Only show users country if its not unknown

This commit is contained in:
TingPing 2013-09-25 17:16:47 -04:00
parent 7bc3317eeb
commit c7a00a4aba
2 changed files with 11 additions and 9 deletions

View File

@ -1253,7 +1253,7 @@ country (char *hostname)
domain_t *dom; domain_t *dom;
if (!hostname || !*hostname || isdigit ((unsigned char) hostname[strlen (hostname) - 1])) if (!hostname || !*hostname || isdigit ((unsigned char) hostname[strlen (hostname) - 1]))
return _("Unknown"); return NULL;
if ((p = strrchr (hostname, '.'))) if ((p = strrchr (hostname, '.')))
p++; p++;
else else
@ -1263,7 +1263,7 @@ country (char *hostname)
sizeof (domain_t), country_compare); sizeof (domain_t), country_compare);
if (!dom) if (!dom)
return _("Unknown"); return NULL;
return _(dom->country); return _(dom->country);
} }

View File

@ -600,7 +600,7 @@ menu_create_nickinfo_menu (struct User *user, GtkWidget *submenu)
{ {
char buf[512]; char buf[512];
char unknown[96]; char unknown[96];
char *real, *fmt; char *real, *fmt, *users_country;
struct away_msg *away; struct away_msg *away;
gboolean missing = FALSE; gboolean missing = FALSE;
GtkWidget *item; GtkWidget *item;
@ -637,12 +637,14 @@ menu_create_nickinfo_menu (struct User *user, GtkWidget *submenu)
G_CALLBACK (copy_to_clipboard_cb), G_CALLBACK (copy_to_clipboard_cb),
user->account ? user->account : unknown); user->account ? user->account : unknown);
snprintf (buf, sizeof (buf), fmt, _("Country:"), users_country = country (user->hostname);
user->hostname ? country(user->hostname) : unknown); if (users_country)
item = menu_quick_item (0, buf, submenu, XCMENU_MARKUP, 0, 0); {
g_signal_connect (G_OBJECT (item), "activate", snprintf (buf, sizeof (buf), fmt, _ ("Country:"), users_country);
G_CALLBACK (copy_to_clipboard_cb), item = menu_quick_item (0, buf, submenu, XCMENU_MARKUP, 0, 0);
user->hostname ? country(user->hostname) : unknown); g_signal_connect (G_OBJECT (item), "activate",
G_CALLBACK (copy_to_clipboard_cb), users_country);
}
snprintf (buf, sizeof (buf), fmt, _("Server:"), snprintf (buf, sizeof (buf), fmt, _("Server:"),
user->servername ? user->servername : unknown); user->servername ? user->servername : unknown);