Mercurial > gftp.yaz
diff src/gtk/bookmarks.c @ 613:45a015044483
2004-11-4 Brian Masney <masneyb@gftp.org>
* src/gtk/bookmarks.c (entry_apply_changes) - more cleanups to this
function. Fixes for renaming bookmark entries
author | masneyb |
---|---|
date | Fri, 05 Nov 2004 02:11:59 +0000 |
parents | 08e7b5186eb8 |
children | af9ecca3568e |
line wrap: on
line diff
--- a/src/gtk/bookmarks.c Fri Nov 05 02:05:22 2004 +0000 +++ b/src/gtk/bookmarks.c Fri Nov 05 02:11:59 2004 +0000 @@ -670,7 +670,7 @@ static void entry_apply_changes (GtkWidget * widget, gftp_bookmarks_var * entry) { - gftp_bookmarks_var * tempentry, * nextentry; + gftp_bookmarks_var * tempentry, * nextentry, * bmentry; char *pos, *newpath, tempchar, *tempstr; GtkWidget * tempwid; size_t oldpathlen; @@ -681,15 +681,17 @@ *pos = ' '; oldpathlen = strlen (entry->path); - if ((pos = strrchr (entry->path, '/')) == NULL) - pos = entry->path; - - tempchar = *pos; - *pos = '\0'; - newpath = gftp_build_path (NULL, entry->path, tempstr, NULL); - *pos = tempchar; - - g_free (tempstr); + if ((pos = strrchr (entry->path, '/')) != NULL) + { + pos = entry->path; + tempchar = *pos; + *pos = '\0'; + newpath = gftp_build_path (NULL, entry->path, tempstr, NULL); + *pos = tempchar; + g_free (tempstr); + } + else + newpath = tempstr; str = gtk_entry_get_text (GTK_ENTRY (bm_hostedit)); if (entry->hostname != NULL) @@ -745,12 +747,15 @@ tempentry = entry; nextentry = entry->next; entry->next = NULL; + while (tempentry != NULL) { g_hash_table_remove (new_bookmarks_htable, tempentry->path); - if (tempentry->oldpath == NULL) - tempentry->oldpath = tempentry->path; + bmentry = g_hash_table_lookup (gftp_bookmarks_htable, + tempentry->path); + if (bmentry->oldpath == NULL) + bmentry->oldpath = tempentry->path; else g_free (tempentry->path); @@ -763,16 +768,20 @@ g_hash_table_insert (new_bookmarks_htable, tempentry->path, tempentry); + + gtk_ctree_node_set_text (GTK_CTREE (tree), tempentry->cnode, 0, + tempentry->path); + if (tempentry->children != NULL) - { - tempentry = tempentry->children; - continue; - } - while (tempentry->next == NULL && tempentry != entry && - tempentry->prev != NULL) - tempentry = tempentry->prev; + tempentry = tempentry->children; + else + { + while (tempentry->next == NULL && tempentry != entry && + tempentry->prev != NULL) + tempentry = tempentry->prev; - tempentry = tempentry->next; + tempentry = tempentry->next; + } } entry->next = nextentry;