| 1 | /* builderslist.vala |
|---|
| 2 | * |
|---|
| 3 | * Copyright (C) 2010 Matias De la Puente |
|---|
| 4 | * |
|---|
| 5 | * This program is free software: you can redistribute it and/or modify |
|---|
| 6 | * it under the terms of the GNU General Public License as published by |
|---|
| 7 | * the Free Software Foundation, either version 3 of the License, or |
|---|
| 8 | * (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 |
|---|
| 13 | * GNU General Public License for more details. |
|---|
| 14 | * |
|---|
| 15 | * You should have received a copy of the GNU General Public License |
|---|
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 17 | * |
|---|
| 18 | * Author: |
|---|
| 19 | * Matias De la Puente <mfpuente.ar@gmail.com> |
|---|
| 20 | */ |
|---|
| 21 | using Gtk; |
|---|
| 22 | |
|---|
| 23 | public class I4uc.GtkFrontend.BuildersList : Gtk.VBox, I4uc.Core.BuildersList |
|---|
| 24 | { |
|---|
| 25 | private ItemsCombo _builders_combo = new ItemsCombo (_("Builder:")); |
|---|
| 26 | private ItemsCombo _device_types_combo = new ItemsCombo (_("Device type:")); |
|---|
| 27 | private ItemsCombo _devices_combo = new ItemsCombo (_("Device:")); |
|---|
| 28 | private Entry _extra_options_entry = new Entry (); |
|---|
| 29 | |
|---|
| 30 | public string current_builder |
|---|
| 31 | { |
|---|
| 32 | set { _builders_combo.current_item = value; } |
|---|
| 33 | get { return _builders_combo.current_item; } |
|---|
| 34 | } |
|---|
| 35 | |
|---|
| 36 | public string current_device_type |
|---|
| 37 | { |
|---|
| 38 | set { _device_types_combo.current_item = value; } |
|---|
| 39 | get { return _device_types_combo.current_item; } |
|---|
| 40 | } |
|---|
| 41 | |
|---|
| 42 | public string current_device |
|---|
| 43 | { |
|---|
| 44 | set { _devices_combo.current_item = value; } |
|---|
| 45 | get { return _devices_combo.current_item; } |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | public string current_extra_options |
|---|
| 49 | { |
|---|
| 50 | set { _extra_options_entry.text = value; } |
|---|
| 51 | get { return _extra_options_entry.text; } |
|---|
| 52 | } |
|---|
| 53 | |
|---|
| 54 | public BuildersList () |
|---|
| 55 | { |
|---|
| 56 | pack_start (_builders_combo, false, false, 4); |
|---|
| 57 | pack_start (_device_types_combo, false, false, 4); |
|---|
| 58 | pack_start (_devices_combo, false, false, 4); |
|---|
| 59 | |
|---|
| 60 | var vbox = new VBox (false, 0); |
|---|
| 61 | Utils.add_vbox_label (vbox, _("Extra options:"), _extra_options_entry); |
|---|
| 62 | pack_start (vbox, false, false, 4); |
|---|
| 63 | |
|---|
| 64 | //Connect signals |
|---|
| 65 | _builders_combo.item_changed.connect (() => this.builder_changed ()); |
|---|
| 66 | _device_types_combo.item_changed.connect (() => this.device_type_changed ()); |
|---|
| 67 | _devices_combo.item_changed.connect (() => this.device_changed ()); |
|---|
| 68 | _extra_options_entry.changed.connect (() => this.extra_options_changed ()); |
|---|
| 69 | } |
|---|
| 70 | |
|---|
| 71 | public void add_builder (string builder) |
|---|
| 72 | { |
|---|
| 73 | _builders_combo.add_item (builder); |
|---|
| 74 | } |
|---|
| 75 | |
|---|
| 76 | public void add_device_type (string device_type) |
|---|
| 77 | { |
|---|
| 78 | _device_types_combo.add_item (device_type); |
|---|
| 79 | } |
|---|
| 80 | |
|---|
| 81 | public void add_device (string device) |
|---|
| 82 | { |
|---|
| 83 | _devices_combo.add_item (device); |
|---|
| 84 | } |
|---|
| 85 | |
|---|
| 86 | public void clear_builders_list () |
|---|
| 87 | { |
|---|
| 88 | _builders_combo.clear_list (); |
|---|
| 89 | } |
|---|
| 90 | |
|---|
| 91 | public void clear_device_types_list () |
|---|
| 92 | { |
|---|
| 93 | _device_types_combo.clear_list (); |
|---|
| 94 | } |
|---|
| 95 | |
|---|
| 96 | public void clear_devices_list () |
|---|
| 97 | { |
|---|
| 98 | _devices_combo.clear_list (); |
|---|
| 99 | } |
|---|
| 100 | } |
|---|