From a797afc41638ca9dedd432eee2f2c53e00411926 Mon Sep 17 00:00:00 2001 From: Pablo Barciela Date: Thu, 7 Jun 2018 14:05:28 +0200 Subject: caja-progress-info.c: show notifications in begin/end of progress --- libcaja-private/caja-progress-info.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'libcaja-private/caja-progress-info.c') diff --git a/libcaja-private/caja-progress-info.c b/libcaja-private/caja-progress-info.c index 0c4720a9..33f592a6 100644 --- a/libcaja-private/caja-progress-info.c +++ b/libcaja-private/caja-progress-info.c @@ -595,7 +595,13 @@ update_status_icon_and_window (void) { char *tooltip; gboolean toshow; - static gboolean window_shown = TRUE; + GIcon *icon; + 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); tooltip = g_strdup_printf (ngettext ("%'d file operation active", "%'d file operations active", @@ -607,17 +613,25 @@ update_status_icon_and_window (void) toshow = (n_progress_ops > 0); - if (!toshow && window_shown) + if (!toshow) { gtk_status_icon_set_visible (status_icon, FALSE); - gtk_widget_hide (get_progress_window ()); - window_shown = FALSE; + + 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); + window_shown = FALSE; + } } else if (toshow && !window_shown) { 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); window_shown = TRUE; } } -- cgit v1.2.1