diff options
author | Dan Winship <danw@src.gnome.org> | 2000-05-07 11:15:22 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2000-05-07 11:15:22 +0800 |
commit | 58837630600292086b88a1994328d2908bc29b4d (patch) | |
tree | caf51be65989d6ff74777b739f0002a78452b095 /mail/folder-browser.c | |
parent | fcaa6565ec3885f3e2b537d2a0c5aa449378d1fb (diff) | |
download | gsoc2013-evolution-58837630600292086b88a1994328d2908bc29b4d.tar.gz gsoc2013-evolution-58837630600292086b88a1994328d2908bc29b4d.tar.zst gsoc2013-evolution-58837630600292086b88a1994328d2908bc29b4d.zip |
Don't hardcode "inbox" here.
* folder-browser-factory.c (folder_browser_factory): Don't
hardcode "inbox" here.
* folder-browser.c (folder_browser_set_uri): Don't hardcode
"inbox" here either.
(folder_browser_load_folder): Create a new store according to the
folder browser's URI, and load the mbox file from that store.
Parts of this are temporary.
* session.c, mail.h: There is no longer a global store, just a
global session.
* mail-config.c, mail-ops.c: Update for default_session -> session
change. fetch_mail is currently broken.
svn path=/trunk/; revision=2853
Diffstat (limited to 'mail/folder-browser.c')
-rw-r--r-- | mail/folder-browser.c | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/mail/folder-browser.c b/mail/folder-browser.c index 625a006d50..424523e212 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -64,28 +64,39 @@ folder_browser_class_init (GtkObjectClass *object_class) static gboolean folder_browser_load_folder (FolderBrowser *fb, const char *name) { + char *store_name; + CamelStore *store; CamelFolder *new_folder; - CamelException ex; + CamelException *ex; gboolean new_folder_exists = FALSE; - - camel_exception_init (&ex); - new_folder = camel_store_get_folder (default_session->store, name, &ex); + /* Change "file:" to "mbox:". FIXME :) */ + store_name = g_strdup_printf ("mbox%s", strchr (name, ':')); + + ex = camel_exception_new (); + store = camel_session_get_store (session, store_name, ex); + g_free (store_name); + if (store) { + new_folder = camel_store_get_folder (store, "mbox", ex); + gtk_object_unref (GTK_OBJECT (store)); + } - if (camel_exception_get_id (&ex)){ - printf ("Unable to get folder %s : %s\n", - name, - ex.desc?ex.desc:"unknown reason"); + if (camel_exception_get_id (ex)) { + printf ("Unable to get folder %s: %s\n", name, + camel_exception_get_description (ex)); + camel_exception_free (ex); return FALSE; } - /* if the folder does not exist, we don't want to show it */ - new_folder_exists = camel_folder_exists (new_folder, &ex); - if (camel_exception_get_id (&ex)) { - printf ("Unable to test for folder existence: %s\n", - ex.desc?ex.desc:"unknown reason"); - return FALSE; + /* If the folder does not exist, we don't want to show it */ + new_folder_exists = camel_folder_exists (new_folder, ex); + if (camel_exception_get_id (ex)) { + printf ("Unable to test for folder existence: %s\n", + camel_exception_get_description (ex)); + camel_exception_free (ex); + return FALSE; } + camel_exception_free (ex); if (!new_folder_exists) { gtk_object_unref (GTK_OBJECT (new_folder)); @@ -108,14 +119,11 @@ folder_browser_load_folder (FolderBrowser *fb, const char *name) void folder_browser_set_uri (FolderBrowser *folder_browser, const char *uri) { - /* FIXME: hardcoded uri */ - if (!folder_browser_load_folder (folder_browser, "inbox")) - return; - if (folder_browser->uri) g_free (folder_browser->uri); folder_browser->uri = g_strdup (uri); + folder_browser_load_folder (folder_browser, folder_browser->uri); } void |