[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xchat-discuss
Subject:    a patch for cropping tab texts
From:       Jyrki Muukkonen <sibbe () sibbe ! dhs ! org>
Date:       2001-12-25 13:57:18
[Download RAW message or body]

I made this patch ages ago (= month). It crops the tab texts if they
exceed magic 10 char limit, so "#1234567890" would be shortened to
"#1234567..".

Here's a screenshot (16KB):
http://sibbe.dhs.org/~sibbe/patches/xchat-1.8.x/shot-crop_tabtexts.png

I needed this feature because I had a sh*tload of different networks and
channels in same xchat-client, and it was rather difficult to browse them.

There isn't any setting to switch this feature on/off yet, though it would
be easy to implement. I don't mind if someone else wants to sacrifice a
couple minutes for this ;) (I don't personally need the on/off switch)

Oh, one more thing, to get the most out of this patch, use the "order
tabs" patch announced in this list couple months ago.

--- clip ---

--- src/fe-gtk/maingui.c.orig	Sun Oct 28 11:23:18 2001
+++ src/fe-gtk/maingui.c	Thu Dec  6 21:55:35 2001
@@ -245,10 +245,21 @@
 void
 fe_set_channel (struct session *sess)
 {
+	char *buf;
+
 	wins_set_name (sess->gui->window, sess->channel);
 	/* toplevel dialogs dont have a changad */
-	if (sess->gui->changad != NULL)
-		gtk_label_set_text (GTK_LABEL (sess->gui->changad), sess->channel);
+	if (sess->gui->changad != NULL) {
+		if(strlen(sess->channel) > 10) {
+			buf = malloc(strlen(sess->channel));
+			snprintf(buf, 9, "%s", sess->channel);
+			strcat(buf, "..");
+			gtk_label_set_text(GTK_LABEL (sess->gui->changad), buf);
+			free(buf);
+		} else {
+			gtk_label_set_text (GTK_LABEL (sess->gui->changad), sess->channel);
+		}
+	}
 #ifdef USE_PANEL
 	if (sess->gui->panel_button)
 		gtk_label_set_text (GTK_LABEL
@@ -266,7 +277,12 @@
 	int i;

 	if (sess->waitchannel[0])
-		sprintf(tbuf, "(%s)", sess->waitchannel);
+		if(strlen(sess->waitchannel) > 10) {
+			snprintf(tbuf, 10, "(%s", sess->waitchannel);
+			strcat(tbuf, "..)");
+		} else {
+			sprintf(tbuf, "(%s)", sess->waitchannel);
+		}
 	else
 		strcpy (tbuf, _("<none>"));
 	gtk_entry_set_text (GTK_ENTRY (sess->gui->topicgad), "");

--- clip ---

--
jyrki muukkonen
sibbe@nic.fi


--
XChat-discuss: mailing list for XChat users
Archive:       http://mail.nl.linux.org/xchat-discuss/

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic