changeset 2115:79e5842fb609

GTK: Fixes for building with GTK after the notification image changes.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 23 Jun 2020 08:13:24 +0000
parents 251d050d306b
children cdc5124b6525
files dwtest.c gtk/dw.c gtk3/dw.c
diffstat 3 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/dwtest.c	Tue Jun 23 07:48:29 2020 +0000
+++ b/dwtest.c	Tue Jun 23 08:13:24 2020 +0000
@@ -599,7 +599,7 @@
     tmp = dw_file_browse("Pick a file", "dwtest.c", "c", DW_FILE_OPEN );
     if ( tmp )
     {
-        HWND notification = dw_notification_new("New file loaded", "image\\test.png", "dwtest loaded \"%s\" into the file browser on the Render tab, with \"File Display\" selected from the drop down list.", tmp);
+        HWND notification = dw_notification_new("New file loaded", "image/test.png", "dwtest loaded \"%s\" into the file browser on the Render tab, with \"File Display\" selected from the drop down list.", tmp);
 
         if ( current_file )
         {
--- a/gtk/dw.c	Tue Jun 23 07:48:29 2020 +0000
+++ b/gtk/dw.c	Tue Jun 23 08:13:24 2020 +0000
@@ -12367,7 +12367,7 @@
  *          This will create a system notification that will show in the notifaction panel
  *          on supported systems, which may be clicked to perform another task.
  */
-HWND dw_notification_new(const char *title, HPIXMAP pixmap, const char *description, ...)
+HWND dw_notification_new(const char *title, const char *imagepath, const char *description, ...)
 {
 #if GLIB_CHECK_VERSION(2,40,0)
    GNotification *notification = g_notification_new(title);
@@ -12385,13 +12385,14 @@
 
          g_notification_set_body(notification, outbuf);
       }
-      if(imagepath)
+      /* check if we can read from this file (it exists and read permission) */
+      if(imagepath && access(imagepath, 04 ) != 0)
       {
          GFile *file = g_file_new_for_path(imagepath);
          
          if(file)
          {
-            GFileIcon *icon = g_file_icon_new(file);
+            GIcon *icon = g_file_icon_new(file);
             
             if(icon)
                g_notification_set_icon(notification, G_ICON(icon));
--- a/gtk3/dw.c	Tue Jun 23 07:48:29 2020 +0000
+++ b/gtk3/dw.c	Tue Jun 23 08:13:24 2020 +0000
@@ -11090,13 +11090,14 @@
 
          g_notification_set_body(notification, outbuf);
       }
-      if(imagepath)
+      /* check if we can read from this file (it exists and read permission) */
+      if(imagepath && access(imagepath, 04 ) != 0)
       {
          GFile *file = g_file_new_for_path(imagepath);
          
          if(file)
          {
-            GFileIcon *icon = g_file_icon_new(file);
+            GIcon *icon = g_file_icon_new(file);
             
             if(icon)
                g_notification_set_icon(notification, G_ICON(icon));