diff options
author | lukefromdc <[email protected]> | 2016-10-23 20:24:17 -0400 |
---|---|---|
committer | lukefromdc <[email protected]> | 2016-10-23 20:24:17 -0400 |
commit | 6404fa33afc5b4961fea47f8eefd07f5b4ff913a (patch) | |
tree | 4118dfcf3bf3e69d12e49b2fb360178e00ef802e | |
parent | 30b7ce2e63080fca1db9bdf2dd82955ce7ad2cc7 (diff) | |
download | caja-6404fa33afc5b4961fea47f8eefd07f5b4ff913a.tar.bz2 caja-6404fa33afc5b4961fea47f8eefd07f5b4ff913a.tar.xz |
libunique builds: enable eject notifications
We no longer need to use any GtkApplication features for this so enable it in libunique builds too. Tested with and without libunique in GTK 3.22
-rw-r--r-- | libcaja-private/caja-file-operations.c | 14 | ||||
-rw-r--r-- | src/caja-application.c | 7 | ||||
-rw-r--r-- | src/caja-places-sidebar.c | 22 |
3 files changed, 15 insertions, 28 deletions
diff --git a/libcaja-private/caja-file-operations.c b/libcaja-private/caja-file-operations.c index 705a25b9..a1172533 100644 --- a/libcaja-private/caja-file-operations.c +++ b/libcaja-private/caja-file-operations.c @@ -55,9 +55,7 @@ #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" @@ -195,7 +193,7 @@ typedef struct { #define COPY_FORCE _("Copy _Anyway") NotifyNotification *unmount_notify; -#if ENABLE_LIBUNIQUE == (FALSE) + void caja_application_notify_unmount_show (const gchar *message) { @@ -220,7 +218,7 @@ caja_application_notify_unmount_show (const gchar *message) notify_notification_show (unmount_notify, NULL); g_strfreev (strings); } -#endif + static void mark_desktop_file_trusted (CommonJob *common, GCancellable *cancellable, @@ -2099,9 +2097,9 @@ unmount_mount_callback (GObject *source_object, if (error != NULL) { g_error_free (error); } -#if ENABLE_LIBUNIQUE == (FALSE) + 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); g_free (data); @@ -2120,9 +2118,9 @@ do_unmount (UnmountData *data) NULL, unmount_mount_callback, data); -#if ENABLE_LIBUNIQUE == (FALSE) + caja_application_notify_unmount_show ("writing data to the drive-do not unplug"); -#endif + } else { g_mount_unmount_with_operation (data->mount, 0, diff --git a/src/caja-application.c b/src/caja-application.c index dff984f3..9bd3ef74 100644 --- a/src/caja-application.c +++ b/src/caja-application.c @@ -70,6 +70,7 @@ #include <eel/eel-stock-dialogs.h> #include <gdk/gdkx.h> #include <gtk/gtk.h> +#include <libnotify/notify.h> #include <libcaja-private/caja-debug-log.h> #include <libcaja-private/caja-file-utilities.h> #include <libcaja-private/caja-global-preferences.h> @@ -90,7 +91,6 @@ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <libnotify/notify.h> #else enum { COMMAND_0, /* unused: 0 is an invalid command */ @@ -1459,6 +1459,9 @@ caja_application_startup (CajaApplication *application, /* Load session info if availible */ caja_application_load_session (application); + /* Initialize notifications for eject operations */ + notify_init (GETTEXT_PACKAGE); + /* load accelerator map, and register save callback */ accel_map_filename = caja_get_accel_map_file (); if (accel_map_filename) @@ -3207,7 +3210,7 @@ caja_application_startup (GApplication *app) /* attach menu-provider module callback */ menu_provider_init_callback (); - /* Initialize the UI handler singleton for file operations */ + /* Initialize notifications for eject operations */ notify_init (GETTEXT_PACKAGE); /* Watch for unmounts so we can close open windows */ diff --git a/src/caja-places-sidebar.c b/src/caja-places-sidebar.c index 9b67e64d..b406032e 100644 --- a/src/caja-places-sidebar.c +++ b/src/caja-places-sidebar.c @@ -38,9 +38,6 @@ #include <gdk/gdkkeysyms.h> #include <gtk/gtk.h> #include <glib/gi18n.h> -#if ENABLE_LIBUNIQUE == (FALSE) -#include <caja-application.h> -#endif #include <libcaja-private/caja-debug-log.h> #include <libcaja-private/caja-dnd.h> #include <libcaja-private/caja-bookmark.h> @@ -56,13 +53,11 @@ #include <libcaja-private/caja-window-info.h> #include <libcaja-private/caja-window-slot-info.h> #include <gio/gio.h> +#include <libnotify/notify.h> #include "caja-bookmark-list.h" #include "caja-places-sidebar.h" #include "caja-window.h" -#if ENABLE_LIBUNIQUE == (FALSE) -#include <libnotify/notify.h> -#endif #define EJECT_BUTTON_XPAD 6 #define ICON_CELL_XPAD 6 @@ -2246,12 +2241,9 @@ drive_eject_cb (GObject *source_object, } g_error_free (error); } -#if ENABLE_LIBUNIQUE == (FALSE) else { - CajaApplication *app = CAJA_APPLICATION (g_application_get_default ()); caja_application_notify_unmount_show ("It is now safe to remove the drive"); } -#endif } static void @@ -2283,12 +2275,10 @@ volume_eject_cb (GObject *source_object, } g_error_free (error); } -#if ENABLE_LIBUNIQUE == (FALSE) + else { - CajaApplication *app = CAJA_APPLICATION (g_application_get_default ()); caja_application_notify_unmount_show ("It is now safe to remove the drive"); } -#endif } static void @@ -2320,12 +2310,10 @@ mount_eject_cb (GObject *source_object, } g_error_free (error); } -#if ENABLE_LIBUNIQUE == (FALSE) + else { - CajaApplication *app = CAJA_APPLICATION (g_application_get_default ()); caja_application_notify_unmount_show ("It is now safe to remove the drive"); } -#endif } static void @@ -2357,10 +2345,8 @@ do_eject (GMount *mount, g_drive_eject_with_operation (drive, 0, mount_op, NULL, drive_eject_cb, g_object_ref (sidebar->window)); } -#if ENABLE_LIBUNIQUE == (FALSE) - CajaApplication *app = CAJA_APPLICATION (g_application_get_default ()); + caja_application_notify_unmount_show ("writing data to the drive-do not unplug"); -#endif g_object_unref (mount_op); } |