[evolution-kolab] Remove KOLAB_SETTINGS_HANDLER_CHAR_FIELD_KOLAB_USER_NAME.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab] Remove KOLAB_SETTINGS_HANDLER_CHAR_FIELD_KOLAB_USER_NAME.
- Date: Thu, 12 Jul 2012 12:43:35 +0000 (UTC)
commit 5d1903abbd49542bdea80d66fdc0c08d98b08534
Author: Matthew Barnes <mbarnes redhat com>
Date: Mon Jul 2 09:40:53 2012 -0400
Remove KOLAB_SETTINGS_HANDLER_CHAR_FIELD_KOLAB_USER_NAME.
Use CamelNetworkSettings:user instead.
src/addressbook/e-book-backend-kolab.c | 2 -
src/calendar/e-cal-backend-kolab.c | 2 -
src/calendar/kolab-util-calendar.c | 13 +++---
src/libekolab/kolab-settings-handler.c | 2 -
src/libekolab/kolab-util-backend.c | 40 ++++++++------------
src/libekolab/kolab-util-backend.h | 2 +-
.../integration/libekolab/test-kolab-mail-access.c | 14 ++-----
7 files changed, 27 insertions(+), 48 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-kolab.c b/src/addressbook/e-book-backend-kolab.c
index 709d5ff..29cee01 100644
--- a/src/addressbook/e-book-backend-kolab.c
+++ b/src/addressbook/e-book-backend-kolab.c
@@ -302,7 +302,6 @@ e_book_backend_kolab_open (EBookBackendSync *backend,
NULL,
NULL,
NULL,
- NULL,
foldername,
&sync_value);
/* We may find that we do not yet have a password set.
@@ -354,7 +353,6 @@ e_book_backend_kolab_open (EBookBackendSync *backend,
kolab_util_backend_prepare_settings (ksettings,
esource,
servername,
- username,
NULL,
foldername,
&sync_value);
diff --git a/src/calendar/e-cal-backend-kolab.c b/src/calendar/e-cal-backend-kolab.c
index df16c80..a96645b 100644
--- a/src/calendar/e-cal-backend-kolab.c
+++ b/src/calendar/e-cal-backend-kolab.c
@@ -362,7 +362,6 @@ e_cal_backend_kolab_open (ECalBackendSync *backend,
NULL,
NULL,
NULL,
- NULL,
foldername,
&sync_value);
/* We may find that we do not yet have a password set.
@@ -414,7 +413,6 @@ e_cal_backend_kolab_open (ECalBackendSync *backend,
kolab_util_backend_prepare_settings (ksettings,
esource,
servername,
- username,
NULL,
foldername,
&sync_value);
diff --git a/src/calendar/kolab-util-calendar.c b/src/calendar/kolab-util-calendar.c
index 32de950..7ea960c 100644
--- a/src/calendar/kolab-util-calendar.c
+++ b/src/calendar/kolab-util-calendar.c
@@ -74,6 +74,8 @@ kolab_util_calendar_create_pfb_trigger (KolabSettingsHandler *ksettings,
const gchar *sourcename,
GError **error)
{
+ CamelKolabIMAPXSettings *camel_settings;
+ CamelNetworkSettings *network_settings;
KolabUtilHttpJob *job = NULL;
gchar *path = NULL;
const gchar *username = NULL;
@@ -84,13 +86,10 @@ kolab_util_calendar_create_pfb_trigger (KolabSettingsHandler *ksettings,
g_assert (sourcename != NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
- username = kolab_settings_handler_get_char_field (ksettings,
- KOLAB_SETTINGS_HANDLER_CHAR_FIELD_KOLAB_USER_NAME,
- &tmp_err);
- if (tmp_err != NULL) {
- g_propagate_error (error, tmp_err);
- return NULL;
- }
+ camel_settings = kolab_settings_handler_get_camel_settings (ksettings);
+
+ network_settings = CAMEL_NETWORK_SETTINGS (camel_settings);
+ username = camel_network_settings_get_user (network_settings);
if (strncmp (username, "INBOX/", 6))
source_offset = 6;
diff --git a/src/libekolab/kolab-settings-handler.c b/src/libekolab/kolab-settings-handler.c
index 06ba4f0..c13f839 100644
--- a/src/libekolab/kolab-settings-handler.c
+++ b/src/libekolab/kolab-settings-handler.c
@@ -88,7 +88,6 @@ static KolabSettingsHandlerGetFunc _kolab_settings_handler_char_get_funcs[] = {
NULL, /* KOLAB_SETTINGS_HANDLER_CHAR_FIELD_CAMEL_ACCOUNT_DIR */
NULL, /* KOLAB_SETTINGS_HANDLER_CHAR_FIELD_ESOURCE_UID */
NULL, /* KOLAB_SETTINGS_HANDLER_CHAR_FIELD_KOLAB_SERVER_NAME */
- NULL, /* KOLAB_SETTINGS_HANDLER_CHAR_FIELD_KOLAB_USER_NAME */
NULL, /* KOLAB_SETTINGS_HANDLER_CHAR_FIELD_KOLAB_USER_PASSWORD */
NULL /* KOLAB_SETTINGS_HANDLER_CHAR_FIELD_PKCS11_USER_PIN */
};
@@ -100,7 +99,6 @@ static KolabSettingsHandlerCharSetFunc _kolab_settings_handler_char_set_funcs[]
NULL, /* KOLAB_SETTINGS_HANDLER_CHAR_FIELD_CAMEL_ACCOUNT_DIR */
NULL, /* KOLAB_SETTINGS_HANDLER_CHAR_FIELD_ESOURCE_UID */
NULL, /* KOLAB_SETTINGS_HANDLER_CHAR_FIELD_KOLAB_SERVER_NAME */
- NULL, /* KOLAB_SETTINGS_HANDLER_CHAR_FIELD_KOLAB_USER_NAME */
NULL, /* KOLAB_SETTINGS_HANDLER_CHAR_FIELD_KOLAB_USER_PASSWORD */
NULL /* KOLAB_SETTINGS_HANDLER_CHAR_FIELD_PKCS11_USER_PIN */
};
diff --git a/src/libekolab/kolab-util-backend.c b/src/libekolab/kolab-util-backend.c
index 1a800b0..0d055da 100644
--- a/src/libekolab/kolab-util-backend.c
+++ b/src/libekolab/kolab-util-backend.c
@@ -250,9 +250,11 @@ kolab_util_backend_koma_table_cleanup_cb (gpointer data,
KolabMailAccess *koma = KOLAB_MAIL_ACCESS (object);
GHashTable *koma_table = (GHashTable *) data;
const gchar *servername = NULL;
- const gchar *username = NULL;
+ const gchar *user = NULL;
gchar *user_at_server = NULL;
KolabSettingsHandler *ksettings = NULL;
+ CamelKolabIMAPXSettings *camel_settings;
+ CamelNetworkSettings *network_settings;
/* gboolean ok; */
g_debug ("%s()[%u] called.", __func__, __LINE__);
@@ -261,13 +263,15 @@ kolab_util_backend_koma_table_cleanup_cb (gpointer data,
(void)is_last_ref;
ksettings = kolab_mail_access_get_settings_handler (koma);
+ camel_settings = kolab_settings_handler_get_camel_settings (ksettings);
+
+ network_settings = CAMEL_NETWORK_SETTINGS (camel_settings);
+ user = camel_network_settings_get_user (network_settings);
+
servername = kolab_settings_handler_get_char_field (ksettings,
KOLAB_SETTINGS_HANDLER_CHAR_FIELD_KOLAB_SERVER_NAME,
NULL);
- username = kolab_settings_handler_get_char_field (ksettings,
- KOLAB_SETTINGS_HANDLER_CHAR_FIELD_KOLAB_USER_NAME,
- NULL);
- user_at_server = g_strdup_printf ("%s %s", username, servername);
+ user_at_server = g_strdup_printf ("%s %s", user, servername);
(void)g_hash_table_remove (koma_table, user_at_server);
g_free (user_at_server);
@@ -308,7 +312,6 @@ void
kolab_util_backend_prepare_settings (KolabSettingsHandler *ksettings,
ESource *esource,
const gchar *servername,
- const gchar *username,
const gchar *password,
const gchar *sourcename,
const KolabSyncStrategyID *sync_value)
@@ -363,17 +366,6 @@ kolab_util_backend_prepare_settings (KolabSettingsHandler *ksettings,
error = NULL;
}
}
- if (username != NULL) {
- (void)kolab_settings_handler_set_char_field (ksettings,
- KOLAB_SETTINGS_HANDLER_CHAR_FIELD_KOLAB_USER_NAME,
- g_strdup (username),
- &error);
- if (error != NULL) {
- g_warning ("%s()[%u] error: %s", __func__, __LINE__, error->message);
- g_error_free (error);
- error = NULL;
- }
- }
if (password != NULL) {
(void)kolab_settings_handler_set_char_field (ksettings,
KOLAB_SETTINGS_HANDLER_CHAR_FIELD_KOLAB_USER_PASSWORD,
@@ -464,6 +456,8 @@ gchar*
kolab_util_backend_account_uid_new_from_settings (KolabSettingsHandler *ksettings,
GError **err)
{
+ CamelKolabIMAPXSettings *camel_settings;
+ CamelNetworkSettings *network_settings;
const gchar *user = NULL;
const gchar *server = NULL;
const gchar *esource_uid = NULL;
@@ -490,13 +484,11 @@ kolab_util_backend_account_uid_new_from_settings (KolabSettingsHandler *ksetting
/* fallback in case we don't have an ESource UID set */
- user = kolab_settings_handler_get_char_field (ksettings,
- KOLAB_SETTINGS_HANDLER_CHAR_FIELD_KOLAB_USER_NAME,
- &tmp_err);
- if (tmp_err != NULL) {
- g_propagate_error (err, tmp_err);
- return NULL;
- }
+ camel_settings = kolab_settings_handler_get_camel_settings (ksettings);
+
+ network_settings = CAMEL_NETWORK_SETTINGS (camel_settings);
+ user = camel_network_settings_get_user (network_settings);
+
server = kolab_settings_handler_get_char_field (ksettings,
KOLAB_SETTINGS_HANDLER_CHAR_FIELD_KOLAB_SERVER_NAME,
&tmp_err);
diff --git a/src/libekolab/kolab-util-backend.h b/src/libekolab/kolab-util-backend.h
index 2f4fd1c..6af4a71 100644
--- a/src/libekolab/kolab-util-backend.h
+++ b/src/libekolab/kolab-util-backend.h
@@ -85,7 +85,7 @@ void kolab_util_backend_koma_table_cleanup_cb (gpointer data, GObject *object, g
void kolab_util_backend_modtime_set_on_econtact (EContact *econtact);
void kolab_util_backend_modtime_set_on_ecalcomp (ECalComponent *ecalcomp);
-void kolab_util_backend_prepare_settings (KolabSettingsHandler *ksettings, ESource *esource, const gchar *servername, const gchar *username, const gchar *password, const gchar *sourcename, const KolabSyncStrategyID *sync_value);
+void kolab_util_backend_prepare_settings (KolabSettingsHandler *ksettings, ESource *esource, const gchar *servername, const gchar *password, const gchar *sourcename, const KolabSyncStrategyID *sync_value);
gboolean kolab_util_backend_sqlite_db_new_open (KolabUtilSqliteDb **kdb, KolabSettingsHandler *ksettings, const gchar *dbfilename, GError **err);
diff --git a/src/tests/integration/libekolab/test-kolab-mail-access.c b/src/tests/integration/libekolab/test-kolab-mail-access.c
index 4c5a2ab..0b231d8 100644
--- a/src/tests/integration/libekolab/test-kolab-mail-access.c
+++ b/src/tests/integration/libekolab/test-kolab-mail-access.c
@@ -59,6 +59,7 @@ kolab_itest_koma_ksettings_envset (KolabSettingsHandler *ksettings,
GError **err)
{
CamelKolabIMAPXSettings *camel_settings;
+ CamelNetworkSettings *network_settings;
CamelNetworkSecurityMethod security;
GKeyFile *key_file = NULL;
gchar *config = NULL;
@@ -75,6 +76,7 @@ kolab_itest_koma_ksettings_envset (KolabSettingsHandler *ksettings,
g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
camel_settings = kolab_settings_handler_get_camel_settings (ksettings);
+ network_settings = CAMEL_NETWORK_SETTINGS (camel_settings);
key_file = g_key_file_new ();
@@ -119,14 +121,7 @@ kolab_itest_koma_ksettings_envset (KolabSettingsHandler *ksettings,
return FALSE;
}
- ok = kolab_settings_handler_set_char_field (ksettings,
- KOLAB_SETTINGS_HANDLER_CHAR_FIELD_KOLAB_USER_NAME,
- username,
- &tmp_err);
- if (! ok) {
- g_propagate_error (err, tmp_err);
- return FALSE;
- }
+ camel_network_settings_set_user (network_settings, username);
ok = kolab_settings_handler_set_char_field (ksettings,
KOLAB_SETTINGS_HANDLER_CHAR_FIELD_KOLAB_USER_PASSWORD,
@@ -146,8 +141,7 @@ kolab_itest_koma_ksettings_envset (KolabSettingsHandler *ksettings,
return FALSE;
}
- camel_network_settings_set_security_method (CAMEL_NETWORK_SETTINGS (camel_settings),
- security);
+ camel_network_settings_set_security_method (network_settings, security);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]