Commit cfc8ef4c authored by Matthew Barnes's avatar Matthew Barnes
Browse files

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().
parent 6be2668e
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
......@@ -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;
}
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment