aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2012-04-26 19:47:09 +0800
committerMilan Crha <mcrha@redhat.com>2012-04-26 19:47:09 +0800
commit13d4a2c8ba973bfa5afca4221056f88989671a07 (patch)
tree407c605c071953204a7de8c0d01e46e14288bfd6 /addressbook
parent4eb33fd3daa58ffac6b945506bcd729ab71f5a9f (diff)
downloadgsoc2013-evolution-13d4a2c8ba973bfa5afca4221056f88989671a07.tar
gsoc2013-evolution-13d4a2c8ba973bfa5afca4221056f88989671a07.tar.gz
gsoc2013-evolution-13d4a2c8ba973bfa5afca4221056f88989671a07.tar.bz2
gsoc2013-evolution-13d4a2c8ba973bfa5afca4221056f88989671a07.tar.lz
gsoc2013-evolution-13d4a2c8ba973bfa5afca4221056f88989671a07.tar.xz
gsoc2013-evolution-13d4a2c8ba973bfa5afca4221056f88989671a07.tar.zst
gsoc2013-evolution-13d4a2c8ba973bfa5afca4221056f88989671a07.zip
Bug #668989 - Add a twitter username to IM in contacts
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c4
-rw-r--r--addressbook/gui/widgets/eab-contact-formatter.c21
-rw-r--r--addressbook/importers/evolution-vcard-importer.c2
3 files changed, 25 insertions, 2 deletions
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[] =
"</script>\n" \
"</head>\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 ("<img src=\"gtk-stock://%s\" width=\"16\" height=\"16\" />", 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 (
diff --git a/addressbook/importers/evolution-vcard-importer.c b/addressbook/importers/evolution-vcard-importer.c
index 1dbbed0a39..5094ab64ed 100644
--- a/addressbook/importers/evolution-vcard-importer.c
+++ b/addressbook/importers/evolution-vcard-importer.c
@@ -748,6 +748,7 @@ preview_contact (EWebViewPreview *preview,
E_CONTACT_IM_ICQ,
E_CONTACT_IM_GADUGADU,
E_CONTACT_IM_SKYPE,
+ E_CONTACT_IM_TWITTER,
-1,
@@ -837,6 +838,7 @@ preview_contact (EWebViewPreview *preview,
field == E_CONTACT_IM_ICQ ||
field == E_CONTACT_IM_GADUGADU ||
field == E_CONTACT_IM_SKYPE ||
+ field == E_CONTACT_IM_TWITTER ||
field == E_CONTACT_EMAIL) {
GList *attrs, *a;
gboolean have = FALSE;