diff options
author | Milan Crha <mcrha@redhat.com> | 2010-11-09 00:53:30 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2010-11-10 06:33:23 +0800 |
commit | 5e633737a81adfceae761589b1e464792ad51297 (patch) | |
tree | 6932a00ffc2f0e574e000339f12a37ba192344b9 /plugins/google-account-setup/google-contacts-source.c | |
parent | 674b14c952006d4cf869b374e204be281fafdcaf (diff) | |
download | gsoc2013-evolution-5e633737a81adfceae761589b1e464792ad51297.tar gsoc2013-evolution-5e633737a81adfceae761589b1e464792ad51297.tar.gz gsoc2013-evolution-5e633737a81adfceae761589b1e464792ad51297.tar.bz2 gsoc2013-evolution-5e633737a81adfceae761589b1e464792ad51297.tar.lz gsoc2013-evolution-5e633737a81adfceae761589b1e464792ad51297.tar.xz gsoc2013-evolution-5e633737a81adfceae761589b1e464792ad51297.tar.zst gsoc2013-evolution-5e633737a81adfceae761589b1e464792ad51297.zip |
Bug #632176 - Force user name on Google calendar/address book
Diffstat (limited to 'plugins/google-account-setup/google-contacts-source.c')
-rw-r--r-- | plugins/google-account-setup/google-contacts-source.c | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/plugins/google-account-setup/google-contacts-source.c b/plugins/google-account-setup/google-contacts-source.c index 5f4bf3fc57..0fe49911b0 100644 --- a/plugins/google-account-setup/google-contacts-source.c +++ b/plugins/google-account-setup/google-contacts-source.c @@ -94,7 +94,9 @@ on_username_entry_changed (GtkEntry *entry, gpointer user_data) text = gtk_entry_get_text (entry); - if (strstr (text, "@")) { + if (!text || !*text) { + username = NULL; + } else if (strstr (text, "@")) { username = g_strdup (text); } else { username = g_strdup_printf ("%s@gmail.com", text); @@ -207,6 +209,41 @@ on_interval_combo_changed (GtkComboBox *combo, gpointer user_data) g_free (value_string); } +gpointer +check_username_filled (ESource *source) +{ + gboolean res = TRUE; + + g_return_val_if_fail (source != NULL, NULL); + + if (g_ascii_strncasecmp (GOOGLE_BASE_URI, e_source_group_peek_base_uri (e_source_peek_group (source)), strlen (GOOGLE_BASE_URI)) == 0) { + gchar *username = g_strdup (e_source_get_property (source, "username")); + + if (username) + username = g_strstrip (username); + + res = username && *username; + + g_free (username); + } + + return GINT_TO_POINTER (res ? 1 : 0); +} + +gpointer +plugin_google_contacts_check (EPlugin *epl, EConfigHookPageCheckData *data) +{ + EABConfigTargetSource *t; + + g_return_val_if_fail (data != NULL, NULL); + g_return_val_if_fail (data->target != NULL, NULL); + + t = (EABConfigTargetSource *) data->target; + g_return_val_if_fail (t->source != NULL, NULL); + + return check_username_filled (t->source); +} + struct ui_data { GtkWidget *widget; }; @@ -262,7 +299,7 @@ plugin_google_contacts (EPlugin *epl, g_object_set_data (G_OBJECT (epl), "gwidget", NULL); - if (g_ascii_strncasecmp ("google://", base_uri, 9) != 0) + if (g_ascii_strncasecmp (GOOGLE_BASE_URI, base_uri, 9) != 0) return NULL; /* Build up the UI */ |