/*hello.vala compile : valac --pkg gtk+-3.0 --pkg glib-2.0 helloworld.vala */ using Gtk; using GLib; public ListStore liststore; public Builder builder; public IconView icon_view; public Gdk.Pixbuf pixbuf; public Label label1; public bool gen_list(){ var theme = new Gtk.IconTheme(); theme.set_custom_theme("ubuntu-mono-dark"); var icons=theme.list_icons(null); string[] choices={"face","stock","emblem","gnome","application"}; string[] badicons={"gnome-spinner","gnome-panel-separator"}; string[] data ={}; foreach (string icon in icons ){ foreach (string choice in choices){ if (choice in icon && !( icon in badicons) && !(icon in data)) { print(icon); data += icon; TreeIter iter; try { pixbuf = theme.load_icon(icon, 48, 0); } catch (Error e) {print(e.message);}; liststore.append (out iter); liststore.set(iter,0,pixbuf); }; }; }; label1.hide(); return false; } public static int main (string[] args) { Timeout.add_seconds(2, gen_list); Gtk.init (ref args); Gtk.Builder builder = new Gtk.Builder (); try{ builder.add_from_file ("helloworld.ui"); } catch (Error e ) { print(e.message); }; var window = builder.get_object ("window") as Gtk.Window; icon_view = builder.get_object ("iconview1") as Gtk.IconView; liststore = builder.get_object ("liststore") as Gtk.ListStore; label1 = builder.get_object("label1") as Gtk.Label; icon_view.set_pixbuf_column (0); builder.connect_signals (null); window.show_all (); Gtk.main (); return 0; }