changeset 9750:4f8476beabf5

[gaim-migrate @ 10617] Fix chat buttons and make a few more tweaks committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 15 Aug 2004 15:45:35 +0000
parents a2fd9abea23a
children 94c643a77913
files src/gtkconv.c src/gtkutils.c
diffstat 2 files changed, 54 insertions(+), 81 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkconv.c	Sun Aug 15 15:08:25 2004 +0000
+++ b/src/gtkconv.c	Sun Aug 15 15:45:35 2004 +0000
@@ -3669,7 +3669,7 @@
 	button = gaim_pixbuf_button_from_stock(
 					(buttons == GAIM_BUTTON_IMAGE ? NULL : text),
 					(buttons == GAIM_BUTTON_TEXT ? NULL : icon),
-					GAIM_CONV_IM);
+					GAIM_BUTTON_VERTICAL);
 	gtk_tooltips_set_tip(tooltips, button, tooltip, NULL);
 	gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
 	g_signal_connect(G_OBJECT(button), "clicked",
@@ -3685,7 +3685,6 @@
 	GaimGtkConversation *gtkconv;
 	GaimGtkImPane *gtkim;
 	GaimButtonStyle button_type;
-	GtkWidget *hbox;
 	GList *children;
 
 	gtkconv = GAIM_GTK_CONVERSATION(conv);
@@ -3699,51 +3698,48 @@
 		children = g_list_remove(children, children->data);
 	}
 
-	/* The buttons, in order from left to right: */
-	hbox = gtk_hbox_new(TRUE, 0);
-	gtk_box_pack_start(GTK_BOX(parent), hbox, TRUE, TRUE, 0);
-	gtk_widget_show(hbox);
+	/* The buttons, from left to right */
 
 	/* Warn button */
 	gtkim->warn = new_gtkconv_button(GAIM_STOCK_WARN, _("Warn"),
 									_("Warn the user"),
 									gtkconv->tooltips, warn_cb, conv);
-	gtk_box_pack_start(GTK_BOX(hbox), gtkim->warn, FALSE, FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(parent), gtkim->warn, TRUE, TRUE, 0);
 	gtk_size_group_add_widget(gtkconv->sg, gtkim->warn);
 
 	/* Block button */
 	gtkim->block = new_gtkconv_button(GAIM_STOCK_BLOCK, _("Block"),
 									_("Block the user"),
 									gtkconv->tooltips, block_cb, conv);
-	gtk_box_pack_start(GTK_BOX(hbox), gtkim->block, FALSE, FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(parent), gtkim->block, TRUE, TRUE, 0);
 	gtk_size_group_add_widget(gtkconv->sg, gtkim->block);
 
 	/* Send File button */
 	gtkim->send_file = new_gtkconv_button(GAIM_STOCK_FILE_TRANSFER, _("Send File"),
 									_("Send a file to the user"),
 									gtkconv->tooltips, send_file_cb, conv);
-	gtk_box_pack_start(GTK_BOX(hbox), gtkim->send_file, FALSE, FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(parent), gtkim->send_file, TRUE, TRUE, 0);
 	gtk_size_group_add_widget(gtkconv->sg, gtkim->send_file);
 
 	/* Add button */
 	gtkconv->add = new_gtkconv_button(GTK_STOCK_ADD, _("Add"),
 									_("Add the user to your buddy list"),
 									gtkconv->tooltips, add_remove_cb, conv);
-	gtk_box_pack_start(GTK_BOX(hbox), gtkconv->add, FALSE, FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, TRUE, TRUE, 0);
 	gtk_size_group_add_widget(gtkconv->sg, gtkconv->add);
 
 	/* Remove button */
 	gtkconv->remove = new_gtkconv_button(GTK_STOCK_REMOVE, _("Remove"),
 									_("Remove the user from your buddy list"),
 									gtkconv->tooltips, add_remove_cb, conv);
-	gtk_box_pack_start(GTK_BOX(hbox), gtkconv->remove, FALSE, FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, TRUE, TRUE, 0);
 	gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove);
 
 	/* Info button */
 	gtkconv->info = new_gtkconv_button(GAIM_STOCK_INFO, _("Info"),
 									_("Get the user's information"),
 									gtkconv->tooltips, info_cb, conv);
-	gtk_box_pack_start(GTK_BOX(hbox), gtkconv->info, FALSE, FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(parent), gtkconv->info, TRUE, TRUE, 0);
 	gtk_size_group_add_widget(gtkconv->sg, gtkconv->info);
 
 	/* Send button */
@@ -3774,63 +3770,54 @@
 	GaimGtkConversation *gtkconv;
 	GaimGtkChatPane *gtkchat;
 	GaimButtonStyle button_type;
+	GList *children;
 
 	gtkconv = GAIM_GTK_CONVERSATION(conv);
 	gtkchat = gtkconv->u.chat;
 	gc      = gaim_conversation_get_gc(conv);
 
-	/* From right to left... */
+	/* Remove anything else in our parent */
+	children = gtk_container_get_children(GTK_CONTAINER(parent));
+	while (children != NULL) {
+		gtk_container_remove(GTK_CONTAINER(parent), children->data);
+		children = g_list_remove(children, children->data);
+	}
+
+	/* The buttons, from left to right */
+
+	/* Invite */
+	gtkchat->invite = new_gtkconv_button(GAIM_STOCK_INVITE, _("Invite"),
+									_("Invite a usuer"),
+									gtkconv->tooltips, invite_cb, conv);
+	gtk_box_pack_start(GTK_BOX(parent), gtkchat->invite, TRUE, TRUE, 0);
+	gtk_size_group_add_widget(gtkconv->sg, gtkchat->invite);
+
+	/* Add button */
+	gtkconv->add = new_gtkconv_button(GTK_STOCK_ADD, _("Add"),
+									_("Add the chat to your buddy list"),
+									gtkconv->tooltips, add_remove_cb, conv);
+	gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, TRUE, TRUE, 0);
+	gtk_size_group_add_widget(gtkconv->sg, gtkconv->add);
+
+	/* Remove button */
+	gtkconv->remove = new_gtkconv_button(GTK_STOCK_REMOVE, _("Remove"),
+									_("Remove the chat from your buddy list"),
+									gtkconv->tooltips, add_remove_cb, conv);
+	gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, TRUE, TRUE, 0);
+	gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove);
 
 	/* Send button */
-	gtkconv->send = gaim_pixbuf_button_from_stock(_("Send"),
-										 GAIM_STOCK_SEND, GAIM_CONV_CHAT);
-	gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->send, _("Send"), NULL);
+	gtkconv->send = new_gtkconv_button(GAIM_STOCK_SEND, _("Send"),
+									_("Send message"),
+									gtkconv->tooltips, send_cb, conv);
 	gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0);
+	gtk_size_group_add_widget(gtkconv->sg, gtkconv->send);
 
 	/* Separator */
-	if (gtkchat->sep != NULL)
-		gtk_widget_destroy(gtkchat->sep);
-
 	gtkchat->sep = gtk_vseparator_new();
 	gtk_box_pack_end(GTK_BOX(parent), gtkchat->sep, FALSE, TRUE, 0);
 	gtk_widget_show(gtkchat->sep);
 
-	/* Invite */
-	gtkchat->invite = gaim_pixbuf_button_from_stock(_("Invite"),
-										   GAIM_STOCK_INVITE, GAIM_CONV_CHAT);
-	gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->invite,
-						 _("Invite a user"), NULL);
-	gtk_box_pack_start(GTK_BOX(parent), gtkchat->invite, FALSE, FALSE, 0);
-
-	/* Add button */
-	gtkconv->add = gaim_pixbuf_button_from_stock(_("Add"),
-									  GTK_STOCK_ADD, GAIM_CONV_CHAT);
-	gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->add,
-		_("Add the chat to your buddy list"), NULL);
-	gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, FALSE, FALSE, 0);
-
-	/* Remove button */
-	gtkconv->remove = gaim_pixbuf_button_from_stock(_("Remove"),
-									  GTK_STOCK_REMOVE, GAIM_CONV_CHAT);
-	gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->remove,
-		_("Remove the chat from your buddy list"), NULL);
-	gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, FALSE, FALSE, 0);
-
-	/* Set the relief on these. */
-	gtk_button_set_relief(GTK_BUTTON(gtkchat->invite), GTK_RELIEF_NONE);
-	gtk_button_set_relief(GTK_BUTTON(gtkconv->add),    GTK_RELIEF_NONE);
-	gtk_button_set_relief(GTK_BUTTON(gtkconv->remove), GTK_RELIEF_NONE);
-	gtk_button_set_relief(GTK_BUTTON(gtkconv->send),   GTK_RELIEF_NONE);
-
-	gtk_size_group_add_widget(gtkconv->sg, gtkchat->invite);
-	gtk_size_group_add_widget(gtkconv->sg, gtkconv->add);
-	gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove);
-	gtk_size_group_add_widget(gtkconv->sg, gtkconv->send);
-
-	gtk_box_reorder_child(GTK_BOX(parent), gtkconv->add,    1);
-	gtk_box_reorder_child(GTK_BOX(parent), gtkconv->remove, 3);
-	gtk_box_reorder_child(GTK_BOX(parent), gtkchat->invite, 3);
-
 	gaim_gtkconv_update_buttons_by_protocol(conv);
 
 	/* Check if the buttons should be visible or not */
@@ -3839,16 +3826,6 @@
 		gtk_widget_hide(gtkconv->bbox);
 	else
 		gtk_widget_show(gtkconv->bbox);
-
-	/* Callbacks */
-	g_signal_connect(G_OBJECT(gtkchat->invite), "clicked",
-					 G_CALLBACK(invite_cb), conv);
-	g_signal_connect(G_OBJECT(gtkconv->add), "clicked",
-					 G_CALLBACK(add_remove_cb), conv);
-	g_signal_connect(G_OBJECT(gtkconv->remove), "clicked",
-					 G_CALLBACK(add_remove_cb), conv);
-	g_signal_connect(G_OBJECT(gtkconv->send), "clicked",
-					 G_CALLBACK(send_cb), conv);
 }
 
 
@@ -4170,8 +4147,6 @@
 	/* Setup the bottom button box. */
 	gtkconv->bbox = gtk_hbox_new(FALSE, 6);
 	gtk_box_pack_start(GTK_BOX(vbox), gtkconv->bbox, FALSE, FALSE, 0);
-	gtk_widget_show(gtkconv->bbox);
-
 	setup_chat_buttons(conv, gtkconv->bbox);
 
 	/*
--- a/src/gtkutils.c	Sun Aug 15 15:08:25 2004 +0000
+++ b/src/gtkutils.c	Sun Aug 15 15:45:35 2004 +0000
@@ -232,31 +232,29 @@
 	button = gtk_button_new();
 
 	if (style == GAIM_BUTTON_HORIZONTAL) {
-			bbox = gtk_hbox_new(FALSE, 5);
-			ibox = gtk_hbox_new(FALSE, 0);
-			lbox = gtk_hbox_new(FALSE, 0);
-	}
-	else {
-			bbox = gtk_vbox_new(FALSE, 5);
-			ibox = gtk_vbox_new(FALSE, 0);
-			lbox = gtk_vbox_new(FALSE, 0);
+		bbox = gtk_hbox_new(FALSE, 0);
+		ibox = gtk_hbox_new(FALSE, 0);
+		lbox = gtk_hbox_new(FALSE, 0);
+	} else {
+		bbox = gtk_vbox_new(FALSE, 0);
+		ibox = gtk_vbox_new(FALSE, 0);
+		lbox = gtk_vbox_new(FALSE, 0);
 	}
 
-	gtk_container_add (GTK_CONTAINER(button), bbox);
-
-	gtk_box_pack_start_defaults(GTK_BOX(bbox), ibox);
-	gtk_box_pack_start_defaults(GTK_BOX(bbox), lbox);
+	gtk_container_add(GTK_CONTAINER(button), bbox);
 
 	if (icon) {
+		gtk_box_pack_start_defaults(GTK_BOX(bbox), ibox);
 		image = gtk_image_new_from_stock(icon, GTK_ICON_SIZE_BUTTON);
-		gtk_box_pack_end(GTK_BOX(ibox), image, FALSE, FALSE, 0);
+		gtk_box_pack_end(GTK_BOX(ibox), image, TRUE, TRUE, 0);
 	}
 
 	if (text) {
+		gtk_box_pack_start_defaults(GTK_BOX(bbox), lbox);
 		label = gtk_label_new(NULL);
 		gtk_label_set_text_with_mnemonic(GTK_LABEL(label), text);
 		gtk_label_set_mnemonic_widget(GTK_LABEL(label), button);
-		gtk_box_pack_start(GTK_BOX(lbox), label, FALSE, FALSE, 0);
+		gtk_box_pack_start(GTK_BOX(lbox), label, TRUE, TRUE, 0);
 		gaim_set_accessible_label (button, label);
 	}