diff options
author | John Stebbins <[email protected]> | 2018-06-19 14:57:59 -0700 |
---|---|---|
committer | John Stebbins <[email protected]> | 2018-06-19 14:57:59 -0700 |
commit | 5eccfd54308b64bf9d5bce57bd0c982c4aee4795 (patch) | |
tree | 3936c786fc8959681532d59d3786abc46b6ea295 /gtk/src | |
parent | d309b632bd7083d2c2d21463bc50f29fd33c3ab5 (diff) |
LinGui: use GNotification instead of libnotify
Diffstat (limited to 'gtk/src')
-rw-r--r-- | gtk/src/callbacks.c | 40 | ||||
-rw-r--r-- | gtk/src/main.c | 10 |
2 files changed, 13 insertions, 37 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c index a1091c0cd..3032da463 100644 --- a/gtk/src/callbacks.c +++ b/gtk/src/callbacks.c @@ -58,7 +58,6 @@ #endif #endif -#include <libnotify/notify.h> #ifndef NOTIFY_CHECK_VERSION #define NOTIFY_CHECK_VERSION(x,y,z) 0 #endif @@ -5753,14 +5752,6 @@ free_resources: return NULL; } -#if !defined(_WIN32) -G_MODULE_EXPORT void -notify_closed_cb(NotifyNotification *notification, signal_user_data_t *ud) -{ - g_object_unref(G_OBJECT(notification)); -} -#endif - void ghb_notify_done(signal_user_data_t *ud) { @@ -5768,25 +5759,18 @@ ghb_notify_done(signal_user_data_t *ud) if (ghb_settings_combo_int(ud->prefs, "WhenComplete") == 0) return; -#if !defined(_WIN32) - NotifyNotification *notification; - notification = notify_notification_new( - _("Encode Complete"), - _("Put down that cocktail, Your HandBrake queue is done!"), - NULL -#if NOTIFY_CHECK_VERSION (0, 7, 0) - ); -#else - ,NULL); -#endif - GtkIconTheme *theme = gtk_icon_theme_get_default(); - GdkPixbuf *pb = gtk_icon_theme_load_icon(theme, "hb-icon", 32, - GTK_ICON_LOOKUP_USE_BUILTIN, NULL); - notify_notification_set_icon_from_pixbuf(notification, pb); - g_signal_connect(notification, "closed", (GCallback)notify_closed_cb, ud); - notify_notification_show(notification, NULL); - g_object_unref(G_OBJECT(pb)); -#endif + GNotification * notification; + GIcon * icon; + + notification = g_notification_new(_("Encode Complete")); + g_notification_set_body(notification, + _("Put down that cocktail, Your HandBrake queue is done!")); + icon = g_themed_icon_new("hb-icon"); + g_notification_set_icon(notification, icon); + g_notification_set_priority(notification, G_NOTIFICATION_PRIORITY_URGENT); + + g_application_send_notification(G_APPLICATION(ud->app), "cocktail", notification); + g_object_unref(G_OBJECT(notification)); if (ghb_settings_combo_int(ud->prefs, "WhenComplete") == 3) { diff --git a/gtk/src/main.c b/gtk/src/main.c index ddf44fc2e..c0abea34b 100644 --- a/gtk/src/main.c +++ b/gtk/src/main.c @@ -38,9 +38,7 @@ #include <gst/gst.h> #endif -#if !defined(_WIN32) -#include <libnotify/notify.h> -#else +#if defined(_WIN32) #include <windows.h> #include <io.h> #define pipe(phandles) _pipe (phandles, 4096, _O_BINARY) @@ -981,9 +979,6 @@ ghb_activate_cb(GApplication * app, signal_user_data_t * ud) GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); g_object_unref(provider); -#if !defined(_WIN32) - notify_init("HandBrake"); -#endif ghb_resource_init(); ghb_load_icons(); @@ -1359,9 +1354,6 @@ main(int argc, char *argv[]) g_io_channel_unref(ud->activity_log); ghb_settings_close(); ghb_resource_free(); -#if !defined(_WIN32) - notify_uninit(); -#endif if (ud->builder != NULL) g_object_unref(ud->builder); |