comparison src/dialogs.c @ 6330:def96a62cd0d

[gaim-migrate @ 6829] Updated the Add Group dialog. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Tue, 29 Jul 2003 06:27:13 +0000
parents 418cc72136d1
children b7f983d1392c
comparison
equal deleted inserted replaced
6329:418cc72136d1 6330:def96a62cd0d
812 } 812 }
813 813
814 destroy_dialog(NULL, a->window); 814 destroy_dialog(NULL, a->window);
815 } 815 }
816 816
817 void do_add_group(GtkWidget *w, int resp, struct addbuddy *a)
818 {
819 const char *grp;
820 struct group *g;
821
822 if (resp == GTK_RESPONSE_OK) {
823 grp = gtk_entry_get_text(GTK_ENTRY(a->entry));
824
825 if (!a->gc)
826 a->gc = gaim_connections_get_all()->data;
827
828 g = gaim_group_new(grp);
829 gaim_blist_add_group (g, NULL);
830 gaim_blist_save();
831 }
832
833 destroy_dialog(NULL, a->window);
834 }
835
836
837 static GList *groups_tree() 817 static GList *groups_tree()
838 { 818 {
839 GList *tmp = NULL; 819 GList *tmp = NULL;
840 char *tmp2; 820 char *tmp2;
841 struct group *g; 821 struct group *g;
862 { 842 {
863 g_free(a); 843 g_free(a);
864 } 844 }
865 845
866 846
867 void show_add_group(GaimConnection *gc) 847 static void
868 { 848 add_group_cb(GaimConnection *gc, const char *group_name)
869 849 {
850 struct group *g;
851
852 g = gaim_group_new(group_name);
853 gaim_blist_add_group(g, NULL);
854 gaim_blist_save();
855 }
856
857 void
858 show_add_group(GaimConnection *gc)
859 {
860 gaim_request_input(NULL, _("Add Group"), _("Add a new group"),
861 _("Please enter the name of the group to be added."),
862 NULL, FALSE, FALSE,
863 _("Add"), G_CALLBACK(add_group_cb),
864 _("Cancel"), NULL, gc);
865
866 #if 0
870 GtkWidget *hbox, *vbox; 867 GtkWidget *hbox, *vbox;
871 GtkWidget *label; 868 GtkWidget *label;
872 struct gaim_gtk_buddy_list *gtkblist; 869 struct gaim_gtk_buddy_list *gtkblist;
873 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); 870 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG);
874 struct addbuddy *a = g_new0(struct addbuddy, 1); 871 struct addbuddy *a = g_new0(struct addbuddy, 1);
913 910
914 g_signal_connect(G_OBJECT(a->window), "response", G_CALLBACK(do_add_group), a); 911 g_signal_connect(G_OBJECT(a->window), "response", G_CALLBACK(do_add_group), a);
915 912
916 gtk_widget_show_all(a->window); 913 gtk_widget_show_all(a->window);
917 gtk_widget_grab_focus(GTK_WIDGET(a->entry)); 914 gtk_widget_grab_focus(GTK_WIDGET(a->entry));
915 #endif
918 } 916 }
919 917
920 static void 918 static void
921 addbuddy_select_account(GObject *w, GaimAccount *account, 919 addbuddy_select_account(GObject *w, GaimAccount *account,
922 struct addbuddy *b) 920 struct addbuddy *b)