aboutsummaryrefslogtreecommitdiffstats
path: root/mail/folder-browser.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-07-01 04:05:47 +0800
committerDan Winship <danw@src.gnome.org>2000-07-01 04:05:47 +0800
commit6f95a96083dc0c00b18a612e2309a008b9cc0e21 (patch)
treee8eb7c3517da349a0bb655982d036c39bbc18818 /mail/folder-browser.c
parent39361c665a62e68991e51a9c13c2b2074a130ed4 (diff)
downloadgsoc2013-evolution-6f95a96083dc0c00b18a612e2309a008b9cc0e21.tar.gz
gsoc2013-evolution-6f95a96083dc0c00b18a612e2309a008b9cc0e21.tar.zst
gsoc2013-evolution-6f95a96083dc0c00b18a612e2309a008b9cc0e21.zip
New function, a wrapper around e_table_selected_row_foreach, which calls
* message-list.c (message_list_foreach): New function, a wrapper around e_table_selected_row_foreach, which calls the callback function with UIDs rather than row numbers. * folder-browser-factory.c: Remove never-used "Find" button from the toolbar and replace it with "Refile". (We need a better icon for this...). Hook up "Refile" to "refile_msg". * mail-ops.c (refile_msg): Call the shell's user_select_folder routine, and then use message_list_foreach and real_refile_msg to do the work. (delete_msg): Update to use message_list_foreach. * folder-browser.c (mail_uri_to_folder): new function, extracted from folder_browser_load_folder, to turn a URI into a folder. (folder_browser_load_folder): Use it. svn path=/trunk/; revision=3833
Diffstat (limited to 'mail/folder-browser.c')
-rw-r--r--mail/folder-browser.c65
1 files changed, 34 insertions, 31 deletions
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index 61378cd0c2..be56b78b56 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -54,12 +54,12 @@ folder_browser_class_init (GtkObjectClass *object_class)
folder_browser_parent_class = gtk_type_class (PARENT_TYPE);
}
-static gboolean
-folder_browser_load_folder (FolderBrowser *fb, const char *name)
+CamelFolder *
+mail_uri_to_folder (const char *name)
{
char *store_name, *msg;
CamelStore *store;
- CamelFolder *new_folder = NULL;
+ CamelFolder *folder = NULL;
CamelException *ex;
ex = camel_exception_new ();
@@ -77,24 +77,18 @@ folder_browser_load_folder (FolderBrowser *fb, const char *name)
store = camel_session_get_store (session, store_name, ex);
if (store) {
- new_folder = camel_store_get_folder (store, newquery, TRUE, ex);
+ folder = camel_store_get_folder (store, newquery, TRUE, ex);
/* FIXME: do this properly rather than hardcoding */
#warning "Find a way not to hardcode vfolder source"
{
- CamelStore *st;
- char *stname;
CamelFolder *source_folder;
extern char *evolution_dir;
- stname = g_strdup_printf("mbox://%s/local/Inbox", evolution_dir);
- st = camel_session_get_store (session, stname, ex);
- g_free (stname);
- if (st) {
- source_folder = camel_store_get_folder (st, "mbox", FALSE, ex);
- if (source_folder) {
- camel_vee_folder_add_folder (new_folder, source_folder);
- }
- }
+ name = g_strdup_printf ("mbox://%s/local/Inbox", evolution_dir);
+ source_folder = mail_uri_to_folder (name);
+ g_free (name);
+ if (source_folder)
+ camel_vee_folder_add_folder (folder, source_folder);
}
}
g_free (newquery);
@@ -131,7 +125,7 @@ folder_browser_load_folder (FolderBrowser *fb, const char *name)
folder_name = g_strdup (ptr);
fprintf (stderr, "getting folder: %s\n", folder_name);
- new_folder = camel_store_get_folder (store, folder_name, TRUE, ex);
+ folder = camel_store_get_folder (store, folder_name, TRUE, ex);
g_free (folder_name);
}
}
@@ -142,7 +136,7 @@ folder_browser_load_folder (FolderBrowser *fb, const char *name)
folder_name = name + 5;
- new_folder = camel_store_get_folder (store, folder_name, FALSE, ex);
+ folder = camel_store_get_folder (store, folder_name, FALSE, ex);
}
} else if (!strncmp (name, "file:", 5)) {
/* Change "file:" to "mbox:". */
@@ -150,36 +144,45 @@ folder_browser_load_folder (FolderBrowser *fb, const char *name)
store = camel_session_get_store (session, store_name, ex);
g_free (store_name);
if (store) {
- new_folder = camel_store_get_folder (store, "mbox", FALSE, ex);
+ folder = camel_store_get_folder (store, "mbox", FALSE, ex);
}
} else {
- char *msg;
-
msg = g_strdup_printf ("Can't open URI %s", name);
gnome_error_dialog (msg);
g_free (msg);
- camel_exception_free (ex);
- return FALSE;
}
-
- if (store)
- gtk_object_unref (GTK_OBJECT (store));
if (camel_exception_get_id (ex)) {
msg = g_strdup_printf ("Unable to get folder %s: %s\n", name,
camel_exception_get_description (ex));
gnome_error_dialog (msg);
camel_exception_free (ex);
- if (new_folder)
- gtk_object_unref(GTK_OBJECT (new_folder));
- return FALSE;
+ if (folder) {
+ gtk_object_unref (GTK_OBJECT (folder));
+ folder = NULL;
+ }
}
-
+ camel_exception_free (ex);
+
+ if (store)
+ gtk_object_unref (GTK_OBJECT (store));
+
+ return folder;
+}
+
+static gboolean
+folder_browser_load_folder (FolderBrowser *fb, const char *name)
+{
+ CamelFolder *new_folder;
+
+ new_folder = mail_uri_to_folder (name);
+ if (!new_folder)
+ return FALSE;
+
if (fb->folder)
gtk_object_unref (GTK_OBJECT (fb->folder));
-
fb->folder = new_folder;
-
+
message_list_set_folder (fb->message_list, new_folder);
return TRUE;