[evolution-data-server] Remove "uri" field of CamelFolderInfo.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Remove "uri" field of CamelFolderInfo.
- Date: Sat, 7 May 2011 15:27:10 +0000 (UTC)
commit 133cbedcd0a1327771caac9dc994af3cfca69917
Author: Matthew Barnes <mbarnes redhat com>
Date: Sat May 7 08:13:44 2011 -0400
Remove "uri" field of CamelFolderInfo.
With this change, Camel no longer deals with folder URIs.
camel/camel-store.c | 82 +++++++++-----------------
camel/camel-store.h | 1 -
camel/camel-vee-store.c | 39 +++++--------
camel/providers/imap/camel-imap-store.c | 32 +---------
camel/providers/imapx/camel-imapx-store.c | 32 +---------
camel/providers/local/camel-local-store.c | 6 --
camel/providers/local/camel-maildir-store.c | 8 +--
camel/providers/local/camel-mbox-store.c | 33 +++--------
camel/providers/local/camel-mh-store.c | 29 +++-------
camel/providers/local/camel-spool-store.c | 11 ----
camel/providers/nntp/camel-nntp-folder.c | 2 -
camel/providers/nntp/camel-nntp-store.c | 49 ++++------------
docs/reference/camel/tmpl/camel-store.sgml | 1 -
13 files changed, 82 insertions(+), 243 deletions(-)
---
diff --git a/camel/camel-store.c b/camel/camel-store.c
index 90d0efb..608a761 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -1610,10 +1610,8 @@ add_special_info (CamelStore *store,
CamelFolderInfoFlags flags)
{
CamelFolderInfo *fi, *vinfo, *parent;
- CamelProvider *provider;
- gchar *uri, *path;
- CamelURL *url;
+ g_return_if_fail (CAMEL_IS_STORE (store));
g_return_if_fail (info != NULL);
parent = NULL;
@@ -1623,34 +1621,22 @@ add_special_info (CamelStore *store,
parent = fi;
}
- provider = camel_service_get_provider (CAMEL_SERVICE (store));
-
- /* create our vTrash/vJunk URL */
- url = camel_url_new (info->uri, NULL);
- if (provider->url_flags & CAMEL_URL_FRAGMENT_IS_PATH) {
- camel_url_set_fragment (url, name);
- } else {
- path = g_strdup_printf ("/%s", name);
- camel_url_set_path (url, path);
- g_free (path);
- }
-
- uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
- camel_url_free (url);
-
if (fi) {
- /* We're going to replace the physical Trash/Junk folder with our vTrash/vJunk folder */
+ /* We're going to replace the physical Trash/Junk
+ * folder with our vTrash/vJunk folder. */
vinfo = fi;
- g_free (vinfo->full_name);
g_free (vinfo->name);
- g_free (vinfo->uri);
+ g_free (vinfo->full_name);
} else {
- /* There wasn't a Trash/Junk folder so create a new folder entry */
+ /* There wasn't a Trash/Junk folder so create a new
+ * folder entry. */
vinfo = camel_folder_info_new ();
g_assert (parent != NULL);
- vinfo->flags |= CAMEL_FOLDER_NOINFERIORS | CAMEL_FOLDER_SUBSCRIBED;
+ vinfo->flags |=
+ CAMEL_FOLDER_NOINFERIORS |
+ CAMEL_FOLDER_SUBSCRIBED;
/* link it into the right spot */
vinfo->next = parent->next;
@@ -1661,7 +1647,7 @@ add_special_info (CamelStore *store,
vinfo->flags |= flags;
vinfo->full_name = g_strdup (name);
vinfo->name = g_strdup (translated);
- vinfo->uri = uri;
+
if (!unread_count)
vinfo->unread = -1;
}
@@ -1676,7 +1662,6 @@ dump_fi (CamelFolderInfo *fi, gint depth)
s[depth] = 0;
while (fi) {
- printf("%suri: %s\n", s, fi->uri);
printf("%sfull_name: %s\n", s, fi->full_name);
printf("%sflags: %08x\n", s, fi->flags);
dump_fi (fi->child, depth+2);
@@ -1752,15 +1737,18 @@ camel_folder_info_free (CamelFolderInfo *fi)
camel_folder_info_free (fi->child);
g_free (fi->name);
g_free (fi->full_name);
- g_free (fi->uri);
g_slice_free (CamelFolderInfo, fi);
}
}
/**
* camel_folder_info_new:
+ * @store: a #CamelStore
*
- * Returns: a new empty CamelFolderInfo instance
+ * Allocates a new #CamelFolderInfo instance. Free it with
+ * camel_folder_info_free().
+ *
+ * Returns: a new #CamelFolderInfo instance
*
* Since: 2.22
**/
@@ -1837,11 +1825,9 @@ camel_folder_info_build (GPtrArray *folders,
} else {
/* we are missing a folder in the heirarchy so
create a fake folder node */
- const gchar *path;
- CamelURL *url;
- gchar *sep;
pfi = camel_folder_info_new ();
+
if (short_names) {
pfi->name = strrchr (pname, separator);
if (pfi->name)
@@ -1851,25 +1837,11 @@ camel_folder_info_build (GPtrArray *folders,
} else
pfi->name = g_strdup (pname);
- url = camel_url_new (fi->uri, NULL);
- if (url->fragment)
- path = url->fragment;
- else
- path = url->path + 1;
-
- sep = strrchr (path, separator);
- if (sep)
- *sep = '\0';
- else {
- d(g_warning ("huh, no \"%c\" in \"%s\"?", separator, fi->uri));
- }
-
- pfi->full_name = g_strdup (path);
+ pfi->full_name = g_strdup (pname);
- /* since this is a "fake" folder node, it is not selectable */
- camel_url_set_param (url, "noselect", "yes");
- pfi->uri = camel_url_to_string (url, 0);
- camel_url_free (url);
+ /* Since this is a "fake" folder
+ * node, it is not selectable. */
+ pfi->flags |= CAMEL_FOLDER_NOSELECT;
g_hash_table_insert (hash, pname, pfi);
g_ptr_array_add (folders, pfi);
@@ -1914,7 +1886,6 @@ folder_info_clone_rec (CamelFolderInfo *fi,
info = camel_folder_info_new ();
info->parent = parent;
- info->uri = g_strdup (fi->uri);
info->name = g_strdup (fi->name);
info->full_name = g_strdup (fi->full_name);
info->unread = fi->unread;
@@ -2140,6 +2111,9 @@ camel_store_get_folder_sync (CamelStore *store,
}
}
+ camel_operation_push_message (
+ cancellable, _("Opening folder '%s'"), folder_name);
+
if ((store->flags & CAMEL_STORE_VTRASH) && strcmp (folder_name, CAMEL_VTRASH_NAME) == 0) {
folder = class->get_trash_folder_sync (store, cancellable, error);
CAMEL_CHECK_GERROR (store, get_trash_folder_sync, folder != NULL, error);
@@ -2168,6 +2142,8 @@ camel_store_get_folder_sync (CamelStore *store,
}
}
+ camel_operation_pop_message (cancellable);
+
if (store->folders) {
if (folder)
camel_object_bag_add (store->folders, folder_name, folder);
@@ -2305,10 +2281,10 @@ camel_store_get_folder_info_sync (CamelStore *store,
store, get_folder_info_sync, info != NULL, error);
if (info && (top == NULL || *top == '\0') && (flags & CAMEL_STORE_FOLDER_INFO_NO_VIRTUAL) == 0) {
- if (info->uri && (store->flags & CAMEL_STORE_VTRASH))
+ if (store->flags & CAMEL_STORE_VTRASH)
/* the name of the Trash folder, used for deleted messages */
add_special_info (store, info, CAMEL_VTRASH_NAME, _("Trash"), FALSE, CAMEL_FOLDER_VIRTUAL|CAMEL_FOLDER_SYSTEM|CAMEL_FOLDER_VTRASH|CAMEL_FOLDER_TYPE_TRASH);
- if (info->uri && (store->flags & CAMEL_STORE_VJUNK))
+ if (store->flags & CAMEL_STORE_VJUNK)
/* the name of the Junk folder, used for spam messages */
add_special_info (store, info, CAMEL_VJUNK_NAME, _("Junk"), TRUE, CAMEL_FOLDER_VIRTUAL|CAMEL_FOLDER_SYSTEM|CAMEL_FOLDER_VTRASH|CAMEL_FOLDER_TYPE_JUNK);
} else if (!info && top && (flags & CAMEL_STORE_FOLDER_INFO_NO_VIRTUAL) == 0) {
@@ -2316,11 +2292,11 @@ camel_store_get_folder_info_sync (CamelStore *store,
if ((store->flags & CAMEL_STORE_VTRASH) != 0 && g_str_equal (top, CAMEL_VTRASH_NAME)) {
root_info = class->get_folder_info_sync (store, NULL, flags & (~CAMEL_STORE_FOLDER_INFO_RECURSIVE), cancellable, error);
- if (root_info && root_info->uri)
+ if (root_info)
add_special_info (store, root_info, CAMEL_VTRASH_NAME, _("Trash"), FALSE, CAMEL_FOLDER_VIRTUAL|CAMEL_FOLDER_SYSTEM|CAMEL_FOLDER_VTRASH|CAMEL_FOLDER_TYPE_TRASH);
} else if ((store->flags & CAMEL_STORE_VJUNK) != 0 && g_str_equal (top, CAMEL_VJUNK_NAME)) {
root_info = class->get_folder_info_sync (store, NULL, flags & (~CAMEL_STORE_FOLDER_INFO_RECURSIVE), cancellable, error);
- if (root_info && root_info->uri)
+ if (root_info)
add_special_info (store, root_info, CAMEL_VJUNK_NAME, _("Junk"), TRUE, CAMEL_FOLDER_VIRTUAL|CAMEL_FOLDER_SYSTEM|CAMEL_FOLDER_VTRASH|CAMEL_FOLDER_TYPE_JUNK);
}
diff --git a/camel/camel-store.h b/camel/camel-store.h
index ff1f0fc..cc18e46 100644
--- a/camel/camel-store.h
+++ b/camel/camel-store.h
@@ -156,7 +156,6 @@ typedef struct _CamelFolderInfo {
struct _CamelFolderInfo *parent;
struct _CamelFolderInfo *child;
- gchar *uri;
gchar *name;
gchar *full_name;
diff --git a/camel/camel-vee-store.c b/camel/camel-vee-store.c
index b4755ad..d82a449 100644
--- a/camel/camel-vee-store.c
+++ b/camel/camel-vee-store.c
@@ -191,7 +191,6 @@ vee_store_get_folder_info_sync (CamelStore *store,
CamelFolderInfo *info, *res = NULL, *tail;
GPtrArray *folders;
GHashTable *infos_hash;
- CamelURL *url;
gint i;
d (printf ("Get folder info '%s'\n", top?top:"<null>"));
@@ -230,8 +229,7 @@ vee_store_get_folder_info_sync (CamelStore *store,
d (printf ("%sadding '%s'\n", add?"":"not ", name));
if (add) {
- CamelStore *parent_store;
- CamelURL *service_url;
+ gint32 unread;
/* ensures unread is correct */
if ((flags & CAMEL_STORE_FOLDER_INFO_FAST) == 0)
@@ -239,20 +237,16 @@ vee_store_get_folder_info_sync (CamelStore *store,
(CamelFolder *)folder,
cancellable, NULL);
- parent_store = camel_folder_get_parent_store (CAMEL_FOLDER (folder));
+ unread = camel_folder_get_unread_message_count (
+ CAMEL_FOLDER (folder));
info = camel_folder_info_new ();
- url = camel_url_new ("vfolder:", NULL);
- service_url = camel_service_get_camel_url (
- CAMEL_SERVICE (parent_store));
- camel_url_set_path (url, service_url->path);
- camel_url_set_fragment (url, full_name);
- info->uri = camel_url_to_string (url, 0);
- camel_url_free (url);
- info->full_name = g_strdup (full_name);
info->name = g_strdup (name);
- info->unread = camel_folder_get_unread_message_count ((CamelFolder *)folder);
- info->flags = CAMEL_FOLDER_NOCHILDREN|CAMEL_FOLDER_VIRTUAL;
+ info->full_name = g_strdup (full_name);
+ info->unread = unread;
+ info->flags =
+ CAMEL_FOLDER_NOCHILDREN |
+ CAMEL_FOLDER_VIRTUAL;
g_hash_table_insert (infos_hash, info->full_name, info);
if (res == NULL)
@@ -299,20 +293,15 @@ vee_store_get_folder_info_sync (CamelStore *store,
/* and always add UNMATCHED, if scanning from top/etc */
/* FIXME[disk-summary] comment it out well */
if ((top == NULL || top[0] == 0 || strncmp (top, CAMEL_UNMATCHED_NAME, strlen (CAMEL_UNMATCHED_NAME)) == 0)) {
- CamelURL *service_url;
-
info = camel_folder_info_new ();
- url = camel_url_new ("vfolder:", NULL);
- service_url = camel_service_get_camel_url (CAMEL_SERVICE (store));
- camel_url_set_path (url, service_url->path);
- camel_url_set_fragment (url, CAMEL_UNMATCHED_NAME);
- info->uri = camel_url_to_string (url, 0);
- camel_url_free (url);
- /*info->url = g_strdup_printf ("vfolder:%s#%s", ((CamelService *)store)->url->path, CAMEL_UNMATCHED_NAME);*/
- info->full_name = g_strdup (CAMEL_UNMATCHED_NAME);
info->name = g_strdup (_("Unmatched"));
+ info->full_name = g_strdup (CAMEL_UNMATCHED_NAME);
info->unread = -1;
- info->flags = CAMEL_FOLDER_NOCHILDREN|CAMEL_FOLDER_NOINFERIORS|CAMEL_FOLDER_SYSTEM|CAMEL_FOLDER_VIRTUAL;
+ info->flags =
+ CAMEL_FOLDER_NOCHILDREN |
+ CAMEL_FOLDER_NOINFERIORS |
+ CAMEL_FOLDER_SYSTEM |
+ CAMEL_FOLDER_VIRTUAL;
if (res == NULL)
res = info;
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index da6f344..cc1dd16 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -1397,7 +1397,6 @@ imap_set_server_level (CamelImapStore *store)
static CamelFolderInfo *
imap_build_folder_info (CamelImapStore *imap_store, const gchar *folder_name)
{
- CamelURL *url;
const gchar *name;
CamelFolderInfo *fi;
@@ -1406,11 +1405,6 @@ imap_build_folder_info (CamelImapStore *imap_store, const gchar *folder_name)
fi->unread = -1;
fi->total = -1;
- url = camel_url_new (imap_store->base_url, NULL);
- g_free (url->path);
- url->path = g_strdup_printf ("/%s", folder_name);
- fi->uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
- camel_url_free (url);
name = strrchr (fi->full_name, '/');
if (name == NULL)
name = fi->full_name;
@@ -2475,8 +2469,7 @@ parse_list_response_as_folder_info (CamelImapStore *imap_store,
{
CamelFolderInfo *fi;
gint flags;
- gchar sep, *dir, *path;
- CamelURL *url;
+ gchar sep, *dir;
CamelImapStoreInfo *si;
guint32 newflags;
@@ -2513,18 +2506,6 @@ parse_list_response_as_folder_info (CamelImapStore *imap_store,
flags = (flags & ~CAMEL_FOLDER_NOINFERIORS) | CAMEL_FOLDER_NOCHILDREN;
fi->flags = flags;
- url = camel_url_new (imap_store->base_url, NULL);
- path = alloca (strlen (fi->full_name)+2);
- sprintf(path, "/%s", fi->full_name);
- camel_url_set_path (url, path);
-
- if ((flags & CAMEL_FOLDER_NOSELECT) != 0 || fi->name[0] == 0)
- camel_url_set_param (url, "noselect", "yes");
- else
- camel_url_set_param (url, "noselect", NULL);
- fi->uri = camel_url_to_string (url, 0);
- camel_url_free (url);
-
fi->total = -1;
fi->unread = -1;
@@ -2996,16 +2977,9 @@ get_folder_info_offline (CamelStore *store, const gchar *top,
fi->flags = (fi->flags & ~CAMEL_FOLDER_TYPE_MASK) | CAMEL_FOLDER_TYPE_JUNK;
}
- if (si->flags & CAMEL_FOLDER_NOSELECT) {
- CamelURL *url = camel_url_new (fi->uri, NULL);
-
- camel_url_set_param (url, "noselect", "yes");
- g_free (fi->uri);
- fi->uri = camel_url_to_string (url, 0);
- camel_url_free (url);
- } else {
+ if (!(si->flags & CAMEL_FOLDER_NOSELECT))
fill_fi ((CamelStore *)imap_store, fi, 0);
- }
+
if (!fi->child)
fi->flags |= CAMEL_FOLDER_NOCHILDREN;
g_ptr_array_add (folders, fi);
diff --git a/camel/providers/imapx/camel-imapx-store.c b/camel/providers/imapx/camel-imapx-store.c
index 22549b8..4f24edd 100644
--- a/camel/providers/imapx/camel-imapx-store.c
+++ b/camel/providers/imapx/camel-imapx-store.c
@@ -336,20 +336,14 @@ get_folder_offline (CamelStore *store, const gchar *folder_name,
static CamelFolderInfo *
imapx_build_folder_info (CamelIMAPXStore *imapx_store, const gchar *folder_name)
{
- CamelURL *url;
- const gchar *name;
CamelFolderInfo *fi;
+ const gchar *name;
fi = camel_folder_info_new ();
fi->full_name = g_strdup (folder_name);
fi->unread = -1;
fi->total = -1;
- url = camel_url_new (imapx_store->base_url, NULL);
- g_free (url->path);
- url->path = g_strdup_printf ("/%s", folder_name);
- fi->uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
- camel_url_free (url);
name = strrchr (fi->full_name, '/');
if (name == NULL)
name = fi->full_name;
@@ -714,16 +708,9 @@ get_folder_info_offline (CamelStore *store, const gchar *top,
fi->flags |= CAMEL_FOLDER_SYSTEM;
}
- if (si->flags & CAMEL_FOLDER_NOSELECT) {
- CamelURL *url = camel_url_new (fi->uri, NULL);
-
- camel_url_set_param (url, "noselect", "yes");
- g_free (fi->uri);
- fi->uri = camel_url_to_string (url, 0);
- camel_url_free (url);
- } else {
+ if (!(si->flags & CAMEL_FOLDER_NOSELECT))
fill_fi ((CamelStore *)imapx_store, fi, 0);
- }
+
if (!fi->child)
fi->flags |= CAMEL_FOLDER_NOCHILDREN;
g_ptr_array_add (folders, fi);
@@ -750,7 +737,6 @@ add_folders_to_summary (CamelIMAPXStore *istore, CamelIMAPXServer *server, GPtrA
guint32 new_flags;
CamelFolderInfo *fi, *sfi;
gchar *path;
- CamelURL *url;
if (subscribed) {
path = camel_imapx_store_summary_path_to_full (istore->summary, li->name, li->separator);
@@ -794,16 +780,6 @@ add_folders_to_summary (CamelIMAPXStore *istore, CamelIMAPXServer *server, GPtrA
li->flags = (li->flags & ~CAMEL_FOLDER_NOINFERIORS) | CAMEL_FOLDER_NOCHILDREN;
fi->flags = li->flags;
- url = camel_url_new (istore->base_url, NULL);
- path = alloca (strlen (fi->full_name)+2);
- sprintf(path, "/%s", fi->full_name);
- camel_url_set_path (url, path);
-
- if (li->flags & CAMEL_FOLDER_NOSELECT || fi->name[0] == 0)
- camel_url_set_param (url, "noselect", "yes");
- fi->uri = camel_url_to_string (url, 0);
- camel_url_free (url);
-
fi->total = -1;
fi->unread = -1;
@@ -1524,7 +1500,6 @@ imapx_store_initable_init (GInitable *initable,
{
CamelIMAPXStore *store;
CamelService *service;
- CamelSession *session;
CamelURL *url;
const gchar *user_data_dir;
gchar *summary;
@@ -1537,7 +1512,6 @@ imapx_store_initable_init (GInitable *initable,
service = CAMEL_SERVICE (initable);
url = camel_service_get_camel_url (service);
- session = camel_service_get_session (service);
user_data_dir = camel_service_get_user_data_dir (service);
store->base_url = camel_url_to_string (
diff --git a/camel/providers/local/camel-local-store.c b/camel/providers/local/camel-local-store.c
index 5b88d9c..427f7d8 100644
--- a/camel/providers/local/camel-local-store.c
+++ b/camel/providers/local/camel-local-store.c
@@ -488,12 +488,9 @@ local_store_delete_folder_sync (CamelStore *store,
{
CamelFolderInfo *fi;
CamelFolder *lf;
- CamelURL *url;
gchar *name;
gchar *str;
- url = camel_service_get_camel_url (CAMEL_SERVICE (store));
-
/* remove metadata only */
name = g_strdup_printf("%s%s", CAMEL_LOCAL_STORE(store)->toplevel_dir, folder_name);
str = g_strdup_printf("%s.ibex", name);
@@ -542,9 +539,6 @@ local_store_delete_folder_sync (CamelStore *store,
fi = camel_folder_info_new ();
fi->full_name = g_strdup (folder_name);
fi->name = g_path_get_basename (folder_name);
- fi->uri = g_strdup_printf (
- "%s:%s#%s", url->protocol,
- CAMEL_LOCAL_STORE (store)->toplevel_dir, folder_name);
fi->unread = -1;
camel_store_folder_deleted (store, fi);
diff --git a/camel/providers/local/camel-maildir-store.c b/camel/providers/local/camel-maildir-store.c
index 1f07d3d..427c6fc 100644
--- a/camel/providers/local/camel-maildir-store.c
+++ b/camel/providers/local/camel-maildir-store.c
@@ -415,8 +415,6 @@ scan_fi (CamelStore *store,
fi = camel_folder_info_new ();
fi->full_name = g_strdup (full);
fi->name = g_strdup (name);
- camel_url_set_fragment (url, fi->full_name);
- fi->uri = camel_url_to_string (url, 0);
fi->unread = -1;
fi->total = -1;
@@ -428,9 +426,9 @@ scan_fi (CamelStore *store,
dir_name = maildir_full_name_to_dir_name (fi->full_name);
d(printf("Adding maildir info: '%s' '%s' '%s'\n", fi->name, dir_name, fi->uri));
- tmp = g_build_filename(url->path, dir_name, "tmp", NULL);
- cur = g_build_filename(url->path, dir_name, "cur", NULL);
- new = g_build_filename(url->path, dir_name, "new", NULL);
+ tmp = g_build_filename (url->path, dir_name, "tmp", NULL);
+ cur = g_build_filename (url->path, dir_name, "cur", NULL);
+ new = g_build_filename (url->path, dir_name, "new", NULL);
if (!(g_stat (tmp, &st) == 0 && S_ISDIR (st.st_mode)
&& g_stat (cur, &st) == 0 && S_ISDIR (st.st_mode)
diff --git a/camel/providers/local/camel-mbox-store.c b/camel/providers/local/camel-mbox-store.c
index 0c732ce..afd75c3 100644
--- a/camel/providers/local/camel-mbox-store.c
+++ b/camel/providers/local/camel-mbox-store.c
@@ -138,8 +138,13 @@ fill_fi (CamelStore *store,
}
static CamelFolderInfo *
-scan_dir (CamelStore *store, CamelURL *url, GHashTable *visited, CamelFolderInfo *parent, const gchar *root,
- const gchar *name, guint32 flags, GError **error)
+scan_dir (CamelStore *store,
+ GHashTable *visited,
+ CamelFolderInfo *parent,
+ const gchar *root,
+ const gchar *name,
+ guint32 flags,
+ GError **error)
{
CamelFolderInfo *folders, *tail, *fi;
GHashTable *folder_hash;
@@ -204,9 +209,6 @@ scan_dir (CamelStore *store, CamelURL *url, GHashTable *visited, CamelFolderInfo
fi = camel_folder_info_new ();
fi->parent = parent;
- camel_url_set_fragment (url, full_name);
-
- fi->uri = camel_url_to_string (url, 0);
fi->name = short_name;
fi->full_name = full_name;
fi->unread = -1;
@@ -239,7 +241,7 @@ scan_dir (CamelStore *store, CamelURL *url, GHashTable *visited, CamelFolderInfo
*inew = in;
g_hash_table_insert (visited, inew, inew);
#endif
- if ((fi->child = scan_dir (store, url, visited, fi, path, fi->full_name, flags, error)))
+ if ((fi->child = scan_dir (store, visited, fi, path, fi->full_name, flags, error)))
fi->flags |= CAMEL_FOLDER_CHILDREN;
else
fi->flags =(fi->flags & ~CAMEL_FOLDER_CHILDREN) | CAMEL_FOLDER_NOCHILDREN;
@@ -429,7 +431,6 @@ mbox_store_get_folder_info_sync (CamelStore *store,
CamelFolderInfo *fi;
gchar *basename;
struct stat st;
- CamelURL *url;
top = top ? top : "";
path = camel_local_store_get_full_path (store, top);
@@ -449,12 +450,9 @@ mbox_store_get_folder_info_sync (CamelStore *store,
g_hash_table_insert (visited, inode, inode);
#endif
- url = camel_service_get_camel_url (CAMEL_SERVICE (store));
- url = camel_url_copy (url);
- fi = scan_dir (store, url, visited, NULL, path, NULL, flags, error);
+ fi = scan_dir (store, visited, NULL, path, NULL, flags, error);
g_hash_table_foreach (visited, inode_free, NULL);
g_hash_table_destroy (visited);
- camel_url_free (url);
g_free (path);
return fi;
@@ -470,13 +468,8 @@ mbox_store_get_folder_info_sync (CamelStore *store,
basename = g_path_get_basename (top);
- url = camel_service_get_camel_url (CAMEL_SERVICE (store));
- url = camel_url_copy (url);
- camel_url_set_fragment (url, top);
-
fi = camel_folder_info_new ();
fi->parent = NULL;
- fi->uri = camel_url_to_string (url, 0);
fi->name = basename;
fi->full_name = g_strdup (top);
fi->unread = -1;
@@ -487,11 +480,9 @@ mbox_store_get_folder_info_sync (CamelStore *store,
subdir = g_strdup_printf("%s.sbd", path);
if (g_stat (subdir, &st) == 0) {
if (S_ISDIR (st.st_mode))
- fi->child = scan_dir (store, url, visited, fi, subdir, top, flags, error);
+ fi->child = scan_dir (store, visited, fi, subdir, top, flags, error);
}
- camel_url_free (url);
-
if (fi->child)
fi->flags |= CAMEL_FOLDER_CHILDREN;
else
@@ -598,12 +589,9 @@ mbox_store_delete_folder_sync (CamelStore *store,
{
CamelFolderInfo *fi;
CamelFolder *lf;
- CamelURL *url;
gchar *name, *path;
struct stat st;
- url = camel_service_get_camel_url (CAMEL_SERVICE (store));
-
name = camel_local_store_get_full_path (store, folder_name);
path = g_strdup_printf("%s.sbd", name);
@@ -740,7 +728,6 @@ mbox_store_delete_folder_sync (CamelStore *store,
fi = camel_folder_info_new ();
fi->full_name = g_strdup (folder_name);
fi->name = g_path_get_basename (folder_name);
- fi->uri = g_strdup_printf ("mbox:%s#%s", url->path, folder_name);
fi->unread = -1;
camel_store_folder_deleted (store, fi);
diff --git a/camel/providers/local/camel-mh-store.c b/camel/providers/local/camel-mh-store.c
index 6c33f7f..eda699f 100644
--- a/camel/providers/local/camel-mh-store.c
+++ b/camel/providers/local/camel-mh-store.c
@@ -194,7 +194,6 @@ fill_fi (CamelStore *store,
static CamelFolderInfo *
folder_info_new (CamelStore *store,
- CamelURL *url,
const gchar *root,
const gchar *path,
guint32 flags,
@@ -206,17 +205,12 @@ folder_info_new (CamelStore *store,
base = strrchr (path, '/');
- camel_url_set_fragment (url, path);
-
/* Build the folder info structure. */
fi = camel_folder_info_new ();
- fi->uri = camel_url_to_string (url, 0);
fi->full_name = g_strdup (path);
fi->name = g_strdup (base?base+1:path);
fill_fi (store, fi, flags, cancellable);
- d(printf("New folderinfo:\n '%s'\n '%s'\n '%s'\n", fi->full_name, fi->uri, fi->path));
-
return fi;
}
@@ -230,7 +224,6 @@ struct _inode {
* root and path should have a trailing "/" if they aren't empty. */
static void
recursive_scan (CamelStore *store,
- CamelURL *url,
CamelFolderInfo **fip,
CamelFolderInfo *parent,
GHashTable *visited,
@@ -268,7 +261,7 @@ recursive_scan (CamelStore *store,
g_hash_table_insert (visited, inew, inew);
/* link in ... */
- fi = folder_info_new (store, url, root, path, flags, cancellable);
+ fi = folder_info_new (store, root, path, flags, cancellable);
fi->parent = parent;
fi->next = *fip;
*fip = fi;
@@ -294,10 +287,10 @@ recursive_scan (CamelStore *store,
/* otherwise, treat at potential node, and recurse, a bit more expensive than needed, but tough! */
if (path[0]) {
tmp = g_strdup_printf("%s/%s", path, d->d_name);
- recursive_scan (store, url, &fi->child, fi, visited, root, tmp, flags, cancellable);
+ recursive_scan (store, &fi->child, fi, visited, root, tmp, flags, cancellable);
g_free (tmp);
} else {
- recursive_scan (store, url, &fi->child, fi, visited, root, d->d_name, flags, cancellable);
+ recursive_scan (store, &fi->child, fi, visited, root, d->d_name, flags, cancellable);
}
}
@@ -308,7 +301,6 @@ recursive_scan (CamelStore *store,
/* scan a .folders file */
static void
folders_scan (CamelStore *store,
- CamelURL *url,
const gchar *root,
const gchar *top,
CamelFolderInfo **fip,
@@ -377,7 +369,7 @@ folders_scan (CamelStore *store,
path = g_strdup_printf("%s/%s", root, line);
if (g_stat (path, &st) == 0 && S_ISDIR (st.st_mode)) {
- fi = folder_info_new (store, url, root, line, flags, cancellable);
+ fi = folder_info_new (store, root, line, flags, cancellable);
g_ptr_array_add (folders, fi);
}
g_free (path);
@@ -519,23 +511,22 @@ mh_store_get_folder_info_sync (CamelStore *store,
{
CamelFolderInfo *fi = NULL;
CamelURL *url;
- gchar *root;
url = camel_service_get_camel_url (CAMEL_SERVICE (store));
- root = url->path;
- url = camel_url_copy (url);
-
/* use .folders if we are supposed to */
if (((CamelMhStore *)store)->flags & CAMEL_MH_DOTFOLDERS) {
- folders_scan (store, url, root, top, &fi, flags, cancellable);
+ folders_scan (
+ store, url->path, top, &fi, flags, cancellable);
} else {
GHashTable *visited = g_hash_table_new (inode_hash, inode_equal);
if (top == NULL)
top = "";
- recursive_scan (store, url, &fi, NULL, visited, root, top, flags, cancellable);
+ recursive_scan (
+ store, &fi, NULL, visited, url->path,
+ top, flags, cancellable);
/* if we actually scanned from root, we have a "" root node we dont want */
if (fi != NULL && top[0] == 0) {
@@ -551,8 +542,6 @@ mh_store_get_folder_info_sync (CamelStore *store,
g_hash_table_destroy (visited);
}
- camel_url_free (url);
-
return fi;
}
diff --git a/camel/providers/local/camel-spool-store.c b/camel/providers/local/camel-spool-store.c
index 0675eb4..c1ccd7f 100644
--- a/camel/providers/local/camel-spool-store.c
+++ b/camel/providers/local/camel-spool-store.c
@@ -80,7 +80,6 @@ spool_new_fi (CamelStore *store,
{
CamelFolderInfo *fi;
const gchar *name;
- CamelURL *url;
name = strrchr (full, '/');
if (name)
@@ -89,11 +88,6 @@ spool_new_fi (CamelStore *store,
name = full;
fi = camel_folder_info_new ();
- url = camel_service_get_camel_url (CAMEL_SERVICE (store));
- url = camel_url_copy (url);
- camel_url_set_fragment (url, full);
- fi->uri = camel_url_to_string (url, 0);
- camel_url_free (url);
fi->full_name = g_strdup (full);
fi->name = g_strdup (name);
fi->unread = -1;
@@ -104,8 +98,6 @@ spool_new_fi (CamelStore *store,
fi->next = *fip;
*fip = fi;
- d(printf("Adding spoold info: '%s' '%s' '%s' '%s'\n", fi->path, fi->name, fi->full_name, fi->url));
-
return fi;
}
@@ -329,7 +321,6 @@ spool_store_free_folder_info (CamelStore *store,
CamelFolderInfo *fi)
{
if (fi) {
- g_free (fi->uri);
g_free (fi->name);
g_free (fi->full_name);
g_slice_free (CamelFolderInfo, fi);
@@ -480,12 +471,10 @@ spool_store_get_meta_path (CamelLocalStore *ls,
const gchar *ext)
{
CamelService *service;
- CamelSession *session;
const gchar *user_data_dir;
gchar *path, *key;
service = CAMEL_SERVICE (ls);
- session = camel_service_get_session (service);
user_data_dir = camel_service_get_user_data_dir (service);
key = camel_file_util_safe_filename (full_name);
diff --git a/camel/providers/nntp/camel-nntp-folder.c b/camel/providers/nntp/camel-nntp-folder.c
index 18823fa..07c44f3 100644
--- a/camel/providers/nntp/camel-nntp-folder.c
+++ b/camel/providers/nntp/camel-nntp-folder.c
@@ -656,13 +656,11 @@ camel_nntp_folder_new (CamelStore *parent,
CamelNNTPFolder *nntp_folder;
gchar *root;
CamelService *service;
- CamelSession *session;
CamelStoreInfo *si;
const gchar *user_data_dir;
gboolean subscribed = TRUE;
service = CAMEL_SERVICE (parent);
- session = camel_service_get_session (service);
user_data_dir = camel_service_get_user_data_dir (service);
folder = g_object_new (
diff --git a/camel/providers/nntp/camel-nntp-store.c b/camel/providers/nntp/camel-nntp-store.c
index b3741ed..12dc6f3 100644
--- a/camel/providers/nntp/camel-nntp-store.c
+++ b/camel/providers/nntp/camel-nntp-store.c
@@ -679,12 +679,7 @@ nntp_folder_info_from_store_info (CamelNNTPStore *store,
gboolean short_notation,
CamelStoreInfo *si)
{
- CamelURL *base_url;
CamelFolderInfo *fi;
- CamelURL *url;
- gchar *path;
-
- base_url = camel_service_get_camel_url (CAMEL_SERVICE (store));
fi = camel_folder_info_new ();
fi->full_name = g_strdup (si->path);
@@ -697,24 +692,16 @@ nntp_folder_info_from_store_info (CamelNNTPStore *store,
fi->unread = si->unread;
fi->total = si->total;
fi->flags = si->flags;
- path = alloca (strlen (fi->full_name)+2);
- sprintf(path, "/%s", fi->full_name);
- url = camel_url_new_with_base (base_url, path);
- fi->uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
- camel_url_free (url);
return fi;
}
static CamelFolderInfo *
-nntp_folder_info_from_name (CamelNNTPStore *store, gboolean short_notation, const gchar *name)
+nntp_folder_info_from_name (CamelNNTPStore *store,
+ gboolean short_notation,
+ const gchar *name)
{
- CamelURL *base_url;
CamelFolderInfo *fi;
- CamelURL *url;
- gchar *path;
-
- base_url = camel_service_get_camel_url (CAMEL_SERVICE (store));
fi = camel_folder_info_new ();
fi->full_name = g_strdup (name);
@@ -726,12 +713,6 @@ nntp_folder_info_from_name (CamelNNTPStore *store, gboolean short_notation, cons
fi->unread = -1;
- path = alloca (strlen (fi->full_name)+2);
- sprintf(path, "/%s", fi->full_name);
- url = camel_url_new_with_base (base_url, path);
- fi->uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
- camel_url_free (url);
-
return fi;
}
@@ -892,7 +873,10 @@ tree_insert (CamelFolderInfo *root, CamelFolderInfo *last, CamelFolderInfo *fi)
}
/* returns new root */
static CamelFolderInfo *
-nntp_push_to_hierarchy (CamelURL *base_url, CamelFolderInfo *root, CamelFolderInfo *pfi, GHashTable *known)
+nntp_push_to_hierarchy (CamelNNTPStore *store,
+ CamelFolderInfo *root,
+ CamelFolderInfo *pfi,
+ GHashTable *known)
{
CamelFolderInfo *fi, *last = NULL, *kfi;
gchar *name, *dot;
@@ -908,21 +892,15 @@ nntp_push_to_hierarchy (CamelURL *base_url, CamelFolderInfo *root, CamelFolderIn
kfi = g_hash_table_lookup (known, pfi->full_name);
if (!kfi) {
- gchar *path;
- CamelURL *url;
-
fi = camel_folder_info_new ();
fi->full_name = g_strdup (pfi->full_name);
fi->name = g_strdup (name);
fi->unread = 0;
fi->total = 0;
- fi->flags = CAMEL_FOLDER_NOSELECT | CAMEL_FOLDER_CHILDREN;
- path = alloca (strlen (fi->full_name) + 2);
- sprintf (path, "/%s", fi->full_name);
- url = camel_url_new_with_base (base_url, path);
- fi->uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
- camel_url_free (url);
+ fi->flags =
+ CAMEL_FOLDER_NOSELECT |
+ CAMEL_FOLDER_CHILDREN;
g_hash_table_insert (known, fi->full_name, fi);
root = tree_insert (root, last, fi);
@@ -957,14 +935,11 @@ nntp_store_get_cached_folder_info (CamelNNTPStore *store,
is_folder_list = flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIPTION_LIST;
CamelStoreInfo *si;
CamelFolderInfo *first = NULL, *last = NULL, *fi = NULL;
- CamelURL *url;
GHashTable *known; /* folder name to folder info */
gchar *tmpname;
gchar *top = g_strconcat(orig_top?orig_top:"", ".", NULL);
gint toplen = strlen (top);
- url = camel_service_get_camel_url (CAMEL_SERVICE (store));
-
known = g_hash_table_new (g_str_hash, g_str_equal);
for (i = 0; (si = camel_store_summary_index ((CamelStoreSummary *) store->summary, i)); i++) {
@@ -1013,7 +988,7 @@ nntp_store_get_cached_folder_info (CamelNNTPStore *store,
if (is_folder_list) {
/* create a folder hierarchy rather than a flat list */
- first = nntp_push_to_hierarchy (url, first, fi, known);
+ first = nntp_push_to_hierarchy (store, first, fi, known);
} else {
if (last)
last->next = fi;
@@ -1377,7 +1352,6 @@ nntp_store_initable_init (GInitable *initable,
{
CamelNNTPStore *nntp_store;
CamelService *service;
- CamelSession *session;
CamelURL *summary_url;
CamelURL *url;
const gchar *user_data_dir;
@@ -1391,7 +1365,6 @@ nntp_store_initable_init (GInitable *initable,
service = CAMEL_SERVICE (initable);
url = camel_service_get_camel_url (service);
- session = camel_service_get_session (service);
user_data_dir = camel_service_get_user_data_dir (service);
/* FIXME */
diff --git a/docs/reference/camel/tmpl/camel-store.sgml b/docs/reference/camel/tmpl/camel-store.sgml
index 09b90a8..ba13e75 100644
--- a/docs/reference/camel/tmpl/camel-store.sgml
+++ b/docs/reference/camel/tmpl/camel-store.sgml
@@ -134,7 +134,6 @@ CamelStore
@next:
@parent:
@child:
- uri:
@name:
@full_name:
@flags:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]