diff options
author | Sushma Rai <rsushma@src.gnome.org> | 2005-01-12 18:45:10 +0800 |
---|---|---|
committer | Sushma Rai <rsushma@src.gnome.org> | 2005-01-12 18:45:10 +0800 |
commit | 828cd2b6b198e6015c89f00b8ab720710df07d80 (patch) | |
tree | f3491c53b3248c286d00198ba02401f0a17edc8e | |
parent | 0ad3fc1eb413d8b07c1a53011b890b81b8f71e39 (diff) | |
download | gsoc2013-evolution-828cd2b6b198e6015c89f00b8ab720710df07d80.tar.gz gsoc2013-evolution-828cd2b6b198e6015c89f00b8ab720710df07d80.tar.zst gsoc2013-evolution-828cd2b6b198e6015c89f00b8ab720710df07d80.zip |
Adding a entry widgett o editor page and using Excahnge connector
defined function to validate user
svn path=/trunk/; revision=28374
3 files changed, 97 insertions, 3 deletions
diff --git a/plugins/exchange-account-setup/ChangeLog b/plugins/exchange-account-setup/ChangeLog index c86787d10d..3fc16b44bf 100644 --- a/plugins/exchange-account-setup/ChangeLog +++ b/plugins/exchange-account-setup/ChangeLog @@ -1,4 +1,15 @@ -2005-01-11 Not Zed <NotZed@Ximian.com> +2005-01-12 Sushma Rai <rsushma@novell.com> + + * org-gnome-exchange-account-setup.eplug.in: Factory + method to add owa url entry to account editor. + + * exchange-ask-password.c: (org_gnome_exchange_set_url) + (add_owa_entry_to_editor): Adds owa url entry to the + account editor for Exchange account. + (validate_exchange_user): Using the CamelProvider private + function defined by Exchange camel provider. + +2005-01-11 Sushma Rai <rsushma@novell.com> * org-gnome-exchange-account-setup.eplug.in: Removed page check plugin diff --git a/plugins/exchange-account-setup/exchange-ask-password.c b/plugins/exchange-account-setup/exchange-ask-password.c index a5da9ccdf4..a78cc48df9 100644 --- a/plugins/exchange-account-setup/exchange-ask-password.c +++ b/plugins/exchange-account-setup/exchange-ask-password.c @@ -39,15 +39,23 @@ int e_plugin_lib_enable (EPluginLib *ep, int enable); -//gboolean org_gnome_exchange_ask_password (EPlugin *epl, EConfigHookPageCheckData *data); GtkWidget *org_gnome_exchange_read_url(EPlugin *epl, EConfigHookItemFactoryData *data); +GtkWidget *org_gnome_exchange_set_url(EPlugin *epl, EConfigHookItemFactoryData *data); char *owa_entry_text = NULL; +typedef gboolean (CamelProviderValidateUserFunc) (CamelURL *camel_url, char *url, CamelException *ex); + +typedef struct { + CamelProviderValidateUserFunc *validate_user; +}CamelProviderValidate; + + static gboolean validate_exchange_user (void *data) { EMConfigTargetAccount *target_account = data; + CamelProviderValidate *validate; CamelURL *url=NULL; CamelProvider *provider = NULL; gboolean valid = TRUE; @@ -65,7 +73,8 @@ validate_exchange_user (void *data) return FALSE; /* This should never happen */ } - valid = camel_provider_validate_user (provider, url, owa_entry_text, NULL); + validate = provider->priv; + validate->validate_user (url, owa_entry_text, NULL); if (valid) { count ++; url_string = camel_url_to_string (url, 0); @@ -122,6 +131,34 @@ add_owa_entry (GtkWidget *parent, EConfig *config, EMConfigTargetAccount *target return section; /* FIXME: return entry */ } +static GtkWidget * +add_owa_entry_to_editor (GtkWidget *parent, EConfig *config, EMConfigTargetAccount *target_account) +{ + GtkWidget *section, *owa_entry; + GtkWidget *hbox, *label; + + section = gtk_vbox_new (FALSE, 0); + gtk_widget_show (section); + gtk_box_pack_start (GTK_BOX (parent), section, FALSE, FALSE, 0); + + hbox = gtk_hbox_new (FALSE, 6); + gtk_widget_show(hbox); + gtk_box_pack_start (GTK_BOX (section), hbox, FALSE, FALSE, 0); + label = gtk_label_new_with_mnemonic(_("_Url:")); + gtk_widget_show (label); + owa_entry = gtk_entry_new (); + if (owa_entry_text) + gtk_entry_set_text (owa_entry, owa_entry_text); + gtk_widget_show (owa_entry); + + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (hbox), owa_entry, TRUE, TRUE, 0); + + g_signal_connect (owa_entry, "changed", G_CALLBACK(owa_entry_changed), NULL); /* FIXME - gconf handling*/ + return section; /* FIXME: return entry */ + /* FIXME: Proper placing of the widget */ +} + int e_plugin_lib_enable (EPluginLib *ep, int enable) { @@ -170,3 +207,27 @@ org_gnome_exchange_read_url(EPlugin *epl, EConfigHookItemFactoryData *data) return NULL; } } + +GtkWidget * +org_gnome_exchange_set_url(EPlugin *epl, EConfigHookItemFactoryData *data) +{ + EMConfigTargetAccount *target_account; + EConfig *config; + char *account_url = NULL, *exchange_url = NULL; + GtkWidget *owa_entry = NULL, *parent; + + target_account = (EMConfigTargetAccount *)data->config->target; + account_url = g_strdup (target_account->account->source->url); + exchange_url = g_strrstr (account_url, "exchange"); + config = data->config; + + if (exchange_url) { + if (data->old) + return data->old; + + parent = data->parent; + owa_entry = add_owa_entry_to_editor(parent, config, target_account); + } + g_free (account_url); + return owa_entry; +} diff --git a/plugins/exchange-account-setup/org-gnome-exchange-account-setup.eplug.in b/plugins/exchange-account-setup/org-gnome-exchange-account-setup.eplug.in index a463cfa3dd..d94bc323de 100644 --- a/plugins/exchange-account-setup/org-gnome-exchange-account-setup.eplug.in +++ b/plugins/exchange-account-setup/org-gnome-exchange-account-setup.eplug.in @@ -41,4 +41,26 @@ </group> </hook> </e-plugin> + + <e-plugin + type="shlib" + id="org.gnome.evolution.plugin.exchange-set-url" + location="@PLUGINDIR@/liborg-gnome-exchange-account-settings.so" + load-on-startup="true" + name="Exchange OWA URL in Account Editor" + description="A pluign to read OWA url in account editor"> + + <hook class="org.gnome.evolution.mail.config:1.0"> + <group + target="account" + id="org.gnome.evolution.mail.config.accountEditor"> + <item type="section" + path="10.receive/10.config" + label="OWA Url"/> + <item type="item" + path="10.receive/10.config/00.owa" + factory="org_gnome_exchange_set_url"/> + </group> + </hook> + </e-plugin> </e-plugin-list> |