diff pidgin/gtkconv.c @ 25542:92d8c9b08dab

propagate from branch 'im.pidgin.pidgin' (head 90df17ab44d01f7f8f963d36fefb9eae3ec868cf) to branch 'im.pidgin.pidgin.yaz' (head ef6f65e1b1b0e5c23f07cf062691dcf6e5ee163c)
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Thu, 23 Aug 2007 06:53:06 +0000
parents cbc08c427db6 411b5a604a17
children 7f8cf35fc99b
line wrap: on
line diff
--- a/pidgin/gtkconv.c	Thu Aug 23 04:43:42 2007 +0000
+++ b/pidgin/gtkconv.c	Thu Aug 23 06:53:06 2007 +0000
@@ -108,6 +108,10 @@
 static GdkColor *nick_colors = NULL;
 static guint nbr_nick_colors;
 
+/* yaz. If you want to use shortcut keys that may conflict with
+   inputmethods, change this to 1. */
+#define ENABLE_SHORTCUT 0
+
 typedef struct {
 	GtkWidget *window;
 
@@ -2796,20 +2800,33 @@
 
 	{ "/Conversation/sep0", NULL, NULL, 0, "<Separator>", NULL },
 
+#if ENABLE_SHORTCUT
 	{ N_("/Conversation/_Find..."), NULL, menu_find_cb, 0,
 			"<StockItem>", GTK_STOCK_FIND },
+#else
+	{ N_("/Conversation/_Find..."), NULL, menu_find_cb, 0,
+			"<Item>" },
+#endif
 	{ N_("/Conversation/View _Log"), NULL, menu_view_log_cb, 0, "<Item>", NULL },
 	{ N_("/Conversation/_Save As..."), NULL, menu_save_as_cb, 0,
 			"<StockItem>", GTK_STOCK_SAVE_AS },
+#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>" },
+#endif
 	{ "/Conversation/sep1", NULL, NULL, 0, "<Separator>", NULL },
 
 	{ N_("/Conversation/Se_nd File..."), NULL, menu_send_file_cb, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_SEND_FILE },
 	{ N_("/Conversation/Add Buddy _Pounce..."), NULL, menu_add_pounce_cb,
 			0, "<Item>", NULL },
+#if ENABLE_SHORTCUT
 	{ N_("/Conversation/_Get Info"), "<CTL>O", menu_get_info_cb, 0,
 			"<StockItem>", PIDGIN_STOCK_TOOLBAR_USER_INFO },
+#else
+	{ N_("/Conversation/_Get Info"), NULL, menu_get_info_cb, 0,
+			"<StockItem>", PIDGIN_STOCK_TOOLBAR_USER_INFO },
+#endif
 	{ N_("/Conversation/In_vite..."), NULL, menu_invite_cb, 0,
 			"<Item>", NULL },
 	{ N_("/Conversation/M_ore"), NULL, NULL, 0, "<Branch>", NULL },
@@ -3515,7 +3532,12 @@
 		gtk_widget_destroy(win->menu.send_to);
 
 	/* Build the Send To menu */
+
+#if ENABLE_SHORTCUT
 	win->menu.send_to = gtk_menu_item_new_with_mnemonic(_("_Send To"));
+#else
+	win->menu.send_to = gtk_menu_item_new_with_mnemonic(_("Send To")); //to free Alt-s. intentional. --yaz
+#endif
 	gtk_widget_show(win->menu.send_to);
 
 	menu = gtk_menu_new();
@@ -3989,7 +4011,9 @@
 	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);
 
@@ -4002,8 +4026,13 @@
 	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;
@@ -6271,13 +6300,14 @@
 			(fields & PIDGIN_CONV_SET_TITLE) ||
     			(fields & PIDGIN_CONV_TOPIC))
 	{
-		char *title;
+		char *title, *title_tmp;
 		PurpleConvIm *im = NULL;
 		PurpleAccount *account = purple_conversation_get_account(conv);
 	 	PurpleBuddy *buddy = NULL;
 		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;
 
@@ -6343,11 +6373,23 @@
 			style = "";
 		}
 		
+		// 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"))
+			ellipsis = TRUE;
+
+		if (ellipsis)
+			title_tmp = pidgin_gtk_ellipsis_text(gtkconv->tab_label, title, 60, "...");
+		else
+			title_tmp = title;
+
+		
 		if (*style != '\0')
 		{
 			char *html_title,*label;
 
-			html_title = g_markup_escape_text(title, -1);
+			html_title = g_markup_escape_text(title_tmp, -1);
 			label = g_strdup_printf("<span %s>%s</span>",
 			                        style, html_title);
 			g_free(html_title);
@@ -6355,7 +6397,7 @@
 			g_free(label);
 		}
 		else
-			gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title);
+			gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title_tmp);
 		
 		if (pidgin_conv_window_is_active_conversation(conv))
 			update_typing_icon(gtkconv);
@@ -6712,6 +6754,24 @@
 	return page_num;
 }
 
+//nosuke
+static void
+trim_vertical_tabs_pref_cb(const char *name, PurplePrefType type,
+						   gconstpointer value, gpointer data)
+{
+	GList *l;
+	PurpleConversation *conv;
+
+	for (l = purple_get_conversations(); l != NULL; l = l->next) {
+		conv = (PurpleConversation *)l->data;
+
+		if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
+			continue;
+
+		pidgin_conv_update_fields(conv, PIDGIN_CONV_SET_TITLE);
+	}
+}
+
 static void
 close_on_tabs_pref_cb(const char *name, PurplePrefType type,
 					  gconstpointer value, gpointer data)
@@ -6781,6 +6841,7 @@
 			pidgin_conv_tab_pack(gtkwin, gtkconvs->data);
 		}
 	}
+	trim_vertical_tabs_pref_cb(name, type, value, data);
 }
 
 static void
@@ -7155,6 +7216,7 @@
 	purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations");
 	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/use_smooth_scrolling", TRUE);
 	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/close_on_tabs", TRUE);
+	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/trim_vertical_tabs", FALSE);
 	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_bold", FALSE);
 	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_italic", FALSE);
 	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_underline", FALSE);
@@ -7207,6 +7269,8 @@
 	/* Connect callbacks. */
 	purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/close_on_tabs",
 								close_on_tabs_pref_cb, NULL);
+	purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/trim_vertical_tabs",
+								  trim_vertical_tabs_pref_cb, NULL);
 	purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/show_timestamps",
 								show_timestamps_pref_cb, NULL);
 	purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar",