gnome-control-center r9206 - in trunk/capplets: appearance common



Author: jensg
Date: Sun Jan 25 11:05:45 2009
New Revision: 9206
URL: http://svn.gnome.org/viewvc/gnome-control-center?rev=9206&view=rev

Log:
2009-01-25  Jens Granseuer  <jensgr gmx net>

	* gnome-theme-info.c: (handle_change_signal), (update_theme_index),
	(update_common_theme_dir_index):
	* gnome-theme-info.h: add GnomeThemeElement parameter to the
	ThemeChangedCallback so that the receiver can determine what part of
	the theme changed (part of bug #568595)

2009-01-25  Jens Granseuer  <jensgr gmx net>

	Fix newly installed themes appearing twice in the GTK themes list if
	the package contains themes for both GTK and metacity (bug #568595)

	* appearance-style.c: (changed_on_disk_cb): check the new
	GnomeThemeElement parameter instead of the theme properties to
	determine what part of the theme changed
	* appearance-themes.c: (theme_changed_on_disk_cb): use new callback
	signature


Modified:
   trunk/capplets/appearance/ChangeLog
   trunk/capplets/appearance/appearance-style.c
   trunk/capplets/appearance/appearance-themes.c
   trunk/capplets/common/ChangeLog
   trunk/capplets/common/gnome-theme-info.c
   trunk/capplets/common/gnome-theme-info.h

Modified: trunk/capplets/appearance/appearance-style.c
==============================================================================
--- trunk/capplets/appearance/appearance-style.c	(original)
+++ trunk/capplets/appearance/appearance-style.c	Sun Jan 25 11:05:45 2009
@@ -793,19 +793,20 @@
 static void
 changed_on_disk_cb (GnomeThemeCommonInfo *theme,
 		    GnomeThemeChangeType  change_type,
+                    GnomeThemeElement     element_type,
 		    AppearanceData       *data)
 {
   if (theme->type == GNOME_THEME_TYPE_REGULAR) {
     GnomeThemeInfo *info = (GnomeThemeInfo *) theme;
 
     if (change_type == GNOME_THEME_CHANGE_DELETED) {
-      if (info->has_gtk)
+      if (element_type & GNOME_THEME_GTK_2)
         remove_from_treeview ("gtk_themes_list", info->name, data);
-      if (info->has_metacity)
+      if (element_type & GNOME_THEME_METACITY)
         remove_from_treeview ("window_themes_list", info->name, data);
 
     } else {
-      if (info->has_gtk) {
+      if (element_type & GNOME_THEME_GTK_2) {
         if (change_type == GNOME_THEME_CHANGE_CREATED)
           add_to_treeview ("gtk_themes_list", info->name, info->name, data->gtk_theme_icon, data);
         else if (change_type == GNOME_THEME_CHANGE_CHANGED)
@@ -815,7 +816,7 @@
             (ThemeThumbnailFunc) gtk_theme_thumbnail_cb, data, NULL);
       }
 
-      if (info->has_metacity) {
+      if (element_type & GNOME_THEME_METACITY) {
         if (change_type == GNOME_THEME_CHANGE_CREATED)
           add_to_treeview ("window_themes_list", info->name, info->name, data->window_theme_icon, data);
         else if (change_type == GNOME_THEME_CHANGE_CHANGED)

Modified: trunk/capplets/appearance/appearance-themes.c
==============================================================================
--- trunk/capplets/appearance/appearance-themes.c	(original)
+++ trunk/capplets/appearance/appearance-themes.c	Sun Jan 25 11:05:45 2009
@@ -172,6 +172,7 @@
 static void
 theme_changed_on_disk_cb (GnomeThemeCommonInfo *theme,
 			  GnomeThemeChangeType  change_type,
+                          GnomeThemeElement     element_type,
 			  AppearanceData       *data)
 {
   if (theme->type == GNOME_THEME_TYPE_METATHEME) {

Modified: trunk/capplets/common/gnome-theme-info.c
==============================================================================
--- trunk/capplets/common/gnome-theme-info.c	(original)
+++ trunk/capplets/common/gnome-theme-info.c	Sun Jan 25 11:05:45 2009
@@ -688,7 +688,8 @@
 
 static void
 handle_change_signal (gpointer             data,
-                      GnomeThemeChangeType change_type)
+                      GnomeThemeChangeType change_type,
+                      GnomeThemeElement    element_type)
 {
 #ifdef DEBUG
   gchar *type_str = NULL;
@@ -703,7 +704,7 @@
 
   for (list = callbacks; list; list = list->next) {
     ThemeCallbackData *callback_data = list->data;
-    (* callback_data->func) (theme, change_type, callback_data->data);
+    (* callback_data->func) (theme, change_type, element_type, callback_data->data);
   }
 
 #ifdef DEBUG
@@ -714,12 +715,11 @@
   else if (theme->type == GNOME_THEME_TYPE_CURSOR)
     type_str = "cursor";
   else if (theme->type == GNOME_THEME_TYPE_REGULAR) {
-    GnomeThemeInfo *rtheme = (GnomeThemeInfo *) theme;
-    if (rtheme->has_gtk)
+    if (element_type & GNOME_THEME_GTK_2)
       element_str = "gtk-2";
-    else if (rtheme->has_keybinding)
+    else if (element_type & GNOME_THEME_GTK_2_KEYBINDING)
       element_str = "keybinding";
-    else if (rtheme->has_metacity)
+    else if (element_type & GNOME_THEME_METACITY)
       element_str = "metacity";
   }
 
@@ -784,7 +784,7 @@
 
       g_hash_table_insert (theme_hash_by_uri, g_strdup (common_theme_dir), theme_info);
       add_theme_to_hash_by_name (theme_hash_by_name, theme_info);
-      handle_change_signal (theme_info, GNOME_THEME_CHANGE_CREATED);
+      handle_change_signal (theme_info, GNOME_THEME_CHANGE_CREATED, key_element);
     }
   } else {
     gboolean theme_used_to_exist = FALSE;
@@ -806,11 +806,11 @@
     }
 
     if (theme_exists && theme_used_to_exist) {
-      handle_change_signal (theme_info, GNOME_THEME_CHANGE_CHANGED);
+      handle_change_signal (theme_info, GNOME_THEME_CHANGE_CHANGED, key_element);
     } else if (theme_exists && !theme_used_to_exist) {
-      handle_change_signal (theme_info, GNOME_THEME_CHANGE_CREATED);
+      handle_change_signal (theme_info, GNOME_THEME_CHANGE_CREATED, key_element);
     } else if (!theme_exists && theme_used_to_exist) {
-      handle_change_signal (theme_info, GNOME_THEME_CHANGE_DELETED);
+      handle_change_signal (theme_info, GNOME_THEME_CHANGE_DELETED, key_element);
     }
 
     if (!theme_info->has_metacity && !theme_info->has_keybinding && !theme_info->has_gtk) {
@@ -906,7 +906,7 @@
     if (theme_exists) {
       g_hash_table_insert (hash_by_uri, g_strdup (common_theme_dir), theme_info);
       add_theme_to_hash_by_name (hash_by_name, theme_info);
-      handle_change_signal (theme_info, GNOME_THEME_CHANGE_CREATED);
+      handle_change_signal (theme_info, GNOME_THEME_CHANGE_CREATED, 0);
     }
   } else {
     if (theme_exists) {
@@ -916,7 +916,7 @@
         remove_theme_from_hash_by_name (hash_by_name, old_theme_info);
         g_hash_table_insert (hash_by_uri, g_strdup (common_theme_dir), theme_info);
         add_theme_to_hash_by_name (hash_by_name, theme_info);
-        handle_change_signal (theme_info, GNOME_THEME_CHANGE_CHANGED);
+        handle_change_signal (theme_info, GNOME_THEME_CHANGE_CHANGED, 0);
         theme_free (old_theme_info);
       } else {
         theme_free (theme_info);
@@ -925,7 +925,7 @@
       g_hash_table_remove (hash_by_uri, common_theme_dir);
       remove_theme_from_hash_by_name (hash_by_name, old_theme_info);
 
-      handle_change_signal (old_theme_info, GNOME_THEME_CHANGE_DELETED);
+      handle_change_signal (old_theme_info, GNOME_THEME_CHANGE_DELETED, 0);
       theme_free (old_theme_info);
     }
   }

Modified: trunk/capplets/common/gnome-theme-info.h
==============================================================================
--- trunk/capplets/common/gnome-theme-info.h	(original)
+++ trunk/capplets/common/gnome-theme-info.h	Sun Jan 25 11:05:45 2009
@@ -131,6 +131,7 @@
 
 typedef void (* ThemeChangedCallback) (GnomeThemeCommonInfo *theme,
 				       GnomeThemeChangeType  change_type,
+                                       GnomeThemeElement     element_type,
 				       gpointer              user_data);
 
 #define GNOME_THEME_ERROR gnome_theme_info_error_quark ()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]