diff options
author | Jeffrey Stedfast <fejj@helixcode.com> | 2000-06-19 10:55:09 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2000-06-19 10:55:09 +0800 |
commit | 11c0b04807eda9a49359c8de9ab811c8942c2017 (patch) | |
tree | 7367891a5c3dc5cf5d020cc97602364dc1d7463d | |
parent | e02ffba8e0f08677cd8cf91c5f163facddf45c2d (diff) | |
download | gsoc2013-evolution-11c0b04807eda9a49359c8de9ab811c8942c2017.tar.gz gsoc2013-evolution-11c0b04807eda9a49359c8de9ab811c8942c2017.tar.zst gsoc2013-evolution-11c0b04807eda9a49359c8de9ab811c8942c2017.zip |
started to add code to load an IMAP folder.
2000-06-18 Jeffrey Stedfast <fejj@helixcode.com>
* folder-browser.c (folder_browser_load_folder): started to add
code to load an IMAP folder.
* component-factory.c: Started to add a create_imap_storage
method so that we can eventually have our IMAP store displayed
in the tree view.
(create_vfolder_storage): Renamed from
create_test_storage().
(owner_set_cb): Updated.
svn path=/trunk/; revision=3627
-rw-r--r-- | mail/ChangeLog | 12 | ||||
-rw-r--r-- | mail/component-factory.c | 54 | ||||
-rw-r--r-- | mail/folder-browser.c | 14 |
3 files changed, 62 insertions, 18 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 9d87b56f9d..3ff6199364 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,15 @@ +2000-06-18 Jeffrey Stedfast <fejj@helixcode.com> + + * folder-browser.c (folder_browser_load_folder): started to add + code to load an IMAP folder. + + * component-factory.c: Started to add a create_imap_storage + method so that we can eventually have our IMAP store displayed + in the tree view. + (create_vfolder_storage): Renamed from + create_test_storage(). + (owner_set_cb): Updated. + 2000-06-17 Dan Winship <danw@helixcode.com> * message-list.c (message_list_set_folder): Prevent double-freeing diff --git a/mail/component-factory.c b/mail/component-factory.c index 0dc2700f3e..30658a3596 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -38,9 +38,9 @@ #include "filter/filter-driver.h" #include "component-factory.h" -static void create_test_storage (EvolutionShellComponent *shell_component); +static void create_vfolder_storage (EvolutionShellComponent *shell_component); +/*static void create_imap_storage (EvolutionShellComponent *shell_component);*/ - #ifdef USING_OAF #define COMPONENT_FACTORY_ID "OAFIID:evolution-shell-component-factory:evolution-mail:0ea887d5-622b-4b8c-b525-18aa1cbe18a6" #else @@ -56,7 +56,6 @@ static const EvolutionShellComponentFolderType folder_types[] = { static GList *browsers; - /* EvolutionShellComponent methods and signals. */ static EvolutionShellComponentResult @@ -84,8 +83,8 @@ create_view (EvolutionShellComponent *shell_component, browsers = g_list_prepend (browsers, folder_browser_widget); /* dum de dum, hack to let the folder browser know the storage its in */ - gtk_object_set_data((GtkObject *)folder_browser_widget, "e-storage", - gtk_object_get_data((GtkObject *)shell_component, "e-storage")); + gtk_object_set_data(GTK_OBJECT (folder_browser_widget), "e-storage", + gtk_object_get_data(GTK_OBJECT (shell_component), "e-storage")); *control_return = control; @@ -119,7 +118,7 @@ owner_set_cb (EvolutionShellComponent *shell_component, { g_print ("evolution-mail: Yeeeh! We have an owner!\n"); /* FIXME */ - create_test_storage (shell_component); + create_vfolder_storage (shell_component); } static void @@ -139,12 +138,10 @@ owner_unset_cb (EvolutionShellComponent *shell_component, gpointer user_data) gtk_main_quit (); } - /* The factory function. */ static BonoboObject * -factory_fn (BonoboGenericFactory *factory, - void *closure) +factory_fn (BonoboGenericFactory *factory, void *closure) { EvolutionShellComponent *shell_component; @@ -162,7 +159,6 @@ factory_fn (BonoboGenericFactory *factory, return BONOBO_OBJECT (shell_component); } - void component_factory_init (void) { @@ -179,7 +175,7 @@ component_factory_init (void) } static void -create_test_storage (EvolutionShellComponent *shell_component) +create_vfolder_storage (EvolutionShellComponent *shell_component) { Evolution_Shell corba_shell; EvolutionStorage *storage; @@ -191,14 +187,13 @@ create_test_storage (EvolutionShellComponent *shell_component) } storage = evolution_storage_new ("VFolders"); - if (evolution_storage_register_on_shell (storage, corba_shell) - != EVOLUTION_STORAGE_OK) { + if (evolution_storage_register_on_shell (storage, corba_shell) != EVOLUTION_STORAGE_OK) { g_warning ("Cannot register storage"); return; } /* save the storage for later */ - gtk_object_set_data((GtkObject *)shell_component, "e-storage", storage); + gtk_object_set_data(GTK_OBJECT (shell_component), "e-storage", storage); /* this is totally not the way we want to do this - but the filter stuff needs work before we can remove it */ @@ -216,7 +211,7 @@ create_test_storage (EvolutionShellComponent *shell_component) g_free(system); count = filter_driver_rule_count(fe); - for (i=0;i<count;i++) { + for (i = 0; i < count; i++) { struct filter_option *fo; GString *query; struct filter_desc *desc = NULL; @@ -232,7 +227,7 @@ create_test_storage (EvolutionShellComponent *shell_component) if (desc) desctext = desc->data; else { - sprintf(descunknown, "volder-%p", fo); + sprintf(descunknown, "vfolder-%p", fo); desctext = descunknown; } g_string_sprintf(query, "vfolder:%s/vfolder/%s?", evolution_dir, desctext); @@ -246,7 +241,32 @@ create_test_storage (EvolutionShellComponent *shell_component) g_string_free(query, TRUE); g_free(name); } - gtk_object_unref((GtkObject *)fe); + gtk_object_unref(GTK_OBJECT (fe)); } } +#if 0 +static void +create_imap_storage (EvolutionShellComponent *shell_component) +{ + Evolution_Shell corba_shell; + EvolutionStorage *storage; + + corba_shell = evolution_shell_component_get_owner (shell_component); + if (corba_shell == CORBA_OBJECT_NIL) { + g_warning ("We have no shell!?"); + return; + } + + storage = evolution_storage_new ("IMAP Folders"); + if (evolution_storage_register_on_shell (storage, corba_shell) != EVOLUTION_STORAGE_OK) { + g_warning ("Cannot register storage"); + return; + } + + /* save the storage for later */ + gtk_object_set_data(GTK_OBJECT (shell_component), "e-storage", storage); + + evolution_storage_new_folder (storage, "name", "mail", "some string or other", "description"); +} +#endif diff --git a/mail/folder-browser.c b/mail/folder-browser.c index 78397a9138..3a94659423 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -100,6 +100,16 @@ folder_browser_load_folder (FolderBrowser *fb, const char *name) g_free(newquery); g_free(store_name); + } else if (!strncmp(name, "imap:", 5)) { + /* uhm, I'm just guessing here - this code might be wrong */ + fprintf(stderr, "\n*** name = %s ***\n\n", name); + store = camel_session_get_store (session, name, ex); + if (store) { + char *folder_name; + + folder_name = name += 5; + new_folder = camel_store_get_folder (store, folder_name, TRUE, ex); + } } else if (!strncmp(name, "file:", 5)) { /* Change "file:" to "mbox:". */ store_name = g_strdup_printf ("mbox:%s", name + 5); @@ -127,7 +137,7 @@ folder_browser_load_folder (FolderBrowser *fb, const char *name) gnome_error_dialog (msg); camel_exception_free (ex); if (new_folder) - gtk_object_unref((GtkObject *)new_folder); + gtk_object_unref(GTK_OBJECT (new_folder)); return FALSE; } @@ -395,3 +405,5 @@ folder_browser_new (void) E_MAKE_TYPE (folder_browser, "FolderBrowser", FolderBrowser, folder_browser_class_init, folder_browser_init, PARENT_TYPE); + + |