Mercurial > pidgin.yaz
comparison plugins/docklet/docklet.c @ 12471:011efeb86b8d
[gaim-migrate @ 14781]
SF Patch #1368906 from charkins
"This patch adds a tooltip to the docklet icon. It is
based off of faceprint's code for the blist menutray.
Wingaim had some status strings it was displaying in
the tooltip, this patch removes those."
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Mon, 12 Dec 2005 19:55:42 +0000 |
parents | 13f351a0096e |
children | 065005e5f536 |
comparison
equal
deleted
inserted
replaced
12470:13f351a0096e | 12471:011efeb86b8d |
---|---|
89 | 89 |
90 static gboolean | 90 static gboolean |
91 docklet_update_status() | 91 docklet_update_status() |
92 { | 92 { |
93 GList *l; | 93 GList *l; |
94 GList *convs; | |
94 DockletStatus newstatus = DOCKLET_STATUS_OFFLINE; | 95 DockletStatus newstatus = DOCKLET_STATUS_OFFLINE; |
95 gboolean pending = FALSE; | 96 gboolean pending = FALSE; |
96 | 97 |
97 /* determine if any ims have unseen messages */ | 98 /* determine if any ims have unseen messages */ |
98 l = gaim_gtk_conversations_find_unseen_list(GAIM_CONV_TYPE_IM, | 99 convs = gaim_gtk_conversations_find_unseen_list(GAIM_CONV_TYPE_IM, |
99 GAIM_UNSEEN_TEXT, FALSE, 1); | 100 GAIM_UNSEEN_TEXT, FALSE, 1); |
100 if (l != NULL) { | 101 if (convs != NULL) { |
101 pending = TRUE; | 102 pending = TRUE; |
102 g_list_free(l); | 103 |
104 /* set tooltip if messages are pending */ | |
105 if (ui_ops->set_tooltip) { | |
106 GString *tooltip_text = g_string_new(""); | |
107 for (l = convs ; l != NULL ; l = l->next) { | |
108 if (GAIM_IS_GTK_CONVERSATION(l->data)) { | |
109 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION((GaimConversation *)l->data); | |
110 g_string_append_printf(tooltip_text, | |
111 ngettext("%d unread message from %s\n", "%d unread messages from %s\n", gtkconv->unseen_count), | |
112 gtkconv->unseen_count, | |
113 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label))); | |
114 } | |
115 } | |
116 | |
117 /* get rid of the last newline */ | |
118 if (tooltip_text->len > 0) | |
119 tooltip_text = g_string_truncate(tooltip_text, tooltip_text->len - 1); | |
120 | |
121 ui_ops->set_tooltip(tooltip_text->str); | |
122 | |
123 g_string_free(tooltip_text, TRUE); | |
124 } else { | |
125 ui_ops->set_tooltip(NULL); | |
126 } | |
127 | |
128 g_list_free(convs); | |
103 } | 129 } |
104 | 130 |
105 /* iterate through all accounts and determine which | 131 /* iterate through all accounts and determine which |
106 * status to show in the tray icon based on the following | 132 * status to show in the tray icon based on the following |
107 * ranks (highest encountered rank will be used): | 133 * ranks (highest encountered rank will be used): |