[mistelix] Only preview of visible items and fixes keyboard navigation on dir tree
- From: Jordi Mas <jmas src gnome org>
- To: svn-commits-list gnome org
- Subject: [mistelix] Only preview of visible items and fixes keyboard navigation on dir tree
- Date: Tue, 19 May 2009 08:58:55 -0400 (EDT)
commit 16a7def2048d7ee512fb3bae37716bb37fcbf5ce
Author: Jordi Mas <jmas softcatala org>
Date: Tue May 19 14:58:52 2009 +0200
Only preview of visible items and fixes keyboard navigation on dir tree
---
src/widgets/DirectoryView.cs | 18 ++++++------------
src/widgets/SlideShowImageView.cs | 31 +++++++++++++++++++++++++++++--
2 files changed, 35 insertions(+), 14 deletions(-)
diff --git a/src/widgets/DirectoryView.cs b/src/widgets/DirectoryView.cs
index 6b35221..bda2740 100644
--- a/src/widgets/DirectoryView.cs
+++ b/src/widgets/DirectoryView.cs
@@ -78,10 +78,9 @@ namespace Mistelix.Widgets
//
public class DirectoryView
{
- const int COL_PATH = 0;
- const int COL_DISPLAY_NAME = 1;
- const int COL_PIXBUF = 2;
- const int COL_IS_DIRECTORY = 3;
+ const int COL_DISPLAY_NAME = 0;
+ const int COL_PIXBUF = 1;
+ const int COL_PATH = 2;
DirectoryInfo current;
TreeStore tree_store;
@@ -160,8 +159,8 @@ namespace Mistelix.Widgets
TreeStore CreateTreeStore ()
{
- // path, name, pixbuf, is_dir
- TreeStore store = new TreeStore (typeof (string), typeof (string), typeof (Gdk.Pixbuf), typeof (bool));
+ // name, path, pixbuf, is_dir
+ TreeStore store = new TreeStore (typeof (string), typeof (Gdk.Pixbuf), typeof (string));
return store;
}
@@ -178,7 +177,7 @@ namespace Mistelix.Widgets
if (di.Name.StartsWith ("."))
continue;
- tree_store.AppendValues (di.FullName, di.Name, dir_icon, true);
+ tree_store.AppendValues (di.Name, dir_icon, di.FullName);
}
}
@@ -187,11 +186,6 @@ namespace Mistelix.Widgets
TreeIter iter;
tree_store.GetIter (out iter, args.Path);
string path = (string) tree_store.GetValue (iter, COL_PATH);
- bool isDir = (bool) tree_store.GetValue (iter, COL_IS_DIRECTORY);
-
- if (!isDir)
- return;
-
ProcessNewDirectory (path);
}
diff --git a/src/widgets/SlideShowImageView.cs b/src/widgets/SlideShowImageView.cs
index 1ea5ce7..f12c368 100644
--- a/src/widgets/SlideShowImageView.cs
+++ b/src/widgets/SlideShowImageView.cs
@@ -371,6 +371,26 @@ namespace Mistelix.Widgets
ChangeEvent (this, new ShowImageSelectionEventArgs (images));
}
+ bool IsIterVisible (Gtk.TreeIter iter_visible)
+ {
+ TreePath start, end, cur;
+ TreeIter iter;
+
+ GetVisibleRange (out start, out end);
+
+ if (!store.GetIter (out iter, start))
+ return false;
+
+ do {
+ cur = store.GetPath (iter);
+ if (iter.Equals (iter_visible))
+ return true;
+
+ } while (!cur.Equals (end) && store.IterNext (ref iter));
+
+ return false;
+ }
+
void DoWork (object sender, DoWorkEventArgs e)
{
Logger.Debug ("SlideShowImageView.Dowork start");
@@ -387,8 +407,8 @@ namespace Mistelix.Widgets
iters_list.RemoveAt (0);
}
- SlideImage image = (SlideImage) store.GetValue (iter, COL_OBJECT);
- string filename = image.image;
+ SlideImage image;
+ string filename;
DataImageSurface prev_image;
DataImageSurface cairo_image;
@@ -397,6 +417,13 @@ namespace Mistelix.Widgets
if (prev_image != null) {
continue;
}
+
+ // Discard not visible items
+ if (IsIterVisible (iter) == false)
+ continue;
+
+ image = (SlideImage) store.GetValue (iter, COL_OBJECT);
+ filename = image.image;
cairo_image = image.GetThumbnail (thumbnail_width, thumbnail_height);
Application.Invoke (delegate { store.SetValue (iter, COL_CAIROIMAGE, cairo_image); });
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]