gnome-scan r689 - in trunk: . lib
- From: bersace svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-scan r689 - in trunk: . lib
- Date: Sun, 14 Dec 2008 21:24:40 +0000 (UTC)
Author: bersace
Date: Sun Dec 14 21:24:40 2008
New Revision: 689
URL: http://svn.gnome.org/viewvc/gnome-scan?rev=689&view=rev
Log:
Added string option support.
Added:
trunk/lib/gnome-scan-entry-widget.vala
Modified:
trunk/ChangeLog
trunk/lib/Makefile.am
trunk/lib/gnome-scan-init.vala
trunk/lib/gnome-scan-option.vala
Modified: trunk/lib/Makefile.am
==============================================================================
--- trunk/lib/Makefile.am (original)
+++ trunk/lib/Makefile.am Sun Dec 14 21:24:40 2008
@@ -27,6 +27,7 @@
gnome-scan-option-widget.vala \
gnome-scan-checkbox-widget.vala \
gnome-scan-scale-widget.vala \
+ gnome-scan-entry-widget.vala \
gnome-scan-option-box.vala \
gnome-scan-option-page.vala \
gnome-scan-scanner-selector.vala \
Added: trunk/lib/gnome-scan-entry-widget.vala
==============================================================================
--- (empty file)
+++ trunk/lib/gnome-scan-entry-widget.vala Sun Dec 14 21:24:40 2008
@@ -0,0 +1,60 @@
+/* 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 Gtk;
+
+namespace Gnome.Scan {
+ public class EntryWidget : OptionWidget {
+ private Entry entry;
+ private bool inhibit = false;
+
+ construct {
+ var option = this.option as OptionString;
+
+ entry = new Entry();
+ entry.changed += this.on_entry_changed;
+ entry.text = option.value;
+ this.pack_start(entry, true, true, 0);
+
+ option.notify["value"] += this.on_option_changed;
+ }
+
+ private void on_entry_changed()
+ {
+ if (inhibit)
+ return;
+
+ inhibit = true;
+ ((OptionString)option).value = entry.text;
+ inhibit = false;
+ }
+
+ private void on_option_changed()
+ {
+ if (inhibit)
+ return;
+
+ inhibit = true;
+ entry.text = ((OptionString)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 Sun Dec 14 21:24:40 2008
@@ -41,6 +41,7 @@
option_manager.register_rule_by_type(typeof(OptionBool), typeof(CheckboxWidget));
option_manager.register_rule_by_type(typeof(OptionInt), typeof(ScaleWidget));
option_manager.register_rule_by_type(typeof(OptionDouble), typeof(ScaleWidget));
+ option_manager.register_rule_by_type(typeof(OptionString), typeof(EntryWidget));
module_path = string.join(GLib.Path.SEARCHPATH_SEPARATOR_S, MODULE_DIR,
"modules/gsfile", "modules/gsane",
Modified: trunk/lib/gnome-scan-option.vala
==============================================================================
--- trunk/lib/gnome-scan-option.vala (original)
+++ trunk/lib/gnome-scan-option.vala Sun Dec 14 21:24:40 2008
@@ -109,4 +109,19 @@
this.hint = hint;
}
}
+
+ public class OptionString : Option {
+ public string value {set; get;}
+
+ public OptionString(string name, string title, string desc, string group, string domain, string value, OptionHint hint)
+ {
+ this.name = name;
+ this.title = title;
+ this.desc = desc;
+ this.group = group;
+ this.domain = domain;
+ this.value = value;
+ this.hint = hint;
+ }
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]