filechooserentry: Only append / to directory names once

Since 069d78ed31 the / is appended to
directories upon constructing the display name, so there is no need to
do it later.
This commit is contained in:
Benjamin Otte 2011-11-03 17:32:44 +01:00
parent 8389922de9
commit 2b9ecd9706

View File

@ -321,7 +321,6 @@ match_selected_callback (GtkEntryCompletion *completion,
char *display_name;
GFile *file;
gint pos;
gboolean dummy;
gtk_tree_model_get (model, iter,
DISPLAY_NAME_COLUMN, &display_name,
@ -337,8 +336,6 @@ match_selected_callback (GtkEntryCompletion *completion,
return FALSE;
}
display_name = maybe_append_separator_to_file (chooser_entry, file, display_name, &dummy);
pos = chooser_entry->file_part_pos;
/* We don't set in_change here as we want to update the current_folder
@ -617,29 +614,6 @@ find_common_prefix (GtkFileChooserEntry *chooser_entry,
return TRUE;
}
static gboolean
char_after_cursor_is_directory_separator (GtkFileChooserEntry *chooser_entry)
{
int cursor_pos;
gboolean result;
result = FALSE;
cursor_pos = gtk_editable_get_position (GTK_EDITABLE (chooser_entry));
if (cursor_pos < gtk_entry_get_text_length (GTK_ENTRY (chooser_entry)))
{
char *next_char_str;
next_char_str = gtk_editable_get_chars (GTK_EDITABLE (chooser_entry), cursor_pos, cursor_pos + 1);
if (G_IS_DIR_SEPARATOR (*next_char_str))
result = TRUE;
g_free (next_char_str);
}
return result;
}
typedef enum {
INVALID_INPUT, /* what the user typed is bogus */
NO_MATCH, /* no matches based on what the user typed */
@ -694,18 +668,6 @@ append_common_prefix (GtkFileChooserEntry *chooser_entry,
if (unique_file)
{
if (!char_after_cursor_is_directory_separator (chooser_entry))
{
gboolean appended;
common_prefix = maybe_append_separator_to_file (chooser_entry,
unique_file,
common_prefix,
&appended);
if (appended)
prefix_expands_the_file_part = TRUE;
}
g_object_unref (unique_file);
if (prefix_expands_the_file_part)