You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
evolution/SOURCES/evolution-3.40.4-new-button...

105 lines
3.0 KiB

diff -up evolution-3.40.4/src/shell/e-shell-window.c.7 evolution-3.40.4/src/shell/e-shell-window.c
--- evolution-3.40.4/src/shell/e-shell-window.c.7 2021-08-13 11:50:35.000000000 +0200
+++ evolution-3.40.4/src/shell/e-shell-window.c 2022-09-26 09:33:45.615069941 +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
@@ -463,8 +477,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;
@@ -544,6 +558,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 (
@@ -1133,6 +1152,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);
@@ -2048,6 +2085,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);
}
/**
@@ -2125,6 +2164,8 @@ 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);
}
/**