brasero r1388 - in trunk: . src
- From: philippr svn gnome org
- To: svn-commits-list gnome org
- Subject: brasero r1388 - in trunk: . src
- Date: Fri, 17 Oct 2008 18:11:58 +0000 (UTC)
Author: philippr
Date: Fri Oct 17 18:11:57 2008
New Revision: 1388
URL: http://svn.gnome.org/viewvc/brasero?rev=1388&view=rev
Log:
Fix a problem in the tree when adding file(s) to graft that was already
in the tree but not grafted yet. The previous location(s) were not
grafted as well.
* src/brasero-data-project.c (brasero_data_project_uri_add_graft),
(brasero_data_project_uri_graft_nodes),
(brasero_data_project_node_removed),
(brasero_data_project_move_node),
(brasero_data_project_rename_node),
(brasero_data_project_add_node_real),
(brasero_data_project_add_loading_node):
* src/brasero-file-monitor.c
(brasero_file_monitor_inotify_monitor_cb):
Modified:
trunk/ChangeLog
trunk/src/brasero-data-project.c
trunk/src/brasero-file-monitor.c
Modified: trunk/src/brasero-data-project.c
==============================================================================
--- trunk/src/brasero-data-project.c (original)
+++ trunk/src/brasero-data-project.c Fri Oct 17 18:11:57 2008
@@ -879,7 +879,7 @@
BraseroURINode *graft;
priv = BRASERO_DATA_PROJECT_PRIVATE (self);
-
+g_print ("GRAFT %s\n", uri);
graft = g_new0 (BraseroURINode, 1);
if (uri != NEW_FOLDER)
graft->uri = brasero_utils_register_string (uri);
@@ -909,7 +909,7 @@
return brasero_data_project_uri_add_graft (self, uri);
}
-static void
+static BraseroURINode *
brasero_data_project_uri_graft_nodes (BraseroDataProject *self,
const gchar *uri)
{
@@ -920,10 +920,6 @@
priv = BRASERO_DATA_PROJECT_PRIVATE (self);
- /* see if that's really needed */
- if (g_hash_table_lookup (priv->grafts, uri))
- return;
-
/* Find all the nodes that should be grafted.
* NOTE: this must be done before asking for a new graft */
nodes = brasero_data_project_uri_to_nodes (self, uri);
@@ -936,9 +932,12 @@
BraseroFileNode *iter_node;
iter_node = iter->data;
+ g_print ("NERKJ %s\n", BRASERO_FILE_NODE_NAME (iter_node));
brasero_file_node_graft (iter_node, graft);
}
g_slist_free (nodes);
+
+ return graft;
}
static void
@@ -1038,6 +1037,7 @@
priv = BRASERO_DATA_PROJECT_PRIVATE (self);
#ifdef BUILD_INOTIFY
+
/* remove all monitoring */
if (node->is_monitored)
brasero_file_monitor_foreach_cancel (BRASERO_FILE_MONITOR (self),
@@ -1093,7 +1093,9 @@
/* This URI will need a graft if it hasn't one yet */
uri = brasero_data_project_node_to_uri (self, node);
- brasero_data_project_uri_graft_nodes (self, uri);
+
+ if (!g_hash_table_lookup (priv->grafts, uri))
+ brasero_data_project_uri_graft_nodes (self, uri);
/* NOTE: since the URI wasn't grafted it has to have a
* valid parent that's why we don't check the graft
@@ -1301,7 +1303,8 @@
* move it should probably be a graft now.
* NOTE: we need to do it now before it gets unparented. */
uri = brasero_data_project_node_to_uri (self, node);
- brasero_data_project_uri_graft_nodes (self, uri);
+ if (!g_hash_table_lookup (priv->grafts, uri))
+ brasero_data_project_uri_graft_nodes (self, uri);
g_free (uri);
check_graft = FALSE;
@@ -1406,7 +1409,8 @@
* we need to add one with all nodes having the same
* URI. */
uri = brasero_data_project_node_to_uri (self, node);
- brasero_data_project_uri_graft_nodes (self, uri);
+ if (!g_hash_table_lookup (priv->grafts, uri))
+ brasero_data_project_uri_graft_nodes (self, uri);
g_free (uri);
/* now we can change the name */
@@ -1457,7 +1461,7 @@
BraseroDataProjectClass *klass;
priv = BRASERO_DATA_PROJECT_PRIVATE (self);
-
+g_print ("REACHED %s\n", uri);
/* See if we should create a graft for the node.
* NOTE: if we create a graft we create a graft for all nodes
* that have the same URI in the tree too. */
@@ -1466,24 +1470,33 @@
brasero_file_node_graft (node, graft);
}
else if (node->is_symlink) {
- /* NOTE: info has the uri for the target of the symlink */
- graft = brasero_data_project_uri_ensure_graft (self, uri);
+ /* NOTE: info has the uri for the target of the symlink; graft
+ * it as well as all the nodes already in the tree with the same
+ * URI */
+ graft = brasero_data_project_uri_graft_nodes (self, uri);
brasero_file_node_graft (node, graft);
}
else if (node->parent == priv->root) {
- /* The node is at the root of the project; graft it */
- graft = brasero_data_project_uri_ensure_graft (self, uri);
+g_print ("SKDLFKD \n");
+ /* The node is at the root of the project; graft it as well as
+ * all the nodes already in the tree with the same URI */
+ graft = brasero_data_project_uri_graft_nodes (self, uri);
brasero_file_node_graft (node, graft);
}
else if (node->is_fake) {
- /* The node is a fake directory; graft it */
- graft = brasero_data_project_uri_ensure_graft (self, uri);
- brasero_file_node_graft (node, graft);
+ /* The node is a fake directory; graft it as well as all the
+ * nodes already in the tree with the same URI */
+ graft = brasero_data_project_uri_graft_nodes (self, uri);
}
else {
gchar *parent_uri;
parent_uri = brasero_data_project_node_to_uri (self, node->parent);
+g_print ("OKK %s %p\n", parent_uri, node->parent);
+ /* NOTE: in here use a special function here since that node
+ * could already be in the tree but under its rightful parent
+ * and then it won't have any graft yet. That's why these nodes
+ * need to be grafted as well. */
if (parent_uri) {
guint parent_len;
@@ -1492,8 +1505,8 @@
&& uri [parent_len] != G_DIR_SEPARATOR) {
/* The node hasn't been put under its rightful
* parent from the original file system. That
- * means we must add a graft*/
- graft = brasero_data_project_uri_add_graft (self, uri);
+ * means we must add a graft */
+ graft = brasero_data_project_uri_graft_nodes (self, uri);
brasero_file_node_graft (node, graft);
}
/* NOTE: we don't need to check if the nodes's name
@@ -1507,7 +1520,7 @@
}
else {
/* its father is probably an fake empty directory */
- graft = brasero_data_project_uri_add_graft (self, uri);
+ graft = brasero_data_project_uri_graft_nodes (self, uri);
brasero_file_node_graft (node, graft);
}
}
@@ -1965,7 +1978,6 @@
priv = BRASERO_DATA_PROJECT_PRIVATE (self);
graft = g_hash_table_lookup (priv->grafts, uri);
-
if (!parent)
parent = priv->root;
@@ -1988,7 +2000,7 @@
brasero_data_project_remove_real (self, node);
graft = g_hash_table_lookup (priv->grafts, uri);
}
-
+g_print ("GRAFF %p\n", graft);
node = brasero_file_node_new_loading (name, parent, priv->sort_func);
brasero_data_project_add_node_real (self, node, graft, uri);
g_free (name);
Modified: trunk/src/brasero-file-monitor.c
==============================================================================
--- trunk/src/brasero-file-monitor.c (original)
+++ trunk/src/brasero-file-monitor.c Fri Oct 17 18:11:57 2008
@@ -530,8 +530,7 @@
callback_data = g_hash_table_lookup (priv->files, GINT_TO_POINTER (event.wd));
if (!callback_data) {
/* Retry with children */
- callback_data = g_hash_table_lookup (priv->directories,
- GINT_TO_POINTER (event.wd));
+ callback_data = g_hash_table_lookup (priv->directories, GINT_TO_POINTER (event.wd));
if (name && callback_data) {
/* For directories we don't take heed of the SELF events.
* All events are treated through the parent directory
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]