diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2003-12-04 01:50:59 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2003-12-04 01:50:59 +0800 |
commit | d7aa831cc419feea80fab7d74449eb709f86c88a (patch) | |
tree | d184b3afbc92c87af2cd4681c9acc302ad89ebc2 /mail | |
parent | 313275af7dd939c72e42e38fe4b75f1daf903f55 (diff) | |
download | gsoc2013-evolution-d7aa831cc419feea80fab7d74449eb709f86c88a.tar gsoc2013-evolution-d7aa831cc419feea80fab7d74449eb709f86c88a.tar.gz gsoc2013-evolution-d7aa831cc419feea80fab7d74449eb709f86c88a.tar.bz2 gsoc2013-evolution-d7aa831cc419feea80fab7d74449eb709f86c88a.tar.lz gsoc2013-evolution-d7aa831cc419feea80fab7d74449eb709f86c88a.tar.xz gsoc2013-evolution-d7aa831cc419feea80fab7d74449eb709f86c88a.tar.zst gsoc2013-evolution-d7aa831cc419feea80fab7d74449eb709f86c88a.zip |
Need to prepend a "/" to path if the path is the url fragment. Also fixed
2003-12-03 Jeffrey Stedfast <fejj@ximian.com>
* em-folder-tree.c (em_folder_tree_set_selected): Need to prepend
a "/" to path if the path is the url fragment. Also fixed to
select the store node if path == "/".
svn path=/trunk/; revision=23611
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 6 | ||||
-rw-r--r-- | mail/em-folder-selector.c | 10 | ||||
-rw-r--r-- | mail/em-folder-tree.c | 36 |
3 files changed, 36 insertions, 16 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 9181f562e4..b98feb30c7 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,8 +1,14 @@ 2003-12-03 Jeffrey Stedfast <fejj@ximian.com> + * em-folder-tree.c (em_folder_tree_set_selected): Need to prepend + a "/" to path if the path is the url fragment. Also fixed to + select the store node if path == "/". + * em-folder-selector.c (em_folder_selector_get_selected_uri): Fixed a FIXME by using the CamelProvider url flags to determine if the url used url->fragment or url->path as the folder path. + (em_folder_selector_get_selected_path): Don't allow path strings + to start with "//". 2003-12-03 JP Rosevear <jpr@ximian.com> diff --git a/mail/em-folder-selector.c b/mail/em-folder-selector.c index dea2603e2f..c502ac9a8d 100644 --- a/mail/em-folder-selector.c +++ b/mail/em-folder-selector.c @@ -332,10 +332,16 @@ em_folder_selector_get_selected_path (EMFolderSelector *emfs) } if (path && emfs->name_entry) { + const char *name; char *newpath; - path = newpath = g_strdup_printf ("%s/%s", path, gtk_entry_get_text (emfs->name_entry)); - emfs->selected_path = newpath; + name = gtk_entry_get_text (emfs->name_entry); + if (strcmp (path, "/") != 0) + newpath = g_strdup_printf ("%s/%s", path, name); + else + newpath = g_strdup_printf ("/%s", name); + + path = emfs->selected_path = newpath; } return path; diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 8665e5bcf9..b8d05071e9 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -1043,7 +1043,7 @@ emft_popup_new_folder_response (EMFolderSelector *emfs, int response, EMFolderTr parent = namebuf; } - d(printf ("creating folder name='%s' path='%s'\n", name, path)); + d(printf ("creating folder parent='%s' name='%s' path='%s'\n", parent, name, path)); camel_store_create_folder (si->store, parent, name, &ex); if (camel_exception_is_set (&ex)) { @@ -1562,11 +1562,12 @@ em_folder_tree_set_selected (EMFolderTree *emft, const char *uri) struct _EMFolderTreeModelStoreInfo *si; struct _EMFolderTreeGetFolderInfo *m; struct _EMFolderTreePrivate *priv; + GtkTreeRowReference *row = NULL; GtkTreeSelection *selection; - GtkTreeRowReference *row; GtkTreePath *tree_path; CamelStore *store; CamelException ex; + const char *top; char *path, *p; CamelURL *url; @@ -1590,20 +1591,30 @@ em_folder_tree_set_selected (EMFolderTree *emft, const char *uri) return; } - path = url->fragment ? url->fragment : url->path; - if ((row = g_hash_table_lookup (si->path_hash, path))) { + if (((CamelService *) store)->provider->url_flags & CAMEL_URL_FRAGMENT_IS_PATH) + path = g_strdup_printf ("/%s", url->fragment ? url->fragment : ""); + else + path = g_strdup (url->path ? url->path : "/"); + + top = path[0] == '/' ? path + 1 : path; + camel_url_free (url); + + if (!strcmp (path, "/")) + row = si->row; + + if (row || (row = g_hash_table_lookup (si->path_hash, path))) { /* the folder-info node has already been loaded */ - selection = gtk_tree_view_get_selection (priv->treeview); tree_path = gtk_tree_row_reference_get_path (row); gtk_tree_view_expand_to_path (priv->treeview, tree_path); + selection = gtk_tree_view_get_selection (priv->treeview); gtk_tree_selection_select_path (selection, tree_path); gtk_tree_path_free (tree_path); camel_object_unref (store); - camel_url_free (url); + g_free (path); return; } - /* look for the first of our parent folders that has already been loaeed */ + /* look for the first of our parent folders that has already been loaded */ p = path + strlen (path); while (p > path) { if (*p == '/') { @@ -1619,10 +1630,7 @@ em_folder_tree_set_selected (EMFolderTree *emft, const char *uri) if (row == NULL) { /* none of the folders of the desired store have been loaded yet */ row = si->row; - path = NULL; - } else { - if (path[0] == '/') - path++; + top = NULL; } /* FIXME: this gets all the subfolders of our first loaded @@ -1632,13 +1640,13 @@ em_folder_tree_set_selected (EMFolderTree *emft, const char *uri) m->root = gtk_tree_row_reference_copy (row); m->store = store; m->emft = emft; - m->top = path ? g_strdup (path) : NULL; + m->top = top ? g_strdup (top) : NULL; m->flags = CAMEL_STORE_FOLDER_INFO_RECURSIVE; m->select_uri = g_strdup (uri); - e_thread_put (mail_thread_new, (EMsg *) m); + g_free (path); - camel_url_free (url); + e_thread_put (mail_thread_new, (EMsg *) m); } |