aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSushma Rai <rsushma@src.gnome.org>2005-01-23 17:54:30 +0800
committerSushma Rai <rsushma@src.gnome.org>2005-01-23 17:54:30 +0800
commitd3efc61422d92654a6c6e0320975fca4905c505e (patch)
tree7f89e02ace675bfd988eccab599ddf87f5569dc6
parent7a33c0e1504c8d6bc8569fc65ab1479a04daf0df (diff)
downloadgsoc2013-evolution-d3efc61422d92654a6c6e0320975fca4905c505e.tar.gz
gsoc2013-evolution-d3efc61422d92654a6c6e0320975fca4905c505e.tar.zst
gsoc2013-evolution-d3efc61422d92654a6c6e0320975fca4905c505e.zip
Added owa url entry to the config section in both druid and editor, and
fixed some compile time warnings. svn path=/trunk/; revision=28513
-rw-r--r--plugins/exchange-account-setup/exchange-account-setup.c120
-rw-r--r--plugins/exchange-account-setup/exchange-ask-password.c74
-rw-r--r--plugins/exchange-account-setup/org-gnome-exchange-account-setup.eplug.in10
3 files changed, 129 insertions, 75 deletions
diff --git a/plugins/exchange-account-setup/exchange-account-setup.c b/plugins/exchange-account-setup/exchange-account-setup.c
index afa42ff8ef..5448a7ec79 100644
--- a/plugins/exchange-account-setup/exchange-account-setup.c
+++ b/plugins/exchange-account-setup/exchange-account-setup.c
@@ -203,11 +203,11 @@ org_gnome_exchange_account_setup (EPlugin *epl, EConfigHookItemFactoryData *data
{
EMConfigTargetAccount *target_account;
GtkWidget *oof_page = NULL;
- const char *account_url = NULL, *source_url = NULL, *temp_url = NULL;
+ const char *source_url = NULL, *temp_url = NULL;
char *exchange_url = NULL;
GConfClient *client;
EAccountList *account_list;
- const char *uid;
+ const char *uid = NULL;
EAccount *gconf_account;
target_account = (EMConfigTargetAccount *)data->config->target;
@@ -215,7 +215,7 @@ org_gnome_exchange_account_setup (EPlugin *epl, EConfigHookItemFactoryData *data
client = gconf_client_get_default ();
account_list = e_account_list_new (client);
if (account_list) {
- uid = g_strdup (target_account->account->uid);
+ uid = target_account->account->uid;
if (uid) {
gconf_account = e_account_list_find (account_list,
E_ACCOUNT_FIND_UID,
@@ -239,7 +239,6 @@ org_gnome_exchange_account_setup (EPlugin *epl, EConfigHookItemFactoryData *data
E_ACCOUNT_TRANSPORT_URL,
temp_url);
}
- g_free (uid);
}
g_object_unref (account_list);
}
@@ -250,9 +249,7 @@ org_gnome_exchange_account_setup (EPlugin *epl, EConfigHookItemFactoryData *data
source_url = e_account_get_string (target_account->account,
E_ACCOUNT_SOURCE_URL);
- account_url = g_strdup (source_url);
- exchange_url = g_strrstr (account_url, "exchange");
- g_free (account_url);
+ exchange_url = g_strrstr (source_url, "exchange");
if (exchange_url) {
if (data->old)
@@ -264,6 +261,12 @@ org_gnome_exchange_account_setup (EPlugin *epl, EConfigHookItemFactoryData *data
}
static void
+editor_ok_button_clicked (GtkWidget *entry, void *data)
+{
+ return;
+}
+
+static void
owa_editor_entry_changed (GtkWidget *entry, void *data)
{
GtkWidget *button = data;
@@ -281,61 +284,77 @@ add_owa_entry_to_editor (GtkWidget *parent, EConfig *config,
EAccountList *account_list, const char *url_value)
{
GtkWidget *section, *owa_entry;
- GtkWidget *hbox, *label;
+ GtkWidget *hbox, *hbox_inner, *label, *button;
+ GList *container_list, *l;
+ GValue rows = { 0, };
+ GValue cols = { 0, };
+ gint n_rows, n_cols;
+
+ /* Since configure section in the receive page is not plugin enabled
+ * traversing through the container hierarchy to get the reference
+ * to the table, to which owa_url entry has to be added.
+ * This needs to be changed once we can access configure section from
+ * the plugin.
+ */
+
+ container_list = gtk_container_get_children (GTK_CONTAINER (parent));
+ l = g_list_nth (container_list, 0); /* sourcevbox */
+ container_list = gtk_container_get_children (GTK_CONTAINER (l->data));
+ l = g_list_nth (container_list, 2); /* source frame */
+ container_list = gtk_container_get_children (GTK_CONTAINER (l->data));
+ l = g_list_nth (container_list, 1); /* hbox173 */
+ container_list = gtk_container_get_children (GTK_CONTAINER (l->data));
+ l = g_list_nth (container_list, 1); /* table 13 */
+ container_list = gtk_container_get_children (GTK_CONTAINER (l->data));
+ l = g_list_nth (container_list, 0); /* table 4*/
- section = gtk_vbox_new (FALSE, 0);
- gtk_widget_show (section);
- gtk_box_pack_start (GTK_BOX (parent), section, FALSE, FALSE, 0);
+ g_value_init (&rows, G_TYPE_INT);
+ g_value_init (&cols, G_TYPE_INT);
+ g_object_get_property (G_OBJECT (l->data), "n-rows", &rows);
+ g_object_get_property (G_OBJECT (l->data), "n-columns", &cols);
+ n_rows = g_value_get_int (&rows);
+ n_cols = g_value_get_int (&cols);
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);
+ gtk_widget_show (hbox);
+
+ hbox_inner = gtk_hbox_new (FALSE, 6);
+ gtk_widget_show (hbox_inner);
owa_entry = gtk_entry_new ();
if (url_value)
- gtk_entry_set_text (GTK_ENTRY (owa_entry), url_value);
+ gtk_entry_set_text (GTK_ENTRY (owa_entry), url_value);
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_editor_entry_changed), NULL);
- /* FIXME - gconf handling*/
- return section; /* FIXME: return entry */
-
-#if 0
- GtkWidget *table;
- GladeXML *gui;
- GValue rows = { 0, };
- GValue cols = { 0, };
- gint n_rows, n_cols;
- gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade",
- "table4", NULL);
- table = glade_xml_get_widget (gui, "table4");
+ button = gtk_button_new_from_stock (GTK_STOCK_OK);
+ gtk_widget_set_sensitive (button, FALSE);
+ gtk_widget_show (button);
+ gtk_box_pack_start (GTK_BOX (hbox_inner), owa_entry, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox_inner), button, FALSE, FALSE, 0);
+
+ label = gtk_label_new_with_mnemonic(_("_OWA Url:"));
+ gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+ gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
+ gtk_widget_show (label);
- g_value_init (&rows, G_TYPE_INT);
- g_value_init (&cols, G_TYPE_INT);
- g_object_get_property (G_OBJECT (table), "n-rows", &rows);
- g_object_get_property (G_OBJECT (table), "n-columns", &cols);
- n_rows = g_value_get_int (&rows);
- n_cols = g_value_get_int (&cols);
- printf ("NO OF COLUMES = %d ROWS = %d \n", n_cols, n_rows);
+ gtk_box_pack_start (GTK_BOX (hbox), hbox_inner, TRUE, TRUE, 0);
- if (owa_entry_text)
- gtk_entry_set_text (owa_entry, owa_entry_text);
+ gtk_table_attach (GTK_TABLE (l->data), label, 0, n_cols-1, n_rows,
+ n_rows+1, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_table_attach (GTK_TABLE (l->data), hbox, n_cols-1, n_cols,
+ n_rows, n_rows+1, GTK_FILL, GTK_FILL, 0, 0);
- gtk_table_attach (GTK_TABLE (table), label, 0, n_cols-1, n_rows, n_rows+1, GTK_FILL, GTK_FILL, 0, 0);
- gtk_table_attach (GTK_TABLE (table), owa_entry, n_cols-1, n_cols, n_rows, n_rows+1, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (GTK_WIDGET (l->data));
- gtk_widget_show (table);
- return table;
+ g_signal_connect (owa_entry, "changed",
+ G_CALLBACK (owa_editor_entry_changed), button);
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (editor_ok_button_clicked), target_account);
-#endif
- /* FIXME: Proper placing of the widget */
+ section = gtk_vbox_new (FALSE, 0); /* Sending an invisible section */
+ gtk_widget_hide (section);
+ return section;
}
GtkWidget *
@@ -344,7 +363,7 @@ org_gnome_exchange_set_url (EPlugin *epl, EConfigHookItemFactoryData *data)
EMConfigTargetAccount *target_account;
EConfig *config;
char *account_url = NULL, *exchange_url = NULL;
- const char *source_url, *temp_url, *uid, *owa_url = NULL;
+ const char *source_url, *temp_url, *uid = NULL, *owa_url = NULL;
GtkWidget *owa_entry = NULL, *parent;
GConfClient *client;
EAccountList *account_list = NULL;
@@ -357,7 +376,7 @@ org_gnome_exchange_set_url (EPlugin *epl, EConfigHookItemFactoryData *data)
client = gconf_client_get_default ();
account_list = e_account_list_new (client);
if (account_list) {
- uid = g_strdup (target_account->account->uid);
+ uid = target_account->account->uid;
if (uid) {
gconf_account = e_account_list_find (account_list,
E_ACCOUNT_FIND_UID,
@@ -377,7 +396,6 @@ org_gnome_exchange_set_url (EPlugin *epl, EConfigHookItemFactoryData *data)
E_ACCOUNT_TRANSPORT_URL,
temp_url);
}
- g_free (uid);
}
}
diff --git a/plugins/exchange-account-setup/exchange-ask-password.c b/plugins/exchange-account-setup/exchange-ask-password.c
index a41a9cdffe..c0798b97ca 100644
--- a/plugins/exchange-account-setup/exchange-ask-password.c
+++ b/plugins/exchange-account-setup/exchange-ask-password.c
@@ -42,9 +42,9 @@ void exchange_options_commit (EPlugin *epl, EConfigHookItemFactoryData *data);
GtkWidget *org_gnome_exchange_read_url (EPlugin *epl, EConfigHookItemFactoryData *data);
gboolean org_gnome_exchange_check_options (EPlugin *epl, EConfigHookPageCheckData *data);
-char *owa_entry_text = NULL;
+const char *owa_entry_text = NULL;
-typedef gboolean (CamelProviderValidateUserFunc) (CamelURL *camel_url, char *url, gboolean *remember_password, CamelException *ex);
+typedef gboolean (CamelProviderValidateUserFunc) (CamelURL *camel_url, const char *url, gboolean *remember_password, CamelException *ex);
typedef struct {
CamelProviderValidateUserFunc *validate_user;
@@ -73,9 +73,9 @@ validate_exchange_user (void *data)
CamelProvider *provider = NULL;
gboolean valid = FALSE, *remember_password;
char *account_url, *url_string;
- const char *source_url;
+ const char *source_url, *id_name;
static int count = 0;
- char *id_name, *at, *user;
+ char *at, *user;
if (count)
return valid;
@@ -148,32 +148,74 @@ add_owa_entry (GtkWidget *parent,
EMConfigTargetAccount *target_account)
{
GtkWidget *section, *owa_entry;
- GtkWidget *hbox, *button, *label;
-
- section = gtk_vbox_new (FALSE, 0);
- gtk_widget_show (section);
- gtk_box_pack_start (GTK_BOX (parent), section, FALSE, FALSE, 0);
+ GtkWidget *hbox, *hbox_inner, *label, *button;
+ GList *container_list, *l;
+ GValue rows = { 0, };
+ GValue cols = { 0, };
+ gint n_rows, n_cols;
+
+ /* Since configure section in the receive page is not plugin enabled
+ * traversing through the container hierarchy to get the reference
+ * to the table, to which owa_url entry has to be added.
+ * This needs to be changed once we can access configure section from
+ * the plugin.
+ */
+
+ container_list = gtk_container_get_children (GTK_CONTAINER (parent));
+ l = g_list_nth (container_list, 1); /* vboxsourceborder */
+ container_list = gtk_container_get_children (GTK_CONTAINER (l->data));
+ l = g_list_nth (container_list, 0); /* sourcevbox */
+ container_list = gtk_container_get_children (GTK_CONTAINER (l->data));
+ l = g_list_nth (container_list, 2); /* source frame */
+ container_list = gtk_container_get_children (GTK_CONTAINER (l->data));
+ l = g_list_nth (container_list, 1); /* hbox173 */
+ container_list = gtk_container_get_children (GTK_CONTAINER (l->data));
+ l = g_list_nth (container_list, 1); /* table 13 */
+ container_list = gtk_container_get_children (GTK_CONTAINER (l->data));
+ l = g_list_nth (container_list, 0); /* table 4*/
+
+ g_value_init (&rows, G_TYPE_INT);
+ g_value_init (&cols, G_TYPE_INT);
+ g_object_get_property (G_OBJECT (l->data), "n-rows", &rows);
+ g_object_get_property (G_OBJECT (l->data), "n-columns", &cols);
+ n_rows = g_value_get_int (&rows);
+ n_cols = g_value_get_int (&cols);
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);
+
+ hbox_inner = gtk_hbox_new (FALSE, 6);
+ gtk_widget_show (hbox_inner);
+
owa_entry = gtk_entry_new ();
gtk_widget_show (owa_entry);
+
button = gtk_button_new_from_stock (GTK_STOCK_OK);
gtk_widget_set_sensitive (button, FALSE);
gtk_widget_show (button);
- gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), owa_entry, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox_inner), owa_entry, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox_inner), button, TRUE, TRUE, 0);
+
+ label = gtk_label_new_with_mnemonic(_("_OWA Url:"));
+ gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+ gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
+ gtk_widget_show (label);
+
+ gtk_box_pack_start (GTK_BOX (hbox), hbox_inner, TRUE, TRUE, 0);
+
+ gtk_table_attach (GTK_TABLE (l->data), label, 0, n_cols-1, n_rows, n_rows+1, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_table_attach (GTK_TABLE (l->data), hbox, n_cols-1, n_cols, n_rows, n_rows+1, GTK_FILL, GTK_FILL, 0, 0);
+
+ gtk_widget_show (GTK_WIDGET (l->data));
g_signal_connect (owa_entry, "changed",
G_CALLBACK (owa_entry_changed), button);
g_signal_connect (button, "clicked",
G_CALLBACK (ok_button_clicked), target_account);
-
+
+ section = gtk_vbox_new (FALSE, 0);
+ gtk_widget_hide (section);
return section; /* FIXME: return 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 7fd216c5e8..251824f96d 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
@@ -17,10 +17,7 @@
label="Exchange Settings"
factory="org_gnome_exchange_account_setup"/>
<item type="section"
- path="10.receive/10.config"
- label="OWA Url"/>
- <item type="item"
- path="10.receive/10.config/00.owa"
+ path="10.receive/00.config"
factory="org_gnome_exchange_set_url"/>
</group>
</hook>
@@ -30,10 +27,7 @@
target="account"
id="org.gnome.evolution.mail.config.accountDruid">
<item type="section"
- path="10.receive/30.config"
- label="OWA Url"/>
- <item type="item"
- path="10.receive/30.config/00.owa"
+ path="10.receive/00.config"
factory="org_gnome_exchange_read_url"/>
</group>
<group