gnome-control-center r8865 - trunk/capplets/common



Author: jensg
Date: Sat Aug 16 10:48:20 2008
New Revision: 8865
URL: http://svn.gnome.org/viewvc/gnome-control-center?rev=8865&view=rev

Log:
2008-08-16  Jens Granseuer  <jensgr gmx net>

	Keep track of hidden themes, too, so that e.g. we don't erroneously
	show "GTK theme missing" when a metatheme references a hidden GTK
	theme (part of bug #547301)

	* gnome-theme-info.c: (gnome_theme_read_meta_theme),
	(read_icon_theme), (read_cursor_theme): don't skip hidden themes,
	initialize the hidden property
	(gnome_theme_info_find_all_helper): only return non-hidden themes
	* gnome-theme-info.h: add hidden property to all theme types


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

Modified: trunk/capplets/common/gnome-theme-info.c
==============================================================================
--- trunk/capplets/common/gnome-theme-info.c	(original)
+++ trunk/capplets/common/gnome-theme-info.c	Sat Aug 16 10:48:20 2008
@@ -34,6 +34,7 @@
 #define WINDOWTITLE_FONT_KEY "X-GNOME-Metatheme/WindowTitleFont"
 #define MONOSPACE_FONT_KEY "X-GNOME-Metatheme/MonospaceFont"
 #define BACKGROUND_IMAGE_KEY "X-GNOME-Metatheme/BackgroundImage"
+#define HIDDEN_KEY "X-GNOME-Metatheme/Hidden"
 
 /* Terminology used in this lib:
  *
@@ -378,6 +379,9 @@
   if (str != NULL)
     meta_theme_info->background_image = g_strdup (str);
 
+  meta_theme_info->hidden = gnome_desktop_item_get_boolean (meta_theme_ditem,
+                                                            HIDDEN_KEY);
+
   gnome_desktop_item_unref (meta_theme_ditem);
 
   return meta_theme_info;
@@ -389,9 +393,9 @@
   GnomeThemeIconInfo *icon_theme_info;
   GnomeDesktopItem *icon_theme_ditem;
   gchar *icon_theme_file;
+  gchar *dir_name;
   const gchar *name;
   const gchar *directories;
-  const gchar *hidden_theme_icon;
 
   icon_theme_file = g_file_get_uri (icon_theme_uri);
   icon_theme_ditem = gnome_desktop_item_new_from_uri (icon_theme_file, 0, NULL);
@@ -413,19 +417,13 @@
     return NULL;
   }
 
-  hidden_theme_icon = gnome_desktop_item_get_string (icon_theme_ditem, "Icon Theme/Hidden");
-  if (hidden_theme_icon == NULL ||
-      strcmp (hidden_theme_icon, "false") == 0) {
-    gchar *dir_name;
-    icon_theme_info = gnome_theme_icon_info_new ();
-    icon_theme_info->readable_name = g_strdup (name);
-    icon_theme_info->path = g_file_get_path (icon_theme_uri);
-    dir_name = g_path_get_dirname (icon_theme_info->path);
-    icon_theme_info->name = g_path_get_basename (dir_name);
-    g_free (dir_name);
-  } else {
-    icon_theme_info = NULL;
-  }
+  icon_theme_info = gnome_theme_icon_info_new ();
+  icon_theme_info->readable_name = g_strdup (name);
+  icon_theme_info->path = g_file_get_path (icon_theme_uri);
+  icon_theme_info->hidden = gnome_desktop_item_get_boolean (icon_theme_ditem, "Icon Theme/Hidden");
+  dir_name = g_path_get_dirname (icon_theme_info->path);
+  icon_theme_info->name = g_path_get_basename (dir_name);
+  g_free (dir_name);
 
   gnome_desktop_item_unref (icon_theme_ditem);
 
@@ -559,6 +557,9 @@
         else
           cursor_theme_info->readable_name = g_strdup (name);
 
+        cursor_theme_info->hidden = gnome_desktop_item_get_boolean (cursor_theme_ditem,
+                                                                    "Icon Theme/Hidden");
+
         gnome_desktop_item_unref (cursor_theme_ditem);
       } else {
         cursor_theme_info->readable_name = g_strdup (name);
@@ -1416,7 +1417,9 @@
                                   GList *list,
                                   GList **themes)
 {
-  *themes = g_list_prepend (*themes, list->data);
+  /* only return visible themes */
+  if (!((GnomeThemeCommonInfo *) list->data)->hidden)
+    *themes = g_list_prepend (*themes, list->data);
 }
 
 gchar *

Modified: trunk/capplets/common/gnome-theme-info.h
==============================================================================
--- trunk/capplets/common/gnome-theme-info.h	(original)
+++ trunk/capplets/common/gnome-theme-info.h	Sat Aug 16 10:48:20 2008
@@ -56,6 +56,7 @@
   gchar *name;
   gchar *readable_name;
   gint priority;
+  gboolean hidden;
 };
 
 typedef struct _GnomeThemeInfo GnomeThemeInfo;
@@ -66,6 +67,7 @@
   gchar *name;
   gchar *readable_name;
   gint priority;
+  gboolean hidden;
 
   guint has_gtk : 1;
   guint has_keybinding : 1;
@@ -79,6 +81,7 @@
   gchar *name;
   gchar *readable_name;
   gint priority;
+  gboolean hidden;
 
   GArray *sizes;
   GdkPixbuf *thumbnail;
@@ -92,6 +95,7 @@
   gchar *name;
   gchar *readable_name;
   gint priority;
+  gboolean hidden;
 
   gchar *comment;
   gchar *icon_file;



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