changeset 4445:a65555132674

[gaim-migrate @ 4720] "Who's the idiot now, moron?" An option to remove the 'X' button from the tabs. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Tue, 28 Jan 2003 06:55:23 +0000
parents fd83159169db
children 0acbf78f272f
files src/gaim.h src/gtkconv.c src/gtkconv.h src/prefs.c
diffstat 4 files changed, 47 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/gaim.h	Tue Jan 28 06:51:58 2003 +0000
+++ b/src/gaim.h	Tue Jan 28 06:55:23 2003 +0000
@@ -253,6 +253,7 @@
 #define OPT_CONVO_IGNORE_SIZES		0x00001000
 #define OPT_CONVO_COMBINE		0x00002000
 #define OPT_CONVO_CTL_W_CLOSES          0x00004000
+#define OPT_CONVO_NO_X_ON_TAB		0x00008000
 
 extern guint im_options;
 #define OPT_IM_POPUP			0x00000001
--- a/src/gtkconv.c	Tue Jan 28 06:51:58 2003 +0000
+++ b/src/gtkconv.c	Tue Jan 28 06:55:23 2003 +0000
@@ -3381,14 +3381,14 @@
 	gtkconv->close = gtk_button_new();
 	gtk_widget_set_size_request(GTK_WIDGET(gtkconv->close), 16, 16);
 	gtk_container_add(GTK_CONTAINER(gtkconv->close),
-					  gtk_image_new_from_stock(GTK_STOCK_CLOSE,
-											   GTK_ICON_SIZE_MENU));
+			  gtk_image_new_from_stock(GTK_STOCK_CLOSE,
+			  GTK_ICON_SIZE_MENU));
 	gtk_button_set_relief(GTK_BUTTON(gtkconv->close), GTK_RELIEF_NONE);
 	gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close,
-						 _("Close conversation"), NULL);
+    			 _("Close conversation"), NULL);
 
 	g_signal_connect(G_OBJECT(gtkconv->close), "clicked",
-					 G_CALLBACK(close_conv_cb), conv);
+			 G_CALLBACK(close_conv_cb), conv);
 
 	/* Tab label. */
 	gtkconv->tab_label = gtk_label_new(gaim_conversation_get_title(conv));
@@ -3399,8 +3399,11 @@
 
 	/* Pack it all together. */
 	gtk_box_pack_start(GTK_BOX(tabby), gtkconv->tab_label, TRUE, TRUE, 0);
-	gtk_box_pack_start(GTK_BOX(tabby), gtkconv->close,     FALSE, FALSE, 0);
-	gtk_widget_show_all(tabby);
+	gtk_widget_show(gtkconv->tab_label);
+	gtk_box_pack_start(GTK_BOX(tabby), gtkconv->close, FALSE, FALSE, 0);
+	if (!(convo_options & OPT_CONVO_NO_X_ON_TAB)) 
+		gtk_widget_show_all(gtkconv->close);
+	gtk_widget_show(tabby);
 
 
 	/* Add this pane to the conversations notebook. */
@@ -4268,6 +4271,27 @@
 #endif
 }
 
+void
+gaim_gtkconv_toggle_close_buttons(void)
+{
+	GList *cl;
+	struct gaim_conversation *conv;
+	struct gaim_gtk_conversation *gtkconv;
+	
+	for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) {
+		conv = (struct gaim_conversation *)cl->data;
+		if (!GAIM_IS_GTK_CONVERSATION(conv))
+			continue;
+
+		gtkconv = GAIM_GTK_CONVERSATION(conv);
+
+		if (convo_options & OPT_CONVO_NO_X_ON_TAB)
+			gtk_widget_hide(gtkconv->close);
+		else
+			gtk_widget_show_all(gtkconv->close);
+	}
+}
+
 static void
 remove_icon(struct gaim_gtk_conversation *gtkconv)
 {
--- a/src/gtkconv.h	Tue Jan 28 06:51:58 2003 +0000
+++ b/src/gtkconv.h	Tue Jan 28 06:55:23 2003 +0000
@@ -227,6 +227,11 @@
 void gaim_gtkconv_toggle_spellchk(void);
 
 /**
+ * Toggles the presence of close buttons on tabs
+ */
+void gaim_gtkconv_toggle_close_buttons(void);
+
+/**
  * Updates the buddy icon on a conversation.
  *
  * @param conv The conversation.
--- a/src/prefs.c	Tue Jan 28 06:51:58 2003 +0000
+++ b/src/prefs.c	Tue Jan 28 06:55:23 2003 +0000
@@ -647,6 +647,7 @@
 	GtkWidget *ret;
 	GtkWidget *vbox;
 	GtkWidget *dd;
+	GtkWidget *button;
 	GtkSizeGroup *sg;
 	ret = gtk_vbox_new(FALSE, 18);
 	gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
@@ -673,15 +674,19 @@
 	gaim_button(_("Show all c_hats in one tabbed window"), &chat_options, OPT_CHAT_ONE_WINDOW,
 		    vbox);
 
-	vbox = make_frame (ret, _("Combined Tabs"));
-	gaim_button(_("Show IMs and chats in _same tabbed\nwindow."), &convo_options, OPT_CONVO_COMBINE, vbox);
-
 	vbox = make_frame (ret, _("Buddy List Tabs"));
 	dd = gaim_dropdown(vbox, _("Tab _placement:"), &blist_options, OPT_BLIST_BOTTOM_TAB,
 		      _("Top"), 0,
 		      _("Bottom"), OPT_BLIST_BOTTOM_TAB, NULL);
 	gtk_size_group_add_widget(sg, dd);
 
+	vbox = make_frame (ret, _("Tab Options"));
+	gaim_button(_("Show IMs and chats in _same tabbed window."), &convo_options, OPT_CONVO_COMBINE, vbox);
+	button = gaim_button(_("Show _close button on tabs."), &convo_options, OPT_CONVO_NO_X_ON_TAB, vbox);
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)));
+	convo_options ^= OPT_CONVO_NO_X_ON_TAB;
+
+
 	gtk_widget_show_all(ret);
 	return ret;
 }
@@ -1976,6 +1981,9 @@
 
 	if (option == OPT_CONVO_CHECK_SPELLING)
 		gaim_gtkconv_toggle_spellchk();
+
+	if (option == OPT_CONVO_NO_X_ON_TAB)
+		gaim_gtkconv_toggle_close_buttons();
 }
 
 static void set_im_option(GtkWidget *w, int option)