Read data from /tmp/names if present
authorEnrico Zini <enrico@enricozini.org>
Wed, 9 Dec 2009 22:44:11 +0000 (22:44 +0000)
committerEnrico Zini <enrico@enricozini.org>
Wed, 9 Dec 2009 22:44:11 +0000 (22:44 +0000)
src/fisheye.vala

index 99e16e4f488f469483af8e0ca85719bc3a4b9685..e8a660a9fa060369fbb67e9381c03641619568fb 100644 (file)
@@ -75,7 +75,7 @@ public class FisheyeList : Gtk.DrawingArea
        }
 
        //public virtual signal void cursor_changed ();
-       public virtual signal void row_activated(Gtk.TreePath path);
+       public signal void row_activated(Gtk.TreePath path);
 
        public FisheyeList()
        {
@@ -418,10 +418,24 @@ public class Fisheye : Gtk.Window
 
                var store = new Gtk.ListStore(1, typeof(string));
                Gtk.TreeIter iter;
-               for (int i = 0; i < 300; ++i)
+               var infd = FileStream.open("/tmp/names", "r");
+               if (infd == null)
                {
-                       store.append(out iter);
-                       store.set(iter, 0, "Antani %d".printf(i), -1);
+                       for (int i = 0; i < 300; ++i)
+                       {
+                               store.append(out iter);
+                               store.set(iter, 0, "Antani %d".printf(i), -1);
+                       }
+               } else {
+                       char buf[255];
+                       while (true)
+                       {
+                               string line = infd.gets(buf);
+                               if (line == null)
+                                       break;
+                               store.append(out iter);
+                               store.set(iter, 0, line, -1);
+                       }
                }
 
                list.set_model(store);