comparison pidgin/gtkconv.c @ 27937:1337d2813b2d

propagate from branch 'im.pidgin.pidgin' (head 5ab68ddb0251205f7ef97f4c280e65696cbd5ff2) to branch 'im.pidgin.pidgin.yaz' (head 7a5d48783707dd377fd754961d3b009c3e492827)
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 07 Apr 2009 14:32:50 +0000
parents e1523f30bdb5 f33f4ddbf01a
children b623c1824f29
comparison
equal deleted inserted replaced
26588:1a94a964bddf 27937:1337d2813b2d
1 /* -*- coding: utf-8 -*- */
1 /** 2 /**
2 * @file gtkconv.c GTK+ Conversation API 3 * @file gtkconv.c GTK+ Conversation API
3 * @ingroup pidgin 4 * @ingroup pidgin
4 */ 5 */
5 6
118 119
119 #define NUM_NICK_COLORS 220 120 #define NUM_NICK_COLORS 220
120 static GdkColor *nick_colors = NULL; 121 static GdkColor *nick_colors = NULL;
121 static guint nbr_nick_colors; 122 static guint nbr_nick_colors;
122 123
124 /* yaz. If you want to use shortcut keys that may conflict with
125 inputmethods, change this to 1. */
126 #define ENABLE_SHORTCUT 0
127
123 typedef struct { 128 typedef struct {
124 GtkWidget *window; 129 GtkWidget *window;
125 130
126 GtkWidget *entry; 131 GtkWidget *entry;
127 GtkWidget *message; 132 GtkWidget *message;
272 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/chat/userlist_width", allocation->width == 1 ? 0 : allocation->width); 277 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/chat/userlist_width", allocation->width == 1 ? 0 : allocation->width);
273 278
274 return FALSE; 279 return FALSE;
275 } 280 }
276 281
282 static gboolean
283 size_allocate_cb(GtkWidget *w, GtkAllocation *allocation, PidginConversation *gtkconv)
284 {
285 PurpleConversation *conv = gtkconv->active_conv;
286
287 if (!GTK_WIDGET_VISIBLE(w))
288 return FALSE;
289
290 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
291 return FALSE;
292 if (gtkconv->auto_resize) {
293 return FALSE;
294 }
295
296 if (gdk_window_get_state(gtkconv->win->window->window) & GDK_WINDOW_STATE_MAXIMIZED) {
297 return FALSE;
298 }
299
300 /* I find that I resize the window when it has a bunch of conversations in it, mostly so that the
301 * tab bar will fit, but then I don't want new windows taking up the entire screen. I check to see
302 * if there is only one conversation in the window. This way we'll be setting new windows to the
303 * size of the last resized new window. */
304 /* I think that the above justification is not the majority, and that the new tab resizing should
305 * negate it anyway. --luke */
306 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)
307 {
308 if (w == gtkconv->lower_hbox)
309 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/entry_height", allocation->height);
310 }
311 else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT)
312 {
313 if (w == gtkconv->lower_hbox)
314 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/chat/entry_height", allocation->height);
315 }
316 return FALSE;
317 }
318
277 static void 319 static void
278 default_formatize(PidginConversation *c) 320 default_formatize(PidginConversation *c)
279 { 321 {
280 PurpleConversation *conv = c->active_conv; 322 PurpleConversation *conv = c->active_conv;
281 gtk_imhtml_setup_entry(GTK_IMHTML(c->entry), conv->features); 323 gtk_imhtml_setup_entry(GTK_IMHTML(c->entry), conv->features);
421 first = g_list_first(gtkconv->send_history); 463 first = g_list_first(gtkconv->send_history);
422 g_free(first->data); 464 g_free(first->data);
423 first->data = g_strdup(message); 465 first->data = g_strdup(message);
424 gtkconv->send_history = g_list_prepend(first, NULL); 466 gtkconv->send_history = g_list_prepend(first, NULL);
425 } 467 }
468
469 #if 0
470 static void
471 reset_default_size(PidginConversation *gtkconv)
472 {
473 PurpleConversation *conv = gtkconv->active_conv;
474 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT)
475 gtk_widget_set_size_request(gtkconv->lower_hbox, -1,
476 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/chat/entry_height"));
477 else
478 gtk_widget_set_size_request(gtkconv->lower_hbox, -1,
479 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/im/entry_height"));
480 }
481 #endif
426 482
427 static gboolean 483 static gboolean
428 check_for_and_do_command(PurpleConversation *conv) 484 check_for_and_do_command(PurpleConversation *conv)
429 { 485 {
430 PidginConversation *gtkconv; 486 PidginConversation *gtkconv;
3120 { N_("/Conversation/New Instant _Message..."), "<CTL>M", menu_new_conv_cb, 3176 { N_("/Conversation/New Instant _Message..."), "<CTL>M", menu_new_conv_cb,
3121 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW }, 3177 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW },
3122 3178
3123 { "/Conversation/sep0", NULL, NULL, 0, "<Separator>", NULL }, 3179 { "/Conversation/sep0", NULL, NULL, 0, "<Separator>", NULL },
3124 3180
3181 #if ENABLE_SHORTCUT
3125 { N_("/Conversation/_Find..."), NULL, menu_find_cb, 0, 3182 { N_("/Conversation/_Find..."), NULL, menu_find_cb, 0,
3126 "<StockItem>", GTK_STOCK_FIND }, 3183 "<StockItem>", GTK_STOCK_FIND },
3184 #else
3185 { N_("/Conversation/_Find..."), NULL, menu_find_cb, 0,
3186 "<Item>", NULL },
3187 #endif
3127 { N_("/Conversation/View _Log"), NULL, menu_view_log_cb, 0, "<Item>", NULL }, 3188 { N_("/Conversation/View _Log"), NULL, menu_view_log_cb, 0, "<Item>", NULL },
3128 { N_("/Conversation/_Save As..."), NULL, menu_save_as_cb, 0, 3189 { N_("/Conversation/_Save As..."), NULL, menu_save_as_cb, 0,
3129 "<StockItem>", GTK_STOCK_SAVE_AS }, 3190 "<StockItem>", GTK_STOCK_SAVE_AS },
3191 #if ENABLE_SHORTCUT
3130 { N_("/Conversation/Clea_r Scrollback"), "<CTL>L", menu_clear_cb, 0, "<StockItem>", GTK_STOCK_CLEAR }, 3192 { N_("/Conversation/Clea_r Scrollback"), "<CTL>L", menu_clear_cb, 0, "<StockItem>", GTK_STOCK_CLEAR },
3131 3193 #else
3194 { N_("/Conversation/Clea_r Scrollback"), NULL, menu_clear_cb, 0, "<Item>", NULL },
3195 #endif
3132 { "/Conversation/sep1", NULL, NULL, 0, "<Separator>", NULL }, 3196 { "/Conversation/sep1", NULL, NULL, 0, "<Separator>", NULL },
3133 3197
3134 #ifdef USE_VV 3198 #ifdef USE_VV
3135 { N_("/Conversation/M_edia"), NULL, NULL, 0, "<Branch>", NULL }, 3199 { N_("/Conversation/M_edia"), NULL, NULL, 0, "<Branch>", NULL },
3136 3200
3143 #endif 3207 #endif
3144 3208
3145 { N_("/Conversation/Se_nd File..."), NULL, menu_send_file_cb, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_SEND_FILE }, 3209 { N_("/Conversation/Se_nd File..."), NULL, menu_send_file_cb, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_SEND_FILE },
3146 { N_("/Conversation/Add Buddy _Pounce..."), NULL, menu_add_pounce_cb, 3210 { N_("/Conversation/Add Buddy _Pounce..."), NULL, menu_add_pounce_cb,
3147 0, "<Item>", NULL }, 3211 0, "<Item>", NULL },
3212 #if ENABLE_SHORTCUT
3148 { N_("/Conversation/_Get Info"), "<CTL>O", menu_get_info_cb, 0, 3213 { N_("/Conversation/_Get Info"), "<CTL>O", menu_get_info_cb, 0,
3149 "<StockItem>", PIDGIN_STOCK_TOOLBAR_USER_INFO }, 3214 "<StockItem>", PIDGIN_STOCK_TOOLBAR_USER_INFO },
3215 #else
3216 { N_("/Conversation/_Get Info"), NULL, menu_get_info_cb, 0,
3217 "<StockItem>", PIDGIN_STOCK_TOOLBAR_USER_INFO },
3218 #endif
3150 { N_("/Conversation/In_vite..."), NULL, menu_invite_cb, 0, 3219 { N_("/Conversation/In_vite..."), NULL, menu_invite_cb, 0,
3151 "<Item>", NULL }, 3220 "<Item>", NULL },
3152 { N_("/Conversation/M_ore"), NULL, NULL, 0, "<Branch>", NULL }, 3221 { N_("/Conversation/M_ore"), NULL, NULL, 0, "<Branch>", NULL },
3153 3222
3154 { "/Conversation/sep2", NULL, NULL, 0, "<Separator>", NULL }, 3223 { "/Conversation/sep2", NULL, NULL, 0, "<Separator>", NULL },
3869 3938
3870 if (win->menu.send_to != NULL) 3939 if (win->menu.send_to != NULL)
3871 gtk_widget_destroy(win->menu.send_to); 3940 gtk_widget_destroy(win->menu.send_to);
3872 3941
3873 /* Build the Send To menu */ 3942 /* Build the Send To menu */
3943 #if ENABLE_SHORTCUT
3874 win->menu.send_to = gtk_menu_item_new_with_mnemonic(_("S_end To")); 3944 win->menu.send_to = gtk_menu_item_new_with_mnemonic(_("S_end To"));
3945 #else
3946 win->menu.send_to = gtk_menu_item_new_with_mnemonic(_("Send To")); //to free Alt-s. intentional. --yaz
3947 #endif
3875 gtk_widget_show(win->menu.send_to); 3948 gtk_widget_show(win->menu.send_to);
3876 3949
3877 menu = gtk_menu_new(); 3950 menu = gtk_menu_new();
3878 gtk_menu_shell_insert(GTK_MENU_SHELL(win->menu.menubar), 3951 gtk_menu_shell_insert(GTK_MENU_SHELL(win->menu.menubar),
3879 win->menu.send_to, 2); 3952 win->menu.send_to, 2);
4294 PurpleConnection *gc; 4367 PurpleConnection *gc;
4295 PurpleConversation *conv = gtkconv->active_conv; 4368 PurpleConversation *conv = gtkconv->active_conv;
4296 PidginChatPane *gtkchat; 4369 PidginChatPane *gtkchat;
4297 char *new_topic; 4370 char *new_topic;
4298 const char *current_topic; 4371 const char *current_topic;
4372 char dummy[] = "No Topic";
4299 4373
4300 gc = purple_conversation_get_gc(conv); 4374 gc = purple_conversation_get_gc(conv);
4301 4375
4302 if(!gc || !(prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl))) 4376 if(!gc || !(prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)))
4303 return; 4377 return;
4313 if(current_topic && !g_utf8_collate(new_topic, current_topic)){ 4387 if(current_topic && !g_utf8_collate(new_topic, current_topic)){
4314 g_free(new_topic); 4388 g_free(new_topic);
4315 return; 4389 return;
4316 } 4390 }
4317 4391
4318 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), current_topic); 4392 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), current_topic ? current_topic : dummy);
4319 prpl_info->set_chat_topic(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), 4393 prpl_info->set_chat_topic(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)),
4320 new_topic); 4394 new_topic);
4321 4395
4322 g_free(new_topic); 4396 g_free(new_topic);
4323 } 4397 }
4589 * is the beginning of a new paragraph. */ 4663 * is the beginning of a new paragraph. */
4590 min_height = min_lines * (oneline.height + MAX(pad_inside, pad_top + pad_bottom)); 4664 min_height = min_lines * (oneline.height + MAX(pad_inside, pad_top + pad_bottom));
4591 height = CLAMP(height, MIN(min_height, max_height), max_height); 4665 height = CLAMP(height, MIN(min_height, max_height), max_height);
4592 4666
4593 diff = height - gtkconv->entry->allocation.height; 4667 diff = height - gtkconv->entry->allocation.height;
4594 if (ABS(diff) < oneline.height / 2) 4668 if (diff == 0 || (diff < 0 && -diff < oneline.height / 2))
4595 return FALSE; 4669 return FALSE;
4596
4597 gtk_widget_set_size_request(gtkconv->lower_hbox, -1, 4670 gtk_widget_set_size_request(gtkconv->lower_hbox, -1,
4598 diff + gtkconv->lower_hbox->allocation.height); 4671 diff + gtkconv->lower_hbox->allocation.height);
4599
4600 return FALSE; 4672 return FALSE;
4601 } 4673 }
4602 4674
4603 static void 4675 static void
4604 minimum_entry_lines_pref_cb(const char *name, 4676 minimum_entry_lines_pref_cb(const char *name,
4809 } 4881 }
4810 4882
4811 static GtkWidget * 4883 static GtkWidget *
4812 setup_common_pane(PidginConversation *gtkconv) 4884 setup_common_pane(PidginConversation *gtkconv)
4813 { 4885 {
4814 GtkWidget *vbox, *frame, *imhtml_sw, *event_box; 4886 GtkWidget *paned, *vbox, *frame, *imhtml_sw, *event_box;
4815 GtkCellRenderer *rend; 4887 GtkCellRenderer *rend;
4816 GtkTreePath *path; 4888 GtkTreePath *path;
4817 PurpleConversation *conv = gtkconv->active_conv; 4889 PurpleConversation *conv = gtkconv->active_conv;
4818 PurpleBuddy *buddy; 4890 PurpleBuddy *buddy;
4819 gboolean chat = (conv->type == PURPLE_CONV_TYPE_CHAT); 4891 gboolean chat = (conv->type == PURPLE_CONV_TYPE_CHAT);
4820 GtkPolicyType imhtml_sw_hscroll; 4892 GtkPolicyType imhtml_sw_hscroll;
4821 int buddyicon_size = 0; 4893 int buddyicon_size = 0;
4822 4894
4895 paned = gtk_vpaned_new();
4896 gtk_widget_show(paned);
4897
4823 /* Setup the top part of the pane */ 4898 /* Setup the top part of the pane */
4824 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); 4899 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
4900 gtk_paned_pack1(GTK_PANED(paned), vbox, TRUE, TRUE);
4825 gtk_widget_show(vbox); 4901 gtk_widget_show(vbox);
4826 4902
4827 /* Setup the info pane */ 4903 /* Setup the info pane */
4828 event_box = gtk_event_box_new(); 4904 event_box = gtk_event_box_new();
4829 #if GTK_CHECK_VERSION(2,4,0) 4905 #if GTK_CHECK_VERSION(2,4,0)
4923 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", 4999 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event",
4924 G_CALLBACK(refocus_entry_cb), gtkconv); 5000 G_CALLBACK(refocus_entry_cb), gtkconv);
4925 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", 5001 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event",
4926 G_CALLBACK(refocus_entry_cb), gtkconv); 5002 G_CALLBACK(refocus_entry_cb), gtkconv);
4927 5003
5004 /* Setup the bottom half of the conversation window */
5005 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
5006 gtk_paned_pack2(GTK_PANED(paned), vbox, FALSE, TRUE);
5007 gtk_widget_show(vbox);
5008
4928 gtkconv->lower_hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); 5009 gtkconv->lower_hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
4929 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->lower_hbox, FALSE, FALSE, 0); 5010 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->lower_hbox, TRUE, TRUE, 0);
4930 gtk_widget_show(gtkconv->lower_hbox); 5011 gtk_widget_show(gtkconv->lower_hbox);
5012
5013 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
5014 gtk_box_pack_end(GTK_BOX(gtkconv->lower_hbox), vbox, TRUE, TRUE, 0);
5015 gtk_widget_show(vbox);
4931 5016
4932 /* Setup the toolbar, entry widget and all signals */ 5017 /* Setup the toolbar, entry widget and all signals */
4933 frame = pidgin_create_imhtml(TRUE, &gtkconv->entry, &gtkconv->toolbar, NULL); 5018 frame = pidgin_create_imhtml(TRUE, &gtkconv->entry, &gtkconv->toolbar, NULL);
4934 gtk_box_pack_start(GTK_BOX(gtkconv->lower_hbox), frame, TRUE, TRUE, 0); 5019 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
4935 gtk_widget_show(frame); 5020 gtk_widget_show(frame);
4936 5021
4937 gtk_widget_set_name(gtkconv->entry, "pidgin_conv_entry"); 5022 gtk_widget_set_name(gtkconv->entry, "pidgin_conv_entry");
4938 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), 5023 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry),
4939 purple_account_get_protocol_name(conv->account)); 5024 purple_account_get_protocol_name(conv->account));
5025 gtk_widget_set_size_request(gtkconv->lower_hbox, -1,
5026 chat ? purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/chat/entry_height") :
5027 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/im/entry_height"));
4940 5028
4941 g_signal_connect(G_OBJECT(gtkconv->entry), "populate-popup", 5029 g_signal_connect(G_OBJECT(gtkconv->entry), "populate-popup",
4942 G_CALLBACK(entry_popup_menu_cb), gtkconv); 5030 G_CALLBACK(entry_popup_menu_cb), gtkconv);
4943 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", 5031 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event",
4944 G_CALLBACK(entry_key_press_cb), gtkconv); 5032 G_CALLBACK(entry_key_press_cb), gtkconv);
4945 g_signal_connect_after(G_OBJECT(gtkconv->entry), "message_send", 5033 g_signal_connect_after(G_OBJECT(gtkconv->entry), "message_send",
4946 G_CALLBACK(send_cb), gtkconv); 5034 G_CALLBACK(send_cb), gtkconv);
4947 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", 5035 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event",
4948 G_CALLBACK(entry_stop_rclick_cb), NULL); 5036 G_CALLBACK(entry_stop_rclick_cb), NULL);
5037 g_signal_connect(G_OBJECT(gtkconv->lower_hbox), "size-allocate",
5038 G_CALLBACK(size_allocate_cb), gtkconv);
4949 5039
4950 gtkconv->entry_buffer = 5040 gtkconv->entry_buffer =
4951 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); 5041 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry));
4952 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", gtkconv); 5042 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", gtkconv);
4953 5043
4968 G_CALLBACK(resize_imhtml_cb), gtkconv); 5058 G_CALLBACK(resize_imhtml_cb), gtkconv);
4969 5059
4970 default_formatize(gtkconv); 5060 default_formatize(gtkconv);
4971 g_signal_connect_after(G_OBJECT(gtkconv->entry), "format_function_clear", 5061 g_signal_connect_after(G_OBJECT(gtkconv->entry), "format_function_clear",
4972 G_CALLBACK(clear_formatting_cb), gtkconv); 5062 G_CALLBACK(clear_formatting_cb), gtkconv);
4973 return vbox; 5063 return paned;
4974 } 5064 }
4975 5065
4976 static void 5066 static void
4977 conv_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, 5067 conv_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y,
4978 GtkSelectionData *sd, guint info, guint t, 5068 GtkSelectionData *sd, guint info, guint t,
6622 PurplePresence *p = NULL; 6712 PurplePresence *p = NULL;
6623 char *markup = NULL; 6713 char *markup = NULL;
6624 AtkObject *accessibility_obj; 6714 AtkObject *accessibility_obj;
6625 /* I think this is a little longer than it needs to be but I'm lazy. */ 6715 /* I think this is a little longer than it needs to be but I'm lazy. */
6626 char *style; 6716 char *style;
6717 gboolean ellipsis;
6718 int side;
6719 char *tab_title = NULL;
6627 6720
6628 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) 6721 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)
6629 im = PURPLE_CONV_IM(conv); 6722 im = PURPLE_CONV_IM(conv);
6630 6723
6631 if ((account == NULL) || 6724 if ((account == NULL) ||
6716 style = "tab-label-event"; 6809 style = "tab-label-event";
6717 } else { 6810 } else {
6718 style = NULL; 6811 style = NULL;
6719 } 6812 }
6720 6813
6814 // nosuke's tab width patch
6815 side = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/tab_side");
6816 side &= ~8;
6817 if ( (side == GTK_POS_LEFT || side == GTK_POS_RIGHT) &&
6818 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/trim_vertical_tabs") )
6819 ellipsis = TRUE;
6820 else
6821 ellipsis = FALSE;
6822
6823 if (ellipsis) {
6824 tab_title = pidgin_gtk_ellipsis_text(gtkconv->tab_label, title, 60, "...");
6825 }
6826 else {
6827 tab_title = g_strdup(title);
6828 }
6829
6721 gtk_widget_set_name(gtkconv->tab_label, style); 6830 gtk_widget_set_name(gtkconv->tab_label, style);
6722 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title); 6831 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), tab_title);
6832 g_free(tab_title); tab_title = NULL;
6833
6723 gtk_widget_set_state(gtkconv->tab_label, GTK_STATE_ACTIVE); 6834 gtk_widget_set_state(gtkconv->tab_label, GTK_STATE_ACTIVE);
6724 6835
6725 if (gtkconv->unseen_state == PIDGIN_UNSEEN_TEXT || 6836 if (gtkconv->unseen_state == PIDGIN_UNSEEN_TEXT ||
6726 gtkconv->unseen_state == PIDGIN_UNSEEN_NICK || 6837 gtkconv->unseen_state == PIDGIN_UNSEEN_NICK ||
6727 gtkconv->unseen_state == PIDGIN_UNSEEN_EVENT) { 6838 gtkconv->unseen_state == PIDGIN_UNSEEN_EVENT) {
7135 } 7246 }
7136 7247
7137 return page_num; 7248 return page_num;
7138 } 7249 }
7139 7250
7251 //nosuke
7252 static void
7253 trim_vertical_tabs_pref_cb(const char *name, PurplePrefType type,
7254 gconstpointer value, gpointer data)
7255 {
7256 GList *l;
7257 PurpleConversation *conv;
7258
7259 for (l = purple_get_conversations(); l != NULL; l = l->next) {
7260 conv = (PurpleConversation *)l->data;
7261
7262 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
7263 continue;
7264
7265 pidgin_conv_update_fields(conv, PIDGIN_CONV_SET_TITLE);
7266 }
7267 }
7268
7140 static void 7269 static void
7141 close_on_tabs_pref_cb(const char *name, PurplePrefType type, 7270 close_on_tabs_pref_cb(const char *name, PurplePrefType type,
7142 gconstpointer value, gpointer data) 7271 gconstpointer value, gpointer data)
7143 { 7272 {
7144 GList *l; 7273 GList *l;
7204 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos&~8); 7333 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos&~8);
7205 for (gtkconvs = gtkwin->gtkconvs; gtkconvs != NULL; gtkconvs = gtkconvs->next) { 7334 for (gtkconvs = gtkwin->gtkconvs; gtkconvs != NULL; gtkconvs = gtkconvs->next) {
7206 pidgin_conv_tab_pack(gtkwin, gtkconvs->data); 7335 pidgin_conv_tab_pack(gtkwin, gtkconvs->data);
7207 } 7336 }
7208 } 7337 }
7338 trim_vertical_tabs_pref_cb(name, type, value, data);
7209 } 7339 }
7210 7340
7211 static void 7341 static void
7212 show_timestamps_pref_cb(const char *name, PurplePrefType type, 7342 show_timestamps_pref_cb(const char *name, PurplePrefType type,
7213 gconstpointer value, gpointer data) 7343 gconstpointer value, gpointer data)
7262 if ((gboolean)GPOINTER_TO_INT(value)) 7392 if ((gboolean)GPOINTER_TO_INT(value))
7263 gtk_widget_show(gtkconv->toolbar); 7393 gtk_widget_show(gtkconv->toolbar);
7264 else 7394 else
7265 gtk_widget_hide(gtkconv->toolbar); 7395 gtk_widget_hide(gtkconv->toolbar);
7266 7396
7267 g_idle_add((GSourceFunc)resize_imhtml_cb,gtkconv); 7397 // g_idle_add((GSourceFunc)resize_imhtml_cb,gtkconv);
7268 } 7398 }
7269 } 7399 }
7270 7400
7271 static void 7401 static void
7272 animate_buddy_icons_pref_cb(const char *name, PurplePrefType type, 7402 animate_buddy_icons_pref_cb(const char *name, PurplePrefType type,
7769 7899
7770 /* Conversations */ 7900 /* Conversations */
7771 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations"); 7901 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations");
7772 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/use_smooth_scrolling", TRUE); 7902 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/use_smooth_scrolling", TRUE);
7773 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/close_on_tabs", TRUE); 7903 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/close_on_tabs", TRUE);
7904 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/trim_vertical_tabs", FALSE);
7774 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_bold", FALSE); 7905 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_bold", FALSE);
7775 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_italic", FALSE); 7906 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_italic", FALSE);
7776 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_underline", FALSE); 7907 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_underline", FALSE);
7777 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/spellcheck", TRUE); 7908 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/spellcheck", TRUE);
7778 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting", TRUE); 7909 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting", TRUE);
7823 #endif 7954 #endif
7824 7955
7825 /* Connect callbacks. */ 7956 /* Connect callbacks. */
7826 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/close_on_tabs", 7957 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/close_on_tabs",
7827 close_on_tabs_pref_cb, NULL); 7958 close_on_tabs_pref_cb, NULL);
7959 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/trim_vertical_tabs",
7960 trim_vertical_tabs_pref_cb, NULL);
7828 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/show_timestamps", 7961 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/show_timestamps",
7829 show_timestamps_pref_cb, NULL); 7962 show_timestamps_pref_cb, NULL);
7830 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar", 7963 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar",
7831 show_formatting_toolbar_pref_cb, NULL); 7964 show_formatting_toolbar_pref_cb, NULL);
7832 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/spellcheck", 7965 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/spellcheck",