void notification_update_urgency_hint(void) { MainWindow *mainwin; mainwin = mainwindow_get_mainwindow(); if(mainwin) { NotificationMsgCount count; gboolean active; active = FALSE; if(notify_config.urgency_hint_new || notify_config.urgency_hint_unread) { notification_core_get_msg_count(NULL, &count); if(notify_config.urgency_hint_new) active = (active || (count.new_msgs > 0)); if(notify_config.urgency_hint_unread) active = (active || (count.unread_msgs > 0)); } gtk_window_set_urgency_hint(GTK_WINDOW(mainwin->window), active); } }
void notification_update_lcdproc(void) { NotificationMsgCount count; gchar *buf; if(!notify_config.lcdproc_enabled || !sock) return; if(!sock || sock->state == CONN_FAILED) { notification_lcdproc_connect(); return; } notification_core_get_msg_count(NULL, &count); if((count.new_msgs + count.unread_msgs) > 0) { buf = g_strdup_printf("widget_set msg_counts line1 1 2 {%s: %d}",_("New"), count.new_msgs); notification_lcdproc_send(buf); buf = g_strdup_printf("widget_set msg_counts line2 1 3 {%s: %d}",_("Unread"), count.unread_msgs); notification_lcdproc_send(buf); buf = g_strdup_printf("widget_set msg_counts line3 1 4 {%s: %d}",_("Total"), count.total_msgs); notification_lcdproc_send(buf); } else { buf = g_strdup_printf("widget_set msg_counts line1 1 2 {%s}", _("No new messages")); notification_lcdproc_send(buf); buf = g_strdup_printf("widget_set msg_counts line2 1 3 {}"); notification_lcdproc_send(buf); buf = g_strdup_printf("widget_set msg_counts line3 1 4 {}"); notification_lcdproc_send(buf); } g_free(buf); }
void notification_update_trayicon() { gchar *buf; static GdkPixbuf *old_icon = NULL; GdkPixbuf *new_icon; gint offset; NotificationMsgCount count; GSList *list; if(!notify_config.trayicon_enabled) return; if(notify_config.trayicon_folder_specific) { guint id; id = notification_register_folder_specific_list (TRAYICON_SPECIFIC_FOLDER_ID_STR); list = notification_foldercheck_get_list(id); } else list = NULL; notification_core_get_msg_count(list, &count); if(!trayicon) { #ifdef NOTIFICATION_HOTKEYS notification_hotkeys_update_bindings(); #endif old_icon = notification_trayicon_create(); if(!trayicon) { debug_print("Notification plugin: Could not create trayicon\n"); return; } } /* Tooltip */ buf = g_strdup_printf(_("New %d, Unread: %d, Total: %d"), count.new_msgs, count.unread_msgs, count.total_msgs); #if GTK_CHECK_VERSION(2,16,0) gtk_status_icon_set_tooltip_text(trayicon, buf); #else gtk_status_icon_set_tooltip(trayicon, buf); #endif g_free(buf); /* Pixmap */ (prefs_common_get_prefs()->work_offline) ? (offset = 1) : (offset = 0); if((count.new_msgs > 0) && (count.unreadmarked_msgs > 0)) new_icon = notification_pixbuf_get(NOTIFICATION_TRAYICON_NEWMARKEDMAIL+offset); else if(count.new_msgs > 0) new_icon = notification_pixbuf_get(NOTIFICATION_TRAYICON_NEWMAIL+offset); else if(count.unreadmarked_msgs > 0) new_icon = notification_pixbuf_get(NOTIFICATION_TRAYICON_UNREADMARKEDMAIL+offset); else if(count.unread_msgs > 0) new_icon = notification_pixbuf_get(NOTIFICATION_TRAYICON_UNREADMAIL+offset); else new_icon = notification_pixbuf_get(NOTIFICATION_TRAYICON_NOMAIL+offset); if(new_icon != old_icon) { gtk_status_icon_set_from_pixbuf(trayicon, new_icon); old_icon = new_icon; } }