[nautilus] window, progress-persistence-handler: change notifications API



commit ab566a53d9290e2b110ff4448426f6368d57426b
Author: Razvan Chitu <razvan ch95 gmail com>
Date:   Sat Mar 5 11:57:45 2016 +0200

    window, progress-persistence-handler: change notifications API
    
    In Nautilus, notifications are sent using GApplication functions and are not
    tracked. This leads to notifications that are not being cleared when Nautilus is
    closed. In order to fix this, sending and withdrawing notifications should be
    done with the methods of NautilusApplication. These methods automatically track
    and clear them when the application is shutdown.
    
    Replace GApplication functions for sending and withdrawing notifications with
    corresponding NautilusApplication functions.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=763129

 src/nautilus-progress-persistence-handler.c |   14 +++++++-------
 src/nautilus-window.c                       |   14 +++++++-------
 2 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/src/nautilus-progress-persistence-handler.c b/src/nautilus-progress-persistence-handler.c
index 10e9fc4..e312bc0 100644
--- a/src/nautilus-progress-persistence-handler.c
+++ b/src/nautilus-progress-persistence-handler.c
@@ -138,8 +138,8 @@ progress_persistence_handler_update_notification (NautilusProgressPersistenceHan
                                self->priv->active_infos);
         g_notification_set_body (notification, body);
 
-        g_application_send_notification (g_application_get_default (),
-                                         "progress", notification);
+        nautilus_application_send_notification (self->priv->app,
+                                                "progress", notification);
 
         g_object_unref (notification);
        g_free (body);
@@ -201,9 +201,9 @@ progress_persistence_handler_show_complete_notification (NautilusProgressPersist
        complete_notification = g_notification_new (_("File Operations"));
         g_notification_set_body (complete_notification,
                                  _("All file operations have been successfully completed"));
-       g_application_send_notification (g_application_get_default (),
-                                         "transfer-complete",
-                                         complete_notification);
+        nautilus_application_send_notification (self->priv->app,
+                                                "transfer-complete",
+                                                complete_notification);
 
        g_object_unref (complete_notification);
 }
@@ -215,8 +215,8 @@ progress_persistence_handler_hide_notification_or_status (NautilusProgressPersis
                gtk_status_icon_set_visible (self->priv->status_icon, FALSE);
        }
 
-        g_application_withdraw_notification (g_application_get_default (),
-                                             "progress");
+        nautilus_application_withdraw_notification (self->priv->app,
+                                                    "progress");
 }
 
 static void
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index ff06825..134f7ac 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -939,12 +939,12 @@ static void
 notify_unmount_done (GMountOperation *op,
                      const gchar     *message)
 {
-  GApplication *application;
+  NautilusApplication *application;
   gchar *notification_id;
 
-  application = g_application_get_default ();
+  application = nautilus_application_get_default ();
   notification_id = g_strdup_printf ("nautilus-mount-operation-%p", op);
-  g_application_withdraw_notification (application, notification_id);
+  nautilus_application_withdraw_notification (application, notification_id);
 
   if (message != NULL)
     {
@@ -958,7 +958,7 @@ notify_unmount_done (GMountOperation *op,
       g_notification_set_body (unplug, strings[1]);
       g_notification_set_icon (unplug, icon);
 
-      g_application_send_notification (application, notification_id, unplug);
+      nautilus_application_send_notification (application, notification_id, unplug);
       g_object_unref (unplug);
       g_object_unref (icon);
       g_strfreev (strings);
@@ -971,13 +971,13 @@ static void
 notify_unmount_show (GMountOperation *op,
                      const gchar     *message)
 {
-  GApplication *application;
+  NautilusApplication *application;
   GNotification *unmount;
   gchar *notification_id;
   GIcon *icon;
   gchar **strings;
 
-  application = g_application_get_default ();
+  application = nautilus_application_get_default ();
   strings = g_strsplit (message, "\n", 0);
   icon = g_themed_icon_new ("media-removable");
 
@@ -987,7 +987,7 @@ notify_unmount_show (GMountOperation *op,
   g_notification_set_priority (unmount, G_NOTIFICATION_PRIORITY_URGENT);
 
   notification_id = g_strdup_printf ("nautilus-mount-operation-%p", op);
-  g_application_send_notification (application, notification_id, unmount);
+  nautilus_application_send_notification (application, notification_id, unmount);
   g_object_unref (unmount);
   g_object_unref (icon);
   g_strfreev (strings);


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