diff --git a/app/core/gimp-gui.c b/app/core/gimp-gui.c
index c08da6b67d..3ea8fcf920 100644
--- a/app/core/gimp-gui.c
+++ b/app/core/gimp-gui.c
@@ -29,8 +29,10 @@
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimpdisplay.h"
+#include "gimpdrawable.h"
#include "gimpimage.h"
#include "gimpprogress.h"
+#include "gimpresource.h"
#include "gimpwaitable.h"
#include "about.h"
@@ -403,7 +405,7 @@ gboolean
gimp_pdb_dialog_new (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
- GimpContainer *container,
+ GType contents_type,
GBytes *parent_handle,
const gchar *title,
const gchar *callback_name,
@@ -415,7 +417,8 @@ gimp_pdb_dialog_new (Gimp *gimp,
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), FALSE);
g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), FALSE);
- g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE);
+ g_return_val_if_fail (g_type_is_a (contents_type, GIMP_TYPE_RESOURCE) ||
+ contents_type == GIMP_TYPE_DRAWABLE, FALSE);
g_return_val_if_fail (title != NULL, FALSE);
g_return_val_if_fail (callback_name != NULL, FALSE);
@@ -426,7 +429,7 @@ gimp_pdb_dialog_new (Gimp *gimp,
va_start (args, object);
retval = gimp->gui.pdb_dialog_new (gimp, context, progress,
- container, parent_handle, title,
+ contents_type, parent_handle, title,
callback_name, object, args);
va_end (args);
@@ -436,18 +439,19 @@ gimp_pdb_dialog_new (Gimp *gimp,
}
gboolean
-gimp_pdb_dialog_set (Gimp *gimp,
- GimpContainer *container,
- const gchar *callback_name,
- GimpObject *object,
+gimp_pdb_dialog_set (Gimp *gimp,
+ GType contents_type,
+ const gchar *callback_name,
+ GimpObject *object,
...)
{
gboolean retval = FALSE;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
- g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE);
+ g_return_val_if_fail (g_type_is_a (contents_type, GIMP_TYPE_RESOURCE) ||
+ contents_type == GIMP_TYPE_DRAWABLE, FALSE);
g_return_val_if_fail (callback_name != NULL, FALSE);
- g_return_val_if_fail (object != NULL, FALSE);
+ g_return_val_if_fail (object == NULL || g_type_is_a (G_TYPE_FROM_INSTANCE (object), contents_type), FALSE);
if (gimp->gui.pdb_dialog_set)
{
@@ -455,7 +459,7 @@ gimp_pdb_dialog_set (Gimp *gimp,
va_start (args, object);
- retval = gimp->gui.pdb_dialog_set (gimp, container, callback_name,
+ retval = gimp->gui.pdb_dialog_set (gimp, contents_type, callback_name,
object, args);
va_end (args);
@@ -466,15 +470,16 @@ gimp_pdb_dialog_set (Gimp *gimp,
gboolean
gimp_pdb_dialog_close (Gimp *gimp,
- GimpContainer *container,
+ GType contents_type,
const gchar *callback_name)
{
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
- g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE);
+ g_return_val_if_fail (g_type_is_a (contents_type, GIMP_TYPE_RESOURCE) ||
+ contents_type == GIMP_TYPE_DRAWABLE, FALSE);
g_return_val_if_fail (callback_name != NULL, FALSE);
if (gimp->gui.pdb_dialog_close)
- return gimp->gui.pdb_dialog_close (gimp, container, callback_name);
+ return gimp->gui.pdb_dialog_close (gimp, contents_type, callback_name);
return FALSE;
}
diff --git a/app/core/gimp-gui.h b/app/core/gimp-gui.h
index f11deca70d..fc554745ce 100644
--- a/app/core/gimp-gui.h
+++ b/app/core/gimp-gui.h
@@ -73,19 +73,19 @@ struct _GimpGui
gboolean (* pdb_dialog_new) (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
- GimpContainer *container,
+ GType contents_type,
GBytes *parent_handle,
const gchar *title,
const gchar *callback_name,
GimpObject *object,
va_list args);
gboolean (* pdb_dialog_set) (Gimp *gimp,
- GimpContainer *container,
+ GType contents_type,
const gchar *callback_name,
GimpObject *object,
va_list args);
gboolean (* pdb_dialog_close) (Gimp *gimp,
- GimpContainer *container,
+ GType contents_type,
const gchar *callback_name);
gboolean (* recent_list_add_file) (Gimp *gimp,
GFile *file,
@@ -172,20 +172,21 @@ GFile * gimp_get_icon_theme_dir (Gimp *gimp);
gboolean gimp_pdb_dialog_new (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
- GimpContainer *container,
+ GType contents_type,
GBytes *parent_handle,
const gchar *title,
const gchar *callback_name,
GimpObject *object,
...) G_GNUC_NULL_TERMINATED;
gboolean gimp_pdb_dialog_set (Gimp *gimp,
- GimpContainer *container,
+ GType contents_type,
const gchar *callback_name,
GimpObject *object,
...) G_GNUC_NULL_TERMINATED;
gboolean gimp_pdb_dialog_close (Gimp *gimp,
- GimpContainer *container,
+ GType contents_type,
const gchar *callback_name);
+
gboolean gimp_recent_list_add_file (Gimp *gimp,
GFile *file,
const gchar *mime_type);
diff --git a/app/gui/gui-vtable.c b/app/gui/gui-vtable.c
index cc8c6e624b..9c8b228255 100644
--- a/app/gui/gui-vtable.c
+++ b/app/gui/gui-vtable.c
@@ -58,6 +58,8 @@
#include "core/gimpcancelable.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
+#include "core/gimpdatafactory.h"
+#include "core/gimpdrawable.h"
#include "core/gimpgradient.h"
#include "core/gimpimage.h"
#include "core/gimpimagefile.h"
@@ -85,6 +87,7 @@
#include "widgets/gimpmenufactory.h"
#include "widgets/gimppaletteselect.h"
#include "widgets/gimppatternselect.h"
+#include "widgets/gimppickableselect.h"
#include "widgets/gimpprogressdialog.h"
#include "widgets/gimpuimanager.h"
#include "widgets/gimpwidgets-utils.h"
@@ -152,19 +155,19 @@ static void gui_free_progress (Gimp *gimp,
static gboolean gui_pdb_dialog_new (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
- GimpContainer *container,
+ GType object_type,
GBytes *parent_handle,
const gchar *title,
const gchar *callback_name,
GimpObject *object,
va_list args);
static gboolean gui_pdb_dialog_set (Gimp *gimp,
- GimpContainer *container,
+ GType contents_type,
const gchar *callback_name,
GimpObject *object,
va_list args);
static gboolean gui_pdb_dialog_close (Gimp *gimp,
- GimpContainer *container,
+ GType contents_type,
const gchar *callback_name);
static gboolean gui_recent_list_add_file (Gimp *gimp,
GFile *file,
@@ -611,7 +614,7 @@ static gboolean
gui_pdb_dialog_new (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
- GimpContainer *container,
+ GType contents_type,
GBytes *parent_handle,
const gchar *title,
const gchar *callback_name,
@@ -622,46 +625,48 @@ gui_pdb_dialog_new (Gimp *gimp,
const gchar *dialog_role = NULL;
const gchar *help_id = NULL;
- if (gimp_container_get_children_type (container) == GIMP_TYPE_BRUSH)
+ if (contents_type == GIMP_TYPE_BRUSH)
{
dialog_type = GIMP_TYPE_BRUSH_SELECT;
dialog_role = "gimp-brush-selection";
help_id = GIMP_HELP_BRUSH_DIALOG;
}
- else if (gimp_container_get_children_type (container) == GIMP_TYPE_FONT)
+ else if (contents_type == GIMP_TYPE_FONT)
{
dialog_type = GIMP_TYPE_FONT_SELECT;
dialog_role = "gimp-font-selection";
help_id = GIMP_HELP_FONT_DIALOG;
}
- else if (gimp_container_get_children_type (container) == GIMP_TYPE_GRADIENT)
+ else if (contents_type == GIMP_TYPE_GRADIENT)
{
dialog_type = GIMP_TYPE_GRADIENT_SELECT;
dialog_role = "gimp-gradient-selection";
help_id = GIMP_HELP_GRADIENT_DIALOG;
}
- else if (gimp_container_get_children_type (container) == GIMP_TYPE_PALETTE)
+ else if (contents_type == GIMP_TYPE_PALETTE)
{
dialog_type = GIMP_TYPE_PALETTE_SELECT;
dialog_role = "gimp-palette-selection";
help_id = GIMP_HELP_PALETTE_DIALOG;
}
- else if (gimp_container_get_children_type (container) == GIMP_TYPE_PATTERN)
+ else if (contents_type == GIMP_TYPE_PATTERN)
{
dialog_type = GIMP_TYPE_PATTERN_SELECT;
dialog_role = "gimp-pattern-selection";
help_id = GIMP_HELP_PATTERN_DIALOG;
}
+ else if (contents_type == GIMP_TYPE_DRAWABLE)
+ {
+ dialog_type = GIMP_TYPE_PICKABLE_SELECT;
+ dialog_role = "gimp-pickable-selection";
+ }
if (dialog_type != G_TYPE_NONE)
{
- GimpObject *object = NULL;
+ if (! object && contents_type != GIMP_TYPE_DRAWABLE)
+ object = gimp_context_get_by_type (context, contents_type);
- if (! object)
- object = gimp_context_get_by_type (context,
- gimp_container_get_children_type (container));
-
- if (object)
+ if (object || contents_type == GIMP_TYPE_DRAWABLE)
{
gint n_properties = 0;
gchar **names = NULL;
@@ -682,7 +687,7 @@ gui_pdb_dialog_new (Gimp *gimp,
"help-id", help_id,
"pdb", gimp->pdb,
"context", context,
- "select-type", gimp_container_get_children_type (container),
+ "select-type", contents_type,
"initial-object", object,
"callback-name", callback_name,
"menu-factory", menus_get_global_menu_factory (gimp),
@@ -735,37 +740,65 @@ gui_pdb_dialog_new (Gimp *gimp,
static gboolean
gui_pdb_dialog_set (Gimp *gimp,
- GimpContainer *container,
+ GType contents_type,
const gchar *callback_name,
GimpObject *object,
va_list args)
{
- GimpPdbDialogClass *klass = NULL;
+ GimpPdbDialogClass *klass = NULL;
+ GimpContainer *container = NULL;
GimpPdbDialog *dialog;
- if (gimp_container_get_children_type (container) == GIMP_TYPE_BRUSH)
- klass = g_type_class_peek (GIMP_TYPE_BRUSH_SELECT);
- else if (gimp_container_get_children_type (container) == GIMP_TYPE_FONT)
- klass = g_type_class_peek (GIMP_TYPE_FONT_SELECT);
- else if (gimp_container_get_children_type (container) == GIMP_TYPE_GRADIENT)
- klass = g_type_class_peek (GIMP_TYPE_GRADIENT_SELECT);
- else if (gimp_container_get_children_type (container) == GIMP_TYPE_PALETTE)
- klass = g_type_class_peek (GIMP_TYPE_PALETTE_SELECT);
- else if (gimp_container_get_children_type (container) == GIMP_TYPE_PATTERN)
- klass = g_type_class_peek (GIMP_TYPE_PATTERN_SELECT);
+ if (contents_type == GIMP_TYPE_BRUSH)
+ {
+ klass = g_type_class_peek (GIMP_TYPE_BRUSH_SELECT);
+ container = gimp_data_factory_get_container (gimp->brush_factory);
+ }
+ else if (contents_type == GIMP_TYPE_FONT)
+ {
+ klass = g_type_class_peek (GIMP_TYPE_FONT_SELECT);
+ container = gimp_data_factory_get_container (gimp->font_factory);
+ }
+ else if (contents_type == GIMP_TYPE_GRADIENT)
+ {
+ klass = g_type_class_peek (GIMP_TYPE_GRADIENT_SELECT);
+ container = gimp_data_factory_get_container (gimp->gradient_factory);
+ }
+ else if (contents_type == GIMP_TYPE_PALETTE)
+ {
+ klass = g_type_class_peek (GIMP_TYPE_PALETTE_SELECT);
+ container = gimp_data_factory_get_container (gimp->palette_factory);
+ }
+ else if (contents_type == GIMP_TYPE_PATTERN)
+ {
+ klass = g_type_class_peek (GIMP_TYPE_PATTERN_SELECT);
+ container = gimp_data_factory_get_container (gimp->pattern_factory);
+ }
+ else if (contents_type == GIMP_TYPE_DRAWABLE)
+ {
+ klass = g_type_class_peek (GIMP_TYPE_PICKABLE_SELECT);
+ }
g_return_val_if_fail (klass != NULL, FALSE);
dialog = gimp_pdb_dialog_get_by_callback (klass, callback_name);
- if (dialog != NULL &&
- dialog->select_type == gimp_container_get_children_type (container) &&
- gimp_container_get_child_index (container, object) != -1)
+ if (dialog != NULL &&
+ dialog->select_type == contents_type &&
+ (container == NULL || gimp_container_get_child_index (container, object) != -1))
{
const gchar *prop_name = va_arg (args, const gchar *);
- gimp_context_set_by_type (dialog->context, dialog->select_type,
- object);
+ if (g_type_is_a (contents_type, GIMP_TYPE_RESOURCE))
+ {
+ g_return_val_if_fail (container != NULL, FALSE);
+ gimp_context_set_by_type (dialog->context, dialog->select_type, object);
+ }
+ else
+ {
+ g_return_val_if_fail (klass->set_object != NULL, FALSE);
+ klass->set_object (dialog, object);
+ }
if (prop_name)
g_object_set_valist (G_OBJECT (dialog), prop_name, args);
@@ -779,22 +812,24 @@ gui_pdb_dialog_set (Gimp *gimp,
}
static gboolean
-gui_pdb_dialog_close (Gimp *gimp,
- GimpContainer *container,
- const gchar *callback_name)
+gui_pdb_dialog_close (Gimp *gimp,
+ GType contents_type,
+ const gchar *callback_name)
{
GimpPdbDialogClass *klass = NULL;
- if (gimp_container_get_children_type (container) == GIMP_TYPE_BRUSH)
+ if (contents_type == GIMP_TYPE_BRUSH)
klass = g_type_class_peek (GIMP_TYPE_BRUSH_SELECT);
- else if (gimp_container_get_children_type (container) == GIMP_TYPE_FONT)
+ else if (contents_type == GIMP_TYPE_FONT)
klass = g_type_class_peek (GIMP_TYPE_FONT_SELECT);
- else if (gimp_container_get_children_type (container) == GIMP_TYPE_GRADIENT)
+ else if (contents_type == GIMP_TYPE_GRADIENT)
klass = g_type_class_peek (GIMP_TYPE_GRADIENT_SELECT);
- else if (gimp_container_get_children_type (container) == GIMP_TYPE_PALETTE)
+ else if (contents_type == GIMP_TYPE_PALETTE)
klass = g_type_class_peek (GIMP_TYPE_PALETTE_SELECT);
- else if (gimp_container_get_children_type (container) == GIMP_TYPE_PATTERN)
+ else if (contents_type == GIMP_TYPE_PATTERN)
klass = g_type_class_peek (GIMP_TYPE_PATTERN_SELECT);
+ else if (contents_type == GIMP_TYPE_DRAWABLE)
+ klass = g_type_class_peek (GIMP_TYPE_PICKABLE_SELECT);
if (klass)
{
@@ -802,7 +837,7 @@ gui_pdb_dialog_close (Gimp *gimp,
dialog = gimp_pdb_dialog_get_by_callback (klass, callback_name);
- if (dialog && dialog->select_type == gimp_container_get_children_type (container))
+ if (dialog && dialog->select_type == contents_type)
{
gtk_widget_destroy (GTK_WIDGET (dialog));
return TRUE;
diff --git a/app/pdb/brush-select-cmds.c b/app/pdb/brush-select-cmds.c
index ebd5ed94ca..0024ce02c5 100644
--- a/app/pdb/brush-select-cmds.c
+++ b/app/pdb/brush-select-cmds.c
@@ -31,6 +31,7 @@
#include "core/gimp.h"
#include "core/gimpbrush.h"
+#include "core/gimpcontainer.h"
#include "core/gimpdatafactory.h"
#include "core/gimpparamspecs.h"
@@ -60,10 +61,12 @@ brushes_popup_invoker (GimpProcedure *procedure,
if (success)
{
- if (gimp->no_interface ||
+ GimpContainer *container = gimp_data_factory_get_container (gimp->brush_factory);
+
+ if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, brush_callback) ||
! gimp_pdb_dialog_new (gimp, context, progress,
- gimp_data_factory_get_container (gimp->brush_factory),
+ gimp_container_get_children_type (container),
parent_window, popup_title, brush_callback,
GIMP_OBJECT (initial_brush), NULL))
success = FALSE;
@@ -88,9 +91,12 @@ brushes_close_popup_invoker (GimpProcedure *procedure,
if (success)
{
+ GimpContainer *container = gimp_data_factory_get_container (gimp->brush_factory);
+
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, brush_callback) ||
- ! gimp_pdb_dialog_close (gimp, gimp_data_factory_get_container (gimp->brush_factory),
+ ! gimp_pdb_dialog_close (gimp,
+ gimp_container_get_children_type (container),
brush_callback))
success = FALSE;
}
@@ -116,9 +122,12 @@ brushes_set_popup_invoker (GimpProcedure *procedure,
if (success)
{
+ GimpContainer *container = gimp_data_factory_get_container (gimp->brush_factory);
+
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, brush_callback) ||
- ! gimp_pdb_dialog_set (gimp, gimp_data_factory_get_container (gimp->brush_factory),
+ ! gimp_pdb_dialog_set (gimp,
+ gimp_container_get_children_type (container),
brush_callback, GIMP_OBJECT (brush), NULL))
success = FALSE;
}
diff --git a/app/pdb/drawable-select-cmds.c b/app/pdb/drawable-select-cmds.c
new file mode 100644
index 0000000000..44e0e550a9
--- /dev/null
+++ b/app/pdb/drawable-select-cmds.c
@@ -0,0 +1,229 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include "stamp-pdbgen.h"
+
+#include
+
+#include
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpdatafactory.h"
+#include "core/gimpdrawable.h"
+#include "core/gimpparamspecs.h"
+
+#include "gimppdb.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+drawables_popup_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *callback;
+ const gchar *popup_title;
+ GimpDrawable *initial_drawable;
+ GBytes *parent_window;
+
+ callback = g_value_get_string (gimp_value_array_index (args, 0));
+ popup_title = g_value_get_string (gimp_value_array_index (args, 1));
+ initial_drawable = g_value_get_object (gimp_value_array_index (args, 2));
+ parent_window = g_value_get_boxed (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (gimp->no_interface ||
+ ! gimp_pdb_lookup_procedure (gimp->pdb, callback) ||
+ ! gimp_pdb_dialog_new (gimp, context, progress,
+ GIMP_TYPE_DRAWABLE, parent_window,
+ popup_title, callback, GIMP_OBJECT (initial_drawable),
+ NULL))
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawables_close_popup_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *callback;
+
+ callback = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ if (gimp->no_interface ||
+ ! gimp_pdb_lookup_procedure (gimp->pdb, callback) ||
+ ! gimp_pdb_dialog_close (gimp, GIMP_TYPE_DRAWABLE, callback))
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawables_set_popup_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *callback;
+ GimpDrawable *drawable;
+
+ callback = g_value_get_string (gimp_value_array_index (args, 0));
+ drawable = g_value_get_object (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp->no_interface ||
+ ! gimp_pdb_lookup_procedure (gimp->pdb, callback) ||
+ ! gimp_pdb_dialog_set (gimp, GIMP_TYPE_DRAWABLE, callback, GIMP_OBJECT (drawable), NULL))
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_drawable_select_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-drawables-popup
+ */
+ procedure = gimp_procedure_new (drawables_popup_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawables-popup");
+ gimp_procedure_set_static_help (procedure,
+ "Invokes the drawable selection dialog.",
+ "Opens a dialog letting a user choose an drawable.",
+ NULL);
+ gimp_procedure_set_static_attribution (procedure,
+ "Jehan",
+ "Jehan",
+ "2023");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("callback",
+ "callback",
+ "The callback PDB proc to call when user chooses an drawable",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("popup-title",
+ "popup title",
+ "Title of the drawable selection dialog",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable ("initial-drawable",
+ "initial drawable",
+ "The drawable to set as the initial choice",
+ FALSE,
+ GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boxed ("parent-window",
+ "parent window",
+ "An optional parent window handle for the popup to be set transient to",
+ G_TYPE_BYTES,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawables-close-popup
+ */
+ procedure = gimp_procedure_new (drawables_close_popup_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawables-close-popup");
+ gimp_procedure_set_static_help (procedure,
+ "Close the drawable selection dialog.",
+ "Closes an open drawable selection dialog.",
+ NULL);
+ gimp_procedure_set_static_attribution (procedure,
+ "Jehan",
+ "Jehan",
+ "2023");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("callback",
+ "callback",
+ "The name of the callback registered for this pop-up",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawables-set-popup
+ */
+ procedure = gimp_procedure_new (drawables_set_popup_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawables-set-popup");
+ gimp_procedure_set_static_help (procedure,
+ "Sets the selected drawable in a drawable selection dialog.",
+ "Sets the selected drawable in a drawable selection dialog.",
+ NULL);
+ gimp_procedure_set_static_attribution (procedure,
+ "Jehan",
+ "Jehan",
+ "2023");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("callback",
+ "callback",
+ "The name of the callback registered for this pop-up",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable ("drawable",
+ "drawable",
+ "The drawable to set as selected",
+ FALSE,
+ GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/font-select-cmds.c b/app/pdb/font-select-cmds.c
index 5b9b3a5479..94390cf62e 100644
--- a/app/pdb/font-select-cmds.c
+++ b/app/pdb/font-select-cmds.c
@@ -30,6 +30,7 @@
#include "pdb-types.h"
#include "core/gimp.h"
+#include "core/gimpcontainer.h"
#include "core/gimpdatafactory.h"
#include "core/gimpparamspecs.h"
#include "text/gimpfont.h"
@@ -60,11 +61,13 @@ fonts_popup_invoker (GimpProcedure *procedure,
if (success)
{
+ GimpContainer *container = gimp_data_factory_get_container (gimp->font_factory);
+
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, font_callback) ||
! gimp_data_factory_data_wait (gimp->font_factory) ||
! gimp_pdb_dialog_new (gimp, context, progress,
- gimp_data_factory_get_container (gimp->font_factory),
+ gimp_container_get_children_type (container),
parent_window, popup_title, font_callback,
GIMP_OBJECT (initial_font), NULL))
success = FALSE;
@@ -89,10 +92,12 @@ fonts_close_popup_invoker (GimpProcedure *procedure,
if (success)
{
+ GimpContainer *container = gimp_data_factory_get_container (gimp->font_factory);
+
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, font_callback) ||
! gimp_pdb_dialog_close (gimp,
- gimp_data_factory_get_container (gimp->font_factory),
+ gimp_container_get_children_type (container),
font_callback))
success = FALSE;
}
@@ -118,10 +123,13 @@ fonts_set_popup_invoker (GimpProcedure *procedure,
if (success)
{
+ GimpContainer *container = gimp_data_factory_get_container (gimp->font_factory);
+
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, font_callback) ||
! gimp_data_factory_data_wait (gimp->font_factory) ||
- ! gimp_pdb_dialog_set (gimp, gimp_data_factory_get_container (gimp->font_factory),
+ ! gimp_pdb_dialog_set (gimp,
+ gimp_container_get_children_type (container),
font_callback, GIMP_OBJECT (font), NULL))
success = FALSE;
}
diff --git a/app/pdb/gradient-select-cmds.c b/app/pdb/gradient-select-cmds.c
index 65c4625ba8..daf74914e9 100644
--- a/app/pdb/gradient-select-cmds.c
+++ b/app/pdb/gradient-select-cmds.c
@@ -30,6 +30,7 @@
#include "pdb-types.h"
#include "core/gimp.h"
+#include "core/gimpcontainer.h"
#include "core/gimpdatafactory.h"
#include "core/gimpgradient.h"
#include "core/gimpparamspecs.h"
@@ -60,6 +61,8 @@ gradients_popup_invoker (GimpProcedure *procedure,
if (success)
{
+ GimpContainer *container = gimp_data_factory_get_container (gimp->gradient_factory);
+
/* Formerly, this procedure had another parameter:
* the sample size of the gradient's data passed in the changed callback.
* Now the sample size is determined by core, and in the future,
@@ -69,7 +72,7 @@ gradients_popup_invoker (GimpProcedure *procedure,
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, gradient_callback) ||
! gimp_pdb_dialog_new (gimp, context, progress,
- gimp_data_factory_get_container (gimp->gradient_factory),
+ gimp_container_get_children_type (container),
parent_window, popup_title, gradient_callback,
GIMP_OBJECT (initial_gradient), NULL))
success = FALSE;
@@ -94,9 +97,12 @@ gradients_close_popup_invoker (GimpProcedure *procedure,
if (success)
{
+ GimpContainer *container = gimp_data_factory_get_container (gimp->gradient_factory);
+
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, gradient_callback) ||
- ! gimp_pdb_dialog_close (gimp, gimp_data_factory_get_container (gimp->gradient_factory),
+ ! gimp_pdb_dialog_close (gimp,
+ gimp_container_get_children_type (container),
gradient_callback))
success = FALSE;
}
@@ -122,9 +128,12 @@ gradients_set_popup_invoker (GimpProcedure *procedure,
if (success)
{
+ GimpContainer *container = gimp_data_factory_get_container (gimp->gradient_factory);
+
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, gradient_callback) ||
- ! gimp_pdb_dialog_set (gimp, gimp_data_factory_get_container (gimp->gradient_factory),
+ ! gimp_pdb_dialog_set (gimp,
+ gimp_container_get_children_type (container),
gradient_callback, GIMP_OBJECT (gradient), NULL))
success = FALSE;
}
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 8771c9e8ea..0826c514cf 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -30,7 +30,7 @@
#include "internal-procs.h"
-/* 775 procedures registered total */
+/* 778 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)
@@ -48,6 +48,7 @@ internal_procs_init (GimpPDB *pdb)
register_drawable_procs (pdb);
register_drawable_color_procs (pdb);
register_drawable_edit_procs (pdb);
+ register_drawable_select_procs (pdb);
register_dynamics_procs (pdb);
register_edit_procs (pdb);
register_file_procs (pdb);
diff --git a/app/pdb/internal-procs.h b/app/pdb/internal-procs.h
index e05ed2a43b..807d6ffae0 100644
--- a/app/pdb/internal-procs.h
+++ b/app/pdb/internal-procs.h
@@ -35,6 +35,7 @@ void register_display_procs (GimpPDB *pdb);
void register_drawable_procs (GimpPDB *pdb);
void register_drawable_color_procs (GimpPDB *pdb);
void register_drawable_edit_procs (GimpPDB *pdb);
+void register_drawable_select_procs (GimpPDB *pdb);
void register_dynamics_procs (GimpPDB *pdb);
void register_edit_procs (GimpPDB *pdb);
void register_file_procs (GimpPDB *pdb);
diff --git a/app/pdb/meson.build b/app/pdb/meson.build
index cd5e7ecd19..125e2f9d66 100644
--- a/app/pdb/meson.build
+++ b/app/pdb/meson.build
@@ -19,6 +19,7 @@ libappinternalprocs_sources = [
'drawable-cmds.c',
'drawable-color-cmds.c',
'drawable-edit-cmds.c',
+ 'drawable-select-cmds.c',
'dynamics-cmds.c',
'edit-cmds.c',
'file-cmds.c',
diff --git a/app/pdb/palette-select-cmds.c b/app/pdb/palette-select-cmds.c
index 6f54a5dbcc..33b08787d6 100644
--- a/app/pdb/palette-select-cmds.c
+++ b/app/pdb/palette-select-cmds.c
@@ -30,6 +30,7 @@
#include "pdb-types.h"
#include "core/gimp.h"
+#include "core/gimpcontainer.h"
#include "core/gimpdatafactory.h"
#include "core/gimppalette.h"
#include "core/gimpparamspecs.h"
@@ -60,10 +61,12 @@ palettes_popup_invoker (GimpProcedure *procedure,
if (success)
{
+ GimpContainer *container = gimp_data_factory_get_container (gimp->palette_factory);
+
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, palette_callback) ||
! gimp_pdb_dialog_new (gimp, context, progress,
- gimp_data_factory_get_container (gimp->palette_factory),
+ gimp_container_get_children_type (container),
parent_window, popup_title, palette_callback,
GIMP_OBJECT (initial_palette), NULL))
success = FALSE;
@@ -88,9 +91,12 @@ palettes_close_popup_invoker (GimpProcedure *procedure,
if (success)
{
+ GimpContainer *container = gimp_data_factory_get_container (gimp->palette_factory);
+
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, palette_callback) ||
- ! gimp_pdb_dialog_close (gimp, gimp_data_factory_get_container (gimp->palette_factory),
+ ! gimp_pdb_dialog_close (gimp,
+ gimp_container_get_children_type (container),
palette_callback))
success = FALSE;
}
@@ -116,9 +122,12 @@ palettes_set_popup_invoker (GimpProcedure *procedure,
if (success)
{
+ GimpContainer *container = gimp_data_factory_get_container (gimp->palette_factory);
+
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, palette_callback) ||
- ! gimp_pdb_dialog_set (gimp, gimp_data_factory_get_container (gimp->palette_factory),
+ ! gimp_pdb_dialog_set (gimp,
+ gimp_container_get_children_type (container),
palette_callback, GIMP_OBJECT (palette), NULL))
success = FALSE;
}
diff --git a/app/pdb/pattern-select-cmds.c b/app/pdb/pattern-select-cmds.c
index 39c6205bf5..0b6b33d64d 100644
--- a/app/pdb/pattern-select-cmds.c
+++ b/app/pdb/pattern-select-cmds.c
@@ -30,6 +30,7 @@
#include "pdb-types.h"
#include "core/gimp.h"
+#include "core/gimpcontainer.h"
#include "core/gimpdatafactory.h"
#include "core/gimpparamspecs.h"
#include "core/gimppattern.h"
@@ -60,10 +61,12 @@ patterns_popup_invoker (GimpProcedure *procedure,
if (success)
{
+ GimpContainer *container = gimp_data_factory_get_container (gimp->pattern_factory);
+
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, pattern_callback) ||
! gimp_pdb_dialog_new (gimp, context, progress,
- gimp_data_factory_get_container (gimp->pattern_factory),
+ gimp_container_get_children_type (container),
parent_window, popup_title, pattern_callback,
GIMP_OBJECT (initial_pattern), NULL))
success = FALSE;
@@ -88,9 +91,12 @@ patterns_close_popup_invoker (GimpProcedure *procedure,
if (success)
{
+ GimpContainer *container = gimp_data_factory_get_container (gimp->pattern_factory);
+
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, pattern_callback) ||
- ! gimp_pdb_dialog_close (gimp, gimp_data_factory_get_container (gimp->pattern_factory),
+ ! gimp_pdb_dialog_close (gimp,
+ gimp_container_get_children_type (container),
pattern_callback))
success = FALSE;
}
@@ -116,9 +122,12 @@ patterns_set_popup_invoker (GimpProcedure *procedure,
if (success)
{
+ GimpContainer *container = gimp_data_factory_get_container (gimp->pattern_factory);
+
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, pattern_callback) ||
- ! gimp_pdb_dialog_set (gimp, gimp_data_factory_get_container (gimp->pattern_factory),
+ ! gimp_pdb_dialog_set (gimp,
+ gimp_container_get_children_type (container),
pattern_callback, GIMP_OBJECT (pattern), NULL))
success = FALSE;
}
diff --git a/app/widgets/gimppdbdialog.c b/app/widgets/gimppdbdialog.c
index c5e29f4ac2..c37b9de19a 100644
--- a/app/widgets/gimppdbdialog.c
+++ b/app/widgets/gimppdbdialog.c
@@ -32,6 +32,7 @@
#include "core/gimp.h"
#include "core/gimpcontext.h"
+#include "core/gimpresource.h"
#include "pdb/gimppdb.h"
@@ -94,6 +95,8 @@ gimp_pdb_dialog_class_init (GimpPdbDialogClass *klass)
dialog_class->response = gimp_pdb_dialog_response;
klass->run_callback = NULL;
+ klass->get_object = NULL;
+ klass->set_object = NULL;
g_object_class_install_property (object_class, PROP_CONTEXT,
g_param_spec_object ("context", NULL, NULL,
@@ -164,15 +167,19 @@ gimp_pdb_dialog_constructed (GObject *object)
G_OBJECT_TYPE_NAME (object),
NULL);
- gimp_context_set_by_type (dialog->context, dialog->select_type,
- dialog->initial_object);
+ if (g_type_is_a (dialog->select_type, GIMP_TYPE_RESOURCE))
+ {
+ gimp_context_set_by_type (dialog->context, dialog->select_type,
+ dialog->initial_object);
- signal_name = gimp_context_type_to_signal_name (dialog->select_type);
+ signal_name = gimp_context_type_to_signal_name (dialog->select_type);
- g_signal_connect_object (dialog->context, signal_name,
- G_CALLBACK (gimp_pdb_dialog_context_changed),
- dialog, 0);
- g_signal_connect_object (dialog->context->gimp->plug_in_manager,
+ g_signal_connect_object (dialog->context, signal_name,
+ G_CALLBACK (gimp_pdb_dialog_context_changed),
+ dialog, 0);
+ }
+
+ g_signal_connect_object (dialog->caller_context->gimp->plug_in_manager,
"plug-in-closed",
G_CALLBACK (gimp_pdb_dialog_plug_in_closed),
dialog, 0);
@@ -247,8 +254,20 @@ gimp_pdb_dialog_response (GtkDialog *gtk_dialog,
GimpPdbDialog *dialog = GIMP_PDB_DIALOG (gtk_dialog);
if (response_id != GTK_RESPONSE_OK)
- gimp_context_set_by_type (dialog->context, dialog->select_type,
- dialog->initial_object);
+ {
+ if (g_type_is_a (dialog->select_type, GIMP_TYPE_RESOURCE))
+ {
+ gimp_context_set_by_type (dialog->context, dialog->select_type,
+ dialog->initial_object);
+ }
+ else
+ {
+ GimpPdbDialogClass *klass = GIMP_PDB_DIALOG_GET_CLASS (dialog);
+
+ g_return_if_fail (klass->set_object != NULL);
+ klass->set_object (dialog, dialog->initial_object);
+ }
+ }
gimp_pdb_dialog_run_callback (&dialog, TRUE);
gtk_widget_destroy (GTK_WIDGET (dialog));
@@ -262,16 +281,26 @@ gimp_pdb_dialog_run_callback (GimpPdbDialog **dialog,
GimpObject *object;
g_object_add_weak_pointer (G_OBJECT (*dialog), (gpointer) dialog);
- object = gimp_context_get_by_type ((*dialog)->context, (*dialog)->select_type);
- if (*dialog && object &&
+ if (g_type_is_a ((*dialog)->select_type, GIMP_TYPE_RESOURCE))
+ {
+ object = gimp_context_get_by_type ((*dialog)->context, (*dialog)->select_type);
+ }
+ else
+ {
+ g_return_if_fail (klass->get_object != NULL);
+ object = klass->get_object (*dialog);
+ }
+
+ if (*dialog &&
klass->run_callback &&
(*dialog)->callback_name &&
! (*dialog)->callback_busy)
{
(*dialog)->callback_busy = TRUE;
- if (gimp_pdb_lookup_procedure ((*dialog)->pdb, (*dialog)->callback_name))
+ if (gimp_pdb_lookup_procedure ((*dialog)->pdb, (*dialog)->callback_name) &&
+ (object == NULL || g_type_is_a (G_TYPE_FROM_INSTANCE (object), (*dialog)->select_type)))
{
GimpValueArray *return_vals;
GError *error = NULL;
@@ -289,7 +318,7 @@ gimp_pdb_dialog_run_callback (GimpPdbDialog **dialog,
else
message = _("The corresponding plug-in may have crashed.");
- gimp_message ((*dialog)->context->gimp, G_OBJECT (*dialog),
+ gimp_message ((*dialog)->caller_context->gimp, G_OBJECT (*dialog),
GIMP_MESSAGE_ERROR,
_("Unable to run %s callback.\n%s"),
g_type_name (G_TYPE_FROM_INSTANCE (*dialog)),
@@ -297,7 +326,7 @@ gimp_pdb_dialog_run_callback (GimpPdbDialog **dialog,
}
else if (*dialog && error)
{
- gimp_message_literal ((*dialog)->context->gimp, G_OBJECT (*dialog),
+ gimp_message_literal ((*dialog)->caller_context->gimp, G_OBJECT (*dialog),
GIMP_MESSAGE_ERROR,
error->message);
g_error_free (error);
diff --git a/app/widgets/gimppdbdialog.h b/app/widgets/gimppdbdialog.h
index b0f83cc2fc..0f8153dd08 100644
--- a/app/widgets/gimppdbdialog.h
+++ b/app/widgets/gimppdbdialog.h
@@ -69,6 +69,9 @@ struct _GimpPdbDialogClass
GimpObject *object,
gboolean closing,
GError **error);
+ GimpObject * (* get_object) (GimpPdbDialog *dialog);
+ void (* set_object) (GimpPdbDialog *dialog,
+ GimpObject *object);
};
diff --git a/app/widgets/gimppickableselect.c b/app/widgets/gimppickableselect.c
new file mode 100644
index 0000000000..4c84a0bd89
--- /dev/null
+++ b/app/widgets/gimppickableselect.c
@@ -0,0 +1,159 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimppickableselect.c
+ * Copyright (C) 2023 Jehan
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "config.h"
+
+#include
+#include
+
+#include "libgimpbase/gimpbase.h"
+#include "libgimpwidgets/gimpwidgets.h"
+
+#include "widgets-types.h"
+
+#include "gegl/gimp-babl-compat.h"
+
+#include "core/gimp.h"
+#include "core/gimpcontext.h"
+#include "core/gimpdrawable.h"
+#include "core/gimppickable.h"
+#include "core/gimpparamspecs.h"
+#include "core/gimptempbuf.h"
+
+#include "pdb/gimppdb.h"
+
+#include "gimppickablechooser.h"
+#include "gimppickableselect.h"
+#include "gimpcontainerbox.h"
+
+#include "gimp-intl.h"
+
+
+static void gimp_pickable_select_constructed (GObject *object);
+
+static GimpValueArray * gimp_pickable_select_run_callback (GimpPdbDialog *dialog,
+ GimpObject *object,
+ gboolean closing,
+ GError **error);
+static GimpObject * gimp_pickable_select_get_object (GimpPdbDialog *dialog);
+static void gimp_pickable_select_set_object (GimpPdbDialog *dialog,
+ GimpObject *object);
+
+static void gimp_pickable_select_activate (GimpPickableSelect *select);
+static void gimp_pickable_select_notify_pickable (GimpPickableSelect *select);
+
+
+G_DEFINE_TYPE (GimpPickableSelect, gimp_pickable_select, GIMP_TYPE_PDB_DIALOG)
+
+#define parent_class gimp_pickable_select_parent_class
+
+
+static void
+gimp_pickable_select_class_init (GimpPickableSelectClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GimpPdbDialogClass *pdb_class = GIMP_PDB_DIALOG_CLASS (klass);
+
+ object_class->constructed = gimp_pickable_select_constructed;
+
+ pdb_class->run_callback = gimp_pickable_select_run_callback;
+ pdb_class->get_object = gimp_pickable_select_get_object;
+ pdb_class->set_object = gimp_pickable_select_set_object;
+}
+
+static void
+gimp_pickable_select_init (GimpPickableSelect *select)
+{
+}
+
+static void
+gimp_pickable_select_constructed (GObject *object)
+{
+ GimpPdbDialog *dialog = GIMP_PDB_DIALOG (object);
+ GimpPickableSelect *select = GIMP_PICKABLE_SELECT (object);
+ GtkWidget *content_area;
+
+ G_OBJECT_CLASS (parent_class)->constructed (object);
+
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+
+ select->chooser = gimp_pickable_chooser_new (dialog->context, GIMP_VIEW_SIZE_LARGE, 1);
+ gimp_pickable_chooser_set_pickable (GIMP_PICKABLE_CHOOSER (select->chooser),
+ GIMP_PICKABLE (dialog->initial_object));
+ g_signal_connect_swapped (select->chooser, "notify::pickable",
+ G_CALLBACK (gimp_pickable_select_notify_pickable),
+ select);
+ g_signal_connect_swapped (select->chooser, "activate",
+ G_CALLBACK (gimp_pickable_select_activate),
+ select);
+ gtk_box_pack_start (GTK_BOX (content_area), select->chooser, TRUE, TRUE, 0);
+ gtk_widget_show (select->chooser);
+}
+
+static GimpValueArray *
+gimp_pickable_select_run_callback (GimpPdbDialog *dialog,
+ GimpObject *object,
+ gboolean closing,
+ GError **error)
+{
+ GimpPickable *pickable = GIMP_PICKABLE (object);
+ GimpValueArray *return_vals;
+
+ return_vals =
+ gimp_pdb_execute_procedure_by_name (dialog->pdb,
+ dialog->caller_context,
+ NULL, error,
+ dialog->callback_name,
+ GIMP_TYPE_DRAWABLE, pickable,
+ G_TYPE_BOOLEAN, closing,
+ G_TYPE_NONE);
+
+ return return_vals;
+}
+
+static GimpObject *
+gimp_pickable_select_get_object (GimpPdbDialog *dialog)
+{
+ GimpPickableSelect *select = GIMP_PICKABLE_SELECT (dialog);
+
+ return (GimpObject *) gimp_pickable_chooser_get_pickable (GIMP_PICKABLE_CHOOSER (select->chooser));
+}
+
+static void
+gimp_pickable_select_set_object (GimpPdbDialog *dialog,
+ GimpObject *object)
+{
+ GimpPickableSelect *select = GIMP_PICKABLE_SELECT (dialog);
+
+ gimp_pickable_chooser_set_pickable (GIMP_PICKABLE_CHOOSER (select->chooser), GIMP_PICKABLE (object));
+}
+
+static void
+gimp_pickable_select_activate (GimpPickableSelect *select)
+{
+ gimp_pdb_dialog_run_callback ((GimpPdbDialog **) &select, TRUE);
+ gtk_widget_destroy (GTK_WIDGET (select));
+}
+
+static void
+gimp_pickable_select_notify_pickable (GimpPickableSelect *select)
+{
+ gimp_pdb_dialog_run_callback ((GimpPdbDialog **) &select, FALSE);
+}
diff --git a/app/widgets/gimppickableselect.h b/app/widgets/gimppickableselect.h
new file mode 100644
index 0000000000..dc742cee0e
--- /dev/null
+++ b/app/widgets/gimppickableselect.h
@@ -0,0 +1,57 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimppickableselect.h
+ * Copyright (C) 2023 Jehan
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef __GIMP_PICKABLE_SELECT_H__
+#define __GIMP_PICKABLE_SELECT_H__
+
+#include "gimppdbdialog.h"
+
+G_BEGIN_DECLS
+
+
+#define GIMP_TYPE_PICKABLE_SELECT (gimp_pickable_select_get_type ())
+#define GIMP_PICKABLE_SELECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PICKABLE_SELECT, GimpPickableSelect))
+#define GIMP_PICKABLE_SELECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PICKABLE_SELECT, GimpPickableSelectClass))
+#define GIMP_IS_PICKABLE_SELECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PICKABLE_SELECT))
+#define GIMP_IS_PICKABLE_SELECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PICKABLE_SELECT))
+#define GIMP_PICKABLE_SELECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PICKABLE_SELECT, GimpPickableSelectClass))
+
+
+typedef struct _GimpPickableSelectClass GimpPickableSelectClass;
+
+struct _GimpPickableSelect
+{
+ GimpPdbDialog parent_instance;
+
+ GtkWidget *chooser;
+};
+
+struct _GimpPickableSelectClass
+{
+ GimpPdbDialogClass parent_class;
+};
+
+
+GType gimp_pickable_select_get_type (void) G_GNUC_CONST;
+
+
+G_END_DECLS
+
+#endif /* __GIMP_PICKABLE_SELECT_H__ */
diff --git a/app/widgets/meson.build b/app/widgets/meson.build
index 8baaff7515..cb772cf895 100644
--- a/app/widgets/meson.build
+++ b/app/widgets/meson.build
@@ -163,6 +163,7 @@ libappwidgets_sources = [
'gimppickablebutton.c',
'gimppickablechooser.c',
'gimppickablepopup.c',
+ 'gimppickableselect.c',
'gimppivotselector.c',
'gimppixbuf.c',
'gimppluginview.c',
diff --git a/app/widgets/widgets-types.h b/app/widgets/widgets-types.h
index 0f2ad439d1..cbbeee0595 100644
--- a/app/widgets/widgets-types.h
+++ b/app/widgets/widgets-types.h
@@ -164,6 +164,7 @@ typedef struct _GimpFontSelect GimpFontSelect;
typedef struct _GimpGradientSelect GimpGradientSelect;
typedef struct _GimpPaletteSelect GimpPaletteSelect;
typedef struct _GimpPatternSelect GimpPatternSelect;
+typedef struct _GimpPickableSelect GimpPickableSelect;
typedef struct _GimpPdbDialog GimpPdbDialog;
diff --git a/libgimp/gimp.def b/libgimp/gimp.def
index ad83bd45f8..8d03505926 100644
--- a/libgimp/gimp.def
+++ b/libgimp/gimp.def
@@ -244,6 +244,9 @@ EXPORTS
gimp_drawable_type
gimp_drawable_type_with_alpha
gimp_drawable_update
+ gimp_drawables_close_popup
+ gimp_drawables_popup
+ gimp_drawables_set_popup
gimp_dynamics_get_list
gimp_dynamics_refresh
gimp_edit_copy
diff --git a/libgimp/gimp_pdb_headers.h b/libgimp/gimp_pdb_headers.h
index 470090a6ef..fab957311e 100644
--- a/libgimp/gimp_pdb_headers.h
+++ b/libgimp/gimp_pdb_headers.h
@@ -39,6 +39,7 @@
#include
#include
#include
+#include
#include
#include
#include
diff --git a/libgimp/gimpdrawableselect_pdb.c b/libgimp/gimpdrawableselect_pdb.c
new file mode 100644
index 0000000000..5a222d06ae
--- /dev/null
+++ b/libgimp/gimpdrawableselect_pdb.c
@@ -0,0 +1,148 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpdrawableselect_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * .
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "stamp-pdbgen.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpdrawableselect
+ * @title: gimpdrawableselect
+ * @short_description: Methods of a drawable chooser dialog
+ *
+
+ **/
+
+
+/**
+ * gimp_drawables_popup:
+ * @callback: The callback PDB proc to call when user chooses an drawable.
+ * @popup_title: Title of the drawable selection dialog.
+ * @initial_drawable: The drawable to set as the initial choice.
+ * @parent_window: An optional parent window handle for the popup to be set transient to.
+ *
+ * Invokes the drawable selection dialog.
+ *
+ * Opens a dialog letting a user choose an drawable.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_drawables_popup (const gchar *callback,
+ const gchar *popup_title,
+ GimpDrawable *initial_drawable,
+ GBytes *parent_window)
+{
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ G_TYPE_STRING, callback,
+ G_TYPE_STRING, popup_title,
+ GIMP_TYPE_DRAWABLE, initial_drawable,
+ G_TYPE_BYTES, parent_window,
+ G_TYPE_NONE);
+
+ return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
+ "gimp-drawables-popup",
+ args);
+ gimp_value_array_unref (args);
+
+ success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawables_close_popup:
+ * @callback: The name of the callback registered for this pop-up.
+ *
+ * Close the drawable selection dialog.
+ *
+ * Closes an open drawable selection dialog.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_drawables_close_popup (const gchar *callback)
+{
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ G_TYPE_STRING, callback,
+ G_TYPE_NONE);
+
+ return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
+ "gimp-drawables-close-popup",
+ args);
+ gimp_value_array_unref (args);
+
+ success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawables_set_popup:
+ * @callback: The name of the callback registered for this pop-up.
+ * @drawable: The drawable to set as selected.
+ *
+ * Sets the selected drawable in a drawable selection dialog.
+ *
+ * Sets the selected drawable in a drawable selection dialog.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_drawables_set_popup (const gchar *callback,
+ GimpDrawable *drawable)
+{
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ G_TYPE_STRING, callback,
+ GIMP_TYPE_DRAWABLE, drawable,
+ G_TYPE_NONE);
+
+ return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
+ "gimp-drawables-set-popup",
+ args);
+ gimp_value_array_unref (args);
+
+ success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
diff --git a/libgimp/gimpdrawableselect_pdb.h b/libgimp/gimpdrawableselect_pdb.h
new file mode 100644
index 0000000000..6b4dd59671
--- /dev/null
+++ b/libgimp/gimpdrawableselect_pdb.h
@@ -0,0 +1,46 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpdrawableselect_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * .
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only can be included directly."
+#endif
+
+#ifndef __GIMP_DRAWABLE_SELECT_PDB_H__
+#define __GIMP_DRAWABLE_SELECT_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_drawables_popup (const gchar *callback,
+ const gchar *popup_title,
+ GimpDrawable *initial_drawable,
+ GBytes *parent_window);
+gboolean gimp_drawables_close_popup (const gchar *callback);
+gboolean gimp_drawables_set_popup (const gchar *callback,
+ GimpDrawable *drawable);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_DRAWABLE_SELECT_PDB_H__ */
diff --git a/libgimp/meson.build b/libgimp/meson.build
index d2b0ba83d4..f956b4fa46 100644
--- a/libgimp/meson.build
+++ b/libgimp/meson.build
@@ -71,6 +71,7 @@ pdb_wrappers_sources = [
'gimpdrawable_pdb.c',
'gimpdrawablecolor_pdb.c',
'gimpdrawableedit_pdb.c',
+ 'gimpdrawableselect_pdb.c',
'gimpdynamics_pdb.c',
'gimpedit_pdb.c',
'gimpfile_pdb.c',
@@ -125,6 +126,7 @@ pdb_wrappers_headers = [
'gimpdrawable_pdb.h',
'gimpdrawablecolor_pdb.h',
'gimpdrawableedit_pdb.h',
+ 'gimpdrawableselect_pdb.h',
'gimpdynamics_pdb.h',
'gimpedit_pdb.h',
'gimpfile_pdb.h',
diff --git a/pdb/groups.pl b/pdb/groups.pl
index 9629a07700..a404a739c3 100644
--- a/pdb/groups.pl
+++ b/pdb/groups.pl
@@ -11,6 +11,7 @@
drawable
drawable_color
drawable_edit
+ drawable_select
dynamics
edit
file
diff --git a/pdb/groups/brush_select.pdb b/pdb/groups/brush_select.pdb
index 54a4b77dc3..06f53e40f1 100644
--- a/pdb/groups/brush_select.pdb
+++ b/pdb/groups/brush_select.pdb
@@ -36,10 +36,12 @@ sub brushes_popup {
%invoke = (
code => <<'CODE'
{
- if (gimp->no_interface ||
+ GimpContainer *container = gimp_data_factory_get_container (gimp->brush_factory);
+
+ if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, brush_callback) ||
! gimp_pdb_dialog_new (gimp, context, progress,
- gimp_data_factory_get_container (gimp->brush_factory),
+ gimp_container_get_children_type (container),
parent_window, popup_title, brush_callback,
GIMP_OBJECT (initial_brush), NULL))
success = FALSE;
@@ -62,9 +64,12 @@ sub brushes_close_popup {
%invoke = (
code => <<'CODE'
{
+ GimpContainer *container = gimp_data_factory_get_container (gimp->brush_factory);
+
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, brush_callback) ||
- ! gimp_pdb_dialog_close (gimp, gimp_data_factory_get_container (gimp->brush_factory),
+ ! gimp_pdb_dialog_close (gimp,
+ gimp_container_get_children_type (container),
brush_callback))
success = FALSE;
}
@@ -88,9 +93,12 @@ sub brushes_set_popup {
%invoke = (
code => <<'CODE'
{
+ GimpContainer *container = gimp_data_factory_get_container (gimp->brush_factory);
+
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, brush_callback) ||
- ! gimp_pdb_dialog_set (gimp, gimp_data_factory_get_container (gimp->brush_factory),
+ ! gimp_pdb_dialog_set (gimp,
+ gimp_container_get_children_type (container),
brush_callback, GIMP_OBJECT (brush), NULL))
success = FALSE;
}
@@ -100,6 +108,7 @@ CODE
@headers = qw("core/gimp.h"
+ "core/gimpcontainer.h"
"core/gimpdatafactory.h");
@procs = qw(brushes_popup
diff --git a/pdb/groups/drawable_select.pdb b/pdb/groups/drawable_select.pdb
new file mode 100644
index 0000000000..fd09af1e3f
--- /dev/null
+++ b/pdb/groups/drawable_select.pdb
@@ -0,0 +1,110 @@
+# GIMP - The GNU Image Manipulation Program
+# Copyright (C) 1995 Spencer Kimball and Peter Mattis
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+sub drawables_popup {
+ $blurb = 'Invokes the drawable selection dialog.';
+ $help = 'Opens a dialog letting a user choose an drawable.';
+
+ &jehan_pdb_misc('2023');
+
+ @inargs = (
+ { name => 'callback', type => 'string', non_empty => 1,
+ desc => 'The callback PDB proc to call when user chooses an drawable' },
+ { name => 'popup_title', type => 'string',
+ desc => 'Title of the drawable selection dialog' },
+ { name => 'initial_drawable', type => 'drawable', null_ok => 1, no_validate => 1,
+ desc => 'The drawable to set as the initial choice' },
+ { name => 'parent_window', type => 'bytes', null_ok => 1,
+ desc => 'An optional parent window handle for the popup to be set transient to' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ if (gimp->no_interface ||
+ ! gimp_pdb_lookup_procedure (gimp->pdb, callback) ||
+ ! gimp_pdb_dialog_new (gimp, context, progress,
+ GIMP_TYPE_DRAWABLE, parent_window,
+ popup_title, callback, GIMP_OBJECT (initial_drawable),
+ NULL))
+ success = FALSE;
+}
+CODE
+ );
+}
+
+sub drawables_close_popup {
+ $blurb = 'Close the drawable selection dialog.';
+ $help = 'Closes an open drawable selection dialog.';
+
+ &jehan_pdb_misc('2023');
+
+ @inargs = (
+ { name => 'callback', type => 'string', non_empty => 1,
+ desc => 'The name of the callback registered for this pop-up' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ if (gimp->no_interface ||
+ ! gimp_pdb_lookup_procedure (gimp->pdb, callback) ||
+ ! gimp_pdb_dialog_close (gimp, GIMP_TYPE_DRAWABLE, callback))
+ success = FALSE;
+}
+CODE
+ );
+}
+
+sub drawables_set_popup {
+ $blurb = 'Sets the selected drawable in a drawable selection dialog.';
+ $help = $blurb;
+
+ &jehan_pdb_misc('2023');
+
+ @inargs = (
+ { name => 'callback', type => 'string', non_empty => 1,
+ desc => 'The name of the callback registered for this pop-up' },
+ { name => 'drawable', type => 'drawable', no_validate => 1,
+ desc => 'The drawable to set as selected' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ if (gimp->no_interface ||
+ ! gimp_pdb_lookup_procedure (gimp->pdb, callback) ||
+ ! gimp_pdb_dialog_set (gimp, GIMP_TYPE_DRAWABLE, callback, GIMP_OBJECT (drawable), NULL))
+ success = FALSE;
+}
+CODE
+ );
+}
+
+@headers = qw("core/gimp.h"
+ "core/gimpdatafactory.h");
+
+@procs = qw(drawables_popup
+ drawables_close_popup
+ drawables_set_popup);
+
+%exports = (app => [@procs], lib => [@procs]);
+
+$desc = 'Drawables UI';
+$doc_title = 'gimpdrawableselect';
+$doc_short_desc = 'Methods of a drawable chooser dialog';
+
+1;
diff --git a/pdb/groups/font_select.pdb b/pdb/groups/font_select.pdb
index 0e9169d916..647db6a8e7 100644
--- a/pdb/groups/font_select.pdb
+++ b/pdb/groups/font_select.pdb
@@ -37,11 +37,13 @@ sub fonts_popup {
%invoke = (
code => <<'CODE'
{
+ GimpContainer *container = gimp_data_factory_get_container (gimp->font_factory);
+
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, font_callback) ||
! gimp_data_factory_data_wait (gimp->font_factory) ||
! gimp_pdb_dialog_new (gimp, context, progress,
- gimp_data_factory_get_container (gimp->font_factory),
+ gimp_container_get_children_type (container),
parent_window, popup_title, font_callback,
GIMP_OBJECT (initial_font), NULL))
success = FALSE;
@@ -64,10 +66,12 @@ sub fonts_close_popup {
%invoke = (
code => <<'CODE'
{
+ GimpContainer *container = gimp_data_factory_get_container (gimp->font_factory);
+
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, font_callback) ||
! gimp_pdb_dialog_close (gimp,
- gimp_data_factory_get_container (gimp->font_factory),
+ gimp_container_get_children_type (container),
font_callback))
success = FALSE;
}
@@ -91,10 +95,13 @@ sub fonts_set_popup {
%invoke = (
code => <<'CODE'
{
+ GimpContainer *container = gimp_data_factory_get_container (gimp->font_factory);
+
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, font_callback) ||
! gimp_data_factory_data_wait (gimp->font_factory) ||
- ! gimp_pdb_dialog_set (gimp, gimp_data_factory_get_container (gimp->font_factory),
+ ! gimp_pdb_dialog_set (gimp,
+ gimp_container_get_children_type (container),
font_callback, GIMP_OBJECT (font), NULL))
success = FALSE;
}
@@ -104,6 +111,7 @@ CODE
@headers = qw("core/gimp.h"
+ "core/gimpcontainer.h"
"core/gimpdatafactory.h");
@procs = qw(fonts_popup
diff --git a/pdb/groups/gradient_select.pdb b/pdb/groups/gradient_select.pdb
index aab1a9f802..1303d9459c 100644
--- a/pdb/groups/gradient_select.pdb
+++ b/pdb/groups/gradient_select.pdb
@@ -37,6 +37,8 @@ sub gradients_popup {
%invoke = (
code => <<'CODE'
{
+ GimpContainer *container = gimp_data_factory_get_container (gimp->gradient_factory);
+
/* Formerly, this procedure had another parameter:
* the sample size of the gradient's data passed in the changed callback.
* Now the sample size is determined by core, and in the future,
@@ -46,7 +48,7 @@ sub gradients_popup {
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, gradient_callback) ||
! gimp_pdb_dialog_new (gimp, context, progress,
- gimp_data_factory_get_container (gimp->gradient_factory),
+ gimp_container_get_children_type (container),
parent_window, popup_title, gradient_callback,
GIMP_OBJECT (initial_gradient), NULL))
success = FALSE;
@@ -69,9 +71,12 @@ sub gradients_close_popup {
%invoke = (
code => <<'CODE'
{
+ GimpContainer *container = gimp_data_factory_get_container (gimp->gradient_factory);
+
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, gradient_callback) ||
- ! gimp_pdb_dialog_close (gimp, gimp_data_factory_get_container (gimp->gradient_factory),
+ ! gimp_pdb_dialog_close (gimp,
+ gimp_container_get_children_type (container),
gradient_callback))
success = FALSE;
}
@@ -95,9 +100,12 @@ sub gradients_set_popup {
%invoke = (
code => <<'CODE'
{
+ GimpContainer *container = gimp_data_factory_get_container (gimp->gradient_factory);
+
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, gradient_callback) ||
- ! gimp_pdb_dialog_set (gimp, gimp_data_factory_get_container (gimp->gradient_factory),
+ ! gimp_pdb_dialog_set (gimp,
+ gimp_container_get_children_type (container),
gradient_callback, GIMP_OBJECT (gradient), NULL))
success = FALSE;
}
@@ -107,6 +115,7 @@ CODE
@headers = qw("core/gimp.h"
+ "core/gimpcontainer.h"
"core/gimpdatafactory.h"
"core/gimpgradient.h");
diff --git a/pdb/groups/palette_select.pdb b/pdb/groups/palette_select.pdb
index e8c4dda278..998aca67fa 100644
--- a/pdb/groups/palette_select.pdb
+++ b/pdb/groups/palette_select.pdb
@@ -36,10 +36,12 @@ sub palettes_popup {
%invoke = (
code => <<'CODE'
{
+ GimpContainer *container = gimp_data_factory_get_container (gimp->palette_factory);
+
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, palette_callback) ||
! gimp_pdb_dialog_new (gimp, context, progress,
- gimp_data_factory_get_container (gimp->palette_factory),
+ gimp_container_get_children_type (container),
parent_window, popup_title, palette_callback,
GIMP_OBJECT (initial_palette), NULL))
success = FALSE;
@@ -62,9 +64,12 @@ sub palettes_close_popup {
%invoke = (
code => <<'CODE'
{
+ GimpContainer *container = gimp_data_factory_get_container (gimp->palette_factory);
+
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, palette_callback) ||
- ! gimp_pdb_dialog_close (gimp, gimp_data_factory_get_container (gimp->palette_factory),
+ ! gimp_pdb_dialog_close (gimp,
+ gimp_container_get_children_type (container),
palette_callback))
success = FALSE;
}
@@ -88,9 +93,12 @@ sub palettes_set_popup {
%invoke = (
code => <<'CODE'
{
+ GimpContainer *container = gimp_data_factory_get_container (gimp->palette_factory);
+
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, palette_callback) ||
- ! gimp_pdb_dialog_set (gimp, gimp_data_factory_get_container (gimp->palette_factory),
+ ! gimp_pdb_dialog_set (gimp,
+ gimp_container_get_children_type (container),
palette_callback, GIMP_OBJECT (palette), NULL))
success = FALSE;
}
@@ -100,6 +108,7 @@ CODE
@headers = qw("core/gimp.h"
+ "core/gimpcontainer.h"
"core/gimpdatafactory.h");
@procs = qw(palettes_popup
diff --git a/pdb/groups/pattern_select.pdb b/pdb/groups/pattern_select.pdb
index 10403fdef2..5b4903ce2f 100644
--- a/pdb/groups/pattern_select.pdb
+++ b/pdb/groups/pattern_select.pdb
@@ -36,10 +36,12 @@ sub patterns_popup {
%invoke = (
code => <<'CODE'
{
+ GimpContainer *container = gimp_data_factory_get_container (gimp->pattern_factory);
+
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, pattern_callback) ||
! gimp_pdb_dialog_new (gimp, context, progress,
- gimp_data_factory_get_container (gimp->pattern_factory),
+ gimp_container_get_children_type (container),
parent_window, popup_title, pattern_callback,
GIMP_OBJECT (initial_pattern), NULL))
success = FALSE;
@@ -62,9 +64,12 @@ sub patterns_close_popup {
%invoke = (
code => <<'CODE'
{
+ GimpContainer *container = gimp_data_factory_get_container (gimp->pattern_factory);
+
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, pattern_callback) ||
- ! gimp_pdb_dialog_close (gimp, gimp_data_factory_get_container (gimp->pattern_factory),
+ ! gimp_pdb_dialog_close (gimp,
+ gimp_container_get_children_type (container),
pattern_callback))
success = FALSE;
}
@@ -88,9 +93,12 @@ sub patterns_set_popup {
%invoke = (
code => <<'CODE'
{
+ GimpContainer *container = gimp_data_factory_get_container (gimp->pattern_factory);
+
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, pattern_callback) ||
- ! gimp_pdb_dialog_set (gimp, gimp_data_factory_get_container (gimp->pattern_factory),
+ ! gimp_pdb_dialog_set (gimp,
+ gimp_container_get_children_type (container),
pattern_callback, GIMP_OBJECT (pattern), NULL))
success = FALSE;
}
@@ -100,6 +108,7 @@ CODE
@headers = qw("core/gimp.h"
+ "core/gimpcontainer.h"
"core/gimpdatafactory.h");
@procs = qw(patterns_popup
diff --git a/pdb/meson.build b/pdb/meson.build
index 005cd3dedf..974589d9f8 100644
--- a/pdb/meson.build
+++ b/pdb/meson.build
@@ -12,6 +12,7 @@ pdb_names = [
'display',
'drawable_color',
'drawable_edit',
+ 'drawable_select',
'drawable',
'dynamics',
'edit',