diff options
author | Pablo Barciela <[email protected]> | 2018-12-17 16:34:37 +0100 |
---|---|---|
committer | ZenWalker <[email protected]> | 2018-12-27 12:35:47 +0100 |
commit | 08f479a8540b60dccef47a2d30cb83deba54bdcd (patch) | |
tree | af58ec28c9d835a491d281cca8c1c6d039ce8e52 | |
parent | d054f1458405b6dfa2ceccfb342eb2a28e742158 (diff) | |
download | caja-08f479a8540b60dccef47a2d30cb83deba54bdcd.tar.bz2 caja-08f479a8540b60dccef47a2d30cb83deba54bdcd.tar.xz |
caja-progress-info: show notifications with the gsettings key:
org.mate.caja.preferences.show-notifications
Closes https://github.com/mate-desktop/caja/issues/1093
-rw-r--r-- | libcaja-private/caja-progress-info.c | 28 | ||||
-rw-r--r-- | libcaja-private/org.mate.caja.gschema.xml | 2 |
2 files changed, 22 insertions, 8 deletions
diff --git a/libcaja-private/caja-progress-info.c b/libcaja-private/caja-progress-info.c index 33f592a6..a0e2fd7e 100644 --- a/libcaja-private/caja-progress-info.c +++ b/libcaja-private/caja-progress-info.c @@ -28,6 +28,7 @@ #include <gtk/gtk.h> #include <eel/eel-glib-extensions.h> #include "caja-progress-info.h" +#include "caja-global-preferences.h" #include <string.h> enum @@ -599,9 +600,12 @@ update_status_icon_and_window (void) GNotification *notification; static gboolean window_shown = FALSE; - notification = g_notification_new ("caja"); - icon = g_themed_icon_new ("system-file-manager"); - g_notification_set_icon (notification, icon); + if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_SHOW_NOTIFICATIONS)) + { + notification = g_notification_new ("caja"); + icon = g_themed_icon_new ("system-file-manager"); + g_notification_set_icon (notification, icon); + } tooltip = g_strdup_printf (ngettext ("%'d file operation active", "%'d file operations active", @@ -620,8 +624,13 @@ update_status_icon_and_window (void) if (window_shown) { gtk_widget_hide (get_progress_window ()); - g_notification_set_body (notification, _("Process completed")); - g_application_send_notification (g_application_get_default (), "caja", notification); + + if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_SHOW_NOTIFICATIONS)) + { + g_notification_set_body (notification, _("Process completed")); + g_application_send_notification (g_application_get_default (), "caja", notification); + } + window_shown = FALSE; } } @@ -630,8 +639,13 @@ update_status_icon_and_window (void) gtk_widget_show_all (get_progress_window ()); gtk_status_icon_set_visible (status_icon, TRUE); gtk_window_present (GTK_WINDOW (get_progress_window ())); - g_notification_set_body (notification, _("Working...")); - g_application_send_notification (g_application_get_default (), "caja", notification); + + if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_SHOW_NOTIFICATIONS)) + { + g_notification_set_body (notification, _("Working...")); + g_application_send_notification (g_application_get_default (), "caja", notification); + } + window_shown = TRUE; } } diff --git a/libcaja-private/org.mate.caja.gschema.xml b/libcaja-private/org.mate.caja.gschema.xml index a0108880..8555d5f7 100644 --- a/libcaja-private/org.mate.caja.gschema.xml +++ b/libcaja-private/org.mate.caja.gschema.xml @@ -256,7 +256,7 @@ <key name="show-notifications" type="b"> <default>true</default> <summary>Whether to show desktop notifications</summary> - <description>If set to true, Caja will show desktop notifications for eject events</description> + <description>If set to true, Caja will show desktop notifications.</description> </key> </schema> |