1/* 2* Copyright (c) 2011-2013 Yorba Foundation 3* 2018 elementary LLC. (https://elementary.io) 4* 5* This program is free software; you can redistribute it and/or 6* modify it under the terms of the GNU Lesser General Public 7* License as published by the Free Software Foundation; either 8* version 2.1 of the License, or (at your option) any later version. 9* 10* This program is distributed in the hope that it will be useful, 11* but WITHOUT ANY WARRANTY; without even the implied warranty of 12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13* General Public License for more details. 14* 15* You should have received a copy of the GNU General Public 16* License along with this program; if not, write to the 17* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18* Boston, MA 02110-1301 USA 19*/ 20 21public class SearchRowModified : SearchRow { 22 private Gtk.ComboBoxText modified_context; 23 private Gtk.ComboBoxText modified_state; 24 25 public SearchRowModified (SearchRowContainer parent) { 26 Object (parent: parent); 27 28 modified_context = new Gtk.ComboBoxText (); 29 modified_context.append_text (_ ("has")); 30 modified_context.append_text (_ ("has no")); 31 modified_context.set_active (0); 32 modified_context.changed.connect (on_changed); 33 34 modified_state = new Gtk.ComboBoxText (); 35 modified_state.append_text (_ ("modifications")); 36 modified_state.append_text (_ ("internal modifications")); 37 modified_state.append_text (_ ("external modifications")); 38 modified_state.set_active (0); 39 modified_state.changed.connect (on_changed); 40 41 add (modified_context); 42 add (modified_state); 43 show_all (); 44 } 45 46 ~SearchRowModified () { 47 modified_state.changed.disconnect (on_changed); 48 modified_context.changed.disconnect (on_changed); 49 } 50 51 public override SearchCondition get_search_condition () { 52 SearchCondition.SearchType search_type = parent.get_search_type (); 53 SearchConditionModified.Context context = (SearchConditionModified.Context) modified_context.get_active (); 54 SearchConditionModified.State state = (SearchConditionModified.State) modified_state.get_active (); 55 SearchConditionModified c = new SearchConditionModified (search_type, context, state); 56 return c; 57 } 58 59 public override void populate (SearchCondition sc) { 60 SearchConditionModified? scm = sc as SearchConditionModified; 61 assert (scm != null); 62 modified_state.set_active (scm.state); 63 modified_context.set_active (scm.context); 64 } 65 66 public override bool is_complete () { 67 return true; 68 } 69 70 private void on_changed () { 71 parent.changed (parent); 72 } 73} 74