Mercurial > pidgin.yaz
comparison pidgin/gtkconv.c @ 25521:636679fb98ad
propagate from branch 'im.pidgin.pidgin' (head 7bf90628ea82588a24a5c2e11b62e1128d8c90f0)
to branch 'im.pidgin.pidgin.yaz' (head f554d827ac55b0841c6212d0537840c743a62b07)
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Thu, 28 Jun 2007 08:37:46 +0000 |
parents | df4ae80156d2 3b0d12179262 |
children | 162a767a20d4 |
comparison
equal
deleted
inserted
replaced
18338:466f933f4a6b | 25521:636679fb98ad |
---|---|
134 #define MIN_COLOR_CONTRAST 200 | 134 #define MIN_COLOR_CONTRAST 200 |
135 | 135 |
136 #define NUM_NICK_COLORS 220 | 136 #define NUM_NICK_COLORS 220 |
137 static GdkColor *nick_colors = NULL; | 137 static GdkColor *nick_colors = NULL; |
138 static guint nbr_nick_colors; | 138 static guint nbr_nick_colors; |
139 | |
140 /* yaz. If you want to use shortcut keys that may conflict with | |
141 inputmethods, change this to 1. */ | |
142 #define ENABLE_SHORTCUT 0 | |
139 | 143 |
140 typedef struct { | 144 typedef struct { |
141 GtkWidget *window; | 145 GtkWidget *window; |
142 | 146 |
143 GtkWidget *entry; | 147 GtkWidget *entry; |
2790 { N_("/Conversation/New Instant _Message..."), "<CTL>M", menu_new_conv_cb, | 2794 { N_("/Conversation/New Instant _Message..."), "<CTL>M", menu_new_conv_cb, |
2791 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW }, | 2795 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW }, |
2792 | 2796 |
2793 { "/Conversation/sep0", NULL, NULL, 0, "<Separator>", NULL }, | 2797 { "/Conversation/sep0", NULL, NULL, 0, "<Separator>", NULL }, |
2794 | 2798 |
2799 #if ENABLE_SHORTCUT | |
2795 { N_("/Conversation/_Find..."), NULL, menu_find_cb, 0, | 2800 { N_("/Conversation/_Find..."), NULL, menu_find_cb, 0, |
2796 "<StockItem>", GTK_STOCK_FIND }, | 2801 "<StockItem>", GTK_STOCK_FIND }, |
2802 #else | |
2803 { N_("/Conversation/_Find..."), NULL, menu_find_cb, 0, | |
2804 "<Item>" }, | |
2805 #endif | |
2797 { N_("/Conversation/View _Log"), NULL, menu_view_log_cb, 0, "<Item>", NULL }, | 2806 { N_("/Conversation/View _Log"), NULL, menu_view_log_cb, 0, "<Item>", NULL }, |
2798 { N_("/Conversation/_Save As..."), NULL, menu_save_as_cb, 0, | 2807 { N_("/Conversation/_Save As..."), NULL, menu_save_as_cb, 0, |
2799 "<StockItem>", GTK_STOCK_SAVE_AS }, | 2808 "<StockItem>", GTK_STOCK_SAVE_AS }, |
2809 #if ENABLE_SHORTCUT | |
2800 { N_("/Conversation/Clea_r Scrollback"), "<CTL>L", menu_clear_cb, 0, "<StockItem>", GTK_STOCK_CLEAR }, | 2810 { N_("/Conversation/Clea_r Scrollback"), "<CTL>L", menu_clear_cb, 0, "<StockItem>", GTK_STOCK_CLEAR }, |
2801 | 2811 #else |
2812 { N_("/Conversation/Clea_r Scrollback"), NULL, menu_clear_cb, 0, "<Item>" }, | |
2813 #endif | |
2802 { "/Conversation/sep1", NULL, NULL, 0, "<Separator>", NULL }, | 2814 { "/Conversation/sep1", NULL, NULL, 0, "<Separator>", NULL }, |
2803 | 2815 |
2804 { N_("/Conversation/Se_nd File..."), NULL, menu_send_file_cb, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_SEND_FILE }, | 2816 { N_("/Conversation/Se_nd File..."), NULL, menu_send_file_cb, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_SEND_FILE }, |
2805 { N_("/Conversation/Add Buddy _Pounce..."), NULL, menu_add_pounce_cb, | 2817 { N_("/Conversation/Add Buddy _Pounce..."), NULL, menu_add_pounce_cb, |
2806 0, "<Item>", NULL }, | 2818 0, "<Item>", NULL }, |
2819 #if ENABLE_SHORTCUT | |
2807 { N_("/Conversation/_Get Info"), "<CTL>O", menu_get_info_cb, 0, | 2820 { N_("/Conversation/_Get Info"), "<CTL>O", menu_get_info_cb, 0, |
2808 "<StockItem>", PIDGIN_STOCK_TOOLBAR_USER_INFO }, | 2821 "<StockItem>", PIDGIN_STOCK_TOOLBAR_USER_INFO }, |
2822 #else | |
2823 { N_("/Conversation/_Get Info"), NULL, menu_get_info_cb, 0, | |
2824 "<StockItem>", PIDGIN_STOCK_TOOLBAR_USER_INFO }, | |
2825 #endif | |
2809 { N_("/Conversation/In_vite..."), NULL, menu_invite_cb, 0, | 2826 { N_("/Conversation/In_vite..."), NULL, menu_invite_cb, 0, |
2810 "<Item>", NULL }, | 2827 "<Item>", NULL }, |
2811 { N_("/Conversation/M_ore"), NULL, NULL, 0, "<Branch>", NULL }, | 2828 { N_("/Conversation/M_ore"), NULL, NULL, 0, "<Branch>", NULL }, |
2812 | 2829 |
2813 { "/Conversation/sep2", NULL, NULL, 0, "<Separator>", NULL }, | 2830 { "/Conversation/sep2", NULL, NULL, 0, "<Separator>", NULL }, |
3491 | 3508 |
3492 if (win->menu.send_to != NULL) | 3509 if (win->menu.send_to != NULL) |
3493 gtk_widget_destroy(win->menu.send_to); | 3510 gtk_widget_destroy(win->menu.send_to); |
3494 | 3511 |
3495 /* Build the Send To menu */ | 3512 /* Build the Send To menu */ |
3513 | |
3514 #if ENABLE_SHORTCUT | |
3496 win->menu.send_to = gtk_menu_item_new_with_mnemonic(_("_Send To")); | 3515 win->menu.send_to = gtk_menu_item_new_with_mnemonic(_("_Send To")); |
3516 #else | |
3517 win->menu.send_to = gtk_menu_item_new_with_mnemonic(_("Send To")); //to free Alt-s. intentional. --yaz | |
3518 #endif | |
3497 gtk_widget_show(win->menu.send_to); | 3519 gtk_widget_show(win->menu.send_to); |
3498 | 3520 |
3499 menu = gtk_menu_new(); | 3521 menu = gtk_menu_new(); |
3500 gtk_menu_shell_insert(GTK_MENU_SHELL(win->menu.menubar), | 3522 gtk_menu_shell_insert(GTK_MENU_SHELL(win->menu.menubar), |
3501 win->menu.send_to, 2); | 3523 win->menu.send_to, 2); |
3965 PurplePluginProtocolInfo *prpl_info = NULL; | 3987 PurplePluginProtocolInfo *prpl_info = NULL; |
3966 PurpleConnection *gc; | 3988 PurpleConnection *gc; |
3967 PurpleConversation *conv = gtkconv->active_conv; | 3989 PurpleConversation *conv = gtkconv->active_conv; |
3968 PidginChatPane *gtkchat; | 3990 PidginChatPane *gtkchat; |
3969 char *new_topic; | 3991 char *new_topic; |
3970 const char *current_topic; | 3992 // const char *current_topic; |
3993 char dummy[] = "No Topic"; | |
3994 char *current_topic = NULL; | |
3971 | 3995 |
3972 gc = purple_conversation_get_gc(conv); | 3996 gc = purple_conversation_get_gc(conv); |
3973 | 3997 |
3974 if(!gc || !(prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl))) | 3998 if(!gc || !(prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl))) |
3975 return; | 3999 return; |
3978 return; | 4002 return; |
3979 | 4003 |
3980 gtkconv = PIDGIN_CONVERSATION(conv); | 4004 gtkconv = PIDGIN_CONVERSATION(conv); |
3981 gtkchat = gtkconv->u.chat; | 4005 gtkchat = gtkconv->u.chat; |
3982 new_topic = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text))); | 4006 new_topic = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text))); |
4007 // purple_debug_info("yaz gtkconv", "new_topic=%s\n", new_topic); | |
3983 current_topic = purple_conv_chat_get_topic(PURPLE_CONV_CHAT(conv)); | 4008 current_topic = purple_conv_chat_get_topic(PURPLE_CONV_CHAT(conv)); |
4009 | |
4010 if(!current_topic) | |
4011 current_topic = dummy; | |
4012 // purple_debug_info("yaz gtkconv", "current_topic=%s\n", current_topic); | |
3984 | 4013 |
3985 if(current_topic && !g_utf8_collate(new_topic, current_topic)){ | 4014 if(current_topic && !g_utf8_collate(new_topic, current_topic)){ |
3986 g_free(new_topic); | 4015 g_free(new_topic); |
3987 return; | 4016 return; |
3988 } | 4017 } |
6162 | 6191 |
6163 if ((fields & PIDGIN_CONV_COLORIZE_TITLE) || | 6192 if ((fields & PIDGIN_CONV_COLORIZE_TITLE) || |
6164 (fields & PIDGIN_CONV_SET_TITLE) || | 6193 (fields & PIDGIN_CONV_SET_TITLE) || |
6165 (fields & PIDGIN_CONV_TOPIC)) | 6194 (fields & PIDGIN_CONV_TOPIC)) |
6166 { | 6195 { |
6167 char *title; | 6196 char *title, *title_tmp; |
6168 PurpleConvIm *im = NULL; | 6197 PurpleConvIm *im = NULL; |
6169 PurpleAccount *account = purple_conversation_get_account(conv); | 6198 PurpleAccount *account = purple_conversation_get_account(conv); |
6170 char *markup = NULL; | 6199 char *markup = NULL; |
6171 AtkObject *accessibility_obj; | 6200 AtkObject *accessibility_obj; |
6201 gboolean ellipsis = FALSE; | |
6172 /* I think this is a little longer than it needs to be but I'm lazy. */ | 6202 /* I think this is a little longer than it needs to be but I'm lazy. */ |
6173 char style[51]; | 6203 char style[51]; |
6174 | 6204 |
6175 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) | 6205 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) |
6176 im = PURPLE_CONV_IM(conv); | 6206 im = PURPLE_CONV_IM(conv); |
6236 { | 6266 { |
6237 atk_object_set_description(accessibility_obj, _("New Event")); | 6267 atk_object_set_description(accessibility_obj, _("New Event")); |
6238 strncpy(style, "color=\"#888a85\" style=\"italic\"", sizeof(style)); | 6268 strncpy(style, "color=\"#888a85\" style=\"italic\"", sizeof(style)); |
6239 } | 6269 } |
6240 | 6270 |
6271 // nosuke's tab width patch | |
6272 if ((purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/tab_side") == (GTK_POS_LEFT|8) | |
6273 || purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/tab_side") == (GTK_POS_RIGHT|8)) | |
6274 && purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/trim_vertical_tabs")) | |
6275 ellipsis = TRUE; | |
6276 | |
6277 if (ellipsis) | |
6278 title_tmp = pidgin_gtk_ellipsis_text(gtkconv->tab_label, title, 60, "..."); | |
6279 else | |
6280 title_tmp = title; | |
6281 | |
6282 | |
6241 if (*style != '\0') | 6283 if (*style != '\0') |
6242 { | 6284 { |
6243 char *html_title,*label; | 6285 char *html_title,*label; |
6244 | 6286 |
6245 html_title = g_markup_escape_text(title, -1); | 6287 html_title = g_markup_escape_text(title_tmp, -1); |
6246 | 6288 |
6247 label = g_strdup_printf("<span %s>%s</span>", | 6289 label = g_strdup_printf("<span %s>%s</span>", |
6248 style, html_title); | 6290 style, html_title); |
6249 g_free(html_title); | 6291 g_free(html_title); |
6250 gtk_label_set_markup(GTK_LABEL(gtkconv->tab_label), label); | 6292 gtk_label_set_markup(GTK_LABEL(gtkconv->tab_label), label); |
6251 g_free(label); | 6293 g_free(label); |
6252 } | 6294 } |
6253 else | 6295 else |
6254 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title); | 6296 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title_tmp); |
6255 | 6297 |
6256 if (pidgin_conv_window_is_active_conversation(conv)) | 6298 if (pidgin_conv_window_is_active_conversation(conv)) |
6257 update_typing_icon(gtkconv); | 6299 update_typing_icon(gtkconv); |
6258 | 6300 |
6259 gtk_label_set_text(GTK_LABEL(gtkconv->menu_label), title); | 6301 gtk_label_set_text(GTK_LABEL(gtkconv->menu_label), title); |
6600 } | 6642 } |
6601 | 6643 |
6602 return page_num; | 6644 return page_num; |
6603 } | 6645 } |
6604 | 6646 |
6647 //nosuke | |
6648 static void | |
6649 trim_vertical_tabs_pref_cb(const char *name, PurplePrefType type, | |
6650 gconstpointer value, gpointer data) | |
6651 { | |
6652 GList *l; | |
6653 PurpleConversation *conv; | |
6654 | |
6655 for (l = purple_get_conversations(); l != NULL; l = l->next) { | |
6656 conv = (PurpleConversation *)l->data; | |
6657 | |
6658 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv)) | |
6659 continue; | |
6660 | |
6661 pidgin_conv_update_fields(conv, PIDGIN_CONV_SET_TITLE); | |
6662 } | |
6663 } | |
6664 | |
6605 static void | 6665 static void |
6606 close_on_tabs_pref_cb(const char *name, PurplePrefType type, | 6666 close_on_tabs_pref_cb(const char *name, PurplePrefType type, |
6607 gconstpointer value, gpointer data) | 6667 gconstpointer value, gpointer data) |
6608 { | 6668 { |
6609 GList *l; | 6669 GList *l; |
6669 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos&~8); | 6729 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos&~8); |
6670 for (gtkconvs = gtkwin->gtkconvs; gtkconvs != NULL; gtkconvs = gtkconvs->next) { | 6730 for (gtkconvs = gtkwin->gtkconvs; gtkconvs != NULL; gtkconvs = gtkconvs->next) { |
6671 pidgin_conv_tab_pack(gtkwin, gtkconvs->data); | 6731 pidgin_conv_tab_pack(gtkwin, gtkconvs->data); |
6672 } | 6732 } |
6673 } | 6733 } |
6734 trim_vertical_tabs_pref_cb(name, type, value, data); | |
6674 } | 6735 } |
6675 | 6736 |
6676 static void | 6737 static void |
6677 show_timestamps_pref_cb(const char *name, PurplePrefType type, | 6738 show_timestamps_pref_cb(const char *name, PurplePrefType type, |
6678 gconstpointer value, gpointer data) | 6739 gconstpointer value, gpointer data) |
7038 | 7099 |
7039 /* Conversations */ | 7100 /* Conversations */ |
7040 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations"); | 7101 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations"); |
7041 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/use_smooth_scrolling", TRUE); | 7102 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/use_smooth_scrolling", TRUE); |
7042 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/close_on_tabs", TRUE); | 7103 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/close_on_tabs", TRUE); |
7104 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/trim_vertical_tabs", FALSE); | |
7043 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_bold", FALSE); | 7105 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_bold", FALSE); |
7044 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_italic", FALSE); | 7106 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_italic", FALSE); |
7045 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_underline", FALSE); | 7107 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_underline", FALSE); |
7046 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/spellcheck", TRUE); | 7108 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/spellcheck", TRUE); |
7047 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting", TRUE); | 7109 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting", TRUE); |
7083 purple_prefs_add_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new", "never"); | 7145 purple_prefs_add_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new", "never"); |
7084 | 7146 |
7085 /* Connect callbacks. */ | 7147 /* Connect callbacks. */ |
7086 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/close_on_tabs", | 7148 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/close_on_tabs", |
7087 close_on_tabs_pref_cb, NULL); | 7149 close_on_tabs_pref_cb, NULL); |
7150 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/trim_vertical_tabs", | |
7151 trim_vertical_tabs_pref_cb, NULL); | |
7088 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/show_timestamps", | 7152 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/show_timestamps", |
7089 show_timestamps_pref_cb, NULL); | 7153 show_timestamps_pref_cb, NULL); |
7090 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar", | 7154 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar", |
7091 show_formatting_toolbar_pref_cb, NULL); | 7155 show_formatting_toolbar_pref_cb, NULL); |
7092 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/spellcheck", | 7156 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/spellcheck", |