diff options
author | Gabriel Millaire <millaire.gabriel@gmail.com> | 2009-05-24 03:51:56 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2009-06-18 18:34:37 +0800 |
commit | ddb6c9033a1e1f028ab3df93d48462f33ea86a44 (patch) | |
tree | 28b7347dd2b304f9ca09e295a480d23202ef9f19 /src | |
parent | bc076392a0980d6a3040e2be2f047fedfadcf591 (diff) | |
download | gsoc2013-empathy-ddb6c9033a1e1f028ab3df93d48462f33ea86a44.tar gsoc2013-empathy-ddb6c9033a1e1f028ab3df93d48462f33ea86a44.tar.gz gsoc2013-empathy-ddb6c9033a1e1f028ab3df93d48462f33ea86a44.tar.bz2 gsoc2013-empathy-ddb6c9033a1e1f028ab3df93d48462f33ea86a44.tar.lz gsoc2013-empathy-ddb6c9033a1e1f028ab3df93d48462f33ea86a44.tar.xz gsoc2013-empathy-ddb6c9033a1e1f028ab3df93d48462f33ea86a44.tar.zst gsoc2013-empathy-ddb6c9033a1e1f028ab3df93d48462f33ea86a44.zip |
Add 'Show Contact List' in Conversation menu
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-chat-window.c | 39 | ||||
-rw-r--r-- | src/empathy-chat-window.ui | 8 |
2 files changed, 47 insertions, 0 deletions
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c index 118c7375e..03e4c1059 100644 --- a/src/empathy-chat-window.c +++ b/src/empathy-chat-window.c @@ -72,11 +72,13 @@ typedef struct { GtkWidget *dialog; GtkWidget *notebook; NotifyNotification *notification; + guint notify_id; /* show contacts' notification */ /* Menu items. */ GtkUIManager *ui_manager; GtkAction *menu_conv_insert_smiley; GtkAction *menu_conv_favorite; + GtkAction *menu_conv_toggle_contacts; GtkAction *menu_edit_cut; GtkAction *menu_edit_copy; @@ -133,6 +135,21 @@ chat_window_accel_cb (GtkAccelGroup *accelgroup, } } +static void +chat_window_notify_show_contacts_cb (EmpathyConf *conf, + const gchar *key, + gpointer user_data) +{ + gboolean value; + EmpathyChatWindowPriv *priv; + + priv = GET_PRIV (user_data); + + if (empathy_conf_get_bool (empathy_conf_get (), key, &value)) { + gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (priv->menu_conv_toggle_contacts), value); + } +} + static EmpathyChatWindow * chat_window_find_chat (EmpathyChat *chat) { @@ -565,6 +582,7 @@ chat_window_conv_activate_cb (GtkAction *action, GTK_TOGGLE_ACTION (priv->menu_conv_favorite), found); } gtk_action_set_visible (priv->menu_conv_favorite, is_room); + gtk_action_set_visible (priv->menu_conv_toggle_contacts, is_room); } static void @@ -608,6 +626,19 @@ chat_window_favorite_toggled_cb (GtkToggleAction *toggle_action, } } +static void +chat_window_contacts_toggled_cb (GtkToggleAction *toggle_action, + EmpathyChatWindow *window) +{ + gboolean active; + + active = gtk_toggle_action_get_active (toggle_action); + + empathy_conf_set_bool (empathy_conf_get (), + EMPATHY_PREFS_CHAT_SHOW_CONTACTS_IN_ROOMS, + active); +} + static const gchar * chat_get_window_id_for_geometry (EmpathyChat *chat) { @@ -1319,6 +1350,8 @@ chat_window_finalize (GObject *object) chat_windows = g_list_remove (chat_windows, window); gtk_widget_destroy (priv->dialog); + + empathy_conf_notify_remove (empathy_conf_get (), priv->notify_id); G_OBJECT_CLASS (empathy_chat_window_parent_class)->finalize (object); } @@ -1368,6 +1401,7 @@ empathy_chat_window_init (EmpathyChatWindow *window) "ui_manager", &priv->ui_manager, "menu_conv_insert_smiley", &priv->menu_conv_insert_smiley, "menu_conv_favorite", &priv->menu_conv_favorite, + "menu_conv_toggle_contacts", &priv->menu_conv_toggle_contacts, "menu_edit_cut", &priv->menu_edit_cut, "menu_edit_copy", &priv->menu_edit_copy, "menu_edit_paste", &priv->menu_edit_paste, @@ -1384,6 +1418,7 @@ empathy_chat_window_init (EmpathyChatWindow *window) "menu_conv", "activate", chat_window_conv_activate_cb, "menu_conv_clear", "activate", chat_window_clear_activate_cb, "menu_conv_favorite", "toggled", chat_window_favorite_toggled_cb, + "menu_conv_toggle_contacts", "toggled", chat_window_contacts_toggled_cb, "menu_conv_close", "activate", chat_window_close_activate_cb, "menu_edit", "activate", chat_window_edit_activate_cb, "menu_edit_cut", "activate", chat_window_cut_activate_cb, @@ -1469,6 +1504,10 @@ empathy_chat_window_init (EmpathyChatWindow *window) "page_removed", G_CALLBACK (chat_window_page_removed_cb), window); + priv->notify_id = empathy_conf_notify_add (empathy_conf_get (), + EMPATHY_PREFS_CHAT_SHOW_CONTACTS_IN_ROOMS, + chat_window_notify_show_contacts_cb, + window); /* Set up drag and drop */ gtk_drag_dest_set (GTK_WIDGET (priv->notebook), diff --git a/src/empathy-chat-window.ui b/src/empathy-chat-window.ui index 0d5a83180..8c8ea7d00 100644 --- a/src/empathy-chat-window.ui +++ b/src/empathy-chat-window.ui @@ -32,6 +32,13 @@ </object> </child> <child> + <object class="GtkToggleAction" id="menu_conv_toggle_contacts"> + <property name="name">menu_conv_toggle_contacts</property> + <property name="active">TRUE</property> + <property name="label" translatable="yes">_Show Contact List</property> + </object> + </child> + <child> <object class="GtkAction" id="menu_conv_close"> <property name="stock_id">gtk-close</property> <property name="name">menu_conv_close</property> @@ -137,6 +144,7 @@ <menuitem action="menu_conv_clear"/> <menuitem action="menu_conv_insert_smiley"/> <menuitem action="menu_conv_favorite"/> + <menuitem action="menu_conv_toggle_contacts"/> <separator/> <menuitem action="menu_conv_close"/> </menu> |