Mercurial > pidgin.yaz
comparison pidgin/gtkblist.c @ 27666:a08e84032814
merge of '2348ff22f0ff3453774b8b25b36238465580c609'
and 'e76f11543c2a4aa05bdf584f087cbe3439029661'
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sun, 12 Jul 2009 05:43:38 +0000 |
parents | cbee8aecc90a |
children | 381acdb3cedc |
comparison
equal
deleted
inserted
replaced
27186:048bcf41deef | 27666:a08e84032814 |
---|---|
1503 pidgin_blist_make_buddy_menu(GtkWidget *menu, PurpleBuddy *buddy, gboolean sub) { | 1503 pidgin_blist_make_buddy_menu(GtkWidget *menu, PurpleBuddy *buddy, gboolean sub) { |
1504 PurplePluginProtocolInfo *prpl_info; | 1504 PurplePluginProtocolInfo *prpl_info; |
1505 PurpleContact *contact; | 1505 PurpleContact *contact; |
1506 PurpleBlistNode *node; | 1506 PurpleBlistNode *node; |
1507 gboolean contact_expanded = FALSE; | 1507 gboolean contact_expanded = FALSE; |
1508 gboolean show_offline = FALSE; | |
1509 | 1508 |
1510 g_return_if_fail(menu); | 1509 g_return_if_fail(menu); |
1511 g_return_if_fail(buddy); | 1510 g_return_if_fail(buddy); |
1512 | 1511 |
1513 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(buddy->account->gc->prpl); | 1512 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(buddy->account->gc->prpl); |
1571 } else if (!sub) { | 1570 } else if (!sub) { |
1572 pidgin_new_item_from_stock(menu, _("View _Log"), NULL, | 1571 pidgin_new_item_from_stock(menu, _("View _Log"), NULL, |
1573 G_CALLBACK(gtk_blist_menu_showlog_cb), buddy, 0, 0, NULL); | 1572 G_CALLBACK(gtk_blist_menu_showlog_cb), buddy, 0, 0, NULL); |
1574 } | 1573 } |
1575 | 1574 |
1576 if (!(purple_blist_node_get_flags(node) & PURPLE_BLIST_NODE_FLAG_NO_SAVE)) { | 1575 if (!PURPLE_BLIST_NODE_HAS_FLAG(node, PURPLE_BLIST_NODE_FLAG_NO_SAVE)) { |
1577 show_offline = purple_blist_node_get_bool(node, "show_offline"); | 1576 gboolean show_offline = purple_blist_node_get_bool(node, "show_offline"); |
1578 pidgin_new_item_from_stock(menu, show_offline ? _("Hide when offline") : _("Show when offline"), | 1577 pidgin_new_item_from_stock(menu, show_offline ? _("Hide When Offline") : _("Show When Offline"), |
1579 NULL, G_CALLBACK(gtk_blist_menu_showoffline_cb), node, 0, 0, NULL); | 1578 NULL, G_CALLBACK(gtk_blist_menu_showoffline_cb), node, 0, 0, NULL); |
1580 } | 1579 } |
1581 | 1580 |
1582 pidgin_append_blist_node_proto_menu(menu, buddy->account->gc, node); | 1581 pidgin_append_blist_node_proto_menu(menu, buddy->account->gc, node); |
1583 pidgin_append_blist_node_extended_menu(menu, node); | 1582 pidgin_append_blist_node_extended_menu(menu, node); |
1757 G_CALLBACK(pidgin_blist_remove_cb), node, 0, 0, NULL); | 1756 G_CALLBACK(pidgin_blist_remove_cb), node, 0, 0, NULL); |
1758 pidgin_new_item_from_stock(menu, _("_Rename"), NULL, | 1757 pidgin_new_item_from_stock(menu, _("_Rename"), NULL, |
1759 G_CALLBACK(gtk_blist_menu_alias_cb), node, 0, 0, NULL); | 1758 G_CALLBACK(gtk_blist_menu_alias_cb), node, 0, 0, NULL); |
1760 if (!(purple_blist_node_get_flags(node) & PURPLE_BLIST_NODE_FLAG_NO_SAVE)) { | 1759 if (!(purple_blist_node_get_flags(node) & PURPLE_BLIST_NODE_FLAG_NO_SAVE)) { |
1761 gboolean show_offline = purple_blist_node_get_bool(node, "show_offline"); | 1760 gboolean show_offline = purple_blist_node_get_bool(node, "show_offline"); |
1762 pidgin_new_item_from_stock(menu, show_offline ? _("Hide when offline") : _("Show when offline"), | 1761 pidgin_new_item_from_stock(menu, show_offline ? _("Hide When Offline") : _("Show When Offline"), |
1763 NULL, G_CALLBACK(gtk_blist_menu_showoffline_cb), node, 0, 0, NULL); | 1762 NULL, G_CALLBACK(gtk_blist_menu_showoffline_cb), node, 0, 0, NULL); |
1764 } | 1763 } |
1765 | 1764 |
1766 add_buddy_icon_menu_items(menu, node); | 1765 add_buddy_icon_menu_items(menu, node); |
1767 | 1766 |
6298 NODE_COLUMN, &selected_node, -1); | 6297 NODE_COLUMN, &selected_node, -1); |
6299 } | 6298 } |
6300 selected = (gnode == selected_node); | 6299 selected = (gnode == selected_node); |
6301 | 6300 |
6302 if (!expanded) { | 6301 if (!expanded) { |
6303 g_snprintf(group_count, sizeof(group_count), " (%d/%d)", | 6302 g_snprintf(group_count, sizeof(group_count), "%d/%d", |
6304 purple_blist_get_group_online_count(group), | 6303 purple_blist_get_group_online_count(group), |
6305 purple_blist_get_group_size(group, FALSE)); | 6304 purple_blist_get_group_size(group, FALSE)); |
6306 } | 6305 } |
6307 | 6306 |
6308 theme = pidgin_blist_get_theme(); | 6307 theme = pidgin_blist_get_theme(); |
6317 text_color = selected ? NULL : theme_font_get_color_default(pair, NULL); | 6316 text_color = selected ? NULL : theme_font_get_color_default(pair, NULL); |
6318 text_font = theme_font_get_face_default(pair, ""); | 6317 text_font = theme_font_get_face_default(pair, ""); |
6319 | 6318 |
6320 esc = g_markup_escape_text(group->name, -1); | 6319 esc = g_markup_escape_text(group->name, -1); |
6321 if (text_color) { | 6320 if (text_color) { |
6322 mark = g_strdup_printf("<span foreground='%s' font_desc='%s'><b>%s</b>%s</span>", | 6321 mark = g_strdup_printf("<span foreground='%s' font_desc='%s'><b>%s</b>%s%s%s</span>", |
6323 text_color, text_font, esc ? esc : "", group_count); | 6322 text_color, text_font, |
6323 esc ? esc : "", | |
6324 !expanded ? " <span weight='light'>(</span>" : "", | |
6325 group_count, | |
6326 !expanded ? "<span weight='light'>)</span>" : ""); | |
6324 } else { | 6327 } else { |
6325 mark = g_strdup_printf("<span font_desc='%s'><b>%s</b>%s</span>", | 6328 mark = g_strdup_printf("<span font_desc='%s'><b>%s</b>%s%s%s</span>", |
6326 text_font, esc ? esc : "", group_count); | 6329 text_font, esc ? esc : "", |
6330 !expanded ? " <span weight='light'>(</span>" : "", | |
6331 group_count, | |
6332 !expanded ? "<span weight='light'>)</span>" : ""); | |
6327 } | 6333 } |
6328 | 6334 |
6329 g_free(esc); | 6335 g_free(esc); |
6330 return mark; | 6336 return mark; |
6331 } | 6337 } |
6706 #if !GTK_CHECK_VERSION(2,6,0) | 6712 #if !GTK_CHECK_VERSION(2,6,0) |
6707 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(gtkblist->treeview)); | 6713 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(gtkblist->treeview)); |
6708 #endif | 6714 #endif |
6709 } | 6715 } |
6710 | 6716 |
6711 | |
6712 static void pidgin_blist_destroy(PurpleBuddyList *list) | 6717 static void pidgin_blist_destroy(PurpleBuddyList *list) |
6713 { | 6718 { |
6714 PidginBuddyListPrivate *priv; | 6719 PidginBuddyListPrivate *priv; |
6715 | 6720 |
6716 if (!gtkblist) | 6721 if (!list || !list->ui_data) |
6717 return; | 6722 return; |
6723 | |
6724 g_return_if_fail(list->ui_data != gtkblist); | |
6718 | 6725 |
6719 purple_signals_disconnect_by_handle(gtkblist); | 6726 purple_signals_disconnect_by_handle(gtkblist); |
6720 | 6727 |
6721 if (gtkblist->headline_close) | 6728 if (gtkblist->headline_close) |
6722 g_object_unref(G_OBJECT(gtkblist->headline_close)); | 6729 g_object_unref(G_OBJECT(gtkblist->headline_close)); |
7866 } else { | 7873 } else { |
7867 enabled_accounts = TRUE; | 7874 enabled_accounts = TRUE; |
7868 } | 7875 } |
7869 } | 7876 } |
7870 | 7877 |
7871 if (!enabled_accounts) | 7878 if (!enabled_accounts) { |
7879 gtk_widget_show_all(accountmenu); | |
7872 return; | 7880 return; |
7881 } | |
7873 | 7882 |
7874 pidgin_separator(accountmenu); | 7883 pidgin_separator(accountmenu); |
7875 accel_group = gtk_menu_get_accel_group(GTK_MENU(accountmenu)); | 7884 accel_group = gtk_menu_get_accel_group(GTK_MENU(accountmenu)); |
7876 | 7885 |
7877 for (accounts = purple_accounts_get_all(); accounts; accounts = accounts->next) { | 7886 for (accounts = purple_accounts_get_all(); accounts; accounts = accounts->next) { |