]> granicus.if.org Git - handbrake/commitdiff
LinGui: use GNotification instead of libnotify
authorJohn Stebbins <jstebbins.hb@gmail.com>
Tue, 19 Jun 2018 21:57:59 +0000 (14:57 -0700)
committerJohn Stebbins <jstebbins.hb@gmail.com>
Tue, 19 Jun 2018 21:57:59 +0000 (14:57 -0700)
gtk/configure.ac
gtk/src/callbacks.c
gtk/src/main.c

index 54a63d488f31220bf54a5f0cd616a44b470b5a72..c9523bb28aaebee171631c97780ffa62103e281e 100644 (file)
@@ -113,7 +113,7 @@ case $host in
        linux*)
          ;;
     esac
-    GHB_PACKAGES="gthread-2.0 gio-2.0 libnotify gmodule-2.0"
+    GHB_PACKAGES="gthread-2.0 gio-2.0 gmodule-2.0"
        mingw_flag=no
     ;;
 esac
index a1091c0cd096ded74190b5b176a6e3b1a7d33410..3032da46333558f8b55d8afb48f8bf733352661d 100644 (file)
@@ -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)
     {
index ddf44fc2e08512891993ec4c01dbaf5687d8d37c..c0abea34b34174678b0823fcda07c6c6c1db5060 100644 (file)
@@ -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);