diff options
author | Benjamin Otte <otte@redhat.com> | 2011-11-05 03:56:36 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2011-12-16 20:09:12 +0100 |
commit | 1ac6ace87d904da1672e7bae01cf1d16e509accb (patch) | |
tree | 1e71fbc96ba373cd9838d09acde788786548368c /gtk/gtkfilechooserentry.c | |
parent | e2105c2befc3c0a10ccb5223714f1a68ee1b4c0b (diff) | |
download | gtk+-1ac6ace87d904da1672e7bae01cf1d16e509accb.tar.gz |
filechooserentry: Redo _gtk_file_chooser_entry_get_file_part()
The new version does not need to update any text, it just strips the
last part of the existing entry.
Diffstat (limited to 'gtk/gtkfilechooserentry.c')
-rw-r--r-- | gtk/gtkfilechooserentry.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/gtk/gtkfilechooserentry.c b/gtk/gtkfilechooserentry.c index 14f9318166..a14116e907 100644 --- a/gtk/gtkfilechooserentry.c +++ b/gtk/gtkfilechooserentry.c @@ -1719,8 +1719,16 @@ _gtk_file_chooser_entry_get_current_folder (GtkFileChooserEntry *chooser_entry) const gchar * _gtk_file_chooser_entry_get_file_part (GtkFileChooserEntry *chooser_entry) { - commit_completion_and_refresh (chooser_entry); - return chooser_entry->file_part; + const char *last_slash, *text; + + g_return_val_if_fail (GTK_IS_FILE_CHOOSER_ENTRY (chooser_entry), NULL); + + text = gtk_entry_get_text (GTK_ENTRY (chooser_entry)); + last_slash = strrchr (text, G_DIR_SEPARATOR); + if (last_slash) + return last_slash + 1; + else + return text; } /** |