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



Author: matthiasc
Date: Tue Jul 15 18:23:31 2008
New Revision: 8781
URL: http://svn.gnome.org/viewvc/gnome-control-center?rev=8781&view=rev

Log:
        Bug 533611 - add notification themes to the metatheme format

        * appearance-themes.c: When loading a metatheme from GConf, read
        the notification theme from /apps/notification-daemon/theme.

        * appearance-theme-save.c: When saving a metatheme to disk,
        save the notification theme with the key NotificationTheme.

        * appearance-theme-util.h: Add a define for the GConf key
        used for notification theme.


        * gnome-theme-apply.c: When applying a metatheme, apply
        the notification theme, too.

        * gnome-theme-info.h: Add a notification_theme_name field
        to the metatheme info struct.

        * gnome-theme-info.c: When reading a metatheme from a keyfile,
        handle notification themes.



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

Modified: trunk/capplets/appearance/appearance-themes.c
==============================================================================
--- trunk/capplets/appearance/appearance-themes.c	(original)
+++ trunk/capplets/appearance/appearance-themes.c	Tue Jul 15 18:23:31 2008
@@ -249,6 +249,8 @@
   if (theme->icon_theme_name == NULL)
     theme->icon_theme_name = g_strdup ("gnome");
 
+  theme->notification_theme_name = gconf_client_get_string (client, NOTIFICATION_THEME_KEY, NULL);
+
   theme->cursor_theme_name = gconf_client_get_string (client, CURSOR_THEME_KEY, NULL);
 #ifdef HAVE_XCURSOR
   theme->cursor_size = gconf_client_get_int (client, CURSOR_SIZE_KEY, NULL);

Modified: trunk/capplets/appearance/theme-save.c
==============================================================================
--- trunk/capplets/appearance/theme-save.c	(original)
+++ trunk/capplets/appearance/theme-save.c	Tue Jul 15 18:23:31 2008
@@ -234,6 +234,12 @@
     g_free (str);
   }
 
+  if (theme_info->notification_theme_name) {
+    str = g_strdup_printf ("NotificationTheme=%s\n", theme_info->notification_theme_name);
+    g_output_stream_write (output, str, strlen (str), NULL, NULL);
+    g_free (str);
+  }
+
   if (save_background) {
     client = gconf_client_get_default ();
     current_background = gconf_client_get_string (client, BACKGROUND_KEY, NULL);

Modified: trunk/capplets/appearance/theme-util.h
==============================================================================
--- trunk/capplets/appearance/theme-util.h	(original)
+++ trunk/capplets/appearance/theme-util.h	Tue Jul 15 18:23:31 2008
@@ -21,6 +21,7 @@
 #define GTK_THEME_KEY "/desktop/gnome/interface/gtk_theme"
 #define METACITY_THEME_KEY "/apps/metacity/general/theme"
 #define ICON_THEME_KEY "/desktop/gnome/interface/icon_theme"
+#define NOTIFICATION_THEME_KEY "/apps/notification-daemon/theme"
 #define COLOR_SCHEME_KEY "/desktop/gnome/interface/gtk_color_scheme"
 #define LOCKDOWN_KEY "/desktop/gnome/lockdown/disable_theme_settings"
 #define BACKGROUND_KEY "/desktop/gnome/background/picture_filename"

Modified: trunk/capplets/common/gnome-theme-apply.c
==============================================================================
--- trunk/capplets/common/gnome-theme-apply.c	(original)
+++ trunk/capplets/common/gnome-theme-apply.c	Tue Jul 15 18:23:31 2008
@@ -34,6 +34,7 @@
 #define CURSOR_FONT_KEY   "/desktop/gnome/peripherals/mouse/cursor_font"
 #define CURSOR_THEME_KEY   "/desktop/gnome/peripherals/mouse/cursor_theme"
 #define CURSOR_SIZE_KEY    "/desktop/gnome/peripherals/mouse/cursor_size"
+#define NOTIFICATION_THEME_KEY    "/apps/notification-daemon/theme"
 
 #define compare(x,y) (!x && y) || (x && !y) || (x && y && strcmp (x, y))
 
@@ -42,6 +43,7 @@
 {
   GConfClient *client;
   gchar *old_key;
+  gchar *new_key;
   gint old_key_int;
   GnomeWindowManager *window_manager;
   GnomeWMSettings wm_settings;
@@ -98,6 +100,17 @@
     }
   g_free (old_key);
 
+  /* set the notification theme */
+  old_key = gconf_client_get_string (client, NOTIFICATION_THEME_KEY, NULL);
+  new_key = meta_theme_info->notification_theme_name;
+  if (new_key == NULL)
+    new_key = "standard";
+  if (compare (old_key, new_key))
+    {
+      gconf_client_set_string (client, NOTIFICATION_THEME_KEY, new_key, NULL);
+    }
+  g_free (old_key);
+
   /* Set the cursor theme key */
 #ifdef HAVE_XCURSOR
   old_key = gconf_client_get_string (client, CURSOR_THEME_KEY, NULL);

Modified: trunk/capplets/common/gnome-theme-info.c
==============================================================================
--- trunk/capplets/common/gnome-theme-info.c	(original)
+++ trunk/capplets/common/gnome-theme-info.c	Tue Jul 15 18:23:31 2008
@@ -25,6 +25,7 @@
 #define METACITY_THEME_KEY "X-GNOME-Metatheme/MetacityTheme"
 #define ICON_THEME_KEY "X-GNOME-Metatheme/IconTheme"
 #define CURSOR_THEME_KEY "X-GNOME-Metatheme/CursorTheme"
+#define NOTIFICATION_THEME_KEY "X-GNOME-Metatheme/NotificationTheme"
 #define CURSOR_SIZE_KEY "X-GNOME-Metatheme/CursorSize"
 #define SOUND_THEME_KEY "X-GNOME-Metatheme/SoundTheme"
 #define APPLICATION_FONT_KEY "X-GNOME-Metatheme/ApplicationFont"
@@ -335,6 +336,10 @@
   }
   meta_theme_info->icon_theme_name = g_strdup (str);
 
+  str = gnome_desktop_item_get_string (meta_theme_ditem, NOTIFICATION_THEME_KEY);
+  if (str != NULL)
+    meta_theme_info->notification_theme_name = g_strdup (str);
+
   str = gnome_desktop_item_get_string (meta_theme_ditem, CURSOR_THEME_KEY);
   if (str != NULL) {
     meta_theme_info->cursor_theme_name = g_strdup (str);
@@ -1593,6 +1598,7 @@
   g_free (meta_theme_info->gtk_color_scheme);
   g_free (meta_theme_info->icon_theme_name);
   g_free (meta_theme_info->metacity_theme_name);
+  g_free (meta_theme_info->notification_theme_name);
   g_free (meta_theme_info);
 }
 
@@ -1694,6 +1700,9 @@
   cmp = safe_strcmp (a->icon_theme_name, b->icon_theme_name);
   if (cmp != 0) return cmp;
 
+  cmp = safe_strcmp (a->notification_theme_name, b->notification_theme_name);
+  if (cmp != 0) return cmp;
+
   cmp = safe_strcmp (a->sound_theme_name, b->sound_theme_name);
   if (cmp != 0) return cmp;
 

Modified: trunk/capplets/common/gnome-theme-info.h
==============================================================================
--- trunk/capplets/common/gnome-theme-info.h	(original)
+++ trunk/capplets/common/gnome-theme-info.h	Tue Jul 15 18:23:31 2008
@@ -100,6 +100,7 @@
   gchar *gtk_color_scheme;
   gchar *metacity_theme_name;
   gchar *icon_theme_name;
+  gchar *notification_theme_name;
   gchar *sound_theme_name;
   gchar *cursor_theme_name;
   guint cursor_size;



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