aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-chat.c
diff options
context:
space:
mode:
Diffstat (limited to 'libempathy-gtk/empathy-chat.c')
-rw-r--r--libempathy-gtk/empathy-chat.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index 04e786253..a55d53e9d 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -100,6 +100,8 @@ struct _EmpathyChatPriv {
/* Source func ID for update_misspelled_words () */
guint update_misspelled_words_id;
+ /* Source func ID for save_paned_pos_timeout () */
+ guint save_paned_pos_id;
GtkWidget *widget;
GtkWidget *hpaned;
@@ -2491,17 +2493,32 @@ conf_spell_checking_cb (GSettings *gsettings_chat,
}
static gboolean
+save_paned_pos_timeout (gpointer data)
+{
+ EmpathyChat *self = data;
+ gint hpaned_pos;
+
+ hpaned_pos = gtk_paned_get_position (GTK_PANED (self->priv->hpaned));
+
+ g_settings_set_int (self->priv->gsettings_ui,
+ EMPATHY_PREFS_UI_CHAT_WINDOW_PANED_POS,
+ hpaned_pos);
+
+ return FALSE;
+}
+
+static gboolean
chat_hpaned_pos_changed_cb (GtkWidget* hpaned,
GParamSpec *spec,
gpointer user_data)
{
EmpathyChat *chat = EMPATHY_CHAT (user_data);
- gint hpaned_pos;
- hpaned_pos = gtk_paned_get_position (GTK_PANED(hpaned));
- g_settings_set_int (chat->priv->gsettings_ui,
- EMPATHY_PREFS_UI_CHAT_WINDOW_PANED_POS,
- hpaned_pos);
+ if (chat->priv->save_paned_pos_id != 0)
+ g_source_remove (chat->priv->save_paned_pos_id);
+
+ chat->priv->save_paned_pos_id = g_timeout_add_seconds (1,
+ save_paned_pos_timeout, chat);
return TRUE;
}
@@ -2656,6 +2673,9 @@ chat_finalize (GObject *object)
if (priv->update_misspelled_words_id != 0)
g_source_remove (priv->update_misspelled_words_id);
+ if (priv->save_paned_pos_id != 0)
+ g_source_remove (priv->save_paned_pos_id);
+
g_object_unref (priv->gsettings_chat);
g_object_unref (priv->gsettings_ui);