Skip to content

Commit 30b7ce2

Browse files
committedOct 23, 2016
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
1 parent edb2cc8 commit 30b7ce2

File tree

4 files changed

+8
-35
lines changed

4 files changed

+8
-35
lines changed
 

‎libcaja-private/caja-file-operations.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ typedef struct {
197197
NotifyNotification *unmount_notify;
198198
#if ENABLE_LIBUNIQUE == (FALSE)
199199
void
200-
caja_application_notification_unmount_show (const gchar *message)
200+
caja_application_notify_unmount_show (const gchar *message)
201201
{
202202
gchar **strings;
203203
strings = g_strsplit (message, "\n", 0);
@@ -2100,7 +2100,7 @@ unmount_mount_callback (GObject *source_object,
21002100
g_error_free (error);
21012101
}
21022102
#if ENABLE_LIBUNIQUE == (FALSE)
2103-
caja_application_notification_unmount_show ("It is now safe to remove the drive");
2103+
caja_application_notify_unmount_show ("It is now safe to remove the drive");
21042104
#endif
21052105
eel_remove_weak_pointer (&data->parent_window);
21062106
g_object_unref (data->mount);
@@ -2121,7 +2121,7 @@ do_unmount (UnmountData *data)
21212121
unmount_mount_callback,
21222122
data);
21232123
#if ENABLE_LIBUNIQUE == (FALSE)
2124-
caja_application_notification_unmount_show ("writing data to the drive-do not unplug");
2124+
caja_application_notify_unmount_show ("writing data to the drive-do not unplug");
21252125
#endif
21262126
} else {
21272127
g_mount_unmount_with_operation (data->mount,

‎libcaja-private/caja-file-operations.h

+1
Original file line numberDiff line numberDiff line change
@@ -138,5 +138,6 @@ void caja_file_mark_desktop_file_trusted (GFile *file,
138138
CajaOpCallback done_callback,
139139
gpointer done_callback_data);
140140

141+
void caja_application_notify_unmount_show (const gchar *message);
141142

142143
#endif /* CAJA_FILE_OPERATIONS_H */

‎src/caja-application.c

-28
Original file line numberDiff line numberDiff line change
@@ -159,36 +159,8 @@ struct _CajaApplicationPriv {
159159
gboolean force_desktop;
160160
gboolean autostart;
161161
gchar *geometry;
162-
NotifyNotification *unmount_notify;
163162
};
164163

165-
void
166-
caja_application_notify_unmount_show (CajaApplication *application,
167-
const gchar *message)
168-
{
169-
gchar **strings;
170-
171-
strings = g_strsplit (message, "\n", 0);
172-
173-
if (application->priv->unmount_notify == NULL) {
174-
application->priv->unmount_notify =
175-
notify_notification_new (strings[0], strings[1],
176-
"media-removable");
177-
178-
notify_notification_set_hint (application->priv->unmount_notify,
179-
"transient", g_variant_new_boolean (TRUE));
180-
notify_notification_set_urgency (application->priv->unmount_notify,
181-
NOTIFY_URGENCY_CRITICAL);
182-
} else {
183-
notify_notification_update (application->priv->unmount_notify,
184-
strings[0], strings[1],
185-
"media-removable");
186-
}
187-
188-
notify_notification_show (application->priv->unmount_notify, NULL);
189-
g_strfreev (strings);
190-
}
191-
192164
#else
193165
G_DEFINE_TYPE (CajaApplication, caja_application, G_TYPE_OBJECT);
194166

‎src/caja-places-sidebar.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -2249,7 +2249,7 @@ drive_eject_cb (GObject *source_object,
22492249
#if ENABLE_LIBUNIQUE == (FALSE)
22502250
else {
22512251
CajaApplication *app = CAJA_APPLICATION (g_application_get_default ());
2252-
caja_application_notify_unmount_show (app, "It is now safe to remove the drive");
2252+
caja_application_notify_unmount_show ("It is now safe to remove the drive");
22532253
}
22542254
#endif
22552255
}
@@ -2286,7 +2286,7 @@ volume_eject_cb (GObject *source_object,
22862286
#if ENABLE_LIBUNIQUE == (FALSE)
22872287
else {
22882288
CajaApplication *app = CAJA_APPLICATION (g_application_get_default ());
2289-
caja_application_notify_unmount_show (app, "It is now safe to remove the drive");
2289+
caja_application_notify_unmount_show ("It is now safe to remove the drive");
22902290
}
22912291
#endif
22922292
}
@@ -2323,7 +2323,7 @@ mount_eject_cb (GObject *source_object,
23232323
#if ENABLE_LIBUNIQUE == (FALSE)
23242324
else {
23252325
CajaApplication *app = CAJA_APPLICATION (g_application_get_default ());
2326-
caja_application_notify_unmount_show (app, "It is now safe to remove the drive");
2326+
caja_application_notify_unmount_show ("It is now safe to remove the drive");
23272327
}
23282328
#endif
23292329
}
@@ -2359,7 +2359,7 @@ do_eject (GMount *mount,
23592359
}
23602360
#if ENABLE_LIBUNIQUE == (FALSE)
23612361
CajaApplication *app = CAJA_APPLICATION (g_application_get_default ());
2362-
caja_application_notify_unmount_show (app, "writing data to the drive-do not unplug");
2362+
caja_application_notify_unmount_show ("writing data to the drive-do not unplug");
23632363
#endif
23642364
g_object_unref (mount_op);
23652365
}

0 commit comments

Comments
 (0)