gnome-settings-daemon r296 - in trunk: . plugins/screensaver plugins/sound



Author: jensg
Date: Fri Apr 11 19:16:42 2008
New Revision: 296
URL: http://svn.gnome.org/viewvc/gnome-settings-daemon?rev=296&view=rev

Log:
2008-04-11  Jens Granseuer  <jensgr gmx net>

	Make screensaver and sound plugin deactivation work (sort of). The
	screensaver is currently not reaped when deactivating the plugin, but
	since the plugin should go away anyway, it doesn't seem worth adding
	that right now. For the sound plugin, esd is currently not reaped
	when HAVE_ESD is set. Maybe we want to get rid of the esd API
	altogether?

	* plugins/sound/gsd-sound-manager.c: (apply_settings),
	(register_config_callback), (gsd_sound_manager_start),
	(gsd_sound_manager_stop): clean up a bit more on stop
	* plugins/screensaver/gsd-screensaver-plugin.c: (impl_deactivate):
	* plugins/sound/gsd-sound-plugin.c: (impl_deactivate): stop manager
	on deactivation


Modified:
   trunk/ChangeLog
   trunk/plugins/screensaver/gsd-screensaver-plugin.c
   trunk/plugins/sound/gsd-sound-manager.c
   trunk/plugins/sound/gsd-sound-plugin.c

Modified: trunk/plugins/screensaver/gsd-screensaver-plugin.c
==============================================================================
--- trunk/plugins/screensaver/gsd-screensaver-plugin.c	(original)
+++ trunk/plugins/screensaver/gsd-screensaver-plugin.c	Fri Apr 11 19:16:42 2008
@@ -86,6 +86,7 @@
 impl_deactivate (GnomeSettingsPlugin *plugin)
 {
         g_debug ("Deactivating screensaver plugin");
+        gsd_screensaver_manager_stop (GSD_SCREENSAVER_PLUGIN (plugin)->priv->manager);
 }
 
 static void

Modified: trunk/plugins/sound/gsd-sound-manager.c
==============================================================================
--- trunk/plugins/sound/gsd-sound-manager.c	(original)
+++ trunk/plugins/sound/gsd-sound-manager.c	Fri Apr 11 19:16:42 2008
@@ -57,12 +57,13 @@
         /* esd/PulseAudio pid */
         GPid  pid;
         guint child_watch_id;
-};
 
-enum {
-        PROP_0,
+        gboolean inited;
+        guint notify;
 };
 
+#define GCONF_SOUND_DIR         "/desktop/gnome/sound"
+
 static void     gsd_sound_manager_class_init  (GsdSoundManagerClass *klass);
 static void     gsd_sound_manager_init        (GsdSoundManager      *sound_manager);
 static void     gsd_sound_manager_finalize    (GObject             *object);
@@ -285,9 +286,6 @@
 apply_settings (GsdSoundManager *manager)
 {
         GConfClient    *client;
-        static gboolean inited = FALSE;
-        static int      event_changed_old = 0;
-        int             event_changed_new;
         gboolean        enable_sound;
         gboolean        event_sounds;
         struct reload_foreach_closure closure;
@@ -298,8 +296,6 @@
 
         enable_sound = gconf_client_get_bool (client, "/desktop/gnome/sound/enable_esd", NULL);
         event_sounds = gconf_client_get_bool (client, "/desktop/gnome/sound/event_sounds", NULL);
-        /* FIXME this is completely bogus, the entry doesn't exist */
-        event_changed_new = gconf_client_get_int  (client, "/desktop/gnome/sound/event_changed", NULL);
 
         closure.enable_system_sounds = event_sounds;
 
@@ -322,13 +318,10 @@
                         stop_gnome_sound (manager);
         }
 
-        if (enable_sound &&
-            (!inited || event_changed_old != event_changed_new)) {
+        if (enable_sound && !manager->priv->inited) {
                 SoundProperties *props;
 
-                inited = TRUE;
-                event_changed_old = event_changed_new;
-
+                manager->priv->inited = TRUE;
                 props = sound_properties_new ();
                 sound_properties_add_defaults (props, NULL);
                 sound_properties_foreach (props, reload_foreach_cb, &closure);
@@ -339,19 +332,21 @@
 
 }
 
-static void
+static guint
 register_config_callback (GsdSoundManager         *manager,
                           const char              *path,
                           GConfClientNotifyFunc    func)
 {
         GConfClient *client;
+        guint notify;
 
         client = gconf_client_get_default ();
 
         gconf_client_add_dir (client, path, GCONF_CLIENT_PRELOAD_NONE, NULL);
-        gconf_client_notify_add (client, path, func, manager, NULL, NULL);
+        notify = gconf_client_notify_add (client, path, func, manager, NULL, NULL);
 
         g_object_unref (client);
+        return notify;
 }
 
 static void
@@ -371,9 +366,10 @@
 
         gnome_settings_profile_start (NULL);
 
-        register_config_callback (manager,
-                                  "/desktop/gnome/sound",
-                                  (GConfClientNotifyFunc)sound_callback);
+        manager->priv->notify =
+                register_config_callback (manager,
+                                          GCONF_SOUND_DIR,
+                                          (GConfClientNotifyFunc) sound_callback);
         apply_settings (manager);
 
         gnome_settings_profile_end (NULL);
@@ -384,9 +380,20 @@
 void
 gsd_sound_manager_stop (GsdSoundManager *manager)
 {
+        GsdSoundManagerPrivate *p = manager->priv;
+
         g_debug ("Stopping sound manager");
 
+        if (p->notify != 0) {
+                GConfClient *client = gconf_client_get_default ();
+                gconf_client_remove_dir (client, GCONF_SOUND_DIR, NULL);
+                gconf_client_notify_remove (client, p->notify);
+                g_object_unref (client);
+                p->notify = 0;
+        }
+
         stop_gnome_sound (manager);
+        p->inited = FALSE;
 }
 
 static void

Modified: trunk/plugins/sound/gsd-sound-plugin.c
==============================================================================
--- trunk/plugins/sound/gsd-sound-plugin.c	(original)
+++ trunk/plugins/sound/gsd-sound-plugin.c	Fri Apr 11 19:16:42 2008
@@ -86,6 +86,7 @@
 impl_deactivate (GnomeSettingsPlugin *plugin)
 {
         g_debug ("Deactivating sound plugin");
+        gsd_sounds_manager_stop (GSD_SOUND_PLUGIN (plugin)->priv->manager);
 }
 
 static void



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