- if (new_provider != provider)
- {
- if (provider)
- gtk_style_context_remove_provider_for_screen (priv->screen,
- GTK_STYLE_PROVIDER (provider));
-
- if (new_provider)
- {
- gtk_style_context_add_provider_for_screen (priv->screen,
- GTK_STYLE_PROVIDER (new_provider),
- GTK_STYLE_PROVIDER_PRIORITY_THEME);
- g_object_ref (new_provider);
- }
-
- g_object_set_qdata_full (G_OBJECT (settings), quark_theme_name,
- new_provider, (GDestroyNotify) g_object_unref);
- }
-}
-
-static gboolean
-add_color_to_hash (gchar *name,
- GdkColor *color,
- GHashTable *target)
-{
- GdkColor *old;
-
- old = g_hash_table_lookup (target, name);
- if (!old || !gdk_color_equal (old, color))
- {
- g_hash_table_insert (target, g_strdup (name), gdk_color_copy (color));
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-static gboolean
-add_colors_to_hash_from_string (GHashTable *hash,
- const gchar *colors)
-{
- gchar *s, *p, *name;
- GdkColor color;
- gboolean changed = FALSE;
- gchar *copy;
-
- copy = g_strdup (colors);
- s = copy;
- while (s && *s)
- {
- name = s;
- p = strchr (s, ':');
- if (p)
- {
- *p = '\0';
- p++;
- }
- else
- break;
-
- while (*p == ' ')
- p++;
-
- s = p;
- while (*s)
- {
- if (*s == '\n' || *s == ';')
- {
- *s = '\0';
- s++;
- break;
- }
- s++;
- }
-
- if (gdk_color_parse (p, &color))
- changed |= add_color_to_hash (name, &color, hash);
- }
-
- g_free (copy);
-
- return changed;
-}
-
-static gboolean
-update_color_hash (ColorSchemeData *data,
- const gchar *str,
- GtkSettingsSource source)
-{
- gboolean changed = FALSE;
- gint i;
- GHashTable *old_hash;
- GHashTableIter iter;
- gpointer name;
- gpointer color;
-
- if ((str == NULL || *str == '\0') &&
- (data->lastentry[source] == NULL || data->lastentry[source][0] == '\0'))
- return FALSE;
-
- if (str && data->lastentry[source] && strcmp (str, data->lastentry[source]) == 0)
- return FALSE;
-
- /* For the RC_FILE source we merge the values rather than over-writing
- * them, since multiple rc files might define independent sets of colors
- */
- if ((source != GTK_SETTINGS_SOURCE_RC_FILE) &&
- data->tables[source] && g_hash_table_size (data->tables[source]) > 0)