diff --git a/thunar/thunar-notify.c b/thunar/thunar-notify.c index 0f4f832f..748c421c 100644 --- a/thunar/thunar-notify.c +++ b/thunar/thunar-notify.c @@ -231,6 +231,10 @@ void thunar_notify_finish (ThunarDevice *device) { #ifdef HAVE_LIBNOTIFY + const gchar *summary; + gchar *message; + gchar *icon_name = NULL; + NotifyNotification *notification; _thunar_return_if_fail (THUNAR_IS_DEVICE (device)); @@ -238,9 +242,36 @@ thunar_notify_finish (ThunarDevice *device) notification = g_object_get_data (G_OBJECT (device), I_("thunar-notification")); if (notification != NULL) { + /* close previous notification */ notify_notification_close (notification, NULL); - g_object_set_data (G_OBJECT (device), I_("thunar-notification"), NULL); - } + g_object_set_data (G_OBJECT (device), I_("thunar-notification"), NULL); + } + + /* display safe notification */ + summary = _("Device Removed"); + message = g_strdup_printf (_("The device has been safely removed.")); + icon_name = g_strdup ("drive-removable-media"); + + /* create notification */ +#ifdef NOTIFY_CHECK_VERSION +#if NOTIFY_CHECK_VERSION (0, 7, 0) + notification = notify_notification_new (summary, message, icon_name); +#else + notification = notify_notification_new (summary, message, icon_name, NULL); +#endif +#else + notification = notify_notification_new (summary, message, icon_name, NULL); +#endif + notify_notification_set_urgency (notification, NOTIFY_URGENCY_NORMAL); + notify_notification_set_timeout (notification, NOTIFY_EXPIRES_DEFAULT); + notify_notification_show (notification, NULL); + + /* attach to object for finalize */ + g_object_set_data_full (G_OBJECT (device), I_("thunar-notification"), + notification, g_object_unref); + + g_free (message); + g_free (icon_name); #endif }