diff --git a/app/gui/gui-vtable.c b/app/gui/gui-vtable.c index 60ec9956a6..e353068ca5 100644 --- a/app/gui/gui-vtable.c +++ b/app/gui/gui-vtable.c @@ -90,7 +90,6 @@ #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" diff --git a/app/widgets/gimppickableselect.c b/app/widgets/gimppickableselect.c deleted file mode 100644 index b21126e5ca..0000000000 --- a/app/widgets/gimppickableselect.c +++ /dev/null @@ -1,176 +0,0 @@ -/* 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/gimpimage.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, dialog->select_type, - 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) -{ - GtkWidget *button; - GimpPickableChooser *chooser = GIMP_PICKABLE_CHOOSER (select->chooser); - - button = gtk_dialog_get_widget_for_response (GTK_DIALOG (select), - GTK_RESPONSE_OK); - - /* Clicking Okay when an image but not a layer or channel has been - * selected causes the widget to "lock up" and not reappear when you - * click on it again. For now, we'll disable the Okay button until - * a layer or channel is selected */ - if (GIMP_IS_IMAGE (gimp_pickable_chooser_get_pickable (chooser))) - gtk_widget_set_sensitive (button, FALSE); - else - gtk_widget_set_sensitive (button, TRUE); - - gimp_pdb_dialog_run_callback ((GimpPdbDialog **) &select, FALSE); -} diff --git a/app/widgets/gimppickableselect.h b/app/widgets/gimppickableselect.h deleted file mode 100644 index b475373a8b..0000000000 --- a/app/widgets/gimppickableselect.h +++ /dev/null @@ -1,49 +0,0 @@ -/* 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 . - */ - -#pragma once - -#include "gimppdbdialog.h" - - -#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; diff --git a/app/widgets/meson.build b/app/widgets/meson.build index 4b75ba84eb..b038b1a7e2 100644 --- a/app/widgets/meson.build +++ b/app/widgets/meson.build @@ -181,7 +181,6 @@ libappwidgets_sources = [ 'gimppickablebutton.c', 'gimppickablechooser.c', 'gimppickablepopup.c', - 'gimppickableselect.c', 'gimppivotselector.c', 'gimppixbuf.c', 'gimppluginview.c',