[seed] Fix enum validation to not break flags



commit 6d51dd5292b5c1a63365ed1aee13f8ea21bef1bc
Author: Robert Carr <racarr mireia (none)>
Date:   Sun Apr 12 10:53:22 2009 -0400

    Fix enum validation to not break flags
---
 examples/accelgroup.js |   16 ++++++++--------
 examples/actions.js    |    6 +++---
 libseed/seed-types.c   |    2 +-
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/examples/accelgroup.js b/examples/accelgroup.js
index 8816397..f2b9f49 100755
--- a/examples/accelgroup.js
+++ b/examples/accelgroup.js
@@ -1,29 +1,29 @@
 #!/usr/bin/env seed
 
-Seed.import_namespace("Gtk");
-Seed.import_namespace("Gdk");
+Gtk = imports.gi.Gtk;
+Gdk = imports.gi.Gdk;
 
 with (Gtk)
 {
 	init(null, null);
-	
+
 	var quit = function ()
 	{
 		main_quit();
 	};
-	
+
 	var w = new Window();
 	w.signal.hide.connect(quit);
-	
+
 	var group = new AccelGroup();
 	group.connect(Gdk.keyval_from_name("q"), 0, 0, quit);
 	w.add_accel_group(group);
-	
+
 	var label = new Label({label: "Press Q to quit"});
 	w.add(label);
-	
+
 	w.resize(300, 300);
 	w.show_all();
-	
+
 	main();
 }
diff --git a/examples/actions.js b/examples/actions.js
index fbd6621..87f84e2 100755
--- a/examples/actions.js
+++ b/examples/actions.js
@@ -1,6 +1,6 @@
 #!/usr/bin/env seed
 
-Seed.import_namespace("Gtk");
+Gtk = imports.gi.Gtk;
 Gtk.init(null, null);
 
 with(Gtk)
@@ -34,7 +34,7 @@ with(Gtk)
 	open_action.signal.activate.connect(function () { Seed.print("Open file"); });
 
 	save_action = new Action({name:"save", label: "Save",
-							  tooltip:"Save File", 
+							  tooltip:"Save File",
 							  stock_id:STOCK_SAVE});
 	save_action.set_accel_group(accels);
 	actions.add_action_with_accel(save_action);
@@ -59,7 +59,7 @@ with(Gtk)
 
 	window.resize(300, 300);
 	window.show_all();
-	
+
 	main();
 }
 
diff --git a/libseed/seed-types.c b/libseed/seed-types.c
index d2fcba0..d4fcf28 100644
--- a/libseed/seed-types.c
+++ b/libseed/seed-types.c
@@ -553,7 +553,7 @@ seed_gi_make_argument (JSContextRef ctx,
 		 interface_type == GI_INFO_TYPE_FLAGS)
 	  {
 	    arg->v_long = seed_value_to_long (ctx, value, exception);
-	    if (!seed_validate_enum ((GIEnumInfo *)interface, arg->v_long))
+	    if (!(interface_type == GI_INFO_TYPE_FLAGS) && !seed_validate_enum ((GIEnumInfo *)interface, arg->v_long))
 	      {
 		gchar *message = 
 		  g_strdup_printf ("Enum value: %ld is out of range", 



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