[empathy] chat-text-view: cache the chat GSettings



commit b63808b139096d53264b90908efcc6e63b1c4170
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Mon Nov 29 15:47:35 2010 +0100

    chat-text-view: cache the chat GSettings

 libempathy-gtk/empathy-chat-text-view.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/libempathy-gtk/empathy-chat-text-view.c b/libempathy-gtk/empathy-chat-text-view.c
index e5ff07f..5d5dcde 100644
--- a/libempathy-gtk/empathy-chat-text-view.c
+++ b/libempathy-gtk/empathy-chat-text-view.c
@@ -69,6 +69,7 @@ typedef struct {
 	gboolean              allow_scrolling;
 	guint                 notify_system_fonts_id;
 	GSettings            *gsettings_desktop;
+	GSettings            *gsettings_chat;
 	EmpathySmileyManager *smiley_manager;
 	gboolean              only_if_date;
 } EmpathyChatTextViewPriv;
@@ -560,6 +561,7 @@ chat_text_view_finalize (GObject *object)
 
 	DEBUG ("%p", object);
 
+	g_object_unref (priv->gsettings_chat);
 	g_object_unref (priv->gsettings_desktop);
 
 	if (priv->last_contact) {
@@ -635,6 +637,8 @@ empathy_chat_text_view_init (EmpathyChatTextView *view)
 		      "cursor-visible", FALSE,
 		      NULL);
 
+	priv->gsettings_chat = g_settings_new (EMPATHY_PREFS_CHAT_SCHEMA);
+
 	priv->gsettings_desktop = g_settings_new (
 			  EMPATHY_PREFS_DESKTOP_INTERFACE_SCHEMA);
 	g_signal_connect (priv->gsettings_desktop,
@@ -1407,11 +1411,9 @@ empathy_chat_text_view_append_body (EmpathyChatTextView *view,
 	GtkTextIter              start_iter;
 	GtkTextIter              iter;
 	GtkTextMark             *mark;
-	GSettings		*gsettings_chat;
 
 	/* Check if we have to parse smileys */
-	gsettings_chat = g_settings_new (EMPATHY_PREFS_CHAT_SCHEMA);
-	use_smileys = g_settings_get_boolean (gsettings_chat,
+	use_smileys = g_settings_get_boolean (priv->gsettings_chat,
 			EMPATHY_PREFS_CHAT_SHOW_SMILEYS);
 
 	if (use_smileys)
@@ -1438,8 +1440,6 @@ empathy_chat_text_view_append_body (EmpathyChatTextView *view,
 					   &iter);
 
 	gtk_text_buffer_delete_mark (priv->buffer, mark);
-
-	g_object_unref (gsettings_chat);
 }
 
 void



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