[empathy] empathy-chat-window: Don't update the Contact menu if visible
- From: Rob Bradford <rbradford src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [empathy] empathy-chat-window: Don't update the Contact menu if visible
- Date: Fri, 23 Oct 2009 16:27:12 +0000 (UTC)
commit 24fb016e872b01bc3e4b8b3a36e99d60f2273784
Author: Rob Bradford <rob linux intel com>
Date: Fri Oct 23 17:18:05 2009 +0100
empathy-chat-window: Don't update the Contact menu if visible
If the Contact menu is currently visible do not update it. Instead update it
once the menu is hidden.
Fixes: #591360
src/empathy-chat-window.c | 31 ++++++++++++++++++++++++++-----
1 files changed, 26 insertions(+), 5 deletions(-)
---
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index f5b5d24..e2d946c 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -113,6 +113,8 @@ static const GtkTargetEntry drag_types_dest[] = {
{ "GTK_NOTEBOOK_TAB", GTK_TARGET_SAME_APP, DND_DRAG_TYPE_TAB },
};
+static void chat_window_update (EmpathyChatWindow *window);
+
G_DEFINE_TYPE (EmpathyChatWindow, empathy_chat_window, G_TYPE_OBJECT);
static void
@@ -295,6 +297,17 @@ chat_window_create_label (EmpathyChatWindow *window,
}
static void
+_submenu_notify_visible_changed_cb (GObject *object,
+ GParamSpec *pspec,
+ gpointer userdata)
+{
+ g_signal_handlers_disconnect_by_func (object,
+ _submenu_notify_visible_changed_cb,
+ userdata);
+ chat_window_update (EMPATHY_CHAT_WINDOW (userdata));
+}
+
+static void
chat_window_update (EmpathyChatWindow *window)
{
EmpathyChatWindowPriv *priv = GET_PRIV (window);
@@ -311,8 +324,7 @@ chat_window_update (EmpathyChatWindow *window)
gboolean avatar_in_icon;
GtkWidget *chat;
GtkWidget *chat_close_button;
- GtkWidget *submenu;
- GtkWidget *menu;
+ GtkWidget *menu, *submenu, *orig_submenu;
/* Get information */
page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (priv->notebook));
@@ -336,9 +348,18 @@ chat_window_update (EmpathyChatWindow *window)
/* Update Contact menu */
menu = gtk_ui_manager_get_widget (priv->ui_manager,
"/chats_menubar/menu_contact");
- submenu = empathy_chat_get_contact_menu (priv->current_chat);
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu), submenu);
- gtk_widget_show (menu);
+ orig_submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (menu));
+ if (!GTK_WIDGET_VISIBLE (orig_submenu))
+ {
+ submenu = empathy_chat_get_contact_menu (priv->current_chat);
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu), submenu);
+ gtk_widget_show (menu);
+ } else {
+ empathy_signal_connect_weak (orig_submenu,
+ "notify::visible",
+ (GCallback)_submenu_notify_visible_changed_cb,
+ G_OBJECT (window));
+ }
/* Update window title */
if (n_chats == 1) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]