summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRazvan Chitu <razvan.ch95@gmail.com>2016-03-05 11:57:45 +0200
committerCarlos Soriano <csoriano@gnome.org>2016-03-07 17:41:57 +0100
commit075e9c1f89d6572615e85a67f7f42ad96323c8ff (patch)
treececd3ea0ef049b0164edfa83168dc9c226ed8955
parent1ba5e6206fe0b4bcc40aee5e5432741b0ba08ce1 (diff)
downloadnautilus-075e9c1f89d6572615e85a67f7f42ad96323c8ff.tar.gz
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
-rw-r--r--src/nautilus-progress-persistence-handler.c14
-rw-r--r--src/nautilus-window.c14
2 files changed, 14 insertions, 14 deletions
diff --git a/src/nautilus-progress-persistence-handler.c b/src/nautilus-progress-persistence-handler.c
index 10e9fc4d6..e312bc02a 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 ff0682571..134f7ac8b 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);