diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-08-13 02:16:04 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-08-13 02:16:04 +0800 |
commit | cfc8ef4c6ca14603c9ea8dd8429e8297e9c51980 (patch) | |
tree | 1624757b388826972c4fc5a47a23e112a02ce203 | |
parent | 6be2668e483cfc7a2e75ae2efcd9675388d08601 (diff) | |
download | gsoc2013-evolution-cfc8ef4c6ca14603c9ea8dd8429e8297e9c51980.tar.gz gsoc2013-evolution-cfc8ef4c6ca14603c9ea8dd8429e8297e9c51980.tar.zst gsoc2013-evolution-cfc8ef4c6ca14603c9ea8dd8429e8297e9c51980.zip |
Adapt to CamelService API changes.
camel_service_get_settings() is now camel_service_ref_settings()
and it returns a new CamelSettings reference which the caller must
release with g_object_unref().
-rw-r--r-- | libemail-engine/e-mail-folder-utils.c | 4 | ||||
-rw-r--r-- | libemail-engine/e-mail-session.c | 10 | ||||
-rw-r--r-- | libemail-engine/mail-ops.c | 5 | ||||
-rw-r--r-- | libemail-engine/mail-tools.c | 11 | ||||
-rw-r--r-- | mail/mail-send-recv.c | 19 | ||||
-rw-r--r-- | shell/e-convert-local-mail.c | 5 |
6 files changed, 39 insertions, 15 deletions
diff --git a/libemail-engine/e-mail-folder-utils.c b/libemail-engine/e-mail-folder-utils.c index 78e5434ed9..5d4fa2e2b1 100644 --- a/libemail-engine/e-mail-folder-utils.c +++ b/libemail-engine/e-mail-folder-utils.c @@ -313,7 +313,7 @@ mail_folder_expunge_pop3_stores (CamelFolder *folder, CAMEL_SESSION (session), source_uid); service_uid = camel_service_get_uid (service); - settings = camel_service_get_settings (service); + settings = camel_service_ref_settings (service); g_object_get ( settings, @@ -321,6 +321,8 @@ mail_folder_expunge_pop3_stores (CamelFolder *folder, "keep-on-server", &keep_on_server, NULL); + g_object_unref (settings); + if (!keep_on_server || !delete_expunged) { g_object_unref (service); continue; diff --git a/libemail-engine/e-mail-session.c b/libemail-engine/e-mail-session.c index c7853f9b56..a2f56814cf 100644 --- a/libemail-engine/e-mail-session.c +++ b/libemail-engine/e-mail-session.c @@ -688,14 +688,18 @@ mail_session_configure_local_store (EMailSession *session) session->priv->local_store = service; /* takes ownership */ g_return_if_fail (service != NULL); - settings = camel_service_get_settings (service); - local_settings = CAMEL_LOCAL_SETTINGS (settings); - data_dir = camel_session_get_user_data_dir (camel_session); + settings = camel_service_ref_settings (service); + data_dir = camel_session_get_user_data_dir (camel_session); path = g_build_filename (data_dir, E_MAIL_SESSION_LOCAL_UID, NULL); + + local_settings = CAMEL_LOCAL_SETTINGS (settings); camel_local_settings_set_path (local_settings, path); + g_free (path); + g_object_unref (settings); + /* Shouldn't need to worry about other mail applications * altering files in our local mail store. */ g_object_set (service, "need-summary-check", FALSE, NULL); diff --git a/libemail-engine/mail-ops.c b/libemail-engine/mail-ops.c index 7120826d49..ed3f44264d 100644 --- a/libemail-engine/mail-ops.c +++ b/libemail-engine/mail-ops.c @@ -249,13 +249,16 @@ fetch_mail_exec (struct _fetch_mail_msg *m, service = CAMEL_SERVICE (m->store); uid = camel_service_get_uid (service); - settings = camel_service_get_settings (service); + + settings = camel_service_ref_settings (service); /* XXX This is a POP3-specific setting. */ class = G_OBJECT_GET_CLASS (settings); if (g_object_class_find_property (class, "keep-on-server") != NULL) g_object_get (settings, "keep-on-server", &keep, NULL); + g_object_unref (settings); + /* Just for readability. */ delete_fetched = !keep; diff --git a/libemail-engine/mail-tools.c b/libemail-engine/mail-tools.c index 82b2146b92..29955c73d4 100644 --- a/libemail-engine/mail-tools.c +++ b/libemail-engine/mail-tools.c @@ -91,7 +91,7 @@ mail_tool_do_movemail (CamelStore *store, CamelService *service; CamelProvider *provider; CamelSettings *settings; - const gchar *src_path; + gchar *src_path; gchar *dest_path; struct stat sb; gboolean success; @@ -100,7 +100,6 @@ mail_tool_do_movemail (CamelStore *store, service = CAMEL_SERVICE (store); provider = camel_service_get_provider (service); - settings = camel_service_get_settings (service); g_return_val_if_fail (provider != NULL, NULL); @@ -114,9 +113,13 @@ mail_tool_do_movemail (CamelStore *store, return NULL; } - src_path = camel_local_settings_get_path ( + settings = camel_service_ref_settings (service); + + src_path = camel_local_settings_dup_path ( CAMEL_LOCAL_SETTINGS (settings)); + g_object_unref (settings); + /* Set up our destination. */ dest_path = mail_tool_get_local_movemail_path (store, error); if (dest_path == NULL) @@ -125,6 +128,8 @@ mail_tool_do_movemail (CamelStore *store, /* Movemail from source to dest_path */ success = camel_movemail (src_path, dest_path, error) != -1; + g_free (src_path); + if (g_stat (dest_path, &sb) < 0 || sb.st_size == 0) { g_unlink (dest_path); /* Clean up the movemail.foo file. */ g_free (dest_path); diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c index d2190a244d..4dd68f631c 100644 --- a/mail/mail-send-recv.c +++ b/mail/mail-send-recv.c @@ -370,9 +370,9 @@ format_service_name (CamelService *service) CamelSettings *settings; gchar *service_name = NULL; const gchar *display_name; - const gchar *host = NULL; - const gchar *path = NULL; gchar *pretty_url = NULL; + gchar *host = NULL; + gchar *path = NULL; gchar *user = NULL; gchar *cp; gboolean have_host = FALSE; @@ -380,11 +380,12 @@ format_service_name (CamelService *service) gboolean have_user = FALSE; provider = camel_service_get_provider (service); - settings = camel_service_get_settings (service); display_name = camel_service_get_display_name (service); + settings = camel_service_ref_settings (service); + if (CAMEL_IS_NETWORK_SETTINGS (settings)) { - host = camel_network_settings_get_host ( + host = camel_network_settings_dup_host ( CAMEL_NETWORK_SETTINGS (settings)); have_host = (host != NULL) && (*host != '\0'); @@ -394,11 +395,13 @@ format_service_name (CamelService *service) } if (CAMEL_IS_LOCAL_SETTINGS (settings)) { - path = camel_local_settings_get_path ( + path = camel_local_settings_dup_path ( CAMEL_LOCAL_SETTINGS (settings)); have_path = (path != NULL) && (*path != '\0'); } + g_object_unref (settings); + /* Shorten user names with '@', since multiple '@' in a * 'user@host' label look weird. This is just supposed * to be a hint anyway so it doesn't matter if it's not @@ -433,6 +436,8 @@ format_service_name (CamelService *service) } g_free (service_name); + g_free (host); + g_free (path); g_free (user); return pretty_url; @@ -491,7 +496,7 @@ get_keep_on_server (CamelService *service) CamelSettings *settings; gboolean keep_on_server = FALSE; - settings = camel_service_get_settings (service); + settings = camel_service_ref_settings (service); class = G_OBJECT_GET_CLASS (settings); /* XXX This is a POP3-specific setting. */ @@ -500,6 +505,8 @@ get_keep_on_server (CamelService *service) settings, "keep-on-server", &keep_on_server, NULL); + g_object_unref (settings); + return keep_on_server; } diff --git a/shell/e-convert-local-mail.c b/shell/e-convert-local-mail.c index 16736c95c4..8a726f8a99 100644 --- a/shell/e-convert-local-mail.c +++ b/shell/e-convert-local-mail.c @@ -241,12 +241,15 @@ migrate_mbox_to_maildir (EShell *shell, camel_service_set_settings (mbox_service, settings); - settings = camel_service_get_settings (maildir_service); + settings = camel_service_ref_settings (maildir_service); + path = g_build_filename (data_dir, "local", NULL); g_object_set (settings, "path", path, NULL); g_mkdir (path, 0700); g_free (path); + g_object_unref (settings); + ms.mail_store = CAMEL_STORE (mbox_service); ms.maildir_store = CAMEL_STORE (maildir_service); ms.session = session; |