[gnome-system-tools] Detach groups model from its view before massive insertions
- From: Milan Bouchet-Valat <milanbv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-system-tools] Detach groups model from its view before massive insertions
- Date: Thu, 16 Dec 2010 12:19:31 +0000 (UTC)
commit 2e7634fd1e8002c3db7ef24cb2dd33b8ca12053b
Author: Milan Bouchet-Valat <nalimilan club fr>
Date: Thu Dec 16 12:07:24 2010 +0100
Detach groups model from its view before massive insertions
Since we add many groups on start and when reloading, this can have
a significant effect.
src/users/groups-table.c | 24 ++++++++++++++++++++++++
src/users/groups-table.h | 2 ++
src/users/users-tool.c | 4 ++++
3 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/src/users/groups-table.c b/src/users/groups-table.c
index 3775c54..54a7bb9 100644
--- a/src/users/groups-table.c
+++ b/src/users/groups-table.c
@@ -128,6 +128,30 @@ groups_table_clear (void)
}
/*
+ * Detach the model from the tree view before massive insert,
+ * for performance reasons.
+ */
+void
+groups_table_begin_insertions (void)
+{
+ GtkWidget *groups_table;
+
+ groups_table = gst_dialog_get_widget (tool->main_dialog, "groups_table");
+
+ gtk_tree_view_set_model (GTK_TREE_VIEW (groups_table), NULL);
+}
+
+void
+groups_table_end_insertions (void)
+{
+ GtkWidget *groups_table;
+
+ groups_table = gst_dialog_get_widget (tool->main_dialog, "groups_table");
+
+ gtk_tree_view_set_model (GTK_TREE_VIEW (groups_table), GTK_TREE_MODEL (groups_model));
+}
+
+/*
* Get selected items, translating them to child GtkListStore references.
*/
GList*
diff --git a/src/users/groups-table.h b/src/users/groups-table.h
index d4c89cb..720412d 100644
--- a/src/users/groups-table.h
+++ b/src/users/groups-table.h
@@ -57,6 +57,8 @@ GtkTreeModel *groups_table_get_model ();
void groups_table_set_group (OobsGroup *group,
GtkTreeIter *iter);
void groups_table_add_group (OobsGroup *group);
+void groups_table_begin_insertions (void);
+void groups_table_end_insertions (void);
GList *groups_table_get_row_references ();
diff --git a/src/users/users-tool.c b/src/users/users-tool.c
index c3786b5..e8a180a 100644
--- a/src/users/users-tool.c
+++ b/src/users/users-tool.c
@@ -167,7 +167,9 @@ update_groups (GstUsersTool *tool)
gboolean valid;
groups_table_clear ();
+ groups_table_begin_insertions ();
privileges_table_clear ();
+
list = oobs_groups_config_get_groups (OOBS_GROUPS_CONFIG (tool->groups_config));
valid = oobs_list_get_iter_first (list, &iter);
@@ -183,6 +185,8 @@ update_groups (GstUsersTool *tool)
g_object_unref (group);
valid = oobs_list_iter_next (list, &iter);
}
+
+ groups_table_end_insertions ();
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]