Mercurial > pidgin.yaz
comparison pidgin/gtkconv.c @ 27858:a5bb767b8644
propagate from branch 'im.pidgin.pidgin' (head 420b71541a7786d593759ead8d775f487291fb97)
to branch 'im.pidgin.pidgin.yaz' (head 63207704bdd62ed93263dbb54f5ede5d640e2e5a)
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Tue, 17 Jun 2008 09:06:41 +0000 |
parents | 398f84dd4041 d201287d3a0e |
children | e4fa83bb82e0 |
comparison
equal
deleted
inserted
replaced
23376:85fc34efe733 | 27858:a5bb767b8644 |
---|---|
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, |
4725 } | 4797 } |
4726 | 4798 |
4727 static GtkWidget * | 4799 static GtkWidget * |
4728 setup_common_pane(PidginConversation *gtkconv) | 4800 setup_common_pane(PidginConversation *gtkconv) |
4729 { | 4801 { |
4730 GtkWidget *vbox, *frame, *imhtml_sw, *event_box; | 4802 GtkWidget *paned, *vbox, *frame, *imhtml_sw, *event_box; |
4731 GtkCellRenderer *rend; | 4803 GtkCellRenderer *rend; |
4732 GtkTreePath *path; | 4804 GtkTreePath *path; |
4733 PurpleConversation *conv = gtkconv->active_conv; | 4805 PurpleConversation *conv = gtkconv->active_conv; |
4734 PurpleBuddy *buddy; | 4806 PurpleBuddy *buddy; |
4735 gboolean chat = (conv->type == PURPLE_CONV_TYPE_CHAT); | 4807 gboolean chat = (conv->type == PURPLE_CONV_TYPE_CHAT); |
4736 GtkPolicyType imhtml_sw_hscroll; | 4808 GtkPolicyType imhtml_sw_hscroll; |
4737 int buddyicon_size = 0; | 4809 int buddyicon_size = 0; |
4738 | 4810 |
4811 paned = gtk_vpaned_new(); | |
4812 gtk_widget_show(paned); | |
4813 | |
4739 /* Setup the top part of the pane */ | 4814 /* Setup the top part of the pane */ |
4740 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); | 4815 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
4816 gtk_paned_pack1(GTK_PANED(paned), vbox, TRUE, TRUE); | |
4741 gtk_widget_show(vbox); | 4817 gtk_widget_show(vbox); |
4742 | 4818 |
4743 /* Setup the info pane */ | 4819 /* Setup the info pane */ |
4744 event_box = gtk_event_box_new(); | 4820 event_box = gtk_event_box_new(); |
4745 #if GTK_CHECK_VERSION(2,4,0) | 4821 #if GTK_CHECK_VERSION(2,4,0) |
4839 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", | 4915 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", |
4840 G_CALLBACK(refocus_entry_cb), gtkconv); | 4916 G_CALLBACK(refocus_entry_cb), gtkconv); |
4841 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", | 4917 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", |
4842 G_CALLBACK(refocus_entry_cb), gtkconv); | 4918 G_CALLBACK(refocus_entry_cb), gtkconv); |
4843 | 4919 |
4920 /* Setup the bottom half of the conversation window */ | |
4921 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); | |
4922 gtk_paned_pack2(GTK_PANED(paned), vbox, FALSE, TRUE); | |
4923 gtk_widget_show(vbox); | |
4924 | |
4844 gtkconv->lower_hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); | 4925 gtkconv->lower_hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
4845 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->lower_hbox, FALSE, FALSE, 0); | 4926 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->lower_hbox, TRUE, TRUE, 0); |
4846 gtk_widget_show(gtkconv->lower_hbox); | 4927 gtk_widget_show(gtkconv->lower_hbox); |
4928 | |
4929 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); | |
4930 gtk_box_pack_end(GTK_BOX(gtkconv->lower_hbox), vbox, TRUE, TRUE, 0); | |
4931 gtk_widget_show(vbox); | |
4847 | 4932 |
4848 /* Setup the toolbar, entry widget and all signals */ | 4933 /* Setup the toolbar, entry widget and all signals */ |
4849 frame = pidgin_create_imhtml(TRUE, >kconv->entry, >kconv->toolbar, NULL); | 4934 frame = pidgin_create_imhtml(TRUE, >kconv->entry, >kconv->toolbar, NULL); |
4850 gtk_box_pack_start(GTK_BOX(gtkconv->lower_hbox), frame, TRUE, TRUE, 0); | 4935 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); |
4851 gtk_widget_show(frame); | 4936 gtk_widget_show(frame); |
4852 | 4937 |
4853 gtk_widget_set_name(gtkconv->entry, "pidgin_conv_entry"); | 4938 gtk_widget_set_name(gtkconv->entry, "pidgin_conv_entry"); |
4854 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | 4939 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), |
4855 purple_account_get_protocol_name(conv->account)); | 4940 purple_account_get_protocol_name(conv->account)); |
4941 gtk_widget_set_size_request(gtkconv->lower_hbox, -1, | |
4942 chat ? purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/chat/entry_height") : | |
4943 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/im/entry_height")); | |
4856 | 4944 |
4857 g_signal_connect(G_OBJECT(gtkconv->entry), "populate-popup", | 4945 g_signal_connect(G_OBJECT(gtkconv->entry), "populate-popup", |
4858 G_CALLBACK(entry_popup_menu_cb), gtkconv); | 4946 G_CALLBACK(entry_popup_menu_cb), gtkconv); |
4859 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", | 4947 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", |
4860 G_CALLBACK(entry_key_press_cb), gtkconv); | 4948 G_CALLBACK(entry_key_press_cb), gtkconv); |
4861 g_signal_connect_after(G_OBJECT(gtkconv->entry), "message_send", | 4949 g_signal_connect_after(G_OBJECT(gtkconv->entry), "message_send", |
4862 G_CALLBACK(send_cb), gtkconv); | 4950 G_CALLBACK(send_cb), gtkconv); |
4863 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", | 4951 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
4864 G_CALLBACK(entry_stop_rclick_cb), NULL); | 4952 G_CALLBACK(entry_stop_rclick_cb), NULL); |
4953 g_signal_connect(G_OBJECT(gtkconv->lower_hbox), "size-allocate", | |
4954 G_CALLBACK(size_allocate_cb), gtkconv); | |
4865 | 4955 |
4866 gtkconv->entry_buffer = | 4956 gtkconv->entry_buffer = |
4867 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | 4957 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
4868 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", gtkconv); | 4958 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", gtkconv); |
4869 | 4959 |
4884 G_CALLBACK(resize_imhtml_cb), gtkconv); | 4974 G_CALLBACK(resize_imhtml_cb), gtkconv); |
4885 | 4975 |
4886 default_formatize(gtkconv); | 4976 default_formatize(gtkconv); |
4887 g_signal_connect_after(G_OBJECT(gtkconv->entry), "format_function_clear", | 4977 g_signal_connect_after(G_OBJECT(gtkconv->entry), "format_function_clear", |
4888 G_CALLBACK(clear_formatting_cb), gtkconv); | 4978 G_CALLBACK(clear_formatting_cb), gtkconv); |
4889 return vbox; | 4979 return paned; |
4890 } | 4980 } |
4891 | 4981 |
4892 static void | 4982 static void |
4893 conv_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, | 4983 conv_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, |
4894 GtkSelectionData *sd, guint info, guint t, | 4984 GtkSelectionData *sd, guint info, guint t, |
6487 PurplePresence *p = NULL; | 6577 PurplePresence *p = NULL; |
6488 char *markup = NULL; | 6578 char *markup = NULL; |
6489 AtkObject *accessibility_obj; | 6579 AtkObject *accessibility_obj; |
6490 /* I think this is a little longer than it needs to be but I'm lazy. */ | 6580 /* I think this is a little longer than it needs to be but I'm lazy. */ |
6491 char *style; | 6581 char *style; |
6582 gboolean ellipsis; | |
6583 int side; | |
6584 char *tab_title = NULL; | |
6492 | 6585 |
6493 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) | 6586 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) |
6494 im = PURPLE_CONV_IM(conv); | 6587 im = PURPLE_CONV_IM(conv); |
6495 | 6588 |
6496 if ((account == NULL) || | 6589 if ((account == NULL) || |
6581 style = "tab-label-event"; | 6674 style = "tab-label-event"; |
6582 } else { | 6675 } else { |
6583 style = NULL; | 6676 style = NULL; |
6584 } | 6677 } |
6585 | 6678 |
6679 // nosuke's tab width patch | |
6680 side = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/tab_side"); | |
6681 side &= ~8; | |
6682 if ( (side == GTK_POS_LEFT || side == GTK_POS_RIGHT) && | |
6683 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/trim_vertical_tabs") ) | |
6684 ellipsis = TRUE; | |
6685 else | |
6686 ellipsis = FALSE; | |
6687 | |
6688 if (ellipsis) { | |
6689 tab_title = pidgin_gtk_ellipsis_text(gtkconv->tab_label, title, 60, "..."); | |
6690 } | |
6691 else { | |
6692 tab_title = g_strdup(title); | |
6693 } | |
6694 | |
6586 gtk_widget_set_name(gtkconv->tab_label, style); | 6695 gtk_widget_set_name(gtkconv->tab_label, style); |
6587 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title); | 6696 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), tab_title); |
6697 g_free(tab_title); tab_title = NULL; | |
6698 | |
6588 gtk_widget_set_state(gtkconv->tab_label, GTK_STATE_ACTIVE); | 6699 gtk_widget_set_state(gtkconv->tab_label, GTK_STATE_ACTIVE); |
6589 | 6700 |
6590 if (gtkconv->unseen_state == PIDGIN_UNSEEN_TEXT || | 6701 if (gtkconv->unseen_state == PIDGIN_UNSEEN_TEXT || |
6591 gtkconv->unseen_state == PIDGIN_UNSEEN_NICK || | 6702 gtkconv->unseen_state == PIDGIN_UNSEEN_NICK || |
6592 gtkconv->unseen_state == PIDGIN_UNSEEN_EVENT) { | 6703 gtkconv->unseen_state == PIDGIN_UNSEEN_EVENT) { |
6995 } | 7106 } |
6996 | 7107 |
6997 return page_num; | 7108 return page_num; |
6998 } | 7109 } |
6999 | 7110 |
7111 //nosuke | |
7112 static void | |
7113 trim_vertical_tabs_pref_cb(const char *name, PurplePrefType type, | |
7114 gconstpointer value, gpointer data) | |
7115 { | |
7116 GList *l; | |
7117 PurpleConversation *conv; | |
7118 | |
7119 for (l = purple_get_conversations(); l != NULL; l = l->next) { | |
7120 conv = (PurpleConversation *)l->data; | |
7121 | |
7122 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv)) | |
7123 continue; | |
7124 | |
7125 pidgin_conv_update_fields(conv, PIDGIN_CONV_SET_TITLE); | |
7126 } | |
7127 } | |
7128 | |
7000 static void | 7129 static void |
7001 close_on_tabs_pref_cb(const char *name, PurplePrefType type, | 7130 close_on_tabs_pref_cb(const char *name, PurplePrefType type, |
7002 gconstpointer value, gpointer data) | 7131 gconstpointer value, gpointer data) |
7003 { | 7132 { |
7004 GList *l; | 7133 GList *l; |
7064 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos&~8); | 7193 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos&~8); |
7065 for (gtkconvs = gtkwin->gtkconvs; gtkconvs != NULL; gtkconvs = gtkconvs->next) { | 7194 for (gtkconvs = gtkwin->gtkconvs; gtkconvs != NULL; gtkconvs = gtkconvs->next) { |
7066 pidgin_conv_tab_pack(gtkwin, gtkconvs->data); | 7195 pidgin_conv_tab_pack(gtkwin, gtkconvs->data); |
7067 } | 7196 } |
7068 } | 7197 } |
7198 trim_vertical_tabs_pref_cb(name, type, value, data); | |
7069 } | 7199 } |
7070 | 7200 |
7071 static void | 7201 static void |
7072 show_timestamps_pref_cb(const char *name, PurplePrefType type, | 7202 show_timestamps_pref_cb(const char *name, PurplePrefType type, |
7073 gconstpointer value, gpointer data) | 7203 gconstpointer value, gpointer data) |
7122 if ((gboolean)GPOINTER_TO_INT(value)) | 7252 if ((gboolean)GPOINTER_TO_INT(value)) |
7123 gtk_widget_show(gtkconv->toolbar); | 7253 gtk_widget_show(gtkconv->toolbar); |
7124 else | 7254 else |
7125 gtk_widget_hide(gtkconv->toolbar); | 7255 gtk_widget_hide(gtkconv->toolbar); |
7126 | 7256 |
7127 g_idle_add((GSourceFunc)resize_imhtml_cb,gtkconv); | 7257 // g_idle_add((GSourceFunc)resize_imhtml_cb,gtkconv); |
7128 } | 7258 } |
7129 } | 7259 } |
7130 | 7260 |
7131 static void | 7261 static void |
7132 animate_buddy_icons_pref_cb(const char *name, PurplePrefType type, | 7262 animate_buddy_icons_pref_cb(const char *name, PurplePrefType type, |
7625 | 7755 |
7626 /* Conversations */ | 7756 /* Conversations */ |
7627 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations"); | 7757 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations"); |
7628 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/use_smooth_scrolling", TRUE); | 7758 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/use_smooth_scrolling", TRUE); |
7629 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/close_on_tabs", TRUE); | 7759 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/close_on_tabs", TRUE); |
7760 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/trim_vertical_tabs", FALSE); | |
7630 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_bold", FALSE); | 7761 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_bold", FALSE); |
7631 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_italic", FALSE); | 7762 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_italic", FALSE); |
7632 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_underline", FALSE); | 7763 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_underline", FALSE); |
7633 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/spellcheck", TRUE); | 7764 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/spellcheck", TRUE); |
7634 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting", TRUE); | 7765 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting", TRUE); |
7679 #endif | 7810 #endif |
7680 | 7811 |
7681 /* Connect callbacks. */ | 7812 /* Connect callbacks. */ |
7682 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/close_on_tabs", | 7813 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/close_on_tabs", |
7683 close_on_tabs_pref_cb, NULL); | 7814 close_on_tabs_pref_cb, NULL); |
7815 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/trim_vertical_tabs", | |
7816 trim_vertical_tabs_pref_cb, NULL); | |
7684 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/show_timestamps", | 7817 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/show_timestamps", |
7685 show_timestamps_pref_cb, NULL); | 7818 show_timestamps_pref_cb, NULL); |
7686 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar", | 7819 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar", |
7687 show_formatting_toolbar_pref_cb, NULL); | 7820 show_formatting_toolbar_pref_cb, NULL); |
7688 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/spellcheck", | 7821 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/spellcheck", |