After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 584931 - Old directory name doesn't disappear from dir list if renaming
Old directory name doesn't disappear from dir list if renaming
Status: RESOLVED FIXED
Product: gthumb
Classification: Other
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Paolo Bacchilega
Paolo Bacchilega
Depends on:
Blocks: 525482
 
 
Reported: 2009-06-05 14:56 UTC by Paolo Benvenuto
Modified: 2009-06-15 23:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GIO Fix Bug: 584931 Old directory name doesn't disappear from dir list if renaming (12.45 KB, patch)
2009-06-09 23:16 UTC, Marlodavampire
none Details | Review
GIO Fix Bug: 584931 Old directory name doesn't disappear from dir list if renaming (12.62 KB, patch)
2009-06-10 06:15 UTC, Marlodavampire
needs-work Details | Review
GIO Fix Bug: 584931 Old directory name doesn't disappear from dir list if renaming (11.94 KB, patch)
2009-06-10 18:18 UTC, Marlodavampire
needs-work Details | Review
GIO Fix Bug: 584931 Old directory name doesn't disappear from dir list if renaming (21.89 KB, patch)
2009-06-11 18:11 UTC, Marlodavampire
none Details | Review
GIO Fix Bug: 584931 Old directory name doesn't disappear from dir list if renaming (21.86 KB, patch)
2009-06-13 10:31 UTC, Marlodavampire
needs-work Details | Review
GIO Fix Bug: 584931 Old directory name doesn't disappear from dir list if renaming (23.66 KB, patch)
2009-06-15 16:42 UTC, Marlodavampire
committed Details | Review

Description Paolo Benvenuto 2009-06-05 14:56:00 UTC
If you rename a directory in the folders pane, after renaming it you still see the old directory name in the directories list.

The new name is presented at the beginning of the list, and not where it should be presented.
Comment 1 Marlodavampire 2009-06-09 23:16:55 UTC
Created attachment 136236 [details] [review]
GIO Fix Bug: 584931 Old directory name doesn't disappear from dir list if renaming

Add gfile_get_basename_for_uri to gfile-utils
Update gth-monitor to use full URIs
Update gth-browser-action-callbacks to send full URIs to the directory callbacks
Update gth-browser to use URIs for directory callbacks
Update gth-dir-list to use the new gfile_get_basename_for_uri
Remove and readd .. item in gth_dir_list_add_directory to keep dir_list->list ordering correct
Fix using new_path after g_free in folder_rename
Comment 2 Marlodavampire 2009-06-10 06:15:13 UTC
Created attachment 136251 [details] [review]
GIO Fix Bug: 584931 Old directory name doesn't disappear from dir list if renaming
Comment 3 Michael Chudobiak 2009-06-10 10:04:00 UTC
Could you check the formatting of your patches? It looks like some of your tabs are only 4 spaces, not 8. Click on the attachment link above and you can see how the indentation is messed up everywhere. It needs to be fixed.

- Mike
Comment 4 Marlodavampire 2009-06-10 18:18:43 UTC
Created attachment 136288 [details] [review]
GIO Fix Bug: 584931 Old directory name doesn't disappear from dir list if renaming

Odd, not sure why my settings changed.
Comment 5 Michael Chudobiak 2009-06-10 19:12:49 UTC
The patch seems to have problems. If I create a new folder (Ctrl+Shift+N), it is not inserted in the correct location. I have to press Ctrl+R to refresh the list properly.

Also, don't do this:

-	char *uri = g_file_get_parse_name (gfile);
+	char *uri;
+	uri = g_file_get_uri (gfile);
 	add_monitor_event (monitor, event_type, uri, priv->monitor_events);

At the moment, all file lists use the parse name (also called the utf8_path in FileData), and NOT the URI. Don't mix them! They are different.

I will be changing the monitor code to accept gfile arguments, instead of parse names or URIs, soon, which will eliminate this confusion.


- Mike
Comment 6 Marlodavampire 2009-06-11 11:38:27 UTC
Yes, all the problems left with this bug are related to URIs vs parse names I think. I'm going to change gth-dir-list to store GFiles for the directory list so it will be easy to access both formats. GFiles will help later for Bug 328509 – folders tree view too.
Comment 7 Michael Chudobiak 2009-06-11 11:53:22 UTC
Ideally, ALL path_lists and file_lists should be replaced with gfile_lists, and we should be using functions like g_file_equal (instead of same_uri) and gfile_list_free (instead of path_list_free).

In cases where we really need a list of FileDatas, we can be a gfile_list and use file_data_new_from_gfile.

fd->utf8_path should only be used for display applications, and nothing else. However, it can also be replaced with g_file_get_parse_name (gfile).

URIs should never be handled directly, except in some thumbnail-related code.

- Mike
Comment 8 Marlodavampire 2009-06-11 18:11:28 UTC
Created attachment 136345 [details] [review]
GIO Fix Bug: 584931 Old directory name doesn't disappear from dir list if renaming

Update gth-dir-list to use GFile for the directory list
Remove .. items from the gth-dir-list dir_list->list and only have it in the gtk_list_store
Add gth_sort_by_gfile to gth-sort-utils
Add gfile_get_basename_for_uri to gfile-utils
Update gth-browser and gth-browser-actions-callbacks to pass GFiles to gth-dir-list add_dir and remove_dir functions
Fix using new_path after g_free in folder_rename (gth-browser-actions-callbacks)
Comment 9 Michael Chudobiak 2009-06-12 00:40:08 UTC
+int gth_sort_by_gfile (GFile *file1,
+		       GFile *file2)
+{
+	char *path1, *path2;
+	int result;
+	path1 = g_file_get_parse_name(file1);
+	path2 = g_file_get_parse_name(file2);
+	result = gth_sort_by_filename(path1, path2, FALSE);
+	if(path1 && path2) {
+		g_free(path1);
+		g_free(path2);
+	}
+	return result;
+}

What's the "if" statement for?

- Mike
Comment 10 Marlodavampire 2009-06-12 14:22:08 UTC
Absolutely nothing. Feel free to remove it or wait until I'm on my development machine and I'll remove it and resubmit the patch.
Comment 11 Marlodavampire 2009-06-13 10:31:39 UTC
Created attachment 136495 [details] [review]
GIO Fix Bug: 584931 Old directory name doesn't disappear from dir list if renaming

Update gth-dir-list to use GFile for the directory list
Remove .. items from the gth-dir-list dir_list->list and only have it in the gtk_list_store
Add gth_sort_by_gfile to gth-sort-utils
Add gfile_get_basename_for_uri to gfile-utils
Update gth-browser and gth-browser-actions-callbacks to pass GFiles to gth-dir-list add_dir and remove_dir functions
Fix using new_path after g_free in folder_rename (gth-browser-actions-callbacks)
Comment 12 Michael Chudobiak 2009-06-15 13:24:36 UTC
[mjc@xena gthumb]$ make > eraseme
gth-browser-actions-callbacks.c: In function ‘edit_current_folder_tags__done’:
gth-browser-actions-callbacks.c:1406: warning: passing argument 2 of ‘gth_dir_list_remove_directory’ from incompatible pointer type
gth-dir-list.h:82: note: expected ‘struct GFile *’ but argument is of type ‘const char *’
gth-browser-actions-callbacks.c:1407: warning: passing argument 2 of ‘gth_dir_list_add_directory’ from incompatible pointer type
gth-dir-list.h:80: note: expected ‘struct GFile *’ but argument is of type ‘const char *’
Comment 13 Marlodavampire 2009-06-15 16:42:35 UTC
Created attachment 136645 [details] [review]
GIO Fix Bug: 584931 Old directory name doesn't disappear from dir list if  renaming

Update gth-dir-list to use GFile for the directory list
Remove .. items from the gth-dir-list dir_list->list and only have it in the gtk_list_store
Add gfile_get_basename_for_uri to gfile-utils
Update gth-browser and gth-browser-actions-callbacks to pass GFiles to gth-dir-list add_dir and remove_dir functions
Fix using new_path after g_free in folder_rename (gth-browser-actions-callbacks)
Update current_folder_tag functions in gth-browser-actions-callbacks for GFiles
Comment 14 Michael Chudobiak 2009-06-15 23:16:28 UTC
Committed, with some edits.

Thanks!

- Mike