From 13d4a2c8ba973bfa5afca4221056f88989671a07 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 26 Apr 2012 13:47:09 +0200 Subject: Bug #668989 - Add a twitter username to IM in contacts --- addressbook/gui/contact-editor/e-contact-editor.c | 4 +++- addressbook/gui/widgets/eab-contact-formatter.c | 21 ++++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) (limited to 'addressbook/gui') diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index 7ad3bcdb3e..af92ba2568 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -181,7 +181,8 @@ im_service[] = { E_CONTACT_IM_MSN, N_ ("MSN") }, { E_CONTACT_IM_ICQ, N_ ("ICQ") }, { E_CONTACT_IM_GROUPWISE, N_ ("GroupWise") }, - { E_CONTACT_IM_SKYPE, N_ ("Skype") } + { E_CONTACT_IM_SKYPE, N_ ("Skype") }, + { E_CONTACT_IM_TWITTER, N_ ("Twitter") } }; /* Defaults from the table above */ @@ -3703,6 +3704,7 @@ static const EContactField non_string_fields[] = { E_CONTACT_IM_MSN, E_CONTACT_IM_ICQ, E_CONTACT_IM_SKYPE, + E_CONTACT_IM_TWITTER, E_CONTACT_PHOTO, E_CONTACT_LOGO, E_CONTACT_X509_CERT, diff --git a/addressbook/gui/widgets/eab-contact-formatter.c b/addressbook/gui/widgets/eab-contact-formatter.c index b87944c224..0c594b9993 100644 --- a/addressbook/gui/widgets/eab-contact-formatter.c +++ b/addressbook/gui/widgets/eab-contact-formatter.c @@ -83,6 +83,7 @@ common_location[] = #define YAHOO_ICON "im-yahoo" #define GADUGADU_ICON "im-gadugadu" #define SKYPE_ICON "stock_people" +#define TWITTER_ICON "im-twitter" #define VIDEOCONF_ICON "stock_video-conferencing" #define MAX_COMPACT_IMAGE_DIMENSION 48 @@ -110,6 +111,23 @@ common_location[] = "\n" \ "\n" +static gboolean +icon_available (const gchar *icon) +{ + GtkIconTheme *icon_theme; + GtkIconInfo *icon_info; + + if (!icon) + return FALSE; + + icon_theme = gtk_icon_theme_get_default (); + icon_info = gtk_icon_theme_lookup_icon (icon_theme, icon, 16, 0); + if (icon_info != NULL) + gtk_icon_info_free (icon_info); + + return icon_info != NULL; +} + static void render_address_link (GString *buffer, EContact *contact, @@ -264,7 +282,7 @@ render_table_row (GString *buffer, else value = (gchar *) str; - if (icon) { + if (icon && icon_available (icon)) { icon_html = g_strdup_printf ("", icon); } else { icon_html = ""; @@ -604,6 +622,7 @@ render_contact_column (EABContactFormatter *formatter, accum_attribute_multival (accum, contact, _("Yahoo"), E_CONTACT_IM_YAHOO, YAHOO_ICON, 0); accum_attribute_multival (accum, contact, _("Gadu-Gadu"), E_CONTACT_IM_GADUGADU, GADUGADU_ICON, 0); accum_attribute_multival (accum, contact, _("Skype"), E_CONTACT_IM_SKYPE, SKYPE_ICON, 0); + accum_attribute_multival (accum, contact, _("Twitter"), E_CONTACT_IM_TWITTER, TWITTER_ICON, 0); if (accum->len) g_string_append_printf ( -- cgit v1.2.3