aboutsummaryrefslogtreecommitdiff
path: root/debian/patches/lazy_init.patch
blob: cc0fe1774b6326997ff764367abb6b272a3113a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Description: Avoid spawning notification daemon right at startup, instead initialize it lazily when actually doing a notification. Improves boot speed.
Bug: https://launchpad.net/bugs/912150
Author: Martin Pitt <martin.pitt@ubuntu.com>
Forwarded: https://code.launchpad.net/~pitti/indicator-sound/lazy-notification-init/+merge/87576

--- a/src/sound-state-manager.c	2011-04-05 03:14:19 +0000
+++ b/src/sound-state-manager.c	2012-01-05 08:46:07 +0000
@@ -80,8 +80,6 @@
 
   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 @@
 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 @@
 {
   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;