2008-07-01 22:57:50 +00:00
|
|
|
|
/* GTK - The GIMP Toolkit
|
2001-03-18 04:50:34 +00:00
|
|
|
|
* Copyright (C) 2000 Red Hat, Inc.
|
|
|
|
|
*
|
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2012-02-27 13:01:10 +00:00
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.Free
|
2001-03-18 04:50:34 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2010-11-06 16:48:32 +00:00
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
|
#include "config.h"
|
2005-08-24 16:17:56 +00:00
|
|
|
|
|
2010-12-24 02:55:47 +00:00
|
|
|
|
#include "gtksettingsprivate.h"
|
2019-03-16 03:48:26 +00:00
|
|
|
|
|
2011-01-26 16:18:11 +00:00
|
|
|
|
#include "gtkcssproviderprivate.h"
|
2016-10-06 19:46:27 +00:00
|
|
|
|
#include "gtkhslaprivate.h"
|
2019-03-16 03:48:26 +00:00
|
|
|
|
#include "gtkintl.h"
|
|
|
|
|
#include "gtkprivate.h"
|
|
|
|
|
#include "gtkscrolledwindow.h"
|
|
|
|
|
#include "gtkstylecontext.h"
|
2011-12-28 21:59:55 +00:00
|
|
|
|
#include "gtkstyleproviderprivate.h"
|
2011-01-04 17:05:05 +00:00
|
|
|
|
#include "gtktypebuiltins.h"
|
2010-09-11 10:48:27 +00:00
|
|
|
|
#include "gtkversion.h"
|
2019-03-16 03:48:26 +00:00
|
|
|
|
#include "gtkwidget.h"
|
|
|
|
|
|
2017-11-17 21:34:04 +00:00
|
|
|
|
#include "gdk/gdk-private.h"
|
2001-03-18 04:50:34 +00:00
|
|
|
|
|
2019-03-16 03:48:26 +00:00
|
|
|
|
#include <string.h>
|
|
|
|
|
|
2005-06-15 19:25:49 +00:00
|
|
|
|
#ifdef GDK_WINDOWING_X11
|
|
|
|
|
#include "x11/gdkx.h"
|
2008-06-06 16:39:37 +00:00
|
|
|
|
#include <pango/pangofc-fontmap.h>
|
2005-06-15 19:25:49 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
2013-03-23 00:31:50 +00:00
|
|
|
|
#ifdef GDK_WINDOWING_WAYLAND
|
|
|
|
|
#include "wayland/gdkwayland.h"
|
2015-06-29 19:37:26 +00:00
|
|
|
|
#include <pango/pangofc-fontmap.h>
|
2013-03-23 00:31:50 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
2013-11-13 11:20:07 +00:00
|
|
|
|
#ifdef GDK_WINDOWING_BROADWAY
|
|
|
|
|
#include "broadway/gdkbroadway.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
2011-03-10 20:20:37 +00:00
|
|
|
|
#ifdef GDK_WINDOWING_QUARTZ
|
|
|
|
|
#include "quartz/gdkquartz.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
2015-05-13 07:45:40 +00:00
|
|
|
|
#ifdef GDK_WINDOWING_WIN32
|
|
|
|
|
#include "win32/gdkwin32.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
2014-12-01 04:43:07 +00:00
|
|
|
|
#ifdef GDK_WINDOWING_QUARTZ
|
|
|
|
|
#define PRINT_PREVIEW_COMMAND "open -a /Applications/Preview.app %f"
|
|
|
|
|
#else
|
|
|
|
|
#define PRINT_PREVIEW_COMMAND "evince --unlink-tempfile --preview --print-settings %s %f"
|
|
|
|
|
#endif
|
|
|
|
|
|
2010-11-06 16:48:32 +00:00
|
|
|
|
/**
|
|
|
|
|
* SECTION:gtksettings
|
|
|
|
|
* @Short_description: Sharing settings between applications
|
|
|
|
|
* @Title: Settings
|
|
|
|
|
*
|
2011-01-26 16:33:19 +00:00
|
|
|
|
* GtkSettings provide a mechanism to share global settings between
|
|
|
|
|
* applications.
|
|
|
|
|
*
|
2010-11-06 16:48:32 +00:00
|
|
|
|
* On the X window system, this sharing is realized by an
|
2014-02-04 23:53:51 +00:00
|
|
|
|
* [XSettings](http://www.freedesktop.org/wiki/Specifications/xsettings-spec)
|
2011-01-26 16:33:19 +00:00
|
|
|
|
* manager that is usually part of the desktop environment, along with
|
|
|
|
|
* utilities that let the user change these settings. In the absence of
|
2019-02-05 10:26:20 +00:00
|
|
|
|
* an Xsettings manager, GTK reads default values for settings from
|
2014-02-03 21:34:03 +00:00
|
|
|
|
* `settings.ini` files in
|
2016-10-23 18:06:33 +00:00
|
|
|
|
* `/etc/gtk-4.0`, `$XDG_CONFIG_DIRS/gtk-4.0`
|
|
|
|
|
* and `$XDG_CONFIG_HOME/gtk-4.0`.
|
2012-09-12 14:10:56 +00:00
|
|
|
|
* These files must be valid key files (see #GKeyFile), and have
|
2011-01-26 16:33:19 +00:00
|
|
|
|
* a section called Settings. Themes can also provide default values
|
2014-02-03 21:34:03 +00:00
|
|
|
|
* for settings by installing a `settings.ini` file
|
|
|
|
|
* next to their `gtk.css` file.
|
2010-11-06 16:48:32 +00:00
|
|
|
|
*
|
2014-10-20 00:47:05 +00:00
|
|
|
|
* Applications can override system-wide settings by setting the property
|
|
|
|
|
* of the GtkSettings object with g_object_set(). This should be restricted
|
|
|
|
|
* to special cases though; GtkSettings are not meant as an application
|
2019-05-08 21:45:17 +00:00
|
|
|
|
* configuration facility.
|
2010-11-06 16:48:32 +00:00
|
|
|
|
*
|
2017-10-30 22:58:05 +00:00
|
|
|
|
* There is one GtkSettings instance per display. It can be obtained with
|
|
|
|
|
* gtk_settings_get_for_display(), but in many cases, it is more convenient
|
2010-11-06 16:48:32 +00:00
|
|
|
|
* to use gtk_widget_get_settings(). gtk_settings_get_default() returns the
|
2017-10-30 22:58:05 +00:00
|
|
|
|
* GtkSettings instance for the default display.
|
2010-11-06 16:48:32 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2013-07-09 20:44:04 +00:00
|
|
|
|
#define DEFAULT_TIMEOUT_INITIAL 500
|
|
|
|
|
#define DEFAULT_TIMEOUT_REPEAT 50
|
2006-03-22 20:17:23 +00:00
|
|
|
|
#define DEFAULT_TIMEOUT_EXPAND 500
|
2005-11-22 12:40:15 +00:00
|
|
|
|
|
2019-05-19 20:04:47 +00:00
|
|
|
|
typedef struct _GtkSettingsClass GtkSettingsClass;
|
|
|
|
|
|
2019-05-19 19:13:19 +00:00
|
|
|
|
struct _GtkSettingsClass
|
|
|
|
|
{
|
|
|
|
|
GObjectClass parent_class;
|
|
|
|
|
|
|
|
|
|
/* Padding for future expansion */
|
|
|
|
|
void (*_gtk_reserved1) (void);
|
|
|
|
|
void (*_gtk_reserved2) (void);
|
|
|
|
|
void (*_gtk_reserved3) (void);
|
|
|
|
|
void (*_gtk_reserved4) (void);
|
|
|
|
|
};
|
|
|
|
|
|
2010-12-24 02:55:47 +00:00
|
|
|
|
typedef struct _GtkSettingsPropertyValue GtkSettingsPropertyValue;
|
2002-10-02 14:22:31 +00:00
|
|
|
|
typedef struct _GtkSettingsValuePrivate GtkSettingsValuePrivate;
|
|
|
|
|
|
2019-05-19 20:04:47 +00:00
|
|
|
|
typedef struct _GtkSettingsPrivate GtkSettingsPrivate;
|
|
|
|
|
|
2010-12-24 02:55:47 +00:00
|
|
|
|
struct _GtkSettingsPrivate
|
|
|
|
|
{
|
|
|
|
|
GData *queued_settings; /* of type GtkSettingsValue* */
|
|
|
|
|
GtkSettingsPropertyValue *property_values;
|
2017-10-30 19:45:37 +00:00
|
|
|
|
GdkDisplay *display;
|
2015-02-06 09:13:11 +00:00
|
|
|
|
GSList *style_cascades;
|
2011-01-28 19:19:30 +00:00
|
|
|
|
GtkCssProvider *theme_provider;
|
2016-05-01 05:10:33 +00:00
|
|
|
|
gint font_size;
|
|
|
|
|
gboolean font_size_absolute;
|
|
|
|
|
gchar *font_family;
|
2016-09-30 02:58:29 +00:00
|
|
|
|
cairo_font_options_t *font_options;
|
2010-12-24 02:55:47 +00:00
|
|
|
|
};
|
|
|
|
|
|
2002-10-02 14:22:31 +00:00
|
|
|
|
struct _GtkSettingsValuePrivate
|
|
|
|
|
{
|
|
|
|
|
GtkSettingsValue public;
|
2002-11-16 01:30:12 +00:00
|
|
|
|
GtkSettingsSource source;
|
2002-10-02 14:22:31 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct _GtkSettingsPropertyValue
|
|
|
|
|
{
|
|
|
|
|
GValue value;
|
2002-11-16 01:30:12 +00:00
|
|
|
|
GtkSettingsSource source;
|
2002-10-02 14:22:31 +00:00
|
|
|
|
};
|
|
|
|
|
|
2001-03-18 04:50:34 +00:00
|
|
|
|
enum {
|
|
|
|
|
PROP_0,
|
2001-05-30 20:40:28 +00:00
|
|
|
|
PROP_DOUBLE_CLICK_TIME,
|
2003-12-16 00:56:48 +00:00
|
|
|
|
PROP_DOUBLE_CLICK_DISTANCE,
|
2001-05-30 20:40:28 +00:00
|
|
|
|
PROP_CURSOR_BLINK,
|
|
|
|
|
PROP_CURSOR_BLINK_TIME,
|
2006-09-01 02:14:30 +00:00
|
|
|
|
PROP_CURSOR_BLINK_TIMEOUT,
|
Allow %NULL for style to mean "revert to default style"
Tue Jun 26 19:39:03 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_style): Allow %NULL
for style to mean "revert to default style"
* gtk/gtkwidget.[ch] (gtk_widget_set_rc_style,
gtk_widget_restore_default_style): Make this functions
deprecated aliases for gtk_widget_set_style (widget, NULL).
* gtk/gtkwidget.[ch]: Remove:
gtk_widget_set_default_style ()
gtk_widget_push_style ()
gtk_widget_pop_style ()
These functions interact are overriden by RC files, and
thus virtually useless, and complicated.
Fri Jun 22 18:49:48 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c: Add a GtkRcContext structure to hold
most of the previous global variables in gtkrc.c. This is
in preparation for multi-head, since each screen can
have different GtkSettings and RC information.
* gtk/gtkrc.[ch]:
* gtk/gtkrc.h (struct _GtkRcStyleClass): Add a
GtkSettings parameter to GtkRcStyle::parse.
* gdk/x11/gdkevents-x11.c gtk/gtksettings.c gtk/gtkrc.c:
Add two new settings gtk-theme-name, gtk-key-theme-name,
for RC files that are loaded by name after reading
the default RC files.
* gtk/gtkrc.c: Allow priorities for styles, as wll as
bindings.
* gtk/gtkenums.h gtk/gtkrc.c: Add GTK_PATH_PRIO_THEME,
and use it by default for RC files loaded via
gtk-theme-name, gtk-key-theme-name.
* gtk/gtkiconfactory.c (gtk_icon_source_set_filename)
gtk/gtkrc.c (gtk_rc_parse_pixmap_path_string)
tests/testgtkrc: Require pathnames to be absolute.
* gtk/gtkrc.c gtk/gtkiconfactory.c: Look up the full filename for
the source when parsing, since the operation of looking up a
pixmap from an RC file depends on the parsing context.
* gtk/gtkrc.c (gtk_rc_context_reparse_all): Automatically
reset RC styles on all widgets when files are reparsed.
* tests/testgtk.c (create_rc_file)
gtk/gtkwindow.c (gtk_window_read_rcfiles):
Simplify, now that gtk_rc_reparse_all() resets styles on
all widgets itself.
* gtk/gtkmain.c (gtk_get_default_language): Fix broken
return value.
* gtk/gtksettings.[ch] (gtk_settings_install_property[_ch]): Remove
GtkSettings argument.
* gtk/gtksettings.[ch] (gtk_settings_get_default): Rename from
gtk_settings_get_global().
* gtk/gtkwidget.[ch]: Add a function gtk_widget_Get_settings()
to get the appropriate GtkSettings for a widget. (For now,
just gets the default GtkSetttings.)
* gtk/gtkcolorsel.c gtk/gtkentry.c gtk/gtkmenu.c gtk/gtkmenubar.c
gtk/gtktextview.c gtk/gtktoolbar.c: Fixes for GtkSettings
changes.
* gtk/gtkrc.[ch]: Add gtk_rc_get_style_by_paths() to allow
getting a style for a path without actually having a widget.
(Allows using a style for a subpart of a widget, for
example.)
* gtk/gtkrc.[ch]: Add gtk_rc_reparse_all_for_setting() to allow forcing
the RC files to be reloaded for just one GtkSettings
(not sure how useful this really is.)
* gtk/gtkrc.h: Deprecate
gtk_rc_add_widget_name/widget_class/class_style
2001-06-30 16:08:25 +00:00
|
|
|
|
PROP_SPLIT_CURSOR,
|
|
|
|
|
PROP_THEME_NAME,
|
2003-07-02 22:44:09 +00:00
|
|
|
|
PROP_ICON_THEME_NAME,
|
2002-02-24 02:24:51 +00:00
|
|
|
|
PROP_DND_DRAG_THRESHOLD,
|
2002-09-24 21:03:58 +00:00
|
|
|
|
PROP_FONT_NAME,
|
2004-02-21 19:17:48 +00:00
|
|
|
|
PROP_XFT_ANTIALIAS,
|
|
|
|
|
PROP_XFT_HINTING,
|
|
|
|
|
PROP_XFT_HINTSTYLE,
|
|
|
|
|
PROP_XFT_RGBA,
|
2004-10-25 05:43:29 +00:00
|
|
|
|
PROP_XFT_DPI,
|
2005-06-15 19:25:49 +00:00
|
|
|
|
PROP_CURSOR_THEME_NAME,
|
|
|
|
|
PROP_CURSOR_THEME_SIZE,
|
2005-10-24 20:01:57 +00:00
|
|
|
|
PROP_ALTERNATIVE_BUTTON_ORDER,
|
2006-12-27 19:52:25 +00:00
|
|
|
|
PROP_ALTERNATIVE_SORT_ARROWS,
|
2005-12-16 18:45:31 +00:00
|
|
|
|
PROP_ENABLE_ANIMATIONS,
|
2006-11-16 12:56:30 +00:00
|
|
|
|
PROP_ERROR_BELL,
|
2006-12-31 05:54:46 +00:00
|
|
|
|
PROP_PRINT_BACKENDS,
|
2007-02-05 14:11:39 +00:00
|
|
|
|
PROP_PRINT_PREVIEW_COMMAND,
|
2007-07-20 10:39:03 +00:00
|
|
|
|
PROP_ENABLE_ACCELS,
|
2008-04-15 22:37:32 +00:00
|
|
|
|
PROP_IM_MODULE,
|
2008-06-06 16:39:37 +00:00
|
|
|
|
PROP_RECENT_FILES_MAX_AGE,
|
2008-07-01 06:22:04 +00:00
|
|
|
|
PROP_FONTCONFIG_TIMESTAMP,
|
|
|
|
|
PROP_SOUND_THEME_NAME,
|
|
|
|
|
PROP_ENABLE_INPUT_FEEDBACK_SOUNDS,
|
2008-07-02 09:32:14 +00:00
|
|
|
|
PROP_ENABLE_EVENT_SOUNDS,
|
2012-08-24 09:49:43 +00:00
|
|
|
|
PROP_PRIMARY_BUTTON_WARPS_SLIDER,
|
2010-10-19 10:47:40 +00:00
|
|
|
|
PROP_APPLICATION_PREFER_DARK_THEME,
|
|
|
|
|
PROP_ENTRY_SELECT_ON_FOCUS,
|
|
|
|
|
PROP_ENTRY_PASSWORD_HINT_TIMEOUT,
|
|
|
|
|
PROP_LABEL_SELECT_ON_FOCUS,
|
2011-12-02 00:57:32 +00:00
|
|
|
|
PROP_SHELL_SHOWS_APP_MENU,
|
2011-11-30 19:46:55 +00:00
|
|
|
|
PROP_SHELL_SHOWS_MENUBAR,
|
2013-11-14 20:01:19 +00:00
|
|
|
|
PROP_SHELL_SHOWS_DESKTOP,
|
2013-12-22 02:58:24 +00:00
|
|
|
|
PROP_DECORATION_LAYOUT,
|
2014-09-25 05:24:44 +00:00
|
|
|
|
PROP_TITLEBAR_DOUBLE_CLICK,
|
|
|
|
|
PROP_TITLEBAR_MIDDLE_CLICK,
|
|
|
|
|
PROP_TITLEBAR_RIGHT_CLICK,
|
2014-01-15 05:33:30 +00:00
|
|
|
|
PROP_DIALOGS_USE_HEADER,
|
2013-02-13 16:05:07 +00:00
|
|
|
|
PROP_ENABLE_PRIMARY_PASTE,
|
2014-03-31 10:22:11 +00:00
|
|
|
|
PROP_RECENT_FILES_ENABLED,
|
2016-03-05 03:25:37 +00:00
|
|
|
|
PROP_LONG_PRESS_TIME,
|
|
|
|
|
PROP_KEYNAV_USE_CARET
|
2001-03-18 04:50:34 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* --- prototypes --- */
|
2017-10-31 03:31:46 +00:00
|
|
|
|
static void gtk_settings_provider_iface_init (GtkStyleProviderInterface *iface);
|
2010-08-30 20:41:12 +00:00
|
|
|
|
|
2010-12-24 02:55:47 +00:00
|
|
|
|
static void gtk_settings_finalize (GObject *object);
|
|
|
|
|
static void gtk_settings_get_property (GObject *object,
|
|
|
|
|
guint property_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec);
|
|
|
|
|
static void gtk_settings_set_property (GObject *object,
|
|
|
|
|
guint property_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec);
|
|
|
|
|
static void gtk_settings_notify (GObject *object,
|
|
|
|
|
GParamSpec *pspec);
|
|
|
|
|
static guint settings_install_property_parser (GtkSettingsClass *class,
|
|
|
|
|
GParamSpec *pspec,
|
|
|
|
|
GtkRcPropertyParser parser);
|
2003-12-16 00:56:48 +00:00
|
|
|
|
static void settings_update_double_click (GtkSettings *settings);
|
2004-09-01 20:30:24 +00:00
|
|
|
|
|
2005-06-15 19:25:49 +00:00
|
|
|
|
static void settings_update_cursor_theme (GtkSettings *settings);
|
2005-08-24 16:17:56 +00:00
|
|
|
|
static void settings_update_font_options (GtkSettings *settings);
|
2016-05-05 17:30:55 +00:00
|
|
|
|
static void settings_update_font_values (GtkSettings *settings);
|
2008-06-06 16:39:37 +00:00
|
|
|
|
static gboolean settings_update_fontconfig (GtkSettings *settings);
|
2016-04-27 04:00:19 +00:00
|
|
|
|
static void settings_update_theme (GtkSettings *settings);
|
|
|
|
|
static gboolean settings_update_xsetting (GtkSettings *settings,
|
|
|
|
|
GParamSpec *pspec,
|
|
|
|
|
gboolean force);
|
2016-05-05 18:13:03 +00:00
|
|
|
|
static void settings_update_xsettings (GtkSettings *settings);
|
2005-06-15 19:25:49 +00:00
|
|
|
|
|
2011-01-26 15:46:40 +00:00
|
|
|
|
static void gtk_settings_load_from_key_file (GtkSettings *settings,
|
|
|
|
|
const gchar *path,
|
|
|
|
|
GtkSettingsSource source);
|
2017-10-30 21:02:35 +00:00
|
|
|
|
static void settings_update_provider (GdkDisplay *display,
|
2012-09-18 02:30:14 +00:00
|
|
|
|
GtkCssProvider **old,
|
|
|
|
|
GtkCssProvider *new);
|
2001-03-18 04:50:34 +00:00
|
|
|
|
|
|
|
|
|
/* --- variables --- */
|
2010-12-24 02:55:47 +00:00
|
|
|
|
static GQuark quark_property_parser = 0;
|
2015-09-12 13:14:47 +00:00
|
|
|
|
static GQuark quark_gtk_settings = 0;
|
2001-03-18 04:50:34 +00:00
|
|
|
|
static GSList *object_list = NULL;
|
2010-12-24 02:55:47 +00:00
|
|
|
|
static guint class_n_properties = 0;
|
2001-03-18 04:50:34 +00:00
|
|
|
|
|
2017-10-30 19:45:37 +00:00
|
|
|
|
static GPtrArray *display_settings;
|
2016-05-06 04:21:08 +00:00
|
|
|
|
|
2001-03-18 04:50:34 +00:00
|
|
|
|
|
2010-08-30 20:41:12 +00:00
|
|
|
|
G_DEFINE_TYPE_EXTENDED (GtkSettings, gtk_settings, G_TYPE_OBJECT, 0,
|
2013-06-27 19:02:52 +00:00
|
|
|
|
G_ADD_PRIVATE (GtkSettings)
|
2010-08-30 20:41:12 +00:00
|
|
|
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_STYLE_PROVIDER,
|
2017-10-31 03:31:46 +00:00
|
|
|
|
gtk_settings_provider_iface_init));
|
2001-03-18 04:50:34 +00:00
|
|
|
|
|
2006-05-02 23:56:43 +00:00
|
|
|
|
/* --- functions --- */
|
2001-03-18 04:50:34 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_settings_init (GtkSettings *settings)
|
|
|
|
|
{
|
2010-12-24 02:55:47 +00:00
|
|
|
|
GtkSettingsPrivate *priv;
|
fix PROP_EVENTS.
Mon Jun 18 02:00:49 2001 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_get_property): fix PROP_EVENTS.
* gtk/Makefile.am:
* gtk/gtk.h: disabled GtkPacker compilation.
* gtk/gtkarg.[hc], gtk/gtkargcollector.c: got rid of these.
* gtk/gtknotebook.c:
* gtk/gtktable.c:
* gtk/gtkbox.c: ported this over to child properties.
* gtk/gtksettings.c: fetch class properties via
g_object_class_list_properties().
* gtk/gtkcontainer.[hc]: implemented child properties, got rid of the
child arg interface. use gobjectnotifyqueue.c for child property
notification.
* gtk/gtkwidget.[hc]: provide necessary means for container child
properties, i.e. ::child_notify signal,
gtk_widget_freeze_child_notify(),
gtk_widget_child_notify(),
gtk_widget_thaw_child_notify().
* tests/testgtk.c: removed inferior property handling code, for
property editing, a generic module should be used, and GLE
coincidentally fullfills that purpose.
* docs/reference/Makefile.am: disabled gtk docs building, gtk-doc
needs to be adapted to g_object_class_list_properties() before this
builds again.
2001-06-19 12:54:10 +00:00
|
|
|
|
GParamSpec **pspecs, **p;
|
|
|
|
|
guint i = 0;
|
2011-01-26 13:57:08 +00:00
|
|
|
|
gchar *path;
|
2012-09-12 14:10:56 +00:00
|
|
|
|
const gchar * const *config_dirs;
|
2010-12-24 02:55:47 +00:00
|
|
|
|
|
2013-06-27 19:02:52 +00:00
|
|
|
|
priv = gtk_settings_get_instance_private (settings);
|
|
|
|
|
|
2010-12-24 02:55:47 +00:00
|
|
|
|
g_datalist_init (&priv->queued_settings);
|
2001-03-18 04:50:34 +00:00
|
|
|
|
object_list = g_slist_prepend (object_list, settings);
|
|
|
|
|
|
2015-02-06 09:13:11 +00:00
|
|
|
|
priv->style_cascades = g_slist_prepend (NULL, _gtk_style_cascade_new ());
|
2012-09-19 14:41:19 +00:00
|
|
|
|
priv->theme_provider = gtk_css_provider_new ();
|
|
|
|
|
|
2001-03-18 04:50:34 +00:00
|
|
|
|
/* build up property array for all yet existing properties and queue
|
|
|
|
|
* notification for them (at least notification for internal properties
|
|
|
|
|
* will instantly be caught)
|
|
|
|
|
*/
|
fix PROP_EVENTS.
Mon Jun 18 02:00:49 2001 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_get_property): fix PROP_EVENTS.
* gtk/Makefile.am:
* gtk/gtk.h: disabled GtkPacker compilation.
* gtk/gtkarg.[hc], gtk/gtkargcollector.c: got rid of these.
* gtk/gtknotebook.c:
* gtk/gtktable.c:
* gtk/gtkbox.c: ported this over to child properties.
* gtk/gtksettings.c: fetch class properties via
g_object_class_list_properties().
* gtk/gtkcontainer.[hc]: implemented child properties, got rid of the
child arg interface. use gobjectnotifyqueue.c for child property
notification.
* gtk/gtkwidget.[hc]: provide necessary means for container child
properties, i.e. ::child_notify signal,
gtk_widget_freeze_child_notify(),
gtk_widget_child_notify(),
gtk_widget_thaw_child_notify().
* tests/testgtk.c: removed inferior property handling code, for
property editing, a generic module should be used, and GLE
coincidentally fullfills that purpose.
* docs/reference/Makefile.am: disabled gtk docs building, gtk-doc
needs to be adapted to g_object_class_list_properties() before this
builds again.
2001-06-19 12:54:10 +00:00
|
|
|
|
pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (settings), NULL);
|
|
|
|
|
for (p = pspecs; *p; p++)
|
|
|
|
|
if ((*p)->owner_type == G_OBJECT_TYPE (settings))
|
|
|
|
|
i++;
|
2010-12-24 02:55:47 +00:00
|
|
|
|
priv->property_values = g_new0 (GtkSettingsPropertyValue, i);
|
fix PROP_EVENTS.
Mon Jun 18 02:00:49 2001 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_get_property): fix PROP_EVENTS.
* gtk/Makefile.am:
* gtk/gtk.h: disabled GtkPacker compilation.
* gtk/gtkarg.[hc], gtk/gtkargcollector.c: got rid of these.
* gtk/gtknotebook.c:
* gtk/gtktable.c:
* gtk/gtkbox.c: ported this over to child properties.
* gtk/gtksettings.c: fetch class properties via
g_object_class_list_properties().
* gtk/gtkcontainer.[hc]: implemented child properties, got rid of the
child arg interface. use gobjectnotifyqueue.c for child property
notification.
* gtk/gtkwidget.[hc]: provide necessary means for container child
properties, i.e. ::child_notify signal,
gtk_widget_freeze_child_notify(),
gtk_widget_child_notify(),
gtk_widget_thaw_child_notify().
* tests/testgtk.c: removed inferior property handling code, for
property editing, a generic module should be used, and GLE
coincidentally fullfills that purpose.
* docs/reference/Makefile.am: disabled gtk docs building, gtk-doc
needs to be adapted to g_object_class_list_properties() before this
builds again.
2001-06-19 12:54:10 +00:00
|
|
|
|
i = 0;
|
coalescing property notifies
2001-08-11 Hans Breuer <hans@breuer.org>
* gtk/gtkalignment.c, gtk/gtkarrow.c, gtk/gtkaspectframe.c,
gtk/gtkcellrenderer.c, gtk/gtkcellrenderertext.c,
gtk/gtkcombo.c, gtk/gtkcurve.c, gtk/gtkfontsel.c,
gtk/gtklayout.c, gtk/gtkmisc.c, gtk/gtkpacker.c,
gtk/gtkprogress.c, gtk/gtkruler.c,, gtk/gtksettings.c,
gtk/gtkspinbutton.c, gtk/gtktexttag.c : coalescing property notifies
* gtk/gtkclist.c, gtk/gtktipsquery.c, gtk/gtktexttag.c,
gtk/gtkwidget.c : added G_SIGNAL_TYPE_STATIC_SCOPE to all
GDK_TYPE_EVENT signals
* gtk/gtkalignment.c : removed 'direct allocation bug',
which Tim discovered while reading the patch
2001-08-11 20:27:36 +00:00
|
|
|
|
g_object_freeze_notify (G_OBJECT (settings));
|
2011-01-26 13:57:08 +00:00
|
|
|
|
|
fix PROP_EVENTS.
Mon Jun 18 02:00:49 2001 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_get_property): fix PROP_EVENTS.
* gtk/Makefile.am:
* gtk/gtk.h: disabled GtkPacker compilation.
* gtk/gtkarg.[hc], gtk/gtkargcollector.c: got rid of these.
* gtk/gtknotebook.c:
* gtk/gtktable.c:
* gtk/gtkbox.c: ported this over to child properties.
* gtk/gtksettings.c: fetch class properties via
g_object_class_list_properties().
* gtk/gtkcontainer.[hc]: implemented child properties, got rid of the
child arg interface. use gobjectnotifyqueue.c for child property
notification.
* gtk/gtkwidget.[hc]: provide necessary means for container child
properties, i.e. ::child_notify signal,
gtk_widget_freeze_child_notify(),
gtk_widget_child_notify(),
gtk_widget_thaw_child_notify().
* tests/testgtk.c: removed inferior property handling code, for
property editing, a generic module should be used, and GLE
coincidentally fullfills that purpose.
* docs/reference/Makefile.am: disabled gtk docs building, gtk-doc
needs to be adapted to g_object_class_list_properties() before this
builds again.
2001-06-19 12:54:10 +00:00
|
|
|
|
for (p = pspecs; *p; p++)
|
2001-03-18 04:50:34 +00:00
|
|
|
|
{
|
fix PROP_EVENTS.
Mon Jun 18 02:00:49 2001 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_get_property): fix PROP_EVENTS.
* gtk/Makefile.am:
* gtk/gtk.h: disabled GtkPacker compilation.
* gtk/gtkarg.[hc], gtk/gtkargcollector.c: got rid of these.
* gtk/gtknotebook.c:
* gtk/gtktable.c:
* gtk/gtkbox.c: ported this over to child properties.
* gtk/gtksettings.c: fetch class properties via
g_object_class_list_properties().
* gtk/gtkcontainer.[hc]: implemented child properties, got rid of the
child arg interface. use gobjectnotifyqueue.c for child property
notification.
* gtk/gtkwidget.[hc]: provide necessary means for container child
properties, i.e. ::child_notify signal,
gtk_widget_freeze_child_notify(),
gtk_widget_child_notify(),
gtk_widget_thaw_child_notify().
* tests/testgtk.c: removed inferior property handling code, for
property editing, a generic module should be used, and GLE
coincidentally fullfills that purpose.
* docs/reference/Makefile.am: disabled gtk docs building, gtk-doc
needs to be adapted to g_object_class_list_properties() before this
builds again.
2001-06-19 12:54:10 +00:00
|
|
|
|
GParamSpec *pspec = *p;
|
2011-01-26 13:57:08 +00:00
|
|
|
|
GType value_type = G_PARAM_SPEC_VALUE_TYPE (pspec);
|
2001-03-18 04:50:34 +00:00
|
|
|
|
|
fix PROP_EVENTS.
Mon Jun 18 02:00:49 2001 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_get_property): fix PROP_EVENTS.
* gtk/Makefile.am:
* gtk/gtk.h: disabled GtkPacker compilation.
* gtk/gtkarg.[hc], gtk/gtkargcollector.c: got rid of these.
* gtk/gtknotebook.c:
* gtk/gtktable.c:
* gtk/gtkbox.c: ported this over to child properties.
* gtk/gtksettings.c: fetch class properties via
g_object_class_list_properties().
* gtk/gtkcontainer.[hc]: implemented child properties, got rid of the
child arg interface. use gobjectnotifyqueue.c for child property
notification.
* gtk/gtkwidget.[hc]: provide necessary means for container child
properties, i.e. ::child_notify signal,
gtk_widget_freeze_child_notify(),
gtk_widget_child_notify(),
gtk_widget_thaw_child_notify().
* tests/testgtk.c: removed inferior property handling code, for
property editing, a generic module should be used, and GLE
coincidentally fullfills that purpose.
* docs/reference/Makefile.am: disabled gtk docs building, gtk-doc
needs to be adapted to g_object_class_list_properties() before this
builds again.
2001-06-19 12:54:10 +00:00
|
|
|
|
if (pspec->owner_type != G_OBJECT_TYPE (settings))
|
2010-12-24 02:55:47 +00:00
|
|
|
|
continue;
|
2011-01-26 13:57:08 +00:00
|
|
|
|
g_value_init (&priv->property_values[i].value, value_type);
|
2010-12-24 02:55:47 +00:00
|
|
|
|
g_param_value_set_default (pspec, &priv->property_values[i].value);
|
2011-01-26 13:57:08 +00:00
|
|
|
|
|
2015-09-07 19:55:02 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (settings), pspec);
|
2010-12-24 02:55:47 +00:00
|
|
|
|
priv->property_values[i].source = GTK_SETTINGS_SOURCE_DEFAULT;
|
fix PROP_EVENTS.
Mon Jun 18 02:00:49 2001 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_get_property): fix PROP_EVENTS.
* gtk/Makefile.am:
* gtk/gtk.h: disabled GtkPacker compilation.
* gtk/gtkarg.[hc], gtk/gtkargcollector.c: got rid of these.
* gtk/gtknotebook.c:
* gtk/gtktable.c:
* gtk/gtkbox.c: ported this over to child properties.
* gtk/gtksettings.c: fetch class properties via
g_object_class_list_properties().
* gtk/gtkcontainer.[hc]: implemented child properties, got rid of the
child arg interface. use gobjectnotifyqueue.c for child property
notification.
* gtk/gtkwidget.[hc]: provide necessary means for container child
properties, i.e. ::child_notify signal,
gtk_widget_freeze_child_notify(),
gtk_widget_child_notify(),
gtk_widget_thaw_child_notify().
* tests/testgtk.c: removed inferior property handling code, for
property editing, a generic module should be used, and GLE
coincidentally fullfills that purpose.
* docs/reference/Makefile.am: disabled gtk docs building, gtk-doc
needs to be adapted to g_object_class_list_properties() before this
builds again.
2001-06-19 12:54:10 +00:00
|
|
|
|
i++;
|
2001-03-18 04:50:34 +00:00
|
|
|
|
}
|
2011-01-26 15:46:40 +00:00
|
|
|
|
g_free (pspecs);
|
2011-01-26 13:57:08 +00:00
|
|
|
|
|
2016-10-23 18:06:33 +00:00
|
|
|
|
path = g_build_filename (_gtk_get_data_prefix (), "share", "gtk-4.0", "settings.ini", NULL);
|
2013-09-06 13:42:01 +00:00
|
|
|
|
if (g_file_test (path, G_FILE_TEST_EXISTS))
|
|
|
|
|
gtk_settings_load_from_key_file (settings, path, GTK_SETTINGS_SOURCE_DEFAULT);
|
|
|
|
|
g_free (path);
|
|
|
|
|
|
2016-10-23 18:06:33 +00:00
|
|
|
|
path = g_build_filename (_gtk_get_sysconfdir (), "gtk-4.0", "settings.ini", NULL);
|
2011-01-26 15:46:40 +00:00
|
|
|
|
if (g_file_test (path, G_FILE_TEST_EXISTS))
|
|
|
|
|
gtk_settings_load_from_key_file (settings, path, GTK_SETTINGS_SOURCE_DEFAULT);
|
|
|
|
|
g_free (path);
|
|
|
|
|
|
2012-09-12 14:10:56 +00:00
|
|
|
|
config_dirs = g_get_system_config_dirs ();
|
2015-10-31 22:13:29 +00:00
|
|
|
|
for (i = 0; config_dirs[i] != NULL; i++)
|
2012-09-12 14:10:56 +00:00
|
|
|
|
{
|
2016-10-23 18:06:33 +00:00
|
|
|
|
path = g_build_filename (config_dirs[i], "gtk-4.0", "settings.ini", NULL);
|
2012-09-12 14:10:56 +00:00
|
|
|
|
if (g_file_test (path, G_FILE_TEST_EXISTS))
|
|
|
|
|
gtk_settings_load_from_key_file (settings, path, GTK_SETTINGS_SOURCE_DEFAULT);
|
|
|
|
|
g_free (path);
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-23 18:06:33 +00:00
|
|
|
|
path = g_build_filename (g_get_user_config_dir (), "gtk-4.0", "settings.ini", NULL);
|
2011-01-26 15:46:40 +00:00
|
|
|
|
if (g_file_test (path, G_FILE_TEST_EXISTS))
|
|
|
|
|
gtk_settings_load_from_key_file (settings, path, GTK_SETTINGS_SOURCE_DEFAULT);
|
2011-01-26 13:57:08 +00:00
|
|
|
|
g_free (path);
|
|
|
|
|
|
coalescing property notifies
2001-08-11 Hans Breuer <hans@breuer.org>
* gtk/gtkalignment.c, gtk/gtkarrow.c, gtk/gtkaspectframe.c,
gtk/gtkcellrenderer.c, gtk/gtkcellrenderertext.c,
gtk/gtkcombo.c, gtk/gtkcurve.c, gtk/gtkfontsel.c,
gtk/gtklayout.c, gtk/gtkmisc.c, gtk/gtkpacker.c,
gtk/gtkprogress.c, gtk/gtkruler.c,, gtk/gtksettings.c,
gtk/gtkspinbutton.c, gtk/gtktexttag.c : coalescing property notifies
* gtk/gtkclist.c, gtk/gtktipsquery.c, gtk/gtktexttag.c,
gtk/gtkwidget.c : added G_SIGNAL_TYPE_STATIC_SCOPE to all
GDK_TYPE_EVENT signals
* gtk/gtkalignment.c : removed 'direct allocation bug',
which Tim discovered while reading the patch
2001-08-11 20:27:36 +00:00
|
|
|
|
g_object_thaw_notify (G_OBJECT (settings));
|
2016-05-04 10:28:59 +00:00
|
|
|
|
|
|
|
|
|
/* ensure that derived fields are initialized */
|
|
|
|
|
if (priv->font_size == 0)
|
|
|
|
|
settings_update_font_values (settings);
|
2001-03-18 04:50:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_settings_class_init (GtkSettingsClass *class)
|
|
|
|
|
{
|
|
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
|
fix warning
2001-04-27 Havoc Pennington <hp@redhat.com>
* gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning
* gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable
* gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip
line/para separators
(gtk_entry_create_layout): set single paragraph mode on the layout
* gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much
spacing between the image and label; instead, inside a button box
the button will get extra space that will go there, but if people
configure button box for 0 chubbiness, then there's no spacing.
* gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding
and min/max size style properties, so people can tune their
chubbiness.
* tests/testgtk.c (make_toolbar): remove calls to removed toolbar
functions
* gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size,
space_style, and button_relief into style properties, remove
functions for setting them
* gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop
it back down
* gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed
types from gtk_widget_style_get
* gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace
with a style property.
* gdk/x11/gdkevents-x11.c: namespace the settings
* gtk/gtkmenubar.c: Add F10 accelerator to move between menubars.
* gtk/gtksettings.c (gtk_settings_class_init): remove code with
side effects from inside g_assert(), so that G_DISABLE_ASSERT can
be used. Also, translate doc strings for settings. Also, namespace
the double-click-time property. Also, remove bell properties crap.
2001-04-28 00:12:47 +00:00
|
|
|
|
guint result;
|
2010-12-24 02:55:47 +00:00
|
|
|
|
|
2001-03-18 04:50:34 +00:00
|
|
|
|
gobject_class->finalize = gtk_settings_finalize;
|
|
|
|
|
gobject_class->get_property = gtk_settings_get_property;
|
|
|
|
|
gobject_class->set_property = gtk_settings_set_property;
|
|
|
|
|
gobject_class->notify = gtk_settings_notify;
|
|
|
|
|
|
|
|
|
|
quark_property_parser = g_quark_from_static_string ("gtk-rc-property-parser");
|
2015-09-12 13:14:47 +00:00
|
|
|
|
quark_gtk_settings = g_quark_from_static_string ("gtk-settings");
|
|
|
|
|
|
fix warning
2001-04-27 Havoc Pennington <hp@redhat.com>
* gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning
* gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable
* gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip
line/para separators
(gtk_entry_create_layout): set single paragraph mode on the layout
* gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much
spacing between the image and label; instead, inside a button box
the button will get extra space that will go there, but if people
configure button box for 0 chubbiness, then there's no spacing.
* gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding
and min/max size style properties, so people can tune their
chubbiness.
* tests/testgtk.c (make_toolbar): remove calls to removed toolbar
functions
* gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size,
space_style, and button_relief into style properties, remove
functions for setting them
* gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop
it back down
* gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed
types from gtk_widget_style_get
* gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace
with a style property.
* gdk/x11/gdkevents-x11.c: namespace the settings
* gtk/gtkmenubar.c: Add F10 accelerator to move between menubars.
* gtk/gtksettings.c (gtk_settings_class_init): remove code with
side effects from inside g_assert(), so that G_DISABLE_ASSERT can
be used. Also, translate doc strings for settings. Also, namespace
the double-click-time property. Also, remove bell properties crap.
2001-04-28 00:12:47 +00:00
|
|
|
|
result = settings_install_property_parser (class,
|
2001-05-30 20:40:28 +00:00
|
|
|
|
g_param_spec_int ("gtk-double-click-time",
|
2004-01-16 23:10:05 +00:00
|
|
|
|
P_("Double Click Time"),
|
|
|
|
|
P_("Maximum time allowed between two clicks for them to be considered a double click (in milliseconds)"),
|
2016-03-07 12:48:29 +00:00
|
|
|
|
0, G_MAXINT, 400,
|
2005-03-22 02:14:55 +00:00
|
|
|
|
GTK_PARAM_READWRITE),
|
fix warning
2001-04-27 Havoc Pennington <hp@redhat.com>
* gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning
* gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable
* gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip
line/para separators
(gtk_entry_create_layout): set single paragraph mode on the layout
* gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much
spacing between the image and label; instead, inside a button box
the button will get extra space that will go there, but if people
configure button box for 0 chubbiness, then there's no spacing.
* gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding
and min/max size style properties, so people can tune their
chubbiness.
* tests/testgtk.c (make_toolbar): remove calls to removed toolbar
functions
* gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size,
space_style, and button_relief into style properties, remove
functions for setting them
* gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop
it back down
* gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed
types from gtk_widget_style_get
* gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace
with a style property.
* gdk/x11/gdkevents-x11.c: namespace the settings
* gtk/gtkmenubar.c: Add F10 accelerator to move between menubars.
* gtk/gtksettings.c (gtk_settings_class_init): remove code with
side effects from inside g_assert(), so that G_DISABLE_ASSERT can
be used. Also, translate doc strings for settings. Also, namespace
the double-click-time property. Also, remove bell properties crap.
2001-04-28 00:12:47 +00:00
|
|
|
|
NULL);
|
2001-05-30 20:40:28 +00:00
|
|
|
|
g_assert (result == PROP_DOUBLE_CLICK_TIME);
|
2003-12-16 00:56:48 +00:00
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_int ("gtk-double-click-distance",
|
2004-01-16 23:10:05 +00:00
|
|
|
|
P_("Double Click Distance"),
|
|
|
|
|
P_("Maximum distance allowed between two clicks for them to be considered a double click (in pixels)"),
|
2003-12-16 00:56:48 +00:00
|
|
|
|
0, G_MAXINT, 5,
|
2005-03-22 02:14:55 +00:00
|
|
|
|
GTK_PARAM_READWRITE),
|
2003-12-16 00:56:48 +00:00
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_DOUBLE_CLICK_DISTANCE);
|
2006-09-01 02:14:30 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkSettings:gtk-cursor-blink:
|
|
|
|
|
*
|
2010-12-24 02:55:47 +00:00
|
|
|
|
* Whether the cursor should blink.
|
2006-09-01 02:14:30 +00:00
|
|
|
|
*
|
2013-08-17 02:45:13 +00:00
|
|
|
|
* Also see the #GtkSettings:gtk-cursor-blink-timeout setting,
|
|
|
|
|
* which allows more flexible control over cursor blinking.
|
2006-09-01 02:14:30 +00:00
|
|
|
|
*/
|
2001-05-30 20:40:28 +00:00
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_boolean ("gtk-cursor-blink",
|
2010-12-24 02:55:47 +00:00
|
|
|
|
P_("Cursor Blink"),
|
|
|
|
|
P_("Whether the cursor should blink"),
|
|
|
|
|
TRUE,
|
2014-07-03 12:34:02 +00:00
|
|
|
|
GTK_PARAM_READWRITE ),
|
2010-12-24 02:55:47 +00:00
|
|
|
|
NULL);
|
2001-05-30 20:40:28 +00:00
|
|
|
|
g_assert (result == PROP_CURSOR_BLINK);
|
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_int ("gtk-cursor-blink-time",
|
2004-01-16 23:10:05 +00:00
|
|
|
|
P_("Cursor Blink Time"),
|
2006-09-01 02:14:30 +00:00
|
|
|
|
P_("Length of the cursor blink cycle, in milliseconds"),
|
2001-05-30 20:40:28 +00:00
|
|
|
|
100, G_MAXINT, 1200,
|
2014-07-03 12:34:02 +00:00
|
|
|
|
GTK_PARAM_READWRITE),
|
2001-05-30 20:40:28 +00:00
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_CURSOR_BLINK_TIME);
|
2010-12-24 02:55:47 +00:00
|
|
|
|
|
2006-09-01 02:14:30 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkSettings:gtk-cursor-blink-timeout:
|
|
|
|
|
*
|
|
|
|
|
* Time after which the cursor stops blinking, in seconds.
|
|
|
|
|
* The timer is reset after each user interaction.
|
|
|
|
|
*
|
|
|
|
|
* Setting this to zero has the same effect as setting
|
2010-12-24 02:55:47 +00:00
|
|
|
|
* #GtkSettings:gtk-cursor-blink to %FALSE.
|
2006-09-01 02:14:30 +00:00
|
|
|
|
*/
|
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_int ("gtk-cursor-blink-timeout",
|
|
|
|
|
P_("Cursor Blink Timeout"),
|
|
|
|
|
P_("Time after which the cursor stops blinking, in seconds"),
|
2013-06-26 16:32:31 +00:00
|
|
|
|
1, G_MAXINT, 10,
|
2014-07-03 12:34:02 +00:00
|
|
|
|
GTK_PARAM_READWRITE),
|
2006-09-01 02:14:30 +00:00
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_CURSOR_BLINK_TIMEOUT);
|
2001-06-08 16:07:00 +00:00
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_boolean ("gtk-split-cursor",
|
2010-12-24 02:55:47 +00:00
|
|
|
|
P_("Split Cursor"),
|
|
|
|
|
P_("Whether two cursors should be displayed for mixed left-to-right and right-to-left text"),
|
|
|
|
|
TRUE,
|
|
|
|
|
GTK_PARAM_READWRITE),
|
2001-06-08 16:07:00 +00:00
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_SPLIT_CURSOR);
|
Allow %NULL for style to mean "revert to default style"
Tue Jun 26 19:39:03 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_style): Allow %NULL
for style to mean "revert to default style"
* gtk/gtkwidget.[ch] (gtk_widget_set_rc_style,
gtk_widget_restore_default_style): Make this functions
deprecated aliases for gtk_widget_set_style (widget, NULL).
* gtk/gtkwidget.[ch]: Remove:
gtk_widget_set_default_style ()
gtk_widget_push_style ()
gtk_widget_pop_style ()
These functions interact are overriden by RC files, and
thus virtually useless, and complicated.
Fri Jun 22 18:49:48 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c: Add a GtkRcContext structure to hold
most of the previous global variables in gtkrc.c. This is
in preparation for multi-head, since each screen can
have different GtkSettings and RC information.
* gtk/gtkrc.[ch]:
* gtk/gtkrc.h (struct _GtkRcStyleClass): Add a
GtkSettings parameter to GtkRcStyle::parse.
* gdk/x11/gdkevents-x11.c gtk/gtksettings.c gtk/gtkrc.c:
Add two new settings gtk-theme-name, gtk-key-theme-name,
for RC files that are loaded by name after reading
the default RC files.
* gtk/gtkrc.c: Allow priorities for styles, as wll as
bindings.
* gtk/gtkenums.h gtk/gtkrc.c: Add GTK_PATH_PRIO_THEME,
and use it by default for RC files loaded via
gtk-theme-name, gtk-key-theme-name.
* gtk/gtkiconfactory.c (gtk_icon_source_set_filename)
gtk/gtkrc.c (gtk_rc_parse_pixmap_path_string)
tests/testgtkrc: Require pathnames to be absolute.
* gtk/gtkrc.c gtk/gtkiconfactory.c: Look up the full filename for
the source when parsing, since the operation of looking up a
pixmap from an RC file depends on the parsing context.
* gtk/gtkrc.c (gtk_rc_context_reparse_all): Automatically
reset RC styles on all widgets when files are reparsed.
* tests/testgtk.c (create_rc_file)
gtk/gtkwindow.c (gtk_window_read_rcfiles):
Simplify, now that gtk_rc_reparse_all() resets styles on
all widgets itself.
* gtk/gtkmain.c (gtk_get_default_language): Fix broken
return value.
* gtk/gtksettings.[ch] (gtk_settings_install_property[_ch]): Remove
GtkSettings argument.
* gtk/gtksettings.[ch] (gtk_settings_get_default): Rename from
gtk_settings_get_global().
* gtk/gtkwidget.[ch]: Add a function gtk_widget_Get_settings()
to get the appropriate GtkSettings for a widget. (For now,
just gets the default GtkSetttings.)
* gtk/gtkcolorsel.c gtk/gtkentry.c gtk/gtkmenu.c gtk/gtkmenubar.c
gtk/gtktextview.c gtk/gtktoolbar.c: Fixes for GtkSettings
changes.
* gtk/gtkrc.[ch]: Add gtk_rc_get_style_by_paths() to allow
getting a style for a path without actually having a widget.
(Allows using a style for a subpart of a widget, for
example.)
* gtk/gtkrc.[ch]: Add gtk_rc_reparse_all_for_setting() to allow forcing
the RC files to be reloaded for just one GtkSettings
(not sure how useful this really is.)
* gtk/gtkrc.h: Deprecate
gtk_rc_add_widget_name/widget_class/class_style
2001-06-30 16:08:25 +00:00
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_string ("gtk-theme-name",
|
2010-12-24 02:55:47 +00:00
|
|
|
|
P_("Theme Name"),
|
2011-01-31 04:34:52 +00:00
|
|
|
|
P_("Name of theme to load"),
|
2014-01-24 13:04:04 +00:00
|
|
|
|
DEFAULT_THEME_NAME,
|
2010-12-24 02:55:47 +00:00
|
|
|
|
GTK_PARAM_READWRITE),
|
Allow %NULL for style to mean "revert to default style"
Tue Jun 26 19:39:03 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_style): Allow %NULL
for style to mean "revert to default style"
* gtk/gtkwidget.[ch] (gtk_widget_set_rc_style,
gtk_widget_restore_default_style): Make this functions
deprecated aliases for gtk_widget_set_style (widget, NULL).
* gtk/gtkwidget.[ch]: Remove:
gtk_widget_set_default_style ()
gtk_widget_push_style ()
gtk_widget_pop_style ()
These functions interact are overriden by RC files, and
thus virtually useless, and complicated.
Fri Jun 22 18:49:48 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c: Add a GtkRcContext structure to hold
most of the previous global variables in gtkrc.c. This is
in preparation for multi-head, since each screen can
have different GtkSettings and RC information.
* gtk/gtkrc.[ch]:
* gtk/gtkrc.h (struct _GtkRcStyleClass): Add a
GtkSettings parameter to GtkRcStyle::parse.
* gdk/x11/gdkevents-x11.c gtk/gtksettings.c gtk/gtkrc.c:
Add two new settings gtk-theme-name, gtk-key-theme-name,
for RC files that are loaded by name after reading
the default RC files.
* gtk/gtkrc.c: Allow priorities for styles, as wll as
bindings.
* gtk/gtkenums.h gtk/gtkrc.c: Add GTK_PATH_PRIO_THEME,
and use it by default for RC files loaded via
gtk-theme-name, gtk-key-theme-name.
* gtk/gtkiconfactory.c (gtk_icon_source_set_filename)
gtk/gtkrc.c (gtk_rc_parse_pixmap_path_string)
tests/testgtkrc: Require pathnames to be absolute.
* gtk/gtkrc.c gtk/gtkiconfactory.c: Look up the full filename for
the source when parsing, since the operation of looking up a
pixmap from an RC file depends on the parsing context.
* gtk/gtkrc.c (gtk_rc_context_reparse_all): Automatically
reset RC styles on all widgets when files are reparsed.
* tests/testgtk.c (create_rc_file)
gtk/gtkwindow.c (gtk_window_read_rcfiles):
Simplify, now that gtk_rc_reparse_all() resets styles on
all widgets itself.
* gtk/gtkmain.c (gtk_get_default_language): Fix broken
return value.
* gtk/gtksettings.[ch] (gtk_settings_install_property[_ch]): Remove
GtkSettings argument.
* gtk/gtksettings.[ch] (gtk_settings_get_default): Rename from
gtk_settings_get_global().
* gtk/gtkwidget.[ch]: Add a function gtk_widget_Get_settings()
to get the appropriate GtkSettings for a widget. (For now,
just gets the default GtkSetttings.)
* gtk/gtkcolorsel.c gtk/gtkentry.c gtk/gtkmenu.c gtk/gtkmenubar.c
gtk/gtktextview.c gtk/gtktoolbar.c: Fixes for GtkSettings
changes.
* gtk/gtkrc.[ch]: Add gtk_rc_get_style_by_paths() to allow
getting a style for a path without actually having a widget.
(Allows using a style for a subpart of a widget, for
example.)
* gtk/gtkrc.[ch]: Add gtk_rc_reparse_all_for_setting() to allow forcing
the RC files to be reloaded for just one GtkSettings
(not sure how useful this really is.)
* gtk/gtkrc.h: Deprecate
gtk_rc_add_widget_name/widget_class/class_style
2001-06-30 16:08:25 +00:00
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_THEME_NAME);
|
2006-01-11 06:20:17 +00:00
|
|
|
|
|
2003-07-02 22:44:09 +00:00
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_string ("gtk-icon-theme-name",
|
2010-12-24 02:55:47 +00:00
|
|
|
|
P_("Icon Theme Name"),
|
|
|
|
|
P_("Name of icon theme to use"),
|
2014-07-10 01:18:18 +00:00
|
|
|
|
DEFAULT_ICON_THEME,
|
2010-12-24 02:55:47 +00:00
|
|
|
|
GTK_PARAM_READWRITE),
|
2003-07-02 22:44:09 +00:00
|
|
|
|
NULL);
|
2004-03-01 19:40:47 +00:00
|
|
|
|
g_assert (result == PROP_ICON_THEME_NAME);
|
2006-01-11 06:20:17 +00:00
|
|
|
|
|
2001-12-09 22:08:30 +00:00
|
|
|
|
result = settings_install_property_parser (class,
|
2010-12-24 02:55:47 +00:00
|
|
|
|
g_param_spec_int ("gtk-dnd-drag-threshold",
|
|
|
|
|
P_("Drag threshold"),
|
|
|
|
|
P_("Number of pixels the cursor can move before dragging"),
|
|
|
|
|
1, G_MAXINT, 8,
|
2005-03-22 02:14:55 +00:00
|
|
|
|
GTK_PARAM_READWRITE),
|
2010-12-24 02:55:47 +00:00
|
|
|
|
NULL);
|
2001-12-09 22:08:30 +00:00
|
|
|
|
g_assert (result == PROP_DND_DRAG_THRESHOLD);
|
2002-02-24 02:24:51 +00:00
|
|
|
|
|
2015-11-23 13:17:49 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkSettings:gtk-font-name:
|
|
|
|
|
*
|
2019-02-05 10:26:20 +00:00
|
|
|
|
* The default font to use. GTK uses the family name and size from this string.
|
2015-11-23 13:17:49 +00:00
|
|
|
|
*/
|
2002-02-24 02:24:51 +00:00
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_string ("gtk-font-name",
|
2010-12-24 02:55:47 +00:00
|
|
|
|
P_("Font Name"),
|
2015-11-23 13:17:49 +00:00
|
|
|
|
P_("The default font family and size to use"),
|
2010-12-24 02:55:47 +00:00
|
|
|
|
"Sans 10",
|
|
|
|
|
GTK_PARAM_READWRITE),
|
2002-02-24 02:24:51 +00:00
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_FONT_NAME);
|
2002-09-24 21:03:58 +00:00
|
|
|
|
|
2004-02-21 19:17:48 +00:00
|
|
|
|
result = settings_install_property_parser (class,
|
2010-12-24 02:55:47 +00:00
|
|
|
|
g_param_spec_int ("gtk-xft-antialias",
|
|
|
|
|
P_("Xft Antialias"),
|
|
|
|
|
P_("Whether to antialias Xft fonts; 0=no, 1=yes, -1=default"),
|
|
|
|
|
-1, 1, -1,
|
|
|
|
|
GTK_PARAM_READWRITE),
|
|
|
|
|
NULL);
|
|
|
|
|
|
2004-02-21 19:17:48 +00:00
|
|
|
|
g_assert (result == PROP_XFT_ANTIALIAS);
|
2010-12-24 02:55:47 +00:00
|
|
|
|
|
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_int ("gtk-xft-hinting",
|
|
|
|
|
P_("Xft Hinting"),
|
|
|
|
|
P_("Whether to hint Xft fonts; 0=no, 1=yes, -1=default"),
|
|
|
|
|
-1, 1, -1,
|
|
|
|
|
GTK_PARAM_READWRITE),
|
|
|
|
|
NULL);
|
|
|
|
|
|
2004-02-21 19:17:48 +00:00
|
|
|
|
g_assert (result == PROP_XFT_HINTING);
|
2010-12-24 02:55:47 +00:00
|
|
|
|
|
2004-02-21 19:17:48 +00:00
|
|
|
|
result = settings_install_property_parser (class,
|
2010-12-24 02:55:47 +00:00
|
|
|
|
g_param_spec_string ("gtk-xft-hintstyle",
|
|
|
|
|
P_("Xft Hint Style"),
|
|
|
|
|
P_("What degree of hinting to use; hintnone, hintslight, hintmedium, or hintfull"),
|
|
|
|
|
NULL,
|
|
|
|
|
GTK_PARAM_READWRITE),
|
2004-02-21 19:17:48 +00:00
|
|
|
|
NULL);
|
2010-12-24 02:55:47 +00:00
|
|
|
|
|
2004-02-21 19:17:48 +00:00
|
|
|
|
g_assert (result == PROP_XFT_HINTSTYLE);
|
2010-12-24 02:55:47 +00:00
|
|
|
|
|
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_string ("gtk-xft-rgba",
|
|
|
|
|
P_("Xft RGBA"),
|
|
|
|
|
P_("Type of subpixel antialiasing; none, rgb, bgr, vrgb, vbgr"),
|
|
|
|
|
NULL,
|
|
|
|
|
GTK_PARAM_READWRITE),
|
|
|
|
|
NULL);
|
|
|
|
|
|
2004-02-21 19:17:48 +00:00
|
|
|
|
g_assert (result == PROP_XFT_RGBA);
|
2010-12-24 02:55:47 +00:00
|
|
|
|
|
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_int ("gtk-xft-dpi",
|
|
|
|
|
P_("Xft DPI"),
|
|
|
|
|
P_("Resolution for Xft, in 1024 * dots/inch. -1 to use default value"),
|
|
|
|
|
-1, 1024*1024, -1,
|
|
|
|
|
GTK_PARAM_READWRITE),
|
|
|
|
|
NULL);
|
|
|
|
|
|
2004-02-21 19:17:48 +00:00
|
|
|
|
g_assert (result == PROP_XFT_DPI);
|
2005-06-15 19:25:49 +00:00
|
|
|
|
|
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_string ("gtk-cursor-theme-name",
|
2010-12-24 02:55:47 +00:00
|
|
|
|
P_("Cursor theme name"),
|
|
|
|
|
P_("Name of the cursor theme to use, or NULL to use the default theme"),
|
|
|
|
|
NULL,
|
|
|
|
|
GTK_PARAM_READWRITE),
|
2005-06-15 19:25:49 +00:00
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_CURSOR_THEME_NAME);
|
|
|
|
|
|
|
|
|
|
result = settings_install_property_parser (class,
|
2010-12-24 02:55:47 +00:00
|
|
|
|
g_param_spec_int ("gtk-cursor-theme-size",
|
|
|
|
|
P_("Cursor theme size"),
|
|
|
|
|
P_("Size to use for cursors, or 0 to use the default size"),
|
|
|
|
|
0, 128, 0,
|
|
|
|
|
GTK_PARAM_READWRITE),
|
|
|
|
|
NULL);
|
|
|
|
|
|
2005-06-15 19:25:49 +00:00
|
|
|
|
g_assert (result == PROP_CURSOR_THEME_SIZE);
|
|
|
|
|
|
2004-10-25 05:43:29 +00:00
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_boolean ("gtk-alternative-button-order",
|
2010-12-24 02:55:47 +00:00
|
|
|
|
P_("Alternative button order"),
|
|
|
|
|
P_("Whether buttons in dialogs should use the alternative button order"),
|
|
|
|
|
FALSE,
|
|
|
|
|
GTK_PARAM_READWRITE),
|
2004-10-25 05:43:29 +00:00
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_ALTERNATIVE_BUTTON_ORDER);
|
2005-10-24 20:01:57 +00:00
|
|
|
|
|
2006-12-27 19:52:25 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkSettings:gtk-alternative-sort-arrows:
|
|
|
|
|
*
|
|
|
|
|
* Controls the direction of the sort indicators in sorted list and tree
|
2007-05-26 06:59:36 +00:00
|
|
|
|
* views. By default an arrow pointing down means the column is sorted
|
|
|
|
|
* in ascending order. When set to %TRUE, this order will be inverted.
|
2006-12-27 19:52:25 +00:00
|
|
|
|
*/
|
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_boolean ("gtk-alternative-sort-arrows",
|
2010-12-24 02:55:47 +00:00
|
|
|
|
P_("Alternative sort indicator direction"),
|
|
|
|
|
P_("Whether the direction of the sort indicators in list and tree views is inverted compared to the default (where down means ascending)"),
|
|
|
|
|
FALSE,
|
|
|
|
|
GTK_PARAM_READWRITE),
|
2006-12-27 19:52:25 +00:00
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_ALTERNATIVE_SORT_ARROWS);
|
|
|
|
|
|
2005-12-01 20:49:17 +00:00
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_boolean ("gtk-enable-animations",
|
|
|
|
|
P_("Enable Animations"),
|
|
|
|
|
P_("Whether to enable toolkit-wide animations."),
|
|
|
|
|
TRUE,
|
|
|
|
|
GTK_PARAM_READWRITE),
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
g_assert (result == PROP_ENABLE_ANIMATIONS);
|
2005-12-16 18:45:31 +00:00
|
|
|
|
|
2006-11-16 12:56:30 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkSettings:gtk-error-bell:
|
|
|
|
|
*
|
|
|
|
|
* When %TRUE, keyboard navigation and other input-related errors
|
|
|
|
|
* will cause a beep. Since the error bell is implemented using
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_beep(), the windowing system may offer ways to
|
2006-11-16 12:56:30 +00:00
|
|
|
|
* configure the error bell in many ways, such as flashing the
|
|
|
|
|
* window or similar visual effects.
|
|
|
|
|
*/
|
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_boolean ("gtk-error-bell",
|
|
|
|
|
P_("Error Bell"),
|
|
|
|
|
P_("When TRUE, keyboard navigation and other errors will cause a beep"),
|
|
|
|
|
TRUE,
|
|
|
|
|
GTK_PARAM_READWRITE),
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
g_assert (result == PROP_ERROR_BELL);
|
|
|
|
|
|
2006-12-31 05:54:46 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkSettings:gtk-print-backends:
|
|
|
|
|
*
|
|
|
|
|
* A comma-separated list of print backends to use in the print
|
2019-02-05 10:26:20 +00:00
|
|
|
|
* dialog. Available print backends depend on the GTK installation,
|
2009-08-09 02:43:16 +00:00
|
|
|
|
* and may include "file", "cups", "lpr" or "papi".
|
2006-12-31 05:54:46 +00:00
|
|
|
|
*/
|
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_string ("gtk-print-backends",
|
|
|
|
|
P_("Default print backend"),
|
|
|
|
|
P_("List of the GtkPrintBackend backends to use by default"),
|
|
|
|
|
GTK_PRINT_BACKENDS,
|
|
|
|
|
GTK_PARAM_READWRITE),
|
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_PRINT_BACKENDS);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkSettings:gtk-print-preview-command:
|
|
|
|
|
*
|
|
|
|
|
* A command to run for displaying the print preview. The command
|
2014-03-28 20:55:03 +00:00
|
|
|
|
* should contain a `%f` placeholder, which will get replaced by
|
|
|
|
|
* the path to the pdf file. The command may also contain a `%s`
|
2007-04-29 06:59:27 +00:00
|
|
|
|
* placeholder, which will get replaced by the path to a file
|
2010-12-24 02:55:47 +00:00
|
|
|
|
* containing the print settings in the format produced by
|
2007-04-29 06:59:27 +00:00
|
|
|
|
* gtk_print_settings_to_file().
|
2006-12-31 05:54:46 +00:00
|
|
|
|
*
|
|
|
|
|
* The preview application is responsible for removing the pdf file
|
2007-04-29 06:59:27 +00:00
|
|
|
|
* and the print settings file when it is done.
|
2006-12-31 05:54:46 +00:00
|
|
|
|
*/
|
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_string ("gtk-print-preview-command",
|
|
|
|
|
P_("Default command to run when displaying a print preview"),
|
|
|
|
|
P_("Command to run when displaying a print preview"),
|
2014-12-01 04:43:07 +00:00
|
|
|
|
PRINT_PREVIEW_COMMAND,
|
2006-12-31 05:54:46 +00:00
|
|
|
|
GTK_PARAM_READWRITE),
|
2010-12-24 02:55:47 +00:00
|
|
|
|
NULL);
|
2006-12-31 05:54:46 +00:00
|
|
|
|
g_assert (result == PROP_PRINT_PREVIEW_COMMAND);
|
2007-02-05 14:11:39 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkSettings:gtk-enable-accels:
|
|
|
|
|
*
|
|
|
|
|
* Whether menu items should have visible accelerators which can be
|
|
|
|
|
* activated.
|
|
|
|
|
*/
|
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_boolean ("gtk-enable-accels",
|
|
|
|
|
P_("Enable Accelerators"),
|
|
|
|
|
P_("Whether menu items should have accelerators"),
|
|
|
|
|
TRUE,
|
|
|
|
|
GTK_PARAM_READWRITE),
|
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_ENABLE_ACCELS);
|
2007-07-20 10:39:03 +00:00
|
|
|
|
|
2007-12-18 03:24:17 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkSettings:gtk-im-module:
|
|
|
|
|
*
|
2010-12-24 02:55:47 +00:00
|
|
|
|
* Which IM (input method) module should be used by default. This is the
|
|
|
|
|
* input method that will be used if the user has not explicitly chosen
|
|
|
|
|
* another input method from the IM context menu.
|
2019-02-05 10:26:20 +00:00
|
|
|
|
* This also can be a colon-separated list of input methods, which GTK
|
2011-11-05 05:47:46 +00:00
|
|
|
|
* will try in turn until it finds one available on the system.
|
2009-01-15 16:53:27 +00:00
|
|
|
|
*
|
2013-06-26 13:04:24 +00:00
|
|
|
|
* See #GtkIMContext.
|
2007-12-18 03:24:17 +00:00
|
|
|
|
*/
|
|
|
|
|
result = settings_install_property_parser (class,
|
2010-12-24 02:55:47 +00:00
|
|
|
|
g_param_spec_string ("gtk-im-module",
|
|
|
|
|
P_("Default IM module"),
|
|
|
|
|
P_("Which IM module should be used by default"),
|
|
|
|
|
NULL,
|
|
|
|
|
GTK_PARAM_READWRITE),
|
|
|
|
|
NULL);
|
2007-12-18 03:24:17 +00:00
|
|
|
|
g_assert (result == PROP_IM_MODULE);
|
2008-04-15 22:37:32 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkSettings:gtk-recent-files-max-age:
|
|
|
|
|
*
|
|
|
|
|
* The maximum age, in days, of the items inside the recently used
|
|
|
|
|
* resources list. Items older than this setting will be excised
|
|
|
|
|
* from the list. If set to 0, the list will always be empty; if
|
|
|
|
|
* set to -1, no item will be removed.
|
|
|
|
|
*/
|
|
|
|
|
result = settings_install_property_parser (class,
|
2010-12-24 02:55:47 +00:00
|
|
|
|
g_param_spec_int ("gtk-recent-files-max-age",
|
|
|
|
|
P_("Recent Files Max Age"),
|
|
|
|
|
P_("Maximum age of recently used files, in days"),
|
|
|
|
|
-1, G_MAXINT,
|
|
|
|
|
30,
|
|
|
|
|
GTK_PARAM_READWRITE),
|
|
|
|
|
NULL);
|
2008-04-15 22:37:32 +00:00
|
|
|
|
g_assert (result == PROP_RECENT_FILES_MAX_AGE);
|
2008-06-06 16:39:37 +00:00
|
|
|
|
|
|
|
|
|
result = settings_install_property_parser (class,
|
2010-12-24 02:55:47 +00:00
|
|
|
|
g_param_spec_uint ("gtk-fontconfig-timestamp",
|
|
|
|
|
P_("Fontconfig configuration timestamp"),
|
|
|
|
|
P_("Timestamp of current fontconfig configuration"),
|
|
|
|
|
0, G_MAXUINT, 0,
|
|
|
|
|
GTK_PARAM_READWRITE),
|
|
|
|
|
NULL);
|
|
|
|
|
|
2008-06-06 16:39:37 +00:00
|
|
|
|
g_assert (result == PROP_FONTCONFIG_TIMESTAMP);
|
2008-07-02 09:32:14 +00:00
|
|
|
|
|
2008-07-01 06:22:04 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkSettings:gtk-sound-theme-name:
|
|
|
|
|
*
|
|
|
|
|
* The XDG sound theme to use for event sounds.
|
|
|
|
|
*
|
2014-02-04 23:53:51 +00:00
|
|
|
|
* See the [Sound Theme Specifications](http://www.freedesktop.org/wiki/Specifications/sound-theme-spec)
|
2008-07-01 06:22:04 +00:00
|
|
|
|
* for more information on event sounds and sound themes.
|
|
|
|
|
*
|
2019-02-05 10:26:20 +00:00
|
|
|
|
* GTK itself does not support event sounds, you have to use a loadable
|
2008-07-01 06:22:04 +00:00
|
|
|
|
* module like the one that comes with libcanberra.
|
|
|
|
|
*/
|
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_string ("gtk-sound-theme-name",
|
|
|
|
|
P_("Sound Theme Name"),
|
|
|
|
|
P_("XDG sound theme name"),
|
|
|
|
|
"freedesktop",
|
|
|
|
|
GTK_PARAM_READWRITE),
|
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_SOUND_THEME_NAME);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkSettings:gtk-enable-input-feedback-sounds:
|
|
|
|
|
*
|
|
|
|
|
* Whether to play event sounds as feedback to user input.
|
|
|
|
|
*
|
2014-02-04 23:53:51 +00:00
|
|
|
|
* See the [Sound Theme Specifications](http://www.freedesktop.org/wiki/Specifications/sound-theme-spec)
|
2008-07-01 06:22:04 +00:00
|
|
|
|
* for more information on event sounds and sound themes.
|
|
|
|
|
*
|
2019-02-05 10:26:20 +00:00
|
|
|
|
* GTK itself does not support event sounds, you have to use a loadable
|
2008-07-01 06:22:04 +00:00
|
|
|
|
* module like the one that comes with libcanberra.
|
|
|
|
|
*/
|
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_boolean ("gtk-enable-input-feedback-sounds",
|
2008-08-03 19:25:00 +00:00
|
|
|
|
/* Translators: this means sounds that are played as feedback to user input */
|
2010-12-24 02:55:47 +00:00
|
|
|
|
P_("Audible Input Feedback"),
|
|
|
|
|
P_("Whether to play event sounds as feedback to user input"),
|
|
|
|
|
TRUE,
|
|
|
|
|
GTK_PARAM_READWRITE),
|
2008-07-01 06:22:04 +00:00
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_ENABLE_INPUT_FEEDBACK_SOUNDS);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkSettings:gtk-enable-event-sounds:
|
|
|
|
|
*
|
|
|
|
|
* Whether to play any event sounds at all.
|
|
|
|
|
*
|
2014-02-04 23:53:51 +00:00
|
|
|
|
* See the [Sound Theme Specifications](http://www.freedesktop.org/wiki/Specifications/sound-theme-spec)
|
2008-07-01 06:22:04 +00:00
|
|
|
|
* for more information on event sounds and sound themes.
|
|
|
|
|
*
|
2019-02-05 10:26:20 +00:00
|
|
|
|
* GTK itself does not support event sounds, you have to use a loadable
|
2008-07-01 06:22:04 +00:00
|
|
|
|
* module like the one that comes with libcanberra.
|
|
|
|
|
*/
|
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_boolean ("gtk-enable-event-sounds",
|
2010-12-24 02:55:47 +00:00
|
|
|
|
P_("Enable Event Sounds"),
|
|
|
|
|
P_("Whether to play any event sounds at all"),
|
|
|
|
|
TRUE,
|
|
|
|
|
GTK_PARAM_READWRITE),
|
2008-07-01 06:22:04 +00:00
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_ENABLE_EVENT_SOUNDS);
|
2008-07-02 09:32:14 +00:00
|
|
|
|
|
2012-08-24 09:49:43 +00:00
|
|
|
|
/**
|
2012-09-13 04:10:50 +00:00
|
|
|
|
* GtkSettings:gtk-primary-button-warps-slider:
|
2012-08-24 09:49:43 +00:00
|
|
|
|
*
|
2017-10-11 20:23:20 +00:00
|
|
|
|
* If the value of this setting is %TRUE, clicking the primary button in a
|
|
|
|
|
* #GtkRange trough will move the slider, and hence set the range’s value, to
|
|
|
|
|
* the point that you clicked. If it is %FALSE, a primary click will cause the
|
|
|
|
|
* slider/value to move by the range’s page-size towards the point clicked.
|
|
|
|
|
*
|
|
|
|
|
* Whichever action you choose for the primary button, the other action will
|
2019-02-05 10:26:20 +00:00
|
|
|
|
* be available by holding Shift and primary-clicking, or (since GTK 3.22.25)
|
2017-10-11 21:35:31 +00:00
|
|
|
|
* clicking the middle mouse button.
|
2012-08-24 09:49:43 +00:00
|
|
|
|
*/
|
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_boolean ("gtk-primary-button-warps-slider",
|
|
|
|
|
P_("Primary button warps slider"),
|
|
|
|
|
P_("Whether a primary click on the trough should warp the slider into position"),
|
|
|
|
|
TRUE,
|
|
|
|
|
GTK_PARAM_READWRITE),
|
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_PRIMARY_BUTTON_WARPS_SLIDER);
|
|
|
|
|
|
2010-05-06 19:35:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkSettings:gtk-application-prefer-dark-theme:
|
|
|
|
|
*
|
2019-02-05 10:26:20 +00:00
|
|
|
|
* Whether the application prefers to use a dark theme. If a GTK theme
|
2010-05-06 19:35:52 +00:00
|
|
|
|
* includes a dark variant, it will be used instead of the configured
|
|
|
|
|
* theme.
|
|
|
|
|
*
|
|
|
|
|
* Some applications benefit from minimizing the amount of light pollution that
|
|
|
|
|
* interferes with the content. Good candidates for dark themes are photo and
|
|
|
|
|
* video editors that make the actual content get all the attention and minimize
|
|
|
|
|
* the distraction of the chrome.
|
|
|
|
|
*
|
|
|
|
|
* Dark themes should not be used for documents, where large spaces are white/light
|
|
|
|
|
* and the dark chrome creates too much contrast (web browser, text editor...).
|
|
|
|
|
*/
|
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_boolean ("gtk-application-prefer-dark-theme",
|
|
|
|
|
P_("Application prefers a dark theme"),
|
|
|
|
|
P_("Whether the application prefers to have a dark theme."),
|
|
|
|
|
FALSE,
|
|
|
|
|
GTK_PARAM_READWRITE),
|
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_APPLICATION_PREFER_DARK_THEME);
|
2010-10-19 10:47:40 +00:00
|
|
|
|
|
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_boolean ("gtk-entry-select-on-focus",
|
|
|
|
|
P_("Select on focus"),
|
|
|
|
|
P_("Whether to select the contents of an entry when it is focused"),
|
|
|
|
|
TRUE,
|
|
|
|
|
GTK_PARAM_READWRITE),
|
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_ENTRY_SELECT_ON_FOCUS);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkSettings:gtk-entry-password-hint-timeout:
|
|
|
|
|
*
|
|
|
|
|
* How long to show the last input character in hidden
|
|
|
|
|
* entries. This value is in milliseconds. 0 disables showing the
|
|
|
|
|
* last char. 600 is a good value for enabling it.
|
|
|
|
|
*/
|
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_uint ("gtk-entry-password-hint-timeout",
|
|
|
|
|
P_("Password Hint Timeout"),
|
|
|
|
|
P_("How long to show the last input character in hidden entries"),
|
|
|
|
|
0, G_MAXUINT,
|
2013-08-31 04:14:58 +00:00
|
|
|
|
0,
|
|
|
|
|
GTK_PARAM_READWRITE),
|
2010-10-19 10:47:40 +00:00
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_ENTRY_PASSWORD_HINT_TIMEOUT);
|
|
|
|
|
|
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_boolean ("gtk-label-select-on-focus",
|
|
|
|
|
P_("Select on focus"),
|
|
|
|
|
P_("Whether to select the contents of a selectable label when it is focused"),
|
|
|
|
|
TRUE,
|
|
|
|
|
GTK_PARAM_READWRITE),
|
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_LABEL_SELECT_ON_FOCUS);
|
|
|
|
|
|
2011-11-30 03:28:11 +00:00
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_boolean ("gtk-shell-shows-app-menu",
|
|
|
|
|
P_("Desktop shell shows app menu"),
|
2011-12-01 00:14:48 +00:00
|
|
|
|
P_("Set to TRUE if the desktop environment "
|
|
|
|
|
"is displaying the app menu, FALSE if "
|
|
|
|
|
"the app should display it itself."),
|
2011-11-30 03:28:11 +00:00
|
|
|
|
FALSE, GTK_PARAM_READWRITE),
|
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_SHELL_SHOWS_APP_MENU);
|
|
|
|
|
|
2011-12-02 00:57:32 +00:00
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_boolean ("gtk-shell-shows-menubar",
|
|
|
|
|
P_("Desktop shell shows the menubar"),
|
|
|
|
|
P_("Set to TRUE if the desktop environment "
|
|
|
|
|
"is displaying the menubar, FALSE if "
|
|
|
|
|
"the app should display it itself."),
|
|
|
|
|
FALSE, GTK_PARAM_READWRITE),
|
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_SHELL_SHOWS_MENUBAR);
|
2011-11-30 03:28:11 +00:00
|
|
|
|
|
2013-11-14 20:01:19 +00:00
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_boolean ("gtk-shell-shows-desktop",
|
|
|
|
|
P_("Desktop environment shows the desktop folder"),
|
|
|
|
|
P_("Set to TRUE if the desktop environment "
|
|
|
|
|
"is displaying the desktop folder, FALSE "
|
|
|
|
|
"if not."),
|
2013-11-26 18:54:44 +00:00
|
|
|
|
TRUE, GTK_PARAM_READWRITE),
|
2013-11-14 20:01:19 +00:00
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_SHELL_SHOWS_DESKTOP);
|
|
|
|
|
|
2013-12-22 02:58:24 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkSettings:gtk-decoration-layout:
|
|
|
|
|
*
|
|
|
|
|
* This setting determines which buttons should be put in the
|
|
|
|
|
* titlebar of client-side decorated windows, and whether they
|
|
|
|
|
* should be placed at the left of right.
|
|
|
|
|
*
|
|
|
|
|
* The format of the string is button names, separated by commas.
|
|
|
|
|
* A colon separates the buttons that should appear on the left
|
|
|
|
|
* from those on the right. Recognized button names are minimize,
|
|
|
|
|
* maximize, close, icon (the window icon) and menu (a menu button
|
|
|
|
|
* for the fallback app menu).
|
|
|
|
|
*
|
|
|
|
|
* For example, "menu:minimize,maximize,close" specifies a menu
|
|
|
|
|
* on the left, and minimize, maximize and close buttons on the right.
|
|
|
|
|
*
|
|
|
|
|
* Note that buttons will only be shown when they are meaningful.
|
|
|
|
|
* E.g. a menu button only appears when the desktop shell does not
|
|
|
|
|
* show the app menu, and a close button only appears on a window
|
|
|
|
|
* that can be closed.
|
|
|
|
|
*
|
|
|
|
|
* Also note that the setting can be overridden with the
|
|
|
|
|
* #GtkHeaderBar:decoration-layout property.
|
|
|
|
|
*/
|
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_string ("gtk-decoration-layout",
|
|
|
|
|
P_("Decoration Layout"),
|
|
|
|
|
P_("The layout for window decorations"),
|
2014-06-28 01:29:18 +00:00
|
|
|
|
"menu:minimize,maximize,close", GTK_PARAM_READWRITE),
|
2013-12-22 02:58:24 +00:00
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_DECORATION_LAYOUT);
|
|
|
|
|
|
2014-09-25 05:24:44 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkSettings:gtk-titlebar-double-click:
|
|
|
|
|
*
|
|
|
|
|
* This setting determines the action to take when a double-click
|
|
|
|
|
* occurs on the titlebar of client-side decorated windows.
|
|
|
|
|
*
|
|
|
|
|
* Recognized actions are minimize, toggle-maximize, menu, lower
|
|
|
|
|
* or none.
|
|
|
|
|
*/
|
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_string ("gtk-titlebar-double-click",
|
|
|
|
|
P_("Titlebar double-click action"),
|
|
|
|
|
P_("The action to take on titlebar double-click"),
|
|
|
|
|
"toggle-maximize", GTK_PARAM_READWRITE),
|
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_TITLEBAR_DOUBLE_CLICK);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkSettings:gtk-titlebar-middle-click:
|
|
|
|
|
*
|
|
|
|
|
* This setting determines the action to take when a middle-click
|
|
|
|
|
* occurs on the titlebar of client-side decorated windows.
|
|
|
|
|
*
|
|
|
|
|
* Recognized actions are minimize, toggle-maximize, menu, lower
|
|
|
|
|
* or none.
|
|
|
|
|
*/
|
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_string ("gtk-titlebar-middle-click",
|
|
|
|
|
P_("Titlebar middle-click action"),
|
|
|
|
|
P_("The action to take on titlebar middle-click"),
|
|
|
|
|
"none", GTK_PARAM_READWRITE),
|
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_TITLEBAR_MIDDLE_CLICK);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkSettings:gtk-titlebar-right-click:
|
|
|
|
|
*
|
|
|
|
|
* This setting determines the action to take when a right-click
|
|
|
|
|
* occurs on the titlebar of client-side decorated windows.
|
|
|
|
|
*
|
|
|
|
|
* Recognized actions are minimize, toggle-maximize, menu, lower
|
|
|
|
|
* or none.
|
|
|
|
|
*/
|
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_string ("gtk-titlebar-right-click",
|
|
|
|
|
P_("Titlebar right-click action"),
|
|
|
|
|
P_("The action to take on titlebar right-click"),
|
|
|
|
|
"menu", GTK_PARAM_READWRITE),
|
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_TITLEBAR_RIGHT_CLICK);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-01-15 05:33:30 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkSettings:gtk-dialogs-use-header:
|
|
|
|
|
*
|
2019-02-05 10:26:20 +00:00
|
|
|
|
* Whether builtin GTK dialogs such as the file chooser, the
|
2014-01-15 05:33:30 +00:00
|
|
|
|
* color chooser or the font chooser will use a header bar at
|
|
|
|
|
* the top to show action widgets, or an action area at the bottom.
|
|
|
|
|
*
|
|
|
|
|
* This setting does not affect custom dialogs using GtkDialog
|
|
|
|
|
* directly, or message dialogs.
|
|
|
|
|
*/
|
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_boolean ("gtk-dialogs-use-header",
|
|
|
|
|
P_("Dialogs use header bar"),
|
2019-02-05 10:26:20 +00:00
|
|
|
|
P_("Whether builtin GTK dialogs should use a header bar instead of an action area."),
|
2014-01-15 05:33:30 +00:00
|
|
|
|
FALSE,
|
|
|
|
|
GTK_PARAM_READWRITE),
|
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_DIALOGS_USE_HEADER);
|
|
|
|
|
|
2011-11-30 19:46:55 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkSettings:gtk-enable-primary-paste:
|
|
|
|
|
*
|
|
|
|
|
* Whether a middle click on a mouse should paste the
|
|
|
|
|
* 'PRIMARY' clipboard content at the cursor location.
|
|
|
|
|
*/
|
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_boolean ("gtk-enable-primary-paste",
|
|
|
|
|
P_("Enable primary paste"),
|
2016-10-03 16:20:03 +00:00
|
|
|
|
P_("Whether a middle click on a mouse should paste the “PRIMARY” clipboard content at the cursor location."),
|
2013-08-02 14:42:41 +00:00
|
|
|
|
TRUE,
|
2011-11-30 19:46:55 +00:00
|
|
|
|
GTK_PARAM_READWRITE),
|
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_ENABLE_PRIMARY_PASTE);
|
|
|
|
|
|
2013-02-13 16:05:07 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkSettings:gtk-recent-files-enabled:
|
|
|
|
|
*
|
2019-02-05 10:26:20 +00:00
|
|
|
|
* Whether GTK should keep track of items inside the recently used
|
2013-02-13 16:05:07 +00:00
|
|
|
|
* resources list. If set to %FALSE, the list will always be empty.
|
|
|
|
|
*/
|
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_boolean ("gtk-recent-files-enabled",
|
|
|
|
|
P_("Recent Files Enabled"),
|
2019-02-05 10:26:20 +00:00
|
|
|
|
P_("Whether GTK remembers recent files"),
|
2013-02-13 16:05:07 +00:00
|
|
|
|
TRUE,
|
|
|
|
|
GTK_PARAM_READWRITE),
|
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_RECENT_FILES_ENABLED);
|
2014-03-31 10:22:11 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkSettings:gtk-long-press-time:
|
|
|
|
|
*
|
|
|
|
|
* The time for a button or touch press to be considered a "long press".
|
|
|
|
|
*/
|
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_uint ("gtk-long-press-time",
|
|
|
|
|
P_("Long press time"),
|
|
|
|
|
P_("Time for a button/touch press to be considered a long press (in milliseconds)"),
|
|
|
|
|
0, G_MAXINT, 500,
|
|
|
|
|
GTK_PARAM_READWRITE),
|
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_LONG_PRESS_TIME);
|
2016-03-05 03:25:37 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkSettings:gtk-keynav-use-caret:
|
|
|
|
|
*
|
2019-02-05 10:26:20 +00:00
|
|
|
|
* Whether GTK should make sure that text can be navigated with
|
2016-03-05 03:25:37 +00:00
|
|
|
|
* a caret, even if it is not editable. This is useful when using
|
|
|
|
|
* a screen reader.
|
|
|
|
|
*/
|
|
|
|
|
result = settings_install_property_parser (class,
|
|
|
|
|
g_param_spec_boolean ("gtk-keynav-use-caret",
|
|
|
|
|
P_("Whether to show cursor in text"),
|
|
|
|
|
P_("Whether to show cursor in text"),
|
|
|
|
|
FALSE,
|
|
|
|
|
GTK_PARAM_READWRITE),
|
|
|
|
|
NULL);
|
|
|
|
|
g_assert (result == PROP_KEYNAV_USE_CARET);
|
2001-03-18 04:50:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-12-01 00:24:12 +00:00
|
|
|
|
static GtkSettings *
|
2017-10-31 03:31:46 +00:00
|
|
|
|
gtk_settings_style_provider_get_settings (GtkStyleProvider *provider)
|
2012-12-01 00:24:12 +00:00
|
|
|
|
{
|
|
|
|
|
return GTK_SETTINGS (provider);
|
|
|
|
|
}
|
|
|
|
|
|
2011-12-28 21:59:55 +00:00
|
|
|
|
static void
|
2017-10-31 03:31:46 +00:00
|
|
|
|
gtk_settings_provider_iface_init (GtkStyleProviderInterface *iface)
|
2011-12-28 21:59:55 +00:00
|
|
|
|
{
|
2012-12-01 00:24:12 +00:00
|
|
|
|
iface->get_settings = gtk_settings_style_provider_get_settings;
|
2011-12-28 21:59:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-03-18 04:50:34 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_settings_finalize (GObject *object)
|
|
|
|
|
{
|
|
|
|
|
GtkSettings *settings = GTK_SETTINGS (object);
|
2019-05-19 20:04:47 +00:00
|
|
|
|
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
|
2001-03-18 04:50:34 +00:00
|
|
|
|
guint i;
|
|
|
|
|
|
|
|
|
|
object_list = g_slist_remove (object_list, settings);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < class_n_properties; i++)
|
2010-12-24 02:55:47 +00:00
|
|
|
|
g_value_unset (&priv->property_values[i].value);
|
|
|
|
|
g_free (priv->property_values);
|
|
|
|
|
|
|
|
|
|
g_datalist_clear (&priv->queued_settings);
|
2001-03-18 04:50:34 +00:00
|
|
|
|
|
2017-10-30 21:02:35 +00:00
|
|
|
|
settings_update_provider (priv->display, &priv->theme_provider, NULL);
|
2015-02-06 09:13:11 +00:00
|
|
|
|
g_slist_free_full (priv->style_cascades, g_object_unref);
|
2011-01-28 19:19:30 +00:00
|
|
|
|
|
2016-09-30 02:58:29 +00:00
|
|
|
|
if (priv->font_options)
|
|
|
|
|
cairo_font_options_destroy (priv->font_options);
|
|
|
|
|
|
2016-05-01 05:10:33 +00:00
|
|
|
|
g_free (priv->font_family);
|
|
|
|
|
|
2006-05-02 23:56:43 +00:00
|
|
|
|
G_OBJECT_CLASS (gtk_settings_parent_class)->finalize (object);
|
2001-03-18 04:50:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-02-20 01:02:05 +00:00
|
|
|
|
GtkStyleCascade *
|
2015-02-06 09:13:11 +00:00
|
|
|
|
_gtk_settings_get_style_cascade (GtkSettings *settings,
|
|
|
|
|
gint scale)
|
2014-02-20 01:02:05 +00:00
|
|
|
|
{
|
2019-05-19 20:04:47 +00:00
|
|
|
|
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
|
2015-02-06 09:13:11 +00:00
|
|
|
|
GtkStyleCascade *new_cascade;
|
|
|
|
|
GSList *list;
|
|
|
|
|
|
2014-02-20 01:02:05 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_SETTINGS (settings), NULL);
|
|
|
|
|
|
2015-02-06 09:13:11 +00:00
|
|
|
|
for (list = priv->style_cascades; list; list = list->next)
|
|
|
|
|
{
|
|
|
|
|
if (_gtk_style_cascade_get_scale (list->data) == scale)
|
|
|
|
|
return list->data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* We are guaranteed to have the special cascade with scale == 1.
|
|
|
|
|
* It's created in gtk_settings_init()
|
|
|
|
|
*/
|
|
|
|
|
g_assert (scale != 1);
|
|
|
|
|
|
|
|
|
|
new_cascade = _gtk_style_cascade_new ();
|
|
|
|
|
_gtk_style_cascade_set_parent (new_cascade, _gtk_settings_get_style_cascade (settings, 1));
|
|
|
|
|
_gtk_style_cascade_set_scale (new_cascade, scale);
|
|
|
|
|
|
|
|
|
|
priv->style_cascades = g_slist_prepend (priv->style_cascades, new_cascade);
|
|
|
|
|
|
|
|
|
|
return new_cascade;
|
2014-02-20 01:02:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-09-11 10:48:27 +00:00
|
|
|
|
static void
|
|
|
|
|
settings_init_style (GtkSettings *settings)
|
|
|
|
|
{
|
2019-05-19 20:04:47 +00:00
|
|
|
|
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
|
2010-09-11 10:48:27 +00:00
|
|
|
|
static GtkCssProvider *css_provider = NULL;
|
2015-02-06 09:13:11 +00:00
|
|
|
|
GtkStyleCascade *cascade;
|
2010-09-11 10:48:27 +00:00
|
|
|
|
|
|
|
|
|
/* Add provider for user file */
|
|
|
|
|
if (G_UNLIKELY (!css_provider))
|
|
|
|
|
{
|
2010-12-01 01:55:31 +00:00
|
|
|
|
gchar *css_path;
|
2010-09-11 10:48:27 +00:00
|
|
|
|
|
|
|
|
|
css_provider = gtk_css_provider_new ();
|
2010-12-01 01:55:31 +00:00
|
|
|
|
css_path = g_build_filename (g_get_user_config_dir (),
|
2016-10-23 18:06:33 +00:00
|
|
|
|
"gtk-4.0",
|
2010-12-01 01:55:31 +00:00
|
|
|
|
"gtk.css",
|
|
|
|
|
NULL);
|
2010-09-11 10:48:27 +00:00
|
|
|
|
|
2010-12-01 01:55:31 +00:00
|
|
|
|
if (g_file_test (css_path,
|
|
|
|
|
G_FILE_TEST_IS_REGULAR))
|
2016-10-17 14:09:12 +00:00
|
|
|
|
gtk_css_provider_load_from_path (css_provider, css_path);
|
2010-09-11 10:48:27 +00:00
|
|
|
|
|
2010-12-01 01:55:31 +00:00
|
|
|
|
g_free (css_path);
|
2010-09-11 10:48:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-02-06 09:13:11 +00:00
|
|
|
|
cascade = _gtk_settings_get_style_cascade (settings, 1);
|
|
|
|
|
_gtk_style_cascade_add_provider (cascade,
|
2014-02-20 01:02:05 +00:00
|
|
|
|
GTK_STYLE_PROVIDER (css_provider),
|
|
|
|
|
GTK_STYLE_PROVIDER_PRIORITY_USER);
|
2010-09-11 10:48:27 +00:00
|
|
|
|
|
2015-02-06 09:13:11 +00:00
|
|
|
|
_gtk_style_cascade_add_provider (cascade,
|
2014-02-20 01:02:05 +00:00
|
|
|
|
GTK_STYLE_PROVIDER (settings),
|
|
|
|
|
GTK_STYLE_PROVIDER_PRIORITY_SETTINGS);
|
2010-11-13 21:35:58 +00:00
|
|
|
|
|
2015-02-06 09:13:11 +00:00
|
|
|
|
_gtk_style_cascade_add_provider (cascade,
|
2019-05-19 20:04:47 +00:00
|
|
|
|
GTK_STYLE_PROVIDER (priv->theme_provider),
|
2014-02-20 01:02:05 +00:00
|
|
|
|
GTK_STYLE_PROVIDER_PRIORITY_SETTINGS);
|
2012-09-19 14:41:19 +00:00
|
|
|
|
|
2010-11-13 21:35:58 +00:00
|
|
|
|
settings_update_theme (settings);
|
2010-09-11 10:48:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-10-30 13:04:09 +00:00
|
|
|
|
static void
|
|
|
|
|
setting_changed (GdkDisplay *display,
|
|
|
|
|
const char *name,
|
|
|
|
|
gpointer data)
|
|
|
|
|
{
|
|
|
|
|
GtkSettings *settings = data;
|
|
|
|
|
GParamSpec *pspec;
|
|
|
|
|
|
|
|
|
|
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (settings), name);
|
|
|
|
|
|
|
|
|
|
if (!pspec)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (settings_update_xsetting (settings, pspec, TRUE))
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (settings), pspec);
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-06 04:21:08 +00:00
|
|
|
|
static GtkSettings *
|
|
|
|
|
gtk_settings_create_for_display (GdkDisplay *display)
|
|
|
|
|
{
|
|
|
|
|
GtkSettings *settings;
|
2019-05-19 20:04:47 +00:00
|
|
|
|
GtkSettingsPrivate *priv;
|
2016-05-06 04:21:08 +00:00
|
|
|
|
|
|
|
|
|
#ifdef GDK_WINDOWING_QUARTZ
|
|
|
|
|
if (GDK_IS_QUARTZ_DISPLAY (display))
|
|
|
|
|
settings = g_object_new (GTK_TYPE_SETTINGS,
|
|
|
|
|
"gtk-key-theme-name", "Mac",
|
|
|
|
|
"gtk-shell-shows-app-menu", TRUE,
|
|
|
|
|
"gtk-shell-shows-menubar", TRUE,
|
|
|
|
|
NULL);
|
|
|
|
|
else
|
|
|
|
|
#endif
|
|
|
|
|
settings = g_object_new (GTK_TYPE_SETTINGS, NULL);
|
|
|
|
|
|
2019-05-19 20:04:47 +00:00
|
|
|
|
priv = gtk_settings_get_instance_private (settings);
|
|
|
|
|
|
|
|
|
|
priv->display = display;
|
2016-05-06 04:21:08 +00:00
|
|
|
|
|
2017-10-30 13:04:09 +00:00
|
|
|
|
g_signal_connect_object (display, "setting-changed", G_CALLBACK (setting_changed), settings, 0);
|
|
|
|
|
|
2017-10-30 19:45:37 +00:00
|
|
|
|
g_ptr_array_add (display_settings, settings);
|
2016-05-06 04:21:08 +00:00
|
|
|
|
|
|
|
|
|
settings_init_style (settings);
|
|
|
|
|
settings_update_xsettings (settings);
|
|
|
|
|
settings_update_double_click (settings);
|
|
|
|
|
settings_update_cursor_theme (settings);
|
|
|
|
|
settings_update_font_options (settings);
|
2016-05-06 11:08:56 +00:00
|
|
|
|
settings_update_font_values (settings);
|
2016-05-06 04:21:08 +00:00
|
|
|
|
|
|
|
|
|
return settings;
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-30 22:58:05 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_settings_get_for_display:
|
2017-11-28 14:20:14 +00:00
|
|
|
|
* @display: a #GdkDisplay.
|
2017-10-30 22:58:05 +00:00
|
|
|
|
*
|
|
|
|
|
* Gets the #GtkSettings object for @display, creating it if necessary.
|
|
|
|
|
*
|
|
|
|
|
* Returns: (transfer none): a #GtkSettings object.
|
|
|
|
|
*/
|
2017-10-30 20:50:14 +00:00
|
|
|
|
GtkSettings *
|
2016-05-06 04:21:08 +00:00
|
|
|
|
gtk_settings_get_for_display (GdkDisplay *display)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
2017-10-30 20:50:14 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
|
|
|
|
|
|
2016-05-06 04:21:08 +00:00
|
|
|
|
if G_UNLIKELY (display_settings == NULL)
|
2017-10-30 19:45:37 +00:00
|
|
|
|
display_settings = g_ptr_array_new ();
|
2016-05-06 04:21:08 +00:00
|
|
|
|
|
|
|
|
|
for (i = 0; i < display_settings->len; i++)
|
|
|
|
|
{
|
2017-10-30 19:45:37 +00:00
|
|
|
|
GtkSettings *settings = g_ptr_array_index (display_settings, i);
|
2019-05-19 20:04:47 +00:00
|
|
|
|
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
|
|
|
|
|
if (priv->display == display)
|
2017-10-30 19:45:37 +00:00
|
|
|
|
return settings;
|
2016-05-06 04:21:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return gtk_settings_create_for_display (display);
|
|
|
|
|
}
|
|
|
|
|
|
Integrate Erwann Chenede's multihead changes for the gtk/ directory.
Mon Apr 29 18:28:00 2002 Owen Taylor <otaylor@redhat.com>
Integrate Erwann Chenede's multihead changes for the gtk/ directory.
* gtk/gtkclipboard.[ch]: Add gtk_clipboard_get_for_display(),
make internals multihead aware.
* gtk/gtkcolorsel.[ch]: Add
gtk_color_selection_set_change_palette_with_screen_hook () [ugh!]
make up for non-multihead safety of
gtk_color_selection_set_change_palette_hook()
* gtk/gtkinvisible.[ch] gtk/gtkmenu.[ch] gtkwindow.[ch]: Add
gtk_{invisible,menu,window}_set_screen(); add "screen" properties
for GtkWindow and GtkMenu.
* gtk/gtkplug.[ch]: Add gtk_plug_construct_for_display(),
gtk_plug_new_for_display(). Multihead fixes.
* gtk/gtkselection.[ch]: Add gtk_selection_owner_set_for_display(),
make internals multihead aware.
* gtk/gtksettings.[ch]: Add gtk_settings_get_for_screen(), get
rid of now-useless gtk_settings_constructor().
* gtk/gtkstyle.[ch]: Add gtk_style_get_font_for_display(), fix
check/radio button indicators bitmap handling to be multihead
safe.
* gtk/gtkwidget.[ch]: Add gtk_widget_get_screen(), gtk_widget_has_screen(),
gtk_widget_get_display(), gtk_widget_get_clipboard(),
gtk_widget_get_root_window().
* gtk/gtkbindings.c gtk/gtkbutton.c gtk/gtkclist.c gtk/gtkcombo.c
gtk/gtkctree.c gtk/gtkdnd.c gtk/gtkfilesel.c gtk/gtkgamma.c
gtk/gtkhandlebox.c gtk/gtkhsv.c gtk/gtkimcontext.c gtk/gtklabel.c
gtk/gtklist.c gtk/gtkmain.c gtk/gtkmenuitem.c gtk/gtkmenushell.c
gtk/gtknotebook.c gtk/gtkoldeditable.c gtk/gtkoptionmenu.c
gtk/gtkpaned.c gtk/gtkpreview.c gtk/gtksocket.c gtk/gtktext.c
gtk/gtktextbuffer.c gtk/gtktextview.c gtk/gtktipsquery.c
gtk/gtktooltips.c gtk/gtktreeview.c gtk/gtktreeviewcolumn.c:
misc mechanical multihead-safety fixes.
* gtk/gtkclipboard.c: Use a GtkImage rather than a pixmap for
the dropper, look up the color palette only at realization time,
other multihead fixes.
* gtk/gtkcombo.c (gtk_combo_unrealize): Popdown the list when
unrealizing.
* gtk/gtkentry.c: Only claim ownership of the primary selection
when realized, misc multihead fixes.
* gtk/gtkfontsel.c: Only fill in fonts when attached to a screen,
fix gtk_font_selection_get_font() for multihead.
* gtk/gtkgc.c: make the depth => drawable hash per-screen.
* gtk/gtkinvisible.c: Add a constructor that realizes the
widget, so we get a realized widget with g_object_new() as
well gtk_invisible_new() as before.
* gtk/gtkmain.c: Get rid of unused gtk_visual/gtk_colormap
variables.
* gtk/gtktextdisplay.c: Add warnings if stipple bitmaps
are used on the wrong screen.
* gtk/gtktoolbar.c: Make handling of GtkSettings-based layout
read properties and connect to settings when the screen is changed,
rather than on init/finalize.
* gtk/gtkwindow.c: Fix icon handing to be multihead safe ...
default icon pixmaps/mask are only shared between windows on the
same screen. Misc multihead fixes.
Sat Apr 27 13:49:53 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkclipboard.c (gtk_clipboard_get_for_display):
Update docs to reference GDK_SELECTION_CLIPBOARD rather GDK_NONE.
2002-04-29 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkproperty-fb.c (gdk_property_get):
Fix silly bug, noticed by Sven Neumann.
Sun Apr 28 22:43:55 2002 Jonathan Blandford <jrb@gnome.org>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_set_sort_func): Fix
so that you can set a new sort func.
2002-04-29 22:53:45 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_settings_get_default:
|
2010-12-24 02:55:47 +00:00
|
|
|
|
*
|
2017-10-30 22:58:05 +00:00
|
|
|
|
* Gets the #GtkSettings object for the default display, creating
|
|
|
|
|
* it if necessary. See gtk_settings_get_for_display().
|
2009-12-10 10:23:40 +00:00
|
|
|
|
*
|
2015-12-28 20:14:08 +00:00
|
|
|
|
* Returns: (nullable) (transfer none): a #GtkSettings object. If there is
|
2017-10-30 22:58:05 +00:00
|
|
|
|
* no default display, then returns %NULL.
|
Integrate Erwann Chenede's multihead changes for the gtk/ directory.
Mon Apr 29 18:28:00 2002 Owen Taylor <otaylor@redhat.com>
Integrate Erwann Chenede's multihead changes for the gtk/ directory.
* gtk/gtkclipboard.[ch]: Add gtk_clipboard_get_for_display(),
make internals multihead aware.
* gtk/gtkcolorsel.[ch]: Add
gtk_color_selection_set_change_palette_with_screen_hook () [ugh!]
make up for non-multihead safety of
gtk_color_selection_set_change_palette_hook()
* gtk/gtkinvisible.[ch] gtk/gtkmenu.[ch] gtkwindow.[ch]: Add
gtk_{invisible,menu,window}_set_screen(); add "screen" properties
for GtkWindow and GtkMenu.
* gtk/gtkplug.[ch]: Add gtk_plug_construct_for_display(),
gtk_plug_new_for_display(). Multihead fixes.
* gtk/gtkselection.[ch]: Add gtk_selection_owner_set_for_display(),
make internals multihead aware.
* gtk/gtksettings.[ch]: Add gtk_settings_get_for_screen(), get
rid of now-useless gtk_settings_constructor().
* gtk/gtkstyle.[ch]: Add gtk_style_get_font_for_display(), fix
check/radio button indicators bitmap handling to be multihead
safe.
* gtk/gtkwidget.[ch]: Add gtk_widget_get_screen(), gtk_widget_has_screen(),
gtk_widget_get_display(), gtk_widget_get_clipboard(),
gtk_widget_get_root_window().
* gtk/gtkbindings.c gtk/gtkbutton.c gtk/gtkclist.c gtk/gtkcombo.c
gtk/gtkctree.c gtk/gtkdnd.c gtk/gtkfilesel.c gtk/gtkgamma.c
gtk/gtkhandlebox.c gtk/gtkhsv.c gtk/gtkimcontext.c gtk/gtklabel.c
gtk/gtklist.c gtk/gtkmain.c gtk/gtkmenuitem.c gtk/gtkmenushell.c
gtk/gtknotebook.c gtk/gtkoldeditable.c gtk/gtkoptionmenu.c
gtk/gtkpaned.c gtk/gtkpreview.c gtk/gtksocket.c gtk/gtktext.c
gtk/gtktextbuffer.c gtk/gtktextview.c gtk/gtktipsquery.c
gtk/gtktooltips.c gtk/gtktreeview.c gtk/gtktreeviewcolumn.c:
misc mechanical multihead-safety fixes.
* gtk/gtkclipboard.c: Use a GtkImage rather than a pixmap for
the dropper, look up the color palette only at realization time,
other multihead fixes.
* gtk/gtkcombo.c (gtk_combo_unrealize): Popdown the list when
unrealizing.
* gtk/gtkentry.c: Only claim ownership of the primary selection
when realized, misc multihead fixes.
* gtk/gtkfontsel.c: Only fill in fonts when attached to a screen,
fix gtk_font_selection_get_font() for multihead.
* gtk/gtkgc.c: make the depth => drawable hash per-screen.
* gtk/gtkinvisible.c: Add a constructor that realizes the
widget, so we get a realized widget with g_object_new() as
well gtk_invisible_new() as before.
* gtk/gtkmain.c: Get rid of unused gtk_visual/gtk_colormap
variables.
* gtk/gtktextdisplay.c: Add warnings if stipple bitmaps
are used on the wrong screen.
* gtk/gtktoolbar.c: Make handling of GtkSettings-based layout
read properties and connect to settings when the screen is changed,
rather than on init/finalize.
* gtk/gtkwindow.c: Fix icon handing to be multihead safe ...
default icon pixmaps/mask are only shared between windows on the
same screen. Misc multihead fixes.
Sat Apr 27 13:49:53 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkclipboard.c (gtk_clipboard_get_for_display):
Update docs to reference GDK_SELECTION_CLIPBOARD rather GDK_NONE.
2002-04-29 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkproperty-fb.c (gdk_property_get):
Fix silly bug, noticed by Sven Neumann.
Sun Apr 28 22:43:55 2002 Jonathan Blandford <jrb@gnome.org>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_set_sort_func): Fix
so that you can set a new sort func.
2002-04-29 22:53:45 +00:00
|
|
|
|
**/
|
2001-03-18 04:50:34 +00:00
|
|
|
|
GtkSettings*
|
Allow %NULL for style to mean "revert to default style"
Tue Jun 26 19:39:03 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_style): Allow %NULL
for style to mean "revert to default style"
* gtk/gtkwidget.[ch] (gtk_widget_set_rc_style,
gtk_widget_restore_default_style): Make this functions
deprecated aliases for gtk_widget_set_style (widget, NULL).
* gtk/gtkwidget.[ch]: Remove:
gtk_widget_set_default_style ()
gtk_widget_push_style ()
gtk_widget_pop_style ()
These functions interact are overriden by RC files, and
thus virtually useless, and complicated.
Fri Jun 22 18:49:48 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c: Add a GtkRcContext structure to hold
most of the previous global variables in gtkrc.c. This is
in preparation for multi-head, since each screen can
have different GtkSettings and RC information.
* gtk/gtkrc.[ch]:
* gtk/gtkrc.h (struct _GtkRcStyleClass): Add a
GtkSettings parameter to GtkRcStyle::parse.
* gdk/x11/gdkevents-x11.c gtk/gtksettings.c gtk/gtkrc.c:
Add two new settings gtk-theme-name, gtk-key-theme-name,
for RC files that are loaded by name after reading
the default RC files.
* gtk/gtkrc.c: Allow priorities for styles, as wll as
bindings.
* gtk/gtkenums.h gtk/gtkrc.c: Add GTK_PATH_PRIO_THEME,
and use it by default for RC files loaded via
gtk-theme-name, gtk-key-theme-name.
* gtk/gtkiconfactory.c (gtk_icon_source_set_filename)
gtk/gtkrc.c (gtk_rc_parse_pixmap_path_string)
tests/testgtkrc: Require pathnames to be absolute.
* gtk/gtkrc.c gtk/gtkiconfactory.c: Look up the full filename for
the source when parsing, since the operation of looking up a
pixmap from an RC file depends on the parsing context.
* gtk/gtkrc.c (gtk_rc_context_reparse_all): Automatically
reset RC styles on all widgets when files are reparsed.
* tests/testgtk.c (create_rc_file)
gtk/gtkwindow.c (gtk_window_read_rcfiles):
Simplify, now that gtk_rc_reparse_all() resets styles on
all widgets itself.
* gtk/gtkmain.c (gtk_get_default_language): Fix broken
return value.
* gtk/gtksettings.[ch] (gtk_settings_install_property[_ch]): Remove
GtkSettings argument.
* gtk/gtksettings.[ch] (gtk_settings_get_default): Rename from
gtk_settings_get_global().
* gtk/gtkwidget.[ch]: Add a function gtk_widget_Get_settings()
to get the appropriate GtkSettings for a widget. (For now,
just gets the default GtkSetttings.)
* gtk/gtkcolorsel.c gtk/gtkentry.c gtk/gtkmenu.c gtk/gtkmenubar.c
gtk/gtktextview.c gtk/gtktoolbar.c: Fixes for GtkSettings
changes.
* gtk/gtkrc.[ch]: Add gtk_rc_get_style_by_paths() to allow
getting a style for a path without actually having a widget.
(Allows using a style for a subpart of a widget, for
example.)
* gtk/gtkrc.[ch]: Add gtk_rc_reparse_all_for_setting() to allow forcing
the RC files to be reloaded for just one GtkSettings
(not sure how useful this really is.)
* gtk/gtkrc.h: Deprecate
gtk_rc_add_widget_name/widget_class/class_style
2001-06-30 16:08:25 +00:00
|
|
|
|
gtk_settings_get_default (void)
|
2001-03-18 04:50:34 +00:00
|
|
|
|
{
|
2016-05-06 04:21:08 +00:00
|
|
|
|
GdkDisplay *display = gdk_display_get_default ();
|
2002-08-01 23:43:13 +00:00
|
|
|
|
|
2016-05-06 04:21:08 +00:00
|
|
|
|
if (display)
|
|
|
|
|
return gtk_settings_get_for_display (display);
|
2017-02-09 17:17:05 +00:00
|
|
|
|
|
|
|
|
|
g_debug ("%s() returning NULL GtkSettings object. Is a display available?",
|
|
|
|
|
G_STRFUNC);
|
|
|
|
|
return NULL;
|
2001-03-18 04:50:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_settings_set_property (GObject *object,
|
2010-12-24 02:55:47 +00:00
|
|
|
|
guint property_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
2001-03-18 04:50:34 +00:00
|
|
|
|
{
|
|
|
|
|
GtkSettings *settings = GTK_SETTINGS (object);
|
2019-05-19 20:04:47 +00:00
|
|
|
|
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
|
2010-12-24 02:55:47 +00:00
|
|
|
|
|
|
|
|
|
g_value_copy (value, &priv->property_values[property_id - 1].value);
|
|
|
|
|
priv->property_values[property_id - 1].source = GTK_SETTINGS_SOURCE_APPLICATION;
|
2001-03-18 04:50:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-12-28 13:34:54 +00:00
|
|
|
|
static void
|
|
|
|
|
settings_invalidate_style (GtkSettings *settings)
|
|
|
|
|
{
|
2017-10-31 03:31:46 +00:00
|
|
|
|
gtk_style_provider_changed (GTK_STYLE_PROVIDER (settings));
|
2011-12-28 13:34:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-05-01 05:10:33 +00:00
|
|
|
|
static void
|
|
|
|
|
settings_update_font_values (GtkSettings *settings)
|
|
|
|
|
{
|
2019-05-19 20:04:47 +00:00
|
|
|
|
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
|
2016-05-01 05:10:33 +00:00
|
|
|
|
PangoFontDescription *desc;
|
|
|
|
|
const gchar *font_name;
|
|
|
|
|
|
|
|
|
|
font_name = g_value_get_string (&priv->property_values[PROP_FONT_NAME - 1].value);
|
|
|
|
|
desc = pango_font_description_from_string (font_name);
|
|
|
|
|
|
2016-05-04 15:19:03 +00:00
|
|
|
|
if (desc != NULL &&
|
|
|
|
|
(pango_font_description_get_set_fields (desc) & PANGO_FONT_MASK_SIZE) != 0)
|
|
|
|
|
{
|
|
|
|
|
priv->font_size = pango_font_description_get_size (desc);
|
|
|
|
|
priv->font_size_absolute = pango_font_description_get_size_is_absolute (desc);
|
|
|
|
|
}
|
|
|
|
|
else
|
2016-05-04 10:28:59 +00:00
|
|
|
|
{
|
|
|
|
|
priv->font_size = 10 * PANGO_SCALE;
|
|
|
|
|
priv->font_size_absolute = FALSE;
|
|
|
|
|
}
|
2016-05-01 05:10:33 +00:00
|
|
|
|
|
2016-05-04 15:19:03 +00:00
|
|
|
|
g_free (priv->font_family);
|
|
|
|
|
|
|
|
|
|
if (desc != NULL &&
|
|
|
|
|
(pango_font_description_get_set_fields (desc) & PANGO_FONT_MASK_FAMILY) != 0)
|
2016-05-01 05:10:33 +00:00
|
|
|
|
{
|
2016-05-04 15:19:03 +00:00
|
|
|
|
priv->font_family = g_strdup (pango_font_description_get_family (desc));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
priv->font_family = g_strdup ("Sans");
|
2016-05-01 05:10:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-05-04 15:19:03 +00:00
|
|
|
|
if (desc)
|
|
|
|
|
pango_font_description_free (desc);
|
2016-05-01 05:10:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-03-18 04:50:34 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_settings_notify (GObject *object,
|
2010-12-24 02:55:47 +00:00
|
|
|
|
GParamSpec *pspec)
|
2001-03-18 04:50:34 +00:00
|
|
|
|
{
|
Integrate Erwann Chenede's multihead changes for the gtk/ directory.
Mon Apr 29 18:28:00 2002 Owen Taylor <otaylor@redhat.com>
Integrate Erwann Chenede's multihead changes for the gtk/ directory.
* gtk/gtkclipboard.[ch]: Add gtk_clipboard_get_for_display(),
make internals multihead aware.
* gtk/gtkcolorsel.[ch]: Add
gtk_color_selection_set_change_palette_with_screen_hook () [ugh!]
make up for non-multihead safety of
gtk_color_selection_set_change_palette_hook()
* gtk/gtkinvisible.[ch] gtk/gtkmenu.[ch] gtkwindow.[ch]: Add
gtk_{invisible,menu,window}_set_screen(); add "screen" properties
for GtkWindow and GtkMenu.
* gtk/gtkplug.[ch]: Add gtk_plug_construct_for_display(),
gtk_plug_new_for_display(). Multihead fixes.
* gtk/gtkselection.[ch]: Add gtk_selection_owner_set_for_display(),
make internals multihead aware.
* gtk/gtksettings.[ch]: Add gtk_settings_get_for_screen(), get
rid of now-useless gtk_settings_constructor().
* gtk/gtkstyle.[ch]: Add gtk_style_get_font_for_display(), fix
check/radio button indicators bitmap handling to be multihead
safe.
* gtk/gtkwidget.[ch]: Add gtk_widget_get_screen(), gtk_widget_has_screen(),
gtk_widget_get_display(), gtk_widget_get_clipboard(),
gtk_widget_get_root_window().
* gtk/gtkbindings.c gtk/gtkbutton.c gtk/gtkclist.c gtk/gtkcombo.c
gtk/gtkctree.c gtk/gtkdnd.c gtk/gtkfilesel.c gtk/gtkgamma.c
gtk/gtkhandlebox.c gtk/gtkhsv.c gtk/gtkimcontext.c gtk/gtklabel.c
gtk/gtklist.c gtk/gtkmain.c gtk/gtkmenuitem.c gtk/gtkmenushell.c
gtk/gtknotebook.c gtk/gtkoldeditable.c gtk/gtkoptionmenu.c
gtk/gtkpaned.c gtk/gtkpreview.c gtk/gtksocket.c gtk/gtktext.c
gtk/gtktextbuffer.c gtk/gtktextview.c gtk/gtktipsquery.c
gtk/gtktooltips.c gtk/gtktreeview.c gtk/gtktreeviewcolumn.c:
misc mechanical multihead-safety fixes.
* gtk/gtkclipboard.c: Use a GtkImage rather than a pixmap for
the dropper, look up the color palette only at realization time,
other multihead fixes.
* gtk/gtkcombo.c (gtk_combo_unrealize): Popdown the list when
unrealizing.
* gtk/gtkentry.c: Only claim ownership of the primary selection
when realized, misc multihead fixes.
* gtk/gtkfontsel.c: Only fill in fonts when attached to a screen,
fix gtk_font_selection_get_font() for multihead.
* gtk/gtkgc.c: make the depth => drawable hash per-screen.
* gtk/gtkinvisible.c: Add a constructor that realizes the
widget, so we get a realized widget with g_object_new() as
well gtk_invisible_new() as before.
* gtk/gtkmain.c: Get rid of unused gtk_visual/gtk_colormap
variables.
* gtk/gtktextdisplay.c: Add warnings if stipple bitmaps
are used on the wrong screen.
* gtk/gtktoolbar.c: Make handling of GtkSettings-based layout
read properties and connect to settings when the screen is changed,
rather than on init/finalize.
* gtk/gtkwindow.c: Fix icon handing to be multihead safe ...
default icon pixmaps/mask are only shared between windows on the
same screen. Misc multihead fixes.
Sat Apr 27 13:49:53 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkclipboard.c (gtk_clipboard_get_for_display):
Update docs to reference GDK_SELECTION_CLIPBOARD rather GDK_NONE.
2002-04-29 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkproperty-fb.c (gdk_property_get):
Fix silly bug, noticed by Sven Neumann.
Sun Apr 28 22:43:55 2002 Jonathan Blandford <jrb@gnome.org>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_set_sort_func): Fix
so that you can set a new sort func.
2002-04-29 22:53:45 +00:00
|
|
|
|
GtkSettings *settings = GTK_SETTINGS (object);
|
2019-05-19 20:04:47 +00:00
|
|
|
|
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
|
fix PROP_EVENTS.
Mon Jun 18 02:00:49 2001 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_get_property): fix PROP_EVENTS.
* gtk/Makefile.am:
* gtk/gtk.h: disabled GtkPacker compilation.
* gtk/gtkarg.[hc], gtk/gtkargcollector.c: got rid of these.
* gtk/gtknotebook.c:
* gtk/gtktable.c:
* gtk/gtkbox.c: ported this over to child properties.
* gtk/gtksettings.c: fetch class properties via
g_object_class_list_properties().
* gtk/gtkcontainer.[hc]: implemented child properties, got rid of the
child arg interface. use gobjectnotifyqueue.c for child property
notification.
* gtk/gtkwidget.[hc]: provide necessary means for container child
properties, i.e. ::child_notify signal,
gtk_widget_freeze_child_notify(),
gtk_widget_child_notify(),
gtk_widget_thaw_child_notify().
* tests/testgtk.c: removed inferior property handling code, for
property editing, a generic module should be used, and GLE
coincidentally fullfills that purpose.
* docs/reference/Makefile.am: disabled gtk docs building, gtk-doc
needs to be adapted to g_object_class_list_properties() before this
builds again.
2001-06-19 12:54:10 +00:00
|
|
|
|
guint property_id = pspec->param_id;
|
Integrate Erwann Chenede's multihead changes for the gtk/ directory.
Mon Apr 29 18:28:00 2002 Owen Taylor <otaylor@redhat.com>
Integrate Erwann Chenede's multihead changes for the gtk/ directory.
* gtk/gtkclipboard.[ch]: Add gtk_clipboard_get_for_display(),
make internals multihead aware.
* gtk/gtkcolorsel.[ch]: Add
gtk_color_selection_set_change_palette_with_screen_hook () [ugh!]
make up for non-multihead safety of
gtk_color_selection_set_change_palette_hook()
* gtk/gtkinvisible.[ch] gtk/gtkmenu.[ch] gtkwindow.[ch]: Add
gtk_{invisible,menu,window}_set_screen(); add "screen" properties
for GtkWindow and GtkMenu.
* gtk/gtkplug.[ch]: Add gtk_plug_construct_for_display(),
gtk_plug_new_for_display(). Multihead fixes.
* gtk/gtkselection.[ch]: Add gtk_selection_owner_set_for_display(),
make internals multihead aware.
* gtk/gtksettings.[ch]: Add gtk_settings_get_for_screen(), get
rid of now-useless gtk_settings_constructor().
* gtk/gtkstyle.[ch]: Add gtk_style_get_font_for_display(), fix
check/radio button indicators bitmap handling to be multihead
safe.
* gtk/gtkwidget.[ch]: Add gtk_widget_get_screen(), gtk_widget_has_screen(),
gtk_widget_get_display(), gtk_widget_get_clipboard(),
gtk_widget_get_root_window().
* gtk/gtkbindings.c gtk/gtkbutton.c gtk/gtkclist.c gtk/gtkcombo.c
gtk/gtkctree.c gtk/gtkdnd.c gtk/gtkfilesel.c gtk/gtkgamma.c
gtk/gtkhandlebox.c gtk/gtkhsv.c gtk/gtkimcontext.c gtk/gtklabel.c
gtk/gtklist.c gtk/gtkmain.c gtk/gtkmenuitem.c gtk/gtkmenushell.c
gtk/gtknotebook.c gtk/gtkoldeditable.c gtk/gtkoptionmenu.c
gtk/gtkpaned.c gtk/gtkpreview.c gtk/gtksocket.c gtk/gtktext.c
gtk/gtktextbuffer.c gtk/gtktextview.c gtk/gtktipsquery.c
gtk/gtktooltips.c gtk/gtktreeview.c gtk/gtktreeviewcolumn.c:
misc mechanical multihead-safety fixes.
* gtk/gtkclipboard.c: Use a GtkImage rather than a pixmap for
the dropper, look up the color palette only at realization time,
other multihead fixes.
* gtk/gtkcombo.c (gtk_combo_unrealize): Popdown the list when
unrealizing.
* gtk/gtkentry.c: Only claim ownership of the primary selection
when realized, misc multihead fixes.
* gtk/gtkfontsel.c: Only fill in fonts when attached to a screen,
fix gtk_font_selection_get_font() for multihead.
* gtk/gtkgc.c: make the depth => drawable hash per-screen.
* gtk/gtkinvisible.c: Add a constructor that realizes the
widget, so we get a realized widget with g_object_new() as
well gtk_invisible_new() as before.
* gtk/gtkmain.c: Get rid of unused gtk_visual/gtk_colormap
variables.
* gtk/gtktextdisplay.c: Add warnings if stipple bitmaps
are used on the wrong screen.
* gtk/gtktoolbar.c: Make handling of GtkSettings-based layout
read properties and connect to settings when the screen is changed,
rather than on init/finalize.
* gtk/gtkwindow.c: Fix icon handing to be multihead safe ...
default icon pixmaps/mask are only shared between windows on the
same screen. Misc multihead fixes.
Sat Apr 27 13:49:53 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkclipboard.c (gtk_clipboard_get_for_display):
Update docs to reference GDK_SELECTION_CLIPBOARD rather GDK_NONE.
2002-04-29 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkproperty-fb.c (gdk_property_get):
Fix silly bug, noticed by Sven Neumann.
Sun Apr 28 22:43:55 2002 Jonathan Blandford <jrb@gnome.org>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_set_sort_func): Fix
so that you can set a new sort func.
2002-04-29 22:53:45 +00:00
|
|
|
|
|
2017-10-30 21:02:35 +00:00
|
|
|
|
if (priv->display == NULL) /* initialization */
|
Integrate Erwann Chenede's multihead changes for the gtk/ directory.
Mon Apr 29 18:28:00 2002 Owen Taylor <otaylor@redhat.com>
Integrate Erwann Chenede's multihead changes for the gtk/ directory.
* gtk/gtkclipboard.[ch]: Add gtk_clipboard_get_for_display(),
make internals multihead aware.
* gtk/gtkcolorsel.[ch]: Add
gtk_color_selection_set_change_palette_with_screen_hook () [ugh!]
make up for non-multihead safety of
gtk_color_selection_set_change_palette_hook()
* gtk/gtkinvisible.[ch] gtk/gtkmenu.[ch] gtkwindow.[ch]: Add
gtk_{invisible,menu,window}_set_screen(); add "screen" properties
for GtkWindow and GtkMenu.
* gtk/gtkplug.[ch]: Add gtk_plug_construct_for_display(),
gtk_plug_new_for_display(). Multihead fixes.
* gtk/gtkselection.[ch]: Add gtk_selection_owner_set_for_display(),
make internals multihead aware.
* gtk/gtksettings.[ch]: Add gtk_settings_get_for_screen(), get
rid of now-useless gtk_settings_constructor().
* gtk/gtkstyle.[ch]: Add gtk_style_get_font_for_display(), fix
check/radio button indicators bitmap handling to be multihead
safe.
* gtk/gtkwidget.[ch]: Add gtk_widget_get_screen(), gtk_widget_has_screen(),
gtk_widget_get_display(), gtk_widget_get_clipboard(),
gtk_widget_get_root_window().
* gtk/gtkbindings.c gtk/gtkbutton.c gtk/gtkclist.c gtk/gtkcombo.c
gtk/gtkctree.c gtk/gtkdnd.c gtk/gtkfilesel.c gtk/gtkgamma.c
gtk/gtkhandlebox.c gtk/gtkhsv.c gtk/gtkimcontext.c gtk/gtklabel.c
gtk/gtklist.c gtk/gtkmain.c gtk/gtkmenuitem.c gtk/gtkmenushell.c
gtk/gtknotebook.c gtk/gtkoldeditable.c gtk/gtkoptionmenu.c
gtk/gtkpaned.c gtk/gtkpreview.c gtk/gtksocket.c gtk/gtktext.c
gtk/gtktextbuffer.c gtk/gtktextview.c gtk/gtktipsquery.c
gtk/gtktooltips.c gtk/gtktreeview.c gtk/gtktreeviewcolumn.c:
misc mechanical multihead-safety fixes.
* gtk/gtkclipboard.c: Use a GtkImage rather than a pixmap for
the dropper, look up the color palette only at realization time,
other multihead fixes.
* gtk/gtkcombo.c (gtk_combo_unrealize): Popdown the list when
unrealizing.
* gtk/gtkentry.c: Only claim ownership of the primary selection
when realized, misc multihead fixes.
* gtk/gtkfontsel.c: Only fill in fonts when attached to a screen,
fix gtk_font_selection_get_font() for multihead.
* gtk/gtkgc.c: make the depth => drawable hash per-screen.
* gtk/gtkinvisible.c: Add a constructor that realizes the
widget, so we get a realized widget with g_object_new() as
well gtk_invisible_new() as before.
* gtk/gtkmain.c: Get rid of unused gtk_visual/gtk_colormap
variables.
* gtk/gtktextdisplay.c: Add warnings if stipple bitmaps
are used on the wrong screen.
* gtk/gtktoolbar.c: Make handling of GtkSettings-based layout
read properties and connect to settings when the screen is changed,
rather than on init/finalize.
* gtk/gtkwindow.c: Fix icon handing to be multihead safe ...
default icon pixmaps/mask are only shared between windows on the
same screen. Misc multihead fixes.
Sat Apr 27 13:49:53 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkclipboard.c (gtk_clipboard_get_for_display):
Update docs to reference GDK_SELECTION_CLIPBOARD rather GDK_NONE.
2002-04-29 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkproperty-fb.c (gdk_property_get):
Fix silly bug, noticed by Sven Neumann.
Sun Apr 28 22:43:55 2002 Jonathan Blandford <jrb@gnome.org>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_set_sort_func): Fix
so that you can set a new sort func.
2002-04-29 22:53:45 +00:00
|
|
|
|
return;
|
2001-03-18 04:50:34 +00:00
|
|
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
|
{
|
2001-05-30 20:40:28 +00:00
|
|
|
|
case PROP_DOUBLE_CLICK_TIME:
|
2003-12-16 00:56:48 +00:00
|
|
|
|
case PROP_DOUBLE_CLICK_DISTANCE:
|
|
|
|
|
settings_update_double_click (settings);
|
2003-01-15 21:01:54 +00:00
|
|
|
|
break;
|
2011-05-01 02:15:42 +00:00
|
|
|
|
case PROP_FONT_NAME:
|
2016-05-01 05:10:33 +00:00
|
|
|
|
settings_update_font_values (settings);
|
2011-12-28 13:34:54 +00:00
|
|
|
|
settings_invalidate_style (settings);
|
2017-10-31 01:35:21 +00:00
|
|
|
|
gtk_style_context_reset_widgets (priv->display);
|
2011-05-01 02:15:42 +00:00
|
|
|
|
break;
|
2010-09-22 21:44:06 +00:00
|
|
|
|
case PROP_THEME_NAME:
|
2011-01-28 18:34:36 +00:00
|
|
|
|
case PROP_APPLICATION_PREFER_DARK_THEME:
|
2010-09-22 21:44:06 +00:00
|
|
|
|
settings_update_theme (settings);
|
2005-12-16 18:45:31 +00:00
|
|
|
|
break;
|
2005-07-21 13:59:22 +00:00
|
|
|
|
case PROP_XFT_DPI:
|
2005-08-24 15:47:28 +00:00
|
|
|
|
/* This is a hack because with gtk_rc_reset_styles() doesn't get
|
|
|
|
|
* widgets with gtk_widget_style_set(), and also causes more
|
|
|
|
|
* recomputation than necessary.
|
|
|
|
|
*/
|
2017-10-31 01:35:21 +00:00
|
|
|
|
gtk_style_context_reset_widgets (priv->display);
|
2005-08-24 03:29:06 +00:00
|
|
|
|
break;
|
2005-08-24 16:17:56 +00:00
|
|
|
|
case PROP_XFT_ANTIALIAS:
|
|
|
|
|
case PROP_XFT_HINTING:
|
|
|
|
|
case PROP_XFT_HINTSTYLE:
|
|
|
|
|
case PROP_XFT_RGBA:
|
|
|
|
|
settings_update_font_options (settings);
|
2017-10-31 01:35:21 +00:00
|
|
|
|
gtk_style_context_reset_widgets (priv->display);
|
2005-08-24 16:17:56 +00:00
|
|
|
|
break;
|
2008-06-06 16:39:37 +00:00
|
|
|
|
case PROP_FONTCONFIG_TIMESTAMP:
|
|
|
|
|
if (settings_update_fontconfig (settings))
|
2017-10-31 01:35:21 +00:00
|
|
|
|
gtk_style_context_reset_widgets (priv->display);
|
2012-11-01 11:23:42 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_ENABLE_ANIMATIONS:
|
2017-10-31 01:35:21 +00:00
|
|
|
|
gtk_style_context_reset_widgets (priv->display);
|
2008-06-06 16:39:37 +00:00
|
|
|
|
break;
|
2005-06-15 19:25:49 +00:00
|
|
|
|
case PROP_CURSOR_THEME_NAME:
|
|
|
|
|
case PROP_CURSOR_THEME_SIZE:
|
|
|
|
|
settings_update_cursor_theme (settings);
|
|
|
|
|
break;
|
2017-10-06 19:19:42 +00:00
|
|
|
|
default:
|
|
|
|
|
break;
|
2001-03-18 04:50:34 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-04-03 13:18:00 +00:00
|
|
|
|
gboolean
|
|
|
|
|
_gtk_settings_parse_convert (GtkRcPropertyParser parser,
|
2010-12-24 02:55:47 +00:00
|
|
|
|
const GValue *src_value,
|
|
|
|
|
GParamSpec *pspec,
|
|
|
|
|
GValue *dest_value)
|
2001-03-18 04:50:34 +00:00
|
|
|
|
{
|
2001-04-03 13:18:00 +00:00
|
|
|
|
gboolean success = FALSE;
|
2001-03-18 04:50:34 +00:00
|
|
|
|
|
2001-04-03 13:18:00 +00:00
|
|
|
|
g_return_val_if_fail (G_VALUE_HOLDS (dest_value, G_PARAM_SPEC_VALUE_TYPE (pspec)), FALSE);
|
2001-03-18 04:50:34 +00:00
|
|
|
|
|
2001-04-03 13:18:00 +00:00
|
|
|
|
if (parser)
|
|
|
|
|
{
|
|
|
|
|
GString *gstring;
|
|
|
|
|
gboolean free_gstring = TRUE;
|
2010-12-24 02:55:47 +00:00
|
|
|
|
|
2001-04-03 13:18:00 +00:00
|
|
|
|
if (G_VALUE_HOLDS (src_value, G_TYPE_GSTRING))
|
2010-12-24 02:55:47 +00:00
|
|
|
|
{
|
|
|
|
|
gstring = g_value_get_boxed (src_value);
|
|
|
|
|
free_gstring = FALSE;
|
|
|
|
|
}
|
2001-04-03 13:18:00 +00:00
|
|
|
|
else if (G_VALUE_HOLDS_LONG (src_value))
|
2010-12-24 02:55:47 +00:00
|
|
|
|
{
|
|
|
|
|
gstring = g_string_new (NULL);
|
|
|
|
|
g_string_append_printf (gstring, "%ld", g_value_get_long (src_value));
|
|
|
|
|
}
|
2001-04-03 13:18:00 +00:00
|
|
|
|
else if (G_VALUE_HOLDS_DOUBLE (src_value))
|
2010-12-24 02:55:47 +00:00
|
|
|
|
{
|
|
|
|
|
gstring = g_string_new (NULL);
|
|
|
|
|
g_string_append_printf (gstring, "%f", g_value_get_double (src_value));
|
|
|
|
|
}
|
2001-04-03 13:18:00 +00:00
|
|
|
|
else if (G_VALUE_HOLDS_STRING (src_value))
|
2010-12-24 02:55:47 +00:00
|
|
|
|
{
|
|
|
|
|
gchar *tstr = g_strescape (g_value_get_string (src_value), NULL);
|
|
|
|
|
|
2011-01-26 15:46:40 +00:00
|
|
|
|
gstring = g_string_new (NULL);
|
|
|
|
|
g_string_append_c (gstring, '\"');
|
2010-12-24 02:55:47 +00:00
|
|
|
|
g_string_append (gstring, tstr);
|
|
|
|
|
g_string_append_c (gstring, '\"');
|
|
|
|
|
g_free (tstr);
|
|
|
|
|
}
|
2001-03-18 04:50:34 +00:00
|
|
|
|
else
|
2010-12-24 02:55:47 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (G_VALUE_HOLDS (src_value, G_TYPE_GSTRING), FALSE);
|
|
|
|
|
gstring = NULL; /* silence compiler */
|
|
|
|
|
}
|
2001-04-03 13:18:00 +00:00
|
|
|
|
|
|
|
|
|
success = (parser (pspec, gstring, dest_value) &&
|
2010-12-24 02:55:47 +00:00
|
|
|
|
!g_param_value_validate (pspec, dest_value));
|
2001-04-03 13:18:00 +00:00
|
|
|
|
|
|
|
|
|
if (free_gstring)
|
2010-12-24 02:55:47 +00:00
|
|
|
|
g_string_free (gstring, TRUE);
|
2001-03-18 04:50:34 +00:00
|
|
|
|
}
|
added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:06:38 2001 Tim Janik <timj@gtk.org>
* added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:08:37 2001 Tim Janik <timj@gtk.org>
* gtk/maketypes.awk: fix type utils generation on unix.
* gtk/gtkaccelmap.[hc]: new files, implementing a global accelerator
registry.
* gtk/gtkaccelgroup.[hc]: major API/implementation revamp:
removed GTK_ACCEL_SIGNAL_VISIBLE, gtk_accel_group_get_default,
gtk_accel_group_get_entry, gtk_accel_group_(un)lock_entry,
gtk_accel_group_add/remove, gtk_accel_group_handle_add/remove,
gtk_accel_group_create_add/remove, gtk_accel_group_entries_from_object.
introduced ::accel_changed signal for change notification, and
gtk_accel_group_connect/disconnect to connect closures to accel groups.
made gtk_accel_group_attach/detach and gtk_accel_group_activate private
functions.
deprecated gtk_accel_group_ref/unref.
* gtk/gtkaccellabel.[hc]: changes to make accellabels pay attention
to accel group changed notification and basically operate on closures.
removed gtk_accel_label_get_accel_object and
gtk_accel_label_set_accel_object.
introduced gtk_accel_label_set_accel_closure, and for convenience,
gtk_accel_label_set_accel_widget.
* gtk/gtkitemfactory.[hc]: removed accelerator propagation code
which mostly moved into gtkaccelmap.[hc].
removed gtk_item_factory_parse_rc*, gtk_item_factory_dump_*
and gtk_item_factory_print_func.
* gtk/gtkmain.c: call _gtk_accel_map_init().
* gtk/gtkmenuitem.[hc]: introduced gtk_menu_item_set_accel_path(),
that associates an accelerator path with menu items, through which
persistent accelerator settings on menu items are enabled.
* gtk/gtkmenu.[hc]: added gtk_menu_set_accel_path() so accelerator
paths of menu item can be default constructed to allow installation
of accelerators on menu items that don't come with an accelerator
binding by default.
* gtk/gtksettings.c: fix STRING type rc settings by special casing
them appropriately in the parser.
* gtk/gtksignal.[hc]: allow a class function offset of 0 for
gtk_signal_newv().
* gtk/gtkwidget.[hc]: accelerator API revamp.
removed ::accelerator_add/remove signals, gtk_widget_accelerator_signal,
gtk_widget_accelerators_locked, gtk_widget_remove_accelerators and
gtk_widget_(un)lock_accelerators.
accelerators maintained through gtk_widget_add/remove_accelerator()
are not runtime changable now, the correct sequence to setup a
widget for runtime changable accelerators is now:
gtk_accel_map_add_entry(accel_path, key, mods);
_gtk_widget_set_accel_path(widget, accel_path, accel_group);
* gtk/gtkwindow.[hc]: accelerator changes, proxy and coalesce accel
group changes (as well as mnemonic changes) through the new signal
::accels_changed.
Sat Nov 10 12:08:56 2001 Tim Janik <timj@gtk.org>
* gtk/gtksettings.c (_gtk_settings_parse_convert): properly handle
GString->string conversions.
2001-11-13 00:53:47 +00:00
|
|
|
|
else if (G_VALUE_HOLDS (src_value, G_TYPE_GSTRING))
|
|
|
|
|
{
|
|
|
|
|
if (G_VALUE_HOLDS (dest_value, G_TYPE_STRING))
|
2010-12-24 02:55:47 +00:00
|
|
|
|
{
|
|
|
|
|
GString *gstring = g_value_get_boxed (src_value);
|
added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:06:38 2001 Tim Janik <timj@gtk.org>
* added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:08:37 2001 Tim Janik <timj@gtk.org>
* gtk/maketypes.awk: fix type utils generation on unix.
* gtk/gtkaccelmap.[hc]: new files, implementing a global accelerator
registry.
* gtk/gtkaccelgroup.[hc]: major API/implementation revamp:
removed GTK_ACCEL_SIGNAL_VISIBLE, gtk_accel_group_get_default,
gtk_accel_group_get_entry, gtk_accel_group_(un)lock_entry,
gtk_accel_group_add/remove, gtk_accel_group_handle_add/remove,
gtk_accel_group_create_add/remove, gtk_accel_group_entries_from_object.
introduced ::accel_changed signal for change notification, and
gtk_accel_group_connect/disconnect to connect closures to accel groups.
made gtk_accel_group_attach/detach and gtk_accel_group_activate private
functions.
deprecated gtk_accel_group_ref/unref.
* gtk/gtkaccellabel.[hc]: changes to make accellabels pay attention
to accel group changed notification and basically operate on closures.
removed gtk_accel_label_get_accel_object and
gtk_accel_label_set_accel_object.
introduced gtk_accel_label_set_accel_closure, and for convenience,
gtk_accel_label_set_accel_widget.
* gtk/gtkitemfactory.[hc]: removed accelerator propagation code
which mostly moved into gtkaccelmap.[hc].
removed gtk_item_factory_parse_rc*, gtk_item_factory_dump_*
and gtk_item_factory_print_func.
* gtk/gtkmain.c: call _gtk_accel_map_init().
* gtk/gtkmenuitem.[hc]: introduced gtk_menu_item_set_accel_path(),
that associates an accelerator path with menu items, through which
persistent accelerator settings on menu items are enabled.
* gtk/gtkmenu.[hc]: added gtk_menu_set_accel_path() so accelerator
paths of menu item can be default constructed to allow installation
of accelerators on menu items that don't come with an accelerator
binding by default.
* gtk/gtksettings.c: fix STRING type rc settings by special casing
them appropriately in the parser.
* gtk/gtksignal.[hc]: allow a class function offset of 0 for
gtk_signal_newv().
* gtk/gtkwidget.[hc]: accelerator API revamp.
removed ::accelerator_add/remove signals, gtk_widget_accelerator_signal,
gtk_widget_accelerators_locked, gtk_widget_remove_accelerators and
gtk_widget_(un)lock_accelerators.
accelerators maintained through gtk_widget_add/remove_accelerator()
are not runtime changable now, the correct sequence to setup a
widget for runtime changable accelerators is now:
gtk_accel_map_add_entry(accel_path, key, mods);
_gtk_widget_set_accel_path(widget, accel_path, accel_group);
* gtk/gtkwindow.[hc]: accelerator changes, proxy and coalesce accel
group changes (as well as mnemonic changes) through the new signal
::accels_changed.
Sat Nov 10 12:08:56 2001 Tim Janik <timj@gtk.org>
* gtk/gtksettings.c (_gtk_settings_parse_convert): properly handle
GString->string conversions.
2001-11-13 00:53:47 +00:00
|
|
|
|
|
2010-12-24 02:55:47 +00:00
|
|
|
|
g_value_set_string (dest_value, gstring ? gstring->str : NULL);
|
|
|
|
|
success = !g_param_value_validate (pspec, dest_value);
|
|
|
|
|
}
|
added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:06:38 2001 Tim Janik <timj@gtk.org>
* added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:08:37 2001 Tim Janik <timj@gtk.org>
* gtk/maketypes.awk: fix type utils generation on unix.
* gtk/gtkaccelmap.[hc]: new files, implementing a global accelerator
registry.
* gtk/gtkaccelgroup.[hc]: major API/implementation revamp:
removed GTK_ACCEL_SIGNAL_VISIBLE, gtk_accel_group_get_default,
gtk_accel_group_get_entry, gtk_accel_group_(un)lock_entry,
gtk_accel_group_add/remove, gtk_accel_group_handle_add/remove,
gtk_accel_group_create_add/remove, gtk_accel_group_entries_from_object.
introduced ::accel_changed signal for change notification, and
gtk_accel_group_connect/disconnect to connect closures to accel groups.
made gtk_accel_group_attach/detach and gtk_accel_group_activate private
functions.
deprecated gtk_accel_group_ref/unref.
* gtk/gtkaccellabel.[hc]: changes to make accellabels pay attention
to accel group changed notification and basically operate on closures.
removed gtk_accel_label_get_accel_object and
gtk_accel_label_set_accel_object.
introduced gtk_accel_label_set_accel_closure, and for convenience,
gtk_accel_label_set_accel_widget.
* gtk/gtkitemfactory.[hc]: removed accelerator propagation code
which mostly moved into gtkaccelmap.[hc].
removed gtk_item_factory_parse_rc*, gtk_item_factory_dump_*
and gtk_item_factory_print_func.
* gtk/gtkmain.c: call _gtk_accel_map_init().
* gtk/gtkmenuitem.[hc]: introduced gtk_menu_item_set_accel_path(),
that associates an accelerator path with menu items, through which
persistent accelerator settings on menu items are enabled.
* gtk/gtkmenu.[hc]: added gtk_menu_set_accel_path() so accelerator
paths of menu item can be default constructed to allow installation
of accelerators on menu items that don't come with an accelerator
binding by default.
* gtk/gtksettings.c: fix STRING type rc settings by special casing
them appropriately in the parser.
* gtk/gtksignal.[hc]: allow a class function offset of 0 for
gtk_signal_newv().
* gtk/gtkwidget.[hc]: accelerator API revamp.
removed ::accelerator_add/remove signals, gtk_widget_accelerator_signal,
gtk_widget_accelerators_locked, gtk_widget_remove_accelerators and
gtk_widget_(un)lock_accelerators.
accelerators maintained through gtk_widget_add/remove_accelerator()
are not runtime changable now, the correct sequence to setup a
widget for runtime changable accelerators is now:
gtk_accel_map_add_entry(accel_path, key, mods);
_gtk_widget_set_accel_path(widget, accel_path, accel_group);
* gtk/gtkwindow.[hc]: accelerator changes, proxy and coalesce accel
group changes (as well as mnemonic changes) through the new signal
::accels_changed.
Sat Nov 10 12:08:56 2001 Tim Janik <timj@gtk.org>
* gtk/gtksettings.c (_gtk_settings_parse_convert): properly handle
GString->string conversions.
2001-11-13 00:53:47 +00:00
|
|
|
|
}
|
|
|
|
|
else if (g_value_type_transformable (G_VALUE_TYPE (src_value), G_VALUE_TYPE (dest_value)))
|
2001-04-03 13:18:00 +00:00
|
|
|
|
success = g_param_value_convert (pspec, src_value, dest_value, TRUE);
|
|
|
|
|
|
|
|
|
|
return success;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2010-12-24 02:55:47 +00:00
|
|
|
|
apply_queued_setting (GtkSettings *settings,
|
|
|
|
|
GParamSpec *pspec,
|
|
|
|
|
GtkSettingsValuePrivate *qvalue)
|
2001-04-03 13:18:00 +00:00
|
|
|
|
{
|
2019-05-19 20:04:47 +00:00
|
|
|
|
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
|
2011-09-30 15:31:04 +00:00
|
|
|
|
GValue tmp_value = G_VALUE_INIT;
|
2002-03-20 21:47:01 +00:00
|
|
|
|
GtkRcPropertyParser parser = (GtkRcPropertyParser) g_param_spec_get_qdata (pspec, quark_property_parser);
|
2001-04-03 13:18:00 +00:00
|
|
|
|
|
|
|
|
|
g_value_init (&tmp_value, G_PARAM_SPEC_VALUE_TYPE (pspec));
|
2002-10-02 14:22:31 +00:00
|
|
|
|
if (_gtk_settings_parse_convert (parser, &qvalue->public.value,
|
2010-12-24 02:55:47 +00:00
|
|
|
|
pspec, &tmp_value))
|
2002-10-02 14:22:31 +00:00
|
|
|
|
{
|
2010-12-24 02:55:47 +00:00
|
|
|
|
if (priv->property_values[pspec->param_id - 1].source <= qvalue->source)
|
|
|
|
|
{
|
|
|
|
|
g_value_copy (&tmp_value, &priv->property_values[pspec->param_id - 1].value);
|
|
|
|
|
priv->property_values[pspec->param_id - 1].source = qvalue->source;
|
2015-09-07 19:55:02 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (settings), pspec);
|
2010-12-24 02:55:47 +00:00
|
|
|
|
}
|
2007-03-01 06:44:00 +00:00
|
|
|
|
|
2002-10-02 14:22:31 +00:00
|
|
|
|
}
|
2001-03-18 04:50:34 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
2002-10-02 14:22:31 +00:00
|
|
|
|
gchar *debug = g_strdup_value_contents (&qvalue->public.value);
|
2010-12-24 02:55:47 +00:00
|
|
|
|
|
2015-09-20 06:32:48 +00:00
|
|
|
|
g_message ("%s: failed to retrieve property '%s' of type '%s' from rc file value \"%s\" of type '%s'",
|
2010-12-24 02:55:47 +00:00
|
|
|
|
qvalue->public.origin ? qvalue->public.origin : "(for origin information, set GTK_DEBUG)",
|
|
|
|
|
pspec->name,
|
|
|
|
|
g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)),
|
|
|
|
|
debug,
|
|
|
|
|
G_VALUE_TYPE_NAME (&tmp_value));
|
2001-04-03 13:18:00 +00:00
|
|
|
|
g_free (debug);
|
2001-03-18 04:50:34 +00:00
|
|
|
|
}
|
2001-04-03 13:18:00 +00:00
|
|
|
|
g_value_unset (&tmp_value);
|
2001-03-18 04:50:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static guint
|
|
|
|
|
settings_install_property_parser (GtkSettingsClass *class,
|
2010-12-24 02:55:47 +00:00
|
|
|
|
GParamSpec *pspec,
|
|
|
|
|
GtkRcPropertyParser parser)
|
2001-03-18 04:50:34 +00:00
|
|
|
|
{
|
|
|
|
|
GSList *node, *next;
|
|
|
|
|
|
|
|
|
|
switch (G_TYPE_FUNDAMENTAL (G_PARAM_SPEC_VALUE_TYPE (pspec)))
|
|
|
|
|
{
|
|
|
|
|
case G_TYPE_BOOLEAN:
|
|
|
|
|
case G_TYPE_UCHAR:
|
|
|
|
|
case G_TYPE_CHAR:
|
|
|
|
|
case G_TYPE_UINT:
|
|
|
|
|
case G_TYPE_INT:
|
|
|
|
|
case G_TYPE_ULONG:
|
|
|
|
|
case G_TYPE_LONG:
|
|
|
|
|
case G_TYPE_FLOAT:
|
|
|
|
|
case G_TYPE_DOUBLE:
|
|
|
|
|
case G_TYPE_STRING:
|
2009-07-16 15:51:55 +00:00
|
|
|
|
case G_TYPE_ENUM:
|
2001-03-18 04:50:34 +00:00
|
|
|
|
break;
|
2007-01-30 11:10:22 +00:00
|
|
|
|
case G_TYPE_BOXED:
|
|
|
|
|
if (strcmp (g_param_spec_get_name (pspec), "color-hash") == 0)
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
/* fall through */
|
2001-03-18 04:50:34 +00:00
|
|
|
|
default:
|
|
|
|
|
if (!parser)
|
2001-06-04 23:15:51 +00:00
|
|
|
|
{
|
2015-09-20 06:32:48 +00:00
|
|
|
|
g_warning (G_STRLOC ": parser needs to be specified for property \"%s\" of type '%s'",
|
2001-06-04 23:15:51 +00:00
|
|
|
|
pspec->name, g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)));
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2001-03-18 04:50:34 +00:00
|
|
|
|
}
|
|
|
|
|
if (g_object_class_find_property (G_OBJECT_CLASS (class), pspec->name))
|
|
|
|
|
{
|
|
|
|
|
g_warning (G_STRLOC ": an rc-data property \"%s\" already exists",
|
2010-12-24 02:55:47 +00:00
|
|
|
|
pspec->name);
|
2001-03-18 04:50:34 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
2010-12-24 02:55:47 +00:00
|
|
|
|
|
2001-03-18 04:50:34 +00:00
|
|
|
|
for (node = object_list; node; node = node->next)
|
|
|
|
|
g_object_freeze_notify (node->data);
|
|
|
|
|
|
|
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (class), ++class_n_properties, pspec);
|
2002-03-20 21:47:01 +00:00
|
|
|
|
g_param_spec_set_qdata (pspec, quark_property_parser, (gpointer) parser);
|
2001-03-18 04:50:34 +00:00
|
|
|
|
|
|
|
|
|
for (node = object_list; node; node = node->next)
|
|
|
|
|
{
|
|
|
|
|
GtkSettings *settings = node->data;
|
2019-05-19 20:04:47 +00:00
|
|
|
|
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
|
2002-10-02 14:22:31 +00:00
|
|
|
|
GtkSettingsValuePrivate *qvalue;
|
2010-12-24 02:55:47 +00:00
|
|
|
|
|
|
|
|
|
priv->property_values = g_renew (GtkSettingsPropertyValue, priv->property_values, class_n_properties);
|
|
|
|
|
priv->property_values[class_n_properties - 1].value.g_type = 0;
|
|
|
|
|
g_value_init (&priv->property_values[class_n_properties - 1].value, G_PARAM_SPEC_VALUE_TYPE (pspec));
|
|
|
|
|
g_param_value_set_default (pspec, &priv->property_values[class_n_properties - 1].value);
|
|
|
|
|
priv->property_values[class_n_properties - 1].source = GTK_SETTINGS_SOURCE_DEFAULT;
|
2015-09-07 19:55:02 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (settings), pspec);
|
2010-12-24 02:55:47 +00:00
|
|
|
|
|
2015-09-12 13:14:47 +00:00
|
|
|
|
qvalue = g_datalist_id_dup_data (&priv->queued_settings, g_param_spec_get_name_quark (pspec), NULL, NULL);
|
2001-03-18 04:50:34 +00:00
|
|
|
|
if (qvalue)
|
2010-12-24 02:55:47 +00:00
|
|
|
|
apply_queued_setting (settings, pspec, qvalue);
|
2001-03-18 04:50:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (node = object_list; node; node = next)
|
|
|
|
|
{
|
|
|
|
|
next = node->next;
|
|
|
|
|
g_object_thaw_notify (node->data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return class_n_properties;
|
|
|
|
|
}
|
|
|
|
|
|
2001-04-02 03:47:25 +00:00
|
|
|
|
GtkRcPropertyParser
|
2001-04-03 13:18:00 +00:00
|
|
|
|
_gtk_rc_property_parser_from_type (GType type)
|
2001-04-02 03:47:25 +00:00
|
|
|
|
{
|
2016-10-28 21:03:24 +00:00
|
|
|
|
if (type == GTK_TYPE_REQUISITION)
|
2001-04-02 03:47:25 +00:00
|
|
|
|
return gtk_rc_property_parse_requisition;
|
|
|
|
|
else if (type == GTK_TYPE_BORDER)
|
|
|
|
|
return gtk_rc_property_parse_border;
|
|
|
|
|
else if (G_TYPE_FUNDAMENTAL (type) == G_TYPE_ENUM && G_TYPE_IS_DERIVED (type))
|
|
|
|
|
return gtk_rc_property_parse_enum;
|
|
|
|
|
else if (G_TYPE_FUNDAMENTAL (type) == G_TYPE_FLAGS && G_TYPE_IS_DERIVED (type))
|
|
|
|
|
return gtk_rc_property_parse_flags;
|
|
|
|
|
else
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2001-03-18 04:50:34 +00:00
|
|
|
|
static void
|
|
|
|
|
free_value (gpointer data)
|
|
|
|
|
{
|
2002-10-02 14:22:31 +00:00
|
|
|
|
GtkSettingsValuePrivate *qvalue = data;
|
2010-12-24 02:55:47 +00:00
|
|
|
|
|
2002-10-02 14:22:31 +00:00
|
|
|
|
g_value_unset (&qvalue->public.value);
|
|
|
|
|
g_free (qvalue->public.origin);
|
2008-05-25 23:47:36 +00:00
|
|
|
|
g_slice_free (GtkSettingsValuePrivate, qvalue);
|
2001-03-18 04:50:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-10-02 14:22:31 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_settings_set_property_value_internal (GtkSettings *settings,
|
2010-12-24 02:55:47 +00:00
|
|
|
|
const gchar *prop_name,
|
|
|
|
|
const GtkSettingsValue *new_value,
|
|
|
|
|
GtkSettingsSource source)
|
2001-03-18 04:50:34 +00:00
|
|
|
|
{
|
2019-05-19 20:04:47 +00:00
|
|
|
|
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
|
2002-10-02 14:22:31 +00:00
|
|
|
|
GtkSettingsValuePrivate *qvalue;
|
2001-03-18 04:50:34 +00:00
|
|
|
|
GParamSpec *pspec;
|
|
|
|
|
gchar *name;
|
|
|
|
|
GQuark name_quark;
|
|
|
|
|
|
|
|
|
|
if (!G_VALUE_HOLDS_LONG (&new_value->value) &&
|
|
|
|
|
!G_VALUE_HOLDS_DOUBLE (&new_value->value) &&
|
|
|
|
|
!G_VALUE_HOLDS_STRING (&new_value->value) &&
|
|
|
|
|
!G_VALUE_HOLDS (&new_value->value, G_TYPE_GSTRING))
|
|
|
|
|
{
|
2011-01-26 15:46:40 +00:00
|
|
|
|
g_warning (G_STRLOC ": value type invalid (%s)", g_type_name (G_VALUE_TYPE (&new_value->value)));
|
2001-03-18 04:50:34 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2010-12-24 02:55:47 +00:00
|
|
|
|
|
2001-03-18 04:50:34 +00:00
|
|
|
|
name = g_strdup (prop_name);
|
2006-07-07 15:54:06 +00:00
|
|
|
|
g_strcanon (name, G_CSET_DIGITS "-" G_CSET_a_2_z G_CSET_A_2_Z, '-');
|
2001-12-04 17:20:41 +00:00
|
|
|
|
name_quark = g_quark_from_string (name);
|
|
|
|
|
g_free (name);
|
2001-03-18 04:50:34 +00:00
|
|
|
|
|
2015-09-12 13:14:47 +00:00
|
|
|
|
qvalue = g_datalist_id_dup_data (&priv->queued_settings, name_quark, NULL, NULL);
|
2001-03-18 04:50:34 +00:00
|
|
|
|
if (!qvalue)
|
|
|
|
|
{
|
2008-05-25 23:47:36 +00:00
|
|
|
|
qvalue = g_slice_new0 (GtkSettingsValuePrivate);
|
2010-12-24 02:55:47 +00:00
|
|
|
|
g_datalist_id_set_data_full (&priv->queued_settings, name_quark, qvalue, free_value);
|
2001-03-18 04:50:34 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2002-10-02 14:22:31 +00:00
|
|
|
|
g_free (qvalue->public.origin);
|
|
|
|
|
g_value_unset (&qvalue->public.value);
|
2001-03-18 04:50:34 +00:00
|
|
|
|
}
|
2002-10-02 14:22:31 +00:00
|
|
|
|
qvalue->public.origin = g_strdup (new_value->origin);
|
|
|
|
|
g_value_init (&qvalue->public.value, G_VALUE_TYPE (&new_value->value));
|
|
|
|
|
g_value_copy (&new_value->value, &qvalue->public.value);
|
2002-11-16 01:30:12 +00:00
|
|
|
|
qvalue->source = source;
|
2001-03-18 04:50:34 +00:00
|
|
|
|
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (settings), g_quark_to_string (name_quark));
|
|
|
|
|
if (pspec)
|
|
|
|
|
apply_queued_setting (settings, pspec, qvalue);
|
|
|
|
|
}
|
|
|
|
|
|
2002-10-02 14:22:31 +00:00
|
|
|
|
void
|
|
|
|
|
_gtk_settings_set_property_value_from_rc (GtkSettings *settings,
|
2010-12-24 02:55:47 +00:00
|
|
|
|
const gchar *prop_name,
|
|
|
|
|
const GtkSettingsValue *new_value)
|
2002-10-02 14:22:31 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GTK_SETTINGS (settings));
|
|
|
|
|
g_return_if_fail (prop_name != NULL);
|
|
|
|
|
g_return_if_fail (new_value != NULL);
|
|
|
|
|
|
2002-11-25 22:29:32 +00:00
|
|
|
|
gtk_settings_set_property_value_internal (settings, prop_name, new_value,
|
2011-01-26 16:20:22 +00:00
|
|
|
|
GTK_SETTINGS_SOURCE_THEME);
|
2002-10-02 14:22:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-10-06 19:46:27 +00:00
|
|
|
|
static const GScannerConfig gtk_rc_scanner_config =
|
|
|
|
|
{
|
2016-10-15 20:24:42 +00:00
|
|
|
|
(char *) (
|
2016-10-06 19:46:27 +00:00
|
|
|
|
" \t\r\n"
|
|
|
|
|
) /* cset_skip_characters */,
|
2016-10-15 20:24:42 +00:00
|
|
|
|
(char *) (
|
2016-10-06 19:46:27 +00:00
|
|
|
|
"_"
|
|
|
|
|
G_CSET_a_2_z
|
|
|
|
|
G_CSET_A_2_Z
|
|
|
|
|
) /* cset_identifier_first */,
|
2016-10-15 20:24:42 +00:00
|
|
|
|
(char *) (
|
2016-10-06 19:46:27 +00:00
|
|
|
|
G_CSET_DIGITS
|
|
|
|
|
"-_"
|
|
|
|
|
G_CSET_a_2_z
|
|
|
|
|
G_CSET_A_2_Z
|
|
|
|
|
) /* cset_identifier_nth */,
|
2016-10-15 20:24:42 +00:00
|
|
|
|
(char *) ( "#\n" ) /* cpair_comment_single */,
|
2016-10-06 19:46:27 +00:00
|
|
|
|
|
|
|
|
|
TRUE /* case_sensitive */,
|
|
|
|
|
|
|
|
|
|
TRUE /* skip_comment_multi */,
|
|
|
|
|
TRUE /* skip_comment_single */,
|
|
|
|
|
TRUE /* scan_comment_multi */,
|
|
|
|
|
TRUE /* scan_identifier */,
|
|
|
|
|
FALSE /* scan_identifier_1char */,
|
|
|
|
|
FALSE /* scan_identifier_NULL */,
|
|
|
|
|
TRUE /* scan_symbols */,
|
|
|
|
|
TRUE /* scan_binary */,
|
|
|
|
|
TRUE /* scan_octal */,
|
|
|
|
|
TRUE /* scan_float */,
|
|
|
|
|
TRUE /* scan_hex */,
|
|
|
|
|
TRUE /* scan_hex_dollar */,
|
|
|
|
|
TRUE /* scan_string_sq */,
|
|
|
|
|
TRUE /* scan_string_dq */,
|
|
|
|
|
TRUE /* numbers_2_int */,
|
|
|
|
|
FALSE /* int_2_float */,
|
|
|
|
|
FALSE /* identifier_2_string */,
|
|
|
|
|
TRUE /* char_2_token */,
|
|
|
|
|
TRUE /* symbol_2_token */,
|
|
|
|
|
FALSE /* scope_0_fallback */,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static GScanner*
|
|
|
|
|
gtk_rc_scanner_new (void)
|
|
|
|
|
{
|
|
|
|
|
return g_scanner_new (>k_rc_scanner_config);
|
|
|
|
|
}
|
|
|
|
|
|
2003-05-19 00:55:20 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_rc_property_parse_enum:
|
|
|
|
|
* @pspec: a #GParamSpec
|
|
|
|
|
* @gstring: the #GString to be parsed
|
|
|
|
|
* @property_value: a #GValue which must hold enum values.
|
2010-12-24 02:55:47 +00:00
|
|
|
|
*
|
2003-05-19 00:55:20 +00:00
|
|
|
|
* A #GtkRcPropertyParser for use with gtk_settings_install_property_parser()
|
|
|
|
|
* or gtk_widget_class_install_style_property_parser() which parses a single
|
|
|
|
|
* enumeration value.
|
|
|
|
|
*
|
|
|
|
|
* The enumeration value can be specified by its name, its nickname or
|
|
|
|
|
* its numeric value. For consistency with flags parsing, the value
|
|
|
|
|
* may be surrounded by parentheses.
|
2010-12-24 02:55:47 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: %TRUE if @gstring could be parsed and @property_value
|
2003-05-19 00:55:20 +00:00
|
|
|
|
* has been set to the resulting #GEnumValue.
|
|
|
|
|
**/
|
2001-03-18 04:50:34 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gtk_rc_property_parse_enum (const GParamSpec *pspec,
|
2010-12-24 02:55:47 +00:00
|
|
|
|
const GString *gstring,
|
|
|
|
|
GValue *property_value)
|
2001-03-18 04:50:34 +00:00
|
|
|
|
{
|
|
|
|
|
gboolean need_closing_brace = FALSE, success = FALSE;
|
|
|
|
|
GScanner *scanner;
|
|
|
|
|
GEnumValue *enum_value = NULL;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE);
|
|
|
|
|
g_return_val_if_fail (G_VALUE_HOLDS_ENUM (property_value), FALSE);
|
|
|
|
|
|
|
|
|
|
scanner = gtk_rc_scanner_new ();
|
|
|
|
|
g_scanner_input_text (scanner, gstring->str, gstring->len);
|
|
|
|
|
|
|
|
|
|
/* we just want to parse _one_ value, but for consistency with flags parsing
|
2003-05-19 00:55:20 +00:00
|
|
|
|
* we support optional parenthesis
|
2001-03-18 04:50:34 +00:00
|
|
|
|
*/
|
|
|
|
|
g_scanner_get_next_token (scanner);
|
|
|
|
|
if (scanner->token == '(')
|
|
|
|
|
{
|
|
|
|
|
need_closing_brace = TRUE;
|
|
|
|
|
g_scanner_get_next_token (scanner);
|
|
|
|
|
}
|
|
|
|
|
if (scanner->token == G_TOKEN_IDENTIFIER)
|
|
|
|
|
{
|
|
|
|
|
GEnumClass *class = G_PARAM_SPEC_ENUM (pspec)->enum_class;
|
2010-12-24 02:55:47 +00:00
|
|
|
|
|
2001-03-18 04:50:34 +00:00
|
|
|
|
enum_value = g_enum_get_value_by_name (class, scanner->value.v_identifier);
|
|
|
|
|
if (!enum_value)
|
2010-12-24 02:55:47 +00:00
|
|
|
|
enum_value = g_enum_get_value_by_nick (class, scanner->value.v_identifier);
|
2001-03-18 04:50:34 +00:00
|
|
|
|
if (enum_value)
|
2010-12-24 02:55:47 +00:00
|
|
|
|
{
|
|
|
|
|
g_value_set_enum (property_value, enum_value->value);
|
|
|
|
|
success = TRUE;
|
|
|
|
|
}
|
2001-03-18 04:50:34 +00:00
|
|
|
|
}
|
|
|
|
|
else if (scanner->token == G_TOKEN_INT)
|
|
|
|
|
{
|
|
|
|
|
g_value_set_enum (property_value, scanner->value.v_int);
|
|
|
|
|
success = TRUE;
|
|
|
|
|
}
|
|
|
|
|
if (need_closing_brace && g_scanner_get_next_token (scanner) != ')')
|
|
|
|
|
success = FALSE;
|
|
|
|
|
if (g_scanner_get_next_token (scanner) != G_TOKEN_EOF)
|
|
|
|
|
success = FALSE;
|
|
|
|
|
|
|
|
|
|
g_scanner_destroy (scanner);
|
|
|
|
|
|
|
|
|
|
return success;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static guint
|
|
|
|
|
parse_flags_value (GScanner *scanner,
|
2010-12-24 02:55:47 +00:00
|
|
|
|
GFlagsClass *class,
|
|
|
|
|
guint *number)
|
2001-03-18 04:50:34 +00:00
|
|
|
|
{
|
|
|
|
|
g_scanner_get_next_token (scanner);
|
|
|
|
|
if (scanner->token == G_TOKEN_IDENTIFIER)
|
|
|
|
|
{
|
|
|
|
|
GFlagsValue *flags_value;
|
|
|
|
|
|
|
|
|
|
flags_value = g_flags_get_value_by_name (class, scanner->value.v_identifier);
|
|
|
|
|
if (!flags_value)
|
2010-12-24 02:55:47 +00:00
|
|
|
|
flags_value = g_flags_get_value_by_nick (class, scanner->value.v_identifier);
|
2001-03-18 04:50:34 +00:00
|
|
|
|
if (flags_value)
|
2010-12-24 02:55:47 +00:00
|
|
|
|
{
|
|
|
|
|
*number |= flags_value->value;
|
|
|
|
|
return G_TOKEN_NONE;
|
|
|
|
|
}
|
2001-03-18 04:50:34 +00:00
|
|
|
|
}
|
|
|
|
|
else if (scanner->token == G_TOKEN_INT)
|
|
|
|
|
{
|
|
|
|
|
*number |= scanner->value.v_int;
|
|
|
|
|
return G_TOKEN_NONE;
|
|
|
|
|
}
|
|
|
|
|
return G_TOKEN_IDENTIFIER;
|
|
|
|
|
}
|
|
|
|
|
|
2003-05-19 00:55:20 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_rc_property_parse_flags:
|
|
|
|
|
* @pspec: a #GParamSpec
|
|
|
|
|
* @gstring: the #GString to be parsed
|
|
|
|
|
* @property_value: a #GValue which must hold flags values.
|
2010-12-24 02:55:47 +00:00
|
|
|
|
*
|
2003-05-19 00:55:20 +00:00
|
|
|
|
* A #GtkRcPropertyParser for use with gtk_settings_install_property_parser()
|
2010-12-24 02:55:47 +00:00
|
|
|
|
* or gtk_widget_class_install_style_property_parser() which parses flags.
|
|
|
|
|
*
|
2003-05-19 00:55:20 +00:00
|
|
|
|
* Flags can be specified by their name, their nickname or
|
2010-12-24 02:55:47 +00:00
|
|
|
|
* numerically. Multiple flags can be specified in the form
|
2014-02-04 23:21:13 +00:00
|
|
|
|
* `"( flag1 | flag2 | ... )"`.
|
2010-12-24 02:55:47 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: %TRUE if @gstring could be parsed and @property_value
|
2003-05-19 00:55:20 +00:00
|
|
|
|
* has been set to the resulting flags value.
|
|
|
|
|
**/
|
2001-03-18 04:50:34 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gtk_rc_property_parse_flags (const GParamSpec *pspec,
|
2010-12-24 02:55:47 +00:00
|
|
|
|
const GString *gstring,
|
|
|
|
|
GValue *property_value)
|
2001-03-18 04:50:34 +00:00
|
|
|
|
{
|
|
|
|
|
GFlagsClass *class;
|
2003-05-19 00:55:20 +00:00
|
|
|
|
gboolean success = FALSE;
|
2001-03-18 04:50:34 +00:00
|
|
|
|
GScanner *scanner;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE);
|
|
|
|
|
g_return_val_if_fail (G_VALUE_HOLDS_FLAGS (property_value), FALSE);
|
|
|
|
|
|
|
|
|
|
class = G_PARAM_SPEC_FLAGS (pspec)->flags_class;
|
|
|
|
|
scanner = gtk_rc_scanner_new ();
|
|
|
|
|
g_scanner_input_text (scanner, gstring->str, gstring->len);
|
|
|
|
|
|
|
|
|
|
/* parse either a single flags value or a "\( ... [ \| ... ] \)" compound */
|
|
|
|
|
if (g_scanner_peek_next_token (scanner) == G_TOKEN_IDENTIFIER ||
|
|
|
|
|
scanner->next_token == G_TOKEN_INT)
|
|
|
|
|
{
|
|
|
|
|
guint token, flags_value = 0;
|
2010-12-24 02:55:47 +00:00
|
|
|
|
|
2001-03-18 04:50:34 +00:00
|
|
|
|
token = parse_flags_value (scanner, class, &flags_value);
|
|
|
|
|
|
|
|
|
|
if (token == G_TOKEN_NONE && g_scanner_peek_next_token (scanner) == G_TOKEN_EOF)
|
2010-12-24 02:55:47 +00:00
|
|
|
|
{
|
|
|
|
|
success = TRUE;
|
|
|
|
|
g_value_set_flags (property_value, flags_value);
|
|
|
|
|
}
|
|
|
|
|
|
2001-03-18 04:50:34 +00:00
|
|
|
|
}
|
|
|
|
|
else if (g_scanner_get_next_token (scanner) == '(')
|
|
|
|
|
{
|
|
|
|
|
guint token, flags_value = 0;
|
|
|
|
|
|
|
|
|
|
/* parse first value */
|
|
|
|
|
token = parse_flags_value (scanner, class, &flags_value);
|
|
|
|
|
|
|
|
|
|
/* parse nth values, preceeded by '|' */
|
|
|
|
|
while (token == G_TOKEN_NONE && g_scanner_get_next_token (scanner) == '|')
|
2010-12-24 02:55:47 +00:00
|
|
|
|
token = parse_flags_value (scanner, class, &flags_value);
|
2001-03-18 04:50:34 +00:00
|
|
|
|
|
|
|
|
|
/* done, last token must have closed expression */
|
|
|
|
|
if (token == G_TOKEN_NONE && scanner->token == ')' &&
|
2010-12-24 02:55:47 +00:00
|
|
|
|
g_scanner_peek_next_token (scanner) == G_TOKEN_EOF)
|
|
|
|
|
{
|
|
|
|
|
g_value_set_flags (property_value, flags_value);
|
|
|
|
|
success = TRUE;
|
|
|
|
|
}
|
2001-03-18 04:50:34 +00:00
|
|
|
|
}
|
|
|
|
|
g_scanner_destroy (scanner);
|
|
|
|
|
|
|
|
|
|
return success;
|
|
|
|
|
}
|
2001-04-02 03:47:25 +00:00
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
get_braced_int (GScanner *scanner,
|
2010-12-24 02:55:47 +00:00
|
|
|
|
gboolean first,
|
|
|
|
|
gboolean last,
|
|
|
|
|
gint *value)
|
2001-04-02 03:47:25 +00:00
|
|
|
|
{
|
|
|
|
|
if (first)
|
|
|
|
|
{
|
|
|
|
|
g_scanner_get_next_token (scanner);
|
|
|
|
|
if (scanner->token != '{')
|
2010-12-24 02:55:47 +00:00
|
|
|
|
return FALSE;
|
2001-04-02 03:47:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_scanner_get_next_token (scanner);
|
|
|
|
|
if (scanner->token != G_TOKEN_INT)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
*value = scanner->value.v_int;
|
|
|
|
|
|
|
|
|
|
if (last)
|
|
|
|
|
{
|
|
|
|
|
g_scanner_get_next_token (scanner);
|
|
|
|
|
if (scanner->token != '}')
|
2010-12-24 02:55:47 +00:00
|
|
|
|
return FALSE;
|
2001-04-02 03:47:25 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
g_scanner_get_next_token (scanner);
|
|
|
|
|
if (scanner->token != ',')
|
2010-12-24 02:55:47 +00:00
|
|
|
|
return FALSE;
|
2001-04-02 03:47:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2003-05-19 00:55:20 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_rc_property_parse_requisition:
|
|
|
|
|
* @pspec: a #GParamSpec
|
|
|
|
|
* @gstring: the #GString to be parsed
|
|
|
|
|
* @property_value: a #GValue which must hold boxed values.
|
2010-12-24 02:55:47 +00:00
|
|
|
|
*
|
2003-05-19 00:55:20 +00:00
|
|
|
|
* A #GtkRcPropertyParser for use with gtk_settings_install_property_parser()
|
|
|
|
|
* or gtk_widget_class_install_style_property_parser() which parses a
|
2010-12-24 02:55:47 +00:00
|
|
|
|
* requisition in the form
|
2014-02-04 23:21:13 +00:00
|
|
|
|
* `"{ width, height }"` for integers %width and %height.
|
2010-12-24 02:55:47 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: %TRUE if @gstring could be parsed and @property_value
|
2003-05-19 00:55:20 +00:00
|
|
|
|
* has been set to the resulting #GtkRequisition.
|
|
|
|
|
**/
|
2001-04-02 03:47:25 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gtk_rc_property_parse_requisition (const GParamSpec *pspec,
|
2010-12-24 02:55:47 +00:00
|
|
|
|
const GString *gstring,
|
|
|
|
|
GValue *property_value)
|
2001-04-02 03:47:25 +00:00
|
|
|
|
{
|
|
|
|
|
GtkRequisition requisition;
|
|
|
|
|
GScanner *scanner;
|
|
|
|
|
gboolean success = FALSE;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE);
|
|
|
|
|
g_return_val_if_fail (G_VALUE_HOLDS_BOXED (property_value), FALSE);
|
|
|
|
|
|
|
|
|
|
scanner = gtk_rc_scanner_new ();
|
|
|
|
|
g_scanner_input_text (scanner, gstring->str, gstring->len);
|
|
|
|
|
|
|
|
|
|
if (get_braced_int (scanner, TRUE, FALSE, &requisition.width) &&
|
|
|
|
|
get_braced_int (scanner, FALSE, TRUE, &requisition.height))
|
|
|
|
|
{
|
|
|
|
|
g_value_set_boxed (property_value, &requisition);
|
|
|
|
|
success = TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_scanner_destroy (scanner);
|
|
|
|
|
|
|
|
|
|
return success;
|
|
|
|
|
}
|
|
|
|
|
|
2003-05-19 00:55:20 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_rc_property_parse_border:
|
|
|
|
|
* @pspec: a #GParamSpec
|
|
|
|
|
* @gstring: the #GString to be parsed
|
|
|
|
|
* @property_value: a #GValue which must hold boxed values.
|
2010-12-24 02:55:47 +00:00
|
|
|
|
*
|
2003-05-19 00:55:20 +00:00
|
|
|
|
* A #GtkRcPropertyParser for use with gtk_settings_install_property_parser()
|
|
|
|
|
* or gtk_widget_class_install_style_property_parser() which parses
|
2010-12-24 02:55:47 +00:00
|
|
|
|
* borders in the form
|
2014-02-04 23:21:13 +00:00
|
|
|
|
* `"{ left, right, top, bottom }"` for integers
|
2014-01-21 22:14:04 +00:00
|
|
|
|
* left, right, top and bottom.
|
2010-12-24 02:55:47 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: %TRUE if @gstring could be parsed and @property_value
|
2003-05-19 00:55:20 +00:00
|
|
|
|
* has been set to the resulting #GtkBorder.
|
|
|
|
|
**/
|
2001-04-02 03:47:25 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gtk_rc_property_parse_border (const GParamSpec *pspec,
|
2010-12-24 02:55:47 +00:00
|
|
|
|
const GString *gstring,
|
|
|
|
|
GValue *property_value)
|
2001-04-02 03:47:25 +00:00
|
|
|
|
{
|
|
|
|
|
GtkBorder border;
|
|
|
|
|
GScanner *scanner;
|
|
|
|
|
gboolean success = FALSE;
|
2010-09-11 23:25:57 +00:00
|
|
|
|
int left, right, top, bottom;
|
2001-04-02 03:47:25 +00:00
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE);
|
|
|
|
|
g_return_val_if_fail (G_VALUE_HOLDS_BOXED (property_value), FALSE);
|
|
|
|
|
|
|
|
|
|
scanner = gtk_rc_scanner_new ();
|
|
|
|
|
g_scanner_input_text (scanner, gstring->str, gstring->len);
|
|
|
|
|
|
2010-09-11 23:25:57 +00:00
|
|
|
|
if (get_braced_int (scanner, TRUE, FALSE, &left) &&
|
|
|
|
|
get_braced_int (scanner, FALSE, FALSE, &right) &&
|
|
|
|
|
get_braced_int (scanner, FALSE, FALSE, &top) &&
|
|
|
|
|
get_braced_int (scanner, FALSE, TRUE, &bottom))
|
2001-04-02 03:47:25 +00:00
|
|
|
|
{
|
2010-09-11 23:25:57 +00:00
|
|
|
|
border.left = left;
|
|
|
|
|
border.right = right;
|
|
|
|
|
border.top = top;
|
|
|
|
|
border.bottom = bottom;
|
2001-04-02 03:47:25 +00:00
|
|
|
|
g_value_set_boxed (property_value, &border);
|
|
|
|
|
success = TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_scanner_destroy (scanner);
|
|
|
|
|
|
|
|
|
|
return success;
|
|
|
|
|
}
|
2001-04-02 23:33:47 +00:00
|
|
|
|
|
2002-10-02 14:22:31 +00:00
|
|
|
|
static void
|
2010-12-24 02:55:47 +00:00
|
|
|
|
reset_rc_values_foreach (GQuark key_id,
|
|
|
|
|
gpointer data,
|
|
|
|
|
gpointer user_data)
|
2002-10-02 14:22:31 +00:00
|
|
|
|
{
|
|
|
|
|
GtkSettingsValuePrivate *qvalue = data;
|
|
|
|
|
GSList **to_reset = user_data;
|
|
|
|
|
|
2011-01-26 16:20:22 +00:00
|
|
|
|
if (qvalue->source == GTK_SETTINGS_SOURCE_THEME)
|
2002-10-02 14:22:31 +00:00
|
|
|
|
*to_reset = g_slist_prepend (*to_reset, GUINT_TO_POINTER (key_id));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
_gtk_settings_reset_rc_values (GtkSettings *settings)
|
|
|
|
|
{
|
2019-05-19 20:04:47 +00:00
|
|
|
|
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
|
2002-10-02 14:22:31 +00:00
|
|
|
|
GSList *to_reset = NULL;
|
|
|
|
|
GSList *tmp_list;
|
|
|
|
|
GParamSpec **pspecs, **p;
|
|
|
|
|
gint i;
|
|
|
|
|
|
2010-12-24 02:55:47 +00:00
|
|
|
|
/* Remove any queued settings */
|
|
|
|
|
g_datalist_foreach (&priv->queued_settings,
|
|
|
|
|
reset_rc_values_foreach,
|
|
|
|
|
&to_reset);
|
2002-10-02 14:22:31 +00:00
|
|
|
|
|
|
|
|
|
for (tmp_list = to_reset; tmp_list; tmp_list = tmp_list->next)
|
|
|
|
|
{
|
|
|
|
|
GQuark key_id = GPOINTER_TO_UINT (tmp_list->data);
|
2010-12-24 02:55:47 +00:00
|
|
|
|
g_datalist_id_remove_data (&priv->queued_settings, key_id);
|
2002-10-02 14:22:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-09-09 05:22:16 +00:00
|
|
|
|
g_slist_free (to_reset);
|
|
|
|
|
|
2002-10-02 14:22:31 +00:00
|
|
|
|
/* Now reset the active settings
|
|
|
|
|
*/
|
|
|
|
|
pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (settings), NULL);
|
|
|
|
|
i = 0;
|
|
|
|
|
|
|
|
|
|
g_object_freeze_notify (G_OBJECT (settings));
|
|
|
|
|
for (p = pspecs; *p; p++)
|
|
|
|
|
{
|
2011-01-26 16:20:22 +00:00
|
|
|
|
if (priv->property_values[i].source == GTK_SETTINGS_SOURCE_THEME)
|
2010-12-24 02:55:47 +00:00
|
|
|
|
{
|
|
|
|
|
GParamSpec *pspec = *p;
|
2002-10-02 14:22:31 +00:00
|
|
|
|
|
2010-12-24 02:55:47 +00:00
|
|
|
|
g_param_value_set_default (pspec, &priv->property_values[i].value);
|
2015-09-07 19:55:02 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (settings), pspec);
|
2010-12-24 02:55:47 +00:00
|
|
|
|
}
|
2002-10-02 14:22:31 +00:00
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
g_object_thaw_notify (G_OBJECT (settings));
|
|
|
|
|
g_free (pspecs);
|
|
|
|
|
}
|
|
|
|
|
|
2003-01-15 21:01:54 +00:00
|
|
|
|
static void
|
2003-12-16 00:56:48 +00:00
|
|
|
|
settings_update_double_click (GtkSettings *settings)
|
2003-01-15 21:01:54 +00:00
|
|
|
|
{
|
2019-05-19 20:04:47 +00:00
|
|
|
|
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
|
2016-04-11 03:44:05 +00:00
|
|
|
|
gint double_click_time;
|
|
|
|
|
gint double_click_distance;
|
2010-12-24 02:55:47 +00:00
|
|
|
|
|
2016-04-11 03:44:05 +00:00
|
|
|
|
g_object_get (settings,
|
|
|
|
|
"gtk-double-click-time", &double_click_time,
|
|
|
|
|
"gtk-double-click-distance", &double_click_distance,
|
|
|
|
|
NULL);
|
2010-12-24 02:55:47 +00:00
|
|
|
|
|
2017-10-30 20:06:42 +00:00
|
|
|
|
gdk_display_set_double_click_time (priv->display, double_click_time);
|
|
|
|
|
gdk_display_set_double_click_distance (priv->display, double_click_distance);
|
2003-01-15 21:01:54 +00:00
|
|
|
|
}
|
2004-09-01 20:30:24 +00:00
|
|
|
|
|
2005-06-15 19:25:49 +00:00
|
|
|
|
static void
|
|
|
|
|
settings_update_cursor_theme (GtkSettings *settings)
|
|
|
|
|
{
|
2019-05-19 20:04:47 +00:00
|
|
|
|
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
|
2005-06-15 19:25:49 +00:00
|
|
|
|
gchar *theme = NULL;
|
|
|
|
|
gint size = 0;
|
2010-12-24 02:55:47 +00:00
|
|
|
|
|
2013-03-23 00:31:50 +00:00
|
|
|
|
g_object_get (settings,
|
|
|
|
|
"gtk-cursor-theme-name", &theme,
|
|
|
|
|
"gtk-cursor-theme-size", &size,
|
|
|
|
|
NULL);
|
2017-11-17 22:56:03 +00:00
|
|
|
|
if (theme)
|
|
|
|
|
{
|
|
|
|
|
gdk_display_set_cursor_theme (priv->display, theme, size);
|
|
|
|
|
g_free (theme);
|
|
|
|
|
}
|
2005-06-15 19:25:49 +00:00
|
|
|
|
}
|
2005-08-24 16:17:56 +00:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
settings_update_font_options (GtkSettings *settings)
|
|
|
|
|
{
|
2019-05-19 20:04:47 +00:00
|
|
|
|
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
|
2005-08-24 16:17:56 +00:00
|
|
|
|
gint hinting;
|
|
|
|
|
gchar *hint_style_str;
|
2014-12-03 00:09:38 +00:00
|
|
|
|
cairo_hint_style_t hint_style;
|
2005-08-24 16:17:56 +00:00
|
|
|
|
gint antialias;
|
2014-12-03 00:09:38 +00:00
|
|
|
|
cairo_antialias_t antialias_mode;
|
2005-08-24 16:17:56 +00:00
|
|
|
|
gchar *rgba_str;
|
2014-12-03 00:09:38 +00:00
|
|
|
|
cairo_subpixel_order_t subpixel_order;
|
2016-09-30 02:58:29 +00:00
|
|
|
|
|
|
|
|
|
if (priv->font_options)
|
|
|
|
|
cairo_font_options_destroy (priv->font_options);
|
2010-12-24 02:55:47 +00:00
|
|
|
|
|
2005-08-24 16:17:56 +00:00
|
|
|
|
g_object_get (settings,
|
2010-12-24 02:55:47 +00:00
|
|
|
|
"gtk-xft-antialias", &antialias,
|
|
|
|
|
"gtk-xft-hinting", &hinting,
|
|
|
|
|
"gtk-xft-hintstyle", &hint_style_str,
|
|
|
|
|
"gtk-xft-rgba", &rgba_str,
|
|
|
|
|
NULL);
|
2005-08-24 16:17:56 +00:00
|
|
|
|
|
2016-09-30 02:58:29 +00:00
|
|
|
|
priv->font_options = cairo_font_options_create ();
|
2008-06-16 18:53:17 +00:00
|
|
|
|
|
2016-09-30 02:58:29 +00:00
|
|
|
|
cairo_font_options_set_hint_metrics (priv->font_options, CAIRO_HINT_METRICS_ON);
|
2010-12-24 02:55:47 +00:00
|
|
|
|
|
2014-12-03 00:09:38 +00:00
|
|
|
|
hint_style = CAIRO_HINT_STYLE_DEFAULT;
|
|
|
|
|
if (hinting == 0)
|
2005-08-24 16:17:56 +00:00
|
|
|
|
{
|
|
|
|
|
hint_style = CAIRO_HINT_STYLE_NONE;
|
|
|
|
|
}
|
2014-12-03 00:09:38 +00:00
|
|
|
|
else if (hinting == 1)
|
2005-08-24 16:17:56 +00:00
|
|
|
|
{
|
2014-12-03 00:09:38 +00:00
|
|
|
|
if (hint_style_str)
|
|
|
|
|
{
|
|
|
|
|
if (strcmp (hint_style_str, "hintnone") == 0)
|
|
|
|
|
hint_style = CAIRO_HINT_STYLE_NONE;
|
|
|
|
|
else if (strcmp (hint_style_str, "hintslight") == 0)
|
|
|
|
|
hint_style = CAIRO_HINT_STYLE_SLIGHT;
|
|
|
|
|
else if (strcmp (hint_style_str, "hintmedium") == 0)
|
|
|
|
|
hint_style = CAIRO_HINT_STYLE_MEDIUM;
|
|
|
|
|
else if (strcmp (hint_style_str, "hintfull") == 0)
|
|
|
|
|
hint_style = CAIRO_HINT_STYLE_FULL;
|
|
|
|
|
}
|
2005-08-24 16:17:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-03-09 21:57:37 +00:00
|
|
|
|
g_free (hint_style_str);
|
2005-08-24 16:17:56 +00:00
|
|
|
|
|
2016-09-30 02:58:29 +00:00
|
|
|
|
cairo_font_options_set_hint_style (priv->font_options, hint_style);
|
2005-08-24 16:17:56 +00:00
|
|
|
|
|
2014-12-03 00:09:38 +00:00
|
|
|
|
subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
|
2005-08-24 16:17:56 +00:00
|
|
|
|
if (rgba_str)
|
|
|
|
|
{
|
|
|
|
|
if (strcmp (rgba_str, "rgb") == 0)
|
2010-12-24 02:55:47 +00:00
|
|
|
|
subpixel_order = CAIRO_SUBPIXEL_ORDER_RGB;
|
2005-08-24 16:17:56 +00:00
|
|
|
|
else if (strcmp (rgba_str, "bgr") == 0)
|
2010-12-24 02:55:47 +00:00
|
|
|
|
subpixel_order = CAIRO_SUBPIXEL_ORDER_BGR;
|
2005-08-24 16:17:56 +00:00
|
|
|
|
else if (strcmp (rgba_str, "vrgb") == 0)
|
2010-12-24 02:55:47 +00:00
|
|
|
|
subpixel_order = CAIRO_SUBPIXEL_ORDER_VRGB;
|
2005-08-24 16:17:56 +00:00
|
|
|
|
else if (strcmp (rgba_str, "vbgr") == 0)
|
2010-12-24 02:55:47 +00:00
|
|
|
|
subpixel_order = CAIRO_SUBPIXEL_ORDER_VBGR;
|
2005-08-24 16:17:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 00:09:38 +00:00
|
|
|
|
g_free (rgba_str);
|
|
|
|
|
|
2016-09-30 02:58:29 +00:00
|
|
|
|
cairo_font_options_set_subpixel_order (priv->font_options, subpixel_order);
|
2010-12-24 02:55:47 +00:00
|
|
|
|
|
2014-12-03 00:09:38 +00:00
|
|
|
|
antialias_mode = CAIRO_ANTIALIAS_DEFAULT;
|
|
|
|
|
if (antialias == 0)
|
|
|
|
|
{
|
|
|
|
|
antialias_mode = CAIRO_ANTIALIAS_NONE;
|
|
|
|
|
}
|
|
|
|
|
else if (antialias == 1)
|
|
|
|
|
{
|
|
|
|
|
if (subpixel_order != CAIRO_SUBPIXEL_ORDER_DEFAULT)
|
|
|
|
|
antialias_mode = CAIRO_ANTIALIAS_SUBPIXEL;
|
|
|
|
|
else
|
|
|
|
|
antialias_mode = CAIRO_ANTIALIAS_GRAY;
|
|
|
|
|
}
|
2010-12-24 02:55:47 +00:00
|
|
|
|
|
2016-09-30 02:58:29 +00:00
|
|
|
|
cairo_font_options_set_antialias (priv->font_options, antialias_mode);
|
2005-08-24 16:17:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-06-06 16:39:37 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
settings_update_fontconfig (GtkSettings *settings)
|
|
|
|
|
{
|
2015-05-04 12:28:14 +00:00
|
|
|
|
#if defined(GDK_WINDOWING_X11) || defined(GDK_WINDOWING_WAYLAND)
|
2008-06-06 16:39:37 +00:00
|
|
|
|
static guint last_update_timestamp;
|
|
|
|
|
static gboolean last_update_needed;
|
|
|
|
|
|
2008-08-15 19:43:20 +00:00
|
|
|
|
guint timestamp;
|
2008-06-06 16:39:37 +00:00
|
|
|
|
|
|
|
|
|
g_object_get (settings,
|
2010-12-24 02:55:47 +00:00
|
|
|
|
"gtk-fontconfig-timestamp", ×tamp,
|
|
|
|
|
NULL);
|
2008-06-06 16:39:37 +00:00
|
|
|
|
|
|
|
|
|
/* if timestamp is the same as last_update_timestamp, we already have
|
|
|
|
|
* updated fontconig on this timestamp (another screen requested it perhaps?),
|
|
|
|
|
* just return the cached result.*/
|
|
|
|
|
|
|
|
|
|
if (timestamp != last_update_timestamp)
|
|
|
|
|
{
|
|
|
|
|
PangoFontMap *fontmap = pango_cairo_font_map_get_default ();
|
|
|
|
|
gboolean update_needed = FALSE;
|
|
|
|
|
|
2008-08-15 19:43:20 +00:00
|
|
|
|
/* bug 547680 */
|
|
|
|
|
if (PANGO_IS_FC_FONT_MAP (fontmap) && !FcConfigUptoDate (NULL))
|
2010-12-24 02:55:47 +00:00
|
|
|
|
{
|
2015-07-31 04:50:47 +00:00
|
|
|
|
pango_fc_font_map_config_changed (PANGO_FC_FONT_MAP (fontmap));
|
2010-12-24 02:55:47 +00:00
|
|
|
|
if (FcInitReinitialize ())
|
|
|
|
|
update_needed = TRUE;
|
|
|
|
|
}
|
2008-06-06 16:39:37 +00:00
|
|
|
|
|
|
|
|
|
last_update_timestamp = timestamp;
|
|
|
|
|
last_update_needed = update_needed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return last_update_needed;
|
2011-09-27 12:21:09 +00:00
|
|
|
|
#else
|
|
|
|
|
return FALSE;
|
2015-05-04 12:28:14 +00:00
|
|
|
|
#endif /* GDK_WINDOWING_X11 || GDK_WINDOWING_WAYLAND */
|
2011-03-02 16:02:51 +00:00
|
|
|
|
}
|
2008-06-06 16:39:37 +00:00
|
|
|
|
|
2010-09-22 21:44:06 +00:00
|
|
|
|
static void
|
2017-10-30 21:02:35 +00:00
|
|
|
|
settings_update_provider (GdkDisplay *display,
|
2011-01-28 19:19:30 +00:00
|
|
|
|
GtkCssProvider **old,
|
|
|
|
|
GtkCssProvider *new)
|
2010-09-22 21:44:06 +00:00
|
|
|
|
{
|
2017-10-30 21:02:35 +00:00
|
|
|
|
if (display != NULL && *old != new)
|
2011-01-28 19:19:30 +00:00
|
|
|
|
{
|
|
|
|
|
if (*old)
|
|
|
|
|
{
|
2017-10-31 01:35:21 +00:00
|
|
|
|
gtk_style_context_remove_provider_for_display (display,
|
|
|
|
|
GTK_STYLE_PROVIDER (*old));
|
2011-01-28 19:19:30 +00:00
|
|
|
|
g_object_unref (*old);
|
|
|
|
|
*old = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (new)
|
|
|
|
|
{
|
2017-10-31 01:35:21 +00:00
|
|
|
|
gtk_style_context_add_provider_for_display (display,
|
|
|
|
|
GTK_STYLE_PROVIDER (new),
|
|
|
|
|
GTK_STYLE_PROVIDER_PRIORITY_THEME);
|
2011-01-28 19:19:30 +00:00
|
|
|
|
*old = g_object_ref (new);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-12-24 02:55:47 +00:00
|
|
|
|
|
2014-03-07 00:27:37 +00:00
|
|
|
|
static void
|
|
|
|
|
get_theme_name (GtkSettings *settings,
|
|
|
|
|
gchar **theme_name,
|
|
|
|
|
gchar **theme_variant)
|
2013-11-01 20:03:56 +00:00
|
|
|
|
{
|
2014-03-07 00:27:37 +00:00
|
|
|
|
gboolean prefer_dark;
|
|
|
|
|
|
|
|
|
|
*theme_name = NULL;
|
|
|
|
|
*theme_variant = NULL;
|
2013-11-01 20:03:56 +00:00
|
|
|
|
|
|
|
|
|
if (g_getenv ("GTK_THEME"))
|
2014-03-07 00:27:37 +00:00
|
|
|
|
*theme_name = g_strdup (g_getenv ("GTK_THEME"));
|
2013-11-01 20:03:56 +00:00
|
|
|
|
|
2014-03-07 00:27:37 +00:00
|
|
|
|
if (*theme_name && **theme_name)
|
|
|
|
|
{
|
|
|
|
|
char *p;
|
|
|
|
|
p = strrchr (*theme_name, ':');
|
|
|
|
|
if (p) {
|
|
|
|
|
*p = '\0';
|
|
|
|
|
p++;
|
|
|
|
|
*theme_variant = g_strdup (p);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_free (*theme_name);
|
2013-11-01 20:03:56 +00:00
|
|
|
|
|
|
|
|
|
g_object_get (settings,
|
2014-03-07 00:27:37 +00:00
|
|
|
|
"gtk-theme-name", theme_name,
|
|
|
|
|
"gtk-application-prefer-dark-theme", &prefer_dark,
|
2013-11-01 20:03:56 +00:00
|
|
|
|
NULL);
|
|
|
|
|
|
2014-03-07 00:27:37 +00:00
|
|
|
|
if (prefer_dark)
|
|
|
|
|
*theme_variant = g_strdup ("dark");
|
2013-11-01 20:03:56 +00:00
|
|
|
|
|
2014-03-07 00:27:37 +00:00
|
|
|
|
if (*theme_name && **theme_name)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
g_free (*theme_name);
|
|
|
|
|
*theme_name = g_strdup (DEFAULT_THEME_NAME);
|
2013-11-01 20:03:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-28 19:19:30 +00:00
|
|
|
|
static void
|
|
|
|
|
settings_update_theme (GtkSettings *settings)
|
|
|
|
|
{
|
2019-05-19 20:04:47 +00:00
|
|
|
|
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
|
2010-09-22 21:44:06 +00:00
|
|
|
|
gchar *theme_name;
|
2014-03-07 00:27:37 +00:00
|
|
|
|
gchar *theme_variant;
|
2016-03-17 04:57:45 +00:00
|
|
|
|
const gchar *theme_dir;
|
2013-11-01 20:03:56 +00:00
|
|
|
|
gchar *path;
|
2010-09-22 21:44:06 +00:00
|
|
|
|
|
2014-03-07 00:27:37 +00:00
|
|
|
|
get_theme_name (settings, &theme_name, &theme_variant);
|
2013-11-01 20:03:56 +00:00
|
|
|
|
|
2019-04-18 00:05:58 +00:00
|
|
|
|
gtk_css_provider_load_named (priv->theme_provider,
|
|
|
|
|
theme_name,
|
|
|
|
|
theme_variant);
|
2011-01-26 16:18:11 +00:00
|
|
|
|
|
2013-11-01 20:03:56 +00:00
|
|
|
|
/* reload per-theme settings */
|
2016-03-17 04:57:45 +00:00
|
|
|
|
theme_dir = _gtk_css_provider_get_theme_dir (priv->theme_provider);
|
|
|
|
|
if (theme_dir)
|
|
|
|
|
{
|
|
|
|
|
path = g_build_filename (theme_dir, "settings.ini", NULL);
|
|
|
|
|
if (g_file_test (path, G_FILE_TEST_EXISTS))
|
|
|
|
|
gtk_settings_load_from_key_file (settings, path, GTK_SETTINGS_SOURCE_THEME);
|
|
|
|
|
g_free (path);
|
|
|
|
|
}
|
2011-01-26 16:18:11 +00:00
|
|
|
|
|
2014-02-21 20:13:17 +00:00
|
|
|
|
g_free (theme_name);
|
2014-03-07 00:27:37 +00:00
|
|
|
|
g_free (theme_variant);
|
2010-09-22 21:44:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-09-30 02:58:29 +00:00
|
|
|
|
const cairo_font_options_t *
|
|
|
|
|
gtk_settings_get_font_options (GtkSettings *settings)
|
|
|
|
|
{
|
2019-05-19 20:04:47 +00:00
|
|
|
|
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
|
|
|
|
|
return priv->font_options;
|
2016-09-30 02:58:29 +00:00
|
|
|
|
}
|
2010-12-03 13:00:16 +00:00
|
|
|
|
|
2017-10-31 01:35:21 +00:00
|
|
|
|
GdkDisplay *
|
|
|
|
|
_gtk_settings_get_display (GtkSettings *settings)
|
2010-12-03 13:00:16 +00:00
|
|
|
|
{
|
2019-05-19 20:04:47 +00:00
|
|
|
|
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
|
|
|
|
|
return priv->display;
|
2010-12-03 13:00:16 +00:00
|
|
|
|
}
|
2011-01-26 15:46:40 +00:00
|
|
|
|
|
2016-02-01 20:38:28 +00:00
|
|
|
|
static void
|
|
|
|
|
gvalue_free (gpointer data)
|
|
|
|
|
{
|
|
|
|
|
g_value_unset (data);
|
|
|
|
|
g_free (data);
|
|
|
|
|
}
|
2011-01-26 15:46:40 +00:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_settings_load_from_key_file (GtkSettings *settings,
|
|
|
|
|
const gchar *path,
|
|
|
|
|
GtkSettingsSource source)
|
|
|
|
|
{
|
|
|
|
|
GError *error;
|
|
|
|
|
GKeyFile *keyfile;
|
|
|
|
|
gchar **keys;
|
|
|
|
|
gsize n_keys;
|
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
|
|
error = NULL;
|
|
|
|
|
keys = NULL;
|
|
|
|
|
|
|
|
|
|
keyfile = g_key_file_new ();
|
|
|
|
|
|
|
|
|
|
if (!g_key_file_load_from_file (keyfile, path, G_KEY_FILE_NONE, &error))
|
|
|
|
|
{
|
|
|
|
|
g_warning ("Failed to parse %s: %s", path, error->message);
|
|
|
|
|
|
|
|
|
|
g_error_free (error);
|
|
|
|
|
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
keys = g_key_file_get_keys (keyfile, "Settings", &n_keys, &error);
|
|
|
|
|
if (error)
|
|
|
|
|
{
|
|
|
|
|
g_warning ("Failed to parse %s: %s", path, error->message);
|
|
|
|
|
g_error_free (error);
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < n_keys; i++)
|
|
|
|
|
{
|
|
|
|
|
gchar *key;
|
|
|
|
|
GParamSpec *pspec;
|
|
|
|
|
GType value_type;
|
|
|
|
|
GtkSettingsValue svalue = { NULL, { 0, }, };
|
|
|
|
|
|
|
|
|
|
key = keys[i];
|
|
|
|
|
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (settings), key);
|
|
|
|
|
if (!pspec)
|
|
|
|
|
{
|
|
|
|
|
g_warning ("Unknown key %s in %s", key, path);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pspec->owner_type != G_OBJECT_TYPE (settings))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
value_type = G_PARAM_SPEC_VALUE_TYPE (pspec);
|
|
|
|
|
switch (value_type)
|
|
|
|
|
{
|
|
|
|
|
case G_TYPE_BOOLEAN:
|
|
|
|
|
{
|
|
|
|
|
gboolean b_val;
|
|
|
|
|
|
|
|
|
|
g_value_init (&svalue.value, G_TYPE_LONG);
|
|
|
|
|
b_val = g_key_file_get_boolean (keyfile, "Settings", key, &error);
|
|
|
|
|
if (!error)
|
|
|
|
|
g_value_set_long (&svalue.value, b_val);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case G_TYPE_INT:
|
2013-05-06 09:03:21 +00:00
|
|
|
|
case G_TYPE_UINT:
|
2011-01-26 15:46:40 +00:00
|
|
|
|
{
|
|
|
|
|
gint i_val;
|
|
|
|
|
|
|
|
|
|
g_value_init (&svalue.value, G_TYPE_LONG);
|
|
|
|
|
i_val = g_key_file_get_integer (keyfile, "Settings", key, &error);
|
|
|
|
|
if (!error)
|
|
|
|
|
g_value_set_long (&svalue.value, i_val);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case G_TYPE_DOUBLE:
|
|
|
|
|
{
|
|
|
|
|
gdouble d_val;
|
|
|
|
|
|
|
|
|
|
g_value_init (&svalue.value, G_TYPE_DOUBLE);
|
|
|
|
|
d_val = g_key_file_get_double (keyfile, "Settings", key, &error);
|
|
|
|
|
if (!error)
|
|
|
|
|
g_value_set_double (&svalue.value, d_val);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
{
|
|
|
|
|
gchar *s_val;
|
|
|
|
|
|
|
|
|
|
g_value_init (&svalue.value, G_TYPE_GSTRING);
|
|
|
|
|
s_val = g_key_file_get_string (keyfile, "Settings", key, &error);
|
|
|
|
|
if (!error)
|
2011-03-07 22:05:03 +00:00
|
|
|
|
g_value_take_boxed (&svalue.value, g_string_new (s_val));
|
2011-01-26 15:46:40 +00:00
|
|
|
|
g_free (s_val);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (error)
|
|
|
|
|
{
|
|
|
|
|
g_warning ("Error setting %s in %s: %s", key, path, error->message);
|
|
|
|
|
g_error_free (error);
|
|
|
|
|
error = NULL;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2016-02-01 20:38:28 +00:00
|
|
|
|
GValue *copy;
|
|
|
|
|
|
|
|
|
|
copy = g_new0 (GValue, 1);
|
|
|
|
|
|
|
|
|
|
g_value_init (copy, G_VALUE_TYPE (&svalue.value));
|
|
|
|
|
g_value_copy (&svalue.value, copy);
|
|
|
|
|
|
|
|
|
|
g_param_spec_set_qdata_full (pspec, g_quark_from_string (key),
|
|
|
|
|
copy, gvalue_free);
|
|
|
|
|
|
2011-01-26 15:46:40 +00:00
|
|
|
|
if (g_getenv ("GTK_DEBUG"))
|
|
|
|
|
svalue.origin = (gchar *)path;
|
2016-02-01 20:38:28 +00:00
|
|
|
|
|
2011-01-26 15:46:40 +00:00
|
|
|
|
gtk_settings_set_property_value_internal (settings, key, &svalue, source);
|
|
|
|
|
g_value_unset (&svalue.value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
out:
|
|
|
|
|
g_strfreev (keys);
|
|
|
|
|
g_key_file_free (keyfile);
|
|
|
|
|
}
|
2014-09-19 12:41:06 +00:00
|
|
|
|
|
2016-04-27 04:00:19 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
settings_update_xsetting (GtkSettings *settings,
|
|
|
|
|
GParamSpec *pspec,
|
|
|
|
|
gboolean force)
|
|
|
|
|
{
|
2019-05-19 20:04:47 +00:00
|
|
|
|
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
|
2016-04-27 04:00:19 +00:00
|
|
|
|
GType value_type;
|
|
|
|
|
GType fundamental_type;
|
|
|
|
|
gboolean retval = FALSE;
|
|
|
|
|
|
|
|
|
|
if (priv->property_values[pspec->param_id - 1].source == GTK_SETTINGS_SOURCE_APPLICATION)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if (priv->property_values[pspec->param_id - 1].source == GTK_SETTINGS_SOURCE_XSETTING && !force)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
value_type = G_PARAM_SPEC_VALUE_TYPE (pspec);
|
|
|
|
|
fundamental_type = G_TYPE_FUNDAMENTAL (value_type);
|
|
|
|
|
|
|
|
|
|
if ((g_value_type_transformable (G_TYPE_INT, value_type) &&
|
|
|
|
|
!(fundamental_type == G_TYPE_ENUM || fundamental_type == G_TYPE_FLAGS)) ||
|
|
|
|
|
g_value_type_transformable (G_TYPE_STRING, value_type) ||
|
|
|
|
|
g_value_type_transformable (GDK_TYPE_RGBA, value_type))
|
|
|
|
|
{
|
|
|
|
|
GValue val = G_VALUE_INIT;
|
|
|
|
|
|
|
|
|
|
g_value_init (&val, value_type);
|
|
|
|
|
|
2017-10-30 20:06:42 +00:00
|
|
|
|
if (!gdk_display_get_setting (priv->display, pspec->name, &val))
|
2016-04-27 04:00:19 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
g_param_value_validate (pspec, &val);
|
|
|
|
|
g_value_copy (&val, &priv->property_values[pspec->param_id - 1].value);
|
|
|
|
|
priv->property_values[pspec->param_id - 1].source = GTK_SETTINGS_SOURCE_XSETTING;
|
|
|
|
|
|
|
|
|
|
g_value_unset (&val);
|
|
|
|
|
|
|
|
|
|
retval = TRUE;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
GValue tmp_value = G_VALUE_INIT;
|
|
|
|
|
GValue gstring_value = G_VALUE_INIT;
|
|
|
|
|
GValue val = G_VALUE_INIT;
|
|
|
|
|
GtkRcPropertyParser parser = (GtkRcPropertyParser) g_param_spec_get_qdata (pspec, quark_property_parser);
|
|
|
|
|
|
|
|
|
|
g_value_init (&val, G_TYPE_STRING);
|
|
|
|
|
|
2017-10-30 20:06:42 +00:00
|
|
|
|
if (!gdk_display_get_setting (priv->display, pspec->name, &val))
|
2016-04-27 04:00:19 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
g_value_init (&gstring_value, G_TYPE_GSTRING);
|
|
|
|
|
g_value_take_boxed (&gstring_value, g_string_new (g_value_get_string (&val)));
|
|
|
|
|
|
|
|
|
|
g_value_init (&tmp_value, value_type);
|
|
|
|
|
if (parser && _gtk_settings_parse_convert (parser, &gstring_value,
|
|
|
|
|
pspec, &tmp_value))
|
|
|
|
|
{
|
|
|
|
|
g_param_value_validate (pspec, &tmp_value);
|
|
|
|
|
g_value_copy (&tmp_value, &priv->property_values[pspec->param_id - 1].value);
|
|
|
|
|
priv->property_values[pspec->param_id - 1].source = GTK_SETTINGS_SOURCE_XSETTING;
|
|
|
|
|
retval = TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_value_unset (&gstring_value);
|
|
|
|
|
g_value_unset (&tmp_value);
|
|
|
|
|
|
|
|
|
|
g_value_unset (&val);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-05 18:13:03 +00:00
|
|
|
|
static void
|
|
|
|
|
settings_update_xsettings (GtkSettings *settings)
|
|
|
|
|
{
|
|
|
|
|
GParamSpec **pspecs;
|
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
|
|
pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (settings), NULL);
|
|
|
|
|
for (i = 0; pspecs[i]; i++)
|
|
|
|
|
settings_update_xsetting (settings, pspecs[i], FALSE);
|
|
|
|
|
g_free (pspecs);
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-27 04:00:19 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_settings_get_property (GObject *object,
|
|
|
|
|
guint property_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
|
|
|
|
{
|
|
|
|
|
GtkSettings *settings = GTK_SETTINGS (object);
|
2019-05-19 20:04:47 +00:00
|
|
|
|
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
|
2016-04-27 04:00:19 +00:00
|
|
|
|
|
|
|
|
|
settings_update_xsetting (settings, pspec, FALSE);
|
|
|
|
|
|
|
|
|
|
g_value_copy (&priv->property_values[property_id - 1].value, value);
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-19 12:41:06 +00:00
|
|
|
|
GtkSettingsSource
|
|
|
|
|
_gtk_settings_get_setting_source (GtkSettings *settings,
|
|
|
|
|
const gchar *name)
|
|
|
|
|
{
|
2019-05-19 20:04:47 +00:00
|
|
|
|
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
|
2014-09-19 12:41:06 +00:00
|
|
|
|
GParamSpec *pspec;
|
|
|
|
|
|
|
|
|
|
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (settings), name);
|
|
|
|
|
if (!pspec)
|
|
|
|
|
return GTK_SETTINGS_SOURCE_DEFAULT;
|
|
|
|
|
|
2016-04-27 04:00:19 +00:00
|
|
|
|
return priv->property_values[pspec->param_id - 1].source;
|
2014-09-19 12:41:06 +00:00
|
|
|
|
}
|
2015-09-17 23:13:39 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_settings_reset_property:
|
|
|
|
|
* @settings: a #GtkSettings object
|
|
|
|
|
* @name: the name of the setting to reset
|
|
|
|
|
*
|
|
|
|
|
* Undoes the effect of calling g_object_set() to install an
|
|
|
|
|
* application-specific value for a setting. After this call,
|
|
|
|
|
* the setting will again follow the session-wide value for
|
|
|
|
|
* this setting.
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_settings_reset_property (GtkSettings *settings,
|
|
|
|
|
const gchar *name)
|
|
|
|
|
{
|
2019-05-19 20:04:47 +00:00
|
|
|
|
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
|
2015-09-17 23:13:39 +00:00
|
|
|
|
GParamSpec *pspec;
|
2016-02-03 13:48:52 +00:00
|
|
|
|
GtkRcPropertyParser parser;
|
2016-02-01 20:38:28 +00:00
|
|
|
|
GValue *value;
|
2016-02-03 13:48:52 +00:00
|
|
|
|
GValue tmp_value = G_VALUE_INIT;
|
2015-09-17 23:13:39 +00:00
|
|
|
|
|
|
|
|
|
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (settings), name);
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (pspec != NULL);
|
|
|
|
|
|
2016-02-03 13:48:52 +00:00
|
|
|
|
parser = (GtkRcPropertyParser) g_param_spec_get_qdata (pspec, quark_property_parser);
|
2016-02-01 20:38:28 +00:00
|
|
|
|
value = g_param_spec_get_qdata (pspec, g_quark_from_string (name));
|
|
|
|
|
|
2016-02-03 13:48:52 +00:00
|
|
|
|
g_value_init (&tmp_value, G_PARAM_SPEC_VALUE_TYPE (pspec));
|
|
|
|
|
if (value && _gtk_settings_parse_convert (parser, value, pspec, &tmp_value))
|
|
|
|
|
g_value_copy (&tmp_value, &priv->property_values[pspec->param_id - 1].value);
|
2016-02-01 20:38:28 +00:00
|
|
|
|
else
|
|
|
|
|
g_param_value_set_default (pspec, &priv->property_values[pspec->param_id - 1].value);
|
2015-09-17 23:13:39 +00:00
|
|
|
|
|
|
|
|
|
priv->property_values[pspec->param_id - 1].source = GTK_SETTINGS_SOURCE_DEFAULT;
|
2015-12-23 03:30:11 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (settings), pspec);
|
2015-09-17 23:13:39 +00:00
|
|
|
|
}
|
2016-05-01 02:00:06 +00:00
|
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
|
gtk_settings_get_enable_animations (GtkSettings *settings)
|
|
|
|
|
{
|
2019-05-19 20:04:47 +00:00
|
|
|
|
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
|
2016-05-01 02:00:06 +00:00
|
|
|
|
GtkSettingsPropertyValue *svalue = &priv->property_values[PROP_ENABLE_ANIMATIONS - 1];
|
|
|
|
|
|
|
|
|
|
if (svalue->source < GTK_SETTINGS_SOURCE_XSETTING)
|
|
|
|
|
{
|
|
|
|
|
GParamSpec *pspec;
|
|
|
|
|
|
|
|
|
|
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (settings), "gtk-enable-animations");
|
2016-05-04 15:19:03 +00:00
|
|
|
|
if (settings_update_xsetting (settings, pspec, FALSE))
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (settings), pspec);
|
2016-05-01 02:00:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return g_value_get_boolean (&svalue->value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gint
|
|
|
|
|
gtk_settings_get_dnd_drag_threshold (GtkSettings *settings)
|
|
|
|
|
{
|
2019-05-19 20:04:47 +00:00
|
|
|
|
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
|
2016-05-01 02:00:06 +00:00
|
|
|
|
GtkSettingsPropertyValue *svalue = &priv->property_values[PROP_DND_DRAG_THRESHOLD - 1];
|
|
|
|
|
|
|
|
|
|
if (svalue->source < GTK_SETTINGS_SOURCE_XSETTING)
|
|
|
|
|
{
|
|
|
|
|
GParamSpec *pspec;
|
|
|
|
|
|
|
|
|
|
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (settings), "gtk-dnd-drag-threshold");
|
2016-05-04 15:19:03 +00:00
|
|
|
|
if (settings_update_xsetting (settings, pspec, FALSE))
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (settings), pspec);
|
2016-05-01 02:00:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return g_value_get_int (&svalue->value);
|
|
|
|
|
}
|
2016-05-01 05:10:33 +00:00
|
|
|
|
|
2016-05-04 15:19:03 +00:00
|
|
|
|
static void
|
2016-05-05 17:30:55 +00:00
|
|
|
|
settings_update_font_name (GtkSettings *settings)
|
2016-05-04 15:19:03 +00:00
|
|
|
|
{
|
2019-05-19 20:04:47 +00:00
|
|
|
|
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
|
2016-05-04 15:19:03 +00:00
|
|
|
|
GtkSettingsPropertyValue *svalue = &priv->property_values[PROP_FONT_NAME - 1];
|
|
|
|
|
|
|
|
|
|
if (svalue->source < GTK_SETTINGS_SOURCE_XSETTING)
|
|
|
|
|
{
|
|
|
|
|
GParamSpec *pspec;
|
|
|
|
|
|
|
|
|
|
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (settings), "gtk-font-name");
|
|
|
|
|
if (settings_update_xsetting (settings, pspec, FALSE))
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (settings), pspec);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-01 05:10:33 +00:00
|
|
|
|
const gchar *
|
|
|
|
|
gtk_settings_get_font_family (GtkSettings *settings)
|
|
|
|
|
{
|
2019-05-19 20:04:47 +00:00
|
|
|
|
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
|
2016-05-05 17:30:55 +00:00
|
|
|
|
settings_update_font_name (settings);
|
2016-05-04 15:19:03 +00:00
|
|
|
|
|
2019-05-19 20:04:47 +00:00
|
|
|
|
return priv->font_family;
|
2016-05-01 05:10:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gint
|
|
|
|
|
gtk_settings_get_font_size (GtkSettings *settings)
|
|
|
|
|
{
|
2019-05-19 20:04:47 +00:00
|
|
|
|
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
|
2016-05-05 17:30:55 +00:00
|
|
|
|
settings_update_font_name (settings);
|
2016-05-04 15:19:03 +00:00
|
|
|
|
|
2019-05-19 20:04:47 +00:00
|
|
|
|
return priv->font_size;
|
2016-05-01 05:10:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
|
gtk_settings_get_font_size_is_absolute (GtkSettings *settings)
|
|
|
|
|
{
|
2019-05-19 20:04:47 +00:00
|
|
|
|
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
|
2016-05-05 17:30:55 +00:00
|
|
|
|
settings_update_font_name (settings);
|
2016-05-04 15:19:03 +00:00
|
|
|
|
|
2019-05-19 20:04:47 +00:00
|
|
|
|
return priv->font_size_absolute;
|
2016-05-01 05:10:33 +00:00
|
|
|
|
}
|