Bug 4680 - Trayicon not updated
Summary: Trayicon not updated
Status: NEW
Alias: None
Product: Claws Mail (GTK 2)
Classification: Unclassified
Component: Plugins/Notification (show other bugs)
Version: 3.19.1
Hardware: Other Linux
: P3 normal
Assignee: users
URL:
Depends on:
Blocks:
 
Reported: 2023-06-11 05:15 UTC by Steven
Modified: 2023-06-11 05:16 UTC (History)
0 users

See Also:


Attachments

Description Steven 2023-06-11 05:15:26 UTC
With gtk2 under buster (was okay with stretch) the trayicon is not updated after the initial load at BOJ.  This appears to be a gtk bug rather than a claws bug.  It is possible to overcome this bug by toggling the "visible" attribute after changing the pixbuf for the icon.

diff --git a/src/plugins/notification/notification_trayicon.c b/src/plugins/notification/notification_trayicon.c
index c35781f77..6dcb59f98 100644
--- a/src/plugins/notification/notification_trayicon.c
+++ b/src/plugins/notification/notification_trayicon.c
@@ -278,6 +278,7 @@ void notification_update_trayicon()
                        count.new_msgs, count.unread_msgs,
                        count.total_msgs);
   gtk_status_icon_set_tooltip_text(trayicon, buf);
+  debug_print("Notification plugin: tooltip updated (%s)\n", buf);
 
   g_free(buf);
 
@@ -300,11 +301,23 @@ void notification_update_trayicon()
     new_icon =
       notification_pixbuf_get(NOTIFICATION_TRAYICON_NOMAIL+offset);
 
+  debug_print("Notification plugin: icon was %d, now %d\n", old_icon, new_icon);
   if(new_icon != old_icon) {
     gtk_status_icon_set_from_pixbuf(trayicon, new_icon);
+/*
+    gtk2 no longer (post stretch) updates the display when the icon is changed.
+    So we hide and then display the icon to update the display.
+    There doesn't seem to be a "refresh" function that would do this less clumsily.
+*/
+    gtk_status_icon_set_visible(trayicon, FALSE);
+    gtk_status_icon_set_visible(trayicon, TRUE);
+
+    debug_print("Notification plugin: icon updated\n");
     old_icon = new_icon;
   }
-}
+  else
+    debug_print("Notification plugin: icon already correct\n");
+  }

Note You need to log in before you can comment on or make changes to this bug.