/* This file is part of Cinaest. * * Copyright (C) 2009 Philipp Zabel * * Cinaest is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Cinaest is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Cinaest. If not, see . */ using Gtk; using Hildon; public class MovieListWindow : StackableWindow { private Hildon.Entry search_field; private Toolbar search_bar; construct { // View menu var menu = new MovieListMenu (); set_main_menu (menu); // Search bar search_field = new Hildon.Entry (SizeType.FINGER_HEIGHT); var search_field_item = new ToolItem (); search_field_item.set_expand (true); search_field_item.add (search_field); var close_image = new Image.from_file("/usr/share/icons/hicolor/48x48/hildon/general_close.png"); var close_button = new ToolButton (close_image, "Close"); search_bar = new Toolbar (); search_bar.insert (search_field_item, 0); search_bar.insert (close_button, 1); add_toolbar (search_bar); // Movie list - connected to menu for sorting var movie_list = new MovieListView (); menu.sortable = movie_list.sorted_store; var vbox = new VBox (false, 0); vbox.pack_start (movie_list, true, true, 0); add (vbox); // Connect signals close_button.clicked.connect (on_close_button_clicked); key_press_event.connect (on_key_press_event); search_field.set_flags (WidgetFlags.CAN_DEFAULT); search_field.grab_default (); show_all (); search_bar.hide (); } private void on_close_button_clicked () { search_field.set_text (""); search_bar.hide (); } private bool on_key_press_event (Widget widget, Gdk.EventKey event) { if (event.str != "") { if (!search_bar.visible) { search_bar.show (); } search_field.grab_focus (); } return false; } }