comparison src/gtkblist.c @ 9812:d56f24cc4dad

[gaim-migrate @ 10683] See the changelog. This is a modified patch #1005629. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 22 Aug 2004 03:06:33 +0000
parents a107051d991f
children 524cd6d1496e
comparison
equal deleted inserted replaced
9811:a107051d991f 9812:d56f24cc4dad
74 } GaimGtkAddBuddyData; 74 } GaimGtkAddBuddyData;
75 75
76 typedef struct 76 typedef struct
77 { 77 {
78 GaimAccount *account; 78 GaimAccount *account;
79 const char *default_chat_name; 79 gchar *default_chat_name;
80 80
81 GtkWidget *window; 81 GtkWidget *window;
82 GtkWidget *account_menu; 82 GtkWidget *account_menu;
83 GtkWidget *alias_entry; 83 GtkWidget *alias_entry;
84 GtkWidget *group_combo; 84 GtkWidget *group_combo;
4104 { 4104 {
4105 gaim_blist_add_chat(chat, group, NULL); 4105 gaim_blist_add_chat(chat, group, NULL);
4106 } 4106 }
4107 4107
4108 gtk_widget_destroy(data->window); 4108 gtk_widget_destroy(data->window);
4109 g_free(data->default_chat_name);
4109 g_list_free(data->entries); 4110 g_list_free(data->entries);
4110
4111 g_free(data); 4111 g_free(data);
4112 } 4112 }
4113 4113
4114 static void 4114 static void
4115 add_chat_resp_cb(GtkWidget *w, int resp, GaimGtkAddChatData *data) 4115 add_chat_resp_cb(GtkWidget *w, int resp, GaimGtkAddChatData *data)
4119 add_chat_cb(NULL, data); 4119 add_chat_cb(NULL, data);
4120 } 4120 }
4121 else 4121 else
4122 { 4122 {
4123 gtk_widget_destroy(data->window); 4123 gtk_widget_destroy(data->window);
4124 g_free(data->default_chat_name);
4124 g_list_free(data->entries); 4125 g_list_free(data->entries);
4125 g_free(data); 4126 g_free(data);
4126 } 4127 }
4127 } 4128 }
4128 4129
4258 GtkWidget *rowbox; 4259 GtkWidget *rowbox;
4259 GtkWidget *hbox; 4260 GtkWidget *hbox;
4260 GtkWidget *vbox; 4261 GtkWidget *vbox;
4261 GtkWidget *img; 4262 GtkWidget *img;
4262 4263
4264 if (account != NULL) {
4265 gc = gaim_account_get_connection(account);
4266
4267 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat == NULL) {
4268 gaim_notify_error(gc, NULL, _("This protocol does not support chat rooms."), NULL);
4269 return;
4270 }
4271 } else {
4272 /* Find an account with chat capabilities */
4273 for (l = gaim_connections_get_all(); l != NULL; l = l->next) {
4274 gc = (GaimConnection *)l->data;
4275
4276 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat != NULL) {
4277 account = gaim_connection_get_account(gc);
4278 break;
4279 }
4280 }
4281
4282 if (account == NULL) {
4283 gaim_notify_error(NULL, NULL,
4284 _("You are not currently signed on with any "
4285 "protocols that have the ability to chat."), NULL);
4286 return;
4287 }
4288 }
4289
4263 data = g_new0(GaimGtkAddChatData, 1); 4290 data = g_new0(GaimGtkAddChatData, 1);
4291 data->account = account;
4292 data->default_chat_name = g_strdup(name);
4264 4293
4265 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, 4294 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
4266 GTK_ICON_SIZE_DIALOG); 4295 GTK_ICON_SIZE_DIALOG);
4267 4296
4268 gtkblist = GAIM_GTK_BLIST(gaim_get_blist()); 4297 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
4269
4270 data->default_chat_name = name;
4271
4272 if (account != NULL)
4273 {
4274 data->account = account;
4275 }
4276 else
4277 {
4278 /* Select an account with chat capabilities */
4279 for (l = gaim_connections_get_all(); l != NULL; l = l->next)
4280 {
4281 gc = (GaimConnection *)l->data;
4282
4283 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat != NULL)
4284 {
4285 data->account = gaim_connection_get_account(gc);
4286 break;
4287 }
4288 }
4289 }
4290
4291 if (data->account == NULL)
4292 {
4293 gaim_notify_error(NULL, NULL,
4294 _("You are not currently signed on with any "
4295 "protocols that have the ability to chat."), NULL);
4296 return;
4297 }
4298 4298
4299 data->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); 4299 data->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
4300 4300
4301 data->window = gtk_dialog_new_with_buttons(_("Add Chat"), 4301 data->window = gtk_dialog_new_with_buttons(_("Add Chat"),
4302 NULL, GTK_DIALOG_NO_SEPARATOR, 4302 NULL, GTK_DIALOG_NO_SEPARATOR,