changeset 2117:37060de79102

GTK: Versions of Glib prior to May 2019 don't support GFileIcon for notifications. Also fix a GVariant warning in g_simple_action_new().
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 23 Jun 2020 09:37:37 +0000
parents cdc5124b6525
children c3f088266bcd
files gtk/dw.c gtk3/dw.c
diffstat 2 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/gtk/dw.c	Tue Jun 23 08:39:44 2020 +0000
+++ b/gtk/dw.c	Tue Jun 23 09:37:37 2020 +0000
@@ -2141,7 +2141,7 @@
    {
 #if GLIB_CHECK_VERSION(2,40,0)
       /* Creat our notification handler for any notifications */
-      GSimpleAction *action = g_simple_action_new("notification", "t");
+      GSimpleAction *action = g_simple_action_new("notification", G_VARIANT_TYPE_UINT64);
       
       g_signal_connect(G_OBJECT(action), "activate", G_CALLBACK(_dw_notification_handler), NULL);
       g_action_map_add_action(G_ACTION_MAP(_DWApp), G_ACTION(action));
@@ -12389,10 +12389,11 @@
       if(imagepath && access(imagepath, 04 ) != 0)
       {
          GFile *file = g_file_new_for_path(imagepath);
+         GBytes *bytes = g_file_load_bytes(file, NULL, NULL, NULL);
          
-         if(file)
-         {
-            GIcon *icon = g_file_icon_new(file);
+         if(bytes)
+         {
+            GIcon *icon = g_bytes_icon_new(bytes);
             
             if(icon)
                g_notification_set_icon(notification, G_ICON(icon));
--- a/gtk3/dw.c	Tue Jun 23 08:39:44 2020 +0000
+++ b/gtk3/dw.c	Tue Jun 23 09:37:37 2020 +0000
@@ -2069,7 +2069,7 @@
    {
 #if GLIB_CHECK_VERSION(2,40,0)
       /* Creat our notification handler for any notifications */
-      GSimpleAction *action = g_simple_action_new("notification", "t");
+      GSimpleAction *action = g_simple_action_new("notification", G_VARIANT_TYPE_UINT64);
       
       g_signal_connect(G_OBJECT(action), "activate", G_CALLBACK(_dw_notification_handler), NULL);
       g_action_map_add_action(G_ACTION_MAP(_DWApp), G_ACTION(action));
@@ -11094,10 +11094,11 @@
       if(imagepath && access(imagepath, 04 ) != 0)
       {
          GFile *file = g_file_new_for_path(imagepath);
+         GBytes *bytes = g_file_load_bytes(file, NULL, NULL, NULL);
          
-         if(file)
-         {
-            GIcon *icon = g_file_icon_new(file);
+         if(bytes)
+         {
+            GIcon *icon = g_bytes_icon_new(bytes);
             
             if(icon)
                g_notification_set_icon(notification, G_ICON(icon));