summaryrefslogtreecommitdiff
path: root/libcaja-private/caja-file-operations.c
diff options
context:
space:
mode:
authorlukefromdc <[email protected]>2016-10-23 02:59:33 -0400
committerlukefromdc <[email protected]>2016-10-23 02:59:33 -0400
commitedb2cc870fa87cf1c57a61c0af5c578461b20a20 (patch)
treeb0a10ce65f41977c1e528debe46c84bd192f8927 /libcaja-private/caja-file-operations.c
parentec529e70c20c4164fe34179fc1956676bd10e665 (diff)
downloadcaja-edb2cc870fa87cf1c57a61c0af5c578461b20a20.tar.bz2
caja-edb2cc870fa87cf1c57a61c0af5c578461b20a20.tar.xz
GtkApplication: show notifications for ejecting from the desktop too
Show desktop notifications for ejecting a drive from the desktop as well.The code in caja-file-operations won't show notifications from the sidebar so that code is still needed too.
Diffstat (limited to 'libcaja-private/caja-file-operations.c')
-rw-r--r--libcaja-private/caja-file-operations.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/libcaja-private/caja-file-operations.c b/libcaja-private/caja-file-operations.c
index 15b0fb14..f637274a 100644
--- a/libcaja-private/caja-file-operations.c
+++ b/libcaja-private/caja-file-operations.c
@@ -55,7 +55,9 @@
#include <gtk/gtk.h>
#include <gio/gio.h>
#include <glib.h>
-
+#if ENABLE_LIBUNIQUE == (FALSE)
+#include <libnotify/notify.h>
+#endif
#include "caja-file-changes-queue.h"
#include "caja-file-private.h"
#include "caja-desktop-icon-file.h"
@@ -192,6 +194,33 @@ typedef struct {
#define MERGE_ALL _("Merge _All")
#define COPY_FORCE _("Copy _Anyway")
+NotifyNotification *unmount_notify;
+#if ENABLE_LIBUNIQUE == (FALSE)
+void
+caja_application_notification_unmount_show (const gchar *message)
+{
+ gchar **strings;
+ strings = g_strsplit (message, "\n", 0);
+
+ if (unmount_notify == NULL) {
+ unmount_notify =
+ notify_notification_new (strings[0], strings[1],
+ "media-removable");
+
+ notify_notification_set_hint (unmount_notify,
+ "transient", g_variant_new_boolean (TRUE));
+ notify_notification_set_urgency (unmount_notify,
+ NOTIFY_URGENCY_CRITICAL);
+ } else {
+ notify_notification_update (unmount_notify,
+ strings[0], strings[1],
+ "media-removable");
+ }
+
+ notify_notification_show (unmount_notify, NULL);
+ g_strfreev (strings);
+}
+#endif
static void
mark_desktop_file_trusted (CommonJob *common,
GCancellable *cancellable,
@@ -2070,7 +2099,9 @@ unmount_mount_callback (GObject *source_object,
if (error != NULL) {
g_error_free (error);
}
-
+#if ENABLE_LIBUNIQUE == (FALSE)
+ caja_application_notification_unmount_show ("It is now safe to remove the drive");
+#endif
eel_remove_weak_pointer (&data->parent_window);
g_object_unref (data->mount);
g_free (data);
@@ -2089,6 +2120,9 @@ do_unmount (UnmountData *data)
NULL,
unmount_mount_callback,
data);
+#if ENABLE_LIBUNIQUE == (FALSE)
+ caja_application_notification_unmount_show ("writing data to the drive-do not unplug");
+#endif
} else {
g_mount_unmount_with_operation (data->mount,
0,