[gtk+/gtk-2-24] filechooserentry: Store the liststore as a treemodel
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-24] filechooserentry: Store the liststore as a treemodel
- Date: Thu, 10 Mar 2016 21:28:42 +0000 (UTC)
commit 88810509ca0e959598813842cc9f45ae6bc2c61f
Author: Benjamin Otte <otte redhat com>
Date: Thu Nov 3 18:11:14 2011 +0100
filechooserentry: Store the liststore as a treemodel
Just changes the type of the member variable. This way we can avoid a
lot of casts.
gtk/gtkfilechooserentry.c | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/gtk/gtkfilechooserentry.c b/gtk/gtkfilechooserentry.c
index c2c2552..26c377e 100644
--- a/gtk/gtkfilechooserentry.c
+++ b/gtk/gtkfilechooserentry.c
@@ -79,7 +79,7 @@ struct _GtkFileChooserEntry
LoadCompleteAction load_complete_action;
- GtkListStore *completion_store;
+ GtkTreeModel *completion_store;
guint start_autocompletion_idle_id;
@@ -379,7 +379,7 @@ completion_match_func (GtkEntryCompletion *comp,
return FALSE;
}
- gtk_tree_model_get (GTK_TREE_MODEL (chooser_entry->completion_store), iter, DISPLAY_NAME_COLUMN, &name,
-1);
+ gtk_tree_model_get (chooser_entry->completion_store, iter, DISPLAY_NAME_COLUMN, &name, -1);
if (!name)
{
return FALSE; /* Uninitialized row, ugh */
@@ -492,14 +492,14 @@ find_common_prefix (GtkFileChooserEntry *chooser_entry,
/* First pass: find the common prefix */
- valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (chooser_entry->completion_store), &iter);
+ valid = gtk_tree_model_get_iter_first (chooser_entry->completion_store, &iter);
while (valid)
{
gchar *display_name;
GFile *file;
- gtk_tree_model_get (GTK_TREE_MODEL (chooser_entry->completion_store),
+ gtk_tree_model_get (chooser_entry->completion_store,
&iter,
DISPLAY_NAME_COLUMN, &display_name,
FILE_COLUMN, &file,
@@ -535,21 +535,21 @@ find_common_prefix (GtkFileChooserEntry *chooser_entry,
g_free (display_name);
g_object_unref (file);
- valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (chooser_entry->completion_store), &iter);
+ valid = gtk_tree_model_iter_next (chooser_entry->completion_store, &iter);
}
/* Second pass: see if the prefix we found is a complete match */
if (*common_prefix_ret != NULL)
{
- valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (chooser_entry->completion_store), &iter);
+ valid = gtk_tree_model_get_iter_first (chooser_entry->completion_store, &iter);
while (valid)
{
gchar *display_name;
int len;
- gtk_tree_model_get (GTK_TREE_MODEL (chooser_entry->completion_store),
+ gtk_tree_model_get (chooser_entry->completion_store,
&iter,
DISPLAY_NAME_COLUMN, &display_name,
-1);
@@ -563,7 +563,7 @@ find_common_prefix (GtkFileChooserEntry *chooser_entry,
*is_complete_not_unique_ret = TRUE;
g_free (display_name);
- valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (chooser_entry->completion_store), &iter);
+ valid = gtk_tree_model_iter_next (chooser_entry->completion_store, &iter);
}
/* Finally: Did we generate a new completion, or was the user's input already completed as far as it
could go? */
@@ -1215,9 +1215,9 @@ populate_completion_store (GtkFileChooserEntry *chooser_entry)
files = _gtk_folder_list_children (chooser_entry->current_folder);
- chooser_entry->completion_store = gtk_list_store_new (N_COLUMNS,
- G_TYPE_STRING,
- G_TYPE_FILE);
+ chooser_entry->completion_store = GTK_TREE_MODEL (gtk_list_store_new (N_COLUMNS,
+ G_TYPE_STRING,
+ G_TYPE_FILE));
for (tmp_list = files; tmp_list; tmp_list = tmp_list->next)
{
@@ -1238,8 +1238,8 @@ populate_completion_store (GtkFileChooserEntry *chooser_entry)
else
display_name = g_strdup (g_file_info_get_display_name (info));
- gtk_list_store_append (chooser_entry->completion_store, &iter);
- gtk_list_store_set (chooser_entry->completion_store, &iter,
+ gtk_list_store_append (GTK_LIST_STORE (chooser_entry->completion_store), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (chooser_entry->completion_store), &iter,
DISPLAY_NAME_COLUMN, display_name,
FILE_COLUMN, file,
-1);
@@ -1256,7 +1256,7 @@ populate_completion_store (GtkFileChooserEntry *chooser_entry)
DISPLAY_NAME_COLUMN, GTK_SORT_ASCENDING);
gtk_entry_completion_set_model (gtk_entry_get_completion (GTK_ENTRY (chooser_entry)),
- GTK_TREE_MODEL (chooser_entry->completion_store));
+ chooser_entry->completion_store);
}
/* When we finish loading the current folder, this function should get called to
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]