summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis@xfce.org>2009-08-21 16:32:43 +0200
committerJannis Pohlmann <jannis@xfce.org>2009-08-21 16:32:43 +0200
commitabe57845eb7620894a2e4c09769857d16b63d2f1 (patch)
treeec4f266a6b19331f6e157a7f274e0819ed06db72
parent62ad9ea08c84849d6e4384e03f58ec29295c2b5a (diff)
downloadthunar-migration-to-gio.tar.gz
Fix crash in the URI completion of the path entry. Patch by Nick.migration-to-gio
-rw-r--r--thunar/thunar-path-entry.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/thunar/thunar-path-entry.c b/thunar/thunar-path-entry.c
index 40d61b6c..2946f021 100644
--- a/thunar/thunar-path-entry.c
+++ b/thunar/thunar-path-entry.c
@@ -810,6 +810,12 @@ thunar_path_entry_changed (GtkEditable *editable)
{
/* try to parse the URI text */
file_path = g_file_new_for_uri (text);
+
+ /* use the same file if the text assumes we're in a directory */
+ if (g_str_has_suffix (text, "/"))
+ folder_path = g_object_ref (G_OBJECT (file_path));
+ else
+ folder_path = g_file_get_parent (file_path);
}
else if (thunar_path_entry_parse (path_entry, &folder_part, &file_part, NULL))
{
@@ -831,9 +837,6 @@ thunar_path_entry_changed (GtkEditable *editable)
current_folder = (folder_path != NULL) ? thunar_file_get (folder_path, NULL) : NULL;
current_file = (file_path != NULL) ? thunar_file_get (file_path, NULL) : NULL;
- /* TODO Fix bug with non-existent folders */
- _thunar_assert (current_folder == NULL || thunar_file_is_directory (current_folder));
-
/* determine the entry completion */
completion = gtk_entry_get_completion (GTK_ENTRY (path_entry));
@@ -848,7 +851,10 @@ thunar_path_entry_changed (GtkEditable *editable)
g_object_ref (G_OBJECT (current_folder));
/* try to open the current-folder file as folder */
- folder = (current_folder != NULL) ? thunar_folder_get_for_file (current_folder) : NULL;
+ if (current_folder != NULL && thunar_file_is_directory (current_folder))
+ folder = thunar_folder_get_for_file (current_folder);
+ else
+ folder = NULL;
/* set the new folder for the completion model, but disconnect the model from the
* completion first, because GtkEntryCompletion has become very slow recently when