comparison plugins/docklet/docklet.c @ 10127:23e101b522f1

[gaim-migrate @ 11165] This is from patch 1049732 by datallah to fix a crash when trying to join a chat from the docklet when not signed in with any chat capable accounts. committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Tue, 19 Oct 2004 18:37:24 +0000
parents 60db14d54914
children d082b2a71ee7
comparison
equal deleted inserted replaced
10126:3c3795562256 10127:23e101b522f1
56 /* globals */ 56 /* globals */
57 57
58 GaimPlugin *handle = NULL; 58 GaimPlugin *handle = NULL;
59 static struct docklet_ui_ops *ui_ops = NULL; 59 static struct docklet_ui_ops *ui_ops = NULL;
60 static enum docklet_status status = offline; 60 static enum docklet_status status = offline;
61 gboolean online_account_supports_chat = FALSE;
61 #if 0 /* XXX CUI */ 62 #if 0 /* XXX CUI */
62 #ifdef _WIN32 63 #ifdef _WIN32
63 __declspec(dllimport) GSList *unread_message_queue; 64 __declspec(dllimport) GSList *unread_message_queue;
64 __declspec(dllimport) GSList *away_messages; 65 __declspec(dllimport) GSList *away_messages;
65 __declspec(dllimport) struct away_message *awaymessage; 66 __declspec(dllimport) struct away_message *awaymessage;
123 #endif 124 #endif
124 125
125 static void docklet_menu() { 126 static void docklet_menu() {
126 static GtkWidget *menu = NULL; 127 static GtkWidget *menu = NULL;
127 GtkWidget *entry; 128 GtkWidget *entry;
129 GtkWidget *menuitem;
128 130
129 if (menu) { 131 if (menu) {
130 gtk_widget_destroy(menu); 132 gtk_widget_destroy(menu);
131 } 133 }
132 134
137 case offline_connecting: 139 case offline_connecting:
138 gaim_new_item_from_stock(menu, _("Auto-login"), GAIM_STOCK_SIGN_ON, G_CALLBACK(docklet_auto_login), NULL, 0, 0, NULL); 140 gaim_new_item_from_stock(menu, _("Auto-login"), GAIM_STOCK_SIGN_ON, G_CALLBACK(docklet_auto_login), NULL, 0, 0, NULL);
139 break; 141 break;
140 default: 142 default:
141 gaim_new_item_from_stock(menu, _("New Message..."), GAIM_STOCK_IM, G_CALLBACK(gaim_gtkdialogs_im), NULL, 0, 0, NULL); 143 gaim_new_item_from_stock(menu, _("New Message..."), GAIM_STOCK_IM, G_CALLBACK(gaim_gtkdialogs_im), NULL, 0, 0, NULL);
142 gaim_new_item_from_stock(menu, _("Join A Chat..."), GAIM_STOCK_CHAT, G_CALLBACK(gaim_gtk_blist_joinchat_show), NULL, 0, 0, NULL); 144 menuitem = gaim_new_item_from_stock(menu, _("Join A Chat..."), GAIM_STOCK_CHAT, G_CALLBACK(gaim_gtk_blist_joinchat_show), NULL, 0, 0, NULL);
145 gtk_widget_set_sensitive(menuitem, online_account_supports_chat);
143 break; 146 break;
144 } 147 }
145 148
146 switch (status) { 149 switch (status) {
147 case offline: 150 case offline:
264 } 267 }
265 268
266 static gboolean 269 static gboolean
267 docklet_update_status() 270 docklet_update_status()
268 { 271 {
272 GList *c;
269 enum docklet_status oldstatus; 273 enum docklet_status oldstatus;
270 274
271 oldstatus = status; 275 oldstatus = status;
272 276
273 if (gaim_connections_get_all()) { 277 if ((c = gaim_connections_get_all())) {
274 #if 0 /* XXX NEW STATUS */ 278 #if 0 /* XXX NEW STATUS */
275 if (unread_message_queue) { 279 if (unread_message_queue) {
276 status = online_pending; 280 status = online_pending;
277 } else if (awaymessage) { 281 } else if (awaymessage) {
278 if (message_queue) { 282 if (message_queue) {
285 if (gaim_connections_get_connecting()) { 289 if (gaim_connections_get_connecting()) {
286 #endif 290 #endif
287 status = online_connecting; 291 status = online_connecting;
288 } else { 292 } else {
289 status = online; 293 status = online;
294 }
295 /* Check if any online accounts support chats */
296 while (c != NULL) {
297 GaimConnection *gc = c->data;
298 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL) {
299 online_account_supports_chat = TRUE;
300 break;
301 }
302 c = c->next;
290 } 303 }
291 } else { 304 } else {
292 if (gaim_connections_get_connecting()) { 305 if (gaim_connections_get_connecting()) {
293 status = offline_connecting; 306 status = offline_connecting;
294 } else { 307 } else {