libgimp: rename Gimp*SelectButton widgets to Gimp*Chooser.

This name was really irking me because it's not a button (anymore? Maybe it used
to be just a button). Depending on the specific widget, it will have several
sub-widgets, including a label. And it can theoretically even be something else
than a button.

So let's just rename these widgets with the more generic "chooser" name.
This commit is contained in:
Jehan 2023-08-19 01:22:09 +02:00
parent 55d6f6c26e
commit 62a3889617
24 changed files with 578 additions and 609 deletions

View file

@ -1,7 +1,7 @@
/* LIBGIMP - The GIMP Library /* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
* *
* gimpbrushselectbutton.c * gimpbrushchooser.c
* Copyright (C) 1998 Andy Thomas * Copyright (C) 1998 Andy Thomas
* *
* This library is free software: you can redistribute it and/or * This library is free software: you can redistribute it and/or
@ -29,15 +29,15 @@
#include "gimp.h" #include "gimp.h"
#include "gimpuitypes.h" #include "gimpuitypes.h"
#include "gimpbrushselectbutton.h" #include "gimpbrushchooser.h"
#include "gimpuimarshal.h" #include "gimpuimarshal.h"
#include "libgimp-intl.h" #include "libgimp-intl.h"
/** /**
* SECTION: gimpbrushselectbutton * SECTION: gimpbrushchooser
* @title: GimpBrushSelectButton * @title: GimpBrushChooser
* @short_description: A button which pops up a brush selection dialog. * @short_description: A button which pops up a brush selection dialog.
* *
* A button which pops up a brush selection dialog. * A button which pops up a brush selection dialog.
@ -48,61 +48,61 @@
#define CELL_SIZE 40 #define CELL_SIZE 40
struct _GimpBrushSelectButton struct _GimpBrushChooser
{ {
GimpResourceSelectButton parent_instance; GimpResourceChooser parent_instance;
GtkWidget *preview; GtkWidget *preview;
GtkWidget *popup; GtkWidget *popup;
GimpBrush *brush; GimpBrush *brush;
gint width; gint width;
gint height; gint height;
GeglBuffer *buffer; GeglBuffer *buffer;
GeglBuffer *mask; GeglBuffer *mask;
}; };
static void gimp_brush_select_button_finalize (GObject *object); static void gimp_brush_chooser_finalize (GObject *object);
static gboolean gimp_brush_select_on_preview_events (GtkWidget *widget, static gboolean gimp_brush_select_on_preview_events (GtkWidget *widget,
GdkEvent *event, GdkEvent *event,
GimpBrushSelectButton *button); GimpBrushChooser *button);
static void gimp_brush_select_preview_draw (GimpBrushSelectButton *chooser, static void gimp_brush_select_preview_draw (GimpBrushChooser *chooser,
GimpPreviewArea *area); GimpPreviewArea *area);
static void gimp_brush_select_button_draw (GimpBrushSelectButton *self); static void gimp_brush_chooser_draw (GimpBrushChooser *self);
static void gimp_brush_select_button_get_brush_bitmap (GimpBrushSelectButton *self, static void gimp_brush_chooser_get_brush_bitmap (GimpBrushChooser *self,
gint width, gint width,
gint height); gint height);
/* Popup methods. */ /* Popup methods. */
static void gimp_brush_select_button_open_popup (GimpBrushSelectButton *button, static void gimp_brush_chooser_open_popup (GimpBrushChooser *button,
gint x, gint x,
gint y); gint y);
static void gimp_brush_select_button_close_popup (GimpBrushSelectButton *button); static void gimp_brush_chooser_close_popup (GimpBrushChooser *button);
static const GtkTargetEntry drag_target = { "application/x-gimp-brush-name", 0, 0 }; static const GtkTargetEntry drag_target = { "application/x-gimp-brush-name", 0, 0 };
G_DEFINE_FINAL_TYPE (GimpBrushSelectButton, gimp_brush_select_button, GIMP_TYPE_RESOURCE_SELECT_BUTTON) G_DEFINE_FINAL_TYPE (GimpBrushChooser, gimp_brush_chooser, GIMP_TYPE_RESOURCE_CHOOSER)
static void static void
gimp_brush_select_button_class_init (GimpBrushSelectButtonClass *klass) gimp_brush_chooser_class_init (GimpBrushChooserClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpResourceSelectButtonClass *res_class = GIMP_RESOURCE_SELECT_BUTTON_CLASS (klass); GimpResourceChooserClass *res_class = GIMP_RESOURCE_CHOOSER_CLASS (klass);
res_class->draw_interior = (void (*)(GimpResourceSelectButton *)) gimp_brush_select_button_draw; res_class->draw_interior = (void (*)(GimpResourceChooser *)) gimp_brush_chooser_draw;
res_class->resource_type = GIMP_TYPE_BRUSH; res_class->resource_type = GIMP_TYPE_BRUSH;
object_class->finalize = gimp_brush_select_button_finalize; object_class->finalize = gimp_brush_chooser_finalize;
} }
static void static void
gimp_brush_select_button_init (GimpBrushSelectButton *chooser) gimp_brush_chooser_init (GimpBrushChooser *chooser)
{ {
GtkWidget *widget; GtkWidget *widget;
gint scale_factor = gtk_widget_get_scale_factor (GTK_WIDGET (chooser)); gint scale_factor = gtk_widget_get_scale_factor (GTK_WIDGET (chooser));
@ -124,7 +124,7 @@ gimp_brush_select_button_init (GimpBrushSelectButton *chooser)
gtk_widget_show (chooser->preview); gtk_widget_show (chooser->preview);
g_signal_connect_swapped (chooser->preview, "size-allocate", g_signal_connect_swapped (chooser->preview, "size-allocate",
G_CALLBACK (gimp_brush_select_button_draw), G_CALLBACK (gimp_brush_chooser_draw),
chooser); chooser);
g_signal_connect (chooser->preview, "event", g_signal_connect (chooser->preview, "event",
@ -134,28 +134,28 @@ gimp_brush_select_button_init (GimpBrushSelectButton *chooser)
widget = gtk_button_new_with_mnemonic (_("_Browse...")); widget = gtk_button_new_with_mnemonic (_("_Browse..."));
gtk_box_pack_start (GTK_BOX (chooser), widget, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (chooser), widget, FALSE, FALSE, 0);
gimp_resource_select_button_set_drag_target (GIMP_RESOURCE_SELECT_BUTTON (chooser), gimp_resource_chooser_set_drag_target (GIMP_RESOURCE_CHOOSER (chooser),
chooser->preview, chooser->preview,
&drag_target); &drag_target);
gimp_resource_select_button_set_clickable (GIMP_RESOURCE_SELECT_BUTTON (chooser), gimp_resource_chooser_set_clickable (GIMP_RESOURCE_CHOOSER (chooser),
widget); widget);
gtk_widget_show (widget); gtk_widget_show (widget);
} }
static void static void
gimp_brush_select_button_finalize (GObject *object) gimp_brush_chooser_finalize (GObject *object)
{ {
GimpBrushSelectButton *chooser = GIMP_BRUSH_SELECT_BUTTON (object); GimpBrushChooser *chooser = GIMP_BRUSH_CHOOSER (object);
g_clear_object (&chooser->buffer); g_clear_object (&chooser->buffer);
g_clear_object (&chooser->mask); g_clear_object (&chooser->mask);
G_OBJECT_CLASS (gimp_brush_select_button_parent_class)->finalize (object); G_OBJECT_CLASS (gimp_brush_chooser_parent_class)->finalize (object);
} }
/** /**
* gimp_brush_select_button_new: * gimp_brush_chooser_new:
* @title: (nullable): Title of the dialog to use or %NULL to use the default title. * @title: (nullable): Title of the dialog to use or %NULL to use the default title.
* @label: (nullable): Button label or %NULL for no label. * @label: (nullable): Button label or %NULL for no label.
* @resource: (nullable): Initial brush. * @resource: (nullable): Initial brush.
@ -170,9 +170,9 @@ gimp_brush_select_button_finalize (GObject *object)
* Since: 2.4 * Since: 2.4
*/ */
GtkWidget * GtkWidget *
gimp_brush_select_button_new (const gchar *title, gimp_brush_chooser_new (const gchar *title,
const gchar *label, const gchar *label,
GimpResource *resource) GimpResource *resource)
{ {
GtkWidget *self; GtkWidget *self;
@ -180,13 +180,13 @@ gimp_brush_select_button_new (const gchar *title,
resource = GIMP_RESOURCE (gimp_context_get_brush ()); resource = GIMP_RESOURCE (gimp_context_get_brush ());
if (title) if (title)
self = g_object_new (GIMP_TYPE_BRUSH_SELECT_BUTTON, self = g_object_new (GIMP_TYPE_BRUSH_CHOOSER,
"title", title, "title", title,
"label", label, "label", label,
"resource", resource, "resource", resource,
NULL); NULL);
else else
self = g_object_new (GIMP_TYPE_BRUSH_SELECT_BUTTON, self = g_object_new (GIMP_TYPE_BRUSH_CHOOSER,
"label", label, "label", label,
"resource", resource, "resource", resource,
NULL); NULL);
@ -197,20 +197,20 @@ gimp_brush_select_button_new (const gchar *title,
/* private functions */ /* private functions */
static void static void
gimp_brush_select_button_draw (GimpBrushSelectButton *chooser) gimp_brush_chooser_draw (GimpBrushChooser *chooser)
{ {
GtkAllocation allocation; GtkAllocation allocation;
gtk_widget_get_allocation (chooser->preview, &allocation); gtk_widget_get_allocation (chooser->preview, &allocation);
gimp_brush_select_button_get_brush_bitmap (chooser, allocation.width, allocation.height); gimp_brush_chooser_get_brush_bitmap (chooser, allocation.width, allocation.height);
gimp_brush_select_preview_draw (chooser, GIMP_PREVIEW_AREA (chooser->preview)); gimp_brush_select_preview_draw (chooser, GIMP_PREVIEW_AREA (chooser->preview));
} }
static void static void
gimp_brush_select_button_get_brush_bitmap (GimpBrushSelectButton *chooser, gimp_brush_chooser_get_brush_bitmap (GimpBrushChooser *chooser,
gint width, gint width,
gint height) gint height)
{ {
GimpBrush *brush; GimpBrush *brush;
@ -297,9 +297,9 @@ gimp_brush_select_button_get_brush_bitmap (GimpBrushSelectButton *chooser,
/* On mouse events in self's preview, popup a zoom view of entire brush */ /* On mouse events in self's preview, popup a zoom view of entire brush */
static gboolean static gboolean
gimp_brush_select_on_preview_events (GtkWidget *widget, gimp_brush_select_on_preview_events (GtkWidget *widget,
GdkEvent *event, GdkEvent *event,
GimpBrushSelectButton *self) GimpBrushChooser *self)
{ {
GdkEventButton *bevent; GdkEventButton *bevent;
@ -311,7 +311,7 @@ gimp_brush_select_on_preview_events (GtkWidget *widget,
if (bevent->button == 1) if (bevent->button == 1)
{ {
gtk_grab_add (widget); gtk_grab_add (widget);
gimp_brush_select_button_open_popup (self, gimp_brush_chooser_open_popup (self,
bevent->x, bevent->y); bevent->x, bevent->y);
} }
break; break;
@ -322,7 +322,7 @@ gimp_brush_select_on_preview_events (GtkWidget *widget,
if (bevent->button == 1) if (bevent->button == 1)
{ {
gtk_grab_remove (widget); gtk_grab_remove (widget);
gimp_brush_select_button_close_popup (self); gimp_brush_chooser_close_popup (self);
} }
break; break;
@ -335,8 +335,8 @@ gimp_brush_select_on_preview_events (GtkWidget *widget,
/* Draw a GimpPreviewArea with a given bitmap. */ /* Draw a GimpPreviewArea with a given bitmap. */
static void static void
gimp_brush_select_preview_draw (GimpBrushSelectButton *chooser, gimp_brush_select_preview_draw (GimpBrushChooser *chooser,
GimpPreviewArea *preview) GimpPreviewArea *preview)
{ {
GimpPreviewArea *area = GIMP_PREVIEW_AREA (preview); GimpPreviewArea *area = GIMP_PREVIEW_AREA (preview);
GeglBuffer *src_buffer; GeglBuffer *src_buffer;
@ -394,9 +394,9 @@ gimp_brush_select_preview_draw (GimpBrushSelectButton *chooser,
/* popup methods. */ /* popup methods. */
static void static void
gimp_brush_select_button_open_popup (GimpBrushSelectButton *chooser, gimp_brush_chooser_open_popup (GimpBrushChooser *chooser,
gint x, gint x,
gint y) gint y)
{ {
GtkWidget *frame; GtkWidget *frame;
GtkWidget *preview; GtkWidget *preview;
@ -406,7 +406,7 @@ gimp_brush_select_button_open_popup (GimpBrushSelectButton *chooser,
gint y_org; gint y_org;
if (chooser->popup) if (chooser->popup)
gimp_brush_select_button_close_popup (chooser); gimp_brush_chooser_close_popup (chooser);
if (chooser->width <= CELL_SIZE && chooser->height <= CELL_SIZE) if (chooser->width <= CELL_SIZE && chooser->height <= CELL_SIZE)
return; return;
@ -450,7 +450,7 @@ gimp_brush_select_button_open_popup (GimpBrushSelectButton *chooser,
} }
static void static void
gimp_brush_select_button_close_popup (GimpBrushSelectButton *self) gimp_brush_chooser_close_popup (GimpBrushChooser *self)
{ {
g_clear_pointer (&self->popup, gtk_widget_destroy); g_clear_pointer (&self->popup, gtk_widget_destroy);
} }

View file

@ -1,7 +1,7 @@
/* LIBGIMP - The GIMP Library /* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
* *
* gimpfontselectbutton.h * gimpbrushchooser.h
* *
* This library is free software: you can redistribute it and/or * This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -22,25 +22,22 @@
#error "Only <libgimp/gimpui.h> can be included directly." #error "Only <libgimp/gimpui.h> can be included directly."
#endif #endif
#ifndef __GIMP_FONT_SELECT_BUTTON_H__ #ifndef __GIMP_BRUSH_CHOOSER_H__
#define __GIMP_FONT_SELECT_BUTTON_H__ #define __GIMP_BRUSH_CHOOSER_H__
#include <libgimp/gimpresourceselectbutton.h> #include <libgimp/gimpresourcechooser.h>
G_BEGIN_DECLS G_BEGIN_DECLS
#define GIMP_TYPE_FONT_SELECT_BUTTON (gimp_font_select_button_get_type ()) #define GIMP_TYPE_BRUSH_CHOOSER (gimp_brush_chooser_get_type ())
G_DECLARE_FINAL_TYPE (GimpFontSelectButton, G_DECLARE_FINAL_TYPE (GimpBrushChooser, gimp_brush_chooser, GIMP, BRUSH_CHOOSER, GimpResourceChooser)
gimp_font_select_button,
GIMP, FONT_SELECT_BUTTON,
GimpResourceSelectButton)
GtkWidget * gimp_font_select_button_new (const gchar *title, GtkWidget * gimp_brush_chooser_new (const gchar *title,
const gchar *label, const gchar *label,
GimpResource *resource); GimpResource *resource);
G_END_DECLS G_END_DECLS
#endif /* __GIMP_FONT_SELECT_BUTTON_H__ */ #endif /* __GIMP_BRUSH_CHOOSER_H__ */

View file

@ -1,7 +1,7 @@
/* LIBGIMP - The GIMP Library /* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
* *
* gimpfontselectbutton.c * gimpfontchooser.c
* Copyright (C) 2003 Sven Neumann <sven@gimp.org> * Copyright (C) 2003 Sven Neumann <sven@gimp.org>
* *
* This library is free software: you can redistribute it and/or * This library is free software: you can redistribute it and/or
@ -29,50 +29,48 @@
#include "gimp.h" #include "gimp.h"
#include "gimpuitypes.h" #include "gimpuitypes.h"
#include "gimpfontselectbutton.h" #include "gimpfontchooser.h"
#include "gimpuimarshal.h" #include "gimpuimarshal.h"
#include "libgimp-intl.h" #include "libgimp-intl.h"
/** /**
* SECTION: gimpfontselectbutton * SECTION: gimpfontchooser
* @title: GimpFontSelectButton * @title: GimpFontChooser
* @short_description: A button which pops up a font selection dialog. * @short_description: A button which pops up a font selection dialog.
* *
* A button which pops up a font selection dialog. * A button which pops up a font selection dialog.
**/ **/
struct _GimpFontSelectButton struct _GimpFontChooser
{ {
GimpResourceSelectButton parent_instance; GimpResourceChooser parent_instance;
GtkWidget *label; GtkWidget *label;
}; };
static void gimp_font_select_button_draw_interior (GimpResourceSelectButton *self); static void gimp_font_chooser_draw_interior (GimpResourceChooser *self);
static const GtkTargetEntry drag_target = { "application/x-gimp-font-name", 0, 0 }; static const GtkTargetEntry drag_target = { "application/x-gimp-font-name", 0, 0 };
G_DEFINE_FINAL_TYPE (GimpFontSelectButton, G_DEFINE_FINAL_TYPE (GimpFontChooser, gimp_font_chooser, GIMP_TYPE_RESOURCE_CHOOSER)
gimp_font_select_button,
GIMP_TYPE_RESOURCE_SELECT_BUTTON)
static void static void
gimp_font_select_button_class_init (GimpFontSelectButtonClass *klass) gimp_font_chooser_class_init (GimpFontChooserClass *klass)
{ {
GimpResourceSelectButtonClass *superclass = GIMP_RESOURCE_SELECT_BUTTON_CLASS (klass); GimpResourceChooserClass *superclass = GIMP_RESOURCE_CHOOSER_CLASS (klass);
superclass->draw_interior = gimp_font_select_button_draw_interior; superclass->draw_interior = gimp_font_chooser_draw_interior;
superclass->resource_type = GIMP_TYPE_FONT; superclass->resource_type = GIMP_TYPE_FONT;
} }
static void static void
gimp_font_select_button_init (GimpFontSelectButton *self) gimp_font_chooser_init (GimpFontChooser *self)
{ {
GtkWidget *button; GtkWidget *button;
GtkWidget *hbox; GtkWidget *hbox;
@ -93,22 +91,20 @@ gimp_font_select_button_init (GimpFontSelectButton *self)
gtk_widget_show_all (GTK_WIDGET (self)); gtk_widget_show_all (GTK_WIDGET (self));
gimp_resource_select_button_set_drag_target (GIMP_RESOURCE_SELECT_BUTTON (self), gimp_resource_chooser_set_drag_target (GIMP_RESOURCE_CHOOSER (self),
hbox, hbox, &drag_target);
&drag_target);
gimp_resource_select_button_set_clickable (GIMP_RESOURCE_SELECT_BUTTON (self), gimp_resource_chooser_set_clickable (GIMP_RESOURCE_CHOOSER (self), button);
button);
} }
static void static void
gimp_font_select_button_draw_interior (GimpResourceSelectButton *self) gimp_font_chooser_draw_interior (GimpResourceChooser *self)
{ {
GimpFontSelectButton *font_select= GIMP_FONT_SELECT_BUTTON (self); GimpFontChooser *font_select= GIMP_FONT_CHOOSER (self);
GimpResource *resource; GimpResource *resource;
gchar *name = NULL; gchar *name = NULL;
resource = gimp_resource_select_button_get_resource (self); resource = gimp_resource_chooser_get_resource (self);
if (resource) if (resource)
name = gimp_resource_get_name (resource); name = gimp_resource_get_name (resource);
@ -118,7 +114,7 @@ gimp_font_select_button_draw_interior (GimpResourceSelectButton *self)
/** /**
* gimp_font_select_button_new: * gimp_font_chooser_new:
* @title: (nullable): Title of the dialog to use or %NULL to use the default title. * @title: (nullable): Title of the dialog to use or %NULL to use the default title.
* @label: (nullable): Button label or %NULL for no label. * @label: (nullable): Button label or %NULL for no label.
* @resource: (nullable): Initial font. * @resource: (nullable): Initial font.
@ -133,11 +129,11 @@ gimp_font_select_button_draw_interior (GimpResourceSelectButton *self)
* Since: 2.4 * Since: 2.4
*/ */
GtkWidget * GtkWidget *
gimp_font_select_button_new (const gchar *title, gimp_font_chooser_new (const gchar *title,
const gchar *label, const gchar *label,
GimpResource *resource) GimpResource *resource)
{ {
GtkWidget *self; GtkWidget *chooser;
g_return_val_if_fail (resource == NULL || GIMP_IS_FONT (resource), NULL); g_return_val_if_fail (resource == NULL || GIMP_IS_FONT (resource), NULL);
@ -145,18 +141,18 @@ gimp_font_select_button_new (const gchar *title,
resource = GIMP_RESOURCE (gimp_context_get_font ()); resource = GIMP_RESOURCE (gimp_context_get_font ());
if (title) if (title)
self = g_object_new (GIMP_TYPE_FONT_SELECT_BUTTON, chooser = g_object_new (GIMP_TYPE_FONT_CHOOSER,
"title", title, "title", title,
"label", label, "label", label,
"resource", resource, "resource", resource,
NULL); NULL);
else else
self = g_object_new (GIMP_TYPE_FONT_SELECT_BUTTON, chooser = g_object_new (GIMP_TYPE_FONT_CHOOSER,
"label", label, "label", label,
"resource", resource, "resource", resource,
NULL); NULL);
gimp_font_select_button_draw_interior (GIMP_RESOURCE_SELECT_BUTTON (self)); gimp_font_chooser_draw_interior (GIMP_RESOURCE_CHOOSER (chooser));
return self; return chooser;
} }

View file

@ -1,7 +1,7 @@
/* LIBGIMP - The GIMP Library /* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
* *
* gimpbrushselectbutton.h * gimpfontchooser.h
* *
* This library is free software: you can redistribute it and/or * This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -22,25 +22,22 @@
#error "Only <libgimp/gimpui.h> can be included directly." #error "Only <libgimp/gimpui.h> can be included directly."
#endif #endif
#ifndef __GIMP_BRUSH_SELECT_BUTTON_H__ #ifndef __GIMP_FONT_CHOOSER_H__
#define __GIMP_BRUSH_SELECT_BUTTON_H__ #define __GIMP_FONT_CHOOSER_H__
#include <libgimp/gimpresourceselectbutton.h> #include <libgimp/gimpresourcechooser.h>
G_BEGIN_DECLS G_BEGIN_DECLS
#define GIMP_TYPE_BRUSH_SELECT_BUTTON (gimp_brush_select_button_get_type ()) #define GIMP_TYPE_FONT_CHOOSER (gimp_font_chooser_get_type ())
G_DECLARE_FINAL_TYPE (GimpBrushSelectButton, G_DECLARE_FINAL_TYPE (GimpFontChooser, gimp_font_chooser, GIMP, FONT_CHOOSER, GimpResourceChooser)
gimp_brush_select_button,
GIMP, BRUSH_SELECT_BUTTON,
GimpResourceSelectButton)
GtkWidget * gimp_brush_select_button_new (const gchar *title, GtkWidget * gimp_font_chooser_new (const gchar *title,
const gchar *label, const gchar *label,
GimpResource *resource); GimpResource *resource);
G_END_DECLS G_END_DECLS
#endif /* __GIMP_BRUSH_SELECT_BUTTON_H__ */ #endif /* __GIMP_FONT_CHOOSER_H__ */

View file

@ -1,7 +1,7 @@
/* LIBGIMP - The GIMP Library /* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
* *
* gimpgradientselectbutton.c * gimpgradientchooser.c
* Copyright (C) 1998 Andy Thomas * Copyright (C) 1998 Andy Thomas
* *
* This library is free software: you can redistribute it and/or * This library is free software: you can redistribute it and/or
@ -29,62 +29,62 @@
#include "gimp.h" #include "gimp.h"
#include "gimpuitypes.h" #include "gimpuitypes.h"
#include "gimpgradientselectbutton.h" #include "gimpgradientchooser.h"
#include "gimpuimarshal.h" #include "gimpuimarshal.h"
#include "libgimp-intl.h" #include "libgimp-intl.h"
/** /**
* SECTION: gimpgradientselectbutton * SECTION: gimpgradientchooser
* @title: GimpGradientSelectButton * @title: GimpGradientChooser
* @short_description: A button which pops up a gradient select dialog. * @short_description: A button which pops up a gradient select dialog.
* *
* A button which pops up a gradient select dialog. * A button which pops up a gradient select dialog.
**/ **/
struct _GimpGradientSelectButton struct _GimpGradientChooser
{ {
GimpResourceSelectButton parent_instance; GimpResourceChooser parent_instance;
GtkWidget *preview; GtkWidget *preview;
}; };
/* local function prototypes */ /* local function prototypes */
static void gimp_gradient_select_button_draw_interior (GimpResourceSelectButton *self); static void gimp_gradient_chooser_draw_interior (GimpResourceChooser *self);
static void gimp_gradient_select_preview_size_allocate (GtkWidget *widget, static void gimp_gradient_select_preview_size_allocate (GtkWidget *widget,
GtkAllocation *allocation, GtkAllocation *allocation,
GimpGradientSelectButton *self); GimpGradientChooser *self);
static gboolean gimp_gradient_select_preview_draw_handler (GtkWidget *preview, static gboolean gimp_gradient_select_preview_draw_handler (GtkWidget *preview,
cairo_t *cr, cairo_t *cr,
GimpGradientSelectButton *self); GimpGradientChooser *self);
static const GtkTargetEntry drag_target = { "application/x-gimp-gradient-name", 0 }; static const GtkTargetEntry drag_target = { "application/x-gimp-gradient-name", 0 };
G_DEFINE_FINAL_TYPE (GimpGradientSelectButton, G_DEFINE_FINAL_TYPE (GimpGradientChooser,
gimp_gradient_select_button, gimp_gradient_chooser,
GIMP_TYPE_RESOURCE_SELECT_BUTTON) GIMP_TYPE_RESOURCE_CHOOSER)
/* Initial dimensions of widget. */ /* Initial dimensions of widget. */
#define CELL_HEIGHT 18 #define CELL_HEIGHT 18
#define CELL_WIDTH 84 #define CELL_WIDTH 84
static void static void
gimp_gradient_select_button_class_init (GimpGradientSelectButtonClass *klass) gimp_gradient_chooser_class_init (GimpGradientChooserClass *klass)
{ {
GimpResourceSelectButtonClass *superclass = GIMP_RESOURCE_SELECT_BUTTON_CLASS (klass); GimpResourceChooserClass *superclass = GIMP_RESOURCE_CHOOSER_CLASS (klass);
superclass->draw_interior = gimp_gradient_select_button_draw_interior; superclass->draw_interior = gimp_gradient_chooser_draw_interior;
superclass->resource_type = GIMP_TYPE_GRADIENT; superclass->resource_type = GIMP_TYPE_GRADIENT;
} }
static void static void
gimp_gradient_select_button_init (GimpGradientSelectButton *self) gimp_gradient_chooser_init (GimpGradientChooser *self)
{ {
GtkWidget *button; GtkWidget *button;
@ -105,25 +105,23 @@ gimp_gradient_select_button_init (GimpGradientSelectButton *self)
gtk_widget_show_all (GTK_WIDGET (self)); gtk_widget_show_all (GTK_WIDGET (self));
gimp_resource_select_button_set_drag_target (GIMP_RESOURCE_SELECT_BUTTON (self), gimp_resource_chooser_set_drag_target (GIMP_RESOURCE_CHOOSER (self),
self->preview, self->preview, &drag_target);
&drag_target);
gimp_resource_select_button_set_clickable (GIMP_RESOURCE_SELECT_BUTTON (self), gimp_resource_chooser_set_clickable (GIMP_RESOURCE_CHOOSER (self), button);
button);
} }
static void static void
gimp_gradient_select_button_draw_interior (GimpResourceSelectButton *self) gimp_gradient_chooser_draw_interior (GimpResourceChooser *self)
{ {
GimpGradientSelectButton *gradient_select = GIMP_GRADIENT_SELECT_BUTTON (self); GimpGradientChooser *gradient_select = GIMP_GRADIENT_CHOOSER (self);
gtk_widget_queue_draw (gradient_select->preview); gtk_widget_queue_draw (gradient_select->preview);
} }
/** /**
* gimp_gradient_select_button_new: * gimp_gradient_chooser_new:
* @title: (nullable): Title of the dialog to use or %NULL to use the default title. * @title: (nullable): Title of the dialog to use or %NULL to use the default title.
* @label: (nullable): Button label or %NULL for no label. * @label: (nullable): Button label or %NULL for no label.
* @gradient: (nullable): Initial gradient. * @gradient: (nullable): Initial gradient.
@ -136,9 +134,9 @@ gimp_gradient_select_button_draw_interior (GimpResourceSelectButton *self)
* Since: 2.4 * Since: 2.4
*/ */
GtkWidget * GtkWidget *
gimp_gradient_select_button_new (const gchar *title, gimp_gradient_chooser_new (const gchar *title,
const gchar *label, const gchar *label,
GimpResource *gradient) GimpResource *gradient)
{ {
GtkWidget *self; GtkWidget *self;
@ -146,18 +144,18 @@ gimp_gradient_select_button_new (const gchar *title,
gradient = GIMP_RESOURCE (gimp_context_get_gradient ()); gradient = GIMP_RESOURCE (gimp_context_get_gradient ());
if (title) if (title)
self = g_object_new (GIMP_TYPE_GRADIENT_SELECT_BUTTON, self = g_object_new (GIMP_TYPE_GRADIENT_CHOOSER,
"title", title, "title", title,
"label", label, "label", label,
"resource", gradient, "resource", gradient,
NULL); NULL);
else else
self = g_object_new (GIMP_TYPE_GRADIENT_SELECT_BUTTON, self = g_object_new (GIMP_TYPE_GRADIENT_CHOOSER,
"label", label, "label", label,
"resource", gradient, "resource", gradient,
NULL); NULL);
gimp_gradient_select_button_draw_interior (GIMP_RESOURCE_SELECT_BUTTON (self)); gimp_gradient_chooser_draw_interior (GIMP_RESOURCE_CHOOSER (self));
return self; return self;
} }
@ -170,10 +168,10 @@ gimp_gradient_select_button_new (const gchar *title,
* Return success. * Return success.
*/ */
static gboolean static gboolean
get_gradient_data (GimpGradientSelectButton *self, get_gradient_data (GimpGradientChooser *self,
gint allocation_width, gint allocation_width,
gint *sample_count, gint *sample_count,
gdouble **sample_array) gdouble **sample_array)
{ {
GimpGradient *gradient; GimpGradient *gradient;
gboolean result; gboolean result;
@ -204,9 +202,9 @@ get_gradient_data (GimpGradientSelectButton *self,
/* Called on widget resized. */ /* Called on widget resized. */
static void static void
gimp_gradient_select_preview_size_allocate (GtkWidget *widget, gimp_gradient_select_preview_size_allocate (GtkWidget *widget,
GtkAllocation *allocation, GtkAllocation *allocation,
GimpGradientSelectButton *self) GimpGradientChooser *self)
{ {
/* Do nothing. /* Do nothing.
* *
@ -225,10 +223,10 @@ gimp_gradient_select_preview_size_allocate (GtkWidget *widget,
* This understands mostly cairo, and little about gradient. * This understands mostly cairo, and little about gradient.
*/ */
static void static void
gimp_gradient_select_preview_draw (cairo_t *cr, gimp_gradient_select_preview_draw (cairo_t *cr,
gint src_width, gint src_width,
gint dest_width, gint dest_width,
gdouble *src) gdouble *src)
{ {
cairo_pattern_t *pattern; cairo_pattern_t *pattern;
cairo_surface_t *surface; cairo_surface_t *surface;
@ -270,8 +268,6 @@ gimp_gradient_select_preview_draw (cairo_t *cr,
cairo_paint (cr); cairo_paint (cr);
} }
/* Handles a draw signal. /* Handles a draw signal.
* Draw self, i.e. interior of button. * Draw self, i.e. interior of button.
* *
@ -280,9 +276,9 @@ gimp_gradient_select_preview_draw (cairo_t *cr,
* Is passed neither gradient nor attributes of gradient: get them now from self. * Is passed neither gradient nor attributes of gradient: get them now from self.
*/ */
static gboolean static gboolean
gimp_gradient_select_preview_draw_handler (GtkWidget *widget, gimp_gradient_select_preview_draw_handler (GtkWidget *widget,
cairo_t *cr, cairo_t *cr,
GimpGradientSelectButton *self) GimpGradientChooser *self)
{ {
GtkAllocation allocation; GtkAllocation allocation;

View file

@ -1,7 +1,7 @@
/* LIBGIMP - The GIMP Library /* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
* *
* gimppatternselectbutton.h * gimpgradientchooser.h
* *
* This library is free software: you can redistribute it and/or * This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -22,25 +22,22 @@
#error "Only <libgimp/gimpui.h> can be included directly." #error "Only <libgimp/gimpui.h> can be included directly."
#endif #endif
#ifndef __GIMP_PATTERN_SELECT_BUTTON_H__ #ifndef __GIMP_GRADIENT_CHOOSER_H__
#define __GIMP_PATTERN_SELECT_BUTTON_H__ #define __GIMP_GRADIENT_CHOOSER_H__
#include <libgimp/gimpresourceselectbutton.h> #include <libgimp/gimpresourcechooser.h>
G_BEGIN_DECLS G_BEGIN_DECLS
#define GIMP_TYPE_PATTERN_SELECT_BUTTON (gimp_pattern_select_button_get_type ()) #define GIMP_TYPE_GRADIENT_CHOOSER (gimp_gradient_chooser_get_type ())
G_DECLARE_FINAL_TYPE (GimpPatternSelectButton, G_DECLARE_FINAL_TYPE (GimpGradientChooser, gimp_gradient_chooser, GIMP, GRADIENT_CHOOSER, GimpResourceChooser)
gimp_pattern_select_button,
GIMP, PATTERN_SELECT_BUTTON,
GimpResourceSelectButton)
GtkWidget * gimp_pattern_select_button_new (const gchar *title, GtkWidget * gimp_gradient_chooser_new (const gchar *title,
const gchar *label, const gchar *label,
GimpResource *resource); GimpResource *gradient);
G_END_DECLS G_END_DECLS
#endif /* __GIMP_PATTERN_SELECT_BUTTON_H__ */ #endif /* __GIMP_GRADIENT_CHOOSER_H__ */

View file

@ -1,47 +0,0 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* gimpgradientselectbutton.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
* <https://www.gnu.org/licenses/>.
*/
#if !defined (__GIMP_UI_H_INSIDE__) && !defined (GIMP_COMPILATION)
#error "Only <libgimp/gimpui.h> can be included directly."
#endif
#ifndef __GIMP_GRADIENT_SELECT_BUTTON_H__
#define __GIMP_GRADIENT_SELECT_BUTTON_H__
#include <libgimp/gimpresourceselectbutton.h>
G_BEGIN_DECLS
#define GIMP_TYPE_GRADIENT_SELECT_BUTTON (gimp_gradient_select_button_get_type ())
G_DECLARE_FINAL_TYPE (GimpGradientSelectButton,
gimp_gradient_select_button,
GIMP,
GRADIENT_SELECT_BUTTON,
GimpResourceSelectButton)
GtkWidget * gimp_gradient_select_button_new (const gchar *title,
const gchar *label,
GimpResource *gradient);
G_END_DECLS
#endif /* __GIMP_GRADIENT_SELECT_BUTTON_H__ */

View file

@ -1,7 +1,7 @@
/* LIBGIMP - The GIMP Library /* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
* *
* gimppaletteselectbutton.c * gimppalettechooser.c
* Copyright (C) 2004 Michael Natterer <mitch@gimp.org> * Copyright (C) 2004 Michael Natterer <mitch@gimp.org>
* *
* This library is free software: you can redistribute it and/or * This library is free software: you can redistribute it and/or
@ -29,51 +29,49 @@
#include "gimp.h" #include "gimp.h"
#include "gimpuitypes.h" #include "gimpuitypes.h"
#include "gimppaletteselectbutton.h" #include "gimppalettechooser.h"
#include "gimpuimarshal.h" #include "gimpuimarshal.h"
#include "libgimp-intl.h" #include "libgimp-intl.h"
/** /**
* SECTION: gimppaletteselectbutton * SECTION: gimppalettechooser
* @title: GimpPaletteSelectButton * @title: GimpPaletteChooser
* @short_description: A button which pops up a palette selection dialog. * @short_description: A button which pops up a palette selection dialog.
* *
* A button which pops up a palette selection dialog. * A button which pops up a palette selection dialog.
**/ **/
struct _GimpPaletteSelectButton struct _GimpPaletteChooser
{ {
GimpResourceSelectButton parent_instance; GimpResourceChooser parent_instance;
GtkWidget *label; GtkWidget *label;
GtkWidget *button; GtkWidget *button;
}; };
static void gimp_palette_select_button_draw_interior (GimpResourceSelectButton *self); static void gimp_palette_chooser_draw_interior (GimpResourceChooser *self);
static const GtkTargetEntry drag_target = { "application/x-gimp-palette-name", 0, 0 }; static const GtkTargetEntry drag_target = { "application/x-gimp-palette-name", 0, 0 };
G_DEFINE_FINAL_TYPE (GimpPaletteSelectButton, G_DEFINE_FINAL_TYPE (GimpPaletteChooser, gimp_palette_chooser, GIMP_TYPE_RESOURCE_CHOOSER)
gimp_palette_select_button,
GIMP_TYPE_RESOURCE_SELECT_BUTTON)
static void static void
gimp_palette_select_button_class_init (GimpPaletteSelectButtonClass *klass) gimp_palette_chooser_class_init (GimpPaletteChooserClass *klass)
{ {
GimpResourceSelectButtonClass *superclass = GIMP_RESOURCE_SELECT_BUTTON_CLASS (klass); GimpResourceChooserClass *superclass = GIMP_RESOURCE_CHOOSER_CLASS (klass);
superclass->draw_interior = gimp_palette_select_button_draw_interior; superclass->draw_interior = gimp_palette_chooser_draw_interior;
superclass->resource_type = GIMP_TYPE_PALETTE; superclass->resource_type = GIMP_TYPE_PALETTE;
} }
static void static void
gimp_palette_select_button_init (GimpPaletteSelectButton *self) gimp_palette_chooser_init (GimpPaletteChooser *self)
{ {
GtkWidget *hbox; GtkWidget *hbox;
GtkWidget *image; GtkWidget *image;
@ -93,21 +91,19 @@ gimp_palette_select_button_init (GimpPaletteSelectButton *self)
gtk_widget_show_all (GTK_WIDGET (self)); gtk_widget_show_all (GTK_WIDGET (self));
gimp_resource_select_button_set_drag_target (GIMP_RESOURCE_SELECT_BUTTON (self), gimp_resource_chooser_set_drag_target (GIMP_RESOURCE_CHOOSER (self),
hbox, hbox, &drag_target);
&drag_target); gimp_resource_chooser_set_clickable (GIMP_RESOURCE_CHOOSER (self), self->button);
gimp_resource_select_button_set_clickable (GIMP_RESOURCE_SELECT_BUTTON (self),
self->button);
} }
static void static void
gimp_palette_select_button_draw_interior (GimpResourceSelectButton *self) gimp_palette_chooser_draw_interior (GimpResourceChooser *self)
{ {
GimpPaletteSelectButton *palette_select= GIMP_PALETTE_SELECT_BUTTON (self); GimpPaletteChooser *palette_select= GIMP_PALETTE_CHOOSER (self);
GimpResource *resource; GimpResource *resource;
gchar *name = NULL; gchar *name = NULL;
resource = gimp_resource_select_button_get_resource (self); resource = gimp_resource_chooser_get_resource (self);
if (resource) if (resource)
name = gimp_resource_get_name (resource); name = gimp_resource_get_name (resource);
@ -115,9 +111,8 @@ gimp_palette_select_button_draw_interior (GimpResourceSelectButton *self)
gtk_label_set_text (GTK_LABEL (palette_select->label), name); gtk_label_set_text (GTK_LABEL (palette_select->label), name);
} }
/** /**
* gimp_palette_select_button_new: * gimp_palette_chooser_new:
* @title: (nullable): Title of the dialog to use or %NULL to use the default title. * @title: (nullable): Title of the dialog to use or %NULL to use the default title.
* @label: (nullable): Button label or %NULL for no label. * @label: (nullable): Button label or %NULL for no label.
* @resource: (nullable): Initial palette. * @resource: (nullable): Initial palette.
@ -132,9 +127,9 @@ gimp_palette_select_button_draw_interior (GimpResourceSelectButton *self)
* Since: 2.4 * Since: 2.4
*/ */
GtkWidget * GtkWidget *
gimp_palette_select_button_new (const gchar *title, gimp_palette_chooser_new (const gchar *title,
const gchar *label, const gchar *label,
GimpResource *resource) GimpResource *resource)
{ {
GtkWidget *self; GtkWidget *self;
@ -142,18 +137,18 @@ gimp_palette_select_button_new (const gchar *title,
resource = GIMP_RESOURCE (gimp_context_get_palette ()); resource = GIMP_RESOURCE (gimp_context_get_palette ());
if (title) if (title)
self = g_object_new (GIMP_TYPE_PALETTE_SELECT_BUTTON, self = g_object_new (GIMP_TYPE_PALETTE_CHOOSER,
"title", title, "title", title,
"label", label, "label", label,
"resource", resource, "resource", resource,
NULL); NULL);
else else
self = g_object_new (GIMP_TYPE_PALETTE_SELECT_BUTTON, self = g_object_new (GIMP_TYPE_PALETTE_CHOOSER,
"label", label, "label", label,
"resource", resource, "resource", resource,
NULL); NULL);
gimp_palette_select_button_draw_interior (GIMP_RESOURCE_SELECT_BUTTON (self)); gimp_palette_chooser_draw_interior (GIMP_RESOURCE_CHOOSER (self));
return self; return self;
} }

View file

@ -22,25 +22,22 @@
#error "Only <libgimp/gimpui.h> can be included directly." #error "Only <libgimp/gimpui.h> can be included directly."
#endif #endif
#ifndef __GIMP_PALETTE_SELECT_BUTTON_H__ #ifndef __GIMP_PALETTE_CHOOSER_H__
#define __GIMP_PALETTE_SELECT_BUTTON_H__ #define __GIMP_PALETTE_CHOOSER_H__
#include <libgimp/gimpresourceselectbutton.h> #include <libgimp/gimpresourcechooser.h>
G_BEGIN_DECLS G_BEGIN_DECLS
#define GIMP_TYPE_PALETTE_SELECT_BUTTON (gimp_palette_select_button_get_type ()) #define GIMP_TYPE_PALETTE_CHOOSER (gimp_palette_chooser_get_type ())
G_DECLARE_FINAL_TYPE (GimpPaletteSelectButton, G_DECLARE_FINAL_TYPE (GimpPaletteChooser, gimp_palette_chooser, GIMP, PALETTE_CHOOSER, GimpResourceChooser)
gimp_palette_select_button,
GIMP, PALETTE_SELECT_BUTTON,
GimpResourceSelectButton)
GtkWidget * gimp_palette_select_button_new (const gchar *title, GtkWidget * gimp_palette_chooser_new (const gchar *title,
const gchar *label, const gchar *label,
GimpResource *resource); GimpResource *resource);
G_END_DECLS G_END_DECLS
#endif /* __GIMP_PALETTE_SELECT_BUTTON_H__ */ #endif /* __GIMP_PALETTE_CHOOSER_H__ */

View file

@ -1,7 +1,7 @@
/* LIBGIMP - The GIMP Library /* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
* *
* gimppatternselectbutton.c * gimppatternchooser.c
* Copyright (C) 1998 Andy Thomas * Copyright (C) 1998 Andy Thomas
* *
* This library is free software: you can redistribute it and/or * This library is free software: you can redistribute it and/or
@ -29,15 +29,15 @@
#include "gimp.h" #include "gimp.h"
#include "gimpuitypes.h" #include "gimpuitypes.h"
#include "gimppatternselectbutton.h" #include "gimppatternchooser.h"
#include "gimpuimarshal.h" #include "gimpuimarshal.h"
#include "libgimp-intl.h" #include "libgimp-intl.h"
/** /**
* SECTION: gimppatternselectbutton * SECTION: gimppatternchooser
* @title: GimpPatternSelectButton * @title: GimpPatternChooser
* @short_description: A button which pops up a pattern selection dialog. * @short_description: A button which pops up a pattern selection dialog.
* *
* A button which pops up a pattern selection dialog. * A button which pops up a pattern selection dialog.
@ -48,39 +48,39 @@
#define CELL_SIZE 40 #define CELL_SIZE 40
struct _GimpPatternSelectButton struct _GimpPatternChooser
{ {
GimpResourceSelectButton parent_instance; GimpResourceChooser parent_instance;
GtkWidget *preview; GtkWidget *preview;
GtkWidget *popup; GtkWidget *popup;
GimpPattern *pattern; GimpPattern *pattern;
GeglBuffer *buffer; GeglBuffer *buffer;
gint width; gint width;
gint height; gint height;
}; };
/* local */ /* local */
static gboolean gimp_pattern_select_on_preview_events (GtkWidget *widget, static gboolean gimp_pattern_select_on_preview_events (GtkWidget *widget,
GdkEvent *event, GdkEvent *event,
GimpPatternSelectButton *button); GimpPatternChooser *button);
/* local drawing methods. */ /* local drawing methods. */
static void gimp_pattern_select_preview_fill_draw (GimpPatternSelectButton *chooser, static void gimp_pattern_select_preview_fill_draw (GimpPatternChooser *chooser,
GimpPreviewArea *area); GimpPreviewArea *area);
static void gimp_pattern_select_button_draw (GimpResourceSelectButton *self); static void gimp_pattern_chooser_draw (GimpResourceChooser *self);
static void gimp_pattern_select_button_get_pattern_image (GimpPatternSelectButton *self, static void gimp_pattern_chooser_get_pattern_image (GimpPatternChooser *self,
gint width, gint width,
gint height); gint height);
/* Popup methods. */ /* Popup methods. */
static void gimp_pattern_select_button_open_popup (GimpPatternSelectButton *button, static void gimp_pattern_chooser_open_popup (GimpPatternChooser *button,
gint x, gint x,
gint y); gint y);
static void gimp_pattern_select_button_close_popup (GimpPatternSelectButton *button); static void gimp_pattern_chooser_close_popup (GimpPatternChooser *button);
/* A GtkTargetEntry has a string and two ints. /* A GtkTargetEntry has a string and two ints.
@ -88,20 +88,20 @@ static void gimp_pattern_select_button_close_popup (GimpPatternSelectB
*/ */
static const GtkTargetEntry drag_target = { "application/x-gimp-pattern-name", 0, 0 }; static const GtkTargetEntry drag_target = { "application/x-gimp-pattern-name", 0, 0 };
G_DEFINE_FINAL_TYPE (GimpPatternSelectButton, gimp_pattern_select_button, GIMP_TYPE_RESOURCE_SELECT_BUTTON) G_DEFINE_FINAL_TYPE (GimpPatternChooser, gimp_pattern_chooser, GIMP_TYPE_RESOURCE_CHOOSER)
static void static void
gimp_pattern_select_button_class_init (GimpPatternSelectButtonClass *klass) gimp_pattern_chooser_class_init (GimpPatternChooserClass *klass)
{ {
GimpResourceSelectButtonClass *superclass = GIMP_RESOURCE_SELECT_BUTTON_CLASS (klass); GimpResourceChooserClass *superclass = GIMP_RESOURCE_CHOOSER_CLASS (klass);
superclass->draw_interior = gimp_pattern_select_button_draw; superclass->draw_interior = gimp_pattern_chooser_draw;
superclass->resource_type = GIMP_TYPE_PATTERN; superclass->resource_type = GIMP_TYPE_PATTERN;
} }
static void static void
gimp_pattern_select_button_init (GimpPatternSelectButton *self) gimp_pattern_chooser_init (GimpPatternChooser *self)
{ {
GtkWidget *frame; GtkWidget *frame;
GtkWidget *button; GtkWidget *button;
@ -119,7 +119,7 @@ gimp_pattern_select_button_init (GimpPatternSelectButton *self)
gtk_widget_show (self->preview); gtk_widget_show (self->preview);
g_signal_connect_swapped (self->preview, "size-allocate", g_signal_connect_swapped (self->preview, "size-allocate",
G_CALLBACK (gimp_pattern_select_button_draw), G_CALLBACK (gimp_pattern_chooser_draw),
self); self);
g_signal_connect (self->preview, "event", g_signal_connect (self->preview, "event",
@ -129,17 +129,15 @@ gimp_pattern_select_button_init (GimpPatternSelectButton *self)
button = gtk_button_new_with_mnemonic (_("_Browse...")); button = gtk_button_new_with_mnemonic (_("_Browse..."));
gtk_box_pack_start (GTK_BOX (self), button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (self), button, FALSE, FALSE, 0);
gimp_resource_select_button_set_drag_target (GIMP_RESOURCE_SELECT_BUTTON (self), gimp_resource_chooser_set_drag_target (GIMP_RESOURCE_CHOOSER (self),
self->preview, self->preview, &drag_target);
&drag_target);
gimp_resource_select_button_set_clickable (GIMP_RESOURCE_SELECT_BUTTON (self), gimp_resource_chooser_set_clickable (GIMP_RESOURCE_CHOOSER (self), button);
button);
gtk_widget_show (button); gtk_widget_show (button);
} }
/** /**
* gimp_pattern_select_button_new: * gimp_pattern_chooser_new:
* @title: (nullable): Title of the dialog to use or %NULL to use the default title. * @title: (nullable): Title of the dialog to use or %NULL to use the default title.
* @label: (nullable): Button label or %NULL for no label. * @label: (nullable): Button label or %NULL for no label.
* @resource: (nullable): Initial pattern. * @resource: (nullable): Initial pattern.
@ -154,7 +152,7 @@ gimp_pattern_select_button_init (GimpPatternSelectButton *self)
* Since: 2.4 * Since: 2.4
*/ */
GtkWidget * GtkWidget *
gimp_pattern_select_button_new (const gchar *title, gimp_pattern_chooser_new (const gchar *title,
const gchar *label, const gchar *label,
GimpResource *resource) GimpResource *resource)
{ {
@ -165,39 +163,39 @@ gimp_pattern_select_button_new (const gchar *title,
g_return_val_if_fail (GIMP_IS_PATTERN (resource), NULL); g_return_val_if_fail (GIMP_IS_PATTERN (resource), NULL);
if (title) if (title)
self = g_object_new (GIMP_TYPE_PATTERN_SELECT_BUTTON, self = g_object_new (GIMP_TYPE_PATTERN_CHOOSER,
"title", title, "title", title,
"label", label, "label", label,
"resource", resource, "resource", resource,
NULL); NULL);
else else
self = g_object_new (GIMP_TYPE_PATTERN_SELECT_BUTTON, self = g_object_new (GIMP_TYPE_PATTERN_CHOOSER,
"label", label, "label", label,
"resource", resource, "resource", resource,
NULL); NULL);
gimp_pattern_select_button_draw (GIMP_RESOURCE_SELECT_BUTTON (self)); gimp_pattern_chooser_draw (GIMP_RESOURCE_CHOOSER (self));
return self; return self;
} }
static void static void
gimp_pattern_select_button_draw (GimpResourceSelectButton *chooser) gimp_pattern_chooser_draw (GimpResourceChooser *chooser)
{ {
GimpPatternSelectButton *pchooser = GIMP_PATTERN_SELECT_BUTTON (chooser); GimpPatternChooser *pchooser = GIMP_PATTERN_CHOOSER (chooser);
GtkAllocation allocation; GtkAllocation allocation;
gtk_widget_get_allocation (pchooser->preview, &allocation); gtk_widget_get_allocation (pchooser->preview, &allocation);
gimp_pattern_select_button_get_pattern_image (pchooser, allocation.width, allocation.height); gimp_pattern_chooser_get_pattern_image (pchooser, allocation.width, allocation.height);
gimp_pattern_select_preview_fill_draw (pchooser, GIMP_PREVIEW_AREA (pchooser->preview)); gimp_pattern_select_preview_fill_draw (pchooser, GIMP_PREVIEW_AREA (pchooser->preview));
} }
static void static void
gimp_pattern_select_button_get_pattern_image (GimpPatternSelectButton *chooser, gimp_pattern_chooser_get_pattern_image (GimpPatternChooser *chooser,
gint width, gint width,
gint height) gint height)
{ {
GimpPattern *pattern; GimpPattern *pattern;
@ -224,9 +222,9 @@ gimp_pattern_select_button_get_pattern_image (GimpPatternSelectButton *chooser,
/* On mouse events in self's preview, popup a zoom view of entire pattern */ /* On mouse events in self's preview, popup a zoom view of entire pattern */
static gboolean static gboolean
gimp_pattern_select_on_preview_events (GtkWidget *widget, gimp_pattern_select_on_preview_events (GtkWidget *widget,
GdkEvent *event, GdkEvent *event,
GimpPatternSelectButton *self) GimpPatternChooser *self)
{ {
GdkEventButton *bevent; GdkEventButton *bevent;
@ -238,7 +236,7 @@ gimp_pattern_select_on_preview_events (GtkWidget *widget,
if (bevent->button == 1) if (bevent->button == 1)
{ {
gtk_grab_add (widget); gtk_grab_add (widget);
gimp_pattern_select_button_open_popup (self, gimp_pattern_chooser_open_popup (self,
bevent->x, bevent->y); bevent->x, bevent->y);
} }
break; break;
@ -249,7 +247,7 @@ gimp_pattern_select_on_preview_events (GtkWidget *widget,
if (bevent->button == 1) if (bevent->button == 1)
{ {
gtk_grab_remove (widget); gtk_grab_remove (widget);
gimp_pattern_select_button_close_popup (self); gimp_pattern_chooser_close_popup (self);
} }
break; break;
@ -262,8 +260,8 @@ gimp_pattern_select_on_preview_events (GtkWidget *widget,
/* Fill a GimpPreviewArea with a image then draw. */ /* Fill a GimpPreviewArea with a image then draw. */
static void static void
gimp_pattern_select_preview_fill_draw (GimpPatternSelectButton *chooser, gimp_pattern_select_preview_fill_draw (GimpPatternChooser *chooser,
GimpPreviewArea *area) GimpPreviewArea *area)
{ {
GeglBuffer *src_buffer; GeglBuffer *src_buffer;
const Babl *format; const Babl *format;
@ -323,9 +321,9 @@ gimp_pattern_select_preview_fill_draw (GimpPatternSelectButton *chooser,
/* popup methods. */ /* popup methods. */
static void static void
gimp_pattern_select_button_open_popup (GimpPatternSelectButton *chooser, gimp_pattern_chooser_open_popup (GimpPatternChooser *chooser,
gint x, gint x,
gint y) gint y)
{ {
GtkWidget *frame; GtkWidget *frame;
GtkWidget *preview; GtkWidget *preview;
@ -335,7 +333,7 @@ gimp_pattern_select_button_open_popup (GimpPatternSelectButton *chooser,
gint y_org; gint y_org;
if (chooser->popup) if (chooser->popup)
gimp_pattern_select_button_close_popup (chooser); gimp_pattern_chooser_close_popup (chooser);
if (chooser->width <= CELL_SIZE && chooser->height <= CELL_SIZE) if (chooser->width <= CELL_SIZE && chooser->height <= CELL_SIZE)
return; return;
@ -377,7 +375,7 @@ gimp_pattern_select_button_open_popup (GimpPatternSelectButton *chooser,
} }
static void static void
gimp_pattern_select_button_close_popup (GimpPatternSelectButton *self) gimp_pattern_chooser_close_popup (GimpPatternChooser *self)
{ {
g_clear_pointer (&self->popup, gtk_widget_destroy); g_clear_pointer (&self->popup, gtk_widget_destroy);
} }

View file

@ -0,0 +1,43 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* gimppatternchooser.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
* <https://www.gnu.org/licenses/>.
*/
#if !defined (__GIMP_UI_H_INSIDE__) && !defined (GIMP_COMPILATION)
#error "Only <libgimp/gimpui.h> can be included directly."
#endif
#ifndef __GIMP_PATTERN_CHOOSER_H__
#define __GIMP_PATTERN_CHOOSER_H__
#include <libgimp/gimpresourcechooser.h>
G_BEGIN_DECLS
#define GIMP_TYPE_PATTERN_CHOOSER (gimp_pattern_chooser_get_type ())
G_DECLARE_FINAL_TYPE (GimpPatternChooser, gimp_pattern_chooser, GIMP, PATTERN_CHOOSER, GimpResourceChooser)
GtkWidget * gimp_pattern_chooser_new (const gchar *title,
const gchar *label,
GimpResource *resource);
G_END_DECLS
#endif /* __GIMP_PATTERN_CHOOSER_H__ */

View file

@ -836,8 +836,8 @@ gimp_procedure_dialog_get_widget (GimpProcedureDialog *dialog,
{ {
if (GIMP_IS_LABELED (widget)) if (GIMP_IS_LABELED (widget))
label = gimp_labeled_get_label (GIMP_LABELED (widget)); label = gimp_labeled_get_label (GIMP_LABELED (widget));
else if (GIMP_IS_RESOURCE_SELECT_BUTTON (widget)) else if (GIMP_IS_RESOURCE_CHOOSER (widget))
label = gimp_resource_select_button_get_label (GIMP_RESOURCE_SELECT_BUTTON (widget)); label = gimp_resource_chooser_get_label (GIMP_RESOURCE_CHOOSER (widget));
} }
if (label != NULL) if (label != NULL)
gtk_size_group_add_widget (dialog->priv->label_group, label); gtk_size_group_add_widget (dialog->priv->label_group, label);

View file

@ -58,7 +58,7 @@ gimp_prop_brush_chooser_new (GObject *config,
const gchar *property_name, const gchar *property_name,
const gchar *chooser_title) const gchar *chooser_title)
{ {
return gimp_prop_resource_chooser_factory (gimp_brush_select_button_new, return gimp_prop_resource_chooser_factory (gimp_brush_chooser_new,
config, property_name, chooser_title); config, property_name, chooser_title);
} }
@ -79,7 +79,7 @@ gimp_prop_font_chooser_new (GObject *config,
const gchar *property_name, const gchar *property_name,
const gchar *chooser_title) const gchar *chooser_title)
{ {
return gimp_prop_resource_chooser_factory (gimp_font_select_button_new, return gimp_prop_resource_chooser_factory (gimp_font_chooser_new,
config, property_name, chooser_title); config, property_name, chooser_title);
} }
@ -100,7 +100,7 @@ gimp_prop_gradient_chooser_new (GObject *config,
const gchar *property_name, const gchar *property_name,
const gchar *chooser_title) const gchar *chooser_title)
{ {
return gimp_prop_resource_chooser_factory (gimp_gradient_select_button_new, return gimp_prop_resource_chooser_factory (gimp_gradient_chooser_new,
config, property_name, chooser_title); config, property_name, chooser_title);
} }
@ -121,7 +121,7 @@ gimp_prop_palette_chooser_new (GObject *config,
const gchar *property_name, const gchar *property_name,
const gchar *chooser_title) const gchar *chooser_title)
{ {
return gimp_prop_resource_chooser_factory (gimp_palette_select_button_new, return gimp_prop_resource_chooser_factory (gimp_palette_chooser_new,
config, property_name, chooser_title); config, property_name, chooser_title);
} }
@ -142,7 +142,7 @@ gimp_prop_pattern_chooser_new (GObject *config,
const gchar *property_name, const gchar *property_name,
const gchar *chooser_title) const gchar *chooser_title)
{ {
return gimp_prop_resource_chooser_factory (gimp_pattern_select_button_new, return gimp_prop_resource_chooser_factory (gimp_pattern_chooser_new,
config, property_name, chooser_title); config, property_name, chooser_title);
} }
@ -175,7 +175,7 @@ gimp_prop_resource_chooser_factory (GimpResourceWidgetCreator widget_creator_fu
label = g_param_spec_get_nick (param_spec); label = g_param_spec_get_nick (param_spec);
/* Create the wrapped widget. For example, call gimp_font_select_button_new. /* Create the wrapped widget. For example, call gimp_font_chooser_new.
* When initial_resource is NULL, the widget creator will set it's resource * When initial_resource is NULL, the widget creator will set it's resource
* property from context. * property from context.
*/ */

View file

@ -26,15 +26,15 @@
#include "gimp.h" #include "gimp.h"
#include "gimpuitypes.h" #include "gimpuitypes.h"
#include "gimpresourceselectbutton.h" #include "gimpresourcechooser.h"
#include "gimpuimarshal.h" #include "gimpuimarshal.h"
#include "libgimp-intl.h" #include "libgimp-intl.h"
/** /**
* SECTION: gimpresourceselectbutton * SECTION: gimpresourcechooser
* @title: GimpResourceSelectButton * @title: GimpResourceChooser
* @short_description: Base class for buttons that popup a resource * @short_description: Base class for buttons that popup a resource
* selection dialog. * selection dialog.
* *
@ -92,63 +92,63 @@ typedef struct
gchar *callback; gchar *callback;
GtkWidget *label_widget; GtkWidget *label_widget;
} GimpResourceSelectButtonPrivate; } GimpResourceChooserPrivate;
/* local function prototypes */ /* local function prototypes */
static void gimp_resource_select_button_constructed (GObject *object); static void gimp_resource_chooser_constructed (GObject *object);
static void gimp_resource_select_button_dispose (GObject *object); static void gimp_resource_chooser_dispose (GObject *object);
static void gimp_resource_select_button_finalize (GObject *object); static void gimp_resource_chooser_finalize (GObject *object);
static void gimp_resource_select_button_set_property (GObject *object, static void gimp_resource_chooser_set_property (GObject *object,
guint property_id, guint property_id,
const GValue *value, const GValue *value,
GParamSpec *pspec); GParamSpec *pspec);
static void gimp_resource_select_button_get_property (GObject *object, static void gimp_resource_chooser_get_property (GObject *object,
guint property_id, guint property_id,
GValue *value, GValue *value,
GParamSpec *pspec); GParamSpec *pspec);
static void gimp_resource_select_button_clicked (GimpResourceSelectButton *self); static void gimp_resource_chooser_clicked (GimpResourceChooser *self);
static void gimp_resource_select_button_callback (GimpResource *resource, static void gimp_resource_chooser_callback (GimpResource *resource,
gboolean dialog_closing, gboolean dialog_closing,
gpointer user_data); gpointer user_data);
static void gimp_resource_select_drag_data_received (GimpResourceSelectButton *self, static void gimp_resource_select_drag_data_received (GimpResourceChooser *self,
GdkDragContext *context, GdkDragContext *context,
gint x, gint x,
gint y, gint y,
GtkSelectionData *selection, GtkSelectionData *selection,
guint info, guint info,
guint time); guint time);
static void gimp_resource_select_button_set_remote_dialog (GimpResourceSelectButton *self, static void gimp_resource_chooser_set_remote_dialog (GimpResourceChooser *self,
GimpResource *resource); GimpResource *resource);
static guint resource_button_signals[LAST_SIGNAL] = { 0 }; static guint resource_button_signals[LAST_SIGNAL] = { 0 };
static GParamSpec *resource_button_props[N_PROPS] = { NULL, }; static GParamSpec *resource_button_props[N_PROPS] = { NULL, };
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GimpResourceSelectButton, gimp_resource_select_button, GTK_TYPE_BOX) G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GimpResourceChooser, gimp_resource_chooser, GTK_TYPE_BOX)
static void static void
gimp_resource_select_button_class_init (GimpResourceSelectButtonClass *klass) gimp_resource_chooser_class_init (GimpResourceChooserClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->constructed = gimp_resource_select_button_constructed; object_class->constructed = gimp_resource_chooser_constructed;
object_class->dispose = gimp_resource_select_button_dispose; object_class->dispose = gimp_resource_chooser_dispose;
object_class->finalize = gimp_resource_select_button_finalize; object_class->finalize = gimp_resource_chooser_finalize;
object_class->set_property = gimp_resource_select_button_set_property; object_class->set_property = gimp_resource_chooser_set_property;
object_class->get_property = gimp_resource_select_button_get_property; object_class->get_property = gimp_resource_chooser_get_property;
klass->resource_set = NULL; klass->resource_set = NULL;
/** /**
* GimpResourceSelectButton:title: * GimpResourceChooser:title:
* *
* The title to be used for the resource selection popup dialog. * The title to be used for the resource selection popup dialog.
* *
@ -163,7 +163,7 @@ gimp_resource_select_button_class_init (GimpResourceSelectButtonClass *klass)
G_PARAM_CONSTRUCT_ONLY); G_PARAM_CONSTRUCT_ONLY);
/** /**
* GimpResourceSelectButton:label: * GimpResourceChooser:label:
* *
* Label text with mnemonic. * Label text with mnemonic.
* *
@ -178,7 +178,7 @@ gimp_resource_select_button_class_init (GimpResourceSelectButtonClass *klass)
G_PARAM_CONSTRUCT_ONLY); G_PARAM_CONSTRUCT_ONLY);
/** /**
* GimpResourceSelectButton:resource: * GimpResourceChooser:resource:
* *
* The currently selected resource. * The currently selected resource.
* *
@ -195,7 +195,7 @@ gimp_resource_select_button_class_init (GimpResourceSelectButtonClass *klass)
N_PROPS, resource_button_props); N_PROPS, resource_button_props);
/** /**
* GimpResourceSelectButton::resource-set: * GimpResourceChooser::resource-set:
* @widget: the object which received the signal. * @widget: the object which received the signal.
* @resource: the currently selected resource. * @resource: the currently selected resource.
* @dialog_closing: whether the dialog was closed or not. * @dialog_closing: whether the dialog was closed or not.
@ -208,7 +208,7 @@ gimp_resource_select_button_class_init (GimpResourceSelectButtonClass *klass)
g_signal_new ("resource-set", g_signal_new ("resource-set",
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpResourceSelectButtonClass, resource_set), G_STRUCT_OFFSET (GimpResourceChooserClass, resource_set),
NULL, NULL, NULL, NULL,
_gimpui_marshal_VOID__POINTER_BOOLEAN, _gimpui_marshal_VOID__POINTER_BOOLEAN,
G_TYPE_NONE, 2, G_TYPE_NONE, 2,
@ -217,11 +217,11 @@ gimp_resource_select_button_class_init (GimpResourceSelectButtonClass *klass)
} }
static void static void
gimp_resource_select_button_init (GimpResourceSelectButton *self) gimp_resource_chooser_init (GimpResourceChooser *self)
{ {
GimpResourceSelectButtonPrivate *priv; GimpResourceChooserPrivate *priv;
priv = gimp_resource_select_button_get_instance_private (GIMP_RESOURCE_SELECT_BUTTON (self)); priv = gimp_resource_chooser_get_instance_private (GIMP_RESOURCE_CHOOSER (self));
gtk_orientable_set_orientation (GTK_ORIENTABLE (self), gtk_orientable_set_orientation (GTK_ORIENTABLE (self),
GTK_ORIENTATION_HORIZONTAL); GTK_ORIENTATION_HORIZONTAL);
@ -232,25 +232,25 @@ gimp_resource_select_button_init (GimpResourceSelectButton *self)
} }
static void static void
gimp_resource_select_button_constructed (GObject *object) gimp_resource_chooser_constructed (GObject *object)
{ {
GimpResourceSelectButtonPrivate *priv; GimpResourceChooserPrivate *priv;
priv = gimp_resource_select_button_get_instance_private (GIMP_RESOURCE_SELECT_BUTTON (object)); priv = gimp_resource_chooser_get_instance_private (GIMP_RESOURCE_CHOOSER (object));
gtk_label_set_text_with_mnemonic (GTK_LABEL (priv->label_widget), priv->label); gtk_label_set_text_with_mnemonic (GTK_LABEL (priv->label_widget), priv->label);
gtk_widget_show (GTK_WIDGET (priv->label_widget)); gtk_widget_show (GTK_WIDGET (priv->label_widget));
G_OBJECT_CLASS (gimp_resource_select_button_parent_class)->constructed (object); G_OBJECT_CLASS (gimp_resource_chooser_parent_class)->constructed (object);
} }
static void static void
gimp_resource_select_button_dispose (GObject *self) gimp_resource_chooser_dispose (GObject *self)
{ {
GimpResourceSelectButtonPrivate *priv; GimpResourceChooserPrivate *priv;
GimpResourceSelectButtonClass *klass; GimpResourceChooserClass *klass;
priv = gimp_resource_select_button_get_instance_private (GIMP_RESOURCE_SELECT_BUTTON (self)); priv = gimp_resource_chooser_get_instance_private (GIMP_RESOURCE_CHOOSER (self));
klass = GIMP_RESOURCE_SELECT_BUTTON_GET_CLASS (self); klass = GIMP_RESOURCE_CHOOSER_GET_CLASS (self);
if (priv->callback) if (priv->callback)
{ {
@ -273,24 +273,24 @@ gimp_resource_select_button_dispose (GObject *self)
g_clear_pointer (&priv->callback, g_free); g_clear_pointer (&priv->callback, g_free);
} }
G_OBJECT_CLASS (gimp_resource_select_button_parent_class)->dispose (self); G_OBJECT_CLASS (gimp_resource_chooser_parent_class)->dispose (self);
} }
static void static void
gimp_resource_select_button_finalize (GObject *object) gimp_resource_chooser_finalize (GObject *object)
{ {
GimpResourceSelectButton *self = GIMP_RESOURCE_SELECT_BUTTON (object); GimpResourceChooser *self = GIMP_RESOURCE_CHOOSER (object);
GimpResourceSelectButtonPrivate *priv = gimp_resource_select_button_get_instance_private (self); GimpResourceChooserPrivate *priv = gimp_resource_chooser_get_instance_private (self);
g_clear_pointer (&priv->title, g_free); g_clear_pointer (&priv->title, g_free);
g_clear_pointer (&priv->label, g_free); g_clear_pointer (&priv->label, g_free);
G_OBJECT_CLASS (gimp_resource_select_button_parent_class)->finalize (object); G_OBJECT_CLASS (gimp_resource_chooser_parent_class)->finalize (object);
} }
/** /**
* gimp_resource_select_button_set_drag_target: * gimp_resource_chooser_set_drag_target:
* @self: A [class@ResourceSelectButton] * @self: A [class@ResourceChooser]
* @drag_region_widget: An interior widget to be a droppable region * @drag_region_widget: An interior widget to be a droppable region
* and emit "drag-data-received" signal * and emit "drag-data-received" signal
* @drag_target: The drag target to accept * @drag_target: The drag target to accept
@ -304,11 +304,11 @@ gimp_resource_select_button_finalize (GObject *object)
* Since: 3.0 * Since: 3.0
**/ **/
void void
gimp_resource_select_button_set_drag_target (GimpResourceSelectButton *self, gimp_resource_chooser_set_drag_target (GimpResourceChooser *self,
GtkWidget *drag_region_widget, GtkWidget *drag_region_widget,
const GtkTargetEntry *drag_target) const GtkTargetEntry *drag_target)
{ {
g_return_if_fail (GIMP_IS_RESOURCE_SELECT_BUTTON (self)); g_return_if_fail (GIMP_IS_RESOURCE_CHOOSER (self));
g_return_if_fail (drag_target != NULL); g_return_if_fail (drag_target != NULL);
g_return_if_fail (drag_region_widget != NULL); g_return_if_fail (drag_region_widget != NULL);
@ -326,8 +326,8 @@ gimp_resource_select_button_set_drag_target (GimpResourceSelectButton *self,
} }
/** /**
* gimp_resource_select_button_set_clickable: * gimp_resource_chooser_set_clickable:
* @self: A [class@ResourceSelectButton] * @self: A [class@ResourceChooser]
* @widget: An interior widget that emits "clicked" signal * @widget: An interior widget that emits "clicked" signal
* *
* Called by a subclass init to specialize the instance. * Called by a subclass init to specialize the instance.
@ -339,22 +339,22 @@ gimp_resource_select_button_set_drag_target (GimpResourceSelectButton *self,
* Since: 3.0 * Since: 3.0
**/ **/
void void
gimp_resource_select_button_set_clickable (GimpResourceSelectButton *self, gimp_resource_chooser_set_clickable (GimpResourceChooser *self,
GtkWidget *widget) GtkWidget *widget)
{ {
g_return_if_fail (GIMP_IS_RESOURCE_SELECT_BUTTON (self)); g_return_if_fail (GIMP_IS_RESOURCE_CHOOSER (self));
g_return_if_fail (widget != NULL); g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget)); g_return_if_fail (GTK_IS_WIDGET (widget));
/* Require the widget have a signal "clicked", usually a button. */ /* Require the widget have a signal "clicked", usually a button. */
g_signal_connect_swapped (widget, "clicked", g_signal_connect_swapped (widget, "clicked",
G_CALLBACK (gimp_resource_select_button_clicked), G_CALLBACK (gimp_resource_chooser_clicked),
self); self);
} }
/** /**
* gimp_resource_select_button_get_resource: * gimp_resource_chooser_get_resource:
* @self: A #GimpResourceSelectButton * @self: A #GimpResourceChooser
* *
* Gets the currently selected resource. * Gets the currently selected resource.
* *
@ -363,20 +363,20 @@ gimp_resource_select_button_set_clickable (GimpResourceSelectButton *self,
* Since: 3.0 * Since: 3.0
*/ */
GimpResource * GimpResource *
gimp_resource_select_button_get_resource (GimpResourceSelectButton *self) gimp_resource_chooser_get_resource (GimpResourceChooser *self)
{ {
GimpResourceSelectButtonPrivate *priv; GimpResourceChooserPrivate *priv;
g_return_val_if_fail (GIMP_IS_RESOURCE_SELECT_BUTTON (self), NULL); g_return_val_if_fail (GIMP_IS_RESOURCE_CHOOSER (self), NULL);
priv = gimp_resource_select_button_get_instance_private (self); priv = gimp_resource_chooser_get_instance_private (self);
return priv->resource; return priv->resource;
} }
/** /**
* gimp_resource_select_button_set_resource: * gimp_resource_chooser_set_resource:
* @self: A #GimpResourceSelectButton * @self: A #GimpResourceChooser
* @resource: Resource to set. * @resource: Resource to set.
* *
* Sets the currently selected resource. * Sets the currently selected resource.
@ -385,15 +385,15 @@ gimp_resource_select_button_get_resource (GimpResourceSelectButton *self)
* Since: 3.0 * Since: 3.0
*/ */
void void
gimp_resource_select_button_set_resource (GimpResourceSelectButton *self, gimp_resource_chooser_set_resource (GimpResourceChooser *self,
GimpResource *resource) GimpResource *resource)
{ {
GimpResourceSelectButtonPrivate *priv; GimpResourceChooserPrivate *priv;
g_return_if_fail (GIMP_IS_RESOURCE_SELECT_BUTTON (self)); g_return_if_fail (GIMP_IS_RESOURCE_CHOOSER (self));
g_return_if_fail (resource != NULL); g_return_if_fail (resource != NULL);
priv = gimp_resource_select_button_get_instance_private (self); priv = gimp_resource_chooser_get_instance_private (self);
if (priv->callback) if (priv->callback)
{ {
@ -402,18 +402,18 @@ gimp_resource_select_button_set_resource (GimpResourceSelectButton *self,
* (since all views of the resource must be consistent.) * (since all views of the resource must be consistent.)
* That will call back, which will change our own view of the resource. * That will call back, which will change our own view of the resource.
*/ */
gimp_resource_select_button_set_remote_dialog (self, resource); gimp_resource_chooser_set_remote_dialog (self, resource);
} }
else else
{ {
/* Call our own setter. */ /* Call our own setter. */
gimp_resource_select_button_callback (resource, FALSE, self); gimp_resource_chooser_callback (resource, FALSE, self);
} }
} }
/** /**
* gimp_resource_select_button_get_label: * gimp_resource_chooser_get_label:
* @widget: A [class@ResourceSelectButton]. * @widget: A [class@ResourceChooser].
* *
* Returns the label widget. * Returns the label widget.
* *
@ -421,13 +421,13 @@ gimp_resource_select_button_set_resource (GimpResourceSelectButton *self,
* Since: 3.0 * Since: 3.0
*/ */
GtkWidget * GtkWidget *
gimp_resource_select_button_get_label (GimpResourceSelectButton *widget) gimp_resource_chooser_get_label (GimpResourceChooser *widget)
{ {
GimpResourceSelectButtonPrivate *priv; GimpResourceChooserPrivate *priv;
g_return_val_if_fail (GIMP_IS_RESOURCE_SELECT_BUTTON (widget), NULL); g_return_val_if_fail (GIMP_IS_RESOURCE_CHOOSER (widget), NULL);
priv = gimp_resource_select_button_get_instance_private (widget); priv = gimp_resource_chooser_get_instance_private (widget);
return priv->label_widget; return priv->label_widget;
} }
@ -435,17 +435,17 @@ gimp_resource_select_button_get_label (GimpResourceSelectButton *widget)
/* private functions */ /* private functions */
static void static void
gimp_resource_select_button_set_remote_dialog (GimpResourceSelectButton *self, gimp_resource_chooser_set_remote_dialog (GimpResourceChooser *self,
GimpResource *resource) GimpResource *resource)
{ {
GimpResourceSelectButtonPrivate *priv; GimpResourceChooserPrivate *priv;
GimpResourceSelectButtonClass *klass; GimpResourceChooserClass *klass;
g_return_if_fail (GIMP_IS_RESOURCE_SELECT_BUTTON (self)); g_return_if_fail (GIMP_IS_RESOURCE_CHOOSER (self));
g_return_if_fail (resource != NULL); g_return_if_fail (resource != NULL);
priv = gimp_resource_select_button_get_instance_private (self); priv = gimp_resource_chooser_get_instance_private (self);
klass = GIMP_RESOURCE_SELECT_BUTTON_GET_CLASS (self); klass = GIMP_RESOURCE_CHOOSER_GET_CLASS (self);
g_return_if_fail (klass->resource_type != G_TYPE_INVALID); g_return_if_fail (klass->resource_type != G_TYPE_INVALID);
g_return_if_fail (klass->resource_type == G_TYPE_FROM_INSTANCE (resource)); g_return_if_fail (klass->resource_type == G_TYPE_FROM_INSTANCE (resource));
@ -454,13 +454,13 @@ gimp_resource_select_button_set_remote_dialog (GimpResourceSelectButton *self,
} }
static void static void
gimp_resource_select_button_set_property (GObject *object, gimp_resource_chooser_set_property (GObject *object,
guint property_id, guint property_id,
const GValue *gvalue, const GValue *gvalue,
GParamSpec *pspec) GParamSpec *pspec)
{ {
GimpResourceSelectButton *self = GIMP_RESOURCE_SELECT_BUTTON (object); GimpResourceChooser *self = GIMP_RESOURCE_CHOOSER (object);
GimpResourceSelectButtonPrivate *priv = gimp_resource_select_button_get_instance_private (self); GimpResourceChooserPrivate *priv = gimp_resource_chooser_get_instance_private (self);
switch (property_id) switch (property_id)
{ {
@ -483,13 +483,13 @@ gimp_resource_select_button_set_property (GObject *object,
} }
static void static void
gimp_resource_select_button_get_property (GObject *object, gimp_resource_chooser_get_property (GObject *object,
guint property_id, guint property_id,
GValue *value, GValue *value,
GParamSpec *pspec) GParamSpec *pspec)
{ {
GimpResourceSelectButton *self = GIMP_RESOURCE_SELECT_BUTTON (object); GimpResourceChooser *self = GIMP_RESOURCE_CHOOSER (object);
GimpResourceSelectButtonPrivate *priv = gimp_resource_select_button_get_instance_private (self); GimpResourceChooserPrivate *priv = gimp_resource_chooser_get_instance_private (self);
switch (property_id) switch (property_id)
{ {
@ -521,16 +521,16 @@ gimp_resource_select_button_get_property (GObject *object,
* Update the view, since model changed. * Update the view, since model changed.
*/ */
static void static void
gimp_resource_select_button_callback (GimpResource *resource, gimp_resource_chooser_callback (GimpResource *resource,
gboolean dialog_closing, gboolean dialog_closing,
gpointer user_data) gpointer user_data)
{ {
GimpResourceSelectButton *self = GIMP_RESOURCE_SELECT_BUTTON (user_data); GimpResourceChooser *self = GIMP_RESOURCE_CHOOSER (user_data);
GimpResourceSelectButtonPrivate *priv = gimp_resource_select_button_get_instance_private (self); GimpResourceChooserPrivate *priv = gimp_resource_chooser_get_instance_private (self);
priv->resource = resource; priv->resource = resource;
GIMP_RESOURCE_SELECT_BUTTON_GET_CLASS (self)->draw_interior (self); GIMP_RESOURCE_CHOOSER_GET_CLASS (self)->draw_interior (self);
if (dialog_closing) if (dialog_closing)
g_clear_pointer (&priv->callback, g_free); g_clear_pointer (&priv->callback, g_free);
@ -540,15 +540,15 @@ gimp_resource_select_button_callback (GimpResource *resource,
} }
static void static void
gimp_resource_select_button_clicked (GimpResourceSelectButton *self) gimp_resource_chooser_clicked (GimpResourceChooser *self)
{ {
GimpResourceSelectButtonPrivate *priv = gimp_resource_select_button_get_instance_private (self); GimpResourceChooserPrivate *priv = gimp_resource_chooser_get_instance_private (self);
GimpResourceSelectButtonClass *klass = GIMP_RESOURCE_SELECT_BUTTON_GET_CLASS (self); GimpResourceChooserClass *klass = GIMP_RESOURCE_CHOOSER_GET_CLASS (self);
if (priv->callback) if (priv->callback)
{ {
/* Popup already created. Calling setter raises the popup. */ /* Popup already created. Calling setter raises the popup. */
gimp_resource_select_button_set_remote_dialog (self, priv->resource); gimp_resource_chooser_set_remote_dialog (self, priv->resource);
} }
else else
{ {
@ -562,10 +562,10 @@ gimp_resource_select_button_clicked (GimpResourceSelectButton *self)
handle, handle,
priv->resource, priv->resource,
klass->resource_type, klass->resource_type,
gimp_resource_select_button_callback, gimp_resource_chooser_callback,
self, self,
NULL)); NULL));
gimp_resource_select_button_set_remote_dialog (self, priv->resource); gimp_resource_chooser_set_remote_dialog (self, priv->resource);
} }
} }
@ -573,20 +573,20 @@ gimp_resource_select_button_clicked (GimpResourceSelectButton *self)
/* Drag methods. */ /* Drag methods. */
static void static void
gimp_resource_select_drag_data_received (GimpResourceSelectButton *self, gimp_resource_select_drag_data_received (GimpResourceChooser *self,
GdkDragContext *context, GdkDragContext *context,
gint x, gint x,
gint y, gint y,
GtkSelectionData *selection, GtkSelectionData *selection,
guint info, guint info,
guint time) guint time)
{ {
gint length = gtk_selection_data_get_length (selection); gint length = gtk_selection_data_get_length (selection);
gchar *str; gchar *str;
GimpResourceSelectButtonClass *klass; GimpResourceChooserClass *klass;
klass = GIMP_RESOURCE_SELECT_BUTTON_GET_CLASS (self); klass = GIMP_RESOURCE_CHOOSER_GET_CLASS (self);
/* Require class resource_type was initialized. */ /* Require class resource_type was initialized. */
g_assert (klass->resource_type != 0); g_assert (klass->resource_type != 0);
@ -614,7 +614,7 @@ gimp_resource_select_drag_data_received (GimpResourceSelectButton *self,
GimpResource *resource; GimpResource *resource;
resource = gimp_resource_get_by_name (klass->resource_type, name); resource = gimp_resource_get_by_name (klass->resource_type, name);
gimp_resource_select_button_set_resource (self, resource); gimp_resource_chooser_set_resource (self, resource);
} }
} }

View file

@ -0,0 +1,65 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* 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
* <https://www.gnu.org/licenses/>.
*/
#if !defined (__GIMP_UI_H_INSIDE__) && !defined (GIMP_COMPILATION)
#error "Only <libgimp/gimpui.h> can be included directly."
#endif
#ifndef __GIMP_RESOURCE_CHOOSER_H__
#define __GIMP_RESOURCE_CHOOSER_H__
G_BEGIN_DECLS
#define GIMP_TYPE_RESOURCE_CHOOSER (gimp_resource_chooser_get_type ())
G_DECLARE_DERIVABLE_TYPE (GimpResourceChooser, gimp_resource_chooser, GIMP, RESOURCE_CHOOSER, GtkBox)
struct _GimpResourceChooserClass
{
GtkBoxClass parent_class;
/* Signals */
void (* resource_set) (GimpResourceChooser *chooser,
GimpResource *resource,
gboolean dialog_closing);
/* Abstract methods and class variables */
void (*draw_interior) (GimpResourceChooser *chooser);
GType resource_type;
/* Padding for future expansion */
gpointer padding[8];
};
GimpResource * gimp_resource_chooser_get_resource (GimpResourceChooser *chooser);
void gimp_resource_chooser_set_resource (GimpResourceChooser *chooser,
GimpResource *resource);
GtkWidget * gimp_resource_chooser_get_label (GimpResourceChooser *widget);
/* API from below, used by subclasses e.g. GimpBrushChooser */
void gimp_resource_chooser_set_drag_target (GimpResourceChooser *chooser,
GtkWidget *drag_region_widget,
const GtkTargetEntry *drag_target);
void gimp_resource_chooser_set_clickable (GimpResourceChooser *chooser,
GtkWidget *widget);
G_END_DECLS
#endif /* __GIMP_RESOURCE_CHOOSER_H__ */

View file

@ -1,65 +0,0 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* 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
* <https://www.gnu.org/licenses/>.
*/
#if !defined (__GIMP_UI_H_INSIDE__) && !defined (GIMP_COMPILATION)
#error "Only <libgimp/gimpui.h> can be included directly."
#endif
#ifndef __GIMP_RESOURCE_SELECT_BUTTON_H__
#define __GIMP_RESOURCE_SELECT_BUTTON_H__
G_BEGIN_DECLS
#define GIMP_TYPE_RESOURCE_SELECT_BUTTON (gimp_resource_select_button_get_type ())
G_DECLARE_DERIVABLE_TYPE (GimpResourceSelectButton, gimp_resource_select_button, GIMP, RESOURCE_SELECT_BUTTON, GtkBox)
struct _GimpResourceSelectButtonClass
{
GtkBoxClass parent_class;
/* Signals */
void (* resource_set) (GimpResourceSelectButton *self,
GimpResource *resource,
gboolean dialog_closing);
/* Abstract methods and class variables */
void (*draw_interior) (GimpResourceSelectButton *self);
GType resource_type;
/* Padding for future expansion */
gpointer padding[8];
};
GimpResource * gimp_resource_select_button_get_resource (GimpResourceSelectButton *self);
void gimp_resource_select_button_set_resource (GimpResourceSelectButton *self,
GimpResource *resource);
GtkWidget * gimp_resource_select_button_get_label (GimpResourceSelectButton *widget);
/* API from below, used by subclasses e.g. GimpBrushSelectButton */
void gimp_resource_select_button_set_drag_target (GimpResourceSelectButton *self,
GtkWidget *drag_region_widget,
const GtkTargetEntry *drag_target);
void gimp_resource_select_button_set_clickable (GimpResourceSelectButton *self,
GtkWidget *widget);
G_END_DECLS
#endif /* __GIMP_RESOURCE_SELECT_BUTTON_H__ */

View file

@ -1,8 +1,8 @@
EXPORTS EXPORTS
gimp_aspect_preview_get_type gimp_aspect_preview_get_type
gimp_aspect_preview_new_from_drawable gimp_aspect_preview_new_from_drawable
gimp_brush_select_button_get_type gimp_brush_chooser_get_type
gimp_brush_select_button_new gimp_brush_chooser_new
gimp_channel_combo_box_get_type gimp_channel_combo_box_get_type
gimp_channel_combo_box_new gimp_channel_combo_box_new
gimp_drawable_combo_box_get_type gimp_drawable_combo_box_get_type
@ -13,18 +13,18 @@ EXPORTS
gimp_export_dialog_get_content_area gimp_export_dialog_get_content_area
gimp_export_dialog_new gimp_export_dialog_new
gimp_export_image gimp_export_image
gimp_font_select_button_get_type gimp_font_chooser_get_type
gimp_font_select_button_new gimp_font_chooser_new
gimp_gradient_select_button_get_type gimp_gradient_chooser_get_type
gimp_gradient_select_button_new gimp_gradient_chooser_new
gimp_image_combo_box_get_type gimp_image_combo_box_get_type
gimp_image_combo_box_new gimp_image_combo_box_new
gimp_layer_combo_box_get_type gimp_layer_combo_box_get_type
gimp_layer_combo_box_new gimp_layer_combo_box_new
gimp_palette_select_button_get_type gimp_palette_chooser_get_type
gimp_palette_select_button_new gimp_palette_chooser_new
gimp_pattern_select_button_get_type gimp_pattern_chooser_get_type
gimp_pattern_select_button_new gimp_pattern_chooser_new
gimp_proc_browser_dialog_get_selected gimp_proc_browser_dialog_get_selected
gimp_proc_browser_dialog_get_type gimp_proc_browser_dialog_get_type
gimp_proc_browser_dialog_new gimp_proc_browser_dialog_new
@ -63,12 +63,12 @@ EXPORTS
gimp_prop_gradient_chooser_new gimp_prop_gradient_chooser_new
gimp_prop_palette_chooser_new gimp_prop_palette_chooser_new
gimp_prop_pattern_chooser_new gimp_prop_pattern_chooser_new
gimp_resource_select_button_get_label gimp_resource_chooser_get_label
gimp_resource_select_button_get_resource gimp_resource_chooser_get_resource
gimp_resource_select_button_get_type gimp_resource_chooser_get_type
gimp_resource_select_button_set_clickable gimp_resource_chooser_set_clickable
gimp_resource_select_button_set_drag_target gimp_resource_chooser_set_drag_target
gimp_resource_select_button_set_resource gimp_resource_chooser_set_resource
gimp_save_procedure_dialog_add_metadata gimp_save_procedure_dialog_add_metadata
gimp_save_procedure_dialog_get_type gimp_save_procedure_dialog_get_type
gimp_save_procedure_dialog_new gimp_save_procedure_dialog_new

View file

@ -30,16 +30,16 @@
#include <libgimp/gimpuitypes.h> #include <libgimp/gimpuitypes.h>
#include <libgimp/gimpaspectpreview.h> #include <libgimp/gimpaspectpreview.h>
#include <libgimp/gimpbrushselectbutton.h> #include <libgimp/gimpbrushchooser.h>
#include <libgimp/gimpdrawablepreview.h> #include <libgimp/gimpdrawablepreview.h>
#include <libgimp/gimpexport.h> #include <libgimp/gimpexport.h>
#include <libgimp/gimpresourceselectbutton.h> #include <libgimp/gimpresourcechooser.h>
#include <libgimp/gimpfontselectbutton.h> #include <libgimp/gimpfontchooser.h>
#include <libgimp/gimpgradientselectbutton.h> #include <libgimp/gimpgradientchooser.h>
#include <libgimp/gimpimagecombobox.h> #include <libgimp/gimpimagecombobox.h>
#include <libgimp/gimpitemcombobox.h> #include <libgimp/gimpitemcombobox.h>
#include <libgimp/gimppaletteselectbutton.h> #include <libgimp/gimppalettechooser.h>
#include <libgimp/gimppatternselectbutton.h> #include <libgimp/gimppatternchooser.h>
#include <libgimp/gimpprocbrowserdialog.h> #include <libgimp/gimpprocbrowserdialog.h>
#include <libgimp/gimpproceduredialog.h> #include <libgimp/gimpproceduredialog.h>
#include <libgimp/gimpprocview.h> #include <libgimp/gimpprocview.h>

View file

@ -43,12 +43,12 @@ typedef struct _GimpLayerComboBox GimpLayerComboBox;
typedef struct _GimpVectorsComboBox GimpVectorsComboBox; typedef struct _GimpVectorsComboBox GimpVectorsComboBox;
typedef struct _GimpImageComboBox GimpImageComboBox; typedef struct _GimpImageComboBox GimpImageComboBox;
typedef struct _GimpSelectButton GimpSelectButton; typedef struct _GimpResourceChooser GimpResourceChooser;
typedef struct _GimpBrushSelectButton GimpBrushSelectButton; typedef struct _GimpBrushChooser GimpBrushChooser;
typedef struct _GimpFontSelectButton GimpFontSelectButton; typedef struct _GimpFontChooser GimpFontChooser;
typedef struct _GimpGradientSelectButton GimpGradientSelectButton; typedef struct _GimpGradientChooser GimpGradientChooser;
typedef struct _GimpPaletteSelectButton GimpPaletteSelectButton; typedef struct _GimpPaletteChooser GimpPaletteChooser;
typedef struct _GimpPatternSelectButton GimpPatternSelectButton; typedef struct _GimpPatternChooser GimpPatternChooser;
G_END_DECLS G_END_DECLS

View file

@ -268,21 +268,21 @@ libgimp_headers = [
libgimpui_sources_introspectable = [ libgimpui_sources_introspectable = [
'gimpaspectpreview.c', 'gimpaspectpreview.c',
'gimpbrushselectbutton.c', 'gimpbrushchooser.c',
'gimpdrawablepreview.c', 'gimpdrawablepreview.c',
'gimpexport.c', 'gimpexport.c',
'gimpfontselectbutton.c', 'gimpfontchooser.c',
'gimpgradientselectbutton.c', 'gimpgradientchooser.c',
'gimpimagecombobox.c', 'gimpimagecombobox.c',
'gimpitemcombobox.c', 'gimpitemcombobox.c',
'gimppaletteselectbutton.c', 'gimppalettechooser.c',
'gimppatternselectbutton.c', 'gimppatternchooser.c',
'gimpprocbrowserdialog.c', 'gimpprocbrowserdialog.c',
'gimpproceduredialog.c', 'gimpproceduredialog.c',
'gimpprocview.c', 'gimpprocview.c',
'gimpprogressbar.c', 'gimpprogressbar.c',
'gimppropwidgets.c', 'gimppropwidgets.c',
'gimpresourceselectbutton.c', 'gimpresourcechooser.c',
'gimpsaveproceduredialog.c', 'gimpsaveproceduredialog.c',
'gimpui.c', 'gimpui.c',
'gimpzoompreview.c', 'gimpzoompreview.c',
@ -300,21 +300,21 @@ libgimpui_headers_introspectable = [
# Other headers # Other headers
'gimpaspectpreview.h', 'gimpaspectpreview.h',
'gimpbrushselectbutton.h', 'gimpbrushchooser.h',
'gimpdrawablepreview.h', 'gimpdrawablepreview.h',
'gimpexport.h', 'gimpexport.h',
'gimpfontselectbutton.h', 'gimpfontchooser.h',
'gimpgradientselectbutton.h', 'gimpgradientchooser.h',
'gimpimagecombobox.h', 'gimpimagecombobox.h',
'gimpitemcombobox.h', 'gimpitemcombobox.h',
'gimppaletteselectbutton.h', 'gimppalettechooser.h',
'gimppatternselectbutton.h', 'gimppatternchooser.h',
'gimpprocbrowserdialog.h', 'gimpprocbrowserdialog.h',
'gimpproceduredialog.h', 'gimpproceduredialog.h',
'gimpprocview.h', 'gimpprocview.h',
'gimpprogressbar.h', 'gimpprogressbar.h',
'gimppropwidgets.h', 'gimppropwidgets.h',
'gimpresourceselectbutton.h', 'gimpresourcechooser.h',
'gimpsaveproceduredialog.h', 'gimpsaveproceduredialog.h',
'gimpzoompreview.h', 'gimpzoompreview.h',
] ]

View file

@ -1159,8 +1159,8 @@ explorer_dialog (void)
&n_gradient_samples, &n_gradient_samples,
&gradient_samples); &gradient_samples);
gradient_button = gimp_gradient_select_button_new (_("FractalExplorer Gradient"), gradient_button = gimp_gradient_chooser_new (_("FractalExplorer Gradient"),
NULL, GIMP_RESOURCE (gradient)); NULL, GIMP_RESOURCE (gradient));
g_signal_connect (gradient_button, "resource-set", g_signal_connect (gradient_button, "resource-set",
G_CALLBACK (explorer_gradient_select_callback), NULL); G_CALLBACK (explorer_gradient_select_callback), NULL);

View file

@ -507,8 +507,8 @@ gfig_dialog (GimpGfig *gfig)
/* brush selector in Stroke frame */ /* brush selector in Stroke frame */
gfig_context->brush_select gfig_context->brush_select
= gimp_brush_select_button_new ("Brush", "Brush", = gimp_brush_chooser_new ("Brush", "Brush",
GIMP_RESOURCE (gfig_context->default_style.brush)); GIMP_RESOURCE (gfig_context->default_style.brush));
g_signal_connect (gfig_context->brush_select, "resource-set", g_signal_connect (gfig_context->brush_select, "resource-set",
G_CALLBACK (gfig_brush_changed_callback), NULL); G_CALLBACK (gfig_brush_changed_callback), NULL);
gtk_box_pack_start (GTK_BOX (vbox), gfig_context->brush_select, gtk_box_pack_start (GTK_BOX (vbox), gfig_context->brush_select,
@ -573,8 +573,8 @@ gfig_dialog (GimpGfig *gfig)
/* A page for the pattern selector */ /* A page for the pattern selector */
gfig_context->pattern_select gfig_context->pattern_select
= gimp_pattern_select_button_new ("Pattern", "Pattern", = gimp_pattern_chooser_new ("Pattern", "Pattern",
GIMP_RESOURCE (gfig_context->default_style.pattern)); GIMP_RESOURCE (gfig_context->default_style.pattern));
g_signal_connect (gfig_context->pattern_select, "resource-set", g_signal_connect (gfig_context->pattern_select, "resource-set",
G_CALLBACK (gfig_pattern_changed_callback), NULL); G_CALLBACK (gfig_pattern_changed_callback), NULL);
gtk_widget_show (gfig_context->pattern_select); gtk_widget_show (gfig_context->pattern_select);
@ -583,8 +583,8 @@ gfig_dialog (GimpGfig *gfig)
/* A page for the gradient selector */ /* A page for the gradient selector */
gfig_context->gradient_select gfig_context->gradient_select
= gimp_gradient_select_button_new ("Gradient", "Gradient", = gimp_gradient_chooser_new ("Gradient", "Gradient",
GIMP_RESOURCE (gfig_context->default_style.gradient)); GIMP_RESOURCE (gfig_context->default_style.gradient));
g_signal_connect (gfig_context->gradient_select, "resource-set", g_signal_connect (gfig_context->gradient_select, "resource-set",
G_CALLBACK (gfig_gradient_changed_callback), NULL); G_CALLBACK (gfig_gradient_changed_callback), NULL);
gtk_widget_show (gfig_context->gradient_select); gtk_widget_show (gfig_context->gradient_select);

View file

@ -697,14 +697,14 @@ gfig_style_set_context_from_style (Style *style)
gimp_context_set_brush_default_size (); gimp_context_set_brush_default_size ();
gimp_resource_select_button_set_resource (GIMP_RESOURCE_SELECT_BUTTON (gfig_context->brush_select), gimp_resource_chooser_set_resource (GIMP_RESOURCE_CHOOSER (gfig_context->brush_select),
GIMP_RESOURCE (style->brush)); GIMP_RESOURCE (style->brush));
gimp_resource_select_button_set_resource (GIMP_RESOURCE_SELECT_BUTTON (gfig_context->pattern_select), gimp_resource_chooser_set_resource (GIMP_RESOURCE_CHOOSER (gfig_context->pattern_select),
GIMP_RESOURCE (style->pattern)); GIMP_RESOURCE (style->pattern));
gimp_resource_select_button_set_resource (GIMP_RESOURCE_SELECT_BUTTON (gfig_context->gradient_select), gimp_resource_chooser_set_resource (GIMP_RESOURCE_CHOOSER (gfig_context->gradient_select),
GIMP_RESOURCE (style->gradient)); GIMP_RESOURCE (style->gradient));
set_context_bdesc (style->brush); set_context_bdesc (style->brush);

View file

@ -606,23 +606,23 @@ script_fu_resource_widget (const gchar *title,
if (g_type_is_a (resource_type, GIMP_TYPE_FONT)) if (g_type_is_a (resource_type, GIMP_TYPE_FONT))
{ {
result_widget = gimp_font_select_button_new (title, title, resource); result_widget = gimp_font_chooser_new (title, title, resource);
} }
else if (g_type_is_a (resource_type, GIMP_TYPE_BRUSH)) else if (g_type_is_a (resource_type, GIMP_TYPE_BRUSH))
{ {
result_widget = gimp_brush_select_button_new (title, title, resource); result_widget = gimp_brush_chooser_new (title, title, resource);
} }
else if (g_type_is_a (resource_type, GIMP_TYPE_GRADIENT)) else if (g_type_is_a (resource_type, GIMP_TYPE_GRADIENT))
{ {
result_widget = gimp_gradient_select_button_new (title, title, resource); result_widget = gimp_gradient_chooser_new (title, title, resource);
} }
else if (g_type_is_a (resource_type, GIMP_TYPE_PALETTE)) else if (g_type_is_a (resource_type, GIMP_TYPE_PALETTE))
{ {
result_widget = gimp_palette_select_button_new (title, title, resource); result_widget = gimp_palette_chooser_new (title, title, resource);
} }
else if (g_type_is_a (resource_type, GIMP_TYPE_PATTERN)) else if (g_type_is_a (resource_type, GIMP_TYPE_PATTERN))
{ {
result_widget = gimp_pattern_select_button_new (title, title, resource); result_widget = gimp_pattern_chooser_new (title, title, resource);
} }
else else
{ {
@ -961,8 +961,8 @@ script_fu_reset (SFScript *script)
case SF_PATTERN: case SF_PATTERN:
case SF_GRADIENT: case SF_GRADIENT:
case SF_BRUSH: case SF_BRUSH:
gimp_resource_select_button_set_resource (GIMP_RESOURCE_SELECT_BUTTON (widget), gimp_resource_chooser_set_resource (GIMP_RESOURCE_CHOOSER (widget),
NULL); NULL);
break; break;
case SF_OPTION: case SF_OPTION: