brasero r1489 - in trunk: . src
- From: philippr svn gnome org
- To: svn-commits-list gnome org
- Subject: brasero r1489 - in trunk: . src
- Date: Fri, 7 Nov 2008 15:12:10 +0000 (UTC)
Author: philippr
Date: Fri Nov 7 15:12:10 2008
New Revision: 1489
URL: http://svn.gnome.org/viewvc/brasero?rev=1489&view=rev
Log:
Allow to freeze the tree model at project load time to delay display
until we\'re ready and created all necessary nodes.
* src/brasero-data-project.c (brasero_data_project_load_contents):
* src/brasero-data-project.h:
* src/brasero-data-tree-model.c (brasero_data_tree_model_freeze),
(brasero_data_tree_model_node_added),
(brasero_data_tree_model_node_removed),
(brasero_data_tree_model_node_changed),
(brasero_data_tree_model_class_init):
Modified:
trunk/ChangeLog
trunk/src/brasero-data-project.c
trunk/src/brasero-data-project.h
trunk/src/brasero-data-tree-model.c
Modified: trunk/src/brasero-data-project.c
==============================================================================
--- trunk/src/brasero-data-project.c (original)
+++ trunk/src/brasero-data-project.c Fri Nov 7 15:12:10 2008
@@ -2886,10 +2886,15 @@
GSList *excluded)
{
GSList *iter;
+ BraseroFileNode *node;
GSList *folders = NULL;
BraseroDataProjectClass *klass;
BraseroDataProjectPrivate *priv;
+ klass = BRASERO_DATA_PROJECT_GET_CLASS (self);
+ if (klass->freeze)
+ klass->freeze (self, TRUE);
+
for (iter = grafts; iter; iter = iter->next) {
BraseroGraftPt *graft;
@@ -2910,7 +2915,6 @@
}
/* Now load the temporary folders that were created */
- klass = BRASERO_DATA_PROJECT_GET_CLASS (self);
priv = BRASERO_DATA_PROJECT_PRIVATE (self);
for (iter = folders; iter; iter = iter->next) {
@@ -2958,6 +2962,18 @@
}
g_slist_free (folders);
+ if (klass->freeze)
+ klass->freeze (self, FALSE);
+
+ /* Now and only now signal to the tree-model that there are new nodes */
+ for (node = BRASERO_FILE_NODE_CHILDREN (priv->root); node; node = node->next) {
+ gchar *uri;
+
+ uri = brasero_data_project_node_to_uri (self, node);
+ if (klass->node_added)
+ klass->node_added (self, node, uri);
+ }
+
return priv->loading;
}
Modified: trunk/src/brasero-data-project.h
==============================================================================
--- trunk/src/brasero-data-project.h (original)
+++ trunk/src/brasero-data-project.h Fri Nov 7 15:12:10 2008
@@ -62,6 +62,12 @@
/* virtual functions */
/**
+ * That's to tell the model whether or not to update it
+ */
+ void (*freeze) (BraseroDataProject *project,
+ gboolean freeze);
+
+ /**
* num_nodes is the number of nodes that were at the root of the
* project.
*/
Modified: trunk/src/brasero-data-tree-model.c
==============================================================================
--- trunk/src/brasero-data-tree-model.c (original)
+++ trunk/src/brasero-data-tree-model.c Fri Nov 7 15:12:10 2008
@@ -53,6 +53,8 @@
gint sort_column;
GtkSortType sort_type;
+
+ guint freeze:1;
};
#define BRASERO_DATA_TREE_MODEL_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BRASERO_TYPE_DATA_TREE_MODEL, BraseroDataTreeModelPrivate))
@@ -639,12 +641,6 @@
return;
}
-/**
- * This is a function mainly used at project load time. In this context there
- * can be nodes that have been added to the data project tree but not added
- * through the model. Don't count those nodes.
- */
-
GtkTreePath *
brasero_data_tree_model_node_to_path (BraseroDataTreeModel *self,
BraseroFileNode *node)
@@ -1158,6 +1154,16 @@
BRASERO_DATA_PROJECT_CLASS (brasero_data_tree_model_parent_class)->reset (project, num_nodes);
}
+static void
+brasero_data_tree_model_freeze (BraseroDataProject *project,
+ gboolean freeze)
+{
+ BraseroDataTreeModelPrivate *priv;
+
+ priv = BRASERO_DATA_TREE_MODEL_PRIVATE (project);
+ priv->freeze = freeze;
+}
+
static gboolean
brasero_data_tree_model_node_added (BraseroDataProject *project,
BraseroFileNode *node,
@@ -1175,6 +1181,8 @@
goto end;
priv = BRASERO_DATA_TREE_MODEL_PRIVATE (project);
+ if (priv->freeze)
+ goto end;
iter.stamp = priv->stamp;
iter.user_data = node;
@@ -1259,6 +1267,8 @@
goto end;
priv = BRASERO_DATA_TREE_MODEL_PRIVATE (project);
+ if (priv->freeze)
+ goto end;
/* remove it from the shown list and all its children as well */
priv->shown = g_slist_remove (priv->shown, node);
@@ -1321,6 +1331,8 @@
goto end;
priv = BRASERO_DATA_TREE_MODEL_PRIVATE (project);
+ if (priv->freeze)
+ goto end;
/* Get the iter for the node */
iter.stamp = priv->stamp;
@@ -1385,6 +1397,8 @@
goto end;
priv = BRASERO_DATA_TREE_MODEL_PRIVATE (project);
+ if (priv->freeze)
+ goto end;
treepath = brasero_data_tree_model_node_to_path (BRASERO_DATA_TREE_MODEL (project), parent);
if (parent != brasero_data_project_get_root (project)) {
@@ -1578,6 +1592,7 @@
vfs_class->activity_changed = brasero_data_tree_model_activity_changed;
data_project_class->reset = brasero_data_tree_model_reset;
+ data_project_class->freeze = brasero_data_tree_model_freeze;
data_project_class->node_added = brasero_data_tree_model_node_added;
data_project_class->node_removed = brasero_data_tree_model_node_removed;
data_project_class->node_changed = brasero_data_tree_model_node_changed;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]