From 9a3724362918fdbeb535ffbb64e25cf5bcd10d57 Mon Sep 17 00:00:00 2001 From: Alexander Schwinn Date: Tue, 13 Aug 2019 23:47:52 +0200 Subject: [PATCH] Easy to hide the menubar, tricky to get it back if the shortcut key is not known (Bug #13868) --- thunar/thunar-notify.c | 33 +++++++++++++++++++++++++++++++++ thunar/thunar-notify.h | 1 + thunar/thunar-window.c | 4 ++++ 3 files changed, 38 insertions(+) diff --git a/thunar/thunar-notify.c b/thunar/thunar-notify.c index 17e653c1..a4e3ce49 100644 --- a/thunar/thunar-notify.c +++ b/thunar/thunar-notify.c @@ -258,3 +258,36 @@ thunar_notify_uninit (void) notify_uninit (); #endif } + + + +void +thunar_notify_menu_hidden (const gchar *shortcut) +{ + NotifyNotification *notification; + gchar *icon_name = NULL; + const gchar *summary; + gchar *message; + + if (!thunar_notify_init ()) + return; + + icon_name = g_strdup ("gtk-dialog-warning"); + summary = _("The thunar menu bar is now hidden"); + message = g_strdup_printf (_("Press \"%s\" to show the menu bar"), shortcut); + + /* create notification */ +#ifdef NOTIFY_CHECK_VERSION +#if NOTIFY_CHECK_VERSION (0, 7, 0) + notification = notify_notification_new (summary, message, icon_name); +#else + notification = notify_notification_new (summary, message, icon_name, NULL); +#endif +#else + notification = notify_notification_new (summary, message, icon_name, NULL); +#endif + + notify_notification_show (notification, NULL); + g_free (icon_name); + g_free (message); +} diff --git a/thunar/thunar-notify.h b/thunar/thunar-notify.h index af17c87b..2909c324 100644 --- a/thunar/thunar-notify.h +++ b/thunar/thunar-notify.h @@ -34,6 +34,7 @@ void thunar_notify_finish (ThunarDevice *device); void thunar_notify_uninit (void); +void thunar_notify_menu_hidden (const gchar *shortcut); G_END_DECLS #endif /* !__THUNAR_NOTIFY_H__ */ diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c index ceaa8b4e..cdc7d374 100644 --- a/thunar/thunar-window.c +++ b/thunar/thunar-window.c @@ -61,6 +61,7 @@ #include #include #include +#include #include @@ -2845,6 +2846,9 @@ G_GNUC_END_IGNORE_DEPRECATIONS /* remember the setting */ if (gtk_widget_get_visible (GTK_WIDGET (window))) g_object_set (G_OBJECT (window->preferences), "last-menubar-visible", active, NULL); + + if(!active) + thunar_notify_menu_hidden("Ctrl+M"); } -- 2.20.1