gnome-scan r702 - in trunk: . lib



Author: bersace
Date: Mon Dec 15 22:29:25 2008
New Revision: 702
URL: http://svn.gnome.org/viewvc/gnome-scan?rev=702&view=rev

Log:
Use weak variable if possible.

Modified:
   trunk/ChangeLog
   trunk/lib/gnome-scan-checkbox-widget.vala
   trunk/lib/gnome-scan-dialog.vala
   trunk/lib/gnome-scan-job.vala
   trunk/lib/gnome-scan-option-box.vala
   trunk/lib/gnome-scan-option-page.vala
   trunk/lib/gnome-scan-option-widget.vala

Modified: trunk/lib/gnome-scan-checkbox-widget.vala
==============================================================================
--- trunk/lib/gnome-scan-checkbox-widget.vala	(original)
+++ trunk/lib/gnome-scan-checkbox-widget.vala	Mon Dec 15 22:29:25 2008
@@ -55,7 +55,6 @@
 				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;

Modified: trunk/lib/gnome-scan-dialog.vala
==============================================================================
--- trunk/lib/gnome-scan-dialog.vala	(original)
+++ trunk/lib/gnome-scan-dialog.vala	Mon Dec 15 22:29:25 2008
@@ -213,8 +213,8 @@
 		private void build_sink_page()
 		{
 			OptionPage opage = new OptionHPage();
-			var paned = this.pages[Pages.GENERAL] as Paned;
-			var box = paned.get_child2() as Box;
+			weak Paned paned = this.pages[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);
 		}
@@ -275,12 +275,12 @@
 			Pages page_id;
 			OptionPage page;
 
-			foreach(Option option in node.options) {
+			foreach(weak Option option in node.options) {
 				if (option.hint == OptionHint.HIDDEN)
 					continue;
 
 				page_id = this.get_page_id_for_option(node, option);
-				page = (OptionPage) this.build_page(page_id);
+				page = this.build_page(page_id) as OptionPage;
 				if (!(page is OptionPage))
 					continue;
 
@@ -292,8 +292,8 @@
 		private void destroy_node_ui(Node node)
 		{
 			Pages page_id = Pages.ADVANCED;
-			OptionPage page;
-			foreach(Option option in node.options) {
+			weak OptionPage page;
+			foreach(weak Option option in node.options) {
 				if (option.hint == OptionHint.HIDDEN)
 					continue;
 

Modified: trunk/lib/gnome-scan-job.vala
==============================================================================
--- trunk/lib/gnome-scan-job.vala	(original)
+++ trunk/lib/gnome-scan-job.vala	Mon Dec 15 22:29:25 2008
@@ -115,7 +115,7 @@
 
 		public bool run_once()
 		{
-			foreach(Gnome.Scan.Node node in this.nodes) {
+			foreach(weak Gnome.Scan.Node node in this.nodes) {
 				if (!node.start_frame() && node is Gnome.Scan.Scanner) {
 					return false;
 				}
@@ -125,7 +125,7 @@
 			while(!this.cancelled && processor.work(out this._progress))
 				debug("%.2f%%", this._progress);
 
-			foreach(Gnome.Scan.Node node in this.nodes)
+			foreach(weak Gnome.Scan.Node node in this.nodes)
 				node.end_frame();
 
 			return true;
@@ -174,8 +174,8 @@
 
 			// list all nodes
 			weak Gegl.Node prev = null;
-			foreach(Gnome.Scan.Node gsnode in this.nodes) {
-				foreach(Gegl.Node gnode in gsnode.nodes) {
+			foreach(weak Gnome.Scan.Node gsnode in this.nodes) {
+				foreach(weak Gegl.Node gnode in gsnode.nodes) {
 					this.graph.append(gnode);
 					if (prev != null) {
 						debug("Link %s to %s", prev.operation, gnode.operation);
@@ -191,7 +191,8 @@
 		private void check_nodes_status()
 		{
 			Status status;
-			if (this._scanner == null || this._sink == null)
+			if (this._scanner == null || this._scanner.nodes.length() == 0
+				|| this._sink == null || this._sink.nodes.length() == 0)
 				this.status = Status.UNCONFIGURED;
 			else {
 				status = Status.READY;

Modified: trunk/lib/gnome-scan-option-box.vala
==============================================================================
--- trunk/lib/gnome-scan-option-box.vala	(original)
+++ trunk/lib/gnome-scan-option-box.vala	Mon Dec 15 22:29:25 2008
@@ -104,7 +104,7 @@
 		// return whether the box is empty
 		public bool unpack_option(Option option)
 		{
-			var widget = this.children.lookup(option);
+			weak OptionWidget widget = this.children.lookup(option);
 			if (widget == null)
 				return false;
 
@@ -113,7 +113,7 @@
 			widget.hide();
 
 			// destroy label
-			var label = this.labels.lookup(widget);
+			weak Label label = this.labels.lookup(widget);
 			if (label != null) {
 				this.table.remove(label);
 				this.labels.remove(widget);

Modified: trunk/lib/gnome-scan-option-page.vala
==============================================================================
--- trunk/lib/gnome-scan-option-page.vala	(original)
+++ trunk/lib/gnome-scan-option-page.vala	Mon Dec 15 22:29:25 2008
@@ -84,7 +84,7 @@
 
 		public void unpack_option(Option option)
 		{
-			OptionBox box = this.boxes.lookup(option.group);
+			weak OptionBox box = this.boxes.lookup(option.group);
 			if (box.unpack_option(option)) {
 				this.container.remove(box);
 				this.boxes.remove(option.group);

Modified: trunk/lib/gnome-scan-option-widget.vala
==============================================================================
--- trunk/lib/gnome-scan-option-widget.vala	(original)
+++ trunk/lib/gnome-scan-option-widget.vala	Mon Dec 15 22:29:25 2008
@@ -29,7 +29,7 @@
 	 * and pass user defined value to #GnomeScanSettings.
 	 */
 	// TODO: with Gtk+ 2.16, herits directly from Box and let children
-	// decide orientation.
+	// decide orientation using GtkOrientable.
 	public abstract class OptionWidget : HBox {
 		public Option	option		{get; set construct;}
 		public bool		no_label	{get; set; default = false;}



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