brasero r1536 - in trunk: . src
- From: philippr svn gnome org
- To: svn-commits-list gnome org
- Subject: brasero r1536 - in trunk: . src
- Date: Mon, 17 Nov 2008 14:28:34 +0000 (UTC)
Author: philippr
Date: Mon Nov 17 14:28:34 2008
New Revision: 1536
URL: http://svn.gnome.org/viewvc/brasero?rev=1536&view=rev
Log:
Small speed up and fixes for project loading and exploration
* src/brasero-data-disc.c (brasero_data_disc_size_changed),
(brasero_data_disc_size_changed_cb), (brasero_data_disc_clear),
(brasero_data_disc_reset), (brasero_data_disc_finalize):
* src/brasero-data-project.c
(brasero_data_project_convert_to_fake),
(brasero_data_project_remove_node),
(brasero_data_project_node_loaded),
(brasero_data_project_load_contents):
* src/brasero-data-vfs.c
(brasero_data_vfs_directory_check_symlink_loop),
(brasero_data_vfs_loading_node):
* src/brasero-file-monitor.c (brasero_file_monitor_foreach_cancel):
Modified:
trunk/ChangeLog
trunk/src/brasero-data-disc.c
trunk/src/brasero-data-project.c
trunk/src/brasero-data-vfs.c
trunk/src/brasero-file-monitor.c
Modified: trunk/src/brasero-data-disc.c
==============================================================================
--- trunk/src/brasero-data-disc.c (original)
+++ trunk/src/brasero-data-disc.c Mon Nov 17 14:28:34 2008
@@ -94,6 +94,8 @@
GSList *load_errors;
+ gint size_changed_id;
+
guint loading;
guint editing:1;
@@ -1099,14 +1101,35 @@
return (answer != GTK_RESPONSE_YES);
}
+static gboolean
+brasero_data_disc_size_changed (gpointer user_data)
+{
+ gint64 size;
+ BraseroDataDisc *self;
+ BraseroDataDiscPrivate *priv;
+
+ self = BRASERO_DATA_DISC (user_data);
+ priv = BRASERO_DATA_DISC_PRIVATE (self);
+
+ size = brasero_data_project_get_size (BRASERO_DATA_PROJECT (priv->project));
+ brasero_disc_size_changed (BRASERO_DISC (self), size);
+
+ priv->size_changed_id = 0;
+ return FALSE;
+}
+
static void
brasero_data_disc_size_changed_cb (BraseroDataProject *project,
BraseroDataDisc *self)
{
- gint64 size;
+ BraseroDataDiscPrivate *priv;
- size = brasero_data_project_get_size (project);
- brasero_disc_size_changed (BRASERO_DISC (self), size);
+ priv = BRASERO_DATA_DISC_PRIVATE (self);
+
+ if (!priv->size_changed_id)
+ priv->size_changed_id = g_timeout_add (500,
+ brasero_data_disc_size_changed,
+ self);
}
static void
@@ -1344,6 +1367,11 @@
if (priv->loading)
return;
+ if (priv->size_changed_id) {
+ g_source_remove (priv->size_changed_id);
+ priv->size_changed_id = 0;
+ }
+
if (brasero_data_session_get_loaded_medium (BRASERO_DATA_SESSION (priv->project)))
brasero_data_session_remove_last (BRASERO_DATA_SESSION (priv->project));
@@ -1375,6 +1403,11 @@
priv = BRASERO_DATA_DISC_PRIVATE (disc);
+ if (priv->size_changed_id) {
+ g_source_remove (priv->size_changed_id);
+ priv->size_changed_id = 0;
+ }
+
/* Unload session */
if (brasero_data_session_get_loaded_medium (BRASERO_DATA_SESSION (priv->project)))
brasero_data_session_remove_last (BRASERO_DATA_SESSION (priv->project));
@@ -2571,6 +2604,11 @@
priv = BRASERO_DATA_DISC_PRIVATE (object);
+ if (priv->size_changed_id) {
+ g_source_remove (priv->size_changed_id);
+ priv->size_changed_id = 0;
+ }
+
if (priv->message) {
g_object_unref (priv->message);
priv->message = NULL;
Modified: trunk/src/brasero-data-project.c
==============================================================================
--- trunk/src/brasero-data-project.c (original)
+++ trunk/src/brasero-data-project.c Mon Nov 17 14:28:34 2008
@@ -1141,6 +1141,33 @@
0);
}
+static void
+brasero_data_project_convert_to_fake (BraseroDataProject *self,
+ BraseroFileNode *node)
+{
+ BraseroURINode *graft;
+ BraseroDataProjectPrivate *priv;
+
+ priv = BRASERO_DATA_PROJECT_PRIVATE (self);
+
+ /* make it a fake directory not to break order */
+ node->is_fake = TRUE;
+ node->is_loading = FALSE;
+ node->is_tmp_parent = FALSE;
+
+ brasero_file_node_ungraft (node);
+ graft = brasero_data_project_uri_ensure_graft (self, NEW_FOLDER);
+ brasero_file_node_graft (node, graft);
+ brasero_data_project_node_changed (self, node);
+
+ /* Remove 2 since we're not going to load its contents */
+ priv->loading -= 2;
+ g_signal_emit (self,
+ brasero_data_project_signals [PROJECT_LOADED_SIGNAL],
+ 0,
+ priv->loading);
+}
+
void
brasero_data_project_remove_node (BraseroDataProject *self,
BraseroFileNode *node)
@@ -1152,47 +1179,25 @@
priv = BRASERO_DATA_PROJECT_PRIVATE (self);
if (node->is_tmp_parent) {
- BraseroURINode *graft;
-
/* This node was created as a temporary parent, it doesn't exist
* so we replace it with a fake one. */
/* Don't exclude any URI since it doesn't exist apparently */
- /* No need to check for deep directory since that was in
- * the project as such. Keep it that way. */
-
- /* Remove 2 since we're not going to load its contents */
- priv->loading -= 2;
- g_signal_emit (self,
- brasero_data_project_signals [PROJECT_LOADED_SIGNAL],
- 0,
- priv->loading);
-
- node->is_tmp_parent = FALSE;
-
- /* make it a fake directory not to break order */
- node->is_fake = TRUE;
- node->is_loading = FALSE;
+ /* No need to check for deep directory since that was in the
+ * project as such. Keep it that way. */
- brasero_file_node_ungraft (node);
- graft = brasero_data_project_uri_ensure_graft (self, NEW_FOLDER);
- brasero_file_node_graft (node, graft);
- brasero_data_project_node_changed (self, node);
+ brasero_data_project_convert_to_fake (self, node);
return;
}
else if (priv->loading && node->is_grafted) {
- /* that means that's a grafted that failed to load decrement by 2 */
- priv->loading -= 2;
- g_signal_emit (self,
- brasero_data_project_signals [PROJECT_LOADED_SIGNAL],
- 0,
- priv->loading);
+ /* that means that's a grafted that failed to load */
+ brasero_data_project_convert_to_fake (self, node);
+ return;
}
/* check for a sibling now (before destruction) */
imported_sibling = brasero_file_node_check_imported_sibling (node);
-
brasero_data_project_remove_real (self, node);
/* add the sibling now (after destruction) */
@@ -1818,33 +1823,9 @@
if (node->is_tmp_parent) {
/* we must make sure that this is really a directory */
if (type != G_FILE_TYPE_DIRECTORY) {
- BraseroURINode *graft;
-
- /* it isn't a directory so it won't be loaded but turned
- * into a fake one. Decrement the number of loading */
- priv->loading -= 2;
- g_signal_emit (self,
- brasero_data_project_signals [PROJECT_LOADED_SIGNAL],
- 0,
- priv->loading);
-
- /* no need to check for deep directory since that was in
- * the project as such. Keep it that way. */
-
- /* make it a fake directory not to break order */
- node->is_fake = TRUE;
- node->is_loading = FALSE;
- node->is_tmp_parent = FALSE;
-
/* exclude the URI we're replacing */
brasero_data_project_exclude_uri (self, uri);
- brasero_file_node_ungraft (node);
-
- graft = brasero_data_project_uri_ensure_graft (self, NEW_FOLDER);
- brasero_file_node_graft (node, graft);
- brasero_data_project_node_changed (self, node);
-
- /* since that URI wasn't a folder no contents loading */
+ brasero_data_project_convert_to_fake (self, node);
return;
}
@@ -2954,21 +2935,34 @@
for (iter = grafts; iter; iter = iter->next) {
BraseroGraftPt *graft;
+ GFile *file;
+ gchar *uri;
graft = iter->data;
+
+ file = g_file_new_for_uri (graft->uri);
+ uri = g_file_get_uri (file);
+ g_object_unref (file);
+
folders = brasero_data_project_add_path (self,
graft->path,
- graft->uri,
+ uri,
folders);
+ g_free (uri);
}
for (iter = excluded; iter; iter = iter->next) {
gchar *uri;
+ GFile *file;
+
+ file = g_file_new_for_uri (iter->data);
+ uri = g_file_get_uri (file);
+ g_object_unref (file);
- uri = iter->data;
folders = brasero_data_project_add_excluded_uri (self,
uri,
folders);
+ g_free (uri);
}
/* Now load the temporary folders that were created */
Modified: trunk/src/brasero-data-vfs.c
==============================================================================
--- trunk/src/brasero-data-vfs.c (original)
+++ trunk/src/brasero-data-vfs.c Mon Nov 17 14:28:34 2008
@@ -385,7 +385,8 @@
/* The next graft point must be the natural parent of this one */
next = parent->parent;
- if (!next || next->is_root) {
+ if (!next || next->is_root || next->is_fake) {
+ /* It's not we're done */
g_free (parent_uri);
break;
}
@@ -811,36 +812,19 @@
priv = BRASERO_DATA_VFS_PRIVATE (self);
- if (!node->is_reloading) {
- gchar *name;
- GFile *vfs_uri;
-
- vfs_uri = g_file_new_for_uri (uri);
- name = g_file_get_basename (vfs_uri);
- g_object_unref (vfs_uri);
-
- /* NOTE and reminder names are already unescaped; the following
- * is not needed:
- * unescaped_name = g_uri_unescape_string (name, NULL); */
-
- if (!name)
- return TRUE;
-
- if (!strcmp (name, G_DIR_SEPARATOR_S)) {
- g_free (name);
-
- /* This is a root directory: we don't add it since a
- * child of the root directory can't be a root itself.
- * So we add all its contents under its parent. Remove
- * the loading node as well.
- * Be careful in the next functions not to use node. */
- brasero_data_vfs_load_directory (self, node->parent, uri);
-
- /* node was invalidated: return FALSE */
- brasero_data_project_remove_node (BRASERO_DATA_PROJECT (self), node);
- return FALSE;
- }
- g_free (name);
+ if (!node->is_reloading
+ && BRASERO_FILE_NODE_NAME (node)
+ && !strcmp (BRASERO_FILE_NODE_NAME (node), G_DIR_SEPARATOR_S)) {
+ /* This is a root directory: we don't add it since a
+ * child of the root directory can't be a root itself.
+ * So we add all its contents under its parent. Remove
+ * the loading node as well.
+ * Be careful in the next functions not to use node. */
+ brasero_data_vfs_load_directory (self, node->parent, uri);
+
+ /* node was invalidated: return FALSE */
+ brasero_data_project_remove_node (BRASERO_DATA_PROJECT (self), node);
+ return FALSE;
}
/* FIXME: we could know right from the start if that node is is_loading */
Modified: trunk/src/brasero-file-monitor.c
==============================================================================
--- trunk/src/brasero-file-monitor.c (original)
+++ trunk/src/brasero-file-monitor.c Mon Nov 17 14:28:34 2008
@@ -739,7 +739,7 @@
data.func = func;
data.results = NULL;
data.callback_data = callback_data;
- data.dev_fd = g_io_channel_unix_get_fd (priv->notify);;
+ data.dev_fd = g_io_channel_unix_get_fd (priv->notify);
g_hash_table_foreach (priv->files,
brasero_file_monitor_foreach_cancel_file_cb,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]