about summary refs log tree commit diff stats
path: root/src/tray.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tray.c')
-rw-r--r--src/tray.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/tray.c b/src/tray.c
index ff9593c3..dfe2831e 100644
--- a/src/tray.c
+++ b/src/tray.c
@@ -131,9 +131,22 @@ _tray_change_icon(gpointer data)
     unread_messages = wins_get_total_unread();
 
     if (unread_messages) {
-        gtk_status_icon_set_from_file(prof_tray, icon_msg_filename->str);
+        if (!prof_tray) {
+            prof_tray = gtk_status_icon_new_from_file(icon_msg_filename->str);
+        } else {
+            gtk_status_icon_set_from_file(prof_tray, icon_msg_filename->str);
+        }
     } else {
-        gtk_status_icon_set_from_file(prof_tray, icon_filename->str);
+        if (prefs_get_boolean(PREF_TRAY_READ)) {
+            if (!prof_tray) {
+                prof_tray = gtk_status_icon_new_from_file(icon_filename->str);
+            } else {
+                gtk_status_icon_set_from_file(prof_tray, icon_filename->str);
+            }
+        } else {
+            g_clear_object(&prof_tray);
+            prof_tray = NULL;
+        }
     }
 
     return TRUE;