gtranslator r3457 - branches/GOBJECT_WORK/src
- From: icq svn gnome org
- To: svn-commits-list gnome org
- Subject: gtranslator r3457 - branches/GOBJECT_WORK/src
- Date: Sat, 26 Jan 2008 17:44:38 +0000 (GMT)
Author: icq
Date: Sat Jan 26 17:44:38 2008
New Revision: 3457
URL: http://svn.gnome.org/viewvc/gtranslator?rev=3457&view=rev
Log:
2008-01-26 Ignacio Casal Quinteiro <nacho resa gmail com>
* message-table.c:
Now the load is faster.
Modified:
branches/GOBJECT_WORK/src/ChangeLog
branches/GOBJECT_WORK/src/message-table.c
Modified: branches/GOBJECT_WORK/src/message-table.c
==============================================================================
--- branches/GOBJECT_WORK/src/message-table.c (original)
+++ branches/GOBJECT_WORK/src/message-table.c Sat Jan 26 17:44:38 2008
@@ -50,6 +50,7 @@
{
GtkWidget *treeview;
GtkListStore *store;
+ GtkTreeModel *sort_model;
GtranslatorTab *tab;
};
@@ -97,7 +98,7 @@
GtkTreePath *path, *sort_path;
GtkTreeSelection *selection;
GtkTreeIter iter, sort_iter;
-
+
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(table->priv->treeview));
path = gtk_tree_row_reference_get_path(gtranslator_msg_get_row_reference(msg));
@@ -107,7 +108,7 @@
gtk_tree_model_get_iter(GTK_TREE_MODEL(model),
&iter,
path);
-
+
gtk_tree_selection_select_iter(selection, &iter);
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(table->priv->treeview),
@@ -279,7 +280,6 @@
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
GtkTreeSelection *selection;
- GtkTreeModel *sort_model;
priv->store = gtk_list_store_new (N_COLUMNS,
G_TYPE_STRING,
@@ -289,18 +289,18 @@
G_TYPE_INT,
G_TYPE_POINTER);
- sort_model = gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(priv->store));
+ priv->sort_model = gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(priv->store));
- priv->treeview = gtk_tree_view_new_with_model(sort_model);
+ priv->treeview = gtk_tree_view_new();
- gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(sort_model),
+ gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(priv->sort_model),
ID_COLUMN,
GTK_SORT_ASCENDING);
- gtk_tree_sortable_set_default_sort_func(GTK_TREE_SORTABLE(sort_model),
+ gtk_tree_sortable_set_default_sort_func(GTK_TREE_SORTABLE(priv->sort_model),
NULL, NULL, NULL);
- gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(sort_model),
+ gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(priv->sort_model),
STATUS_COLUMN,
model_compare_by_status,
NULL,
@@ -444,8 +444,6 @@
g_return_if_fail(table != NULL);
g_return_if_fail(messages != NULL);
- model = gtk_tree_view_get_model(GTK_TREE_VIEW(table->priv->treeview));
-
while (messages)
{
msgid = gtranslator_msg_get_msgid(GTR_MSG(messages->data));
@@ -472,13 +470,20 @@
POINTER_COLUMN, messages,
-1);
- gtk_tree_model_sort_convert_child_iter_to_iter(GTK_TREE_MODEL_SORT(model), &sort_iter, &iter);
- path = gtk_tree_model_get_path(model, &sort_iter);
- row = gtk_tree_row_reference_new(model, path);
+ gtk_tree_model_sort_convert_child_iter_to_iter(GTK_TREE_MODEL_SORT(table->priv->sort_model),
+ &sort_iter, &iter);
+ path = gtk_tree_model_get_path(table->priv->sort_model, &sort_iter);
+ row = gtk_tree_row_reference_new(table->priv->sort_model, path);
gtk_tree_path_free(path);
gtranslator_msg_set_row_reference(GTR_MSG(messages->data), row);
messages = g_list_next(messages);
}
+
+ /*
+ * It is much faster set the model after list population
+ */
+ gtk_tree_view_set_model (GTK_TREE_VIEW (table->priv->treeview),
+ table->priv->sort_model);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]