[empathy] chat-window: cache the notifications GSettings



commit adda65622351cabb18517bef5ca853890e9829af
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Mon Nov 29 15:36:59 2010 +0100

    chat-window: cache the notifications GSettings

 src/empathy-chat-window.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index 4aba2af..7698d26 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -113,6 +113,7 @@ typedef struct {
 	guint32    x_user_action_time;
 
 	GSettings *gsettings_chat;
+	GSettings *gsettings_notif;
 } EmpathyChatWindowPriv;
 
 static GList *chat_windows = NULL;
@@ -1285,14 +1286,9 @@ chat_window_show_or_update_notification (EmpathyChatWindow *window,
 	if (!empathy_notify_manager_notification_is_enabled (priv->notify_mgr)) {
 		return;
 	} else {
-		GSettings *gsettings = g_settings_new (
-				EMPATHY_PREFS_NOTIFICATIONS_SCHEMA);
-
-		res = g_settings_get_boolean (gsettings,
+		res = g_settings_get_boolean (priv->gsettings_notif,
 				EMPATHY_PREFS_NOTIFICATIONS_FOCUS);
 
-		g_object_unref (gsettings);
-
 		if (!res) {
 			return;
 		}
@@ -1874,6 +1870,7 @@ chat_window_finalize (GObject *object)
 	g_object_unref (priv->chatroom_manager);
 	g_object_unref (priv->notify_mgr);
 	g_object_unref (priv->gsettings_chat);
+	g_object_unref (priv->gsettings_notif);
 
 	if (priv->notification != NULL) {
 		notify_notification_close (priv->notification, NULL);
@@ -1985,6 +1982,7 @@ empathy_chat_window_init (EmpathyChatWindow *window)
 	g_object_unref (gui);
 
 	priv->gsettings_chat = g_settings_new (EMPATHY_PREFS_CHAT_SCHEMA);
+	priv->gsettings_notif = g_settings_new (EMPATHY_PREFS_NOTIFICATIONS_SCHEMA);
 	priv->chatroom_manager = empathy_chatroom_manager_dup_singleton (NULL);
 
 	priv->notebook = gtk_notebook_new ();



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