summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Granseuer <jensgr@gmx.net>2008-04-11 18:16:42 +0000
committerJens Granseuer <jensg@src.gnome.org>2008-04-11 18:16:42 +0000
commitec7d590c4c9dda156eb3694702a5ab3728c6a461 (patch)
tree4d15d45884b8d4780580769989ab769883e9869f
parentf0e3b851e7138d73b051b62b42a881a9d02ace03 (diff)
downloadgnome-settings-daemon-ec7d590c4c9dda156eb3694702a5ab3728c6a461.tar.gz
Make screensaver and sound plugin deactivation work (sort of). The
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 svn path=/trunk/; revision=296
-rw-r--r--ChangeLog16
-rw-r--r--plugins/screensaver/gsd-screensaver-plugin.c1
-rw-r--r--plugins/sound/gsd-sound-manager.c43
-rw-r--r--plugins/sound/gsd-sound-plugin.c1
4 files changed, 43 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index b0aa41fa..604a6030 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
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
+
+2008-04-11 Jens Granseuer <jensgr@gmx.net>
+
Make mouse plugin deactivation work
* plugins/mouse/gsd-mouse-manager.c: (register_config_callback),
diff --git a/plugins/screensaver/gsd-screensaver-plugin.c b/plugins/screensaver/gsd-screensaver-plugin.c
index 4d33384d..71a4a2ad 100644
--- a/plugins/screensaver/gsd-screensaver-plugin.c
+++ b/plugins/screensaver/gsd-screensaver-plugin.c
@@ -86,6 +86,7 @@ static void
impl_deactivate (GnomeSettingsPlugin *plugin)
{
g_debug ("Deactivating screensaver plugin");
+ gsd_screensaver_manager_stop (GSD_SCREENSAVER_PLUGIN (plugin)->priv->manager);
}
static void
diff --git a/plugins/sound/gsd-sound-manager.c b/plugins/sound/gsd-sound-manager.c
index ccfd970e..c86c4a7f 100644
--- a/plugins/sound/gsd-sound-manager.c
+++ b/plugins/sound/gsd-sound-manager.c
@@ -57,12 +57,13 @@ struct GsdSoundManagerPrivate
/* 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 @@ static void
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 @@ apply_settings (GsdSoundManager *manager)
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 @@ apply_settings (GsdSoundManager *manager)
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 @@ apply_settings (GsdSoundManager *manager)
}
-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 @@ gsd_sound_manager_start (GsdSoundManager *manager,
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 @@ gsd_sound_manager_start (GsdSoundManager *manager,
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
diff --git a/plugins/sound/gsd-sound-plugin.c b/plugins/sound/gsd-sound-plugin.c
index 4ec5e7a0..eef50ac6 100644
--- a/plugins/sound/gsd-sound-plugin.c
+++ b/plugins/sound/gsd-sound-plugin.c
@@ -86,6 +86,7 @@ static void
impl_deactivate (GnomeSettingsPlugin *plugin)
{
g_debug ("Deactivating sound plugin");
+ gsd_sounds_manager_stop (GSD_SOUND_PLUGIN (plugin)->priv->manager);
}
static void