Mercurial > pidgin
changeset 28237:650b79eaf305
merge of '453bf3da68c1baca3d6585b338ac13df415c9be0'
and 'aedf94cca64dd46503c2482445e6de4e9816b7df'
author | Etan Reisner <pidgin@unreliablesource.net> |
---|---|
date | Sun, 16 Aug 2009 05:29:25 +0000 |
parents | 618c41ef0ab8 (diff) ce50e961f650 (current diff) |
children | 1f0b2af9e2b8 |
files | |
diffstat | 5 files changed, 73 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog.API Sun Aug 16 05:23:07 2009 +0000 +++ b/ChangeLog.API Sun Aug 16 05:29:25 2009 +0000 @@ -22,6 +22,7 @@ and fwrite for saving a file locally. These allow a UI to stream a file through a socket without buffering the file on the local disk. * Jabber plugin signals (see jabber-signals.dox) + * purple_account_get_name_for_display * purple_account_remove_setting * purple_buddy_destroy * purple_buddy_get_protocol_data
--- a/libpurple/account.c Sun Aug 16 05:23:07 2009 +0000 +++ b/libpurple/account.c Sun Aug 16 05:29:25 2009 +0000 @@ -2016,6 +2016,42 @@ return account->gc; } +const gchar * +purple_account_get_name_for_display(const PurpleAccount *account) +{ + PurpleBuddy *self = NULL; + PurpleConnection *gc = NULL; + const gchar *name = NULL, *username = NULL, *displayname = NULL; + + name = purple_account_get_alias(account); + + if (name) { + return name; + } + + username = purple_account_get_username(account); + self = purple_find_buddy((PurpleAccount *)account, username); + + if (self) { + const gchar *calias= purple_buddy_get_contact_alias(self); + + /* We don't want to return the buddy name if the buddy/contact + * doesn't have an alias set. */ + if (!purple_strequal(username, calias)) { + return calias; + } + } + + gc = purple_account_get_connection(account); + displayname = purple_connection_get_display_name(gc); + + if (displayname) { + return displayname; + } + + return username; +} + gboolean purple_account_get_remember_password(const PurpleAccount *account) {
--- a/libpurple/account.h Sun Aug 16 05:23:07 2009 +0000 +++ b/libpurple/account.h Sun Aug 16 05:29:25 2009 +0000 @@ -630,6 +630,20 @@ PurpleConnection *purple_account_get_connection(const PurpleAccount *account); /** + * Returns a name for this account appropriate for display to the user. In + * order of preference: the account's alias; the contact or buddy alias (if + * the account exists on its own buddy list); the connection's display name; + * the account's username. + * + * @param account The account. + * + * @return The name to display. + * + * @since 2.6.0 + */ +const gchar *purple_account_get_name_for_display(const PurpleAccount *account); + +/** * Returns whether or not this account should save its password. * * @param account The account.
--- a/pidgin/gtkconv.c Sun Aug 16 05:23:07 2009 +0000 +++ b/pidgin/gtkconv.c Sun Aug 16 05:29:25 2009 +0000 @@ -3859,7 +3859,7 @@ gtk_size_group_add_widget(sg, image); /* Make our menu item */ - text = g_strdup_printf("%s (%s)", name, purple_account_get_username(account)); + text = g_strdup_printf("%s (%s)", name, purple_account_get_name_for_display(account)); menuitem = gtk_radio_menu_item_new_with_label(*group, text); g_free(text); *group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem));
--- a/pidgin/gtkimhtmltoolbar.c Sun Aug 16 05:23:07 2009 +0000 +++ b/pidgin/gtkimhtmltoolbar.c Sun Aug 16 05:29:25 2009 +0000 @@ -133,22 +133,30 @@ destroy_toolbar_font(widget, NULL, toolbar); } -static void apply_font(GtkWidget *widget, GtkFontSelection *fontsel) +static void +apply_font(GtkWidget *widget, GtkFontSelectionDialog *fontsel) { /* this could be expanded to include font size, weight, etc. but for now only works with font face */ - char *fontname; - char *space; - GtkIMHtmlToolbar *toolbar = g_object_get_data(G_OBJECT(fontsel), "purple_toolbar"); + gchar *fontname = gtk_font_selection_dialog_get_font_name(fontsel); + GtkIMHtmlToolbar *toolbar = g_object_get_data(G_OBJECT(fontsel), + "purple_toolbar"); - fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel)); + if (fontname) { + const gchar *family_name = NULL; + PangoFontDescription *desc = NULL; - space = strrchr(fontname, ' '); - if(space && isdigit(*(space+1))) - *space = '\0'; + desc = pango_font_description_from_string(fontname); + family_name = pango_font_description_get_family(desc); - gtk_imhtml_toggle_fontface(GTK_IMHTML(toolbar->imhtml), fontname); - g_free(fontname); + if (family_name) { + gtk_imhtml_toggle_fontface(GTK_IMHTML(toolbar->imhtml), + family_name); + } + + pango_font_description_free(desc); + g_free(fontname); + } cancel_toolbar_font(NULL, toolbar); } @@ -1224,13 +1232,14 @@ {PIDGIN_STOCK_TOOLBAR_TEXT_SMALLER, do_small, &toolbar->smaller_size, _("Decrease Font Size")}, {"", NULL, NULL, NULL}, {PIDGIN_STOCK_TOOLBAR_FONT_FACE, toggle_font, &toolbar->font, _("Font Face")}, + {PIDGIN_STOCK_TOOLBAR_FGCOLOR, toggle_fg_color, &toolbar->fgcolor, _("Foreground Color")}, {PIDGIN_STOCK_TOOLBAR_BGCOLOR, toggle_bg_color, &toolbar->bgcolor, _("Background Color")}, - {PIDGIN_STOCK_TOOLBAR_FGCOLOR, toggle_fg_color, &toolbar->fgcolor, _("Foreground Color")}, {"", NULL, NULL, NULL}, {PIDGIN_STOCK_CLEAR, clear_formatting_cb, &toolbar->clear, _("Reset Formatting")}, {"", NULL, NULL, NULL}, + {PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE, insert_image_cb, &toolbar->image, _("Insert IM Image")}, {PIDGIN_STOCK_TOOLBAR_INSERT_LINK, insert_link_cb, &toolbar->link, _("Insert Link")}, - {PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE, insert_image_cb, &toolbar->image, _("Insert IM Image")}, + {"", NULL, NULL, NULL}, {PIDGIN_STOCK_TOOLBAR_SMILEY, insert_smiley_cb, &toolbar->smiley, _("Insert Smiley")}, {NULL, NULL, NULL, NULL} };