[gnome-video-arcade] ui: Convert GvaGameStore back to a list store



commit 6086516bed6ca54f9e06dcfd2313f95c29f2b49c
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon Sep 14 13:33:12 2015 -0400

    ui: Convert GvaGameStore back to a list store
    
    MASSIVE performance boost!  Way more than I expected.

 src/gva-columns.c    |    4 ++--
 src/gva-game-store.c |   16 ++++++++--------
 src/gva-game-store.h |    4 ++--
 src/gva-play-back.c  |    8 ++++----
 src/gva-ui.c         |   12 ++++++------
 5 files changed, 22 insertions(+), 22 deletions(-)
---
diff --git a/src/gva-columns.c b/src/gva-columns.c
index 5731bfa..01d5e24 100644
--- a/src/gva-columns.c
+++ b/src/gva-columns.c
@@ -123,8 +123,8 @@ columns_comment_edited_cb (GtkCellRendererText *renderer,
         gtk_tree_path_free (path);
         g_return_if_fail (valid);
 
-        gtk_tree_store_set (
-                GTK_TREE_STORE (model), &iter, column_id, new_text, -1);
+        gtk_list_store_set (
+                GTK_LIST_STORE (model), &iter, column_id, new_text, -1);
 }
 
 static void
diff --git a/src/gva-game-store.c b/src/gva-game-store.c
index 844f653..d7e8c2c 100644
--- a/src/gva-game-store.c
+++ b/src/gva-game-store.c
@@ -32,7 +32,7 @@
 G_DEFINE_TYPE (
         GvaGameStore,
         gva_game_store,
-        GTK_TYPE_TREE_STORE)
+        GTK_TYPE_LIST_STORE)
 
 static GHashTable *
 game_store_get_index (GvaGameStore *game_store)
@@ -192,8 +192,8 @@ game_store_constructor (GType type,
         object = G_OBJECT_CLASS (gva_game_store_parent_class)->constructor (
                 type, n_construct_properties, construct_properties);
 
-        gtk_tree_store_set_column_types (
-                GTK_TREE_STORE (object), G_N_ELEMENTS (types), types);
+        gtk_list_store_set_column_types (
+                GTK_LIST_STORE (object), G_N_ELEMENTS (types), types);
 
         gtk_tree_sortable_set_default_sort_func (
                 GTK_TREE_SORTABLE (object),
@@ -331,7 +331,7 @@ gva_game_store_new_from_query (const gchar *sql,
                 GValue *value;
 
                 /* Append a new row to the tree store. */
-                gtk_tree_store_append (GTK_TREE_STORE (model), &iter, NULL);
+                gtk_list_store_append (GTK_LIST_STORE (model), &iter);
 
                 /* Populate the row with available values. */
                 for (ii = 0; ii < n_columns; ii++)
@@ -391,8 +391,8 @@ gva_game_store_new_from_query (const gchar *sql,
                 g_value_set_boolean (value, gva_favorites_contains (name));
 
                 /* Store the row in the tree model. */
-                gtk_tree_store_set_valuesv (
-                        GTK_TREE_STORE (model), &iter,
+                gtk_list_store_set_valuesv (
+                        GTK_LIST_STORE (model), &iter,
                         (gint *) column_ids, column_values, n_columns + 1);
 
                 /* Keep the UI responsive. */
@@ -441,7 +441,7 @@ gva_game_store_clear (GvaGameStore *game_store)
         g_return_if_fail (GVA_IS_GAME_STORE (game_store));
 
         g_hash_table_remove_all (game_store_get_index (game_store));
-        gtk_tree_store_clear (GTK_TREE_STORE (game_store));
+        gtk_list_store_clear (GTK_LIST_STORE (game_store));
 }
 
 /**
@@ -452,7 +452,7 @@ gva_game_store_clear (GvaGameStore *game_store)
  *
  * Adds an entry to @game_store's internal index.  You will want to call
  * this immediately after adding a new row to @game_store, such as with
- * gtk_tree_store_append().
+ * gtk_list_store_append().
  **/
 void
 gva_game_store_index_insert (GvaGameStore *game_store,
diff --git a/src/gva-game-store.h b/src/gva-game-store.h
index 485e537..6329ce2 100644
--- a/src/gva-game-store.h
+++ b/src/gva-game-store.h
@@ -190,12 +190,12 @@ typedef enum
  **/
 struct _GvaGameStore
 {
-        GtkTreeStore parent;
+        GtkListStore parent;
 };
 
 struct _GvaGameStoreClass
 {
-        GtkTreeStoreClass parent_class;
+        GtkListStoreClass parent_class;
 };
 
 GType           gva_game_store_get_type         (void);
diff --git a/src/gva-play-back.c b/src/gva-play-back.c
index bc32181..52cd00c 100644
--- a/src/gva-play-back.c
+++ b/src/gva-play-back.c
@@ -93,7 +93,7 @@ play_back_delete_inpfile (GtkTreeRowReference *reference)
 
         errno = 0;
         if (g_unlink (inpfile) == 0)
-                gtk_tree_store_remove (GTK_TREE_STORE (model), &iter);
+                gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
         else
                 g_warning ("%s: %s", inpfile, g_strerror (errno));
 
@@ -182,10 +182,10 @@ play_back_add_input_file (GvaInputFile *input_file,
                 return;
         }
 
-        gtk_tree_store_append (GTK_TREE_STORE (game_store), &iter, NULL);
+        gtk_list_store_append (GTK_LIST_STORE (game_store), &iter);
 
-        gtk_tree_store_set (
-                GTK_TREE_STORE (game_store), &iter,
+        gtk_list_store_set (
+                GTK_LIST_STORE (game_store), &iter,
                 GVA_GAME_STORE_COLUMN_NAME, game,
                 GVA_GAME_STORE_COLUMN_COMMENT, comment,
                 GVA_GAME_STORE_COLUMN_INODE, (gint64) st.st_ino,
diff --git a/src/gva-ui.c b/src/gva-ui.c
index ce67d8d..39c7f0a 100644
--- a/src/gva-ui.c
+++ b/src/gva-ui.c
@@ -271,8 +271,8 @@ log_lastplayed (GvaProcess *process,
                 model = gva_tree_view_get_model ();
                 gtk_tree_model_get_iter (model, &iter, path);
 
-                gtk_tree_store_set (
-                        GTK_TREE_STORE (model), &iter,
+                gtk_list_store_set (
+                        GTK_LIST_STORE (model), &iter,
                         GVA_GAME_STORE_COLUMN_LAST_PLAYED, &now, -1);
 
                 gtk_tree_path_free (path);
@@ -361,8 +361,8 @@ gva_action_insert_favorite_cb (GtkAction *action)
         gtk_tree_path_free (path);
         g_assert (valid);
 
-        gtk_tree_store_set (
-                GTK_TREE_STORE (model), &iter,
+        gtk_list_store_set (
+                GTK_LIST_STORE (model), &iter,
                 GVA_GAME_STORE_COLUMN_FAVORITE, TRUE, -1);
 
         gva_favorites_insert (name);
@@ -599,8 +599,8 @@ gva_action_remove_favorite_cb (GtkAction *action)
         gtk_tree_path_free (path);
         g_assert (valid);
 
-        gtk_tree_store_set (
-                GTK_TREE_STORE (model), &iter,
+        gtk_list_store_set (
+                GTK_LIST_STORE (model), &iter,
                 GVA_GAME_STORE_COLUMN_FAVORITE, FALSE, -1);
 
         gva_favorites_remove (name);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]