diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-11-29 23:26:27 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-11-29 23:26:27 +0800 |
commit | 6408432db9e2b1240c1cfea461d330ac0a01e49a (patch) | |
tree | 5516f378b79d97e9304103441adce9942042fb1d | |
parent | 086f0fc0375d06fa0c41cf921f883ed36fdb14d0 (diff) | |
download | gsoc2013-empathy-6408432db9e2b1240c1cfea461d330ac0a01e49a.tar gsoc2013-empathy-6408432db9e2b1240c1cfea461d330ac0a01e49a.tar.gz gsoc2013-empathy-6408432db9e2b1240c1cfea461d330ac0a01e49a.tar.bz2 gsoc2013-empathy-6408432db9e2b1240c1cfea461d330ac0a01e49a.tar.lz gsoc2013-empathy-6408432db9e2b1240c1cfea461d330ac0a01e49a.tar.xz gsoc2013-empathy-6408432db9e2b1240c1cfea461d330ac0a01e49a.tar.zst gsoc2013-empathy-6408432db9e2b1240c1cfea461d330ac0a01e49a.zip |
event-manager: cache the notifications GSettings
-rw-r--r-- | src/empathy-event-manager.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c index 91bd47445..11f95f52b 100644 --- a/src/empathy-event-manager.c +++ b/src/empathy-event-manager.c @@ -82,6 +82,8 @@ typedef struct { GSList *approvals; gint ringing; + + GSettings *gsettings_notif; } EmpathyEventManagerPriv; typedef struct _EventPriv EventPriv; @@ -1032,10 +1034,10 @@ event_manager_presence_changed_cb (EmpathyContact *contact, TpConnectionPresenceType previous, EmpathyEventManager *manager) { + EmpathyEventManagerPriv *priv = GET_PRIV (manager); TpAccount *account; gchar *header = NULL; EmpathyIdle *idle; - GSettings *gsettings = g_settings_new (EMPATHY_PREFS_NOTIFICATIONS_SCHEMA); GtkWidget *window = empathy_main_window_dup (); account = empathy_contact_get_account (contact); @@ -1054,7 +1056,7 @@ event_manager_presence_changed_cb (EmpathyContact *contact, /* someone is logging off */ empathy_sound_play (window, EMPATHY_SOUND_CONTACT_DISCONNECTED); - if (g_settings_get_boolean (gsettings, + if (g_settings_get_boolean (priv->gsettings_notif, EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNOUT)) { header = g_strdup_printf (_("%s is now offline."), @@ -1074,7 +1076,7 @@ event_manager_presence_changed_cb (EmpathyContact *contact, /* someone is logging in */ empathy_sound_play (window, EMPATHY_SOUND_CONTACT_CONNECTED); - if (g_settings_get_boolean (gsettings, + if (g_settings_get_boolean (priv->gsettings_notif, EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNIN)) { header = g_strdup_printf (_("%s is now online."), @@ -1089,7 +1091,6 @@ event_manager_presence_changed_cb (EmpathyContact *contact, out: g_object_unref (idle); - g_object_unref (gsettings); g_object_unref (window); } @@ -1144,6 +1145,7 @@ event_manager_finalize (GObject *object) g_slist_free (priv->approvals); g_object_unref (priv->contact_manager); g_object_unref (priv->approver); + g_object_unref (priv->gsettings_notif); } static void @@ -1196,6 +1198,8 @@ empathy_event_manager_init (EmpathyEventManager *manager) manager->priv = priv; + priv->gsettings_notif = g_settings_new (EMPATHY_PREFS_NOTIFICATIONS_SCHEMA); + priv->contact_manager = empathy_contact_manager_dup_singleton (); g_signal_connect (priv->contact_manager, "pendings-changed", G_CALLBACK (event_manager_pendings_changed_cb), manager); |