summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlukefromdc <[email protected]>2016-10-23 18:39:57 -0400
committerlukefromdc <[email protected]>2016-10-23 18:39:57 -0400
commit30b7ce2e63080fca1db9bdf2dd82955ce7ad2cc7 (patch)
tree742ba07c746dc3ecf9a658f331c6036e96f0d1fd
parentedb2cc870fa87cf1c57a61c0af5c578461b20a20 (diff)
downloadcaja-30b7ce2e63080fca1db9bdf2dd82955ce7ad2cc7.tar.bz2
caja-30b7ce2e63080fca1db9bdf2dd82955ce7ad2cc7.tar.xz
Refactor notification code to remove duplicate function
The desktop icon eject code required a function in libcaja-private so we no longer need it in caja-application.c
-rw-r--r--libcaja-private/caja-file-operations.c6
-rw-r--r--libcaja-private/caja-file-operations.h1
-rw-r--r--src/caja-application.c28
-rw-r--r--src/caja-places-sidebar.c8
4 files changed, 8 insertions, 35 deletions
diff --git a/libcaja-private/caja-file-operations.c b/libcaja-private/caja-file-operations.c
index f637274a..705a25b9 100644
--- a/libcaja-private/caja-file-operations.c
+++ b/libcaja-private/caja-file-operations.c
@@ -197,7 +197,7 @@ typedef struct {
NotifyNotification *unmount_notify;
#if ENABLE_LIBUNIQUE == (FALSE)
void
-caja_application_notification_unmount_show (const gchar *message)
+caja_application_notify_unmount_show (const gchar *message)
{
gchar **strings;
strings = g_strsplit (message, "\n", 0);
@@ -2100,7 +2100,7 @@ unmount_mount_callback (GObject *source_object,
g_error_free (error);
}
#if ENABLE_LIBUNIQUE == (FALSE)
- caja_application_notification_unmount_show ("It is now safe to remove the drive");
+ caja_application_notify_unmount_show ("It is now safe to remove the drive");
#endif
eel_remove_weak_pointer (&data->parent_window);
g_object_unref (data->mount);
@@ -2121,7 +2121,7 @@ do_unmount (UnmountData *data)
unmount_mount_callback,
data);
#if ENABLE_LIBUNIQUE == (FALSE)
- caja_application_notification_unmount_show ("writing data to the drive-do not unplug");
+ caja_application_notify_unmount_show ("writing data to the drive-do not unplug");
#endif
} else {
g_mount_unmount_with_operation (data->mount,
diff --git a/libcaja-private/caja-file-operations.h b/libcaja-private/caja-file-operations.h
index d95e275a..95ba3a3e 100644
--- a/libcaja-private/caja-file-operations.h
+++ b/libcaja-private/caja-file-operations.h
@@ -138,5 +138,6 @@ void caja_file_mark_desktop_file_trusted (GFile *file,
CajaOpCallback done_callback,
gpointer done_callback_data);
+void caja_application_notify_unmount_show (const gchar *message);
#endif /* CAJA_FILE_OPERATIONS_H */
diff --git a/src/caja-application.c b/src/caja-application.c
index e1d8a892..dff984f3 100644
--- a/src/caja-application.c
+++ b/src/caja-application.c
@@ -159,36 +159,8 @@ struct _CajaApplicationPriv {
gboolean force_desktop;
gboolean autostart;
gchar *geometry;
- NotifyNotification *unmount_notify;
};
-void
-caja_application_notify_unmount_show (CajaApplication *application,
- const gchar *message)
-{
- gchar **strings;
-
- strings = g_strsplit (message, "\n", 0);
-
- if (application->priv->unmount_notify == NULL) {
- application->priv->unmount_notify =
- notify_notification_new (strings[0], strings[1],
- "media-removable");
-
- notify_notification_set_hint (application->priv->unmount_notify,
- "transient", g_variant_new_boolean (TRUE));
- notify_notification_set_urgency (application->priv->unmount_notify,
- NOTIFY_URGENCY_CRITICAL);
- } else {
- notify_notification_update (application->priv->unmount_notify,
- strings[0], strings[1],
- "media-removable");
- }
-
- notify_notification_show (application->priv->unmount_notify, NULL);
- g_strfreev (strings);
-}
-
#else
G_DEFINE_TYPE (CajaApplication, caja_application, G_TYPE_OBJECT);
diff --git a/src/caja-places-sidebar.c b/src/caja-places-sidebar.c
index ae0434e2..9b67e64d 100644
--- a/src/caja-places-sidebar.c
+++ b/src/caja-places-sidebar.c
@@ -2249,7 +2249,7 @@ drive_eject_cb (GObject *source_object,
#if ENABLE_LIBUNIQUE == (FALSE)
else {
CajaApplication *app = CAJA_APPLICATION (g_application_get_default ());
- caja_application_notify_unmount_show (app, "It is now safe to remove the drive");
+ caja_application_notify_unmount_show ("It is now safe to remove the drive");
}
#endif
}
@@ -2286,7 +2286,7 @@ volume_eject_cb (GObject *source_object,
#if ENABLE_LIBUNIQUE == (FALSE)
else {
CajaApplication *app = CAJA_APPLICATION (g_application_get_default ());
- caja_application_notify_unmount_show (app, "It is now safe to remove the drive");
+ caja_application_notify_unmount_show ("It is now safe to remove the drive");
}
#endif
}
@@ -2323,7 +2323,7 @@ mount_eject_cb (GObject *source_object,
#if ENABLE_LIBUNIQUE == (FALSE)
else {
CajaApplication *app = CAJA_APPLICATION (g_application_get_default ());
- caja_application_notify_unmount_show (app, "It is now safe to remove the drive");
+ caja_application_notify_unmount_show ("It is now safe to remove the drive");
}
#endif
}
@@ -2359,7 +2359,7 @@ do_eject (GMount *mount,
}
#if ENABLE_LIBUNIQUE == (FALSE)
CajaApplication *app = CAJA_APPLICATION (g_application_get_default ());
- caja_application_notify_unmount_show (app, "writing data to the drive-do not unplug");
+ caja_application_notify_unmount_show ("writing data to the drive-do not unplug");
#endif
g_object_unref (mount_op);
}