[gimp] libgimpwidgets: add GDestroyNotify to all enum widgets callback_data
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimpwidgets: add GDestroyNotify to all enum widgets callback_data
- Date: Wed, 7 Aug 2019 22:01:43 +0000 (UTC)
commit 67455a4ea7450fe2c52e0efca2a153bdc7f83929
Author: Michael Natterer <mitch gimp org>
Date: Thu Aug 8 00:01:10 2019 +0200
libgimpwidgets: add GDestroyNotify to all enum widgets callback_data
app/dialogs/convert-indexed-dialog.c | 2 +-
app/dialogs/image-merge-layers-dialog.c | 2 +-
app/dialogs/item-options-dialog.c | 2 +-
app/dialogs/layer-add-mask-dialog.c | 2 +-
app/tools/gimpcurvestool.c | 2 +-
app/widgets/gimpbrusheditor.c | 2 +-
app/widgets/gimpeditor.c | 2 +-
app/widgets/gimptemplateeditor.c | 2 +-
libgimpwidgets/gimpenumwidgets.c | 96 ++++++++++++++++++++-------------
libgimpwidgets/gimpenumwidgets.h | 84 +++++++++++++++--------------
libgimpwidgets/gimppropwidgets.c | 12 ++---
11 files changed, 119 insertions(+), 89 deletions(-)
---
diff --git a/app/dialogs/convert-indexed-dialog.c b/app/dialogs/convert-indexed-dialog.c
index 446ff63c26..88e82bf239 100644
--- a/app/dialogs/convert-indexed-dialog.c
+++ b/app/dialogs/convert-indexed-dialog.c
@@ -177,7 +177,7 @@ convert_indexed_dialog_new (GimpImage *image,
GIMP_CONVERT_PALETTE_MONO),
gtk_label_new (_("Colormap")),
G_CALLBACK (convert_dialog_type_update),
- private,
+ private, NULL,
&button);
gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (button),
diff --git a/app/dialogs/image-merge-layers-dialog.c b/app/dialogs/image-merge-layers-dialog.c
index 67681eb779..f7a698d2f2 100644
--- a/app/dialogs/image-merge-layers-dialog.c
+++ b/app/dialogs/image-merge-layers-dialog.c
@@ -128,7 +128,7 @@ image_merge_layers_dialog_new (GimpImage *image,
GIMP_CLIP_TO_BOTTOM_LAYER,
gtk_label_new (_("Final, Merged Layer should be:")),
G_CALLBACK (gimp_radio_button_update),
- &private->merge_type,
+ &private->merge_type, NULL,
&button);
gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (button),
private->merge_type);
diff --git a/app/dialogs/item-options-dialog.c b/app/dialogs/item-options-dialog.c
index 265ecc9ff3..3ecc346338 100644
--- a/app/dialogs/item-options-dialog.c
+++ b/app/dialogs/item-options-dialog.c
@@ -194,7 +194,7 @@ item_options_dialog_new (GimpImage *image,
radio_box = gimp_enum_radio_box_new (GIMP_TYPE_COLOR_TAG,
G_CALLBACK (gimp_radio_button_update),
- &private->color_tag,
+ &private->color_tag, NULL,
&radio);
gtk_widget_set_name (radio_box, "gimp-color-tag-box");
gtk_orientable_set_orientation (GTK_ORIENTABLE (radio_box),
diff --git a/app/dialogs/layer-add-mask-dialog.c b/app/dialogs/layer-add-mask-dialog.c
index 2f626b0d4e..dac0163f2c 100644
--- a/app/dialogs/layer-add-mask-dialog.c
+++ b/app/dialogs/layer-add-mask-dialog.c
@@ -136,7 +136,7 @@ layer_add_mask_dialog_new (GimpLayer *layer,
gimp_enum_radio_frame_new (GIMP_TYPE_ADD_MASK_TYPE,
gtk_label_new (_("Initialize Layer Mask to:")),
G_CALLBACK (gimp_radio_button_update),
- &private->add_mask_type,
+ &private->add_mask_type, NULL,
&button);
gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (button),
private->add_mask_type);
diff --git a/app/tools/gimpcurvestool.c b/app/tools/gimpcurvestool.c
index d199502b23..c38f4ce654 100644
--- a/app/tools/gimpcurvestool.c
+++ b/app/tools/gimpcurvestool.c
@@ -651,7 +651,7 @@ gimp_curves_tool_dialog (GimpFilterTool *filter_tool)
"gimp-curve-point",
GTK_ICON_SIZE_MENU,
G_CALLBACK (curves_point_type_callback),
- tool,
+ tool, NULL,
&tool->point_type);
gtk_box_pack_start (GTK_BOX (hbox), hbox2, FALSE, FALSE, 0);
gtk_widget_show (hbox2);
diff --git a/app/widgets/gimpbrusheditor.c b/app/widgets/gimpbrusheditor.c
index 4ead9b97c9..ae4240c72f 100644
--- a/app/widgets/gimpbrusheditor.c
+++ b/app/widgets/gimpbrusheditor.c
@@ -145,7 +145,7 @@ gimp_brush_editor_init (GimpBrushEditor *editor)
"gimp-shape",
GTK_ICON_SIZE_MENU,
G_CALLBACK (gimp_brush_editor_update_shape),
- editor,
+ editor, NULL,
&editor->shape_group);
gtk_box_pack_start (GTK_BOX (hbox), box, FALSE, FALSE, 0);
gtk_widget_show (box);
diff --git a/app/widgets/gimpeditor.c b/app/widgets/gimpeditor.c
index a5a6845b7b..caea8d3e69 100644
--- a/app/widgets/gimpeditor.c
+++ b/app/widgets/gimpeditor.c
@@ -530,7 +530,7 @@ gimp_editor_add_icon_box (GimpEditor *editor,
button_icon_size = gimp_editor_ensure_button_box (editor, &button_relief);
hbox = gimp_enum_icon_box_new (enum_type, icon_prefix, button_icon_size,
- callback, callback_data,
+ callback, callback_data, NULL,
&first_button);
children = gtk_container_get_children (GTK_CONTAINER (hbox));
diff --git a/app/widgets/gimptemplateeditor.c b/app/widgets/gimptemplateeditor.c
index 2adf110fac..834988558b 100644
--- a/app/widgets/gimptemplateeditor.c
+++ b/app/widgets/gimptemplateeditor.c
@@ -248,7 +248,7 @@ gimp_template_editor_constructed (GObject *object)
aspect_box = gimp_enum_icon_box_new (GIMP_TYPE_ASPECT_TYPE,
"gimp", GTK_ICON_SIZE_MENU,
G_CALLBACK (gimp_template_editor_aspect_callback),
- editor,
+ editor, NULL,
&private->aspect_button);
gtk_widget_hide (private->aspect_button); /* hide "square" */
diff --git a/libgimpwidgets/gimpenumwidgets.c b/libgimpwidgets/gimpenumwidgets.c
index c7cc26d028..6f2fb6eb00 100644
--- a/libgimpwidgets/gimpenumwidgets.c
+++ b/libgimpwidgets/gimpenumwidgets.c
@@ -48,6 +48,7 @@
* @callback: a callback to connect to the "toggled" signal of each
* #GtkRadioButton that is created.
* @callback_data: data to pass to the @callback.
+ * @callback_data_destroy: Destroy function for @callback_data.
* @first_button: returns the first button in the created group.
*
* Creates a new group of #GtkRadioButtons representing the enum
@@ -60,10 +61,11 @@
* Since: 2.4
**/
GtkWidget *
-gimp_enum_radio_box_new (GType enum_type,
- GCallback callback,
- gpointer callback_data,
- GtkWidget **first_button)
+gimp_enum_radio_box_new (GType enum_type,
+ GCallback callback,
+ gpointer callback_data,
+ GDestroyNotify callback_data_destroy,
+ GtkWidget **first_button)
{
GEnumClass *enum_class;
GtkWidget *vbox;
@@ -76,6 +78,7 @@ gimp_enum_radio_box_new (GType enum_type,
enum_class->minimum,
enum_class->maximum,
callback, callback_data,
+ callback_data_destroy,
first_button);
g_type_class_unref (enum_class);
@@ -91,6 +94,7 @@ gimp_enum_radio_box_new (GType enum_type,
* @callback: a callback to connect to the "toggled" signal of each
* #GtkRadioButton that is created.
* @callback_data: data to pass to the @callback.
+ * @callback_data_destroy: Destroy function for @callback_data.
* @first_button: returns the first button in the created group.
*
* Just like gimp_enum_radio_box_new(), this function creates a group
@@ -102,12 +106,13 @@ gimp_enum_radio_box_new (GType enum_type,
* Since: 2.4
**/
GtkWidget *
-gimp_enum_radio_box_new_with_range (GType enum_type,
- gint minimum,
- gint maximum,
- GCallback callback,
- gpointer callback_data,
- GtkWidget **first_button)
+gimp_enum_radio_box_new_with_range (GType enum_type,
+ gint minimum,
+ gint maximum,
+ GCallback callback,
+ gpointer callback_data,
+ GDestroyNotify callback_data_destroy,
+ GtkWidget **first_button)
{
GtkWidget *vbox;
GtkWidget *button;
@@ -123,6 +128,10 @@ gimp_enum_radio_box_new_with_range (GType enum_type,
g_object_weak_ref (G_OBJECT (vbox),
(GWeakNotify) g_type_class_unref, enum_class);
+ if (callback_data_destroy)
+ g_object_weak_ref (G_OBJECT (vbox),
+ (GWeakNotify) callback_data_destroy, callback_data);
+
if (first_button)
*first_button = NULL;
@@ -164,6 +173,7 @@ gimp_enum_radio_box_new_with_range (GType enum_type,
* @callback: a callback to connect to the "toggled" signal of each
* #GtkRadioButton that is created.
* @callback_data: data to pass to the @callback.
+ * @callback_data_destroy: Destroy function for @callback_data.
* @first_button: returns the first button in the created group.
*
* Calls gimp_enum_radio_box_new() and puts the resulting vbox into a
@@ -174,11 +184,12 @@ gimp_enum_radio_box_new_with_range (GType enum_type,
* Since: 2.4
**/
GtkWidget *
-gimp_enum_radio_frame_new (GType enum_type,
- GtkWidget *label_widget,
- GCallback callback,
- gpointer callback_data,
- GtkWidget **first_button)
+gimp_enum_radio_frame_new (GType enum_type,
+ GtkWidget *label_widget,
+ GCallback callback,
+ gpointer callback_data,
+ GDestroyNotify callback_data_destroy,
+ GtkWidget **first_button)
{
GtkWidget *frame;
GtkWidget *radio_box;
@@ -197,6 +208,7 @@ gimp_enum_radio_frame_new (GType enum_type,
radio_box = gimp_enum_radio_box_new (enum_type,
callback, callback_data,
+ callback_data_destroy,
first_button);
gtk_container_add (GTK_CONTAINER (frame), radio_box);
gtk_widget_show (radio_box);
@@ -213,6 +225,7 @@ gimp_enum_radio_frame_new (GType enum_type,
* @callback: a callback to connect to the "toggled" signal of each
* #GtkRadioButton that is created.
* @callback_data: data to pass to the @callback.
+ * @callback_data_destroy: Destroy function for @callback_data.
* @first_button: returns the first button in the created group.
*
* Calls gimp_enum_radio_box_new_with_range() and puts the resulting
@@ -223,13 +236,14 @@ gimp_enum_radio_frame_new (GType enum_type,
* Since: 2.4
**/
GtkWidget *
-gimp_enum_radio_frame_new_with_range (GType enum_type,
- gint minimum,
- gint maximum,
- GtkWidget *label_widget,
- GCallback callback,
- gpointer callback_data,
- GtkWidget **first_button)
+gimp_enum_radio_frame_new_with_range (GType enum_type,
+ gint minimum,
+ gint maximum,
+ GtkWidget *label_widget,
+ GCallback callback,
+ gpointer callback_data,
+ GDestroyNotify callback_data_destroy,
+ GtkWidget **first_button)
{
GtkWidget *frame;
GtkWidget *radio_box;
@@ -250,6 +264,7 @@ gimp_enum_radio_frame_new_with_range (GType enum_type,
minimum,
maximum,
callback, callback_data,
+ callback_data_destroy,
first_button);
gtk_container_add (GTK_CONTAINER (frame), radio_box);
gtk_widget_show (radio_box);
@@ -265,6 +280,7 @@ gimp_enum_radio_frame_new_with_range (GType enum_type,
* @callback: a callback to connect to the "toggled" signal of each
* #GtkRadioButton that is created.
* @callback_data: data to pass to the @callback.
+ * @callback_data_destroy: Destroy function for @callback_data.
* @first_button: returns the first button in the created group.
*
* Creates a horizontal box of radio buttons with named icons. The
@@ -276,12 +292,13 @@ gimp_enum_radio_frame_new_with_range (GType enum_type,
* Since: 2.10
**/
GtkWidget *
-gimp_enum_icon_box_new (GType enum_type,
- const gchar *icon_prefix,
- GtkIconSize icon_size,
- GCallback callback,
- gpointer callback_data,
- GtkWidget **first_button)
+gimp_enum_icon_box_new (GType enum_type,
+ const gchar *icon_prefix,
+ GtkIconSize icon_size,
+ GCallback callback,
+ gpointer callback_data,
+ GDestroyNotify callback_data_destroy,
+ GtkWidget **first_button)
{
GEnumClass *enum_class;
GtkWidget *box;
@@ -295,6 +312,7 @@ gimp_enum_icon_box_new (GType enum_type,
enum_class->maximum,
icon_prefix, icon_size,
callback, callback_data,
+ callback_data_destroy,
first_button);
g_type_class_unref (enum_class);
@@ -312,6 +330,7 @@ gimp_enum_icon_box_new (GType enum_type,
* @callback: a callback to connect to the "toggled" signal of each
* #GtkRadioButton that is created.
* @callback_data: data to pass to the @callback.
+ * @callback_data_destroy: Destroy function for @callback_data.
* @first_button: returns the first button in the created group.
*
* Just like gimp_enum_icon_box_new(), this function creates a group
@@ -323,14 +342,15 @@ gimp_enum_icon_box_new (GType enum_type,
* Since: 2.10
**/
GtkWidget *
-gimp_enum_icon_box_new_with_range (GType enum_type,
- gint minimum,
- gint maximum,
- const gchar *icon_prefix,
- GtkIconSize icon_size,
- GCallback callback,
- gpointer callback_data,
- GtkWidget **first_button)
+gimp_enum_icon_box_new_with_range (GType enum_type,
+ gint minimum,
+ gint maximum,
+ const gchar *icon_prefix,
+ GtkIconSize icon_size,
+ GCallback callback,
+ gpointer callback_data,
+ GDestroyNotify callback_data_destroy,
+ GtkWidget **first_button)
{
GtkWidget *hbox;
GtkWidget *button;
@@ -349,6 +369,10 @@ gimp_enum_icon_box_new_with_range (GType enum_type,
g_object_weak_ref (G_OBJECT (hbox),
(GWeakNotify) g_type_class_unref, enum_class);
+ if (callback_data_destroy)
+ g_object_weak_ref (G_OBJECT (hbox),
+ (GWeakNotify) callback_data_destroy, callback_data);
+
if (first_button)
*first_button = NULL;
diff --git a/libgimpwidgets/gimpenumwidgets.h b/libgimpwidgets/gimpenumwidgets.h
index 19164dfc5d..a864e09cea 100644
--- a/libgimpwidgets/gimpenumwidgets.h
+++ b/libgimpwidgets/gimpenumwidgets.h
@@ -29,47 +29,53 @@
G_BEGIN_DECLS
-GtkWidget * gimp_enum_radio_box_new (GType enum_type,
- GCallback callback,
- gpointer callback_data,
- GtkWidget **first_button);
-GtkWidget * gimp_enum_radio_box_new_with_range (GType enum_type,
- gint minimum,
- gint maximum,
- GCallback callback,
- gpointer callback_data,
- GtkWidget **first_button);
+GtkWidget * gimp_enum_radio_box_new (GType enum_type,
+ GCallback callback,
+ gpointer callback_data,
+ GDestroyNotify callback_data_destroy,
+ GtkWidget **first_button);
+GtkWidget * gimp_enum_radio_box_new_with_range (GType enum_type,
+ gint minimum,
+ gint maximum,
+ GCallback callback,
+ gpointer callback_data,
+ GDestroyNotify callback_data_destroy,
+ GtkWidget **first_button);
-GtkWidget * gimp_enum_radio_frame_new (GType enum_type,
- GtkWidget *label_widget,
- GCallback callback,
- gpointer callback_data,
- GtkWidget **first_button);
-GtkWidget * gimp_enum_radio_frame_new_with_range (GType enum_type,
- gint minimum,
- gint maximum,
- GtkWidget *label_widget,
- GCallback callback,
- gpointer callback_data,
- GtkWidget **first_button);
+GtkWidget * gimp_enum_radio_frame_new (GType enum_type,
+ GtkWidget *label_widget,
+ GCallback callback,
+ gpointer callback_data,
+ GDestroyNotify callback_data_destroy,
+ GtkWidget **first_button);
+GtkWidget * gimp_enum_radio_frame_new_with_range (GType enum_type,
+ gint minimum,
+ gint maximum,
+ GtkWidget *label_widget,
+ GCallback callback,
+ gpointer callback_data,
+ GDestroyNotify callback_data_destroy,
+ GtkWidget **first_button);
-GtkWidget * gimp_enum_icon_box_new (GType enum_type,
- const gchar *icon_prefix,
- GtkIconSize icon_size,
- GCallback callback,
- gpointer callback_data,
- GtkWidget **first_button);
-GtkWidget * gimp_enum_icon_box_new_with_range (GType enum_type,
- gint minimum,
- gint maximum,
- const gchar *icon_prefix,
- GtkIconSize icon_size,
- GCallback callback,
- gpointer callback_data,
- GtkWidget **first_button);
-void gimp_enum_icon_box_set_child_padding (GtkWidget *icon_box,
- gint xpad,
- gint ypad);
+GtkWidget * gimp_enum_icon_box_new (GType enum_type,
+ const gchar *icon_prefix,
+ GtkIconSize icon_size,
+ GCallback callback,
+ gpointer callback_data,
+ GDestroyNotify callback_data_destroy,
+ GtkWidget **first_button);
+GtkWidget * gimp_enum_icon_box_new_with_range (GType enum_type,
+ gint minimum,
+ gint maximum,
+ const gchar *icon_prefix,
+ GtkIconSize icon_size,
+ GCallback callback,
+ gpointer callback_data,
+ GDestroyNotify callback_data_destroy,
+ GtkWidget **first_button);
+void gimp_enum_icon_box_set_child_padding (GtkWidget *icon_box,
+ gint xpad,
+ gint ypad);
G_END_DECLS
diff --git a/libgimpwidgets/gimppropwidgets.c b/libgimpwidgets/gimppropwidgets.c
index 296b675750..5eff3c20ad 100644
--- a/libgimpwidgets/gimppropwidgets.c
+++ b/libgimpwidgets/gimppropwidgets.c
@@ -842,7 +842,7 @@ gimp_prop_enum_radio_frame_new (GObject *config,
minimum, maximum,
gtk_label_new (title),
G_CALLBACK (gimp_prop_radio_button_callback),
- config,
+ config, NULL,
&button);
}
else
@@ -850,7 +850,7 @@ gimp_prop_enum_radio_frame_new (GObject *config,
frame = gimp_enum_radio_frame_new (param_spec->value_type,
gtk_label_new (title),
G_CALLBACK (gimp_prop_radio_button_callback),
- config,
+ config, NULL,
&button);
}
@@ -913,14 +913,14 @@ gimp_prop_enum_radio_box_new (GObject *config,
vbox = gimp_enum_radio_box_new_with_range (param_spec->value_type,
minimum, maximum,
G_CALLBACK (gimp_prop_radio_button_callback),
- config,
+ config, NULL,
&button);
}
else
{
vbox = gimp_enum_radio_box_new (param_spec->value_type,
G_CALLBACK (gimp_prop_radio_button_callback),
- config,
+ config, NULL,
&button);
}
@@ -1116,7 +1116,7 @@ gimp_prop_enum_icon_box_new (GObject *config,
icon_prefix,
GTK_ICON_SIZE_MENU,
G_CALLBACK (gimp_prop_radio_button_callback),
- config,
+ config, NULL,
&button);
}
else
@@ -1125,7 +1125,7 @@ gimp_prop_enum_icon_box_new (GObject *config,
icon_prefix,
GTK_ICON_SIZE_MENU,
G_CALLBACK (gimp_prop_radio_button_callback),
- config,
+ config, NULL,
&button);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]