nemo r53 - in trunk: broker gtk uicommon
- From: arj svn gnome org
- To: svn-commits-list gnome org
- Subject: nemo r53 - in trunk: broker gtk uicommon
- Date: Tue, 8 Jan 2008 13:16:43 +0000 (GMT)
Author: arj
Date: Tue Jan 8 13:16:43 2008
New Revision: 53
URL: http://svn.gnome.org/viewvc/nemo?rev=53&view=rev
Log:
Fix search popup
- cut filename so that the box can be fixed size (needed for prev / next
- Fixed size search popup for prev/next
- Fix search results from Xesam, the ordering what funky
- fix a resize of the search result popup caused to it go to next page
- Only let left click open a search results in popup
Modified:
trunk/broker/Xesam.cs
trunk/gtk/CalendarDrawer.cs
trunk/gtk/DisplayItem.cs
trunk/gtk/FixedResizeWidget.cs
trunk/gtk/SearchPopup.cs
trunk/uicommon/DocumentItem.cs
trunk/uicommon/Item.cs
Modified: trunk/broker/Xesam.cs
==============================================================================
--- trunk/broker/Xesam.cs (original)
+++ trunk/broker/Xesam.cs Tue Jan 8 13:16:43 2008
@@ -181,6 +181,7 @@
int si = 0;
foreach (object r in result)
s[si++] = r as string;
+
if (!callbacks.ContainsKey(s[0]))
System.Console.WriteLine("warning, file not found in calllback {0}", s[0]);
else
@@ -284,28 +285,30 @@
}
System.Console.WriteLine("search metadata store for {0} files", filenames.Count);
-
- meta.get_files_from_paths(filenames, Helpers.RunInMainThread<List<File>>(delegate (List<File> files) {
-
- System.Console.WriteLine("got {0} files from metadata store", files.Count);
- int nr = 0;
-
- foreach (File file in files) {
- string[] s = new string[result[nr].Length];
- int si = 0;
- foreach (object r in result[nr])
- s[si++] = r as string;
+ meta.get_files_from_paths(filenames, Helpers.RunInMainThread<List<File>>(delegate (List<File> files) {
- nr++;
+ // we get results back from Xesam out of order
+ // we can't use filenames since mono is buggy
- results.Add(new Tuple<string[], File>(s, file));
+ foreach (object[] r in result)
+ {
+ string path = (r[0] as string).Substring(7);
+ foreach (File file in files)
+ if (file.path == path) {
+ string[] s = new string[r.Length];
+
+ int si = 0;
+ foreach (object o in r)
+ s[si++] = o as string;
+
+ results.Add(new Tuple<string[], File>(s, file));
+ break;
+ }
}
got_results = true;
- System.Console.WriteLine("no more results");
-
#if false
// We don't want more results
if (hits_added_callbacks.ContainsKey(search_id))
@@ -331,7 +334,7 @@
hits_added_callbacks.Remove(search_id);
- if (!got_results) // no results
+ if (!got_results) // no results, FIXME: not needed
callback(new List<Tuple<string[], File>>());
else
callback(results);
Modified: trunk/gtk/CalendarDrawer.cs
==============================================================================
--- trunk/gtk/CalendarDrawer.cs (original)
+++ trunk/gtk/CalendarDrawer.cs Tue Jan 8 13:16:43 2008
@@ -255,7 +255,7 @@
RightClickItemButton b = new RightClickItemButton();
b.set_item(file);
- b.Label += file.small_representation();
+ b.Label += file.name(30);
string image = item.image();
if (image != "")
b.Image = new Gtk.Image(null, image);
Modified: trunk/gtk/DisplayItem.cs
==============================================================================
--- trunk/gtk/DisplayItem.cs (original)
+++ trunk/gtk/DisplayItem.cs Tue Jan 8 13:16:43 2008
@@ -128,7 +128,7 @@
Gtk.Alignment label_alignment = new Gtk.Alignment(0F, 0.5F, 0F, 0.5F);
Gtk.Label tmp_label = new Gtk.Label();
- tmp_label.Markup = "<b>" + item.name + "</b>";
+ tmp_label.Markup = "<b>" + item.name(35) + "</b>";
tmp_label.UseUnderline = false;
label_alignment.Add(tmp_label);
tmp.PackStart(label_alignment, true, true, 0);
@@ -137,7 +137,7 @@
} else {
Gtk.Label title = new Gtk.Label();
- title.Markup = "<b>" + item.name + "</b>";
+ title.Markup = "<b>" + item.name(35) + "</b>";
box.PackStart(title, true, true, 3);
}
Modified: trunk/gtk/FixedResizeWidget.cs
==============================================================================
--- trunk/gtk/FixedResizeWidget.cs (original)
+++ trunk/gtk/FixedResizeWidget.cs Tue Jan 8 13:16:43 2008
@@ -78,7 +78,7 @@
b.Add(tmp);
} else
- b.Label = item.small_representation();
+ b.Label = item.name(25);
b.BorderWidth = 0;
b.Relief = Gtk.ReliefStyle.None;
Modified: trunk/gtk/SearchPopup.cs
==============================================================================
--- trunk/gtk/SearchPopup.cs (original)
+++ trunk/gtk/SearchPopup.cs Tue Jan 8 13:16:43 2008
@@ -48,6 +48,8 @@
public override void resize()
{
+ if (offset > 0)
+ offset = offset - last_page_size;
add_elements();
}
@@ -65,6 +67,8 @@
create_window(search_text, pos.first, pos.second);
+ popup.SetSizeRequest(444, -1);
+
int height = get_size();
int index = 0;
@@ -128,6 +132,7 @@
this.offset = offset;
add_elements();
};
+
GtkCommon.set_background_color(link_wrapper, "white");
page_navigation.PackStart(link_wrapper, false, false, 5);
}
@@ -196,6 +201,7 @@
link_wrapper.ButtonPressEvent += delegate(object sender, Gtk.ButtonPressEventArgs args) {
set_view_callback(view, item_modified_date);
};
+
GtkCommon.set_background_color(link_wrapper, "white");
links.PackStart(link_wrapper, false, false, 5);
}
@@ -209,7 +215,7 @@
Gtk.EventBox title_wrapper = new Gtk.EventBox();
Gtk.Label title = new Gtk.Label();
- string str_title = item.long_name;
+ string str_title = item.name(40);
if (str_title.Contains(search_text)) {
int index = str_title.IndexOf(search_text);
@@ -220,7 +226,8 @@
title.UseUnderline = false;
title.SetAlignment(0, 0); // left aligned
title_wrapper.ButtonPressEvent += delegate(object sender, Gtk.ButtonPressEventArgs args) {
- item.open();
+ if (args.Event.Button == 1)
+ item.open();
};
title_wrapper.Add(title);
GtkCommon.set_background_color(title_wrapper, "white");
@@ -229,12 +236,14 @@
GtkCommon.create_preview(item, lines, title_wrapper);
- title_date.PackStart(title_wrapper, true, true, 2);
+ title_date.PackStart(title_wrapper, true, true, 0);
+ Gtk.Alignment date_alignment = new Gtk.Alignment(1, 0, 0, 0);
Gtk.Label date = new Gtk.Label();
date.Markup = "<big>" + String.Format("{0:dd/MM/yy}", item.last_modify) + "</big>";
- date.SetAlignment(1, 0); // right aligned
- title_date.PackStart(date, true, true, 0);
+ date_alignment.Add(date);
+ date_alignment.LeftPadding = 10;
+ title_date.PackStart(date_alignment, true, true, 0);
lines.PackStart(title_date, true, true, 0);
@@ -297,8 +306,6 @@
if (image != "")
{
- System.Console.WriteLine("SEARCH POPUP image {0}", image);
-
Gtk.Image img;
if (item.file.starred)
Modified: trunk/uicommon/DocumentItem.cs
==============================================================================
--- trunk/uicommon/DocumentItem.cs (original)
+++ trunk/uicommon/DocumentItem.cs Tue Jan 8 13:16:43 2008
@@ -52,6 +52,7 @@
mime_type = fields[1];
set_title(fields[fields_index]);
+ set_page_count(fields[fields_index+1]);
display_item = new DisplayDocumentItem(pages, title, this);
register_starred_change(display_item.update_starred);
Modified: trunk/uicommon/Item.cs
==============================================================================
--- trunk/uicommon/Item.cs (original)
+++ trunk/uicommon/Item.cs Tue Jan 8 13:16:43 2008
@@ -41,7 +41,9 @@
public string long_name;
- public string name; // trimmed
+ string extension;
+
+// public string name; // trimmed
public string modify;
public string accessed;
@@ -54,6 +56,18 @@
public VoidFunction on_labels_callback;
public VoidFunction on_got_data_from_tracker;
+ public string name(int length)
+ {
+ string name = long_name;
+
+ if (long_name.Length-extension.Length > length) {
+ name = long_name.Substring(0, length-5);
+ name += "[...]" + extension;
+ }
+
+ return name;
+ }
+
public Item(File file)
{
this.file = file;
@@ -69,21 +83,15 @@
modify = date_to_string(file.last_modified);
accessed = date_to_string(file.last_accessed);
- name = long_name = file.path.Substring(file.path.LastIndexOf("/")+1);
+ long_name = file.path.Substring(file.path.LastIndexOf("/")+1);
- string extension = "";
int pos;
- if ((pos = name.LastIndexOf(".")) != -1)
- extension = name.Substring(pos);
+ if ((pos = long_name.LastIndexOf(".")) != -1)
+ extension = long_name.Substring(pos);
if (extension.Length > 4)
extension = extension.Substring(0, 4);
- if (name.Length-extension.Length > 35) {
- name = name.Substring(0, 35-5);
- name += "[...]" + extension;
- }
-
display_item = new DisplayItem(this);
register_starred_change(display_item.update_starred);
@@ -152,23 +160,15 @@
set_size();
- name = fields[4];
-
- long_name = name;
+ long_name = fields[4];
- string extension = "";
int pos;
- if ((pos = name.LastIndexOf(".")) != -1)
- extension = name.Substring(pos);
+ if ((pos = long_name.LastIndexOf(".")) != -1)
+ extension = long_name.Substring(pos);
if (extension.Length > 4)
extension = extension.Substring(0, 4);
- if (name.Length-extension.Length > 35) {
- name = name.Substring(0, 35-5);
- name += "[...]" + extension;
- }
-
mime_type = fields[5];
}
@@ -185,11 +185,6 @@
{
starred_update_functions.Add(update_function);
}
-
- public string small_representation()
- {
- return name;
- }
public void update_starred()
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]