#define PANGO_ENABLE_BACKEND /* for pango_fc_font_map_cache_clear() */
-#include <config.h>
+#include "config.h"
#include <string.h>
PROP_RECENT_FILES_LIMIT,
PROP_IM_MODULE,
PROP_RECENT_FILES_MAX_AGE,
- PROP_FONTCONFIG_TIMESTAMP
+ PROP_FONTCONFIG_TIMESTAMP,
+ PROP_SOUND_THEME_NAME,
+ PROP_ENABLE_INPUT_FEEDBACK_SOUNDS,
+ PROP_ENABLE_EVENT_SOUNDS,
+ PROP_ENABLE_TOOLTIPS
};
NULL);
g_assert (result == PROP_FONT_NAME);
+ /**
+ * GtkSettings:gtk-icon-sizes:
+ *
+ * A list of icon sizes. The list is separated by colons, and
+ * item has the form:
+ *
+ * <replaceable>size-name</replaceable> = <replaceable>width</replaceable> , <replaceable>height</replaceable>
+ *
+ * E.g. "gtk-menu=16,16:gtk-button=20,20:gtk-dialog=48,48".
+ * GTK+ itself use the following named icon sizes: gtk-menu,
+ * gtk-button, gtk-small-toolbar, gtk-large-toolbar, gtk-dnd,
+ * gtk-dialog. Applications can register their own named icon
+ * sizes with gtk_icon_size_register().
+ */
result = settings_install_property_parser (class,
g_param_spec_string ("gtk-icon-sizes",
P_("Icon Sizes"),
NULL);
g_assert (result == PROP_FONTCONFIG_TIMESTAMP);
-
+
+ /**
+ * GtkSettings:gtk-sound-theme-name:
+ *
+ * The XDG sound theme to use for event sounds.
+ *
+ * See the <ulink url="http://www.freedesktop.org/wiki/Specifications/sound-theme-spec">Sound Theme spec</ulink>
+ * for more information on event sounds and sound themes.
+ *
+ * GTK+ itself does not support event sounds, you have to use a loadable
+ * module like the one that comes with libcanberra.
+ *
+ * Since: 2.14
+ */
+ 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.
+ *
+ * See the <ulink url="http://www.freedesktop.org/wiki/Specifications/sound-theme-spec">Sound Theme spec</ulink>
+ * for more information on event sounds and sound themes.
+ *
+ * GTK+ itself does not support event sounds, you have to use a loadable
+ * module like the one that comes with libcanberra.
+ *
+ * Since: 2.14
+ */
+ result = settings_install_property_parser (class,
+ g_param_spec_boolean ("gtk-enable-input-feedback-sounds",
+ /* Translators: this means sounds that are played as feedback to user input */
+ P_("Audible Input Feedback"),
+ P_("Whether to play event sounds as feedback to user input"),
+ TRUE,
+ GTK_PARAM_READWRITE),
+ NULL);
+ g_assert (result == PROP_ENABLE_INPUT_FEEDBACK_SOUNDS);
+
+ /**
+ * GtkSettings:gtk-enable-event-sounds:
+ *
+ * Whether to play any event sounds at all.
+ *
+ * See the <ulink url="http://www.freedesktop.org/wiki/Specifications/sound-theme-spec">Sound Theme spec</ulink>
+ * for more information on event sounds and sound themes.
+ *
+ * GTK+ itself does not support event sounds, you have to use a loadable
+ * module like the one that comes with libcanberra.
+ *
+ * Since: 2.14
+ */
+ result = settings_install_property_parser (class,
+ g_param_spec_boolean ("gtk-enable-event-sounds",
+ P_("Enable Event Sounds"),
+ P_("Whether to play any event sounds at all"),
+ TRUE,
+ GTK_PARAM_READWRITE),
+ NULL);
+ g_assert (result == PROP_ENABLE_EVENT_SOUNDS);
+
+ /**
+ * GtkSettings:gtk-enable-tooltips:
+ *
+ * Whether tooltips should be shown on widgets.
+ *
+ * Since: 2.14
+ */
+ result = settings_install_property_parser (class,
+ g_param_spec_boolean ("gtk-enable-tooltips",
+ P_("Enable Tooltips"),
+ P_("Whether tooltips should be shown on widgets"),
+ TRUE,
+ GTK_PARAM_READWRITE),
+ NULL);
+ g_assert (result == PROP_ENABLE_TOOLTIPS);
}
static void
void
gtk_settings_install_property (GParamSpec *pspec)
{
+ static GtkSettingsClass *klass = NULL;
+
GtkRcPropertyParser parser;
g_return_if_fail (G_IS_PARAM_SPEC (pspec));
+ if (! klass)
+ klass = g_type_class_ref (GTK_TYPE_SETTINGS);
+
parser = _gtk_rc_property_parser_from_type (G_PARAM_SPEC_VALUE_TYPE (pspec));
- settings_install_property_parser (gtk_type_class (GTK_TYPE_SETTINGS), pspec, parser);
+ settings_install_property_parser (klass, pspec, parser);
}
void
gtk_settings_install_property_parser (GParamSpec *pspec,
GtkRcPropertyParser parser)
{
+ static GtkSettingsClass *klass = NULL;
+
g_return_if_fail (G_IS_PARAM_SPEC (pspec));
g_return_if_fail (parser != NULL);
-
- settings_install_property_parser (gtk_type_class (GTK_TYPE_SETTINGS), pspec, parser);
+
+ if (! klass)
+ klass = g_type_class_ref (GTK_TYPE_SETTINGS);
+
+ settings_install_property_parser (klass, pspec, parser);
}
static void
if (property_id == PROP_COLOR_SCHEME)
{
GValue value = { 0, };
-
+
g_value_init (&value, G_TYPE_STRING);
if (!gdk_screen_get_setting (settings->screen, pspec->name, &value))
g_value_set_static_string (&value, "");
merge_color_scheme (settings, &value, GTK_SETTINGS_SOURCE_XSETTING);
g_value_unset (&value);
}
-
g_object_notify (G_OBJECT (settings), pspec->name);
}
}
static guint last_update_timestamp;
static gboolean last_update_needed;
- gint timestamp;
+ guint timestamp;
g_object_get (settings,
"gtk-fontconfig-timestamp", ×tamp,
PangoFontMap *fontmap = pango_cairo_font_map_get_default ();
gboolean update_needed = FALSE;
- if (PANGO_IS_FC_FONT_MAP (fontmap) &&
- !FcConfigUptoDate (NULL) && FcInitReinitialize ())
+ /* bug 547680 */
+ if (PANGO_IS_FC_FONT_MAP (fontmap) && !FcConfigUptoDate (NULL))
{
- update_needed = TRUE;
pango_fc_font_map_cache_clear (PANGO_FC_FONT_MAP (fontmap));
+ if (FcInitReinitialize ())
+ update_needed = TRUE;
}
last_update_timestamp = timestamp;
{
gboolean changed = FALSE;
gint i;
+ GHashTable *old_hash;
if ((str == NULL || *str == '\0') &&
(data->lastentry[source] == NULL || data->lastentry[source][0] == '\0'))
return FALSE;
/* Rebuild the merged hash table. */
- if (data->color_hash)
- g_hash_table_unref (data->color_hash);
+ old_hash = data->color_hash;
data->color_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
(GDestroyNotify) gdk_color_free);
for (i = 0; i <= GTK_SETTINGS_SOURCE_APPLICATION; i++)
data->color_hash);
}
- return TRUE;
+ if (old_hash)
+ {
+ /* now check if the merged hash has changed */
+ changed = FALSE;
+ if (g_hash_table_size (old_hash) != g_hash_table_size (data->color_hash))
+ changed = TRUE;
+ else
+ {
+ GHashTableIter iter;
+ gpointer key, value, new_value;
+
+ g_hash_table_iter_init (&iter, old_hash);
+ while (g_hash_table_iter_next (&iter, &key, &value))
+ {
+ new_value = g_hash_table_lookup (data->color_hash, key);
+ if (!new_value || !gdk_color_equal (value, new_value))
+ {
+ changed = TRUE;
+ break;
+ }
+ }
+ }
+
+ g_hash_table_unref (old_hash);
+ }
+ else
+ changed = TRUE;
+
+ return changed;
}
static void