Mercurial > pidgin.yaz
comparison pidgin/gtkconv.c @ 27876:5c76f76ee9db
propagate from branch 'im.pidgin.pidgin' (head 4e2880e0b1b33a1395280db14803f92cc93843de)
to branch 'im.pidgin.pidgin.yaz' (head c1a301a610acc031ca4edb7bead93fb218cbd78f)
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Fri, 05 Sep 2008 10:01:57 +0000 |
parents | a0381a68ceef e187fdccd743 |
children | 0ee06de49812 |
comparison
equal
deleted
inserted
replaced
23997:de712dc6fecd | 27876:5c76f76ee9db |
---|---|
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 |
115 | 116 |
116 #define NUM_NICK_COLORS 220 | 117 #define NUM_NICK_COLORS 220 |
117 static GdkColor *nick_colors = NULL; | 118 static GdkColor *nick_colors = NULL; |
118 static guint nbr_nick_colors; | 119 static guint nbr_nick_colors; |
119 | 120 |
121 /* yaz. If you want to use shortcut keys that may conflict with | |
122 inputmethods, change this to 1. */ | |
123 #define ENABLE_SHORTCUT 0 | |
124 | |
120 typedef struct { | 125 typedef struct { |
121 GtkWidget *window; | 126 GtkWidget *window; |
122 | 127 |
123 GtkWidget *entry; | 128 GtkWidget *entry; |
124 GtkWidget *message; | 129 GtkWidget *message; |
268 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/chat/userlist_width", allocation->width == 1 ? 0 : allocation->width); | 273 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/chat/userlist_width", allocation->width == 1 ? 0 : allocation->width); |
269 | 274 |
270 return FALSE; | 275 return FALSE; |
271 } | 276 } |
272 | 277 |
278 static gboolean | |
279 size_allocate_cb(GtkWidget *w, GtkAllocation *allocation, PidginConversation *gtkconv) | |
280 { | |
281 PurpleConversation *conv = gtkconv->active_conv; | |
282 | |
283 if (!GTK_WIDGET_VISIBLE(w)) | |
284 return FALSE; | |
285 | |
286 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv)) | |
287 return FALSE; | |
288 if (gtkconv->auto_resize) { | |
289 return FALSE; | |
290 } | |
291 | |
292 if (gdk_window_get_state(gtkconv->win->window->window) & GDK_WINDOW_STATE_MAXIMIZED) { | |
293 return FALSE; | |
294 } | |
295 | |
296 /* I find that I resize the window when it has a bunch of conversations in it, mostly so that the | |
297 * tab bar will fit, but then I don't want new windows taking up the entire screen. I check to see | |
298 * if there is only one conversation in the window. This way we'll be setting new windows to the | |
299 * size of the last resized new window. */ | |
300 /* I think that the above justification is not the majority, and that the new tab resizing should | |
301 * negate it anyway. --luke */ | |
302 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) | |
303 { | |
304 if (w == gtkconv->lower_hbox) | |
305 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/entry_height", allocation->height); | |
306 } | |
307 else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) | |
308 { | |
309 if (w == gtkconv->lower_hbox) | |
310 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/chat/entry_height", allocation->height); | |
311 } | |
312 return FALSE; | |
313 } | |
314 | |
273 static void | 315 static void |
274 default_formatize(PidginConversation *c) | 316 default_formatize(PidginConversation *c) |
275 { | 317 { |
276 PurpleConversation *conv = c->active_conv; | 318 PurpleConversation *conv = c->active_conv; |
277 gtk_imhtml_setup_entry(GTK_IMHTML(c->entry), conv->features); | 319 gtk_imhtml_setup_entry(GTK_IMHTML(c->entry), conv->features); |
416 first = g_list_first(gtkconv->send_history); | 458 first = g_list_first(gtkconv->send_history); |
417 g_free(first->data); | 459 g_free(first->data); |
418 first->data = g_strdup(message); | 460 first->data = g_strdup(message); |
419 gtkconv->send_history = g_list_prepend(first, NULL); | 461 gtkconv->send_history = g_list_prepend(first, NULL); |
420 } | 462 } |
463 | |
464 #if 0 | |
465 static void | |
466 reset_default_size(PidginConversation *gtkconv) | |
467 { | |
468 PurpleConversation *conv = gtkconv->active_conv; | |
469 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) | |
470 gtk_widget_set_size_request(gtkconv->lower_hbox, -1, | |
471 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/chat/entry_height")); | |
472 else | |
473 gtk_widget_set_size_request(gtkconv->lower_hbox, -1, | |
474 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/im/entry_height")); | |
475 } | |
476 #endif | |
421 | 477 |
422 static gboolean | 478 static gboolean |
423 check_for_and_do_command(PurpleConversation *conv) | 479 check_for_and_do_command(PurpleConversation *conv) |
424 { | 480 { |
425 PidginConversation *gtkconv; | 481 PidginConversation *gtkconv; |
3062 { N_("/Conversation/New Instant _Message..."), "<CTL>M", menu_new_conv_cb, | 3118 { N_("/Conversation/New Instant _Message..."), "<CTL>M", menu_new_conv_cb, |
3063 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW }, | 3119 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW }, |
3064 | 3120 |
3065 { "/Conversation/sep0", NULL, NULL, 0, "<Separator>", NULL }, | 3121 { "/Conversation/sep0", NULL, NULL, 0, "<Separator>", NULL }, |
3066 | 3122 |
3123 #if ENABLE_SHORTCUT | |
3067 { N_("/Conversation/_Find..."), NULL, menu_find_cb, 0, | 3124 { N_("/Conversation/_Find..."), NULL, menu_find_cb, 0, |
3068 "<StockItem>", GTK_STOCK_FIND }, | 3125 "<StockItem>", GTK_STOCK_FIND }, |
3126 #else | |
3127 { N_("/Conversation/_Find..."), NULL, menu_find_cb, 0, | |
3128 "<Item>", NULL }, | |
3129 #endif | |
3069 { N_("/Conversation/View _Log"), NULL, menu_view_log_cb, 0, "<Item>", NULL }, | 3130 { N_("/Conversation/View _Log"), NULL, menu_view_log_cb, 0, "<Item>", NULL }, |
3070 { N_("/Conversation/_Save As..."), NULL, menu_save_as_cb, 0, | 3131 { N_("/Conversation/_Save As..."), NULL, menu_save_as_cb, 0, |
3071 "<StockItem>", GTK_STOCK_SAVE_AS }, | 3132 "<StockItem>", GTK_STOCK_SAVE_AS }, |
3133 #if ENABLE_SHORTCUT | |
3072 { N_("/Conversation/Clea_r Scrollback"), "<CTL>L", menu_clear_cb, 0, "<StockItem>", GTK_STOCK_CLEAR }, | 3134 { N_("/Conversation/Clea_r Scrollback"), "<CTL>L", menu_clear_cb, 0, "<StockItem>", GTK_STOCK_CLEAR }, |
3073 | 3135 #else |
3136 { N_("/Conversation/Clea_r Scrollback"), NULL, menu_clear_cb, 0, "<Item>", NULL }, | |
3137 #endif | |
3074 { "/Conversation/sep1", NULL, NULL, 0, "<Separator>", NULL }, | 3138 { "/Conversation/sep1", NULL, NULL, 0, "<Separator>", NULL }, |
3075 | 3139 |
3076 { N_("/Conversation/Se_nd File..."), NULL, menu_send_file_cb, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_SEND_FILE }, | 3140 { N_("/Conversation/Se_nd File..."), NULL, menu_send_file_cb, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_SEND_FILE }, |
3077 { N_("/Conversation/Add Buddy _Pounce..."), NULL, menu_add_pounce_cb, | 3141 { N_("/Conversation/Add Buddy _Pounce..."), NULL, menu_add_pounce_cb, |
3078 0, "<Item>", NULL }, | 3142 0, "<Item>", NULL }, |
3143 #if ENABLE_SHORTCUT | |
3079 { N_("/Conversation/_Get Info"), "<CTL>O", menu_get_info_cb, 0, | 3144 { N_("/Conversation/_Get Info"), "<CTL>O", menu_get_info_cb, 0, |
3080 "<StockItem>", PIDGIN_STOCK_TOOLBAR_USER_INFO }, | 3145 "<StockItem>", PIDGIN_STOCK_TOOLBAR_USER_INFO }, |
3146 #else | |
3147 { N_("/Conversation/_Get Info"), NULL, menu_get_info_cb, 0, | |
3148 "<StockItem>", PIDGIN_STOCK_TOOLBAR_USER_INFO }, | |
3149 #endif | |
3081 { N_("/Conversation/In_vite..."), NULL, menu_invite_cb, 0, | 3150 { N_("/Conversation/In_vite..."), NULL, menu_invite_cb, 0, |
3082 "<Item>", NULL }, | 3151 "<Item>", NULL }, |
3083 { N_("/Conversation/M_ore"), NULL, NULL, 0, "<Branch>", NULL }, | 3152 { N_("/Conversation/M_ore"), NULL, NULL, 0, "<Branch>", NULL }, |
3084 | 3153 |
3085 { "/Conversation/sep2", NULL, NULL, 0, "<Separator>", NULL }, | 3154 { "/Conversation/sep2", NULL, NULL, 0, "<Separator>", NULL }, |
3788 | 3857 |
3789 if (win->menu.send_to != NULL) | 3858 if (win->menu.send_to != NULL) |
3790 gtk_widget_destroy(win->menu.send_to); | 3859 gtk_widget_destroy(win->menu.send_to); |
3791 | 3860 |
3792 /* Build the Send To menu */ | 3861 /* Build the Send To menu */ |
3862 #if ENABLE_SHORTCUT | |
3793 win->menu.send_to = gtk_menu_item_new_with_mnemonic(_("S_end To")); | 3863 win->menu.send_to = gtk_menu_item_new_with_mnemonic(_("S_end To")); |
3864 #else | |
3865 win->menu.send_to = gtk_menu_item_new_with_mnemonic(_("Send To")); //to free Alt-s. intentional. --yaz | |
3866 #endif | |
3794 gtk_widget_show(win->menu.send_to); | 3867 gtk_widget_show(win->menu.send_to); |
3795 | 3868 |
3796 menu = gtk_menu_new(); | 3869 menu = gtk_menu_new(); |
3797 gtk_menu_shell_insert(GTK_MENU_SHELL(win->menu.menubar), | 3870 gtk_menu_shell_insert(GTK_MENU_SHELL(win->menu.menubar), |
3798 win->menu.send_to, 2); | 3871 win->menu.send_to, 2); |
4213 PurpleConnection *gc; | 4286 PurpleConnection *gc; |
4214 PurpleConversation *conv = gtkconv->active_conv; | 4287 PurpleConversation *conv = gtkconv->active_conv; |
4215 PidginChatPane *gtkchat; | 4288 PidginChatPane *gtkchat; |
4216 char *new_topic; | 4289 char *new_topic; |
4217 const char *current_topic; | 4290 const char *current_topic; |
4291 char dummy[] = "No Topic"; | |
4218 | 4292 |
4219 gc = purple_conversation_get_gc(conv); | 4293 gc = purple_conversation_get_gc(conv); |
4220 | 4294 |
4221 if(!gc || !(prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl))) | 4295 if(!gc || !(prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl))) |
4222 return; | 4296 return; |
4232 if(current_topic && !g_utf8_collate(new_topic, current_topic)){ | 4306 if(current_topic && !g_utf8_collate(new_topic, current_topic)){ |
4233 g_free(new_topic); | 4307 g_free(new_topic); |
4234 return; | 4308 return; |
4235 } | 4309 } |
4236 | 4310 |
4237 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), current_topic); | 4311 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), current_topic ? current_topic : dummy); |
4238 prpl_info->set_chat_topic(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), | 4312 prpl_info->set_chat_topic(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), |
4239 new_topic); | 4313 new_topic); |
4240 | 4314 |
4241 g_free(new_topic); | 4315 g_free(new_topic); |
4242 } | 4316 } |
4508 * is the beginning of a new paragraph. */ | 4582 * is the beginning of a new paragraph. */ |
4509 min_height = min_lines * (oneline.height + MAX(pad_inside, pad_top + pad_bottom)); | 4583 min_height = min_lines * (oneline.height + MAX(pad_inside, pad_top + pad_bottom)); |
4510 height = CLAMP(height, MIN(min_height, max_height), max_height); | 4584 height = CLAMP(height, MIN(min_height, max_height), max_height); |
4511 | 4585 |
4512 diff = height - gtkconv->entry->allocation.height; | 4586 diff = height - gtkconv->entry->allocation.height; |
4513 if (ABS(diff) < oneline.height / 2) | 4587 if (diff == 0 || (diff < 0 && -diff < oneline.height / 2)) |
4514 return FALSE; | 4588 return FALSE; |
4515 | |
4516 gtk_widget_set_size_request(gtkconv->lower_hbox, -1, | 4589 gtk_widget_set_size_request(gtkconv->lower_hbox, -1, |
4517 diff + gtkconv->lower_hbox->allocation.height); | 4590 diff + gtkconv->lower_hbox->allocation.height); |
4518 | |
4519 return FALSE; | 4591 return FALSE; |
4520 } | 4592 } |
4521 | 4593 |
4522 static void | 4594 static void |
4523 minimum_entry_lines_pref_cb(const char *name, | 4595 minimum_entry_lines_pref_cb(const char *name, |
4728 } | 4800 } |
4729 | 4801 |
4730 static GtkWidget * | 4802 static GtkWidget * |
4731 setup_common_pane(PidginConversation *gtkconv) | 4803 setup_common_pane(PidginConversation *gtkconv) |
4732 { | 4804 { |
4733 GtkWidget *vbox, *frame, *imhtml_sw, *event_box; | 4805 GtkWidget *paned, *vbox, *frame, *imhtml_sw, *event_box; |
4734 GtkCellRenderer *rend; | 4806 GtkCellRenderer *rend; |
4735 GtkTreePath *path; | 4807 GtkTreePath *path; |
4736 PurpleConversation *conv = gtkconv->active_conv; | 4808 PurpleConversation *conv = gtkconv->active_conv; |
4737 PurpleBuddy *buddy; | 4809 PurpleBuddy *buddy; |
4738 gboolean chat = (conv->type == PURPLE_CONV_TYPE_CHAT); | 4810 gboolean chat = (conv->type == PURPLE_CONV_TYPE_CHAT); |
4739 GtkPolicyType imhtml_sw_hscroll; | 4811 GtkPolicyType imhtml_sw_hscroll; |
4740 int buddyicon_size = 0; | 4812 int buddyicon_size = 0; |
4741 | 4813 |
4814 paned = gtk_vpaned_new(); | |
4815 gtk_widget_show(paned); | |
4816 | |
4742 /* Setup the top part of the pane */ | 4817 /* Setup the top part of the pane */ |
4743 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); | 4818 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
4819 gtk_paned_pack1(GTK_PANED(paned), vbox, TRUE, TRUE); | |
4744 gtk_widget_show(vbox); | 4820 gtk_widget_show(vbox); |
4745 | 4821 |
4746 /* Setup the info pane */ | 4822 /* Setup the info pane */ |
4747 event_box = gtk_event_box_new(); | 4823 event_box = gtk_event_box_new(); |
4748 #if GTK_CHECK_VERSION(2,4,0) | 4824 #if GTK_CHECK_VERSION(2,4,0) |
4842 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", | 4918 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", |
4843 G_CALLBACK(refocus_entry_cb), gtkconv); | 4919 G_CALLBACK(refocus_entry_cb), gtkconv); |
4844 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", | 4920 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", |
4845 G_CALLBACK(refocus_entry_cb), gtkconv); | 4921 G_CALLBACK(refocus_entry_cb), gtkconv); |
4846 | 4922 |
4923 /* Setup the bottom half of the conversation window */ | |
4924 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); | |
4925 gtk_paned_pack2(GTK_PANED(paned), vbox, FALSE, TRUE); | |
4926 gtk_widget_show(vbox); | |
4927 | |
4847 gtkconv->lower_hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); | 4928 gtkconv->lower_hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
4848 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->lower_hbox, FALSE, FALSE, 0); | 4929 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->lower_hbox, TRUE, TRUE, 0); |
4849 gtk_widget_show(gtkconv->lower_hbox); | 4930 gtk_widget_show(gtkconv->lower_hbox); |
4931 | |
4932 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); | |
4933 gtk_box_pack_end(GTK_BOX(gtkconv->lower_hbox), vbox, TRUE, TRUE, 0); | |
4934 gtk_widget_show(vbox); | |
4850 | 4935 |
4851 /* Setup the toolbar, entry widget and all signals */ | 4936 /* Setup the toolbar, entry widget and all signals */ |
4852 frame = pidgin_create_imhtml(TRUE, >kconv->entry, >kconv->toolbar, NULL); | 4937 frame = pidgin_create_imhtml(TRUE, >kconv->entry, >kconv->toolbar, NULL); |
4853 gtk_box_pack_start(GTK_BOX(gtkconv->lower_hbox), frame, TRUE, TRUE, 0); | 4938 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); |
4854 gtk_widget_show(frame); | 4939 gtk_widget_show(frame); |
4855 | 4940 |
4856 gtk_widget_set_name(gtkconv->entry, "pidgin_conv_entry"); | 4941 gtk_widget_set_name(gtkconv->entry, "pidgin_conv_entry"); |
4857 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | 4942 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), |
4858 purple_account_get_protocol_name(conv->account)); | 4943 purple_account_get_protocol_name(conv->account)); |
4944 gtk_widget_set_size_request(gtkconv->lower_hbox, -1, | |
4945 chat ? purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/chat/entry_height") : | |
4946 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/im/entry_height")); | |
4859 | 4947 |
4860 g_signal_connect(G_OBJECT(gtkconv->entry), "populate-popup", | 4948 g_signal_connect(G_OBJECT(gtkconv->entry), "populate-popup", |
4861 G_CALLBACK(entry_popup_menu_cb), gtkconv); | 4949 G_CALLBACK(entry_popup_menu_cb), gtkconv); |
4862 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", | 4950 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", |
4863 G_CALLBACK(entry_key_press_cb), gtkconv); | 4951 G_CALLBACK(entry_key_press_cb), gtkconv); |
4864 g_signal_connect_after(G_OBJECT(gtkconv->entry), "message_send", | 4952 g_signal_connect_after(G_OBJECT(gtkconv->entry), "message_send", |
4865 G_CALLBACK(send_cb), gtkconv); | 4953 G_CALLBACK(send_cb), gtkconv); |
4866 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", | 4954 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
4867 G_CALLBACK(entry_stop_rclick_cb), NULL); | 4955 G_CALLBACK(entry_stop_rclick_cb), NULL); |
4956 g_signal_connect(G_OBJECT(gtkconv->lower_hbox), "size-allocate", | |
4957 G_CALLBACK(size_allocate_cb), gtkconv); | |
4868 | 4958 |
4869 gtkconv->entry_buffer = | 4959 gtkconv->entry_buffer = |
4870 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | 4960 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
4871 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", gtkconv); | 4961 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", gtkconv); |
4872 | 4962 |
4887 G_CALLBACK(resize_imhtml_cb), gtkconv); | 4977 G_CALLBACK(resize_imhtml_cb), gtkconv); |
4888 | 4978 |
4889 default_formatize(gtkconv); | 4979 default_formatize(gtkconv); |
4890 g_signal_connect_after(G_OBJECT(gtkconv->entry), "format_function_clear", | 4980 g_signal_connect_after(G_OBJECT(gtkconv->entry), "format_function_clear", |
4891 G_CALLBACK(clear_formatting_cb), gtkconv); | 4981 G_CALLBACK(clear_formatting_cb), gtkconv); |
4892 return vbox; | 4982 return paned; |
4893 } | 4983 } |
4894 | 4984 |
4895 static void | 4985 static void |
4896 conv_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, | 4986 conv_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, |
4897 GtkSelectionData *sd, guint info, guint t, | 4987 GtkSelectionData *sd, guint info, guint t, |
6490 PurplePresence *p = NULL; | 6580 PurplePresence *p = NULL; |
6491 char *markup = NULL; | 6581 char *markup = NULL; |
6492 AtkObject *accessibility_obj; | 6582 AtkObject *accessibility_obj; |
6493 /* I think this is a little longer than it needs to be but I'm lazy. */ | 6583 /* I think this is a little longer than it needs to be but I'm lazy. */ |
6494 char *style; | 6584 char *style; |
6585 gboolean ellipsis; | |
6586 int side; | |
6587 char *tab_title = NULL; | |
6495 | 6588 |
6496 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) | 6589 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) |
6497 im = PURPLE_CONV_IM(conv); | 6590 im = PURPLE_CONV_IM(conv); |
6498 | 6591 |
6499 if ((account == NULL) || | 6592 if ((account == NULL) || |
6584 style = "tab-label-event"; | 6677 style = "tab-label-event"; |
6585 } else { | 6678 } else { |
6586 style = NULL; | 6679 style = NULL; |
6587 } | 6680 } |
6588 | 6681 |
6682 // nosuke's tab width patch | |
6683 side = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/tab_side"); | |
6684 side &= ~8; | |
6685 if ( (side == GTK_POS_LEFT || side == GTK_POS_RIGHT) && | |
6686 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/trim_vertical_tabs") ) | |
6687 ellipsis = TRUE; | |
6688 else | |
6689 ellipsis = FALSE; | |
6690 | |
6691 if (ellipsis) { | |
6692 tab_title = pidgin_gtk_ellipsis_text(gtkconv->tab_label, title, 60, "..."); | |
6693 } | |
6694 else { | |
6695 tab_title = g_strdup(title); | |
6696 } | |
6697 | |
6589 gtk_widget_set_name(gtkconv->tab_label, style); | 6698 gtk_widget_set_name(gtkconv->tab_label, style); |
6590 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title); | 6699 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), tab_title); |
6700 g_free(tab_title); tab_title = NULL; | |
6701 | |
6591 gtk_widget_set_state(gtkconv->tab_label, GTK_STATE_ACTIVE); | 6702 gtk_widget_set_state(gtkconv->tab_label, GTK_STATE_ACTIVE); |
6592 | 6703 |
6593 if (gtkconv->unseen_state == PIDGIN_UNSEEN_TEXT || | 6704 if (gtkconv->unseen_state == PIDGIN_UNSEEN_TEXT || |
6594 gtkconv->unseen_state == PIDGIN_UNSEEN_NICK || | 6705 gtkconv->unseen_state == PIDGIN_UNSEEN_NICK || |
6595 gtkconv->unseen_state == PIDGIN_UNSEEN_EVENT) { | 6706 gtkconv->unseen_state == PIDGIN_UNSEEN_EVENT) { |
7003 } | 7114 } |
7004 | 7115 |
7005 return page_num; | 7116 return page_num; |
7006 } | 7117 } |
7007 | 7118 |
7119 //nosuke | |
7120 static void | |
7121 trim_vertical_tabs_pref_cb(const char *name, PurplePrefType type, | |
7122 gconstpointer value, gpointer data) | |
7123 { | |
7124 GList *l; | |
7125 PurpleConversation *conv; | |
7126 | |
7127 for (l = purple_get_conversations(); l != NULL; l = l->next) { | |
7128 conv = (PurpleConversation *)l->data; | |
7129 | |
7130 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv)) | |
7131 continue; | |
7132 | |
7133 pidgin_conv_update_fields(conv, PIDGIN_CONV_SET_TITLE); | |
7134 } | |
7135 } | |
7136 | |
7008 static void | 7137 static void |
7009 close_on_tabs_pref_cb(const char *name, PurplePrefType type, | 7138 close_on_tabs_pref_cb(const char *name, PurplePrefType type, |
7010 gconstpointer value, gpointer data) | 7139 gconstpointer value, gpointer data) |
7011 { | 7140 { |
7012 GList *l; | 7141 GList *l; |
7072 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos&~8); | 7201 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos&~8); |
7073 for (gtkconvs = gtkwin->gtkconvs; gtkconvs != NULL; gtkconvs = gtkconvs->next) { | 7202 for (gtkconvs = gtkwin->gtkconvs; gtkconvs != NULL; gtkconvs = gtkconvs->next) { |
7074 pidgin_conv_tab_pack(gtkwin, gtkconvs->data); | 7203 pidgin_conv_tab_pack(gtkwin, gtkconvs->data); |
7075 } | 7204 } |
7076 } | 7205 } |
7206 trim_vertical_tabs_pref_cb(name, type, value, data); | |
7077 } | 7207 } |
7078 | 7208 |
7079 static void | 7209 static void |
7080 show_timestamps_pref_cb(const char *name, PurplePrefType type, | 7210 show_timestamps_pref_cb(const char *name, PurplePrefType type, |
7081 gconstpointer value, gpointer data) | 7211 gconstpointer value, gpointer data) |
7130 if ((gboolean)GPOINTER_TO_INT(value)) | 7260 if ((gboolean)GPOINTER_TO_INT(value)) |
7131 gtk_widget_show(gtkconv->toolbar); | 7261 gtk_widget_show(gtkconv->toolbar); |
7132 else | 7262 else |
7133 gtk_widget_hide(gtkconv->toolbar); | 7263 gtk_widget_hide(gtkconv->toolbar); |
7134 | 7264 |
7135 g_idle_add((GSourceFunc)resize_imhtml_cb,gtkconv); | 7265 // g_idle_add((GSourceFunc)resize_imhtml_cb,gtkconv); |
7136 } | 7266 } |
7137 } | 7267 } |
7138 | 7268 |
7139 static void | 7269 static void |
7140 animate_buddy_icons_pref_cb(const char *name, PurplePrefType type, | 7270 animate_buddy_icons_pref_cb(const char *name, PurplePrefType type, |
7643 | 7773 |
7644 /* Conversations */ | 7774 /* Conversations */ |
7645 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations"); | 7775 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations"); |
7646 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/use_smooth_scrolling", TRUE); | 7776 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/use_smooth_scrolling", TRUE); |
7647 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/close_on_tabs", TRUE); | 7777 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/close_on_tabs", TRUE); |
7778 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/trim_vertical_tabs", FALSE); | |
7648 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_bold", FALSE); | 7779 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_bold", FALSE); |
7649 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_italic", FALSE); | 7780 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_italic", FALSE); |
7650 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_underline", FALSE); | 7781 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_underline", FALSE); |
7651 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/spellcheck", TRUE); | 7782 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/spellcheck", TRUE); |
7652 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting", TRUE); | 7783 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting", TRUE); |
7697 #endif | 7828 #endif |
7698 | 7829 |
7699 /* Connect callbacks. */ | 7830 /* Connect callbacks. */ |
7700 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/close_on_tabs", | 7831 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/close_on_tabs", |
7701 close_on_tabs_pref_cb, NULL); | 7832 close_on_tabs_pref_cb, NULL); |
7833 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/trim_vertical_tabs", | |
7834 trim_vertical_tabs_pref_cb, NULL); | |
7702 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/show_timestamps", | 7835 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/show_timestamps", |
7703 show_timestamps_pref_cb, NULL); | 7836 show_timestamps_pref_cb, NULL); |
7704 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar", | 7837 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar", |
7705 show_formatting_toolbar_pref_cb, NULL); | 7838 show_formatting_toolbar_pref_cb, NULL); |
7706 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/spellcheck", | 7839 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/spellcheck", |