3 class MainWindow : Window
6 private Entry search_entry;
7 private TreeView identities_list;
11 this.title = "Moonshoot";
12 this.position = WindowPosition.CENTER;
13 set_default_size (400, 300);
19 private void search_entry_icon_press_cb ()
21 print ("Search entry icon pressed\n");
24 private void search_entry_text_changed_cb ()
26 var has_text = this.search_entry.get_text_length () > 0;
27 this.search_entry.set_icon_sensitive (EntryIconPosition.SECONDARY, has_text);
30 private void setup_identities_list ()
32 var listmodel = new ListStore (1, typeof (string)); //TODO
34 this.identities_list.set_model (listmodel);
37 private void build_ui()
39 var toolbar = new Toolbar ();
40 var open_button = new ToolButton (null, "Open"); //.from_stock (Stock.OPEN);
41 open_button.is_important = true;
42 toolbar.add (open_button);
43 //open_button.clicked.connect (on_open_clicked);
45 this.search_entry = new Entry();
46 this.search_entry.set_icon_from_icon_name (EntryIconPosition.SECONDARY, "system-search");
47 this.search_entry.set_icon_sensitive (EntryIconPosition.SECONDARY, false);
48 this.search_entry.set_icon_tooltip_text (EntryIconPosition.SECONDARY,
49 "Search identity or service");
50 this.search_entry.icon_press.connect (search_entry_icon_press_cb);
51 this.search_entry.notify["text"].connect (search_entry_text_changed_cb);
53 this.identities_list = new TreeView ();
54 this.identities_list.set_headers_visible (false);
55 setup_identities_list ();
57 var scroll = new ScrolledWindow (null, null);
58 scroll.set_policy (PolicyType.NEVER, PolicyType.AUTOMATIC);
59 scroll.set_shadow_type (ShadowType.IN);
60 scroll.add (this.identities_list);
62 var button_add = new Button.from_stock ("gtk-add");
63 var button_remove = new Button.from_stock ("gtk-remove");
64 var button_box = new HButtonBox ();
65 button_box.set_layout (ButtonBoxStyle.SPREAD);
66 button_box.pack_start (button_add, false, false, 0);
67 button_box.pack_start (button_remove, false, false, 0);
69 var vbox = new VBox (false, 0);
70 vbox.pack_start (toolbar, false, true, 0);
71 vbox.pack_start (search_entry, false, true, 0);
72 vbox.pack_start (scroll, true, true, 0);
73 vbox.pack_start (button_box, false, false, 0);
77 private void connect_signals()
79 this.destroy.connect (Gtk.main_quit);
82 public static int main(string[] args)
86 Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
87 Intl.bind_textdomain_codeset (Config.GETTEXT_PACKAGE, "UTF-8");
88 Intl.textdomain (Config.GETTEXT_PACKAGE);
90 var window = new MainWindow();