evolution/evolution-3.28.5-new-button.patch

103 lines
3.0 KiB
Diff

diff -up evolution-3.28.5/src/shell/e-shell-window.c.new-button evolution-3.28.5/src/shell/e-shell-window.c
--- evolution-3.28.5/src/shell/e-shell-window.c.new-button 2018-07-30 15:37:05.000000000 +0200
+++ evolution-3.28.5/src/shell/e-shell-window.c 2022-09-26 09:27:18.862555829 +0200
@@ -47,6 +47,7 @@ enum {
enum {
CLOSE_ALERT,
SHELL_VIEW_CREATED,
+ UPDATE_NEW_MENU,
LAST_SIGNAL
};
@@ -120,6 +121,17 @@ shell_window_toolbar_update_new_menu (Gt
gtk_menu_tool_button_set_menu (menu_tool_button, menu);
}
+static void
+shell_window_toolbar_update_new_menu_sig (EShellWindow *shell_window,
+ GtkMenuToolButton *menu_tool_button)
+{
+ GtkWidget *menu;
+
+ /* Update the "New" menu tool button submenu. */
+ menu = e_shell_window_create_new_menu (shell_window);
+ gtk_menu_tool_button_set_menu (menu_tool_button, menu);
+}
+
static gboolean
shell_window_active_view_to_prefer_item (GBinding *binding,
const GValue *source_value,
@@ -160,6 +172,8 @@ shell_window_set_notebook_page (EShellWi
g_return_if_fail (page_num >= 0);
gtk_notebook_set_current_page (notebook, page_num);
+
+ g_signal_emit (shell_window, signals[UPDATE_NEW_MENU], 0, NULL);
}
static void
@@ -512,8 +526,8 @@ shell_window_construct_menubar (EShellWi
main_menu, "visible",
G_BINDING_SYNC_CREATE);
- e_signal_connect_notify (
- shell_window, "notify::active-view",
+ g_signal_connect (
+ shell_window, "update-new-menu",
G_CALLBACK (shell_window_menubar_update_new_menu), NULL);
return main_menu;
@@ -593,6 +607,11 @@ shell_window_construct_toolbar (EShellWi
G_CALLBACK (shell_window_toolbar_update_new_menu),
shell_window);
+ g_signal_connect_object (
+ shell_window, "update-new-menu",
+ G_CALLBACK (shell_window_toolbar_update_new_menu_sig),
+ item, 0);
+
gtk_box_pack_start (GTK_BOX (box), toolbar, TRUE, TRUE, 0);
toolbar = e_shell_window_get_managed_widget (
@@ -1176,6 +1195,24 @@ e_shell_window_class_init (EShellWindowC
G_TYPE_NONE, 1,
E_TYPE_SHELL_VIEW);
+ /*
+ * EShellWindow::update-new-menu
+ * @shell_window: the #EShellWindow
+ *
+ * Emitted when the 'New' menu should be updated.
+ *
+ * Since: 3.44.5
+ */
+ signals[UPDATE_NEW_MENU] = g_signal_new (
+ "update-new-menu",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0,
+ G_TYPE_NONE);
+
binding_set = gtk_binding_set_by_class (class);
gtk_binding_entry_add_signal (
binding_set, GDK_KEY_Escape, 0, "close-alert", 0);
@@ -2029,6 +2066,8 @@ e_shell_window_register_new_item_actions
G_OBJECT (action),
"primary", GINT_TO_POINTER (TRUE));
}
+
+ g_signal_emit (shell_window, signals[UPDATE_NEW_MENU], 0, NULL);
}
/**
@@ -2106,4 +2145,6 @@ e_shell_window_register_new_source_actio
G_OBJECT (action),
"backend-name", (gpointer) backend_name);
}
+
+ g_signal_emit (shell_window, signals[UPDATE_NEW_MENU], 0, NULL);
}