[evolution] I#1969 - EShellWindow: The 'New' menu is not filled after start



commit 92a44896a75e23447791f4e1f5a053bd4803661c
Author: Milan Crha <mcrha redhat com>
Date:   Tue Aug 30 13:48:53 2022 +0200

    I#1969 - EShellWindow: The 'New' menu is not filled after start
    
    Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1969

 src/shell/e-shell-headerbar.c |  5 ++---
 src/shell/e-shell-window.c    | 29 +++++++++++++++++++++++++++--
 2 files changed, 29 insertions(+), 5 deletions(-)
---
diff --git a/src/shell/e-shell-headerbar.c b/src/shell/e-shell-headerbar.c
index b824bea34d..70a4ea942b 100644
--- a/src/shell/e-shell-headerbar.c
+++ b/src/shell/e-shell-headerbar.c
@@ -89,7 +89,6 @@ shell_header_bar_set_shell_window (EShellHeaderBar *headerbar,
 
 static void
 shell_header_bar_update_new_menu (EShellWindow *shell_window,
-                                 GParamSpec *pspec,
                                  gpointer user_data)
 {
        EShellHeaderBar *headerbar = user_data;
@@ -179,8 +178,8 @@ shell_header_bar_constructed (GObject *object)
                gtk_ui_manager_get_accel_group (ui_manager),
                GDK_KEY_N, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
 
-       self->priv->prefered_item_notify_id = e_signal_connect_notify (
-               shell_window, "notify::active-view",
+       self->priv->prefered_item_notify_id = g_signal_connect (
+               shell_window, "update-new-menu",
                G_CALLBACK (shell_header_bar_update_new_menu), self);
 
        g_object_unref (shell_window);
diff --git a/src/shell/e-shell-window.c b/src/shell/e-shell-window.c
index a7b302a081..7ef3f8e57f 100644
--- a/src/shell/e-shell-window.c
+++ b/src/shell/e-shell-window.c
@@ -47,6 +47,7 @@ enum {
 enum {
        CLOSE_ALERT,
        SHELL_VIEW_CREATED,
+       UPDATE_NEW_MENU,
        LAST_SIGNAL
 };
 
@@ -124,6 +125,8 @@ shell_window_set_notebook_page (EShellWindow *shell_window,
        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
@@ -427,8 +430,8 @@ shell_window_construct_menubar (EShellWindow *shell_window)
                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;
@@ -1047,6 +1050,24 @@ e_shell_window_class_init (EShellWindowClass *class)
                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.46
+        **/
+       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);
@@ -1964,6 +1985,8 @@ e_shell_window_register_new_item_actions (EShellWindow *shell_window,
                                G_OBJECT (action),
                                "primary", GINT_TO_POINTER (TRUE));
        }
+
+       g_signal_emit (shell_window, signals[UPDATE_NEW_MENU], 0, NULL);
 }
 
 /**
@@ -2041,6 +2064,8 @@ e_shell_window_register_new_source_actions (EShellWindow *shell_window,
                        G_OBJECT (action),
                        "backend-name", (gpointer) backend_name);
        }
+
+       g_signal_emit (shell_window, signals[UPDATE_NEW_MENU], 0, NULL);
 }
 
 /**


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]