[gtk+] filechooserentry: Simplify match_selected function
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] filechooserentry: Simplify match_selected function
- Date: Fri, 16 Dec 2011 19:13:35 +0000 (UTC)
commit e3ef8a568e6772b16bb3b52b0e71f80d02187c48
Author: Benjamin Otte <otte redhat com>
Date: Sun Nov 6 02:21:28 2011 +0100
filechooserentry: Simplify match_selected function
gtk/gtkfilechooserentry.c | 32 +++++++++-----------------------
1 files changed, 9 insertions(+), 23 deletions(-)
---
diff --git a/gtk/gtkfilechooserentry.c b/gtk/gtkfilechooserentry.c
index fc2900b..ed97f1a 100644
--- a/gtk/gtkfilechooserentry.c
+++ b/gtk/gtkfilechooserentry.c
@@ -284,37 +284,23 @@ match_selected_callback (GtkEntryCompletion *completion,
GtkTreeIter *iter,
GtkFileChooserEntry *chooser_entry)
{
- char *display_name;
- GFile *file;
- gint pos;
+ char *path;
gtk_tree_model_get (model, iter,
- DISPLAY_NAME_COLUMN, &display_name,
- FILE_COLUMN, &file,
- -1);
-
- if (!display_name || !file)
- {
- if (file)
- g_object_unref (file);
-
- g_free (display_name);
- return FALSE;
- }
-
- pos = chooser_entry->file_part_pos;
+ FULL_PATH_COLUMN, &path,
+ -1);
/* We don't set in_change here as we want to update the current_folder
* variable */
gtk_editable_delete_text (GTK_EDITABLE (chooser_entry),
- pos, -1);
+ 0,
+ gtk_editable_get_position (GTK_EDITABLE (chooser_entry)));
gtk_editable_insert_text (GTK_EDITABLE (chooser_entry),
- display_name, -1,
- &pos);
- gtk_editable_set_position (GTK_EDITABLE (chooser_entry), -1);
+ path,
+ 0,
+ NULL);
- g_object_unref (file);
- g_free (display_name);
+ g_free (path);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]