[evolution] I#67 - Provide a hint how to show hidden Menu Bar again



commit c4423134e382885c5b2f749b5e02ca3d963009fb
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jul 10 16:15:26 2018 +0200

    I#67 - Provide a hint how to show hidden Menu Bar again
    
    Closes https://gitlab.gnome.org/GNOME/evolution/issues/67

 src/shell/e-shell-window.c | 39 +++++++++++++++++++++++++++++++++++++++
 src/shell/shell.error.xml  |  6 ++++++
 2 files changed, 45 insertions(+)
---
diff --git a/src/shell/e-shell-window.c b/src/shell/e-shell-window.c
index 37348982a2..d5e584cbf6 100644
--- a/src/shell/e-shell-window.c
+++ b/src/shell/e-shell-window.c
@@ -1634,6 +1634,26 @@ e_shell_window_add_action_group (EShellWindow *shell_window,
        g_object_unref (action_group);
 }
 
+static void
+shell_window_menubar_info_response_cb (EAlert *alert,
+                                      gint response_id,
+                                      gpointer user_data)
+{
+       GWeakRef *weakref = user_data;
+
+       g_return_if_fail (weakref != NULL);
+
+       if (response_id == GTK_RESPONSE_APPLY) {
+               EShellWindow *shell_window;
+
+               shell_window = g_weak_ref_get (weakref);
+               if (shell_window) {
+                       e_shell_window_set_menubar_visible (shell_window, TRUE);
+                       g_object_unref (shell_window);
+               }
+       }
+}
+
 /**
  * e_shell_window_get_menubar_visible:
  * @shell_window: an #EShellWindow
@@ -1665,6 +1685,8 @@ void
 e_shell_window_set_menubar_visible (EShellWindow *shell_window,
                                    gboolean menubar_visible)
 {
+       GSettings *settings;
+
        g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
 
        if (shell_window->priv->menubar_visible == menubar_visible)
@@ -1672,6 +1694,23 @@ e_shell_window_set_menubar_visible (EShellWindow *shell_window,
 
        shell_window->priv->menubar_visible = menubar_visible;
 
+       settings = e_util_ref_settings ("org.gnome.evolution.shell");
+       if (!menubar_visible &&
+           g_settings_get_boolean (settings, e_shell_window_is_main_instance (shell_window) ? 
"menubar-visible" : "menubar-visible-sub")) {
+               /* The menu bar had been just hidden. Show a hint how to enable it. */
+               EAlert *alert;
+
+               alert = e_alert_new ("shell:menubar-hidden", NULL);
+
+               g_signal_connect_data (alert, "response", G_CALLBACK (shell_window_menubar_info_response_cb),
+                       e_weak_ref_new (shell_window), (GClosureNotify) e_weak_ref_free, 0);
+
+               e_alert_sink_submit_alert (E_ALERT_SINK (shell_window), alert);
+               e_alert_start_timer (alert, 30);
+               g_object_unref (alert);
+       }
+       g_object_unref (settings);
+
        g_object_notify (G_OBJECT (shell_window), "menubar-visible");
 }
 
diff --git a/src/shell/shell.error.xml b/src/shell/shell.error.xml
index f327d1ce81..ed2474a220 100644
--- a/src/shell/shell.error.xml
+++ b/src/shell/shell.error.xml
@@ -127,4 +127,10 @@ If you choose to continue, you may not have access to some of your old data.
   <button _label="_View Certificate" response="GTK_RESPONSE_APPLY"/>
  </error>
 
+ <error id="menubar-hidden" type="info">
+  <_primary>Menu Bar is hidden</_primary>
+  <_secondary>Press the “Alt” key to access the Menu Bar again.</_secondary>
+  <button _label="_Show Menu Bar" response="GTK_RESPONSE_APPLY"/>
+ </error>
+
 </error-list>


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