comparison plugins/docklet/docklet.c @ 12498:a2de852981c1

[gaim-migrate @ 14810] SF Patch #1380806 from charkins "leave docklet loaded when notification area is not present" "From the summary, this sounds weird, but I think its better behavior. This really only effects some odd corner cases. The existing behavior is that the docklet plugin unloads itself after 10 seconds if the tray icon isn't created. The behavior with this patch is that there is a 3 second timeout (this is necessary to avoid race condition when restoring the gtkblist's visibility state on startup). After this timeout, the docklet plugin stays loaded waiting for a notification to appear, but is essentially non-functional. In the typical scenario, this patch doesn't effect the behavior. Here are some examples of where it does matter: 1) If gaim is closed with the buddy list hidden to the docklet, then gaim is started again without a notification area, the buddy list doesn't show up for 10 seconds (the time it takes for the docklet to timeout). This patch would reduce this to 3 seconds. 2) If the user removes the notification area from their panel, maybe to remove it from one panel and add it to a different panel, but doesn't add a new one back within 10 seconds, the current behavior would cause the docklet plugin to be unloaded. With this patch, the tray icon would automatically be added to the new notification area when it becomes available. 3) The gnome-panel dies and is not restarted within 10 seconds. Similar to #2. (There was a bug filed for this, but can't find it right now). My main concern was that it could be confusing to the user if they enable the docklet plugin, then 10 seconds later it gets disabled without any notification. This patch doesn't add any notification, but leaves the plugin running so it will automatically use a notification area when one becomes available. I also removed an unused parameter from docklet_remove() and changed the plugin description slightly to reflect the change in queuing/notification. Not sure how clear this is, so bug me on #gaim if you have any questions. --charkins" I made a few changes to this patch, but nothing terribly significant... committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Fri, 16 Dec 2005 09:16:14 +0000
parents 572d6d5da418
children dd2b171a624c
comparison
equal deleted inserted replaced
12497:202ce52b77a9 12498:a2de852981c1
56 GaimPlugin *handle = NULL; 56 GaimPlugin *handle = NULL;
57 static struct docklet_ui_ops *ui_ops = NULL; 57 static struct docklet_ui_ops *ui_ops = NULL;
58 static DockletStatus status = DOCKLET_STATUS_OFFLINE; 58 static DockletStatus status = DOCKLET_STATUS_OFFLINE;
59 static gboolean enable_join_chat = FALSE; 59 static gboolean enable_join_chat = FALSE;
60 static guint docklet_blinking_timer = 0; 60 static guint docklet_blinking_timer = 0;
61 static gboolean visibility_manager = FALSE;
61 62
62 /************************************************************************** 63 /**************************************************************************
63 * docklet status and utility functions 64 * docklet status and utility functions
64 **************************************************************************/ 65 **************************************************************************/
65 static gboolean 66 static gboolean
167 g_string_free(tooltip_text, TRUE); 168 g_string_free(tooltip_text, TRUE);
168 } 169 }
169 170
170 g_list_free(convs); 171 g_list_free(convs);
171 172
172 } else if(ui_ops->set_tooltip) { 173 } else if (ui_ops->set_tooltip) {
173 ui_ops->set_tooltip(NULL); 174 ui_ops->set_tooltip(NULL);
174 } 175 }
175 176
176 /* iterate through all accounts and determine which 177 /* iterate through all accounts and determine which
177 * status to show in the tray icon based on the following 178 * status to show in the tray icon based on the following
182 * 3) ONLINE_PENDING 183 * 3) ONLINE_PENDING
183 * 4) AWAY 184 * 4) AWAY
184 * 5) AWAY_PENDING 185 * 5) AWAY_PENDING
185 * 6) CONNECTING 186 * 6) CONNECTING
186 */ 187 */
187 for(l = gaim_accounts_get_all(); l!=NULL; l=l->next) { 188 for(l = gaim_accounts_get_all(); l != NULL; l = l->next) {
188 DockletStatus tmpstatus = DOCKLET_STATUS_OFFLINE; 189 DockletStatus tmpstatus = DOCKLET_STATUS_OFFLINE;
189 190
190 GaimAccount *account = (GaimAccount*)l->data; 191 GaimAccount *account = (GaimAccount*)l->data;
191 GaimStatus *account_status; 192 GaimStatus *account_status;
192 193
241 online_account_supports_chat() 242 online_account_supports_chat()
242 { 243 {
243 GList *c = NULL; 244 GList *c = NULL;
244 c = gaim_connections_get_all(); 245 c = gaim_connections_get_all();
245 246
246 while(c!=NULL) { 247 while(c != NULL) {
247 GaimConnection *gc = c->data; 248 GaimConnection *gc = c->data;
248 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL) 249 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL)
249 return TRUE; 250 return TRUE;
250 c = c->next; 251 c = c->next;
251 } 252 }
445 void 446 void
446 docklet_clicked(int button_type) 447 docklet_clicked(int button_type)
447 { 448 {
448 switch (button_type) { 449 switch (button_type) {
449 case 1: 450 case 1:
450 if (status==DOCKLET_STATUS_ONLINE_PENDING || status==DOCKLET_STATUS_AWAY_PENDING) { 451 if (status == DOCKLET_STATUS_ONLINE_PENDING || status == DOCKLET_STATUS_AWAY_PENDING) {
451 GList *l = get_pending_list(1); 452 GList *l = get_pending_list(1);
452 if (l != NULL) { 453 if (l != NULL) {
453 gaim_gtkconv_present_conversation((GaimConversation *)l->data); 454 gaim_gtkconv_present_conversation((GaimConversation *)l->data);
454 g_list_free(l); 455 g_list_free(l);
455 } 456 }
464 } 465 }
465 466
466 void 467 void
467 docklet_embedded() 468 docklet_embedded()
468 { 469 {
469 gaim_gtk_blist_visibility_manager_add(); 470 if (!visibility_manager) {
471 gaim_gtk_blist_visibility_manager_add();
472 visibility_manager = TRUE;
473 }
470 docklet_update_status(); 474 docklet_update_status();
471 if (ui_ops && ui_ops->update_icon) 475 if (ui_ops && ui_ops->update_icon)
472 ui_ops->update_icon(status); 476 ui_ops->update_icon(status);
473 } 477 }
474 478
475 void 479 void
476 docklet_remove(gboolean visible) 480 docklet_remove()
477 { 481 {
478 gaim_gtk_blist_visibility_manager_remove(); 482 if (visibility_manager) {
483 gaim_gtk_blist_visibility_manager_remove();
484 visibility_manager = FALSE;
485 }
479 } 486 }
480 487
481 void 488 void
482 docklet_unload() 489 docklet_unload()
483 { 490 {
608 N_("System Tray Icon"), /**< name */ 615 N_("System Tray Icon"), /**< name */
609 VERSION, /**< version */ 616 VERSION, /**< version */
610 /** summary */ 617 /** summary */
611 N_("Displays an icon for Gaim in the system tray."), 618 N_("Displays an icon for Gaim in the system tray."),
612 /** description */ 619 /** description */
613 N_("Displays a system tray icon (in GNOME, KDE or Windows for example) " 620 N_("Displays a system tray icon (in GNOME, KDE, or Windows for example) "
614 "to show the current status of Gaim, allow fast access to commonly " 621 "to show the current status of Gaim, allow fast access to commonly "
615 "used functions, and to toggle display of the buddy list or login " 622 "used functions, and to toggle display of the buddy list. "
616 "window. Also allows messages to be queued until the icon is " 623 "Also provides options to blink for unread messages."),
617 "clicked, similar to ICQ."), 624 /** author */
618 "Robert McQueen <robot101@debian.org>", /**< author */ 625 "Robert McQueen <robot101@debian.org>"
626 "\n\t\t\tCasey Harkins <charkins@users.sf.net>",
619 GAIM_WEBSITE, /**< homepage */ 627 GAIM_WEBSITE, /**< homepage */
620 628
621 plugin_load, /**< load */ 629 plugin_load, /**< load */
622 plugin_unload, /**< unload */ 630 plugin_unload, /**< unload */
623 NULL, /**< destroy */ 631 NULL, /**< destroy */