comparison pidgin/gtkblist.c @ 31007:c5ba7dd399fa

merged from im.pidgin.pidgin: - oscar.c needs to be revised - changes in google.c may need to be salvaged
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Wed, 22 Sep 2010 14:17:09 +0900
parents 810a6be1920f c8d6a2cc3bfe
children fa88dc1dcabb
comparison
equal deleted inserted replaced
30786:86e77ae76e16 31007:c5ba7dd399fa
3171 gtkblist->tooltipdata = g_list_append(gtkblist->tooltipdata, td); 3171 gtkblist->tooltipdata = g_list_append(gtkblist->tooltipdata, td);
3172 } 3172 }
3173 } else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { 3173 } else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
3174 PurpleBlistNode *child; 3174 PurpleBlistNode *child;
3175 PurpleBuddy *b = purple_contact_get_priority_buddy((PurpleContact *)node); 3175 PurpleBuddy *b = purple_contact_get_priority_buddy((PurpleContact *)node);
3176 width = height = 0;
3177 3176
3178 for(child = node->child; child; child = child->next) 3177 for(child = node->child; child; child = child->next)
3179 { 3178 {
3180 if(PURPLE_BLIST_NODE_IS_BUDDY(child) && buddy_is_displayable((PurpleBuddy*)child)) { 3179 if(PURPLE_BLIST_NODE_IS_BUDDY(child) && buddy_is_displayable((PurpleBuddy*)child)) {
3181 struct tooltip_data *td = create_tip_for_node(child, (b == (PurpleBuddy*)child)); 3180 struct tooltip_data *td = create_tip_for_node(child, (b == (PurpleBuddy*)child));
3657 /*************************************************** 3656 /***************************************************
3658 * Crap * 3657 * Crap *
3659 ***************************************************/ 3658 ***************************************************/
3660 static GtkItemFactoryEntry blist_menu[] = 3659 static GtkItemFactoryEntry blist_menu[] =
3661 { 3660 {
3661 /* NOTE: Do not set any accelerator to Control+O. It is mapped by
3662 gtk_blist_key_press_cb to "Get User Info" on the selected buddy. */
3663
3662 /* Buddies menu */ 3664 /* Buddies menu */
3663 { N_("/_Buddies"), NULL, NULL, 0, "<Branch>", NULL }, 3665 { N_("/_Buddies"), NULL, NULL, 0, "<Branch>", NULL },
3664 { N_("/Buddies/New Instant _Message..."), "<CTL>M", pidgin_dialogs_im, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW }, 3666 { N_("/Buddies/New Instant _Message..."), "<CTL>M", pidgin_dialogs_im, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW },
3665 { N_("/Buddies/Join a _Chat..."), "<CTL>C", pidgin_blist_joinchat_show, 0, "<StockItem>", PIDGIN_STOCK_CHAT }, 3667 { N_("/Buddies/Join a _Chat..."), "<CTL>C", pidgin_blist_joinchat_show, 0, "<StockItem>", PIDGIN_STOCK_CHAT },
3666 { N_("/Buddies/Get User _Info..."), "<CTL>I", pidgin_dialogs_info, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_USER_INFO }, 3668 { N_("/Buddies/Get User _Info..."), "<CTL>I", pidgin_dialogs_info, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_USER_INFO },
3690 { N_("/Tools/_Certificates"), NULL, pidgin_certmgr_show, 0, "<Item>", NULL }, 3692 { N_("/Tools/_Certificates"), NULL, pidgin_certmgr_show, 0, "<Item>", NULL },
3691 { N_("/Tools/Custom Smile_ys"), "<CTL>Y", pidgin_smiley_manager_show, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_SMILEY }, 3693 { N_("/Tools/Custom Smile_ys"), "<CTL>Y", pidgin_smiley_manager_show, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_SMILEY },
3692 { N_("/Tools/Plu_gins"), "<CTL>U", pidgin_plugin_dialog_show, 2, "<StockItem>", PIDGIN_STOCK_TOOLBAR_PLUGINS }, 3694 { N_("/Tools/Plu_gins"), "<CTL>U", pidgin_plugin_dialog_show, 2, "<StockItem>", PIDGIN_STOCK_TOOLBAR_PLUGINS },
3693 { N_("/Tools/Pr_eferences"), "<CTL>P", pidgin_prefs_show, 0, "<StockItem>", GTK_STOCK_PREFERENCES }, 3695 { N_("/Tools/Pr_eferences"), "<CTL>P", pidgin_prefs_show, 0, "<StockItem>", GTK_STOCK_PREFERENCES },
3694 { N_("/Tools/Pr_ivacy"), NULL, pidgin_privacy_dialog_show, 0, "<Item>", NULL }, 3696 { N_("/Tools/Pr_ivacy"), NULL, pidgin_privacy_dialog_show, 0, "<Item>", NULL },
3695 { N_("/Tools/Set _Mood"), "<CTL>O", set_mood_show, 0, "<Item>", NULL }, 3697 { N_("/Tools/Set _Mood"), "<CTL>D", set_mood_show, 0, "<Item>", NULL },
3696 { "/Tools/sep2", NULL, NULL, 0, "<Separator>", NULL }, 3698 { "/Tools/sep2", NULL, NULL, 0, "<Separator>", NULL },
3697 { N_("/Tools/_File Transfers"), "<CTL>T", pidgin_xfer_dialog_show, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_TRANSFER }, 3699 { N_("/Tools/_File Transfers"), "<CTL>T", pidgin_xfer_dialog_show, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_TRANSFER },
3698 { N_("/Tools/R_oom List"), NULL, pidgin_roomlist_dialog_show, 0, "<Item>", NULL }, 3700 { N_("/Tools/R_oom List"), NULL, pidgin_roomlist_dialog_show, 0, "<Item>", NULL },
3699 { N_("/Tools/System _Log"), NULL, gtk_blist_show_systemlog_cb, 3, "<Item>", NULL }, 3701 { N_("/Tools/System _Log"), NULL, gtk_blist_show_systemlog_cb, 3, "<Item>", NULL },
3700 { "/Tools/sep3", NULL, NULL, 0, "<Separator>", NULL }, 3702 { "/Tools/sep3", NULL, NULL, 0, "<Separator>", NULL },
3970 purple_notify_user_info_add_pair(user_info, 3972 purple_notify_user_info_add_pair(user_info,
3971 _("Online Buddies"), 3973 _("Online Buddies"),
3972 tmp); 3974 tmp);
3973 g_free(tmp); 3975 g_free(tmp);
3974 } 3976 }
3975 count = 0;
3976 3977
3977 count = purple_blist_get_group_size(group, FALSE); 3978 count = purple_blist_get_group_size(group, FALSE);
3978 if (count != 0) { 3979 if (count != 0) {
3979 /* Total buddies (from online accounts) in group */ 3980 /* Total buddies (from online accounts) in group */
3980 tmp = g_strdup_printf("%d", count); 3981 tmp = g_strdup_printf("%d", count);
3981 purple_notify_user_info_add_pair(user_info, 3982 purple_notify_user_info_add_pair(user_info,
3982 _("Total Buddies"), 3983 _("Total Buddies"),
3983 tmp); 3984 tmp);
3984 g_free(tmp); 3985 g_free(tmp);
3985 } 3986 }
3986 count = 0;
3987 3987
3988 tmp = purple_notify_user_info_get_text_with_newline(user_info, "\n"); 3988 tmp = purple_notify_user_info_get_text_with_newline(user_info, "\n");
3989 g_string_append(str, tmp); 3989 g_string_append(str, tmp);
3990 g_free(tmp); 3990 g_free(tmp);
3991 3991
4028 GdkPixbuf * 4028 GdkPixbuf *
4029 pidgin_blist_get_emblem(PurpleBlistNode *node) 4029 pidgin_blist_get_emblem(PurpleBlistNode *node)
4030 { 4030 {
4031 PurpleBuddy *buddy = NULL; 4031 PurpleBuddy *buddy = NULL;
4032 struct _pidgin_blist_node *gtknode = node->ui_data; 4032 struct _pidgin_blist_node *gtknode = node->ui_data;
4033 struct _pidgin_blist_node *gtkbuddynode = NULL;
4034 PurplePlugin *prpl; 4033 PurplePlugin *prpl;
4035 PurplePluginProtocolInfo *prpl_info; 4034 PurplePluginProtocolInfo *prpl_info;
4036 const char *name = NULL; 4035 const char *name = NULL;
4037 char *filename, *path; 4036 char *filename, *path;
4038 PurplePresence *p = NULL; 4037 PurplePresence *p = NULL;
4039 PurpleStatus *tune; 4038 PurpleStatus *tune;
4040 4039
4041 if(PURPLE_BLIST_NODE_IS_CONTACT(node)) { 4040 if(PURPLE_BLIST_NODE_IS_CONTACT(node)) {
4042 if(!gtknode->contact_expanded) { 4041 if(!gtknode->contact_expanded) {
4043 buddy = purple_contact_get_priority_buddy((PurpleContact*)node); 4042 buddy = purple_contact_get_priority_buddy((PurpleContact*)node);
4044 gtkbuddynode = ((PurpleBlistNode*)buddy)->ui_data;
4045 } 4043 }
4046 } else if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { 4044 } else if(PURPLE_BLIST_NODE_IS_BUDDY(node)) {
4047 buddy = (PurpleBuddy*)node; 4045 buddy = (PurpleBuddy*)node;
4048 gtkbuddynode = node->ui_data;
4049 p = purple_buddy_get_presence(buddy); 4046 p = purple_buddy_get_presence(buddy);
4050 if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_MOBILE)) { 4047 if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_MOBILE)) {
4051 /* This emblem comes from the small emoticon set now, 4048 /* This emblem comes from the small emoticon set now,
4052 * to reduce duplication. */ 4049 * to reduce duplication. */
4053 path = g_build_filename(DATADIR, "pixmaps", "pidgin", "emotes", 4050 path = g_build_filename(DATADIR, "pixmaps", "pidgin", "emotes",
4136 4133
4137 GdkPixbuf * 4134 GdkPixbuf *
4138 pidgin_blist_get_status_icon(PurpleBlistNode *node, PidginStatusIconSize size) 4135 pidgin_blist_get_status_icon(PurpleBlistNode *node, PidginStatusIconSize size)
4139 { 4136 {
4140 GdkPixbuf *ret; 4137 GdkPixbuf *ret;
4141 const char *protoname = NULL;
4142 const char *icon = NULL; 4138 const char *icon = NULL;
4143 struct _pidgin_blist_node *gtknode = node->ui_data; 4139 struct _pidgin_blist_node *gtknode = node->ui_data;
4144 struct _pidgin_blist_node *gtkbuddynode = NULL; 4140 struct _pidgin_blist_node *gtkbuddynode = NULL;
4145 PurpleBuddy *buddy = NULL; 4141 PurpleBuddy *buddy = NULL;
4146 PurpleChat *chat = NULL; 4142 PurpleChat *chat = NULL;
4163 } 4159 }
4164 4160
4165 if(buddy || chat) { 4161 if(buddy || chat) {
4166 PurpleAccount *account; 4162 PurpleAccount *account;
4167 PurplePlugin *prpl; 4163 PurplePlugin *prpl;
4168 PurplePluginProtocolInfo *prpl_info;
4169 4164
4170 if(buddy) 4165 if(buddy)
4171 account = buddy->account; 4166 account = buddy->account;
4172 else 4167 else
4173 account = chat->account; 4168 account = chat->account;
4174 4169
4175 prpl = purple_find_prpl(purple_account_get_protocol_id(account)); 4170 prpl = purple_find_prpl(purple_account_get_protocol_id(account));
4176 if(!prpl) 4171 if(!prpl)
4177 return NULL; 4172 return NULL;
4178
4179 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
4180
4181 if(prpl_info && prpl_info->list_icon) {
4182 protoname = prpl_info->list_icon(account, buddy);
4183 }
4184 } 4173 }
4185 4174
4186 if(buddy) { 4175 if(buddy) {
4187 PurpleConversation *conv = find_conversation_with_buddy(buddy); 4176 PurpleConversation *conv = find_conversation_with_buddy(buddy);
4188 PurplePresence *p; 4177 PurplePresence *p;