[gnome-scan] Migrate to vala master



commit 592ea74dceec94290e28281a8b4e0426b1f6fe16
Author: Ã?tienne Bersac <bersace gnome org>
Date:   Fri May 8 15:02:39 2009 +0200

    Migrate to vala master
---
 lib/Makefile.am                              |    3 +-
 lib/gnome-scan-backend.vala                  |    6 +-
 lib/gnome-scan-dialog.vala                   |   16 ++--
 lib/gnome-scan-module-manager.vala           |  169 +++++++++++++-------------
 lib/gnome-scan-module.vala                   |    2 +-
 lib/gnome-scan-option-box.vala               |    2 +-
 lib/gnome-scan.h                             |   30 -----
 modules/gsane/gsane-backend.h                |    2 +-
 modules/gsane/gsane-common.h                 |    2 +-
 modules/gsane/gsane-module.c                 |    2 +-
 modules/gsane/gsane-option-handler-generic.c |    2 +-
 modules/gsane/gsane-option-handler.h         |    3 +-
 modules/gsane/gsane-scanner.h                |    2 +-
 modules/gsfile/gsfile-backend.h              |    2 +-
 modules/gsfile/gsfile-filenames-widget.c     |    1 -
 modules/gsfile/gsfile-filenames-widget.h     |    2 +-
 modules/gsfile/gsfile-module.c               |    3 +-
 modules/gsfile/gsfile-options.h              |    2 +-
 modules/gsfile/gsfile-scanner.c              |    3 +-
 modules/gsfile/gsfile-scanner.h              |    2 +-
 20 files changed, 109 insertions(+), 147 deletions(-)

diff --git a/lib/Makefile.am b/lib/Makefile.am
index 2931bad..fedb552 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -53,7 +53,6 @@ libgnome_scan_la_SOURCES = \
 	gnome-scan.vala.stamp	\
 	gnome-scan.h \
 	$(libgnome_scan_la_VALASOURCES:.vala=.c)	\
-	$(libgnome_scan_la_VALASOURCES:.vala=.h)	\
 	$(NULL)
 
 libgnome_scan_la_CFLAGS = \
@@ -68,7 +67,7 @@ includegs_HEADERS = \
 	$(NULL)
 
 gnome-scan.vala.stamp: $(libgnome_scan_la_VALASOURCES)
-	valac --library= VAPINAME@ --thread -C $(libgnome_scan_la_VALAPKGADD) $^ && touch $@
+	valac -H gnome-scan.h -h gnome-scan-priv.h --library= VAPINAME@ --thread -C $(libgnome_scan_la_VALAPKGADD) $^ && touch $@
 
 EXTRA_DIST += \
 	gnome-scan.vala.stamp	\
diff --git a/lib/gnome-scan-backend.vala b/lib/gnome-scan-backend.vala
index ae4d9a6..bcec1cf 100644
--- a/lib/gnome-scan-backend.vala
+++ b/lib/gnome-scan-backend.vala
@@ -20,11 +20,11 @@
  */
 
 namespace Gnome.Scan {
-    public abstract class Backend : Object {
+	public abstract class Backend : Object {
 		public abstract void* probe_scanners();
 
 		public signal void scanner_added(Scanner scanner);
 		public signal void scanner_removed(Scanner scanner);
 		public signal void probe_done();
-    }
-}
\ No newline at end of file
+	}
+}
diff --git a/lib/gnome-scan-dialog.vala b/lib/gnome-scan-dialog.vala
index c288e54..2334498 100644
--- a/lib/gnome-scan-dialog.vala
+++ b/lib/gnome-scan-dialog.vala
@@ -94,7 +94,7 @@ namespace Gnome.Scan {
 			box.pack_start(this.acquisition_page, true, true, 0);
 
 			// build basic UI
-			this.pages = new Widget[Pages.LAST];
+			this.pages = new Widget[(int) Pages.LAST];
 			this.build_general_tab();
 			this.build_scanner_page();
 			this.build_node_ui(this.job.sink);
@@ -156,8 +156,8 @@ namespace Gnome.Scan {
 
 		private Widget build_page(Pages page_id)
 		{
-			if (this.pages[page_id] is Widget)
-				return this.pages[page_id];
+			if (this.pages[(int) page_id] is Widget)
+				return this.pages[(int) page_id];
 
 			switch(page_id) {
 			case Pages.GENERAL:
@@ -182,7 +182,7 @@ namespace Gnome.Scan {
 						enum_get_nick(typeof(Pages), page_id));
 				break;
 			}
-			return this.pages[page_id];
+			return this.pages[(int) page_id];
 		}
 
 		private void build_general_tab()
@@ -204,7 +204,7 @@ namespace Gnome.Scan {
 		private void build_scanner_page()
 		{
 			OptionPage opage = new OptionHPage();
-			var paned = this.pages[Pages.GENERAL] as Paned;
+			var paned = this.pages[(int) Pages.GENERAL] as Paned;
 			var box = paned.get_child2() as Box;
 			box.pack_start(opage, false, true, 0);
 			this.append_page(Pages.FRONT_SCANNER, null, opage);
@@ -213,7 +213,7 @@ namespace Gnome.Scan {
 		private void build_sink_page()
 		{
 			OptionPage opage = new OptionHPage();
-			weak Paned paned = this.pages[Pages.GENERAL] as Paned;
+			weak Paned paned = this.pages[(int) Pages.GENERAL] as Paned;
 			weak Box box = paned.get_child2() as Box;
 			box.pack_start(opage, false, true, 0);
 			this.append_page(Pages.FRONT_SINK, null, opage);
@@ -231,7 +231,7 @@ namespace Gnome.Scan {
 			page.border_width = 12;
 			this.acquisition_page.pack_start(page, false, true, 0);
 
-			this.pages[Pages.ACQUISITION] = page;
+			this.pages[(int) Pages.ACQUISITION] = page;
 		}
 
 		private void build_option_page(Pages page_id)
@@ -298,7 +298,7 @@ namespace Gnome.Scan {
 					continue;
 
 				page_id = this.get_page_id_for_option(node, option);
-				page = this.pages[page_id] as OptionPage;
+				page = this.pages[(int) page_id] as OptionPage;
 				page.unpack_option(option);
 				page.show_all();
 			}
diff --git a/lib/gnome-scan-module-manager.vala b/lib/gnome-scan-module-manager.vala
index 1cca012..5c26c11 100644
--- a/lib/gnome-scan-module-manager.vala
+++ b/lib/gnome-scan-module-manager.vala
@@ -21,107 +21,104 @@
  
 using GLib;
 
-namespace Gnome {
-    namespace Scan {
-		
+namespace Gnome.Scan {
+	/**
+	 * SECTION: gnome-scan-module-manager
+	 * @short_description: Finding installed modules
+	 *
+	 * The #GnomeScanModuleManager search in a list of path shared object,
+	 * and instanciate a #GnomeScanModule for each shared object. Upon
+	 * initialization, the #GnomeScanModule will register new GTypes. This
+	 * implementation is meant to be portable, but never tested on other
+	 * plateform that GNU/Linux.
+	 **/
+	public class ModuleManager : Object {
 		/**
-		 * SECTION: gnome-scan-module-manager
-		 * @short_description: Finding installed modules
+		 * GnomeScanModuleManager:path:
 		 *
-		 * The #GnomeScanModuleManager search in a list of path shared object,
-		 * and instanciate a #GnomeScanModule for each shared object. Upon
-		 * initialization, the #GnomeScanModule will register new GTypes. This
-		 * implementation is meant to be portable, but never tested on other
-		 * plateform that GNU/Linux.
+		 * The search path where are installed #GnomeScanModule shared
+		 * object. A search path is a string formed by a list of absolute
+		 * path to directory separated by #G_SEARCHPATH_SEPARATOR.
 		 **/
-		public class ModuleManager : Object {
-			/**
-			 * GnomeScanModuleManager:path:
-			 *
-			 * The search path where are installed #GnomeScanModule shared
-			 * object. A search path is a string formed by a list of absolute
-			 * path to directory separated by #G_SEARCHPATH_SEPARATOR.
-			 **/
-			[Description(nick="Path", blurb="Module path")]
-			public string path { get; construct set; }
+		[Description(nick="Path", blurb="Module path")]
+		public string path { get; construct set; }
 
-			private SList<TypeModule> modules;
+		private SList<TypeModule> modules;
 			
-			/**
-			 * gnome_scan_module_manager_new:
-			 * @path: Search path.
-			 * 
-			 * Create a new #GnomeScanModuleManager which will handle @path.
-			 * 
-			 * Returns: a new #GnomeScanModuleManager
-			 **/
-			public ModuleManager (string path) {
-				this.path = path;
-			}
+		/**
+		 * gnome_scan_module_manager_new:
+		 * @path: Search path.
+		 * 
+		 * Create a new #GnomeScanModuleManager which will handle @path.
+		 * 
+		 * Returns: a new #GnomeScanModuleManager
+		 **/
+		public ModuleManager (string path) {
+			this.path = path;
+		}
 
-			/**
-			 * gnome_scan_module_manager_query_modules:
-			 * @self: a #GnomeScanModuleManager
-			 * 
-			 * Search for shared objects in path, instanciate and initialize a
-			 * #GnomeScanModule for each shared object. Note that it won't search
-			 * in subdirectories.
-			 **/
-			public void query_modules () {
-				Module module;
-				Dir dir = null;
-				string[] paths = path.split (GLib.Path.SEARCHPATH_SEPARATOR_S);
-				string name;
-				string filename;
+		/**
+		 * gnome_scan_module_manager_query_modules:
+		 * @self: a #GnomeScanModuleManager
+		 * 
+		 * Search for shared objects in path, instanciate and initialize a
+		 * #GnomeScanModule for each shared object. Note that it won't search
+		 * in subdirectories.
+		 **/
+		public void query_modules () {
+			Module module;
+			Dir dir = null;
+			string[] paths = path.split (GLib.Path.SEARCHPATH_SEPARATOR_S);
+			string name;
+			string filename;
 	
-				foreach (string path in paths) {
-					try {
-						dir = Dir.open (path, 0);
-					}
-					catch (GLib.Error error) {
-						/* Show warning only for absolute path, else should be devel pathâ?¦ */
-						if (path[0] == '/')
-							warning("%s", error.message);
-					}
+			foreach (string path in paths) {
+				try {
+					dir = Dir.open (path, 0);
+				}
+				catch (GLib.Error error) {
+					/* Show warning only for absolute path, else should be devel pathâ?¦ */
+					if (path[0] == '/')
+						warning("%s", error.message);
+				}
 
-					if (dir == null)
-						continue;
+				if (dir == null)
+					continue;
 				  
-					/* Scan for lib*.{so,la} */
-					while ((name = dir.read_name ()) != null) {
-						if (is_valid_module_name (name)) {
-							filename = Path.build_filename (path, name);
-							module = new Module (filename);
+				/* Scan for lib*.{so,la} */
+				while ((name = dir.read_name ()) != null) {
+					if (is_valid_module_name (name)) {
+						filename = Path.build_filename (path, name);
+						module = new Module (filename);
 							
-							if (!module.use ()) {
-								warning ("%s", GLib.Module.error());
-								// throw exception ?
-							}
-							modules.append (module);
+						if (!module.use ()) {
+							warning ("%s", GLib.Module.error());
+							// throw exception ?
 						}
+						modules.append (module);
 					}
 				}
 			}
+		}
 			
-			/**
-			 * gnome_scan_module_manager_unload_modules:
-			 * @self: a #GnomeScanModuleManager
-			 * 
-			 * Search for shared objects in path, instanciate and initialize a
-			 * #GnomeScanModule for each shared object. Note that it won't search
-			 * in subdirectories.
-			 **/
-			public void unload_modules () {
-				foreach (TypeModule module in modules)
-				module.unuse ();
-			}
+		/**
+		 * gnome_scan_module_manager_unload_modules:
+		 * @self: a #GnomeScanModuleManager
+		 * 
+		 * Search for shared objects in path, instanciate and initialize a
+		 * #GnomeScanModule for each shared object. Note that it won't search
+		 * in subdirectories.
+		 **/
+		public void unload_modules () {
+			foreach (TypeModule module in modules)
+			module.unuse ();
+		}
 
-			private static bool is_valid_module_name (string name)
-			{
-				return name.has_prefix ("lib")
-				&& (name.has_suffix (GLib.Module.SUFFIX)
-					|| name.has_suffix (".la"));
-			}
+		private static bool is_valid_module_name (string name)
+		{
+			return name.has_prefix ("lib")
+			&& (name.has_suffix (GLib.Module.SUFFIX)
+				|| name.has_suffix (".la"));
 		}
-    }
+	}
 }
diff --git a/lib/gnome-scan-module.vala b/lib/gnome-scan-module.vala
index 23fe1f6..587bb1a 100644
--- a/lib/gnome-scan-module.vala
+++ b/lib/gnome-scan-module.vala
@@ -37,7 +37,7 @@ namespace Gnome.Scan {
 
 		private GLib.Module library;
 		private InitFunc init;
-		private	FinalizeFunc finalize;
+		private	new FinalizeFunc finalize;
 
 		public delegate void InitFunc (Module module);
 		public delegate void FinalizeFunc ();
diff --git a/lib/gnome-scan-option-box.vala b/lib/gnome-scan-option-box.vala
index 71b0c18..a194199 100644
--- a/lib/gnome-scan-option-box.vala
+++ b/lib/gnome-scan-option-box.vala
@@ -31,7 +31,7 @@ namespace Gnome.Scan {
 		int child_count = 0;
 		int child_visible_count = 0;
 		int child_expanding_count = 0;
-		HashTable<Gnome.Scan.Option,OptionWidget> children;
+		new HashTable<Gnome.Scan.Option,OptionWidget> children;
 		HashTable<OptionWidget,Gtk.Label> labels;
 
 		construct {
diff --git a/lib/gnome-scan.h b/lib/gnome-scan.h
deleted file mode 100644
index 86d29ea..0000000
--- a/lib/gnome-scan.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Gnome Scan - Scan as easy as you print
- * Copyright © 2007  �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
- */
-
-#ifndef	_GNOME_SCAN_H_
-#define	_GNOME_SCAN_H_
-
-#include <gnome-scan-init.h>
-#include <gnome-scan-job.h>
-#include <gnome-scan-node.h>
-#include <gnome-scan-dialog.h>
-
-#endif
diff --git a/modules/gsane/gsane-backend.h b/modules/gsane/gsane-backend.h
index 87fce5b..cc03aef 100644
--- a/modules/gsane/gsane-backend.h
+++ b/modules/gsane/gsane-backend.h
@@ -24,7 +24,7 @@
 #define _GSANE_BACKEND_H_
 
 #include <glib-object.h>
-#include <gnome-scan-backend.h>
+#include <gnome-scan.h>
 
 G_BEGIN_DECLS
 
diff --git a/modules/gsane/gsane-common.h b/modules/gsane/gsane-common.h
index 902597c..01c8991 100644
--- a/modules/gsane/gsane-common.h
+++ b/modules/gsane/gsane-common.h
@@ -30,7 +30,7 @@
 #include <glib.h>
 #include <glib/gi18n-lib.h>
 #include <sane/sane.h>
-#include <gnome-scan-common.h>
+#include <gnome-scan.h>
 
 G_BEGIN_DECLS
 
diff --git a/modules/gsane/gsane-module.c b/modules/gsane/gsane-module.c
index 8a23b5d..7d39870 100644
--- a/modules/gsane/gsane-module.c
+++ b/modules/gsane/gsane-module.c
@@ -26,7 +26,7 @@
 #include <glib/gi18n-lib.h>
 #include <gmodule.h>
 #include <sane/sane.h>
-#include <gnome-scan-module.h>
+#include <gnome-scan.h>
 #include "gsane-common.h"
 #include "gsane-option-manager.h"
 #include "gsane-option-handler-generic.h"
diff --git a/modules/gsane/gsane-option-handler-generic.c b/modules/gsane/gsane-option-handler-generic.c
index 249d669..77af046 100644
--- a/modules/gsane/gsane-option-handler-generic.c
+++ b/modules/gsane/gsane-option-handler-generic.c
@@ -19,7 +19,7 @@
  *	Boston, MA 02110-1301, USA
  */
 
-#include <gnome-scan-option.h>
+#include <gnome-scan.h>
 #include "gsane-common.h"
 #include "gsane-option-handler-generic.h"
 
diff --git a/modules/gsane/gsane-option-handler.h b/modules/gsane/gsane-option-handler.h
index 8400e46..f823352 100644
--- a/modules/gsane/gsane-option-handler.h
+++ b/modules/gsane/gsane-option-handler.h
@@ -24,8 +24,7 @@
 
 #include <glib-object.h>
 #include <sane/sane.h>
-#include <gnome-scan-scanner.h>
-#include <gnome-scan-option.h>
+#include <gnome-scan.h>
 #include "gsane-common.h"
 
 G_BEGIN_DECLS
diff --git a/modules/gsane/gsane-scanner.h b/modules/gsane/gsane-scanner.h
index 8fc3465..1674048 100644
--- a/modules/gsane/gsane-scanner.h
+++ b/modules/gsane/gsane-scanner.h
@@ -25,7 +25,7 @@
 
 #include <glib-object.h>
 #include <sane/sane.h>
-#include <gnome-scan-scanner.h>
+#include <gnome-scan.h>
 
 G_BEGIN_DECLS
 
diff --git a/modules/gsfile/gsfile-backend.h b/modules/gsfile/gsfile-backend.h
index d4030e1..8ddd69e 100644
--- a/modules/gsfile/gsfile-backend.h
+++ b/modules/gsfile/gsfile-backend.h
@@ -24,7 +24,7 @@
 #define _GSFILE_BACKEND_H_
 
 #include <glib-object.h>
-#include <gnome-scan-backend.h>
+#include <gnome-scan.h>
 
 G_BEGIN_DECLS
 
diff --git a/modules/gsfile/gsfile-filenames-widget.c b/modules/gsfile/gsfile-filenames-widget.c
index 0d6207d..8803899 100644
--- a/modules/gsfile/gsfile-filenames-widget.c
+++ b/modules/gsfile/gsfile-filenames-widget.c
@@ -25,7 +25,6 @@
 #endif
 
 #include <glib/gi18n-lib.h>
-#include <gnome-scan-option-widget.h>
 #include "gsfile-options.h"
 #include "gsfile-filenames-widget.h"
 
diff --git a/modules/gsfile/gsfile-filenames-widget.h b/modules/gsfile/gsfile-filenames-widget.h
index 6865405..632ba74 100644
--- a/modules/gsfile/gsfile-filenames-widget.h
+++ b/modules/gsfile/gsfile-filenames-widget.h
@@ -24,7 +24,7 @@
 #define _GSFILE_FILENAMES_WIDGET_H_
 
 #include <glib-object.h>
-#include <gnome-scan-option-widget.h>
+#include <gnome-scan.h>
 
 G_BEGIN_DECLS
 
diff --git a/modules/gsfile/gsfile-module.c b/modules/gsfile/gsfile-module.c
index a59e761..1726bd2 100644
--- a/modules/gsfile/gsfile-module.c
+++ b/modules/gsfile/gsfile-module.c
@@ -20,8 +20,7 @@
  */
 
 
-#include <gnome-scan-module.h>
-#include <gnome-scan-option-manager.h>
+#include <gnome-scan.h>
 #include "gsfile-backend.h"
 #include "gsfile-scanner.h"
 #include "gsfile-options.h"
diff --git a/modules/gsfile/gsfile-options.h b/modules/gsfile/gsfile-options.h
index a98f69e..5625256 100644
--- a/modules/gsfile/gsfile-options.h
+++ b/modules/gsfile/gsfile-options.h
@@ -19,7 +19,7 @@
  *	Boston, MA 02110-1301, USA
  */
  
-#include <gnome-scan-option.h>
+#include <gnome-scan.h>
 
 #ifndef _GSFILE_OPTION_H
 #define _GSFILE_OPTION_H
diff --git a/modules/gsfile/gsfile-scanner.c b/modules/gsfile/gsfile-scanner.c
index d6301ef..46b7622 100644
--- a/modules/gsfile/gsfile-scanner.c
+++ b/modules/gsfile/gsfile-scanner.c
@@ -24,8 +24,7 @@
 #endif
 
 #include <glib/gi18n.h>
-#include <gnome-scan-option.h>
-#include <gnome-scan-common.h>
+#include <gnome-scan.h>
 #include "gsfile-options.h"
 #include "gsfile-scanner.h"
 
diff --git a/modules/gsfile/gsfile-scanner.h b/modules/gsfile/gsfile-scanner.h
index a8bff49..1cbf7c7 100644
--- a/modules/gsfile/gsfile-scanner.h
+++ b/modules/gsfile/gsfile-scanner.h
@@ -24,7 +24,7 @@
 #define _GSFILE_SCANNER_H_
 
 #include <glib-object.h>
-#include <gnome-scan-scanner.h>
+#include <gnome-scan.h>
 
 G_BEGIN_DECLS
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]