Blame SOURCES/evolution-3.28.5-new-button.patch

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