nemo r16 - in trunk: . common gtk-gui metadata
- From: arj svn gnome org
- To: svn-commits-list gnome org
- Subject: nemo r16 - in trunk: . common gtk-gui metadata
- Date: Mon, 7 Jan 2008 10:32:29 +0000 (GMT)
Author: arj
Date: Mon Jan 7 10:32:28 2008
New Revision: 16
URL: http://svn.gnome.org/viewvc/nemo?rev=16&view=rev
Log:
Fix indexing so it doesn't kill the machine
Modified:
trunk/NEWS
trunk/common/Common.cs
trunk/gtk-gui/MainWindow.cs
trunk/metadata/MetadataStore.cs
trunk/nemo.mdp
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Mon Jan 7 10:32:28 2008
@@ -2,6 +2,7 @@
---
- Support Beagle through the Xesam adaptor
+- Fix indexing so it doesn't kill the machine
0.1.2 alpha
-----------
Modified: trunk/common/Common.cs
==============================================================================
--- trunk/common/Common.cs (original)
+++ trunk/common/Common.cs Mon Jan 7 10:32:28 2008
@@ -147,7 +147,7 @@
while (i.MoveNext()) {
status = i.Current;
if (!status)
- break;
+ break;
}
return status;
Modified: trunk/gtk-gui/MainWindow.cs
==============================================================================
--- trunk/gtk-gui/MainWindow.cs (original)
+++ trunk/gtk-gui/MainWindow.cs Mon Jan 7 10:32:28 2008
@@ -237,14 +237,14 @@
this.prev_button.UseUnderline = true;
// Container child prev_button.Gtk.Container+ContainerChild
Gtk.Alignment w22 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
- // Container child GtkAlignment1.Gtk.Container+ContainerChild
+ // Container child GtkAlignment.Gtk.Container+ContainerChild
Gtk.HBox w23 = new Gtk.HBox();
w23.Spacing = 2;
- // Container child GtkHBox1.Gtk.Container+ContainerChild
+ // Container child GtkHBox.Gtk.Container+ContainerChild
Gtk.Image w24 = new Gtk.Image();
w24.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-go-back", Gtk.IconSize.Menu, 16);
w23.Add(w24);
- // Container child GtkHBox1.Gtk.Container+ContainerChild
+ // Container child GtkHBox.Gtk.Container+ContainerChild
Gtk.Label w26 = new Gtk.Label();
w26.LabelProp = "";
w23.Add(w26);
@@ -262,14 +262,14 @@
this.next_button.UseUnderline = true;
// Container child next_button.Gtk.Container+ContainerChild
Gtk.Alignment w31 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
- // Container child GtkAlignment2.Gtk.Container+ContainerChild
+ // Container child GtkAlignment.Gtk.Container+ContainerChild
Gtk.HBox w32 = new Gtk.HBox();
w32.Spacing = 2;
- // Container child GtkHBox2.Gtk.Container+ContainerChild
+ // Container child GtkHBox.Gtk.Container+ContainerChild
Gtk.Image w33 = new Gtk.Image();
w33.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-go-forward", Gtk.IconSize.Menu, 16);
w32.Add(w33);
- // Container child GtkHBox2.Gtk.Container+ContainerChild
+ // Container child GtkHBox.Gtk.Container+ContainerChild
Gtk.Label w35 = new Gtk.Label();
w35.LabelProp = "";
w32.Add(w35);
Modified: trunk/metadata/MetadataStore.cs
==============================================================================
--- trunk/metadata/MetadataStore.cs (original)
+++ trunk/metadata/MetadataStore.cs Mon Jan 7 10:32:28 2008
@@ -141,6 +141,7 @@
this.watch_path = new FileInfo(watch_path).FullName;
current_query = null;
query_result_update_timer = null;
+ database_work_count = 0;
excludes = Singleton<Configuration>.Instance.data.exclude_files.Split(' ');
includes = Singleton<Configuration>.Instance.data.include_files.Split(' ');
@@ -151,7 +152,7 @@
private bool filename_is_good(string filename)
{
bool found = false;
-
+
foreach (string v in includes)
if (filename.EndsWith(v)) {
found = true;
@@ -231,7 +232,9 @@
public void sync_with_filesystem()
{
- add_low_priority_db_work(delegate { db_sync_with_filesystem(watch_path); } );
+ add_low_priority_db_work(delegate {
+ db_sync_with_filesystem(watch_path);
+ } );
}
// set query to use for query_changed event, note DON'T touch the query
@@ -424,8 +427,16 @@
db_work.RemoveFirst();
}
}
+
+
if (item == null) {
+
+ if (database_work_count > 0) {
+ database_work_count -= 1;
+ System.Threading.Thread.Sleep(25); // ms
+ }
+
lock (background_db_work) {
if (background_db_work.Count > 0) {
item = background_db_work.First.Value;
@@ -700,7 +711,7 @@
type_labels_changed_callback(database.get_used_file_type_categories());
}
- private void db_sync_directory_with_filesystem(string directory_path)
+ private bool db_sync_directory_with_filesystem(string directory_path)
{
// get filesystem files and database files
string[] files = new string[0];
@@ -757,6 +768,12 @@
moredb = idb.MoveNext();
}
+ bool inserted = delete_files.Count > 0 || add_files.Count > 0 || update_files.Count > 0;
+
+ // performance
+ if (inserted)
+ database.start_transaction();
+
// and action!
foreach (string file in delete_files)
db_handle_delete(file);
@@ -766,18 +783,24 @@
foreach (string file in update_files)
db_handle_change(file);
+
+ dir_sync_count -= 1;
+
+ if (inserted)
+ database.end_transaction();
+
+ return inserted;
}
+
+ static int dir_sync_count = 0;
+ int database_work_count;
private void db_sync_with_filesystem(string directory_path)
{
- // performance
- database.start_transaction();
-
// fix files in this dir
- db_sync_directory_with_filesystem(directory_path);
+ if (db_sync_directory_with_filesystem(directory_path)) // inserted
+ database_work_count = 24; // * 25 ms
- database.end_transaction();
-
// then recurse
string[] subdirs = Directory.GetDirectories(directory_path);
foreach (string subdir in subdirs) {
@@ -787,9 +810,14 @@
string tmp_subdir = subdir;
- if ((System.IO.File.GetAttributes(subdir) & FileAttributes.ReparsePoint) != FileAttributes.ReparsePoint)
+ if ((System.IO.File.GetAttributes(subdir) & FileAttributes.ReparsePoint) != FileAttributes.ReparsePoint) {
add_low_priority_db_work(delegate() { db_sync_with_filesystem(tmp_subdir); } );
+ dir_sync_count += 1;
+ }
}
+
+ // finished indexing
+ // if (dir_sync_count == 0)
}
private long db_determine_filetype_id(string path)
@@ -852,12 +880,14 @@
throw new Exception("die");
}
+ System.Console.WriteLine("begin transaction");
current_transaction = db_connection.BeginTransaction();
}
public void end_transaction()
{
if (current_transaction != null) {
+ System.Console.WriteLine("closing transaction");
current_transaction.Commit();
current_transaction = null;
}
@@ -1033,7 +1063,7 @@
add_par(cmd, "@last_modified", DbType.Int64, last_modified.ToFileTime());
add_par(cmd, "@size", DbType.Int64, size);
add_par(cmd, "@filetype_id", DbType.Int64, filetype_id);
- System.Console.WriteLine("inserting {0}", path);
+// System.Console.WriteLine("inserting {0}", path);
cmd.ExecuteNonQuery();
}
}
Modified: trunk/nemo.mdp
==============================================================================
--- trunk/nemo.mdp (original)
+++ trunk/nemo.mdp Mon Jan 7 10:32:28 2008
@@ -115,6 +115,7 @@
<ProjectReference type="Gac" localcopy="True" refto="glade-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<ProjectReference type="Gac" localcopy="True" refto="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
</References>
+ <GtkDesignInfo gtkVersion="2.10.2" />
<MonoDevelop.Autotools.MakefileInfo RelativeMakefileName="./Makefile">
<BuildFilesVar />
<DeployFilesVar />
@@ -124,5 +125,4 @@
<AsmRefVar />
<ProjectRefVar />
</MonoDevelop.Autotools.MakefileInfo>
- <GtkDesignInfo gtkVersion="2.10.2" />
</Project>
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]