comparison pidgin/gtkconv.c @ 27940:b623c1824f29

propagate from branch 'im.pidgin.pidgin' (head 58fbcc161c5eadf3f307cd460a6ce0a209d908df) to branch 'im.pidgin.pidgin.yaz' (head a378a1d9618c47f5b0e6c67daf613d3c4275f7cf)
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Thu, 16 Apr 2009 05:51:42 +0000
parents 15ae2dea92b3 1337d2813b2d
children 583c36c03e50
comparison
equal deleted inserted replaced
26650:3712d32363dd 27940:b623c1824f29
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,
6647 PurplePresence *p = NULL; 6737 PurplePresence *p = NULL;
6648 char *markup = NULL; 6738 char *markup = NULL;
6649 AtkObject *accessibility_obj; 6739 AtkObject *accessibility_obj;
6650 /* I think this is a little longer than it needs to be but I'm lazy. */ 6740 /* I think this is a little longer than it needs to be but I'm lazy. */
6651 char *style; 6741 char *style;
6742 gboolean ellipsis;
6743 int side;
6744 char *tab_title = NULL;
6652 6745
6653 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) 6746 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)
6654 im = PURPLE_CONV_IM(conv); 6747 im = PURPLE_CONV_IM(conv);
6655 6748
6656 if ((account == NULL) || 6749 if ((account == NULL) ||
6741 style = "tab-label-event"; 6834 style = "tab-label-event";
6742 } else { 6835 } else {
6743 style = NULL; 6836 style = NULL;
6744 } 6837 }
6745 6838
6839 // nosuke's tab width patch
6840 side = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/tab_side");
6841 side &= ~8;
6842 if ( (side == GTK_POS_LEFT || side == GTK_POS_RIGHT) &&
6843 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/trim_vertical_tabs") )
6844 ellipsis = TRUE;
6845 else
6846 ellipsis = FALSE;
6847
6848 if (ellipsis) {
6849 tab_title = pidgin_gtk_ellipsis_text(gtkconv->tab_label, title, 60, "...");
6850 }
6851 else {
6852 tab_title = g_strdup(title);
6853 }
6854
6746 gtk_widget_set_name(gtkconv->tab_label, style); 6855 gtk_widget_set_name(gtkconv->tab_label, style);
6747 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title); 6856 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), tab_title);
6857 g_free(tab_title); tab_title = NULL;
6858
6748 gtk_widget_set_state(gtkconv->tab_label, GTK_STATE_ACTIVE); 6859 gtk_widget_set_state(gtkconv->tab_label, GTK_STATE_ACTIVE);
6749 6860
6750 if (gtkconv->unseen_state == PIDGIN_UNSEEN_TEXT || 6861 if (gtkconv->unseen_state == PIDGIN_UNSEEN_TEXT ||
6751 gtkconv->unseen_state == PIDGIN_UNSEEN_NICK || 6862 gtkconv->unseen_state == PIDGIN_UNSEEN_NICK ||
6752 gtkconv->unseen_state == PIDGIN_UNSEEN_EVENT) { 6863 gtkconv->unseen_state == PIDGIN_UNSEEN_EVENT) {
7161 } 7272 }
7162 7273
7163 return page_num; 7274 return page_num;
7164 } 7275 }
7165 7276
7277 //nosuke
7278 static void
7279 trim_vertical_tabs_pref_cb(const char *name, PurplePrefType type,
7280 gconstpointer value, gpointer data)
7281 {
7282 GList *l;
7283 PurpleConversation *conv;
7284
7285 for (l = purple_get_conversations(); l != NULL; l = l->next) {
7286 conv = (PurpleConversation *)l->data;
7287
7288 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
7289 continue;
7290
7291 pidgin_conv_update_fields(conv, PIDGIN_CONV_SET_TITLE);
7292 }
7293 }
7294
7166 static void 7295 static void
7167 close_on_tabs_pref_cb(const char *name, PurplePrefType type, 7296 close_on_tabs_pref_cb(const char *name, PurplePrefType type,
7168 gconstpointer value, gpointer data) 7297 gconstpointer value, gpointer data)
7169 { 7298 {
7170 GList *l; 7299 GList *l;
7230 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos&~8); 7359 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos&~8);
7231 for (gtkconvs = gtkwin->gtkconvs; gtkconvs != NULL; gtkconvs = gtkconvs->next) { 7360 for (gtkconvs = gtkwin->gtkconvs; gtkconvs != NULL; gtkconvs = gtkconvs->next) {
7232 pidgin_conv_tab_pack(gtkwin, gtkconvs->data); 7361 pidgin_conv_tab_pack(gtkwin, gtkconvs->data);
7233 } 7362 }
7234 } 7363 }
7364 trim_vertical_tabs_pref_cb(name, type, value, data);
7235 } 7365 }
7236 7366
7237 static void 7367 static void
7238 show_timestamps_pref_cb(const char *name, PurplePrefType type, 7368 show_timestamps_pref_cb(const char *name, PurplePrefType type,
7239 gconstpointer value, gpointer data) 7369 gconstpointer value, gpointer data)
7288 if ((gboolean)GPOINTER_TO_INT(value)) 7418 if ((gboolean)GPOINTER_TO_INT(value))
7289 gtk_widget_show(gtkconv->toolbar); 7419 gtk_widget_show(gtkconv->toolbar);
7290 else 7420 else
7291 gtk_widget_hide(gtkconv->toolbar); 7421 gtk_widget_hide(gtkconv->toolbar);
7292 7422
7293 g_idle_add((GSourceFunc)resize_imhtml_cb,gtkconv); 7423 // g_idle_add((GSourceFunc)resize_imhtml_cb,gtkconv);
7294 } 7424 }
7295 } 7425 }
7296 7426
7297 static void 7427 static void
7298 animate_buddy_icons_pref_cb(const char *name, PurplePrefType type, 7428 animate_buddy_icons_pref_cb(const char *name, PurplePrefType type,
7795 7925
7796 /* Conversations */ 7926 /* Conversations */
7797 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations"); 7927 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations");
7798 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/use_smooth_scrolling", TRUE); 7928 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/use_smooth_scrolling", TRUE);
7799 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/close_on_tabs", TRUE); 7929 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/close_on_tabs", TRUE);
7930 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/trim_vertical_tabs", FALSE);
7800 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_bold", FALSE); 7931 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_bold", FALSE);
7801 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_italic", FALSE); 7932 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_italic", FALSE);
7802 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_underline", FALSE); 7933 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_underline", FALSE);
7803 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/spellcheck", TRUE); 7934 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/spellcheck", TRUE);
7804 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting", TRUE); 7935 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting", TRUE);
7849 #endif 7980 #endif
7850 7981
7851 /* Connect callbacks. */ 7982 /* Connect callbacks. */
7852 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/close_on_tabs", 7983 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/close_on_tabs",
7853 close_on_tabs_pref_cb, NULL); 7984 close_on_tabs_pref_cb, NULL);
7985 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/trim_vertical_tabs",
7986 trim_vertical_tabs_pref_cb, NULL);
7854 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/show_timestamps", 7987 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/show_timestamps",
7855 show_timestamps_pref_cb, NULL); 7988 show_timestamps_pref_cb, NULL);
7856 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar", 7989 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar",
7857 show_formatting_toolbar_pref_cb, NULL); 7990 show_formatting_toolbar_pref_cb, NULL);
7858 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/spellcheck", 7991 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/spellcheck",