# HG changeset patch # User Stu Tomlinson # Date 1098211044 0 # Node ID 23e101b522f18c8e0b6082abdde6265ec95b631b # Parent 3c37955622567c496d41871bdd49fe895bb5d3ee [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 diff -r 3c3795562256 -r 23e101b522f1 plugins/docklet/docklet.c --- a/plugins/docklet/docklet.c Tue Oct 19 05:17:14 2004 +0000 +++ b/plugins/docklet/docklet.c Tue Oct 19 18:37:24 2004 +0000 @@ -58,6 +58,7 @@ GaimPlugin *handle = NULL; static struct docklet_ui_ops *ui_ops = NULL; static enum docklet_status status = offline; +gboolean online_account_supports_chat = FALSE; #if 0 /* XXX CUI */ #ifdef _WIN32 __declspec(dllimport) GSList *unread_message_queue; @@ -125,6 +126,7 @@ static void docklet_menu() { static GtkWidget *menu = NULL; GtkWidget *entry; + GtkWidget *menuitem; if (menu) { gtk_widget_destroy(menu); @@ -139,7 +141,8 @@ break; default: gaim_new_item_from_stock(menu, _("New Message..."), GAIM_STOCK_IM, G_CALLBACK(gaim_gtkdialogs_im), NULL, 0, 0, NULL); - gaim_new_item_from_stock(menu, _("Join A Chat..."), GAIM_STOCK_CHAT, G_CALLBACK(gaim_gtk_blist_joinchat_show), NULL, 0, 0, NULL); + menuitem = gaim_new_item_from_stock(menu, _("Join A Chat..."), GAIM_STOCK_CHAT, G_CALLBACK(gaim_gtk_blist_joinchat_show), NULL, 0, 0, NULL); + gtk_widget_set_sensitive(menuitem, online_account_supports_chat); break; } @@ -266,11 +269,12 @@ static gboolean docklet_update_status() { + GList *c; enum docklet_status oldstatus; oldstatus = status; - if (gaim_connections_get_all()) { + if ((c = gaim_connections_get_all())) { #if 0 /* XXX NEW STATUS */ if (unread_message_queue) { status = online_pending; @@ -288,6 +292,15 @@ } else { status = online; } + /* Check if any online accounts support chats */ + while (c != NULL) { + GaimConnection *gc = c->data; + if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL) { + online_account_supports_chat = TRUE; + break; + } + c = c->next; + } } else { if (gaim_connections_get_connecting()) { status = offline_connecting; diff -r 3c3795562256 -r 23e101b522f1 src/gtkblist.c --- a/src/gtkblist.c Tue Oct 19 05:17:14 2004 +0000 +++ b/src/gtkblist.c Tue Oct 19 18:37:24 2004 +0000 @@ -660,6 +660,8 @@ struct proto_chat_entry *pce; gboolean focus = TRUE; + g_return_if_fail(data->account != NULL); + gc = gaim_account_get_connection(data->account); while (GTK_BOX(data->entries_box)->children) @@ -4146,6 +4148,8 @@ struct proto_chat_entry *pce; gboolean focus = TRUE; + g_return_if_fail(data->account != NULL); + gc = gaim_account_get_connection(data->account); while (GTK_BOX(data->entries_box)->children)