changeset 577:aa9a8bcddd80

[gaim-migrate @ 587] add group button. need pixmaps. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 02 Aug 2000 02:28:28 +0000
parents bb22fb4a7d39
children a0636d0d9ee2
files src/buddy.c src/dialogs.c src/gaim.h src/perl.c
diffstat 4 files changed, 164 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/buddy.c	Wed Aug 02 00:19:28 2000 +0000
+++ b/src/buddy.c	Wed Aug 02 02:28:28 2000 +0000
@@ -72,7 +72,7 @@
 static GtkWidget *edittree;
 static GtkWidget *permtree;
 static GtkWidget *imbutton, *infobutton, *chatbutton;
-static GtkWidget *addbutton, *rembutton;
+static GtkWidget *addbutton, *groupbutton, *rembutton;
 static GtkWidget *addpermbutton, *rempermbutton;
 static GtkWidget *lagometer = NULL;
 static GtkWidget *lagometer_box = NULL;
@@ -251,7 +251,7 @@
         GtkWidget *label;
 
 		/*if the user had opted to put pictures on the buttons*/
-        if (display_options & OPT_DISP_SHOW_BUTTON_XPM) {
+        if (display_options & OPT_DISP_SHOW_BUTTON_XPM && xpm) {
 		pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm,
 						  NULL, xpm);
 		pic = gtk_pixmap_new(pm, bm);
@@ -275,6 +275,7 @@
 
 	if (display_options & OPT_DISP_DEVIL_PIXMAPS) {
 	        adjust_pic(addbutton, _("Add"), (gchar **)daemon_buddyadd_xpm);
+	        adjust_pic(groupbutton, _("Group"), NULL);
 		adjust_pic(rembutton, _("Remove"), (gchar **)daemon_buddydel_xpm);
 		adjust_pic(chatbutton, _("Chat"), (gchar **)daemon_buddychat_xpm);
 	        adjust_pic(imbutton, _("IM"), (gchar **)daemon_im_xpm);
@@ -283,6 +284,7 @@
 	        adjust_pic(rempermbutton, _("Remove"), (gchar **)daemon_permdel_xpm);
 	} else {
 	        adjust_pic(addbutton, _("Add"), (gchar **)buddyadd_xpm);
+	        adjust_pic(groupbutton, _("Group"), NULL);
 		adjust_pic(rembutton, _("Remove"), (gchar **)buddydel_xpm);
 		adjust_pic(chatbutton, _("Chat"), (gchar **)buddychat_xpm);
 	        adjust_pic(imbutton, _("IM"), (gchar **)im_xpm);
@@ -1163,6 +1165,11 @@
 
 }
 
+void add_group_callback(GtkWidget *widget, void *dummy)
+{
+	show_add_group();
+}
+
 void add_perm_callback(GtkWidget *widget, void *dummy)
 {
         show_add_perm(NULL);
@@ -2042,11 +2049,13 @@
 
         
        	addbutton = gtk_button_new_with_label(_("Add"));
+       	groupbutton = gtk_button_new_with_label(_("Group"));
        	rembutton = gtk_button_new_with_label(_("Remove"));
 	
 	if (display_options & OPT_DISP_COOL_LOOK)
 	{
 		gtk_button_set_relief(GTK_BUTTON(addbutton), GTK_RELIEF_NONE);
+		gtk_button_set_relief(GTK_BUTTON(groupbutton), GTK_RELIEF_NONE);
 		gtk_button_set_relief(GTK_BUTTON(rembutton), GTK_RELIEF_NONE);
 	}
 	
@@ -2066,10 +2075,12 @@
 	bbox = gtk_hbox_new(TRUE, 10);
        	tbox = gtk_scrolled_window_new(NULL, NULL);
        	/* Put the buttons in the box */
-       	gtk_box_pack_start(GTK_BOX(bbox), addbutton, TRUE, TRUE, 10);
-       	gtk_box_pack_start(GTK_BOX(bbox), rembutton, TRUE, TRUE, 10);
+       	gtk_box_pack_start(GTK_BOX(bbox), addbutton, TRUE, TRUE, 0);
+       	gtk_box_pack_start(GTK_BOX(bbox), groupbutton, TRUE, TRUE, 0);
+       	gtk_box_pack_start(GTK_BOX(bbox), rembutton, TRUE, TRUE, 0);
 
 	gtk_tooltips_set_tip(tips, addbutton, _("Add a new Buddy"), "Penguin");
+	gtk_tooltips_set_tip(tips, groupbutton, _("Add a new Group"), "Penguin");
 	gtk_tooltips_set_tip(tips, rembutton, _("Remove selected Buddy"), "Penguin");
 
        	/* And the boxes in the box */
@@ -2082,6 +2093,7 @@
 
        	/* Finish up */
        	gtk_widget_show(addbutton);
+       	gtk_widget_show(groupbutton);
        	gtk_widget_show(rembutton);
        	gtk_widget_show(edittree);
        	gtk_widget_show(tbox);
@@ -2177,6 +2189,7 @@
 	gtk_signal_connect(GTK_OBJECT(chatbutton), "clicked", GTK_SIGNAL_FUNC(chat_callback), buddies);
        	gtk_signal_connect(GTK_OBJECT(rembutton), "clicked", GTK_SIGNAL_FUNC(do_del_buddy), edittree);
        	gtk_signal_connect(GTK_OBJECT(addbutton), "clicked", GTK_SIGNAL_FUNC(add_buddy_callback), NULL);
+       	gtk_signal_connect(GTK_OBJECT(groupbutton), "clicked", GTK_SIGNAL_FUNC(add_group_callback), NULL);
         gtk_signal_connect(GTK_OBJECT(addpermbutton), "clicked", GTK_SIGNAL_FUNC(add_perm_callback), NULL);
         gtk_signal_connect(GTK_OBJECT(rempermbutton), "clicked", GTK_SIGNAL_FUNC(do_del_perm), permtree);
         gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0);
--- a/src/dialogs.c	Wed Aug 02 00:19:28 2000 +0000
+++ b/src/dialogs.c	Wed Aug 02 02:28:28 2000 +0000
@@ -928,6 +928,25 @@
         destroy_dialog(NULL, a->window);
 }
 
+void do_add_group(GtkWidget *w, struct addbuddy *a)
+{
+	char *grp;
+
+	grp = gtk_entry_get_text(GTK_ENTRY(a->entry));
+
+	add_group(grp);
+
+	build_edit_tree();
+
+	serv_save_config();
+
+	do_export( (GtkWidget *) NULL, 0 );
+
+	update_num_groups();
+
+	destroy_dialog(NULL, a->window);
+}
+
 
 static GList *groups_tree()
 {
@@ -951,6 +970,130 @@
 }
 
 
+void show_add_group()
+{
+	GtkWidget *cancel;
+	GtkWidget *add;
+	GtkWidget *label;
+	GtkWidget *bbox;
+	GtkWidget *vbox;
+        GtkWidget *topbox;
+	GtkWidget *frame;
+	GtkWidget *icon_i;
+	GdkBitmap *mask;
+	GdkPixmap *icon;
+	GtkWidget *button_box;
+
+        struct addbuddy *a = g_new0(struct addbuddy, 1);
+        
+        a->window = gtk_window_new(GTK_WINDOW_DIALOG);
+	gtk_window_set_policy(GTK_WINDOW(a->window), FALSE, FALSE, TRUE);
+	gtk_widget_show(a->window);
+	dialogwindows = g_list_prepend(dialogwindows, a->window);
+
+	bbox = gtk_hbox_new(TRUE, 10);
+        topbox = gtk_hbox_new(FALSE, 5);
+        vbox = gtk_vbox_new(FALSE, 5);
+
+        a->entry = gtk_entry_new();
+        /* Put the buttons in the box */
+
+	/* Build Add Button */
+
+	add = gtk_button_new();
+
+	if (display_options & OPT_DISP_COOL_LOOK)
+		gtk_button_set_relief(GTK_BUTTON(add), GTK_RELIEF_NONE);
+		
+	button_box = gtk_hbox_new(FALSE, 5);
+	icon = gdk_pixmap_create_from_xpm_d ( a->window->window, &mask, NULL, add_xpm);
+	icon_i = gtk_pixmap_new(icon, mask);
+	
+	label = gtk_label_new(_("Add"));
+
+	gtk_box_pack_start(GTK_BOX(button_box), icon_i, FALSE, FALSE, 2);
+	gtk_box_pack_end(GTK_BOX(button_box), label, FALSE, FALSE, 2);
+
+	gtk_widget_show(label);
+	gtk_widget_show(icon_i);
+
+	gtk_widget_show(button_box);
+
+	gtk_container_add(GTK_CONTAINER(add), button_box);
+
+	/* End of OK Button */
+	
+	/* Build Cancel Button */
+
+	cancel = gtk_button_new();
+
+	if (display_options & OPT_DISP_COOL_LOOK)
+		gtk_button_set_relief(GTK_BUTTON(cancel), GTK_RELIEF_NONE);
+		
+	button_box = gtk_hbox_new(FALSE, 5);
+	icon = gdk_pixmap_create_from_xpm_d ( a->window->window, &mask, NULL, cancel_xpm);
+	icon_i = gtk_pixmap_new(icon, mask);
+	
+	label = gtk_label_new(_("Cancel"));
+
+	gtk_box_pack_start(GTK_BOX(button_box), icon_i, FALSE, FALSE, 2);
+	gtk_box_pack_end(GTK_BOX(button_box), label, FALSE, FALSE, 2);
+
+	gtk_widget_show(label);
+	gtk_widget_show(icon_i);
+
+	gtk_widget_show(button_box);
+
+	gtk_container_add(GTK_CONTAINER(cancel), button_box);
+	
+	/* End of Cancel Button */
+
+	gtk_widget_set_usize(add, 75, 30);
+	gtk_widget_set_usize(cancel, 75, 30);
+	
+        gtk_box_pack_start(GTK_BOX(bbox), add, FALSE, FALSE, 5);
+        gtk_box_pack_end(GTK_BOX(bbox), cancel, FALSE, FALSE, 5);
+
+	frame = gtk_frame_new(NULL);
+	gtk_frame_set_label(GTK_FRAME(frame), _("Add Group"));
+
+        label = gtk_label_new(_("Group"));
+        gtk_widget_show(label);
+        gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 5);
+        gtk_box_pack_start(GTK_BOX(topbox), a->entry, FALSE, FALSE, 5);
+
+        /* And the boxes in the box */
+        gtk_box_pack_start(GTK_BOX(vbox), topbox, TRUE, TRUE, 5);
+        gtk_box_pack_start(GTK_BOX(vbox), bbox, TRUE, TRUE, 5);
+
+        /* Handle closes right */
+        gtk_signal_connect(GTK_OBJECT(a->window), "destroy",
+                           GTK_SIGNAL_FUNC(destroy_dialog), a->window);
+        gtk_signal_connect(GTK_OBJECT(cancel), "clicked",
+                           GTK_SIGNAL_FUNC(destroy_dialog), a->window);
+        gtk_signal_connect(GTK_OBJECT(add), "clicked",
+                           GTK_SIGNAL_FUNC(do_add_group), a);
+        gtk_signal_connect(GTK_OBJECT(a->entry), "activate",
+                           GTK_SIGNAL_FUNC(do_add_group), a);
+        /* Finish up */
+        gtk_widget_show(add);
+        gtk_widget_show(cancel);
+        gtk_widget_show(a->entry);
+        gtk_widget_show(topbox);
+        gtk_widget_show(bbox);
+        gtk_widget_show(vbox);
+	gtk_widget_show(frame);
+        gtk_window_set_title(GTK_WINDOW(a->window), _("Gaim - Add Buddy"));
+        gtk_window_set_focus(GTK_WINDOW(a->window), a->entry);
+	gtk_container_add(GTK_CONTAINER(frame), vbox);
+        gtk_container_add(GTK_CONTAINER(a->window), frame);
+	gtk_container_set_border_width(GTK_CONTAINER(a->window), 5);
+        gtk_widget_realize(a->window);
+        aol_icon(a->window->window);
+
+	gtk_widget_show(a->window);
+}
+
 void show_add_buddy(char *buddy, char *group)
 {
 	GtkWidget *cancel;
--- a/src/gaim.h	Wed Aug 02 00:19:28 2000 +0000
+++ b/src/gaim.h	Wed Aug 02 02:28:28 2000 +0000
@@ -404,7 +404,7 @@
 #define TYPE_SIGNOFF   4
 #define TYPE_KEEPALIVE 5
 
-#define REVISION "gaim:$Revision: 585 $"
+#define REVISION "gaim:$Revision: 587 $"
 #define FLAPON "FLAPON\r\n\r\n"
 
 #define ROAST "Tic/Toc"
@@ -751,6 +751,7 @@
 extern void show_error_dialog(char *);
 extern void show_im_dialog(GtkWidget *, GtkWidget *);
 extern void show_add_buddy(char *, char *);
+extern void show_add_group();
 extern void show_add_perm();
 extern void destroy_all_dialogs();
 extern void show_export_dialog();
--- a/src/perl.c	Wed Aug 02 00:19:28 2000 +0000
+++ b/src/perl.c	Wed Aug 02 02:28:28 2000 +0000
@@ -28,7 +28,8 @@
 #endif
 #undef PACKAGE
 
-#if 0 /* #ifdef USE_PERL */
+/*#ifdef USE_PERL /**/
+#if 0 /**/
 
 #include <EXTERN.h>
 #ifndef _SEM_SEMUN_UNDEFINED