comparison src/dialogs.c @ 6322:dd2be7cd66df

[gaim-migrate @ 6821] This is: -Alphabetize the translation things in ChangeLog -Spell Brian Tarricone's name correctly (I hope...) -A fix for a crash when renaming a group containing a chat, thanks to javabsp. Me gusta this change. -Make the rename group dialog use gaim_request_input(). The old dialog may be a bit prettier, but this one uses the request code, which means less work for UIs, which rocks. -Change the TRUE and FALSE defines in aim.h to be more compatible with c++. Thanks to Zack Rusin for this change. -Declare aim.h as a C file when it is used in a c++ program. This should let libfaim be used in C++ programs such as kopete. Thanks again to Zack Rusin. -Rename aimutil_itemidx() to aimutil_itemindex(). "idx" is not a standard abbreviation, and code is written once and read many times--it should be easily readable. -Not an automatic laundry folding machine. So I'm going to do that. (Fold my laundry) (Not automatically) (yet) committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 29 Jul 2003 04:27:31 +0000
parents 519028f52516
children 493eed80869c
comparison
equal deleted inserted replaced
6321:3613007cbb6e 6322:dd2be7cd66df
4261 4261
4262 /*------------------------------------------------------------------------*/ 4262 /*------------------------------------------------------------------------*/
4263 /* The dialog for renaming groups */ 4263 /* The dialog for renaming groups */
4264 /*------------------------------------------------------------------------*/ 4264 /*------------------------------------------------------------------------*/
4265 4265
4266 static void do_rename_group(GtkObject *obj, int resp, GtkWidget *entry) 4266 static void do_rename_group(struct group *g, const char *new_name)
4267 { 4267 {
4268 const char *new_name; 4268 gaim_blist_rename_group(g, new_name);
4269 struct group *g; 4269 gaim_blist_save();
4270
4271 if (resp == GTK_RESPONSE_OK) {
4272 new_name = gtk_entry_get_text(GTK_ENTRY(entry));
4273 g = g_object_get_data(G_OBJECT(entry), "group");
4274
4275 gaim_blist_rename_group(g, new_name);
4276 gaim_blist_save();
4277 }
4278 destroy_dialog(rename_dialog, rename_dialog);
4279 } 4270 }
4280 4271
4281 void show_rename_group(GtkWidget *unused, struct group *g) 4272 void show_rename_group(GtkWidget *unused, struct group *g)
4282 { 4273 {
4283 4274 gaim_request_input(NULL, _("Rename Group"), _("New Group Name:\n"),
4284 GtkWidget *hbox, *vbox; 4275 NULL, g->name, FALSE, FALSE,
4285 GtkWidget *label; 4276 GTK_STOCK_OK, G_CALLBACK(do_rename_group),
4286 struct gaim_gtk_buddy_list *gtkblist; 4277 GTK_STOCK_CANCEL, NULL, g);
4287 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); 4278 }
4288 GtkWidget *name_entry = NULL;
4289
4290 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
4291
4292 if (!rename_dialog) {
4293 rename_dialog = gtk_dialog_new_with_buttons(_("Rename Group"), GTK_WINDOW(gtkblist->window), 0,
4294 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
4295 gtk_dialog_set_default_response (GTK_DIALOG(rename_dialog), GTK_RESPONSE_OK);
4296 gtk_container_set_border_width (GTK_CONTAINER(rename_dialog), 6);
4297 gtk_window_set_resizable(GTK_WINDOW(rename_dialog), FALSE);
4298 gtk_dialog_set_has_separator(GTK_DIALOG(rename_dialog), FALSE);
4299 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(rename_dialog)->vbox), 12);
4300 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(rename_dialog)->vbox), 6);
4301
4302 hbox = gtk_hbox_new(FALSE, 12);
4303 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(rename_dialog)->vbox), hbox);
4304 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
4305 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
4306
4307 vbox = gtk_vbox_new(FALSE, 0);
4308 gtk_container_add(GTK_CONTAINER(hbox), vbox);
4309
4310 label = gtk_label_new(_("Please enter a new name for the selected group.\n"));
4311 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
4312 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
4313 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
4314
4315 hbox = gtk_hbox_new(FALSE, 6);
4316 gtk_container_add(GTK_CONTAINER(vbox), hbox);
4317
4318 label = gtk_label_new(NULL);
4319 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Group:"));
4320 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
4321
4322 name_entry = gtk_entry_new();
4323 gtk_entry_set_activates_default (GTK_ENTRY(name_entry), TRUE);
4324 g_object_set_data(G_OBJECT(name_entry), "group", g);
4325 gtk_entry_set_text(GTK_ENTRY(name_entry), g->name);
4326 gtk_box_pack_start(GTK_BOX(hbox), name_entry, FALSE, FALSE, 0);
4327 gtk_entry_set_activates_default (GTK_ENTRY(name_entry), TRUE);
4328 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(name_entry));
4329
4330 g_signal_connect(G_OBJECT(rename_dialog), "response", G_CALLBACK(do_rename_group), name_entry);
4331
4332 }
4333
4334 gtk_widget_show_all(rename_dialog);
4335 if(name_entry)
4336 gtk_widget_grab_focus(GTK_WIDGET(name_entry));
4337 }
4338
4339 4279
4340 GtkWidget *gaim_pixbuf_toolbar_button_from_stock(char *icon) 4280 GtkWidget *gaim_pixbuf_toolbar_button_from_stock(char *icon)
4341 { 4281 {
4342 GtkWidget *button, *image, *bbox; 4282 GtkWidget *button, *image, *bbox;
4343 4283