[evolution/gnome-43] I#2087 - Hide extra separators in Mail and Calendar view toolbars



commit d5ff0fb0bd73c062f82f4c4186d07f1230b35727
Author: Milan Crha <mcrha redhat com>
Date:   Thu Oct 20 10:43:56 2022 +0200

    I#2087 - Hide extra separators in Mail and Calendar view toolbars
    
    Related to https://gitlab.gnome.org/GNOME/evolution/-/issues/2087

 data/ui/evolution-calendars.ui                  |  2 +-
 data/ui/evolution-mail-reader.ui                |  2 +-
 src/composer/e-composer-private.c               |  3 ++-
 src/modules/calendar/e-cal-shell-view-private.c | 23 ++++++++++++-----------
 src/modules/mail/e-mail-shell-view-private.c    |  4 ++++
 5 files changed, 20 insertions(+), 14 deletions(-)
---
diff --git a/data/ui/evolution-calendars.ui b/data/ui/evolution-calendars.ui
index 9c9d5cc6ec..3732ae940c 100644
--- a/data/ui/evolution-calendars.ui
+++ b/data/ui/evolution-calendars.ui
@@ -62,7 +62,7 @@
     <toolitem action='calendar-go-back'/>
     <toolitem action='calendar-go-today'/>
     <toolitem action='calendar-go-forward'/>
-    <separator/>
+    <separator name='calendar-go-forward-separator'/>
     <toolitem action='calendar-jump-to'/>
     <separator/>
     <toolitem action='calendar-view-day'/>
diff --git a/data/ui/evolution-mail-reader.ui b/data/ui/evolution-mail-reader.ui
index b8f4e45d0a..2f69e6bf0d 100644
--- a/data/ui/evolution-mail-reader.ui
+++ b/data/ui/evolution-mail-reader.ui
@@ -155,7 +155,7 @@
           <menuitem action='mail-redirect'/>
         </menu>
       </toolitem>
-      <separator/>
+      <separator name='toolbar-mail-forward-separator'/>
       <toolitem action='mail-print'/>
       <toolitem action='mail-delete'/>
       <toolitem action='mail-mark-junk'/>
diff --git a/src/composer/e-composer-private.c b/src/composer/e-composer-private.c
index adad36c4a4..9b07c19eb7 100644
--- a/src/composer/e-composer-private.c
+++ b/src/composer/e-composer-private.c
@@ -325,7 +325,8 @@ e_composer_private_constructed (EMsgComposer *composer)
                /* Destroy items from the toolbar, which are in the header bar */
                for (ii = 0; ii < G_N_ELEMENTS (items); ii++) {
                        widget = gtk_ui_manager_get_widget (ui_manager, items[ii]);
-                       gtk_widget_destroy (widget);
+                       if (widget)
+                               gtk_widget_destroy (widget);
                }
        } else {
                /* We set the send button as important to have a label */
diff --git a/src/modules/calendar/e-cal-shell-view-private.c b/src/modules/calendar/e-cal-shell-view-private.c
index 47ba997ba4..c363d40cf1 100644
--- a/src/modules/calendar/e-cal-shell-view-private.c
+++ b/src/modules/calendar/e-cal-shell-view-private.c
@@ -312,11 +312,18 @@ cal_shell_view_taskpad_settings_changed_cb (GSettings *settings,
 static void
 cal_shell_view_update_header_bar (ECalShellView *cal_shell_view)
 {
+       const gchar *items[] = {
+               "/main-toolbar/calendar-go-back",
+               "/main-toolbar/calendar-go-today",
+               "/main-toolbar/calendar-go-forward",
+               "/main-toolbar/calendar-go-forward-separator"
+       };
        EShellWindow *shell_window;
        EShellView *shell_view;
        EShellHeaderBar *shell_headerbar = NULL;
        GtkWidget *widget;
        GtkAction *action;
+       gint ii;
 
        shell_view = E_SHELL_VIEW (cal_shell_view);
        shell_window = e_shell_view_get_shell_window (shell_view);
@@ -344,17 +351,11 @@ cal_shell_view_update_header_bar (ECalShellView *cal_shell_view)
 
        e_shell_header_bar_pack_end (shell_headerbar, widget);
 
-       widget = e_shell_window_get_managed_widget (shell_window, "/main-toolbar/calendar-go-back");
-       if (widget)
-               gtk_widget_destroy (widget);
-
-       widget = e_shell_window_get_managed_widget (shell_window, "/main-toolbar/calendar-go-today");
-       if (widget)
-               gtk_widget_destroy (widget);
-
-       widget = e_shell_window_get_managed_widget (shell_window, "/main-toolbar/calendar-go-forward");
-       if (widget)
-               gtk_widget_destroy (widget);
+       for (ii = 0; ii < G_N_ELEMENTS (items); ii++) {
+               widget = e_shell_window_get_managed_widget (shell_window, items[ii]);
+               if (widget)
+                       gtk_widget_destroy (widget);
+       }
 }
 
 void
diff --git a/src/modules/mail/e-mail-shell-view-private.c b/src/modules/mail/e-mail-shell-view-private.c
index 2c785a339e..cd0db99de4 100644
--- a/src/modules/mail/e-mail-shell-view-private.c
+++ b/src/modules/mail/e-mail-shell-view-private.c
@@ -1563,6 +1563,10 @@ e_mail_shell_view_update_send_receive_menus (EMailShellView *mail_shell_view)
                widget = e_shell_window_get_managed_widget (shell_window, 
"/main-toolbar/mail-toolbar-common/mail-reply-sender");
                if (widget)
                        gtk_widget_destroy (widget);
+
+               widget = e_shell_window_get_managed_widget (shell_window, 
"/main-toolbar/mail-toolbar-common/toolbar-mail-forward-separator");
+               if (widget)
+                       gtk_widget_destroy (widget);
        } else {
                if (!mail_shell_view->priv->send_receive_tool_item) {
                        GtkWidget *toolbar;


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