nemo r59 - in trunk: broker gtk uicommon
- From: arj svn gnome org
- To: svn-commits-list gnome org
- Subject: nemo r59 - in trunk: broker gtk uicommon
- Date: Wed, 9 Jan 2008 13:04:20 +0000 (GMT)
Author: arj
Date: Wed Jan 9 13:04:20 2008
New Revision: 59
URL: http://svn.gnome.org/viewvc/nemo?rev=59&view=rev
Log:
Make tracker work again
Remove some unused code
Modified:
trunk/broker/Broker.cs
trunk/broker/Tracker.cs
trunk/broker/Xesam.cs
trunk/gtk/MainWindow.cs
trunk/gtk/SearchPopup.cs
trunk/uicommon/DocumentItem.cs
trunk/uicommon/Item.cs
trunk/uicommon/PictureItem.cs
Modified: trunk/broker/Broker.cs
==============================================================================
--- trunk/broker/Broker.cs (original)
+++ trunk/broker/Broker.cs Wed Jan 9 13:04:20 2008
@@ -8,7 +8,10 @@
{
protected MetadataStore meta;
+ // comes in the following order:
+ // mime, width, height, title, page count
protected string[] registered_fields;
+ protected int registered_fields_offset;
protected Dictionary<string, string> types;
@@ -71,7 +74,7 @@
new_registered_fields[i++] = types[field];
}
- int registered_index = registered_fields.Length;
+ int registered_index = registered_fields.Length + registered_fields_offset;
registered_fields = new_registered_fields;
Modified: trunk/broker/Tracker.cs
==============================================================================
--- trunk/broker/Tracker.cs (original)
+++ trunk/broker/Tracker.cs Wed Jan 9 13:04:20 2008
@@ -41,8 +41,8 @@
public Tracker(bool reindex) : base(reindex)
{
- types.Add("height", "Image:Height");
types.Add("width", "Image:Width");
+ types.Add("height", "Image:Height");
types.Add("title", "Doc:Title");
types.Add("pagecount", "Doc:PageCount");
@@ -90,10 +90,11 @@
public override void get_metadata(List<string> filenames, Dictionary<string, VoidFunction<string[]>> callbacks)
{
+ System.Console.WriteLine("searching for metadata for {0} files", filenames.Count);
foreach (string filename in filenames) {
- string tmp_filename = filename;
+ string tmp_filename = filename; // go lambda, go
ThreadPool.QueueUserWorkItem(delegate {
- callbacks[tmp_filename](bus_metadata.Get("Files", filename, registered_fields));
+ callbacks["file://" + tmp_filename](bus_metadata.Get("Files", tmp_filename, registered_fields));
});
}
}
@@ -156,4 +157,4 @@
});
}
}
-}
+}
\ No newline at end of file
Modified: trunk/broker/Xesam.cs
==============================================================================
--- trunk/broker/Xesam.cs (original)
+++ trunk/broker/Xesam.cs Wed Jan 9 13:04:20 2008
@@ -32,8 +32,8 @@
public Xesam(bool reindex) : base(reindex)
{
- types.Add("height", "xesam:height");
types.Add("width", "xesam:width");
+ types.Add("height", "xesam:height");
types.Add("title", "xesam:title");
types.Add("pagecount", "xesam:pageCount");
@@ -53,7 +53,9 @@
bus_search.HitsAdded += hits_callback_handler;
bus_search.SearchDone += hits_done_handler;
- registered_fields = new string[] { "xesam:url", "xesam:mimeType" };
+ registered_fields = new string[] { "xesam:url", "xesam:mimeType" };
+
+ registered_fields_offset = -1; // url
supported_mimetypes = new string[] { "application/msword", "application/vnd.oasis.opendocument.text",
"application/pdf", "application/vnd.ms-excel", "application/vnd.oasis.opendocument.spreadsheet",
@@ -175,17 +177,24 @@
object[][] results = bus_search.GetHits(search_id, amount);
System.Console.WriteLine("ze hits in get metadata!");
-
+
foreach (object[] result in results) {
string[] s = new string[result.Length];
+ string filename = result[0] as string;
+
int si = 0;
+ bool first = true;
foreach (object r in result)
- s[si++] = r as string;
+ if (first) {
+ first = false;
+ continue;
+ } else
+ s[si++] = r as string;
- if (!callbacks.ContainsKey(s[0]))
+ if (!callbacks.ContainsKey(filename))
System.Console.WriteLine("warning, file not found in calllback {0}", s[0]);
else
- callbacks[s[0]](s);
+ callbacks[filename](s);
++count;
}
}));
@@ -336,8 +345,13 @@
string[] s = new string[r.Length];
int si = 0;
+ bool first = true;
foreach (object o in r)
- s[si++] = o as string;
+ if (first) {
+ first = false;
+ continue;
+ } else
+ s[si++] = o as string;
results.Add(new Tuple<string[], File>(s, file));
break;
@@ -382,4 +396,4 @@
});
}
}
-}
+}
\ No newline at end of file
Modified: trunk/gtk/MainWindow.cs
==============================================================================
--- trunk/gtk/MainWindow.cs (original)
+++ trunk/gtk/MainWindow.cs Wed Jan 9 13:04:20 2008
@@ -250,12 +250,14 @@
files.Add(file.path);
- callbacks.Add("file://" + file.path, Helpers.RunInMainThread<string[]>(delegate(string[] result) {
+ string path = file.path;
+
+ callbacks.Add("file://" + path, Helpers.RunInMainThread<string[]>(delegate(string[] result) {
// System.Console.WriteLine("results: {0}", result.Length);
-// System.Console.WriteLine("result: {0}", result[1]);
+ System.Console.WriteLine("result: {0} for {1}", result[0], path);
- if (Nemo.DocumentItem.is_document(result[1]))
+ if (Nemo.DocumentItem.is_document(result[0]))
{
Nemo.VoidFunction callback = wrapper.item.on_got_data_from_tracker;
@@ -271,7 +273,7 @@
wrapper.item.on_got_data_from_tracker();
}
}
- else if (Nemo.PictureItem.is_image(result[1]))
+ else if (Nemo.PictureItem.is_image(result[0]))
{
Nemo.VoidFunction callback = wrapper.item.on_got_data_from_tracker;
@@ -287,7 +289,7 @@
wrapper.item.on_got_data_from_tracker();
}
} else
- wrapper.item.mime_type = result[1];
+ wrapper.item.mime_type = result[0];
}));
wrapper.item.search_func = do_search;
@@ -315,16 +317,16 @@
{
Nemo.Item item;
- System.Console.WriteLine("type {0}", result.first[1]);
+ System.Console.WriteLine("type {0}", result.first[0]);
- if (DocumentItem.is_document(result.first[1]))
+ if (DocumentItem.is_document(result.first[0]))
item = new DocumentItem(result.second, result.first, search_input.Text);
- else if (PictureItem.is_image(result.first[1]))
+ else if (PictureItem.is_image(result.first[0]))
item = new PictureItem(result.second, result.first);
else
{
item = new Nemo.Item(result.second);
- item.mime_type = result.first[1];
+ item.mime_type = result.first[0];
}
item.set_file(result.second);
Modified: trunk/gtk/SearchPopup.cs
==============================================================================
--- trunk/gtk/SearchPopup.cs (original)
+++ trunk/gtk/SearchPopup.cs Wed Jan 9 13:04:20 2008
@@ -134,6 +134,8 @@
GtkCommon.show_hand_and_tooltip(link_wrapper, text);
+ System.Console.WriteLine("adding a page link: {0} with offset on click {1}", text, offset);
+
link_wrapper.Add(link);
link_wrapper.ButtonPressEvent += delegate(object sender, Gtk.ButtonPressEventArgs args) {
this.offset = offset;
Modified: trunk/uicommon/DocumentItem.cs
==============================================================================
--- trunk/uicommon/DocumentItem.cs (original)
+++ trunk/uicommon/DocumentItem.cs Wed Jan 9 13:04:20 2008
@@ -45,11 +45,12 @@
public static void set_fields_index(int index)
{
fields_index = index;
+ System.Console.WriteLine("fields index i document: {0}", fields_index);
}
private void parse_fields_and_update(string[] fields)
{
- mime_type = fields[1];
+ mime_type = fields[0];
set_title(fields[fields_index]);
set_page_count(fields[fields_index+1]);
Modified: trunk/uicommon/Item.cs
==============================================================================
--- trunk/uicommon/Item.cs (original)
+++ trunk/uicommon/Item.cs Wed Jan 9 13:04:20 2008
@@ -119,13 +119,6 @@
on_labels_callback();
}
- public Item(string path, string[] fields)
- {
- setup(path);
-
- parse_fields_and_update(fields);
- }
-
private void setup(string path)
{
// internal variables
@@ -145,40 +138,6 @@
Process.Start("'" + path + "'");
}
- protected void parse_fields(string[] fields)
- {
- long long_modify = System.Convert.ToInt64(fields[1]);
- this.last_modify = Mono.Unix.Native.NativeConvert.FromTimeT(long_modify);
-
- long long_accessed = System.Convert.ToInt64(fields[2]);
- last_accessed = Mono.Unix.Native.NativeConvert.FromTimeT(long_accessed);
-
- modify = date_to_string(last_modify);
- accessed = date_to_string(last_accessed);
-
- long_size = System.Convert.ToInt64(fields[3]);
-
- set_size();
-
- long_name = fields[4];
-
- int pos;
- if ((pos = long_name.LastIndexOf(".")) != -1)
- extension = long_name.Substring(pos);
-
- if (extension.Length > 4)
- extension = extension.Substring(0, 4);
-
- mime_type = fields[5];
- }
-
- private void parse_fields_and_update(string[] fields)
- {
- parse_fields(fields);
- display_item = new DisplayItem(this);
- register_starred_change(display_item.update_starred);
- }
-
List<VoidFunction<bool>> starred_update_functions;
public void register_starred_change(VoidFunction<bool> update_function)
Modified: trunk/uicommon/PictureItem.cs
==============================================================================
--- trunk/uicommon/PictureItem.cs (original)
+++ trunk/uicommon/PictureItem.cs Wed Jan 9 13:04:20 2008
@@ -37,11 +37,12 @@
public static void set_fields_index(int index)
{
fields_index = index;
+ System.Console.WriteLine("fields index i pictures: {0}", fields_index);
}
private void parse_fields_and_update(string[] fields)
{
- mime_type = fields[1];
+ mime_type = fields[0];
height = fields[fields_index];
width = fields[fields_index+1];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]