Mercurial > pidgin
diff pidgin/gtkblist.c @ 32667:e2a1510da13d
propagate from branch 'im.pidgin.pidgin' (head 5da91575f92c8c13d7a85eef338ec6da55e6fb26)
to branch 'im.pidgin.cpw.qulogic.gtk3' (head 53d36fd22e482079303664b9f3e13fa2a4b6f9b2)
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Mon, 22 Aug 2011 21:27:03 +0000 |
parents | d1315b4e1e4a 99ca503ea087 |
children | 3828a61c44da |
line wrap: on
line diff
--- a/pidgin/gtkblist.c Mon Apr 25 20:13:05 2011 +0000 +++ b/pidgin/gtkblist.c Mon Aug 22 21:27:03 2011 +0000 @@ -2657,7 +2657,6 @@ gboolean scaled, gboolean greyed) { gsize len; - GdkPixbufLoader *loader; PurpleBuddy *buddy = NULL; PurpleGroup *group = NULL; const guchar *data = NULL; @@ -2724,21 +2723,20 @@ return NULL; } - loader = gdk_pixbuf_loader_new(); - gdk_pixbuf_loader_write(loader, data, len, NULL); - gdk_pixbuf_loader_close(loader, NULL); - - purple_imgstore_unref(custom_img); + buf = pidgin_pixbuf_from_data(data, len); purple_buddy_icon_unref(icon); - - buf = gdk_pixbuf_loader_get_pixbuf(loader); - if (buf) - g_object_ref(G_OBJECT(buf)); - g_object_unref(G_OBJECT(loader)); - if (!buf) { + purple_debug_warning("gtkblist", "Couldn't load buddy icon " + "on account %s (%s) buddyname=%s " + "custom_img_data=%p\n", + account ? purple_account_get_username(account) : "(no account)", + account ? purple_account_get_protocol_id(account) : "(no account)", + buddy ? purple_buddy_get_name(buddy) : "(no buddy)", + custom_img ? purple_imgstore_get_data(custom_img) : NULL); + purple_imgstore_unref(custom_img); return NULL; } + purple_imgstore_unref(custom_img); if (greyed) { gboolean offline = FALSE, idle = FALSE; @@ -3788,6 +3786,7 @@ { N_("/Help/_Build Information"), NULL, pidgin_dialogs_buildinfo, 0, "<Item>", NULL }, { N_("/Help/_Debug Window"), NULL, toggle_debug, 0, "<Item>", NULL }, { N_("/Help/De_veloper Information"), NULL, pidgin_dialogs_developers, 0, "<Item>", NULL }, + { N_("/Help/_Plugin Information"), NULL, pidgin_dialogs_plugins_info, 0, "<Item>", NULL }, { N_("/Help/_Translator Information"), NULL, pidgin_dialogs_translators, 0, "<Item>", NULL }, { "/Help/sep2", NULL, NULL, 0, "<Separator>", NULL }, { N_("/Help/_About"), NULL, pidgin_dialogs_about, 4, "<StockItem>", GTK_STOCK_ABOUT }, @@ -3915,10 +3914,8 @@ connections = purple_connections_get_all(); if (full && connections && connections->next) { - tmp = g_markup_escape_text(purple_account_get_username( - purple_buddy_get_account(b)), -1); - purple_notify_user_info_add_pair(user_info, _("Account"), tmp); - g_free(tmp); + purple_notify_user_info_add_pair_plaintext(user_info, _("Account"), + purple_account_get_username(purple_buddy_get_account(b))); } /* Alias */ @@ -3928,9 +3925,8 @@ (c->alias != NULL && c->alias[0] != '\0') && strcmp(c->alias, b->alias) != 0) { - tmp = g_markup_escape_text(b->alias, -1); - purple_notify_user_info_add_pair(user_info, _("Buddy Alias"), tmp); - g_free(tmp); + purple_notify_user_info_add_pair_plaintext(user_info, + _("Buddy Alias"), b->alias); } /* Nickname/Server Alias */ @@ -3940,9 +3936,8 @@ * to look at the tooltip. */ if (full && b->server_alias != NULL && b->server_alias[0] != '\0') { - tmp = g_markup_escape_text(b->server_alias, -1); - purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp); - g_free(tmp); + purple_notify_user_info_add_pair_plaintext(user_info, + _("Nickname"), b->server_alias); } /* Logged In */ @@ -3958,7 +3953,7 @@ tmp = g_strdup(purple_date_format_long(localtime(&signon))); } else tmp = purple_str_seconds_to_string(time(NULL) - signon); - purple_notify_user_info_add_pair(user_info, _("Logged In"), tmp); + purple_notify_user_info_add_pair_plaintext(user_info, _("Logged In"), tmp); g_free(tmp); } @@ -3969,7 +3964,7 @@ if (idle_secs > 0) { tmp = purple_str_seconds_to_string(time(NULL) - idle_secs); - purple_notify_user_info_add_pair(user_info, _("Idle"), tmp); + purple_notify_user_info_add_pair_plaintext(user_info, _("Idle"), tmp); g_free(tmp); } } @@ -4004,7 +3999,7 @@ if (lastseen > 0) { tmp = purple_str_seconds_to_string(time(NULL) - lastseen); - purple_notify_user_info_add_pair(user_info, _("Last Seen"), tmp); + purple_notify_user_info_add_pair_plaintext(user_info, _("Last Seen"), tmp); g_free(tmp); } } @@ -4014,7 +4009,7 @@ /* FIXME: Why is this status special-cased by the core? --rlaager * FIXME: Alternatively, why not have the core do all of them? --rlaager */ if (!PURPLE_BUDDY_IS_ONLINE(b)) { - purple_notify_user_info_add_pair(user_info, _("Status"), _("Offline")); + purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), _("Offline")); } if (purple_account_is_connected(b->account) && @@ -4026,11 +4021,11 @@ /* These are Easter Eggs. Patches to remove them will be rejected. */ if (!g_ascii_strcasecmp(b->name, "robflynn")) - purple_notify_user_info_add_pair(user_info, _("Description"), _("Spooky")); + purple_notify_user_info_add_pair_plaintext(user_info, _("Description"), _("Spooky")); if (!g_ascii_strcasecmp(b->name, "seanegn")) - purple_notify_user_info_add_pair(user_info, _("Status"), _("Awesome")); + purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), _("Awesome")); if (!g_ascii_strcasecmp(b->name, "chipx86")) - purple_notify_user_info_add_pair(user_info, _("Status"), _("Rockin'")); + purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), _("Rockin'")); tmp = purple_notify_user_info_get_text_with_newline(user_info, "\n"); g_string_append(str, tmp); @@ -4045,24 +4040,21 @@ user_info = purple_notify_user_info_new(); count = purple_blist_get_group_online_count(group); - if (count != 0) { /* Online buddies in group */ - tmp = g_strdup_printf("%d", count); - purple_notify_user_info_add_pair(user_info, - _("Online Buddies"), - tmp); - g_free(tmp); + char tmp2[12]; + sprintf(tmp2, "%d", count); + purple_notify_user_info_add_pair_plaintext(user_info, + _("Online Buddies"), tmp2); } count = purple_blist_get_group_size(group, FALSE); if (count != 0) { /* Total buddies (from online accounts) in group */ - tmp = g_strdup_printf("%d", count); - purple_notify_user_info_add_pair(user_info, - _("Total Buddies"), - tmp); - g_free(tmp); + char tmp2[12]; + sprintf(tmp2, "%d", count); + purple_notify_user_info_add_pair_html(user_info, + _("Total Buddies"), tmp2); } tmp = purple_notify_user_info_get_text_with_newline(user_info, "\n"); @@ -4092,7 +4084,7 @@ g_object_ref(pb); g_free(path); } else { - pb = gdk_pixbuf_new_from_file(path, NULL); + pb = pidgin_pixbuf_new_from_file(path); if (pb != NULL) { /* We don't want to own a ref to the pixbuf, but we need to keep clean up. */ /* I'm not sure if it would be better to just keep our ref and not let the emblem ever be destroyed */ @@ -5277,7 +5269,7 @@ account); if(err->type == PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT) - pidgin_mini_dialog_add_button(PIDGIN_MINI_DIALOG(mini_dialog), + pidgin_mini_dialog_add_non_closing_button(PIDGIN_MINI_DIALOG(mini_dialog), _("SSL FAQs"), ssl_faq_clicked_cb, NULL); g_signal_connect_after(mini_dialog, "destroy", @@ -5487,6 +5479,28 @@ } +/** + * Was used by the connection API to tell the blist if an account has a + * connection error or no longer has a connection error, but the blist now does + * this itself with the @ref account-error-changed signal. + * + * @param account The account that either has a connection error + * or no longer has a connection error. + * @param message The connection error message, or NULL if this + * account is no longer in an error state. + */ +static void +pidgin_blist_update_account_error_state(PurpleAccount *account, const char *text) +{ + /* connection_errors isn't actually used anywhere; it's just kept in + * sync with reality in case a plugin uses it. + */ + if (text == NULL) + g_hash_table_remove(gtkblist->connection_errors, account); + else + g_hash_table_insert(gtkblist->connection_errors, account, g_strdup(text)); +} + /* Call appropriate error notification code based on error types */ static void update_account_error_state(PurpleAccount *account, @@ -5571,18 +5585,6 @@ } } -void -pidgin_blist_update_account_error_state(PurpleAccount *account, const char *text) -{ - /* connection_errors isn't actually used anywhere; it's just kept in - * sync with reality in case a plugin uses it. - */ - if (text == NULL) - g_hash_table_remove(gtkblist->connection_errors, account); - else - g_hash_table_insert(gtkblist->connection_errors, account, g_strdup(text)); -} - static gboolean paint_headline_hbox (GtkWidget *widget, GdkEventExpose *event,