changeset 27757:a8529c3dafe4

- revise handling of current_topic - get rid of warnings in menu code - now gtkconv only trancates tab titles
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Mon, 07 Jan 2008 18:17:44 +0000
parents 9983576f3aa4
children 4426e530c156
files pidgin/gtkconv.c
diffstat 1 files changed, 21 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkconv.c	Mon Jan 07 15:03:29 2008 +0000
+++ b/pidgin/gtkconv.c	Mon Jan 07 18:17:44 2008 +0000
@@ -2994,7 +2994,7 @@
 			"<StockItem>", GTK_STOCK_FIND },
 #else
 	{ N_("/Conversation/_Find..."), NULL, menu_find_cb, 0,
-			"<Item>" },
+      "<Item>", NULL },
 #endif
 	{ N_("/Conversation/View _Log"), NULL, menu_view_log_cb, 0, "<Item>", NULL },
 	{ N_("/Conversation/_Save As..."), NULL, menu_save_as_cb, 0,
@@ -3002,7 +3002,7 @@
 #if ENABLE_SHORTCUT
 	{ N_("/Conversation/Clea_r Scrollback"), "<CTL>L", menu_clear_cb, 0, "<StockItem>", GTK_STOCK_CLEAR },
 #else
-	{ N_("/Conversation/Clea_r Scrollback"), NULL, menu_clear_cb, 0, "<Item>" },
+	{ N_("/Conversation/Clea_r Scrollback"), NULL, menu_clear_cb, 0, "<Item>", NULL },
 #endif
 	{ "/Conversation/sep1", NULL, NULL, 0, "<Separator>", NULL },
 
@@ -4204,9 +4204,8 @@
 	PurpleConversation *conv = gtkconv->active_conv;
 	PidginChatPane *gtkchat;
 	char *new_topic;
-//	const char *current_topic;
+	const char *current_topic;
 	char dummy[] = "No Topic";
-	char *current_topic = NULL;
 
 	gc      = purple_conversation_get_gc(conv);
 
@@ -4219,19 +4218,14 @@
 	gtkconv = PIDGIN_CONVERSATION(conv);
 	gtkchat = gtkconv->u.chat;
 	new_topic = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text)));
-//	purple_debug_info("yaz gtkconv", "new_topic=%s\n", new_topic);
 	current_topic = purple_conv_chat_get_topic(PURPLE_CONV_CHAT(conv));
 
-	if(!current_topic)
- 		current_topic = dummy;
-//	purple_debug_info("yaz gtkconv", "current_topic=%s\n", current_topic);
-
 	if(current_topic && !g_utf8_collate(new_topic, current_topic)){
 		g_free(new_topic);
 		return;
 	}
 
-	gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), current_topic);
+	gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), current_topic ? current_topic : dummy);
 	prpl_info->set_chat_topic(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)),
 			new_topic);
 
@@ -6593,9 +6587,11 @@
 		PurplePresence *p = NULL;
 		char *markup = NULL;
 		AtkObject *accessibility_obj;
-		gboolean ellipsis = FALSE;
 		/* I think this is a little longer than it needs to be but I'm lazy. */
 		char *style;
+		gboolean ellipsis;
+		int side;
+		char *tab_title = NULL;
 
 		if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)
 			im = PURPLE_CONV_IM(conv);
@@ -6684,19 +6680,25 @@
 		}
 
 		// nosuke's tab width patch
-		if ((purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/tab_side") == (GTK_POS_LEFT|8)
-			 || purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/tab_side") == (GTK_POS_RIGHT|8))
-			&& purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/trim_vertical_tabs"))
+		side = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/tab_side");
+		side &= ~8; 
+		if ( (side == GTK_POS_LEFT || side == GTK_POS_RIGHT) &&
+		     purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/trim_vertical_tabs") )
 			ellipsis = TRUE;
+		else
+			ellipsis = FALSE;
 
 		if (ellipsis) {
-			gchar *title_tmp = title;
-			title = pidgin_gtk_ellipsis_text(gtkconv->tab_label, title_tmp, 60, "...");
-			g_free(title_tmp);
-        }
+			tab_title = pidgin_gtk_ellipsis_text(gtkconv->tab_label, title, 60, "...");
+		}
+		else {
+			tab_title = g_strdup(title);
+		}
 
 		gtk_widget_set_name(gtkconv->tab_label, style);
-		gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title);
+		gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), tab_title);
+		g_free(tab_title); tab_title = NULL;
+
 		gtk_widget_set_state(gtkconv->tab_label, GTK_STATE_ACTIVE);
 
 		if (gtkconv->unseen_state == PIDGIN_UNSEEN_TEXT ||