changeset 909:9f2afe5faed5

[gaim-migrate @ 919] yay, change IM windows automagically committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 14 Sep 2000 22:11:28 +0000
parents d0527e1d2050
children 568bb0f5c921
files src/buddy_chat.c src/conversation.c src/convo.h src/dialogs.c src/gaim.h src/prefs.c
diffstat 6 files changed, 97 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/src/buddy_chat.c	Thu Sep 14 21:11:08 2000 +0000
+++ b/src/buddy_chat.c	Thu Sep 14 22:11:28 2000 +0000
@@ -33,14 +33,9 @@
 
 #include "convo.h"
 
-#include "pixmaps/tmp_send.xpm"
-#include "pixmaps/close.xpm"
-#include "pixmaps/tb_search.xpm"
-
 #include "pixmaps/tb_forward.xpm"
 #include "pixmaps/join.xpm"
-#include "pixmaps/cancel.xpm"
-
+#include "pixmaps/close.xpm"
 
 static GtkWidget *joinchat;
 static GtkWidget *entry;
@@ -768,13 +763,16 @@
 
 }
 
-static GtkWidget *change_text(GtkWidget *win, char *text, GtkWidget *button, char **xpm)
+static GtkWidget *change_text(GtkWidget *win, char *text, GtkWidget *button, char **xpm, int opt)
 {
-	gboolean dispstyle = (display_options & OPT_DISP_CHAT_SHOW_TEXT) ? TRUE : FALSE;
+	gboolean dispstyle = (display_options & opt) ? TRUE : FALSE;
 	GtkWidget *parent = button->parent;
 	gtk_widget_destroy(button);
 	button = picture_button2(win, text, xpm, dispstyle);
-	gtk_box_pack_start(GTK_BOX(parent), button, dispstyle, dispstyle, 5);
+	if (opt == OPT_DISP_CHAT_SHOW_TEXT)
+		gtk_box_pack_start(GTK_BOX(parent), button, dispstyle, dispstyle, 5);
+	else
+		gtk_box_pack_end(GTK_BOX(parent), button, dispstyle, dispstyle, 0);
 	gtk_widget_show(button);
 	return button;
 }
@@ -783,13 +781,14 @@
 {
 	GList *bcs = buddy_chats;
 	struct conversation *c;
+	int opt = OPT_DISP_CHAT_SHOW_TEXT;
 
 	while (bcs) {
 		c = (struct conversation *)bcs->data;
-		c->send = change_text(c->window, _("Send"), c->send, tmp_send_xpm);
-		c->whisper = change_text(c->window, _("Whisper"), c->whisper, tb_forward_xpm);
-		c->invite = change_text(c->window, _("Invite"), c->invite, join_xpm);
-		c->close = change_text(c->window, _("Close"), c->close, cancel_xpm);
+		c->send = change_text(c->window, _("Send"), c->send, tmp_send_xpm, opt);
+		c->whisper = change_text(c->window, _("Whisper"), c->whisper, tb_forward_xpm, opt);
+		c->invite = change_text(c->window, _("Invite"), c->invite, join_xpm, opt);
+		c->close = change_text(c->window, _("Close"), c->close, cancel_xpm, opt);
 		gtk_object_set_user_data(GTK_OBJECT(c->close), c);
 		gtk_signal_connect(GTK_OBJECT(c->close), "clicked", GTK_SIGNAL_FUNC(close_callback),c);
 		gtk_signal_connect(GTK_OBJECT(c->send), "clicked", GTK_SIGNAL_FUNC(send_callback),c);
@@ -798,3 +797,42 @@
 		bcs = bcs->next;
 	}
 }
+
+void update_im_button_pix()
+{
+	GList *bcs = conversations;
+	struct conversation *c;
+	GtkWidget *parent;
+	int opt = OPT_DISP_CONV_SHOW_TEXT;
+	gboolean dispstyle = (display_options & opt) ? TRUE : FALSE;
+
+	while (bcs) {
+		c = (struct conversation *)bcs->data;
+		parent = c->close->parent;
+		c->close = change_text(c->window, _("Close"), c->close, cancel_xpm, opt);
+		gtk_box_reorder_child(GTK_BOX(parent), c->close, 0);
+		gtk_box_set_child_packing(GTK_BOX(parent), c->sep1, dispstyle, dispstyle, 0, GTK_PACK_END);
+		if (find_buddy(c->name) == NULL)
+			c->add = change_text(c->window, _("Add"), c->add, gnome_add_xpm, opt);
+		else
+			c->add = change_text(c->window, _("Remove"), c->add, gnome_remove_xpm, opt);
+		gtk_box_reorder_child(GTK_BOX(parent), c->add, 2);
+		c->block = change_text(c->window, _("Block"), c->block, block_xpm, opt);
+		gtk_box_reorder_child(GTK_BOX(parent), c->block, 3);
+		c->warn = change_text(c->window, _("Warn"), c->warn, warn_xpm, opt);
+		gtk_box_reorder_child(GTK_BOX(parent), c->warn, 4);
+		c->info = change_text(c->window, _("Info"), c->info, tb_search_xpm, opt);
+		gtk_box_reorder_child(GTK_BOX(parent), c->info, 5);
+		c->send = change_text(c->window, _("Send"), c->send, tmp_send_xpm, opt);
+		gtk_box_set_child_packing(GTK_BOX(parent), c->sep2, dispstyle, dispstyle, 0, GTK_PACK_END);
+		gtk_box_reorder_child(GTK_BOX(parent), c->send, 7);
+		gtk_object_set_user_data(GTK_OBJECT(c->close), c);
+		gtk_signal_connect(GTK_OBJECT(c->close), "clicked", GTK_SIGNAL_FUNC(close_callback),c);
+		gtk_signal_connect(GTK_OBJECT(c->send), "clicked", GTK_SIGNAL_FUNC(send_callback),c);
+		gtk_signal_connect(GTK_OBJECT(c->add), "clicked", GTK_SIGNAL_FUNC(add_callback),c);
+		gtk_signal_connect(GTK_OBJECT(c->info), "clicked", GTK_SIGNAL_FUNC(info_callback),c);
+		gtk_signal_connect(GTK_OBJECT(c->warn), "clicked", GTK_SIGNAL_FUNC(warn_callback),c);
+		gtk_signal_connect(GTK_OBJECT(c->block), "clicked", GTK_SIGNAL_FUNC(block_callback),c);
+		bcs = bcs->next;
+	}
+}
--- a/src/conversation.c	Thu Sep 14 21:11:08 2000 +0000
+++ b/src/conversation.c	Thu Sep 14 22:11:28 2000 +0000
@@ -67,16 +67,6 @@
 #include "pixmaps/luke03.xpm"
 #include "pixmaps/oneeye.xpm"
 
-#include "pixmaps/tmp_send.xpm"
-#include "pixmaps/gnome_remove.xpm"
-#include "pixmaps/gnome_add.xpm"
-#include "pixmaps/fgcolor.xpm"
-#include "pixmaps/bgcolor.xpm"
-#include "pixmaps/cancel.xpm"
-#include "pixmaps/warn.xpm"
-#include "pixmaps/tb_search.xpm"
-#include "pixmaps/block.xpm"
-
 int state_lock=0;
 
 GdkPixmap *dark_icon_pm = NULL;
@@ -438,17 +428,17 @@
 {
 	if (find_buddy(c->name) != NULL) {
 		gboolean dispstyle = (display_options & OPT_DISP_CONV_SHOW_TEXT) ? TRUE : FALSE;
-		GtkWidget *parent = c->add_button->parent;
+		GtkWidget *parent = c->add->parent;
 		sprintf(debug_buff,_("Removing '%s' from buddylist.\n"), c->name);
 		debug_print(debug_buff);
 		remove_buddy(find_group_by_buddy(c->name), find_buddy(c->name));
 		build_edit_tree();
-		gtk_widget_destroy(c->add_button);
-		c->add_button = picture_button2(c->window, _("Add"), gnome_add_xpm, dispstyle);
-		gtk_signal_connect(GTK_OBJECT(c->add_button), "clicked", GTK_SIGNAL_FUNC(add_callback), c);
-		gtk_box_pack_end(GTK_BOX(parent), c->add_button, dispstyle, dispstyle, 0);
-		gtk_box_reorder_child(GTK_BOX(parent), c->add_button, 1);
-		gtk_widget_show(c->add_button);
+		gtk_widget_destroy(c->add);
+		c->add = picture_button2(c->window, _("Add"), gnome_add_xpm, dispstyle);
+		gtk_signal_connect(GTK_OBJECT(c->add), "clicked", GTK_SIGNAL_FUNC(add_callback), c);
+		gtk_box_pack_end(GTK_BOX(parent), c->add, dispstyle, dispstyle, 0);
+		gtk_box_reorder_child(GTK_BOX(parent), c->add, 2);
+		gtk_widget_show(c->add);
 	}
 	else
 	{
@@ -1691,7 +1681,6 @@
 	gtk_object_set_user_data(GTK_OBJECT(entry), c);
 	c->entry = entry;
 	gtk_signal_connect(GTK_OBJECT(entry), "activate", GTK_SIGNAL_FUNC(send_callback),c);
-	c->add_button = add;
 		
 	/* Toolbar */
 	toolbar = build_conv_toolbar(c);
@@ -1720,11 +1709,17 @@
 	/* Ready and pack buttons */
 	gtk_object_set_user_data(GTK_OBJECT(win), c);
 	gtk_object_set_user_data(GTK_OBJECT(close), c);
+	c->close = close;
 	gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(close_callback), c);
+	c->send = send;
 	gtk_signal_connect(GTK_OBJECT(send), "clicked", GTK_SIGNAL_FUNC(send_callback), c);
+	c->add = add;
 	gtk_signal_connect(GTK_OBJECT(add), "clicked", GTK_SIGNAL_FUNC(add_callback), c);
+	c->info = info;
 	gtk_signal_connect(GTK_OBJECT(info), "clicked", GTK_SIGNAL_FUNC(info_callback), c);
+	c->warn = warn;
 	gtk_signal_connect(GTK_OBJECT(warn), "clicked", GTK_SIGNAL_FUNC(warn_callback), c);
+	c->block = block;
 	gtk_signal_connect(GTK_OBJECT(block), "clicked", GTK_SIGNAL_FUNC(block_callback), c);
        
 	gtk_signal_connect(GTK_OBJECT(entry), "key_press_event", GTK_SIGNAL_FUNC(keypress_callback), c);
@@ -1735,16 +1730,16 @@
 		gtk_widget_set_usize(entry, 300, 25);
 
 	gtk_box_pack_end(GTK_BOX(bbox), close, dispstyle, dispstyle, 0);
-	sep = gtk_vseparator_new();
-	gtk_widget_show(sep);
-	gtk_box_pack_end(GTK_BOX(bbox), sep, dispstyle, dispstyle, 0);
+	c->sep1 = gtk_vseparator_new();
+	gtk_widget_show(c->sep1);
+	gtk_box_pack_end(GTK_BOX(bbox), c->sep1, dispstyle, dispstyle, 0);
 	gtk_box_pack_end(GTK_BOX(bbox), add, dispstyle, dispstyle, 0);
 	gtk_box_pack_end(GTK_BOX(bbox), block, dispstyle, dispstyle, 0);
 	gtk_box_pack_end(GTK_BOX(bbox), warn, dispstyle, dispstyle, 0);
 	gtk_box_pack_end(GTK_BOX(bbox), info, dispstyle, dispstyle, 0);
-	sep = gtk_vseparator_new();
-	gtk_widget_show(sep);
-	gtk_box_pack_end(GTK_BOX(bbox), sep, dispstyle, dispstyle, 0);
+	c->sep2 = gtk_vseparator_new();
+	gtk_widget_show(c->sep2);
+	gtk_box_pack_end(GTK_BOX(bbox), c->sep2, dispstyle, dispstyle, 0);
 	gtk_box_pack_end(GTK_BOX(bbox), send, dispstyle, dispstyle, 0);
 	
 	/* pack and fill the rest */
--- a/src/convo.h	Thu Sep 14 21:11:08 2000 +0000
+++ b/src/convo.h	Thu Sep 14 22:11:28 2000 +0000
@@ -25,6 +25,15 @@
 #include <gtk/gtk.h>
 #include "gaim.h"
 
+#include "pixmaps/tmp_send.xpm"
+#include "pixmaps/gnome_remove.xpm"
+#include "pixmaps/gnome_add.xpm"
+#include "pixmaps/fgcolor.xpm"
+#include "pixmaps/bgcolor.xpm"
+#include "pixmaps/cancel.xpm"
+#include "pixmaps/warn.xpm"
+#include "pixmaps/tb_search.xpm"
+#include "pixmaps/block.xpm"
 
 /* we declare all of the global functions for chat and IM windows here, so
  * that it's easy to keep them merged. */
--- a/src/dialogs.c	Thu Sep 14 21:11:08 2000 +0000
+++ b/src/dialogs.c	Thu Sep 14 22:11:28 2000 +0000
@@ -778,13 +778,13 @@
 
         if (c != NULL) {
 		gboolean dispstyle = (display_options & OPT_DISP_CONV_SHOW_TEXT) ? TRUE : FALSE;
-		GtkWidget *parent = c->add_button->parent;
-		gtk_widget_destroy(c->add_button);
-		c->add_button = picture_button2(c->window, _("Remove"), gnome_remove_xpm, dispstyle);
-		gtk_signal_connect(GTK_OBJECT(c->add_button), "clicked", GTK_SIGNAL_FUNC(add_callback), c);
-		gtk_box_pack_end(GTK_BOX(parent), c->add_button, dispstyle, dispstyle, 0);
-		gtk_box_reorder_child(GTK_BOX(parent), c->add_button, 1);
-		gtk_widget_show(c->add_button);
+		GtkWidget *parent = c->add->parent;
+		gtk_widget_destroy(c->add);
+		c->add = picture_button2(c->window, _("Remove"), gnome_remove_xpm, dispstyle);
+		gtk_signal_connect(GTK_OBJECT(c->add), "clicked", GTK_SIGNAL_FUNC(add_callback), c);
+		gtk_box_pack_end(GTK_BOX(parent), c->add, dispstyle, dispstyle, 0);
+		gtk_box_reorder_child(GTK_BOX(parent), c->add, 2);
+		gtk_widget_show(c->add);
 	}
         
         build_edit_tree();
--- a/src/gaim.h	Thu Sep 14 21:11:08 2000 +0000
+++ b/src/gaim.h	Thu Sep 14 22:11:28 2000 +0000
@@ -287,8 +287,15 @@
 	GdkColor fgcol;
 	int hasfg;
 
+	GtkWidget *send;
+
 	/* stuff used just for IM */
-	GtkWidget *add_button;
+	GtkWidget *info;
+	GtkWidget *warn;
+	GtkWidget *block;
+	GtkWidget *add;
+	GtkWidget *sep1;
+	GtkWidget *sep2;
  	time_t sent_away;
 
 	/* stuff used just for chat */
@@ -296,7 +303,6 @@
         GList *ignored;
         int id;
 	GtkWidget *list;
-	GtkWidget *send;
 	GtkWidget *whisper;
 	GtkWidget *invite;
 	GtkWidget *close;
@@ -408,7 +414,7 @@
 #define TYPE_SIGNOFF   4
 #define TYPE_KEEPALIVE 5
 
-#define REVISION "gaim:$Revision: 914 $"
+#define REVISION "gaim:$Revision: 919 $"
 #define FLAPON "FLAPON\r\n\r\n"
 
 #define ROAST "Tic/Toc"
@@ -569,6 +575,7 @@
 extern void build_imchat_box(gboolean);
 extern void do_quit();
 extern void update_chat_button_pix();
+extern void update_im_button_pix();
 
 
 
--- a/src/prefs.c	Thu Sep 14 21:11:08 2000 +0000
+++ b/src/prefs.c	Thu Sep 14 22:11:28 2000 +0000
@@ -1765,6 +1765,7 @@
 	if (blist) update_button_pix();
 
 	update_chat_button_pix();
+	update_im_button_pix();
 
 #ifdef USE_APPLET
 	update_pixmaps();