gnome-scan r664 - in trunk: . lib
- From: bersace svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-scan r664 - in trunk: . lib
- Date: Fri, 12 Dec 2008 20:37:06 +0000 (UTC)
Author: bersace
Date: Fri Dec 12 20:37:06 2008
New Revision: 664
URL: http://svn.gnome.org/viewvc/gnome-scan?rev=664&view=rev
Log:
Added checkbox widget.
Added:
trunk/lib/gnome-scan-checkbox-widget.vala
Modified:
trunk/ChangeLog
trunk/lib/gnome-scan-init.vala
trunk/lib/gnome-scan-option-manager.vala
Added: trunk/lib/gnome-scan-checkbox-widget.vala
==============================================================================
--- (empty file)
+++ trunk/lib/gnome-scan-checkbox-widget.vala Fri Dec 12 20:37:06 2008
@@ -0,0 +1,63 @@
+/* GNOME Scan - Scan as easy as you print
+ * Copyright  2006-2008 Ãtienne Bersac <bersace gnome org>
+ *
+ * GNOME Scan is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * GNOME Scan 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GNOME Scan. If not, write to:
+ *
+ * the Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA
+ */
+
+using GLib;
+using Gtk;
+
+namespace Gnome.Scan {
+ public class CheckboxWidget : OptionWidget {
+ private CheckButton check;
+ private bool inhibit = false;
+
+ construct {
+ this.no_label = true;
+ this.expand = false;
+ this.check = new CheckButton.with_label(this.option.title);
+ this.pack_start(this.check, true, true, 0);
+
+ this.check.toggled += this.update_option;
+ this.option.notify["value"] += this.update_widget;
+ }
+
+ private void update_option()
+ {
+ if (inhibit)
+ return;
+
+ var option = this.option as OptionBool;
+ inhibit = true;
+ option.value = this.check.active;
+ inhibit = false;
+ }
+
+ private void update_widget()
+ {
+ if (inhibit)
+ return;
+
+ var option = this.option as OptionBool;
+ debug("%s value = %s", option.name, option.value.to_string());
+ inhibit = true;
+ this.check.active = option.value;
+ inhibit = false;
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/lib/gnome-scan-init.vala
==============================================================================
--- trunk/lib/gnome-scan-init.vala (original)
+++ trunk/lib/gnome-scan-init.vala Fri Dec 12 20:37:06 2008
@@ -41,6 +41,7 @@
Gegl.init(ref argv);
option_manager = new OptionManager();
+ option_manager.register_rule_by_type(typeof(OptionBool), typeof(CheckboxWidget));
module_path = string.join(GLib.Path.SEARCHPATH_SEPARATOR_S, MODULE_DIR,
"modules/gsfile", "modules/gsane",
Modified: trunk/lib/gnome-scan-option-manager.vala
==============================================================================
--- trunk/lib/gnome-scan-option-manager.vala (original)
+++ trunk/lib/gnome-scan-option-manager.vala Fri Dec 12 20:37:06 2008
@@ -35,7 +35,7 @@
construct {
this.rules_by_name = new HashTable<string,Type>(GLib.str_hash, GLib.str_equal);
- this.rules_by_type = new HashTable<Type,Type>(GLib.int_hash, GLib.int_equal);
+ this.rules_by_type = new HashTable<Type,Type>(GLib.direct_hash, GLib.direct_equal);
this.options = new HashTable<string,Type>(GLib.str_hash, GLib.str_equal);
// add default rules ?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]