libgimpwidgets, app, plug-ins: fix last GIR warnings.

gimp_int_radio_group_new() was still complaining about the scope of
radio_button_callback(). Make it (scope notified) because it needs to
stay alive after the function returns and may be called multiple times.

Also adding a GDestroyNotify to free the callback data once the widget
is destroyed (additionally it will also serve as a notifier for bindings
to properly free the callback closure itself, not only it's data).

With this last one done, GObject Introspection generation now happens
without any warning output.
This commit is contained in:
Jehan 2020-01-15 13:51:55 +01:00
parent 44300b134f
commit ec9dbd8115
21 changed files with 44 additions and 36 deletions

View File

@ -179,7 +179,7 @@ convert_precision_dialog_new (GimpImage *image,
vbox = gimp_int_radio_group_new (FALSE, NULL,
G_CALLBACK (gimp_radio_button_update),
&private->trc,
&private->trc, NULL,
trc,
_("Linear light"),

View File

@ -529,7 +529,7 @@ gimp_offset_tool_dialog (GimpFilterTool *filter_tool)
frame = gimp_int_radio_group_new (TRUE, _("Edge Behavior"),
G_CALLBACK (gimp_offset_tool_edge_behavior_toggled),
offset_tool,
offset_tool, NULL,
GIMP_OFFSET_WRAP_AROUND,

View File

@ -1186,7 +1186,7 @@ gimp_prop_boolean_radio_frame_new (GObject *config,
frame =
gimp_int_radio_group_new (TRUE, title,
G_CALLBACK (gimp_prop_radio_button_callback),
config, value,
config, NULL, value,
false_text, FALSE, &button,
true_text, TRUE, NULL,

View File

@ -50,10 +50,11 @@
* radio button group.
* @frame_title: The title of the Frame or %NULL if you don't want
* a title.
* @radio_button_callback: The callback each button's "toggled" signal will
* be connected with.
* @radio_button_callback_data:
* @radio_button_callback: (scope notified): The callback each button's
* "toggled" signal will be connected with.
* @radio_button_callback_data: (closure radio_button_callback):
* The data which will be passed to g_signal_connect().
* @radio_button_callback_destroy: (destroy radio_button_callback_data):
* @initial: The @item_data of the initially pressed radio button.
* @...: A %NULL-terminated @va_list describing
* the radio buttons.
@ -70,7 +71,8 @@ GtkWidget *
gimp_int_radio_group_new (gboolean in_frame,
const gchar *frame_title,
GCallback radio_button_callback,
gpointer callback_data,
gpointer radio_button_callback_data,
GDestroyNotify radio_button_callback_destroy,
gint initial, /* item_data */
/* specify radio buttons as va_list:
@ -97,6 +99,11 @@ gimp_int_radio_group_new (gboolean in_frame,
group = NULL;
if (radio_button_callback_destroy)
g_object_weak_ref (G_OBJECT (vbox),
(GWeakNotify) radio_button_callback_destroy,
radio_button_callback_data);
/* create the radio buttons */
va_start (args, initial);
label = va_arg (args, const gchar *);
@ -132,7 +139,7 @@ gimp_int_radio_group_new (gboolean in_frame,
g_signal_connect (button, "toggled",
radio_button_callback,
callback_data);
radio_button_callback_data);
gtk_widget_show (button);

View File

@ -102,6 +102,7 @@ GtkWidget * gimp_int_radio_group_new (gboolean in_frame,
const gchar *frame_title,
GCallback radio_button_callback,
gpointer radio_button_callback_data,
GDestroyNotify radio_button_callback_destroy,
gint initial, /* item_data */
...) G_GNUC_NULL_TERMINATED;

View File

@ -307,7 +307,7 @@ blinds_dialog (GimpDrawable *drawable)
frame =
gimp_int_radio_group_new (TRUE, _("Orientation"),
G_CALLBACK (gimp_radio_button_update),
&bvals.orientation, bvals.orientation,
&bvals.orientation, NULL, bvals.orientation,
_("_Horizontal"), GIMP_ORIENTATION_HORIZONTAL,
&horizontal,

View File

@ -1359,7 +1359,7 @@ bender_new_dialog (GimpDrawable *drawable)
frame = gimp_int_radio_group_new (TRUE, _("Curve for Border"),
G_CALLBACK (bender_border_callback),
&cd->outline, cd->outline,
&cd->outline, NULL, cd->outline,
C_("curve-border", "_Upper"), OUTLINE_UPPER, &upper,
C_("curve-border", "_Lower"), OUTLINE_LOWER, &lower,
@ -1374,7 +1374,7 @@ bender_new_dialog (GimpDrawable *drawable)
frame = gimp_int_radio_group_new (TRUE, _("Curve Type"),
G_CALLBACK (bender_type_callback),
&cd->curve_type, cd->curve_type,
&cd->curve_type, NULL, cd->curve_type,
_("Smoot_h"), SMOOTH, &smooth,
_("_Free"), GFREE, &freew,

View File

@ -3670,7 +3670,7 @@ load_dialog (GFile *file)
/* Coloring */
frame = gimp_int_radio_group_new (TRUE, _("Coloring"),
G_CALLBACK (gimp_radio_button_update),
&plvals.pnm_type, plvals.pnm_type,
&plvals.pnm_type, NULL, plvals.pnm_type,
_("B/W"), 4, NULL,
_("Gray"), 5, NULL,
@ -3688,7 +3688,7 @@ load_dialog (GFile *file)
frame = gimp_int_radio_group_new (TRUE, _("Text antialiasing"),
G_CALLBACK (gimp_radio_button_update),
&plvals.textalpha, plvals.textalpha,
&plvals.textalpha, NULL, plvals.textalpha,
C_("antialiasing", "None"), 1, NULL,
_("Weak"), 2, NULL,
@ -3700,7 +3700,7 @@ load_dialog (GFile *file)
frame = gimp_int_radio_group_new (TRUE, _("Graphic antialiasing"),
G_CALLBACK (gimp_radio_button_update),
&plvals.graphicsalpha, plvals.graphicsalpha,
&plvals.graphicsalpha, NULL, plvals.graphicsalpha,
C_("antialiasing", "None"), 1, NULL,
_("Weak"), 2, NULL,
@ -3864,7 +3864,7 @@ save_dialog (void)
/* Unit */
uframe = gimp_int_radio_group_new (TRUE, _("Unit"),
G_CALLBACK (save_unit_toggle_update),
vals, psvals.unit_mm,
vals, NULL, psvals.unit_mm,
_("_Inch"), FALSE, NULL,
_("_Millimeter"), TRUE, NULL,
@ -3880,7 +3880,7 @@ save_dialog (void)
/* Rotation */
frame = gimp_int_radio_group_new (TRUE, _("Rotation"),
G_CALLBACK (gimp_radio_button_update),
&psvals.rotate, psvals.rotate,
&psvals.rotate, NULL, psvals.rotate,
"_0", 0, NULL,
"_90", 90, NULL,

View File

@ -1243,7 +1243,7 @@ save_dialog (GimpImage *image,
/* Replace size ? */
tmpwidget =
gimp_int_radio_group_new (FALSE, NULL, G_CALLBACK (gimp_radio_button_update),
&xmcvals.size_replace, xmcvals.size_replace,
&xmcvals.size_replace, NULL, xmcvals.size_replace,
_("_Use this value only for a frame which size "
"is not specified."),
FALSE, NULL,
@ -1294,7 +1294,7 @@ save_dialog (GimpImage *image,
/* Replace delay? */
tmpwidget =
gimp_int_radio_group_new (FALSE, NULL, G_CALLBACK (gimp_radio_button_update),
&xmcvals.delay_replace, xmcvals.delay_replace,
&xmcvals.delay_replace, NULL, xmcvals.delay_replace,
_("_Use this value only for a frame which delay "
"is not specified."),
FALSE, NULL,

View File

@ -677,7 +677,7 @@ plugin_dialog (piArgs *argp)
frame = gimp_int_radio_group_new (TRUE, _("Mode"),
G_CALLBACK (gimp_radio_button_update),
&argp->mode, argp->mode,
&argp->mode, NULL, argp->mode,
"N_TSC", MODE_NTSC, NULL,
"_PAL", MODE_PAL, NULL,
@ -698,7 +698,7 @@ plugin_dialog (piArgs *argp)
frame = gimp_int_radio_group_new (TRUE, _("Action"),
G_CALLBACK (gimp_radio_button_update),
&argp->action, argp->action,
&argp->action, NULL, argp->action,
_("Reduce _Luminance"), ACT_LREDUX, NULL,
_("Reduce _Saturation"), ACT_SREDUX, NULL,

View File

@ -2591,7 +2591,7 @@ jigsaw_dialog (GimpDrawable *drawable)
frame = gimp_int_radio_group_new (TRUE, _("Jigsaw Style"),
G_CALLBACK (gimp_radio_button_update),
&config.style, config.style,
&config.style, NULL, config.style,
_("_Square"), BEZIER_1, &rbutton1,
_("C_urved"), BEZIER_2, &rbutton2,

View File

@ -1124,7 +1124,7 @@ nlfilter_dialog (GimpDrawable *drawable)
frame = gimp_int_radio_group_new (TRUE, _("Filter"),
G_CALLBACK (gimp_radio_button_update),
&nlfvals.filter, nlfvals.filter,
&nlfvals.filter, NULL, nlfvals.filter,
_("_Alpha trimmed mean"),
filter_alpha_trim, &alpha_trim,

View File

@ -606,7 +606,7 @@ sparkle_dialog (GimpDrawable *drawable)
/* colortype */
vbox = gimp_int_radio_group_new (FALSE, NULL,
G_CALLBACK (gimp_radio_button_update),
&svals.colortype, svals.colortype,
&svals.colortype, NULL, svals.colortype,
_("_Natural color"), NATURAL, &r1,
_("_Foreground color"), FOREGROUND, &r2,

View File

@ -725,7 +725,7 @@ create_main_dialog (void)
frame = gimp_int_radio_group_new (TRUE, _("Effect Channel"),
G_CALLBACK (gimp_radio_button_update),
&licvals.effect_channel,
&licvals.effect_channel, NULL,
licvals.effect_channel,
_("_Hue"), 0, NULL,
@ -738,7 +738,7 @@ create_main_dialog (void)
frame = gimp_int_radio_group_new (TRUE, _("Effect Operator"),
G_CALLBACK (gimp_radio_button_update),
&licvals.effect_operator,
&licvals.effect_operator, NULL,
licvals.effect_operator,
_("_Derivative"), 0, NULL,
@ -750,7 +750,7 @@ create_main_dialog (void)
frame = gimp_int_radio_group_new (TRUE, _("Convolve"),
G_CALLBACK (gimp_radio_button_update),
&licvals.effect_convolve,
&licvals.effect_convolve, NULL,
licvals.effect_convolve,
_("_With white noise"), 0, NULL,

View File

@ -1935,7 +1935,7 @@ load_dialog (TIFF *tif,
extra_radio = gimp_int_radio_group_new (TRUE, _("Process extra channel as:"),
(GCallback) gimp_radio_button_update,
default_extra, GIMP_TIFF_LOAD_UNASSALPHA,
default_extra, NULL, GIMP_TIFF_LOAD_UNASSALPHA,
_("_Non-premultiplied alpha"), GIMP_TIFF_LOAD_UNASSALPHA, NULL,
_("Pre_multiplied alpha"), GIMP_TIFF_LOAD_ASSOCALPHA, NULL,
_("Channe_l"), GIMP_TIFF_LOAD_CHANNEL, NULL,

View File

@ -1193,7 +1193,7 @@ save_dialog (TiffSaveVals *tsvals,
frame = gimp_int_radio_group_new (TRUE, _("Compression"),
G_CALLBACK (gimp_radio_button_update),
&tsvals->compression, tsvals->compression,
&tsvals->compression, NULL, tsvals->compression,
_("_None"), COMPRESSION_NONE, NULL,
_("_LZW"), COMPRESSION_LZW, NULL,

View File

@ -838,7 +838,7 @@ explorer_dialog (void)
toggle_vbox =
gimp_int_radio_group_new (FALSE, NULL,
G_CALLBACK (explorer_radio_update),
&wvals.fractaltype, wvals.fractaltype,
&wvals.fractaltype, NULL, wvals.fractaltype,
_("Mandelbrot"), TYPE_MANDELBROT,
&(elements->type[TYPE_MANDELBROT]),
@ -991,7 +991,7 @@ explorer_dialog (void)
/* Redmode radio frame */
frame = gimp_int_radio_group_new (TRUE, _("Red"),
G_CALLBACK (explorer_radio_update),
&wvals.redmode, wvals.redmode,
&wvals.redmode, NULL, wvals.redmode,
_("Sine"), SINUS,
&elements->redmode[SINUS],
@ -1032,7 +1032,7 @@ explorer_dialog (void)
/* Greenmode radio frame */
frame = gimp_int_radio_group_new (TRUE, _("Green"),
G_CALLBACK (explorer_radio_update),
&wvals.greenmode, wvals.greenmode,
&wvals.greenmode, NULL, wvals.greenmode,
_("Sine"), SINUS,
&elements->greenmode[SINUS],
@ -1073,7 +1073,7 @@ explorer_dialog (void)
/* Bluemode radio frame */
frame = gimp_int_radio_group_new (TRUE, _("Blue"),
G_CALLBACK (explorer_radio_update),
&wvals.bluemode, wvals.bluemode,
&wvals.bluemode, NULL, wvals.bluemode,
_("Sine"), SINUS,
&elements->bluemode[SINUS],

View File

@ -64,7 +64,7 @@ create_colorpage (GtkNotebook *notebook)
frame = gimp_int_radio_group_new (TRUE, _("Color"),
G_CALLBACK (gimp_radio_button_update),
&pcvals.color_type, 0,
&pcvals.color_type, NULL, 0,
_("A_verage under brush"),
COLOR_TYPE_AVERAGE, &colorradio[COLOR_TYPE_AVERAGE],

View File

@ -637,7 +637,7 @@ create_orientmap_dialog (GtkWidget *parent)
frame = gimp_int_radio_group_new (TRUE, _("Type"),
G_CALLBACK (vector_type_click_callback),
&vector_type, 0,
&vector_type, NULL, 0,
_("_Normal"), 0, &vector_types[0],
_("Vorte_x"), 1, &vector_types[1],

View File

@ -71,7 +71,7 @@ create_placementpage (GtkNotebook *notebook)
frame = gimp_int_radio_group_new (TRUE, _("Placement"),
G_CALLBACK (gimp_radio_button_update),
&pcvals.place_type, 0,
&pcvals.place_type, NULL, 0,
_("Randomly"),
PLACEMENT_TYPE_RANDOM,

View File

@ -828,7 +828,7 @@ shoot_dialog (GdkMonitor **monitor)
frame = gimp_int_radio_group_new (TRUE,
_("Color Profile"),
G_CALLBACK (gimp_radio_button_update),
&shootvals.profile_policy,
&shootvals.profile_policy, NULL,
shootvals.profile_policy,
_("Tag image with _monitor profile"),