[Gimp-developer] adding option to crop tool
Hi all, I'm trying to create a patch to fix several feature requests about the crop tool. However, after adding my first option to the crop tool info window, I get these messages during startup: (gimp-2.1:11796): GLib-GObject-CRITICAL **: file genums.c: line 402 (g_value_get_enum): assertion _VALUE_HOLDS_ENUM (value)' failed I've added a boolean (not enum!!) option to the struct in gimpcropoptions.h, added it to the set and get functions, to the class init, and added a corresponding widget to the GUI. If I try to click the widget, I get the same errors. Where should I look for the problem? Is there some auto-generated file that contains all registered options for all the tools or something like that?? thanks, Olivier ___ Gimp-developer mailing list [EMAIL PROTECTED] http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer
Re: [Gimp-developer] adding option to crop tool
On Wed, Sep 29, 2004 at 04:15:46PM +0200, Sven Neumann wrote: You should show us your code if you want us to help you. what is the policy towards attachments on this list? If allowed I'll attach the file, for now I'll list my changes: -- in gimpcropoptions.h added a gboolean to the struct: struct _GimpCropOptions { GimpToolOptions parent_instence; gboolean layer_only; gboolean allow_enlarge; gboolean keep_aspect; GimpCropMode crop_mode; gboolean blank_outer_region; }; -- in gimpcropoptions.c added a number to the enum: enum { PROP_0, PROP_LAYER_ONLY, PROP_ALLOW_ENLARGE, PROP_KEEP_ASPECT, PROP_CROP_MODE, PROP_BLANK_OUTER_REGION }; -- added to gimp_crop_options_class_init (GimpCropOptionsClass *klass): GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_BLANK_OUTER_REGION, blank-outer-region, NULL, FALSE, 0); -- added to gimp_crop_options_set_property: case PROP_BLANK_OUTER_REGION: options-blank_outer_region = g_value_get_enum (value); break; -- added to gimp_crop_options_get_property: case PROP_BLANK_OUTER_REGION: g_value_set_enum (value, options-blank_outer_region); break; -- added to gimp_crop_options_gui: /* blank outer region */ button = gimp_prop_check_button_new (config, blank-outer-region, _(Blank outer region)); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_widget_show (button); (b.t.w: there is a memory leak in this function, the last string 'str' is not freed, but I'll include that in my patch whenever it is working) so what is missing now? thanks, Olivier ___ Gimp-developer mailing list [EMAIL PROTECTED] http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer
Re: [Gimp-developer] adding option to crop tool
Hi, [EMAIL PROTECTED] (Olivier) writes: -- added to gimp_crop_options_set_property: case PROP_BLANK_OUTER_REGION: options-blank_outer_region = g_value_get_enum (value); break; -- added to gimp_crop_options_get_property: case PROP_BLANK_OUTER_REGION: g_value_set_enum (value, options-blank_outer_region); break; You are using g_value_get_enum() and g_value_set_enum() on a boolean property. Sven ___ Gimp-developer mailing list [EMAIL PROTECTED] http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer
Re: [Gimp-developer] adding option to crop tool
Hi, Quoting Olivier [EMAIL PROTECTED]: snip gboolean blank_outer_region; snip GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_BLANK_OUTER_REGION, blank-outer-region, NULL, FALSE, 0); snip options-blank_outer_region = g_value_get_enum (value); g_value_set_enum (value, options-blank_outer_region); This looks rather suspicions - you're declaring a gboolean as a BOOLEAN property, and then using get_ and set_enum to get and set its value. Try changing these to get_ and set_boolean and see what happens. Cheers, Dave. -- Dave Neary Lyon, France ___ Gimp-developer mailing list [EMAIL PROTECTED] http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer
Re: [Gimp-developer] adding option to crop tool
On Wed, Sep 29, 2004 at 06:19:15PM +0200, Dave Neary wrote: Hi, Quoting Olivier [EMAIL PROTECTED]: snip gboolean blank_outer_region; snip GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_BLANK_OUTER_REGION, blank-outer-region, NULL, FALSE, 0); snip options-blank_outer_region = g_value_get_enum (value); g_value_set_enum (value, options-blank_outer_region); This looks rather suspicions - you're declaring a gboolean as a BOOLEAN property, and then using get_ and set_enum to get and set its value. Try changing these to get_ and set_boolean and see what happens. how blind did I become thanks for noticing that! regards, Olivier ___ Gimp-developer mailing list [EMAIL PROTECTED] http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer