aboutsummaryrefslogtreecommitdiff
path: root/src/sound-state-manager.c
diff options
context:
space:
mode:
authorMartin Pitt <martin.pitt@ubuntu.com>2012-01-05 09:46:07 +0100
committerMartin Pitt <martin.pitt@ubuntu.com>2012-01-05 09:46:07 +0100
commitd2f3236301779a4b99a85083008b50fa6425eb26 (patch)
tree95faa13a46c73e700aac210556002bafafc5813a /src/sound-state-manager.c
parent048fe88d783124358184248e33100caf9d6af82d (diff)
downloadayatana-indicator-sound-d2f3236301779a4b99a85083008b50fa6425eb26.tar.gz
ayatana-indicator-sound-d2f3236301779a4b99a85083008b50fa6425eb26.tar.bz2
ayatana-indicator-sound-d2f3236301779a4b99a85083008b50fa6425eb26.zip
Lazily initialize notification daemon
Avoid spawning notification daemon right at startup, instead initialize it lazily when actually doing a notification. Improves boot speed. https://blueprints.launchpad.net/ubuntu/+spec/desktop-p-desktop-boot-speed https://launchpad.net/bugs/912150
Diffstat (limited to 'src/sound-state-manager.c')
-rw-r--r--src/sound-state-manager.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/sound-state-manager.c b/src/sound-state-manager.c
index c851407..ac03add 100644
--- a/src/sound-state-manager.c
+++ b/src/sound-state-manager.c
@@ -80,8 +80,6 @@ sound_state_manager_init (SoundStateManager* self)
priv->settings_manager = g_settings_new("com.canonical.indicators.sound");
- sound_state_manager_notification_init (self);
-
sound_state_manager_prepare_state_image_names (self);
sound_state_manager_prepare_blocked_animation (self);
@@ -134,6 +132,13 @@ sound_state_manager_class_init (SoundStateManagerClass *klass)
static void
sound_state_manager_notification_init (SoundStateManager* self)
{
+ static gboolean initialized = FALSE;
+
+ /* one-time lazy initialization */
+ if (initialized)
+ return;
+ initialized = TRUE;
+
SoundStateManagerPrivate* priv = SOUND_STATE_MANAGER_GET_PRIVATE(self);
if (!notify_init(PACKAGE_NAME))
@@ -164,6 +169,8 @@ sound_state_manager_show_notification (SoundStateManager *self,
{
SoundStateManagerPrivate* priv = SOUND_STATE_MANAGER_GET_PRIVATE(self);
+ sound_state_manager_notification_init (self);
+
if (priv->notification == NULL ||
g_settings_get_boolean (priv->settings_manager, "show-notify-osd-on-scroll") == FALSE){
return;