diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2003-12-04 07:11:40 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2003-12-04 07:11:40 +0800 |
commit | 0755131616388f21c5a55233464b1f12cf987abb (patch) | |
tree | e543ab8145d323284e989b95fa2dc0097a6e4548 /mail | |
parent | 1b74224c04782be274167b02711f7692e3b97904 (diff) | |
download | gsoc2013-evolution-0755131616388f21c5a55233464b1f12cf987abb.tar.gz gsoc2013-evolution-0755131616388f21c5a55233464b1f12cf987abb.tar.zst gsoc2013-evolution-0755131616388f21c5a55233464b1f12cf987abb.zip |
Updated to add use mail subdirs. (mail_config_uri_renamed): Updated
2003-12-03 Jeffrey Stedfast <fejj@ximian.com>
* mail-config.c (uri_to_evname): Updated to add use mail subdirs.
(mail_config_uri_renamed): Updated cachenames[]
(mail_config_folder_to_cachename): Fixed to use the correct path.
* em-folder-browser.c (emfb_create_view_menus): Updated the
galview path to point to the evo-1.5 location.
(emfb_set_folder): Update the galview view_instance.
(emfb_create_view_instance): Split out from emfb_create_view_menus()
(emfb_create_view_menus): Reduced code, call emfb_create_view_instance()
svn path=/trunk/; revision=23624
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 12 | ||||
-rw-r--r-- | mail/em-folder-browser.c | 194 | ||||
-rw-r--r-- | mail/mail-config.c | 22 |
3 files changed, 141 insertions, 87 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 2bfea6fdc7..f8233a7bd3 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,17 @@ 2003-12-03 Jeffrey Stedfast <fejj@ximian.com> + * mail-config.c (uri_to_evname): Updated to add use mail subdirs. + (mail_config_uri_renamed): Updated cachenames[] + (mail_config_folder_to_cachename): Fixed to use the correct path. + + * em-folder-browser.c (emfb_create_view_menus): Updated the + galview path to point to the evo-1.5 location. + (emfb_set_folder): Update the galview view_instance. + (emfb_create_view_instance): Split out from + emfb_create_view_menus() + (emfb_create_view_menus): Reduced code, call + emfb_create_view_instance(). + * em-folder-selector.c (emfs_create_name_activate): Emit the OK response, not the CREATE_NEW response. Also, g_signal_emit_by_name() does not take a GQuark detail argument, so diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c index 3a1bae2f16..313b2f61e4 100644 --- a/mail/em-folder-browser.c +++ b/mail/em-folder-browser.c @@ -129,6 +129,9 @@ static ESearchBarItem emfb_search_items[] = { { NULL, -1, NULL } }; +static GalViewCollection *collection = NULL; + + static EMFolderViewClass *emfb_parent; /* Needed since the paned wont take the position its given otherwise ... */ @@ -756,6 +759,112 @@ emfb_list_built(MessageList *ml, EMFolderBrowser *emfb) MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN, TRUE); } + +static void +emfb_list_display_view (GalViewInstance *instance, GalView *view, EMFolderBrowser *emfb) +{ + if (GAL_IS_VIEW_ETABLE (view)) + gal_view_etable_attach_tree (GAL_VIEW_ETABLE (view), emfb->view.list->tree); +} + +static void +collection_init (void) +{ + ETableSpecification *spec; + GalViewFactory *factory; + const char *evolution_dir; + char *dir; + + if (collection != NULL) + return; + + collection = gal_view_collection_new (); + + gal_view_collection_set_title (collection, _("Mail")); + + evolution_dir = mail_component_peek_base_directory (mail_component_peek ()); + dir = g_build_filename (evolution_dir, "mail", "views", NULL); + gal_view_collection_set_storage_directories (collection, EVOLUTION_GALVIEWSDIR "/mail/", dir); + g_free (dir); + + spec = e_table_specification_new (); + e_table_specification_load_from_file (spec, EVOLUTION_ETSPECDIR "/message-list.etspec"); + + factory = gal_view_factory_etable_new (spec); + g_object_unref (spec); + gal_view_collection_add_factory (collection, factory); + g_object_unref (factory); + + gal_view_collection_load (collection); +} + +static void +emfb_create_view_instance (EMFolderBrowser *emfb, CamelFolder *folder, const char *uri) +{ + struct _EMFolderBrowserPrivate *priv = emfb->priv; + gboolean outgoing; + char *id; + + collection_init (); + + if (priv->view_instance) { + g_object_unref (priv->view_instance); + priv->view_instance = NULL; + } + + if (folder == NULL) { + folder = emfb->view.folder; + uri = emfb->view.folder_uri; + } + + outgoing = em_utils_folder_is_drafts (folder, uri) + || em_utils_folder_is_sent (folder, uri) + || em_utils_folder_is_outbox (folder, uri); + + /* TODO: should this go through mail-config api? */ + id = mail_config_folder_to_safe_url (folder); + priv->view_instance = gal_view_instance_new (collection, id); + g_free (id); + + if (outgoing) + gal_view_instance_set_default_view (priv->view_instance, "As_Sent_Folder"); + + gal_view_instance_load (priv->view_instance); + + if (!gal_view_instance_exists (priv->view_instance)) { + struct stat st; + char *path; + + path = mail_config_folder_to_cachename (folder, "et-header-"); + if (path && stat (path, &st) == 0 && st.st_size > 0 && S_ISREG (st.st_mode)) { + ETableSpecification *spec; + ETableState *state; + GalView *view; + + spec = e_table_specification_new (); + e_table_specification_load_from_file (spec, EVOLUTION_ETSPECDIR "/message-list.etspec"); + view = gal_view_etable_new (spec, ""); + g_object_unref (spec); + + state = e_table_state_new (); + e_table_state_load_from_file (state, path); + gal_view_etable_set_state (GAL_VIEW_ETABLE (view), state); + g_object_unref (state); + + gal_view_instance_set_custom_view (priv->view_instance, view); + g_object_unref (view); + } + + g_free (path); + } + + if (priv->view_menus) + gal_view_menus_set_instance (priv->view_menus, priv->view_instance); + + g_signal_connect (priv->view_instance, "display_view", G_CALLBACK (emfb_list_display_view), emfb); + emfb_list_display_view (priv->view_instance, gal_view_instance_get_current_view (priv->view_instance), emfb); +} + static void emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) { @@ -764,10 +873,10 @@ emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) defaults */ if (folder) { char *sstate; - + if ((sstate = camel_object_meta_get(folder, "evolution:show_preview"))) em_folder_browser_show_preview((EMFolderBrowser *)emfv, sstate[0] != '0'); - + if ((sstate = camel_object_meta_get(folder, "evolution:thread_list"))) message_list_set_threaded(emfv->list, sstate[0] != '0'); @@ -776,8 +885,10 @@ emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) ((EMFolderBrowser *)emfv)->priv->list_built_id = g_signal_connect(emfv->list, "message_list_built", G_CALLBACK(emfb_list_built), emfv); #endif + + emfb_create_view_instance ((EMFolderBrowser *) emfv, folder, uri); } - + emfb_parent->set_folder(emfv, folder, uri); } @@ -785,88 +896,17 @@ emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) need to become BonoboUIComponent aware ... */ static void -emfb_list_display_view(GalViewInstance *instance, GalView *view, EMFolderBrowser *emfb) -{ - if (GAL_IS_VIEW_ETABLE(view)) - gal_view_etable_attach_tree(GAL_VIEW_ETABLE(view), emfb->view.list->tree); -} - -static void emfb_create_view_menus(EMFolderBrowser *emfb, BonoboUIComponent *uic) { struct _EMFolderBrowserPrivate *p = emfb->priv; - static GalViewCollection *collection = NULL; - char *id; - gboolean outgoing; g_assert(p->view_instance == NULL); g_assert(p->view_menus == NULL); - outgoing = em_utils_folder_is_drafts(emfb->view.folder, emfb->view.folder_uri) - || em_utils_folder_is_sent(emfb->view.folder, emfb->view.folder_uri) - || em_utils_folder_is_outbox(emfb->view.folder, emfb->view.folder_uri); - - if (collection == NULL) { - ETableSpecification *spec; - char *dir; - GalViewFactory *factory; - - collection = gal_view_collection_new(); - - gal_view_collection_set_title(collection, _("Mail")); - - dir = g_build_filename(g_get_home_dir(), "/evolution/views/mail/", NULL); - gal_view_collection_set_storage_directories(collection, EVOLUTION_GALVIEWSDIR "/mail/", dir); - g_free(dir); - - spec = e_table_specification_new(); - e_table_specification_load_from_file(spec, EVOLUTION_ETSPECDIR "/message-list.etspec"); - - factory = gal_view_factory_etable_new(spec); - g_object_unref(spec); - gal_view_collection_add_factory(collection, factory); - g_object_unref(factory); - - gal_view_collection_load(collection); - } - - /* TODO: should this go through mail-config api? */ - id = mail_config_folder_to_safe_url(emfb->view.folder); - p->view_instance = gal_view_instance_new(collection, id); - g_free(id); - - if (outgoing) - gal_view_instance_set_default_view(p->view_instance, "As_Sent_Folder"); - - if (!gal_view_instance_exists(p->view_instance)) { - char *path; - struct stat st; - - gal_view_instance_load(p->view_instance); - - path = mail_config_folder_to_cachename(emfb->view.folder, "et-header-"); - if (path && stat (path, &st) == 0 && st.st_size > 0 && S_ISREG (st.st_mode)) { - ETableSpecification *spec; - ETableState *state; - GalView *view; - - spec = e_table_specification_new(); - e_table_specification_load_from_file(spec, EVOLUTION_ETSPECDIR "/message-list.etspec"); - view = gal_view_etable_new(spec, ""); - g_object_unref(spec); - - state = e_table_state_new(); - e_table_state_load_from_file(state, path); - gal_view_etable_set_state(GAL_VIEW_ETABLE (view), state); - g_object_unref(state); - - gal_view_instance_set_custom_view(p->view_instance, view); - g_object_unref(view); - } - g_free(path); - } + collection_init (); - p->view_menus = gal_view_menus_new(p->view_instance); + emfb_create_view_instance (emfb, emfb->view.folder, emfb->view.folder_uri); + p->view_menus = gal_view_menus_new (p->view_instance); gal_view_menus_apply(p->view_menus, uic, NULL); /* Due to CORBA reentrancy, the view could be gone now. */ diff --git a/mail/mail-config.c b/mail/mail-config.c index a034c743da..6fa378e25b 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -942,14 +942,14 @@ uri_to_evname (const char *uri, const char *prefix) const char *base_directory = mail_component_peek_base_directory (mail_component_peek ()); char *safe; char *tmp; - + safe = g_strdup (uri); e_filename_make_safe (safe); /* blah, easiest thing to do */ if (prefix[0] == '*') - tmp = g_strdup_printf ("%s/%s%s.xml", base_directory, prefix + 1, safe); + tmp = g_strdup_printf ("%s/mail/%s%s.xml", base_directory, prefix + 1, safe); else - tmp = g_strdup_printf ("%s/%s%s", base_directory, prefix, safe); + tmp = g_strdup_printf ("%s/mail/%s%s", base_directory, prefix, safe); g_free (safe); return tmp; } @@ -964,8 +964,8 @@ mail_config_uri_renamed (GCompareFunc uri_cmp, const char *old, const char *new) char *cachenames[] = { "config/hidestate-", "config/et-expanded-", "config/et-header-", - "*views/mail/current_view-", - "*views/mail/custom_view-", + "*views/current_view-", + "*views/custom_view-", NULL }; iter = e_list_get_iterator ((EList *) config->accounts); @@ -1059,13 +1059,15 @@ mail_config_folder_to_safe_url (CamelFolder *folder) char * mail_config_folder_to_cachename (CamelFolder *folder, const char *prefix) { - char *url, *filename; + char *url, *basename, *filename; + const char *evolution_dir; + + evolution_dir = mail_component_peek_base_directory (mail_component_peek ()); url = mail_config_folder_to_safe_url (folder); - filename = g_strdup_printf ("%s/config/%s%s", - mail_component_peek_base_directory (mail_component_peek ()), - prefix, - url); + basename = g_strdup_printf ("%s%s", prefix, url); + filename = g_build_filename (evolution_dir, "mail", "config", basename, NULL); + g_free (basename); g_free (url); return filename; |