aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2010-12-14 22:13:55 +0800
committerMilan Crha <mcrha@redhat.com>2010-12-14 22:13:55 +0800
commitffa69c8bef51ccb6a0a06684605d85b364b2c667 (patch)
treeebf8a42c07880476f8c701d4509a2c2003a5c1a7
parentbf9b9b42a74b497081788f383eee74291b34c956 (diff)
downloadgsoc2013-evolution-ffa69c8bef51ccb6a0a06684605d85b364b2c667.tar
gsoc2013-evolution-ffa69c8bef51ccb6a0a06684605d85b364b2c667.tar.gz
gsoc2013-evolution-ffa69c8bef51ccb6a0a06684605d85b364b2c667.tar.bz2
gsoc2013-evolution-ffa69c8bef51ccb6a0a06684605d85b364b2c667.tar.lz
gsoc2013-evolution-ffa69c8bef51ccb6a0a06684605d85b364b2c667.tar.xz
gsoc2013-evolution-ffa69c8bef51ccb6a0a06684605d85b364b2c667.tar.zst
gsoc2013-evolution-ffa69c8bef51ccb6a0a06684605d85b364b2c667.zip
Bug #637162 - May not add toolbar Send/Receive button multiple times
-rw-r--r--modules/mail/e-mail-shell-view-private.c51
1 files changed, 29 insertions, 22 deletions
diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c
index 8eb77a1920..a4e74c32ad 100644
--- a/modules/mail/e-mail-shell-view-private.c
+++ b/modules/mail/e-mail-shell-view-private.c
@@ -1413,9 +1413,7 @@ e_mail_shell_view_update_send_receive_menus (EMailShellView *mail_shell_view)
{
EMailShellViewPrivate *priv;
EShellWindow *shell_window;
- GtkWidget *widget, *toolbar;
- GtkToolItem *tool_item;
- gint index;
+ GtkWidget *widget;
g_return_if_fail (mail_shell_view != NULL);
@@ -1424,6 +1422,8 @@ e_mail_shell_view_update_send_receive_menus (EMailShellView *mail_shell_view)
if (!e_shell_view_is_active (E_SHELL_VIEW (mail_shell_view))) {
if (priv->send_receive_tool_item) {
+ GtkWidget *toolbar;
+
shell_window = e_shell_view_get_shell_window (E_SHELL_VIEW (mail_shell_view));
toolbar = e_shell_window_get_managed_widget (shell_window, "/main-toolbar");
@@ -1445,29 +1445,36 @@ e_mail_shell_view_update_send_receive_menus (EMailShellView *mail_shell_view)
if (widget)
gtk_menu_item_set_submenu (GTK_MENU_ITEM (widget), create_send_receive_submenu (mail_shell_view));
- toolbar = e_shell_window_get_managed_widget (shell_window, "/main-toolbar");
- g_return_if_fail (toolbar != NULL);
+ if (!priv->send_receive_tool_item) {
+ GtkWidget *toolbar;
+ GtkToolItem *tool_item;
+ gint index;
- widget = e_shell_window_get_managed_widget (shell_window, "/main-toolbar/toolbar-actions/mail-send-receiver");
- g_return_if_fail (widget != NULL);
+ toolbar = e_shell_window_get_managed_widget (shell_window, "/main-toolbar");
+ g_return_if_fail (toolbar != NULL);
- index = gtk_toolbar_get_item_index (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (widget));
+ widget = e_shell_window_get_managed_widget (shell_window, "/main-toolbar/toolbar-actions/mail-send-receiver");
+ g_return_if_fail (widget != NULL);
- tool_item = gtk_separator_tool_item_new ();
- gtk_toolbar_insert (GTK_TOOLBAR (toolbar), tool_item, index);
- gtk_widget_show (GTK_WIDGET (tool_item));
- priv->send_receive_tool_separator = tool_item;
+ index = gtk_toolbar_get_item_index (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (widget));
- tool_item = GTK_TOOL_ITEM (e_menu_tool_button_new (_("Send / Receive")));
- gtk_tool_item_set_is_important (tool_item, TRUE);
- gtk_toolbar_insert (GTK_TOOLBAR (toolbar), tool_item, index);
- gtk_widget_show (GTK_WIDGET (tool_item));
- priv->send_receive_tool_item = tool_item;
+ tool_item = gtk_separator_tool_item_new ();
+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar), tool_item, index);
+ gtk_widget_show (GTK_WIDGET (tool_item));
+ priv->send_receive_tool_separator = tool_item;
- gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (tool_item), create_send_receive_submenu (mail_shell_view));
+ tool_item = GTK_TOOL_ITEM (e_menu_tool_button_new (_("Send / Receive")));
+ gtk_tool_item_set_is_important (tool_item, TRUE);
+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar), tool_item, index);
+ gtk_widget_show (GTK_WIDGET (tool_item));
+ priv->send_receive_tool_item = tool_item;
- g_object_bind_property (
- ACTION (MAIL_SEND_RECEIVE), "sensitive",
- tool_item, "sensitive",
- G_BINDING_SYNC_CREATE);
+ g_object_bind_property (
+ ACTION (MAIL_SEND_RECEIVE), "sensitive",
+ tool_item, "sensitive",
+ G_BINDING_SYNC_CREATE);
+ }
+
+ if (priv->send_receive_tool_item)
+ gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (priv->send_receive_tool_item), create_send_receive_submenu (mail_shell_view));
}