nemo r39 - in trunk: . broker gtk gtk-gui metadata uicommon
- From: arj svn gnome org
- To: svn-commits-list gnome org
- Subject: nemo r39 - in trunk: . broker gtk gtk-gui metadata uicommon
- Date: Mon, 7 Jan 2008 11:00:40 +0000 (GMT)
Author: arj
Date: Mon Jan 7 11:00:40 2008
New Revision: 39
URL: http://svn.gnome.org/viewvc/nemo?rev=39&view=rev
Log:
Add indexing dialog
Added:
trunk/gtk-gui/Nemo.Indexing.cs
trunk/gtk/Indexing.cs
Modified:
trunk/NEWS
trunk/broker/Xesam.cs
trunk/gtk-gui/MainWindow.cs
trunk/gtk-gui/gui.stetic
trunk/gtk/Tray.cs
trunk/metadata/MetadataStore.cs
trunk/nemo.mdp
trunk/uicommon/CalendarDriver.cs
trunk/uicommon/Categories.cs
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Mon Jan 7 11:00:40 2008
@@ -9,6 +9,7 @@
- Don't do needless searching for text and handle the case of empty
search text
- Make add label menu look better when the item has no labels already
+- Add indexing dialog
0.1.2 alpha
-----------
Modified: trunk/broker/Xesam.cs
==============================================================================
--- trunk/broker/Xesam.cs (original)
+++ trunk/broker/Xesam.cs Mon Jan 7 11:00:40 2008
@@ -49,7 +49,7 @@
ObjectPath opath = new ObjectPath("/org/freedesktop/xesam/searcher/main");
bus_search = con.GetObject<IXesamSearch>("org.freedesktop.xesam.searcher", opath);
-
+
bus_search.HitsAdded += hits_callback_handler;
bus_search.SearchDone += hits_done_handler;
Modified: trunk/gtk-gui/MainWindow.cs
==============================================================================
--- trunk/gtk-gui/MainWindow.cs (original)
+++ trunk/gtk-gui/MainWindow.cs Mon Jan 7 11:00:40 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);
Added: trunk/gtk-gui/Nemo.Indexing.cs
==============================================================================
--- (empty file)
+++ trunk/gtk-gui/Nemo.Indexing.cs Mon Jan 7 11:00:40 2008
@@ -0,0 +1,120 @@
+// ------------------------------------------------------------------------------
+// <autogenerated>
+// This code was generated by a tool.
+// Mono Runtime Version: 2.0.50727.42
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </autogenerated>
+// ------------------------------------------------------------------------------
+
+namespace Nemo {
+
+
+ public partial class Indexing {
+
+ private Gtk.HBox hbox1;
+
+ private Gtk.Label label22;
+
+ private Gtk.Label indexer_status;
+
+ private Gtk.ScrolledWindow GtkScrolledWindow;
+
+ private Gtk.TextView log_text_view;
+
+ private Gtk.Button buttonCancel;
+
+ private Gtk.Button buttonOk;
+
+ protected virtual void Build() {
+ Stetic.Gui.Initialize(this);
+ // Widget Nemo.Indexing
+ this.Name = "Nemo.Indexing";
+ this.Title = Mono.Unix.Catalog.GetString("Indexing status");
+ this.WindowPosition = ((Gtk.WindowPosition)(4));
+ this.HasSeparator = false;
+ // Internal child Nemo.Indexing.VBox
+ Gtk.VBox w1 = this.VBox;
+ w1.Name = "dialog1_VBox";
+ w1.BorderWidth = ((uint)(2));
+ // Container child dialog1_VBox.Gtk.Box+BoxChild
+ this.hbox1 = new Gtk.HBox();
+ this.hbox1.Name = "hbox1";
+ this.hbox1.Spacing = 6;
+ // Container child hbox1.Gtk.Box+BoxChild
+ this.label22 = new Gtk.Label();
+ this.label22.Name = "label22";
+ this.label22.Xalign = 1F;
+ this.label22.LabelProp = Mono.Unix.Catalog.GetString("Indexer:");
+ this.hbox1.Add(this.label22);
+ Gtk.Box.BoxChild w2 = ((Gtk.Box.BoxChild)(this.hbox1[this.label22]));
+ w2.Position = 0;
+ // Container child hbox1.Gtk.Box+BoxChild
+ this.indexer_status = new Gtk.Label();
+ this.indexer_status.Name = "indexer_status";
+ this.indexer_status.Xalign = 0F;
+ this.indexer_status.LabelProp = Mono.Unix.Catalog.GetString("Idle");
+ this.hbox1.Add(this.indexer_status);
+ Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.hbox1[this.indexer_status]));
+ w3.Position = 1;
+ w1.Add(this.hbox1);
+ Gtk.Box.BoxChild w4 = ((Gtk.Box.BoxChild)(w1[this.hbox1]));
+ w4.Position = 0;
+ w4.Expand = false;
+ w4.Fill = false;
+ // Container child dialog1_VBox.Gtk.Box+BoxChild
+ this.GtkScrolledWindow = new Gtk.ScrolledWindow();
+ this.GtkScrolledWindow.Name = "GtkScrolledWindow";
+ this.GtkScrolledWindow.ShadowType = ((Gtk.ShadowType)(1));
+ // Container child GtkScrolledWindow.Gtk.Container+ContainerChild
+ this.log_text_view = new Gtk.TextView();
+ this.log_text_view.CanFocus = true;
+ this.log_text_view.Name = "log_text_view";
+ this.log_text_view.Editable = false;
+ this.log_text_view.CursorVisible = false;
+ this.GtkScrolledWindow.Add(this.log_text_view);
+ w1.Add(this.GtkScrolledWindow);
+ Gtk.Box.BoxChild w6 = ((Gtk.Box.BoxChild)(w1[this.GtkScrolledWindow]));
+ w6.Position = 1;
+ // Internal child Nemo.Indexing.ActionArea
+ Gtk.HButtonBox w7 = this.ActionArea;
+ w7.Name = "dialog1_ActionArea";
+ w7.Spacing = 6;
+ w7.BorderWidth = ((uint)(5));
+ w7.LayoutStyle = ((Gtk.ButtonBoxStyle)(4));
+ // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild
+ this.buttonCancel = new Gtk.Button();
+ this.buttonCancel.CanDefault = true;
+ this.buttonCancel.CanFocus = true;
+ this.buttonCancel.Name = "buttonCancel";
+ this.buttonCancel.UseUnderline = true;
+ this.buttonCancel.Label = Mono.Unix.Catalog.GetString("Full reindex");
+ this.AddActionWidget(this.buttonCancel, -6);
+ Gtk.ButtonBox.ButtonBoxChild w8 = ((Gtk.ButtonBox.ButtonBoxChild)(w7[this.buttonCancel]));
+ w8.Expand = false;
+ w8.Fill = false;
+ // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild
+ this.buttonOk = new Gtk.Button();
+ this.buttonOk.CanDefault = true;
+ this.buttonOk.CanFocus = true;
+ this.buttonOk.Name = "buttonOk";
+ this.buttonOk.UseStock = true;
+ this.buttonOk.UseUnderline = true;
+ this.buttonOk.Label = "gtk-ok";
+ this.AddActionWidget(this.buttonOk, -5);
+ Gtk.ButtonBox.ButtonBoxChild w9 = ((Gtk.ButtonBox.ButtonBoxChild)(w7[this.buttonOk]));
+ w9.Position = 1;
+ w9.Expand = false;
+ w9.Fill = false;
+ if ((this.Child != null)) {
+ this.Child.ShowAll();
+ }
+ this.DefaultWidth = 400;
+ this.DefaultHeight = 300;
+ this.Show();
+ this.buttonCancel.Clicked += new System.EventHandler(this.OnFullIndexClick);
+ this.buttonOk.Clicked += new System.EventHandler(this.OnOkClicked);
+ }
+ }
+}
Modified: trunk/gtk-gui/gui.stetic
==============================================================================
--- trunk/gtk-gui/gui.stetic (original)
+++ trunk/gtk-gui/gui.stetic Mon Jan 7 11:00:40 2008
@@ -398,4 +398,115 @@
</widget>
</child>
</widget>
+ <widget class="Gtk.Dialog" id="Nemo.Indexing" design-size="400 300">
+ <property name="MemberName" />
+ <property name="Title" translatable="yes">Indexing status</property>
+ <property name="WindowPosition">CenterOnParent</property>
+ <property name="Buttons">2</property>
+ <property name="HelpButton">False</property>
+ <property name="HasSeparator">False</property>
+ <child internal-child="VBox">
+ <widget class="Gtk.VBox" id="dialog1_VBox">
+ <property name="MemberName" />
+ <property name="BorderWidth">2</property>
+ <child>
+ <widget class="Gtk.HBox" id="hbox1">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <widget class="Gtk.Label" id="label22">
+ <property name="MemberName" />
+ <property name="Xalign">1</property>
+ <property name="LabelProp" translatable="yes">Indexer:</property>
+ </widget>
+ <packing>
+ <property name="Position">0</property>
+ <property name="AutoSize">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Label" id="indexer_status">
+ <property name="MemberName" />
+ <property name="Xalign">0</property>
+ <property name="LabelProp" translatable="yes">Idle</property>
+ </widget>
+ <packing>
+ <property name="Position">1</property>
+ <property name="AutoSize">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="Position">0</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.ScrolledWindow" id="GtkScrolledWindow">
+ <property name="MemberName" />
+ <property name="ShadowType">In</property>
+ <child>
+ <widget class="Gtk.TextView" id="log_text_view">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="ShowScrollbars">True</property>
+ <property name="Editable">False</property>
+ <property name="CursorVisible">False</property>
+ <property name="Text" translatable="yes" />
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="Position">1</property>
+ <property name="AutoSize">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ <child internal-child="ActionArea">
+ <widget class="Gtk.HButtonBox" id="dialog1_ActionArea">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <property name="BorderWidth">5</property>
+ <property name="Size">2</property>
+ <property name="LayoutStyle">End</property>
+ <child>
+ <widget class="Gtk.Button" id="buttonCancel">
+ <property name="MemberName" />
+ <property name="CanDefault">True</property>
+ <property name="CanFocus">True</property>
+ <property name="Type">TextOnly</property>
+ <property name="Label" translatable="yes">Full reindex</property>
+ <property name="UseUnderline">True</property>
+ <property name="ResponseId">-6</property>
+ <signal name="Clicked" handler="OnFullIndexClick" />
+ </widget>
+ <packing>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Button" id="buttonOk">
+ <property name="MemberName" />
+ <property name="CanDefault">True</property>
+ <property name="CanFocus">True</property>
+ <property name="UseStock">True</property>
+ <property name="Type">StockItem</property>
+ <property name="StockId">gtk-ok</property>
+ <property name="ResponseId">-5</property>
+ <signal name="Clicked" handler="OnOkClicked" />
+ <property name="label">gtk-ok</property>
+ </widget>
+ <packing>
+ <property name="Position">1</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
</stetic-interface>
\ No newline at end of file
Added: trunk/gtk/Indexing.cs
==============================================================================
--- (empty file)
+++ trunk/gtk/Indexing.cs Mon Jan 7 11:00:40 2008
@@ -0,0 +1,42 @@
+using System;
+using Gtk;
+
+namespace Nemo
+{
+ public partial class Indexing : Gtk.Dialog
+ {
+ public Indexing()
+ {
+ this.Build();
+ this.Hide(); // not show the on creation, since we can add text before we show the screen
+
+ buffer = new Gtk.TextBuffer(new TextTagTable());
+ log_text_view.Buffer = buffer;
+ }
+
+ Gtk.TextBuffer buffer;
+
+ public void add_text(string text)
+ {
+ buffer.Insert(buffer.StartIter, text);
+ }
+
+ public void change_status(bool status)
+ {
+ if (status)
+ this.indexer_status.Text = "running";
+ else
+ this.indexer_status.Text = "idle";
+ }
+
+ protected virtual void OnOkClicked (object sender, System.EventArgs e)
+ {
+ this.Hide();
+ }
+
+ protected virtual void OnFullIndexClick (object sender, System.EventArgs e)
+ {
+ Singleton<SingletonWrapper<Broker>>.Instance.wrapped.reindex_metadata_store();
+ }
+ }
+}
Modified: trunk/gtk/Tray.cs
==============================================================================
--- trunk/gtk/Tray.cs (original)
+++ trunk/gtk/Tray.cs Mon Jan 7 11:00:40 2008
@@ -64,6 +64,12 @@
}
};
+ ImageMenuItem menuPopup0 = new ImageMenuItem(Mono.Unix.Catalog.GetString("Indexing status"));
+ popupMenu.Add(menuPopup0);
+ menuPopup0.Activated += delegate {
+ Singleton<Indexing>.Instance.Show();
+ };
+
ImageMenuItem menuPopup2 = new ImageMenuItem(Mono.Unix.Catalog.GetString("About"));
menuPopup2.Image = new Image(Stock.About, IconSize.Menu);
popupMenu.Add(menuPopup2);
Modified: trunk/metadata/MetadataStore.cs
==============================================================================
--- trunk/metadata/MetadataStore.cs (original)
+++ trunk/metadata/MetadataStore.cs Mon Jan 7 11:00:40 2008
@@ -193,6 +193,8 @@
{
watcher = new FileSystemWatcher(watch_path);
+ System.Console.WriteLine("watching dir {0}", watch_path);
+
watcher.IncludeSubdirectories = true;
watcher.NotifyFilter = //NotifyFilters.CreationTime |
NotifyFilters.FileName | NotifyFilters.LastAccess |
@@ -233,6 +235,10 @@
public void sync_with_filesystem()
{
+ Helpers.RunInMainThread(delegate {
+ Singleton<Indexing>.Instance.change_status(true);
+ })();
+
add_low_priority_db_work(delegate {
db_sync_with_filesystem(watch_path);
} );
@@ -407,8 +413,6 @@
// db updater thread
private void db_runner()
{
- System.Console.WriteLine("db updater {0}", System.Threading.Thread.CurrentThread.ManagedThreadId);
-
database = new SqliteDatabase(database_dir);
while (true) {
@@ -426,6 +430,7 @@
if (database_work_count > 0) {
database_work_count -= 1;
System.Threading.Thread.Sleep(25); // ms
+ continue;
}
lock (background_db_work) {
@@ -436,10 +441,10 @@
}
}
- if (item != null)
- item();
- else if (stop_db_runner)
+ if (stop_db_runner)
break;
+ else if (item != null)
+ item();
bool work_surely_queued = false;
lock (db_work) {
@@ -487,11 +492,20 @@
bool id_found = false;
long id = database.get_file_id(path, out id_found);
- if (id_found)
+ if (id_found)
+ {
+ Helpers.RunInMainThread(delegate {
+ Singleton<Indexing>.Instance.add_text(String.Format("file updated {0}\n", path));
+ })();
// update database
database.update_file(id, path, f.LastAccessTimeUtc,
f.LastWriteTimeUtc, f.Length, filetype_id);
- else {
+ }
+ else
+ {
+ Helpers.RunInMainThread(delegate {
+ Singleton<Indexing>.Instance.add_text(String.Format("file added {0}\n", path));
+ })();
database.add_file(path, f.LastAccessTimeUtc,
f.LastWriteTimeUtc, f.Length, filetype_id);
db_trigger_type_labels_changed();
@@ -519,6 +533,10 @@
try {
bool was_in_query = database.file_path_is_in_query(path, current_query);
+ Helpers.RunInMainThread(delegate {
+ Singleton<Indexing>.Instance.add_text(String.Format("file deleted {0}\n", path));
+ })();
+
// update database
database.delete_file(path);
@@ -553,6 +571,10 @@
bool id_found = false;
long id = database.get_file_id(e.OldFullPath, out id_found);
if (id_found) {
+ Helpers.RunInMainThread(delegate {
+ Singleton<Indexing>.Instance.add_text(
+ String.Format("file renamed from {0} to {1}\n", e.OldFullPath, e.FullPath));
+ })();
database.rename_file(id, e.FullPath);
database.update_type_for_file(id, db_determine_filetype_id(e.FullPath));
}
@@ -785,7 +807,7 @@
{
// fix files in this dir
if (db_sync_directory_with_filesystem(directory_path)) // inserted
- database_work_count = 24; // * 25 ms
+ database_work_count = 20; // * 25 ms = 500 ms
// then recurse
string[] subdirs = Directory.GetDirectories(directory_path);
@@ -803,7 +825,11 @@
}
// finished indexing
- // if (dir_sync_count == 0)
+ if (dir_sync_count == 0) {
+ Helpers.RunInMainThread(delegate {
+ Singleton<Indexing>.Instance.change_status(false);
+ })();
+ }
}
private long db_determine_filetype_id(string path)
@@ -865,19 +891,15 @@
public void start_transaction()
{
- if (current_transaction != null) {
- System.Console.WriteLine("double begin transaction");
- throw new Exception("die");
- }
+ if (current_transaction != null)
+ throw new Exception("double transaction start in metadata store");
- 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;
}
@@ -917,7 +939,7 @@
cmd.CommandText += "create index labels_label_index on labels(label);";
cmd.CommandText += "create index labels_parent_index on labels(parent);";
- cmd.CommandText += "insert into labels values (0, " + Mono.Unix.Catalog.GetString("All") + ", 1, -1, 1);";
+ cmd.CommandText += String.Format("insert into labels values (0, \"{0}\", 1, -1, 1);", Mono.Unix.Catalog.GetString("All"));
cmd.CommandText += "create table label_colors ("
+ "id integer primary key, "
@@ -1088,7 +1110,6 @@
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("updating {0}", path);
cmd.ExecuteNonQuery();
}
}
Modified: trunk/nemo.mdp
==============================================================================
--- trunk/nemo.mdp (original)
+++ trunk/nemo.mdp Mon Jan 7 11:00:40 2008
@@ -101,6 +101,8 @@
<File name="broker/Tracker.cs" subtype="Code" buildaction="Compile" />
<File name="broker/Xesam.cs" subtype="Code" buildaction="Compile" />
<File name="dbus/GLib.cs" subtype="Code" buildaction="Compile" />
+ <File name="gtk/Indexing.cs" subtype="Code" buildaction="Compile" />
+ <File name="gtk-gui/Nemo.Indexing.cs" subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
@@ -115,6 +117,7 @@
<ProjectReference type="Gac" localcopy="True" refto="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<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" />
+ <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
</References>
<GtkDesignInfo gtkVersion="2.10.2" />
<MonoDevelop.Autotools.MakefileInfo RelativeMakefileName="./Makefile">
Modified: trunk/uicommon/CalendarDriver.cs
==============================================================================
--- trunk/uicommon/CalendarDriver.cs (original)
+++ trunk/uicommon/CalendarDriver.cs Mon Jan 7 11:00:40 2008
@@ -19,7 +19,6 @@
drawer = d;
drawer.update_view = update_view;
drawer.update_view_set_next = update_view_set_next;
- System.Console.WriteLine("set update view set next ok");
calendar = new System.Globalization.GregorianCalendar();
set_default_state();
}
Modified: trunk/uicommon/Categories.cs
==============================================================================
--- trunk/uicommon/Categories.cs (original)
+++ trunk/uicommon/Categories.cs Mon Jan 7 11:00:40 2008
@@ -82,7 +82,7 @@
private void got_labels(List<MetaLabel> labels)
{
- System.Console.WriteLine("got labels!! {0}", labels.Count);
+ System.Console.WriteLine("got labels in categories {0}", labels.Count);
categories.Clear();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]