made a real object (GtkDialog subclass) out of it. The API will change

2001-09-20  Michael Natterer  <mitch@gimp.org>

	* libgimpwidgets/gimpdialog.[ch]: made a real object (GtkDialog
	subclass) out of it. The API will change soon too.

	* libgimpwidgets/gimpwidgetstypes.h: added GimpDialog typedef.

	* libgimpwidgets/gimpbutton.[ch]
	* libgimpwidgets/gimpchainbutton.[ch]
	* libgimpwidgets/gimpcolorarea.[ch]
	* libgimpwidgets/gimpcolorbutton.[ch]
	* libgimpwidgets/gimpfileselection.[ch]
	* libgimpwidgets/gimpoffsetarea.[ch]
	* libgimpwidgets/gimppatheditor.[ch]
	* libgimpwidgets/gimppixmap.c
	* libgimpwidgets/gimpsizeentry.c
	* libgimpwidgets/gimpunitmenu.c: removed GtkType stuff and use
	GType in all get_type() functions. Some random GObject porting.

	* app/gui/info-dialog.c
	* app/gui/info-window.c
	* app/tools/gimpcolorpickertool.c
	* app/tools/gimpcroptool.c
	* app/tools/gimpmeasuretool.c
	* app/tools/gimptransformtool.c: changed accordingly.
This commit is contained in:
Michael Natterer 2001-09-21 10:47:19 +00:00 committed by Michael Natterer
parent 58afaec679
commit cb474a0845
34 changed files with 541 additions and 402 deletions

View File

@ -1,3 +1,29 @@
2001-09-20 Michael Natterer <mitch@gimp.org>
* libgimpwidgets/gimpdialog.[ch]: made a real object (GtkDialog
subclass) out of it. The API will change soon too.
* libgimpwidgets/gimpwidgetstypes.h: added GimpDialog typedef.
* libgimpwidgets/gimpbutton.[ch]
* libgimpwidgets/gimpchainbutton.[ch]
* libgimpwidgets/gimpcolorarea.[ch]
* libgimpwidgets/gimpcolorbutton.[ch]
* libgimpwidgets/gimpfileselection.[ch]
* libgimpwidgets/gimpoffsetarea.[ch]
* libgimpwidgets/gimppatheditor.[ch]
* libgimpwidgets/gimppixmap.c
* libgimpwidgets/gimpsizeentry.c
* libgimpwidgets/gimpunitmenu.c: removed GtkType stuff and use
GType in all get_type() functions. Some random GObject porting.
* app/gui/info-dialog.c
* app/gui/info-window.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpcroptool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimptransformtool.c: changed accordingly.
2001-09-20 Sven Neumann <sven@gimp.org> 2001-09-20 Sven Neumann <sven@gimp.org>
* app/gdisplay.c: fixed resize of cursor position label that I broke * app/gdisplay.c: fixed resize of cursor position label that I broke

View File

@ -496,7 +496,7 @@ gimp_transform_tool_button_press (GimpTool *tool,
gimp_context_get_tool (gimp_get_user_context (gdisp->gimage->gimp))->tool_type; gimp_context_get_tool (gimp_get_user_context (gdisp->gimage->gimp))->tool_type;
gimp_dialog_create_action_area gimp_dialog_create_action_area
(GTK_DIALOG (transform_info->shell), (GIMP_DIALOG (transform_info->shell),
/* FIXME: this does not belong here */ /* FIXME: this does not belong here */
(tool_type == GIMP_TYPE_ROTATE_TOOL) ? _("Rotate") : (tool_type == GIMP_TYPE_ROTATE_TOOL) ? _("Rotate") :

View File

@ -496,7 +496,7 @@ gimp_transform_tool_button_press (GimpTool *tool,
gimp_context_get_tool (gimp_get_user_context (gdisp->gimage->gimp))->tool_type; gimp_context_get_tool (gimp_get_user_context (gdisp->gimage->gimp))->tool_type;
gimp_dialog_create_action_area gimp_dialog_create_action_area
(GTK_DIALOG (transform_info->shell), (GIMP_DIALOG (transform_info->shell),
/* FIXME: this does not belong here */ /* FIXME: this does not belong here */
(tool_type == GIMP_TYPE_ROTATE_TOOL) ? _("Rotate") : (tool_type == GIMP_TYPE_ROTATE_TOOL) ? _("Rotate") :

View File

@ -350,7 +350,7 @@ gimp_color_picker_tool_button_press (GimpTool *tool,
/* create the action area */ /* create the action area */
gimp_dialog_create_action_area gimp_dialog_create_action_area
(GTK_DIALOG (gimp_color_picker_tool_info->shell), (GIMP_DIALOG (gimp_color_picker_tool_info->shell),
GTK_STOCK_CLOSE, gimp_color_picker_tool_info_window_close_callback, GTK_STOCK_CLOSE, gimp_color_picker_tool_info_window_close_callback,
gimp_color_picker_tool_info, NULL, NULL, TRUE, FALSE, gimp_color_picker_tool_info, NULL, NULL, TRUE, FALSE,

View File

@ -173,7 +173,7 @@ info_dialog_new_extended (gchar *title,
idialog->field_list = NULL; idialog->field_list = NULL;
idialog->nfields = 0; idialog->nfields = 0;
shell = gtk_dialog_new (); shell = g_object_new (GIMP_TYPE_DIALOG, NULL);
gtk_window_set_wmclass (GTK_WINDOW (shell), "info_dialog", "Gimp"); gtk_window_set_wmclass (GTK_WINDOW (shell), "info_dialog", "Gimp");
gtk_window_set_title (GTK_WINDOW (shell), title); gtk_window_set_title (GTK_WINDOW (shell), title);

View File

@ -331,7 +331,7 @@ info_window_create (GDisplay *gdisp)
g_free (title); g_free (title);
/* create the action area */ /* create the action area */
gimp_dialog_create_action_area (GTK_DIALOG (info_win->shell), gimp_dialog_create_action_area (GIMP_DIALOG (info_win->shell),
GTK_STOCK_CLOSE, info_window_close_callback, GTK_STOCK_CLOSE, info_window_close_callback,
info_win, NULL, NULL, TRUE, FALSE, info_win, NULL, NULL, TRUE, FALSE,

View File

@ -173,7 +173,7 @@ info_dialog_new_extended (gchar *title,
idialog->field_list = NULL; idialog->field_list = NULL;
idialog->nfields = 0; idialog->nfields = 0;
shell = gtk_dialog_new (); shell = g_object_new (GIMP_TYPE_DIALOG, NULL);
gtk_window_set_wmclass (GTK_WINDOW (shell), "info_dialog", "Gimp"); gtk_window_set_wmclass (GTK_WINDOW (shell), "info_dialog", "Gimp");
gtk_window_set_title (GTK_WINDOW (shell), title); gtk_window_set_title (GTK_WINDOW (shell), title);

View File

@ -331,7 +331,7 @@ info_window_create (GDisplay *gdisp)
g_free (title); g_free (title);
/* create the action area */ /* create the action area */
gimp_dialog_create_action_area (GTK_DIALOG (info_win->shell), gimp_dialog_create_action_area (GIMP_DIALOG (info_win->shell),
GTK_STOCK_CLOSE, info_window_close_callback, GTK_STOCK_CLOSE, info_window_close_callback,
info_win, NULL, NULL, TRUE, FALSE, info_win, NULL, NULL, TRUE, FALSE,

View File

@ -350,7 +350,7 @@ gimp_color_picker_tool_button_press (GimpTool *tool,
/* create the action area */ /* create the action area */
gimp_dialog_create_action_area gimp_dialog_create_action_area
(GTK_DIALOG (gimp_color_picker_tool_info->shell), (GIMP_DIALOG (gimp_color_picker_tool_info->shell),
GTK_STOCK_CLOSE, gimp_color_picker_tool_info_window_close_callback, GTK_STOCK_CLOSE, gimp_color_picker_tool_info_window_close_callback,
gimp_color_picker_tool_info, NULL, NULL, TRUE, FALSE, gimp_color_picker_tool_info, NULL, NULL, TRUE, FALSE,

View File

@ -877,7 +877,7 @@ crop_info_create (GimpTool *tool)
tool_manager_help_func, NULL); tool_manager_help_func, NULL);
/* create the action area */ /* create the action area */
gimp_dialog_create_action_area (GTK_DIALOG (crop_info->shell), gimp_dialog_create_action_area (GIMP_DIALOG (crop_info->shell),
_("Crop"), crop_crop_callback, _("Crop"), crop_crop_callback,
NULL, NULL, NULL, TRUE, FALSE, NULL, NULL, NULL, TRUE, FALSE,

View File

@ -381,7 +381,7 @@ gimp_measure_tool_button_press (GimpTool *tool,
info_dialog_add_label (measure_tool_info, _("Distance:"), distance_buf); info_dialog_add_label (measure_tool_info, _("Distance:"), distance_buf);
info_dialog_add_label (measure_tool_info, _("Angle:"), angle_buf); info_dialog_add_label (measure_tool_info, _("Angle:"), angle_buf);
gimp_dialog_create_action_area (GTK_DIALOG (measure_tool_info->shell), gimp_dialog_create_action_area (GIMP_DIALOG (measure_tool_info->shell),
GTK_STOCK_CLOSE, GTK_STOCK_CLOSE,
measure_tool_info_window_close_callback, measure_tool_info_window_close_callback,

View File

@ -496,7 +496,7 @@ gimp_transform_tool_button_press (GimpTool *tool,
gimp_context_get_tool (gimp_get_user_context (gdisp->gimage->gimp))->tool_type; gimp_context_get_tool (gimp_get_user_context (gdisp->gimage->gimp))->tool_type;
gimp_dialog_create_action_area gimp_dialog_create_action_area
(GTK_DIALOG (transform_info->shell), (GIMP_DIALOG (transform_info->shell),
/* FIXME: this does not belong here */ /* FIXME: this does not belong here */
(tool_type == GIMP_TYPE_ROTATE_TOOL) ? _("Rotate") : (tool_type == GIMP_TYPE_ROTATE_TOOL) ? _("Rotate") :

View File

@ -57,19 +57,22 @@ gimp_button_get_type (void)
if (! button_type) if (! button_type)
{ {
GtkTypeInfo button_info = static const GTypeInfo button_info =
{ {
"GimpButton", sizeof (GimpButtonClass),
sizeof (GimpButton), (GBaseInitFunc) NULL,
sizeof (GimpButtonClass), (GBaseFinalizeFunc) NULL,
(GtkClassInitFunc) gimp_button_class_init, (GClassInitFunc) gimp_button_class_init,
(GtkObjectInitFunc) gimp_button_init, NULL, /* class_finalize */
/* reserved_1 */ NULL, NULL, /* class_data */
/* reserved_2 */ NULL, sizeof (GimpButton),
(GtkClassInitFunc) NULL 0, /* n_preallocs */
(GInstanceInitFunc) gimp_button_init,
}; };
button_type = gtk_type_unique (GTK_TYPE_BUTTON, &button_info); button_type = g_type_register_static (GTK_TYPE_BUTTON,
"GimpButton",
&button_info, 0);
} }
return button_type; return button_type;
@ -81,8 +84,8 @@ gimp_button_class_init (GimpButtonClass *klass)
GObjectClass *object_class; GObjectClass *object_class;
GtkWidgetClass *widget_class; GtkWidgetClass *widget_class;
object_class = (GObjectClass *) klass; object_class = G_OBJECT_CLASS (klass);
widget_class = (GtkWidgetClass *) klass; widget_class = GTK_WIDGET_CLASS (klass);
parent_class = g_type_class_peek_parent (klass); parent_class = g_type_class_peek_parent (klass);

View File

@ -23,6 +23,10 @@
#ifndef __GIMP_BUTTON_H__ #ifndef __GIMP_BUTTON_H__
#define __GIMP_BUTTON_H__ #define __GIMP_BUTTON_H__
#include <gtk/gtkbutton.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
@ -35,6 +39,7 @@ extern "C" {
#define GIMP_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_BUTTON, GimpButtonClass)) #define GIMP_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_BUTTON, GimpButtonClass))
#define GIMP_IS_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_BUTTON)) #define GIMP_IS_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_BUTTON))
#define GIMP_IS_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BUTTON)) #define GIMP_IS_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BUTTON))
#define GIMP_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_BUTTON, GimpButtonClass))
typedef struct _GimpButtonClass GimpButtonClass; typedef struct _GimpButtonClass GimpButtonClass;

View File

@ -83,19 +83,22 @@ gimp_chain_button_get_type (void)
if (! gcb_type) if (! gcb_type)
{ {
GtkTypeInfo gcb_info = static const GTypeInfo gcb_info =
{ {
"GimpChainButton", sizeof (GimpChainButtonClass),
sizeof (GimpChainButton), (GBaseInitFunc) NULL,
sizeof (GimpChainButtonClass), (GBaseFinalizeFunc) NULL,
(GtkClassInitFunc) gimp_chain_button_class_init, (GClassInitFunc) gimp_chain_button_class_init,
(GtkObjectInitFunc) gimp_chain_button_init, NULL, /* class_finalize */
/* reserved_1 */ NULL, NULL, /* class_data */
/* reserved_2 */ NULL, sizeof (GimpChainButton),
(GtkClassInitFunc) NULL 0, /* n_preallocs */
(GInstanceInitFunc) gimp_chain_button_init,
}; };
gcb_type = gtk_type_unique (gtk_table_get_type (), &gcb_info); gcb_type = g_type_register_static (GTK_TYPE_TABLE,
"GimpChainButton",
&gcb_info, 0);
} }
return gcb_type; return gcb_type;
@ -107,8 +110,8 @@ gimp_chain_button_class_init (GimpChainButtonClass *klass)
GtkObjectClass *object_class; GtkObjectClass *object_class;
GtkWidgetClass *widget_class; GtkWidgetClass *widget_class;
object_class = (GtkObjectClass *) klass; object_class = GTK_OBJECT_CLASS (klass);
widget_class = (GtkWidgetClass *) klass; widget_class = GTK_WIDGET_CLASS (klass);
parent_class = g_type_class_peek_parent (klass); parent_class = g_type_class_peek_parent (klass);
@ -148,7 +151,7 @@ gimp_chain_button_init (GimpChainButton *gcb)
gtk_pixmap_set_build_insensitive (GTK_PIXMAP (gcb->pixmap), TRUE); gtk_pixmap_set_build_insensitive (GTK_PIXMAP (gcb->pixmap), TRUE);
g_signal_connect (G_OBJECT(gcb->button), "clicked", g_signal_connect (G_OBJECT (gcb->button), "clicked",
G_CALLBACK (gimp_chain_button_clicked_callback), G_CALLBACK (gimp_chain_button_clicked_callback),
gcb); gcb);
g_signal_connect (G_OBJECT (gcb->line1), "expose_event", g_signal_connect (G_OBJECT (gcb->line1), "expose_event",

View File

@ -41,6 +41,7 @@ extern "C" {
#define GIMP_CHAIN_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_CHAIN_BUTTON, GimpChainButtonClass)) #define GIMP_CHAIN_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_CHAIN_BUTTON, GimpChainButtonClass))
#define GIMP_IS_CHAIN_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_CHAIN_BUTTON)) #define GIMP_IS_CHAIN_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_CHAIN_BUTTON))
#define GIMP_IS_CHAIN_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CHAIN_BUTTON)) #define GIMP_IS_CHAIN_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CHAIN_BUTTON))
#define GIMP_CHAIN_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_CHAIN_BUTTON, GimpChainButtonClass))
typedef struct _GimpChainButtonClass GimpChainButtonClass; typedef struct _GimpChainButtonClass GimpChainButtonClass;
@ -56,7 +57,7 @@ typedef enum
struct _GimpChainButton struct _GimpChainButton
{ {
GtkTable table; GtkTable parent_instance;
GimpChainPosition position; GimpChainPosition position;
GtkWidget *button; GtkWidget *button;
@ -72,14 +73,16 @@ struct _GimpChainButton
struct _GimpChainButtonClass struct _GimpChainButtonClass
{ {
GtkTableClass parent_class; GtkTableClass parent_class;
void (* toggled) (GimpChainButton *gcb); void (* toggled) (GimpChainButton *gcb);
}; };
GtkType gimp_chain_button_get_type (void); GType gimp_chain_button_get_type (void);
GtkWidget * gimp_chain_button_new (GimpChainPosition position); GtkWidget * gimp_chain_button_new (GimpChainPosition position);
void gimp_chain_button_set_active (GimpChainButton *gcb, void gimp_chain_button_set_active (GimpChainButton *gcb,
gboolean is_active); gboolean is_active);
gboolean gimp_chain_button_get_active (GimpChainButton *gcb); gboolean gimp_chain_button_get_active (GimpChainButton *gcb);

View File

@ -36,16 +36,18 @@
#define DRAG_ICON_OFFSET -8 #define DRAG_ICON_OFFSET -8
static const GtkTargetEntry targets[] = { { "application/x-color", 0 } };
enum enum
{ {
COLOR_CHANGED, COLOR_CHANGED,
LAST_SIGNAL LAST_SIGNAL
}; };
static guint gimp_color_area_signals[LAST_SIGNAL] = { 0 };
static GtkWidgetClass *parent_class = NULL; static const GtkTargetEntry targets[] = { { "application/x-color", 0 } };
static guint gimp_color_area_signals[LAST_SIGNAL] = { 0 };
static GtkWidgetClass * parent_class = NULL;
static void gimp_color_area_class_init (GimpColorAreaClass *klass); static void gimp_color_area_class_init (GimpColorAreaClass *klass);
@ -84,19 +86,22 @@ gimp_color_area_get_type (void)
if (!gca_type) if (!gca_type)
{ {
GtkTypeInfo gca_info = static const GTypeInfo gca_info =
{ {
"GimpColorArea", sizeof (GimpColorAreaClass),
sizeof (GimpColorArea), (GBaseInitFunc) NULL,
sizeof (GimpColorAreaClass), (GBaseFinalizeFunc) NULL,
(GtkClassInitFunc) gimp_color_area_class_init, (GClassInitFunc) gimp_color_area_class_init,
(GtkObjectInitFunc) gimp_color_area_init, NULL, /* class_finalize */
/* reserved_1 */ NULL, NULL, /* class_data */
/* reserved_2 */ NULL, sizeof (GimpColorArea),
(GtkClassInitFunc) NULL 0, /* n_preallocs */
(GInstanceInitFunc) gimp_color_area_init,
}; };
gca_type = gtk_type_unique (GTK_TYPE_PREVIEW, &gca_info); gca_type = g_type_register_static (GTK_TYPE_PREVIEW,
"GimpColorArea",
&gca_info, 0);
} }
return gca_type; return gca_type;

View File

@ -42,20 +42,14 @@ extern "C" {
#define GIMP_COLOR_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_AREA, GimpColorAreaClass)) #define GIMP_COLOR_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_AREA, GimpColorAreaClass))
#define GIMP_IS_COLOR_AREA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_COLOR_AREA)) #define GIMP_IS_COLOR_AREA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_COLOR_AREA))
#define GIMP_IS_COLOR_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_AREA)) #define GIMP_IS_COLOR_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_AREA))
#define GIMP_COLOR_AREA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_AREA, GimpColorAreaClass))
typedef enum
{
GIMP_COLOR_AREA_FLAT = 0,
GIMP_COLOR_AREA_SMALL_CHECKS,
GIMP_COLOR_AREA_LARGE_CHECKS
} GimpColorAreaType;
typedef struct _GimpColorAreaClass GimpColorAreaClass; typedef struct _GimpColorAreaClass GimpColorAreaClass;
struct _GimpColorArea struct _GimpColorArea
{ {
GtkPreview preview; GtkPreview parent_instance;
/*< private >*/ /*< private >*/
GimpColorAreaType type; GimpColorAreaType type;
@ -65,16 +59,18 @@ struct _GimpColorArea
struct _GimpColorAreaClass struct _GimpColorAreaClass
{ {
GtkPreviewClass parent_class; GtkPreviewClass parent_class;
void (* color_changed) (GimpColorArea *gca); void (* color_changed) (GimpColorArea *gca);
}; };
GtkType gimp_color_area_get_type (void); GType gimp_color_area_get_type (void);
GtkWidget * gimp_color_area_new (const GimpRGB *color, GtkWidget * gimp_color_area_new (const GimpRGB *color,
GimpColorAreaType type, GimpColorAreaType type,
GdkModifierType drag_mask); GdkModifierType drag_mask);
void gimp_color_area_set_color (GimpColorArea *gca, void gimp_color_area_set_color (GimpColorArea *gca,
const GimpRGB *color); const GimpRGB *color);
void gimp_color_area_get_color (GimpColorArea *gca, void gimp_color_area_get_color (GimpColorArea *gca,

View File

@ -36,6 +36,13 @@
#include "libgimp/libgimp-intl.h" #include "libgimp/libgimp-intl.h"
enum
{
COLOR_CHANGED,
LAST_SIGNAL
};
static void gimp_color_button_class_init (GimpColorButtonClass *klass); static void gimp_color_button_class_init (GimpColorButtonClass *klass);
static void gimp_color_button_init (GimpColorButton *gcb); static void gimp_color_button_init (GimpColorButton *gcb);
static void gimp_color_button_destroy (GtkObject *object); static void gimp_color_button_destroy (GtkObject *object);
@ -71,19 +78,99 @@ static GtkItemFactoryEntry menu_items[] =
{ N_("/Use Foreground Color"), NULL, gimp_color_button_use_fg, 2, NULL }, { N_("/Use Foreground Color"), NULL, gimp_color_button_use_fg, 2, NULL },
{ N_("/Use Background Color"), NULL, gimp_color_button_use_bg, 2, NULL } { N_("/Use Background Color"), NULL, gimp_color_button_use_bg, 2, NULL }
}; };
static gint nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]);
static guint gimp_color_button_signals[LAST_SIGNAL] = { 0 };
static GimpButtonClass * parent_class = NULL;
enum GType
gimp_color_button_get_type (void)
{ {
COLOR_CHANGED, static GType gcb_type = 0;
LAST_SIGNAL
};
static guint gimp_color_button_signals[LAST_SIGNAL] = { 0 }; if (!gcb_type)
{
static const GTypeInfo gcb_info =
{
sizeof (GimpColorButtonClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_color_button_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpColorButton),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_color_button_init,
};
static GtkPreviewClass *parent_class = NULL; gcb_type = g_type_register_static (GIMP_TYPE_BUTTON,
"GimpColorButton",
&gcb_info, 0);
}
return gcb_type;
}
static void
gimp_color_button_class_init (GimpColorButtonClass *klass)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkButtonClass *button_class;
object_class = GTK_OBJECT_CLASS (klass);
widget_class = GTK_WIDGET_CLASS (klass);
button_class = GTK_BUTTON_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
gimp_color_button_signals[COLOR_CHANGED] =
g_signal_new ("color_changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpColorButtonClass, color_changed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
klass->color_changed = NULL;
object_class->destroy = gimp_color_button_destroy;
widget_class->state_changed = gimp_color_button_state_changed;
button_class->clicked = gimp_color_button_clicked;
}
static void
gimp_color_button_init (GimpColorButton *gcb)
{
GimpRGB color;
gcb->title = NULL;
gcb->dialog = NULL;
gimp_rgba_set (&color, 0.0, 0.0, 0.0, 1.0);
gcb->color_area = gimp_color_area_new (&color, FALSE, GDK_BUTTON2_MASK);
g_signal_connect (G_OBJECT (gcb->color_area), "color_changed",
G_CALLBACK (gimp_color_button_color_changed),
gcb);
gtk_container_add (GTK_CONTAINER (gcb), gcb->color_area);
gtk_widget_show (gcb->color_area);
/* right-click opens a popup */
gcb->item_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<popup>", NULL);
gtk_item_factory_set_translate_func (gcb->item_factory,
gimp_color_button_menu_translate,
NULL, NULL);
gtk_item_factory_create_items (gcb->item_factory,
G_N_ELEMENTS (menu_items), menu_items, gcb);
g_signal_connect (G_OBJECT (gcb), "button_press_event",
G_CALLBACK (gimp_color_button_menu_popup),
gcb);
}
static void static void
gimp_color_button_destroy (GtkObject *object) gimp_color_button_destroy (GtkObject *object)
@ -114,90 +201,17 @@ gimp_color_button_destroy (GtkObject *object)
GTK_OBJECT_CLASS (parent_class)->destroy (object); GTK_OBJECT_CLASS (parent_class)->destroy (object);
} }
static void static void
gimp_color_button_class_init (GimpColorButtonClass *klass) gimp_color_button_state_changed (GtkWidget *widget,
{ GtkStateType previous_state)
GtkObjectClass *object_class; {
GtkWidgetClass *widget_class; g_return_if_fail (GIMP_IS_COLOR_BUTTON (widget));
GtkButtonClass *button_class;
object_class = (GtkObjectClass *) klass; if (!GTK_WIDGET_IS_SENSITIVE (widget) && GIMP_COLOR_BUTTON (widget)->dialog)
widget_class = (GtkWidgetClass *) klass; gtk_widget_hide (GIMP_COLOR_BUTTON (widget)->dialog);
button_class = (GtkButtonClass *) klass;
parent_class = g_type_class_peek_parent (klass);
gimp_color_button_signals[COLOR_CHANGED] = if (GTK_WIDGET_CLASS (parent_class)->state_changed)
g_signal_new ("color_changed", GTK_WIDGET_CLASS (parent_class)->state_changed (widget, previous_state);
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpColorButtonClass, color_changed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
klass->color_changed = NULL;
object_class->destroy = gimp_color_button_destroy;
widget_class->state_changed = gimp_color_button_state_changed;
button_class->clicked = gimp_color_button_clicked;
}
static void
gimp_color_button_init (GimpColorButton *gcb)
{
GimpRGB color;
gcb->title = NULL;
gcb->dialog = NULL;
gimp_rgba_set (&color, 0.0, 0.0, 0.0, 1.0);
gcb->color_area = gimp_color_area_new (&color, FALSE, GDK_BUTTON2_MASK);
g_signal_connect (G_OBJECT (gcb->color_area), "color_changed",
G_CALLBACK (gimp_color_button_color_changed),
gcb);
gtk_container_add (GTK_CONTAINER (gcb), gcb->color_area);
gtk_widget_show (gcb->color_area);
/* right-click opens a popup */
gcb->item_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<popup>", NULL);
gtk_item_factory_set_translate_func (gcb->item_factory,
gimp_color_button_menu_translate,
NULL, NULL);
gtk_item_factory_create_items (gcb->item_factory,
nmenu_items, menu_items, gcb);
g_signal_connect (G_OBJECT (gcb), "button_press_event",
G_CALLBACK (gimp_color_button_menu_popup),
gcb);
}
GtkType
gimp_color_button_get_type (void)
{
static GtkType gcb_type = 0;
if (!gcb_type)
{
GtkTypeInfo gcb_info =
{
"GimpColorButton",
sizeof (GimpColorButton),
sizeof (GimpColorButtonClass),
(GtkClassInitFunc) gimp_color_button_class_init,
(GtkObjectInitFunc) gimp_color_button_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
};
gcb_type = gtk_type_unique (gtk_button_get_type (), &gcb_info);
}
return gcb_type;
} }
/** /**
@ -301,20 +315,6 @@ gimp_color_button_set_type (GimpColorButton *gcb,
gimp_color_area_set_type (GIMP_COLOR_AREA (gcb->color_area), type); gimp_color_area_set_type (GIMP_COLOR_AREA (gcb->color_area), type);
} }
static void
gimp_color_button_state_changed (GtkWidget *widget,
GtkStateType previous_state)
{
g_return_if_fail (widget != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (widget));
if (!GTK_WIDGET_IS_SENSITIVE (widget) && GIMP_COLOR_BUTTON (widget)->dialog)
gtk_widget_hide (GIMP_COLOR_BUTTON (widget)->dialog);
if (GTK_WIDGET_CLASS (parent_class)->state_changed)
GTK_WIDGET_CLASS (parent_class)->state_changed (widget, previous_state);
}
static gint static gint
gimp_color_button_menu_popup (GtkWidget *widget, gimp_color_button_menu_popup (GtkWidget *widget,
GdkEvent *event, GdkEvent *event,
@ -325,7 +325,6 @@ gimp_color_button_menu_popup (GtkWidget *widget,
gint x; gint x;
gint y; gint y;
g_return_val_if_fail (data != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_COLOR_BUTTON (data), FALSE); g_return_val_if_fail (GIMP_IS_COLOR_BUTTON (data), FALSE);
gcb = GIMP_COLOR_BUTTON (data); gcb = GIMP_COLOR_BUTTON (data);
@ -353,7 +352,6 @@ gimp_color_button_clicked (GtkButton *button)
GimpRGB color; GimpRGB color;
gdouble dcolor[4]; gdouble dcolor[4];
g_return_if_fail (button != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (button)); g_return_if_fail (GIMP_IS_COLOR_BUTTON (button));
gcb = GIMP_COLOR_BUTTON (button); gcb = GIMP_COLOR_BUTTON (button);
@ -402,7 +400,6 @@ gimp_color_button_dialog_ok (GtkWidget *widget,
GimpRGB color; GimpRGB color;
gdouble dcolor[4]; gdouble dcolor[4];
g_return_if_fail (data != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (data)); g_return_if_fail (GIMP_IS_COLOR_BUTTON (data));
gcb = GIMP_COLOR_BUTTON (data); gcb = GIMP_COLOR_BUTTON (data);
@ -419,7 +416,6 @@ static void
gimp_color_button_dialog_cancel (GtkWidget *widget, gimp_color_button_dialog_cancel (GtkWidget *widget,
gpointer data) gpointer data)
{ {
g_return_if_fail (data != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (data)); g_return_if_fail (GIMP_IS_COLOR_BUTTON (data));
gtk_widget_hide (GIMP_COLOR_BUTTON (data)->dialog); gtk_widget_hide (GIMP_COLOR_BUTTON (data)->dialog);
@ -433,7 +429,6 @@ gimp_color_button_use_fg (gpointer callback_data,
{ {
GimpRGB color; GimpRGB color;
g_return_if_fail (callback_data != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (callback_data)); g_return_if_fail (GIMP_IS_COLOR_BUTTON (callback_data));
gimp_color_button_get_color (GIMP_COLOR_BUTTON (callback_data), &color); gimp_color_button_get_color (GIMP_COLOR_BUTTON (callback_data), &color);
@ -448,7 +443,6 @@ gimp_color_button_use_bg (gpointer callback_data,
{ {
GimpRGB color; GimpRGB color;
g_return_if_fail (callback_data != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (callback_data)); g_return_if_fail (GIMP_IS_COLOR_BUTTON (callback_data));
gimp_color_button_get_color (GIMP_COLOR_BUTTON (callback_data), &color); gimp_color_button_get_color (GIMP_COLOR_BUTTON (callback_data), &color);

View File

@ -30,7 +30,7 @@
#define __GIMP_COLOR_BUTTON_H__ #define __GIMP_COLOR_BUTTON_H__
#include "libgimpwidgets/gimpcolorarea.h" #include <libgimpwidgets/gimpbutton.h>
#ifdef __cplusplus #ifdef __cplusplus
@ -43,13 +43,14 @@ extern "C" {
#define GIMP_COLOR_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_BUTTON, GimpColorButtonClass)) #define GIMP_COLOR_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_BUTTON, GimpColorButtonClass))
#define GIMP_IS_COLOR_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_COLOR_BUTTON)) #define GIMP_IS_COLOR_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_COLOR_BUTTON))
#define GIMP_IS_COLOR_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_BUTTON)) #define GIMP_IS_COLOR_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_BUTTON))
#define GIMP_COLOR_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_BUTTON, GimpColorButtonClass))
typedef struct _GimpColorButtonClass GimpColorButtonClass; typedef struct _GimpColorButtonClass GimpColorButtonClass;
struct _GimpColorButton struct _GimpColorButton
{ {
GtkButton button; GimpButton parent_instance;
gchar *title; gchar *title;
@ -60,18 +61,20 @@ struct _GimpColorButton
struct _GimpColorButtonClass struct _GimpColorButtonClass
{ {
GtkButtonClass parent_class; GimpButtonClass parent_class;
void (* color_changed) (GimpColorButton *gcb); void (* color_changed) (GimpColorButton *gcb);
}; };
GtkType gimp_color_button_get_type (void); GType gimp_color_button_get_type (void);
GtkWidget * gimp_color_button_new (const gchar *title, GtkWidget * gimp_color_button_new (const gchar *title,
gint width, gint width,
gint height, gint height,
const GimpRGB *color, const GimpRGB *color,
GimpColorAreaType type); GimpColorAreaType type);
void gimp_color_button_set_color (GimpColorButton *gcb, void gimp_color_button_set_color (GimpColorButton *gcb,
const GimpRGB *color); const GimpRGB *color);
void gimp_color_button_get_color (GimpColorButton *gcb, void gimp_color_button_get_color (GimpColorButton *gcb,

View File

@ -38,33 +38,77 @@ typedef void (* GimpDialogCancelCallback) (GtkWidget *widget,
gpointer data); gpointer data);
/* local callbacks of gimp_dialog_new () */ static void gimp_dialog_class_init (GimpDialogClass *klass);
static gboolean static void gimp_dialog_init (GimpDialog *dialog);
gimp_dialog_delete_callback (GtkWidget *widget,
GdkEvent *event, static void gimp_dialog_realize (GtkWidget *widget);
gpointer data) static void gimp_dialog_real_realize (GtkWidget *widget);
static gboolean gimp_dialog_delete_event (GtkWidget *widget,
GdkEventAny *event);
static GtkDialogClass *parent_class = NULL;
GType
gimp_dialog_get_type (void)
{ {
GimpDialogCancelCallback cancel_callback; static GType dialog_type = 0;
GtkWidget *cancel_widget;
cancel_callback = (GimpDialogCancelCallback) if (! dialog_type)
g_object_get_data (G_OBJECT (widget), "gimp_dialog_cancel_callback");
cancel_widget = (GtkWidget *)
g_object_get_data (G_OBJECT (widget), "gimp_dialog_cancel_widget");
/* the cancel callback has to destroy the dialog */
if (cancel_callback)
{ {
cancel_callback (cancel_widget, data); static const GTypeInfo dialog_info =
{
sizeof (GimpDialogClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_dialog_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpDialog),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_dialog_init,
};
dialog_type = g_type_register_static (GTK_TYPE_DIALOG,
"GimpDialog",
&dialog_info, 0);
} }
return TRUE; return dialog_type;
} }
static void static void
gimp_dialog_realize_callback (GtkWidget *widget, gimp_dialog_class_init (GimpDialogClass *klass)
gpointer data) {
GObjectClass *object_class;
GtkWidgetClass *widget_class;
object_class = G_OBJECT_CLASS (klass);
widget_class = GTK_WIDGET_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
widget_class->realize = gimp_dialog_realize;
widget_class->delete_event = gimp_dialog_delete_event;
}
static void
gimp_dialog_init (GimpDialog *dialog)
{
}
static void
gimp_dialog_realize (GtkWidget *widget)
{
if (GTK_WIDGET_CLASS (parent_class)->realize)
GTK_WIDGET_CLASS (parent_class)->realize (widget);
gimp_dialog_real_realize (widget);
}
static void
gimp_dialog_real_realize (GtkWidget *widget)
{ {
static GdkPixmap *wilber_pixmap = NULL; static GdkPixmap *wilber_pixmap = NULL;
static GdkBitmap *wilber_mask = NULL; static GdkBitmap *wilber_mask = NULL;
@ -83,6 +127,32 @@ gimp_dialog_realize_callback (GtkWidget *widget,
wilber_pixmap, wilber_mask); wilber_pixmap, wilber_mask);
} }
static gboolean
gimp_dialog_delete_event (GtkWidget *widget,
GdkEventAny *event)
{
GimpDialogCancelCallback cancel_callback;
GtkWidget *cancel_widget;
gpointer cancel_data;
cancel_callback = (GimpDialogCancelCallback)
g_object_get_data (G_OBJECT (widget), "gimp_dialog_cancel_callback");
cancel_widget = (GtkWidget *)
g_object_get_data (G_OBJECT (widget), "gimp_dialog_cancel_widget");
cancel_data =
g_object_get_data (G_OBJECT (widget), "gimp_dialog_cancel_data");
/* the cancel callback has to destroy the dialog */
if (cancel_callback)
{
cancel_callback (cancel_widget, cancel_data);
}
return TRUE;
}
/** /**
* gimp_dialog_new: * gimp_dialog_new:
* @title: The dialog's title which will be set with * @title: The dialog's title which will be set with
@ -107,7 +177,7 @@ gimp_dialog_realize_callback (GtkWidget *widget,
* For a description of the format of the @va_list describing the * For a description of the format of the @va_list describing the
* action_area buttons see gimp_dialog_create_action_areav(). * action_area buttons see gimp_dialog_create_action_areav().
* *
* Returns: A #GtkDialog. * Returns: A #GimpDialog.
**/ **/
GtkWidget * GtkWidget *
gimp_dialog_new (const gchar *title, gimp_dialog_new (const gchar *title,
@ -175,7 +245,7 @@ gimp_dialog_new (const gchar *title,
* The @va_list describing the action_area buttons will be passed to * The @va_list describing the action_area buttons will be passed to
* gimp_dialog_create_action_areav(). * gimp_dialog_create_action_areav().
* *
* Returns: A #GtkDialog. * Returns: A #GimpDialog.
**/ **/
GtkWidget * GtkWidget *
gimp_dialog_newv (const gchar *title, gimp_dialog_newv (const gchar *title,
@ -193,7 +263,8 @@ gimp_dialog_newv (const gchar *title,
g_return_val_if_fail (title != NULL, NULL); g_return_val_if_fail (title != NULL, NULL);
g_return_val_if_fail (wmclass_name != NULL, NULL); g_return_val_if_fail (wmclass_name != NULL, NULL);
dialog = gtk_dialog_new (); dialog = g_object_new (GIMP_TYPE_DIALOG, NULL);
gtk_window_set_title (GTK_WINDOW (dialog), title); gtk_window_set_title (GTK_WINDOW (dialog), title);
gtk_window_set_wmclass (GTK_WINDOW (dialog), wmclass_name, "Gimp"); gtk_window_set_wmclass (GTK_WINDOW (dialog), wmclass_name, "Gimp");
gtk_window_set_position (GTK_WINDOW (dialog), position); gtk_window_set_position (GTK_WINDOW (dialog), position);
@ -201,7 +272,7 @@ gimp_dialog_newv (const gchar *title,
allow_shrink, allow_grow, auto_shrink); allow_shrink, allow_grow, auto_shrink);
/* prepare the action_area */ /* prepare the action_area */
gimp_dialog_create_action_areav (GTK_DIALOG (dialog), args); gimp_dialog_create_action_areav (GIMP_DIALOG (dialog), args);
/* connect the "F1" help key */ /* connect the "F1" help key */
if (help_func) if (help_func)
@ -210,35 +281,9 @@ gimp_dialog_newv (const gchar *title,
return dialog; return dialog;
} }
/**
* gimp_dialog_set_icon:
* @dialog: The #GtkWindow you want to set the pixmap icon for.
*
* This function sets the WM pixmap icon for the dialog which will appear
* e.g. in GNOME's or KDE's window list.
*
* Note that this function is automatically called by
* gimp_help_connect() which in turn is called by gimp_dialog_newv(),
* so you only have to call it for #GtkWindow's which have no help
* page (like tear-off menus).
**/
void
gimp_dialog_set_icon (GtkWindow *dialog)
{
g_return_if_fail (dialog);
g_return_if_fail (GTK_IS_WINDOW (dialog));
if (GTK_WIDGET_REALIZED (GTK_WIDGET (dialog)))
gimp_dialog_realize_callback (GTK_WIDGET (dialog), NULL);
else
g_signal_connect (G_OBJECT (dialog), "realize",
G_CALLBACK (gimp_dialog_realize_callback),
NULL);
}
/** /**
* gimp_dialog_create_action_area: * gimp_dialog_create_action_area:
* @dialog: The #GtkDialog you want to create the action_area for. * @dialog: The #GimpDialog you want to create the action_area for.
* @...: A #NULL terminated @va_list destribing the action_area buttons. * @...: A #NULL terminated @va_list destribing the action_area buttons.
* *
* This function simply packs the action_area arguments passed in "..." * This function simply packs the action_area arguments passed in "..."
@ -246,7 +291,7 @@ gimp_dialog_set_icon (GtkWindow *dialog)
* gimp_dialog_create_action_areav(). * gimp_dialog_create_action_areav().
**/ **/
void void
gimp_dialog_create_action_area (GtkDialog *dialog, gimp_dialog_create_action_area (GimpDialog *dialog,
/* specify action area buttons as va_list: /* specify action area buttons as va_list:
* const gchar *label, * const gchar *label,
@ -271,7 +316,7 @@ gimp_dialog_create_action_area (GtkDialog *dialog,
/** /**
* gimp_dialog_create_action_areav: * gimp_dialog_create_action_areav:
* @dialog: The #GtkDialog you want to create the action_area for. * @dialog: The #GimpDialog you want to create the action_area for.
* @args: A @va_list as obtained with va_start() describing the action_area * @args: A @va_list as obtained with va_start() describing the action_area
* buttons. * buttons.
* *
@ -282,8 +327,8 @@ gimp_dialog_create_action_area (GtkDialog *dialog,
* and callback != NULL. * and callback != NULL.
**/ **/
void void
gimp_dialog_create_action_areav (GtkDialog *dialog, gimp_dialog_create_action_areav (GimpDialog *dialog,
va_list args) va_list args)
{ {
GtkWidget *button; GtkWidget *button;
@ -298,8 +343,7 @@ gimp_dialog_create_action_areav (GtkDialog *dialog,
gboolean delete_connected = FALSE; gboolean delete_connected = FALSE;
g_return_if_fail (dialog != NULL); g_return_if_fail (GIMP_IS_DIALOG (dialog));
g_return_if_fail (GTK_IS_DIALOG (dialog));
label = va_arg (args, const gchar *); label = va_arg (args, const gchar *);
@ -336,11 +380,8 @@ gimp_dialog_create_action_areav (GtkDialog *dialog,
callback); callback);
g_object_set_data (G_OBJECT (dialog), "gimp_dialog_cancel_widget", g_object_set_data (G_OBJECT (dialog), "gimp_dialog_cancel_widget",
slot_object ? slot_object : G_OBJECT (dialog)); slot_object ? slot_object : G_OBJECT (dialog));
g_object_set_data (G_OBJECT (dialog), "gimp_dialog_cancel_data",
/* catch the WM delete event */ callback_data);
g_signal_connect (G_OBJECT (dialog), "delete_event",
G_CALLBACK (gimp_dialog_delete_callback),
callback_data);
delete_connected = TRUE; delete_connected = TRUE;
} }
@ -348,7 +389,8 @@ gimp_dialog_create_action_areav (GtkDialog *dialog,
/* otherwise just create the requested button. */ /* otherwise just create the requested button. */
else else
{ {
button = gtk_dialog_add_button (dialog, label, GTK_RESPONSE_NONE); button = gtk_dialog_add_button (GTK_DIALOG (dialog),
label, GTK_RESPONSE_NONE);
if (callback) if (callback)
{ {
@ -367,17 +409,12 @@ gimp_dialog_create_action_areav (GtkDialog *dialog,
if (connect_delete && callback && ! delete_connected) if (connect_delete && callback && ! delete_connected)
{ {
g_object_set_data (G_OBJECT (dialog), g_object_set_data (G_OBJECT (dialog), "gimp_dialog_cancel_callback",
"gimp_dialog_cancel_callback",
callback); callback);
g_object_set_data (G_OBJECT (dialog), g_object_set_data (G_OBJECT (dialog), "gimp_dialog_cancel_widget",
"gimp_dialog_cancel_widget",
slot_object ? slot_object : G_OBJECT (button)); slot_object ? slot_object : G_OBJECT (button));
g_object_set_data (G_OBJECT (dialog), "gimp_dialog_cancel_data",
/* catch the WM delete event */ callback_data);
g_signal_connect (G_OBJECT (dialog), "delete_event",
G_CALLBACK (gimp_dialog_delete_callback),
callback_data);
delete_connected = TRUE; delete_connected = TRUE;
} }
@ -389,3 +426,28 @@ gimp_dialog_create_action_areav (GtkDialog *dialog,
label = va_arg (args, gchar *); label = va_arg (args, gchar *);
} }
} }
/**
* gimp_dialog_set_icon:
* @dialog: The #GtkWindow you want to set the pixmap icon for.
*
* This function sets the WM pixmap icon for the dialog which will appear
* e.g. in GNOME's or KDE's window list.
*
* Note that this function is automatically called by
* gimp_help_connect() which in turn is called by gimp_dialog_newv(),
* so you only have to call it for #GtkWindow's which have no help
* page (like tear-off menus).
**/
void
gimp_dialog_set_icon (GtkWindow *dialog)
{
g_return_if_fail (GTK_IS_WINDOW (dialog));
if (GTK_WIDGET_REALIZED (GTK_WIDGET (dialog)))
gimp_dialog_real_realize (GTK_WIDGET (dialog));
else
g_signal_connect (G_OBJECT (dialog), "realize",
G_CALLBACK (gimp_dialog_real_realize),
NULL);
}

View File

@ -23,6 +23,10 @@
#ifndef __GIMP_DIALOG_H__ #ifndef __GIMP_DIALOG_H__
#define __GIMP_DIALOG_H__ #define __GIMP_DIALOG_H__
#include <gtk/gtkdialog.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
@ -30,6 +34,29 @@ extern "C" {
/* For information look into the C source or the html documentation */ /* For information look into the C source or the html documentation */
#define GIMP_TYPE_DIALOG (gimp_dialog_get_type ())
#define GIMP_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DIALOG, GimpDialog))
#define GIMP_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DIALOG, GimpDialogClass))
#define GIMP_IS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DIALOG))
#define GIMP_IS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DIALOG))
#define GIMP_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DIALOG, GimpDialogClass))
typedef struct _GimpDialogClass GimpDialogClass;
struct _GimpDialog
{
GtkDialog parent_instance;
};
struct _GimpDialogClass
{
GtkDialogClass parent_class;
};
GType gimp_dialog_get_type (void);
GtkWidget * gimp_dialog_new (const gchar *title, GtkWidget * gimp_dialog_new (const gchar *title,
const gchar *wmclass_name, const gchar *wmclass_name,
GimpHelpFunc help_func, GimpHelpFunc help_func,
@ -62,9 +89,7 @@ GtkWidget * gimp_dialog_newv (const gchar *title,
gint auto_shrink, gint auto_shrink,
va_list args); va_list args);
void gimp_dialog_set_icon (GtkWindow *dialog); void gimp_dialog_create_action_area (GimpDialog *dialog,
void gimp_dialog_create_action_area (GtkDialog *dialog,
/* specify action area buttons /* specify action area buttons
* as va_list: * as va_list:
@ -79,9 +104,11 @@ void gimp_dialog_create_action_area (GtkDialog *dialog,
...); ...);
void gimp_dialog_create_action_areav (GtkDialog *dialog, void gimp_dialog_create_action_areav (GimpDialog *dialog,
va_list args); va_list args);
void gimp_dialog_set_icon (GtkWindow *dialog);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -50,28 +50,28 @@
#endif #endif
static void gimp_file_selection_class_init (GimpFileSelectionClass *klass);
static void gimp_file_selection_init (GimpFileSelection *gfs);
static void gimp_file_selection_destroy (GtkObject *object);
static void gimp_file_selection_entry_callback (GtkWidget *widget,
gpointer data);
static gint gimp_file_selection_entry_focus_out_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data);
static void gimp_file_selection_browse_callback (GtkWidget *widget,
gpointer data);
/* private functions */
static void gimp_file_selection_check_filename (GimpFileSelection *gfs);
enum enum
{ {
FILENAME_CHANGED, FILENAME_CHANGED,
LAST_SIGNAL LAST_SIGNAL
}; };
static void gimp_file_selection_class_init (GimpFileSelectionClass *klass);
static void gimp_file_selection_init (GimpFileSelection *gfs);
static void gimp_file_selection_destroy (GtkObject *object);
static void gimp_file_selection_entry_callback (GtkWidget *widget,
gpointer data);
static gint gimp_file_selection_entry_focus_out_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data);
static void gimp_file_selection_browse_callback (GtkWidget *widget,
gpointer data);
static void gimp_file_selection_check_filename (GimpFileSelection *gfs);
static guint gimp_file_selection_signals[LAST_SIGNAL] = { 0 }; static guint gimp_file_selection_signals[LAST_SIGNAL] = { 0 };
static GtkHBoxClass *parent_class = NULL; static GtkHBoxClass *parent_class = NULL;
@ -82,7 +82,7 @@ gimp_file_selection_get_type (void)
{ {
static GType gfs_type = 0; static GType gfs_type = 0;
if (!gfs_type) if (! gfs_type)
{ {
static const GTypeInfo gfs_info = static const GTypeInfo gfs_info =
{ {
@ -97,10 +97,11 @@ gimp_file_selection_get_type (void)
(GInstanceInitFunc) gimp_file_selection_init, (GInstanceInitFunc) gimp_file_selection_init,
}; };
gfs_type = g_type_register_static (GTK_TYPE_HBOX, "GimpFileSelection", gfs_type = g_type_register_static (GTK_TYPE_HBOX,
"GimpFileSelection",
&gfs_info, 0); &gfs_info, 0);
} }
return gfs_type; return gfs_type;
} }

View File

@ -35,13 +35,14 @@ extern "C" {
#define GIMP_FILE_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_FILE_SELECTION, GimpFileSelectionClass)) #define GIMP_FILE_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_FILE_SELECTION, GimpFileSelectionClass))
#define GIMP_IS_FILE_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, GIMP_TYPE_FILE_SELECTION)) #define GIMP_IS_FILE_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, GIMP_TYPE_FILE_SELECTION))
#define GIMP_IS_FILE_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_FILE_SELECTION)) #define GIMP_IS_FILE_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_FILE_SELECTION))
#define GIMP_FILE_SELECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_FILE_SELECTION, GimpFileSelectionClass))
typedef struct _GimpFileSelectionClass GimpFileSelectionClass; typedef struct _GimpFileSelectionClass GimpFileSelectionClass;
struct _GimpFileSelection struct _GimpFileSelection
{ {
GtkHBox hbox; GtkHBox parent_instance;
GtkWidget *file_exists; GtkWidget *file_exists;
GtkWidget *entry; GtkWidget *entry;
@ -56,7 +57,7 @@ struct _GimpFileSelection
struct _GimpFileSelectionClass struct _GimpFileSelectionClass
{ {
GtkHBoxClass parent_class; GtkHBoxClass parent_class;
void (* filename_changed) (GimpFileSelection *gfs); void (* filename_changed) (GimpFileSelection *gfs);
}; };

View File

@ -50,28 +50,28 @@
#endif #endif
static void gimp_file_selection_class_init (GimpFileSelectionClass *klass);
static void gimp_file_selection_init (GimpFileSelection *gfs);
static void gimp_file_selection_destroy (GtkObject *object);
static void gimp_file_selection_entry_callback (GtkWidget *widget,
gpointer data);
static gint gimp_file_selection_entry_focus_out_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data);
static void gimp_file_selection_browse_callback (GtkWidget *widget,
gpointer data);
/* private functions */
static void gimp_file_selection_check_filename (GimpFileSelection *gfs);
enum enum
{ {
FILENAME_CHANGED, FILENAME_CHANGED,
LAST_SIGNAL LAST_SIGNAL
}; };
static void gimp_file_selection_class_init (GimpFileSelectionClass *klass);
static void gimp_file_selection_init (GimpFileSelection *gfs);
static void gimp_file_selection_destroy (GtkObject *object);
static void gimp_file_selection_entry_callback (GtkWidget *widget,
gpointer data);
static gint gimp_file_selection_entry_focus_out_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data);
static void gimp_file_selection_browse_callback (GtkWidget *widget,
gpointer data);
static void gimp_file_selection_check_filename (GimpFileSelection *gfs);
static guint gimp_file_selection_signals[LAST_SIGNAL] = { 0 }; static guint gimp_file_selection_signals[LAST_SIGNAL] = { 0 };
static GtkHBoxClass *parent_class = NULL; static GtkHBoxClass *parent_class = NULL;
@ -82,7 +82,7 @@ gimp_file_selection_get_type (void)
{ {
static GType gfs_type = 0; static GType gfs_type = 0;
if (!gfs_type) if (! gfs_type)
{ {
static const GTypeInfo gfs_info = static const GTypeInfo gfs_info =
{ {
@ -97,10 +97,11 @@ gimp_file_selection_get_type (void)
(GInstanceInitFunc) gimp_file_selection_init, (GInstanceInitFunc) gimp_file_selection_init,
}; };
gfs_type = g_type_register_static (GTK_TYPE_HBOX, "GimpFileSelection", gfs_type = g_type_register_static (GTK_TYPE_HBOX,
"GimpFileSelection",
&gfs_info, 0); &gfs_info, 0);
} }
return gfs_type; return gfs_type;
} }

View File

@ -35,13 +35,14 @@ extern "C" {
#define GIMP_FILE_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_FILE_SELECTION, GimpFileSelectionClass)) #define GIMP_FILE_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_FILE_SELECTION, GimpFileSelectionClass))
#define GIMP_IS_FILE_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, GIMP_TYPE_FILE_SELECTION)) #define GIMP_IS_FILE_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, GIMP_TYPE_FILE_SELECTION))
#define GIMP_IS_FILE_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_FILE_SELECTION)) #define GIMP_IS_FILE_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_FILE_SELECTION))
#define GIMP_FILE_SELECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_FILE_SELECTION, GimpFileSelectionClass))
typedef struct _GimpFileSelectionClass GimpFileSelectionClass; typedef struct _GimpFileSelectionClass GimpFileSelectionClass;
struct _GimpFileSelection struct _GimpFileSelection
{ {
GtkHBox hbox; GtkHBox parent_instance;
GtkWidget *file_exists; GtkWidget *file_exists;
GtkWidget *entry; GtkWidget *entry;
@ -56,7 +57,7 @@ struct _GimpFileSelection
struct _GimpFileSelectionClass struct _GimpFileSelectionClass
{ {
GtkHBoxClass parent_class; GtkHBoxClass parent_class;
void (* filename_changed) (GimpFileSelection *gfs); void (* filename_changed) (GimpFileSelection *gfs);
}; };

View File

@ -39,11 +39,13 @@ enum
}; };
static void gimp_offset_area_destroy (GtkObject *object); static void gimp_offset_area_class_init (GimpOffsetAreaClass *klass);
static void gimp_offset_area_resize (GimpOffsetArea *offset_area); static void gimp_offset_area_init (GimpOffsetArea *offset_area);
static gboolean gimp_offset_area_event (GtkWidget *widget,
GdkEvent *event); static void gimp_offset_area_resize (GimpOffsetArea *offset_area);
static void gimp_offset_area_draw (GimpOffsetArea *offset_area); static gboolean gimp_offset_area_event (GtkWidget *widget,
GdkEvent *event);
static void gimp_offset_area_draw (GimpOffsetArea *offset_area);
static guint gimp_offset_area_signals[LAST_SIGNAL] = { 0 }; static guint gimp_offset_area_signals[LAST_SIGNAL] = { 0 };
@ -51,15 +53,32 @@ static guint gimp_offset_area_signals[LAST_SIGNAL] = { 0 };
static GtkDrawingAreaClass *parent_class = NULL; static GtkDrawingAreaClass *parent_class = NULL;
static void GType
gimp_offset_area_destroy (GtkObject *object) gimp_offset_area_get_type (void)
{ {
GimpOffsetArea *offset_area = GIMP_OFFSET_AREA (object); static GType offset_area_type = 0;
g_return_if_fail (offset_area != NULL); if (! offset_area_type)
{
static const GTypeInfo offset_area_info =
{
sizeof (GimpOffsetAreaClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_offset_area_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpOffsetArea),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_offset_area_init,
};
if (GTK_OBJECT_CLASS (parent_class)->destroy) offset_area_type = g_type_register_static (GTK_TYPE_DRAWING_AREA,
GTK_OBJECT_CLASS (parent_class)->destroy (object); "GimpOffsetArea",
&offset_area_info, 0);
}
return offset_area_type;
} }
static void static void
@ -68,8 +87,8 @@ gimp_offset_area_class_init (GimpOffsetAreaClass *klass)
GtkObjectClass *object_class; GtkObjectClass *object_class;
GtkWidgetClass *widget_class; GtkWidgetClass *widget_class;
object_class = (GtkObjectClass *) klass; object_class = GTK_OBJECT_CLASS (klass);
widget_class = (GtkWidgetClass *) klass; widget_class = GTK_WIDGET_CLASS (klass);
parent_class = g_type_class_peek_parent (klass); parent_class = g_type_class_peek_parent (klass);
@ -84,8 +103,6 @@ gimp_offset_area_class_init (GimpOffsetAreaClass *klass)
G_TYPE_INT, G_TYPE_INT,
G_TYPE_INT); G_TYPE_INT);
object_class->destroy = gimp_offset_area_destroy;
widget_class->event = gimp_offset_area_event; widget_class->event = gimp_offset_area_event;
} }
@ -105,32 +122,6 @@ gimp_offset_area_init (GimpOffsetArea *offset_area)
GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK); GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK);
} }
GtkType
gimp_offset_area_get_type (void)
{
static GtkType offset_area_type = 0;
if (!offset_area_type)
{
GtkTypeInfo offset_area_info =
{
"GimpOffsetArea",
sizeof (GimpOffsetArea),
sizeof (GimpOffsetAreaClass),
(GtkClassInitFunc) gimp_offset_area_class_init,
(GtkObjectInitFunc) gimp_offset_area_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
};
offset_area_type = gtk_type_unique (gtk_drawing_area_get_type (),
&offset_area_info);
}
return offset_area_type;
}
/** /**
* gimp_offset_area_new: * gimp_offset_area_new:
* @orig_width: the original width * @orig_width: the original width

View File

@ -34,6 +34,7 @@ extern "C" {
#define GIMP_OFFSET_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OFFSET_AREA, GimpOffsetAreaClass)) #define GIMP_OFFSET_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OFFSET_AREA, GimpOffsetAreaClass))
#define GIMP_IS_OFFSET_AREA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OFFSET_AREA)) #define GIMP_IS_OFFSET_AREA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OFFSET_AREA))
#define GIMP_IS_OFFSET_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OFFSET_AREA)) #define GIMP_IS_OFFSET_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OFFSET_AREA))
#define GIMP_OFFSET_AREA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OFFSET_AREA, GimpOffsetAreaClass))
typedef struct _GimpOffsetAreaClass GimpOffsetAreaClass; typedef struct _GimpOffsetAreaClass GimpOffsetAreaClass;
@ -62,9 +63,11 @@ struct _GimpOffsetAreaClass
}; };
GtkType gimp_offset_area_get_type (void); GType gimp_offset_area_get_type (void);
GtkWidget * gimp_offset_area_new (gint orig_width, GtkWidget * gimp_offset_area_new (gint orig_width,
gint orig_height); gint orig_height);
void gimp_offset_area_set_size (GimpOffsetArea *offset_area, void gimp_offset_area_set_size (GimpOffsetArea *offset_area,
gint width, gint width,
gint height); gint height);

View File

@ -69,31 +69,30 @@ gimp_path_editor_get_type (void)
if (! gpe_type) if (! gpe_type)
{ {
GtkTypeInfo gpe_info = static const GTypeInfo gpe_info =
{ {
"GimpPathEditor", sizeof (GimpPathEditorClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_path_editor_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpPathEditor), sizeof (GimpPathEditor),
sizeof (GimpPathEditorClass), 0, /* n_preallocs */
(GtkClassInitFunc) gimp_path_editor_class_init, (GInstanceInitFunc) gimp_path_editor_init,
(GtkObjectInitFunc) gimp_path_editor_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
}; };
gpe_type = gtk_type_unique (gtk_vbox_get_type (), &gpe_info); gpe_type = g_type_register_static (GTK_TYPE_VBOX,
"GimpPathEditor",
&gpe_info, 0);
} }
return gpe_type; return gpe_type;
} }
static void static void
gimp_path_editor_class_init (GimpPathEditorClass *klass) gimp_path_editor_class_init (GimpPathEditorClass *klass)
{ {
GtkObjectClass *object_class;
object_class = (GtkObjectClass *) klass;
parent_class = g_type_class_peek_parent (klass); parent_class = g_type_class_peek_parent (klass);
gimp_path_editor_signals[PATH_CHANGED] = gimp_path_editor_signals[PATH_CHANGED] =

View File

@ -35,13 +35,14 @@ extern "C" {
#define GIMP_PATH_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PATH_EDITOR, GimpPathEditorClass)) #define GIMP_PATH_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PATH_EDITOR, GimpPathEditorClass))
#define GIMP_IS_PATH_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, GIMP_TYPE_PATH_EDITOR)) #define GIMP_IS_PATH_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, GIMP_TYPE_PATH_EDITOR))
#define GIMP_IS_PATH_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PATH_EDITOR)) #define GIMP_IS_PATH_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PATH_EDITOR))
#define GIMP_PATH_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PATH_EDITOR, GimpPathEditorClass))
typedef struct _GimpPathEditorClass GimpPathEditorClass; typedef struct _GimpPathEditorClass GimpPathEditorClass;
struct _GimpPathEditor struct _GimpPathEditor
{ {
GtkVBox vbox; GtkVBox parent_instance;
GtkWidget *upper_hbox; GtkWidget *upper_hbox;
@ -60,7 +61,7 @@ struct _GimpPathEditor
struct _GimpPathEditorClass struct _GimpPathEditorClass
{ {
GtkVBoxClass parent_class; GtkVBoxClass parent_class;
void (* path_changed) (GimpPathEditor *gpe); void (* path_changed) (GimpPathEditor *gpe);
}; };

View File

@ -44,21 +44,24 @@ gimp_pixmap_get_type (void)
{ {
static GType pixmap_type = 0; static GType pixmap_type = 0;
if (!pixmap_type) if (! pixmap_type)
{ {
GtkTypeInfo pixmap_info = static const GTypeInfo pixmap_info =
{ {
"GimpPixmap", sizeof (GimpPixmapClass),
sizeof (GimpPixmap), (GBaseInitFunc) NULL,
sizeof (GimpPixmapClass), (GBaseFinalizeFunc) NULL,
(GtkClassInitFunc) gimp_pixmap_class_init, (GClassInitFunc) gimp_pixmap_class_init,
(GtkObjectInitFunc) gimp_pixmap_init, NULL, /* class_finalize */
/* reserved_1 */ NULL, NULL, /* class_data */
/* reserved_2 */ NULL, sizeof (GimpPixmap),
(GtkClassInitFunc) NULL 0, /* n_preallocs */
(GInstanceInitFunc) gimp_pixmap_init,
}; };
pixmap_type = gtk_type_unique (GTK_TYPE_PIXMAP, &pixmap_info); pixmap_type = g_type_register_static (GTK_TYPE_PIXMAP,
"GimpPixmap",
&pixmap_info, 0);
} }
return pixmap_type; return pixmap_type;
@ -69,7 +72,7 @@ gimp_pixmap_class_init (GimpPixmapClass *klass)
{ {
GtkWidgetClass *widget_class; GtkWidgetClass *widget_class;
widget_class = (GtkWidgetClass *) klass; widget_class = GTK_WIDGET_CLASS (klass);
parent_class = g_type_class_peek_parent (klass); parent_class = g_type_class_peek_parent (klass);

View File

@ -75,7 +75,7 @@ struct _GimpSizeEntryField
static void gimp_size_entry_class_init (GimpSizeEntryClass *class); static void gimp_size_entry_class_init (GimpSizeEntryClass *class);
static void gimp_size_entry_init (GimpSizeEntry *gse); static void gimp_size_entry_init (GimpSizeEntry *gse);
static void gimp_size_entry_destroy (GtkObject *object); static void gimp_size_entry_finalize (GObject *object);
static void gimp_size_entry_update_value (GimpSizeEntryField *gsef, static void gimp_size_entry_update_value (GimpSizeEntryField *gsef,
gdouble value); gdouble value);
@ -103,19 +103,22 @@ gimp_size_entry_get_type (void)
if (! gse_type) if (! gse_type)
{ {
GtkTypeInfo gse_info = static const GTypeInfo gse_info =
{ {
"GimpSizeEntry", sizeof (GimpSizeEntryClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_size_entry_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpSizeEntry), sizeof (GimpSizeEntry),
sizeof (GimpSizeEntryClass), 0, /* n_preallocs */
(GtkClassInitFunc) gimp_size_entry_class_init, (GInstanceInitFunc) gimp_size_entry_init,
(GtkObjectInitFunc) gimp_size_entry_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
}; };
gse_type = gtk_type_unique (GTK_TYPE_TABLE, &gse_info); gse_type = g_type_register_static (GTK_TYPE_TABLE,
"GimpSizeEntry",
&gse_info, 0);
} }
return gse_type; return gse_type;
@ -124,9 +127,9 @@ gimp_size_entry_get_type (void)
static void static void
gimp_size_entry_class_init (GimpSizeEntryClass *klass) gimp_size_entry_class_init (GimpSizeEntryClass *klass)
{ {
GtkObjectClass *object_class; GObjectClass *object_class;
object_class = (GtkObjectClass*) klass; object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass); parent_class = g_type_class_peek_parent (klass);
@ -157,11 +160,11 @@ gimp_size_entry_class_init (GimpSizeEntryClass *klass)
g_cclosure_marshal_VOID__VOID, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
object_class->destroy = gimp_size_entry_destroy; object_class->finalize = gimp_size_entry_finalize;
klass->value_changed = NULL; klass->value_changed = NULL;
klass->refval_changed = NULL; klass->refval_changed = NULL;
klass->unit_changed = NULL; klass->unit_changed = NULL;
} }
static void static void
@ -178,7 +181,7 @@ gimp_size_entry_init (GimpSizeEntry *gse)
} }
static void static void
gimp_size_entry_destroy (GtkObject *object) gimp_size_entry_finalize (GObject *object)
{ {
GimpSizeEntry *gse; GimpSizeEntry *gse;
@ -193,8 +196,7 @@ gimp_size_entry_destroy (GtkObject *object)
gse->fields = NULL; gse->fields = NULL;
} }
if (GTK_OBJECT_CLASS (parent_class)->destroy) G_OBJECT_CLASS (parent_class)->finalize (object);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
} }
/** /**
@ -465,8 +467,8 @@ gimp_size_entry_attach_label (GimpSizeEntry *gse,
{ {
GtkWidget* label; GtkWidget* label;
g_return_if_fail (gse != NULL);
g_return_if_fail (GIMP_IS_SIZE_ENTRY (gse)); g_return_if_fail (GIMP_IS_SIZE_ENTRY (gse));
g_return_if_fail (text != NULL);
label = gtk_label_new (text); label = gtk_label_new (text);
gtk_misc_set_alignment (GTK_MISC (label), alignment, 0.5); gtk_misc_set_alignment (GTK_MISC (label), alignment, 0.5);

View File

@ -45,7 +45,7 @@ enum
static void gimp_unit_menu_class_init (GimpUnitMenuClass *klass); static void gimp_unit_menu_class_init (GimpUnitMenuClass *klass);
static void gimp_unit_menu_init (GimpUnitMenu *gum); static void gimp_unit_menu_init (GimpUnitMenu *gum);
static void gimp_unit_menu_destroy (GtkObject *object); static void gimp_unit_menu_finalize (GObject *object);
static const gchar * gimp_unit_menu_build_string (const gchar *format, static const gchar * gimp_unit_menu_build_string (const gchar *format,
GimpUnit unit); GimpUnit unit);
@ -65,19 +65,22 @@ gimp_unit_menu_get_type (void)
if (! gum_type) if (! gum_type)
{ {
GtkTypeInfo gum_info = static const GTypeInfo gum_info =
{ {
"GimpUnitMenu", sizeof (GimpUnitMenuClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_unit_menu_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpUnitMenu), sizeof (GimpUnitMenu),
sizeof (GimpUnitMenuClass), 0, /* n_preallocs */
(GtkClassInitFunc) gimp_unit_menu_class_init, (GInstanceInitFunc) gimp_unit_menu_init,
(GtkObjectInitFunc) gimp_unit_menu_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
}; };
gum_type = gtk_type_unique (gtk_option_menu_get_type (), &gum_info); gum_type = g_type_register_static (GTK_TYPE_OPTION_MENU,
"GimpUnitMenu",
&gum_info, 0);
} }
return gum_type; return gum_type;
@ -86,9 +89,9 @@ gimp_unit_menu_get_type (void)
static void static void
gimp_unit_menu_class_init (GimpUnitMenuClass *klass) gimp_unit_menu_class_init (GimpUnitMenuClass *klass)
{ {
GtkObjectClass *object_class; GObjectClass *object_class;
object_class = (GtkObjectClass *) klass; object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass); parent_class = g_type_class_peek_parent (klass);
@ -101,9 +104,9 @@ gimp_unit_menu_class_init (GimpUnitMenuClass *klass)
g_cclosure_marshal_VOID__VOID, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
object_class->destroy = gimp_unit_menu_destroy; object_class->finalize = gimp_unit_menu_finalize;
klass->unit_changed = NULL; klass->unit_changed = NULL;
} }
static void static void
@ -118,7 +121,7 @@ gimp_unit_menu_init (GimpUnitMenu *gum)
} }
static void static void
gimp_unit_menu_destroy (GtkObject *object) gimp_unit_menu_finalize (GObject *object)
{ {
GimpUnitMenu *gum; GimpUnitMenu *gum;
@ -132,8 +135,7 @@ gimp_unit_menu_destroy (GtkObject *object)
gum->format = NULL; gum->format = NULL;
} }
if (GTK_OBJECT_CLASS (parent_class)->destroy) G_OBJECT_CLASS (parent_class)->finalize (object);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
} }
/** /**
@ -520,9 +522,8 @@ gimp_unit_menu_create_selection (GimpUnitMenu *gum)
NULL); NULL);
g_signal_connect (G_OBJECT (gum->selection), "destroy", g_object_add_weak_pointer (G_OBJECT (gum->selection),
G_CALLBACK (gtk_widget_destroyed), (gpointer) &gum->selection);
&gum->selection);
g_signal_connect_object (G_OBJECT (gum), "destroy", g_signal_connect_object (G_OBJECT (gum), "destroy",
G_CALLBACK (gtk_widget_destroy), G_CALLBACK (gtk_widget_destroy),

View File

@ -33,6 +33,13 @@ extern "C" {
/* For information look into the html documentation */ /* For information look into the html documentation */
typedef enum
{
GIMP_COLOR_AREA_FLAT = 0,
GIMP_COLOR_AREA_SMALL_CHECKS,
GIMP_COLOR_AREA_LARGE_CHECKS
} GimpColorAreaType;
typedef enum typedef enum
{ {
GIMP_SIZE_ENTRY_UPDATE_NONE = 0, GIMP_SIZE_ENTRY_UPDATE_NONE = 0,
@ -45,6 +52,7 @@ typedef struct _GimpButton GimpButton;
typedef struct _GimpChainButton GimpChainButton; typedef struct _GimpChainButton GimpChainButton;
typedef struct _GimpColorArea GimpColorArea; typedef struct _GimpColorArea GimpColorArea;
typedef struct _GimpColorButton GimpColorButton; typedef struct _GimpColorButton GimpColorButton;
typedef struct _GimpDialog GimpDialog;
typedef struct _GimpFileSelection GimpFileSelection; typedef struct _GimpFileSelection GimpFileSelection;
typedef struct _GimpOffsetArea GimpOffsetArea; typedef struct _GimpOffsetArea GimpOffsetArea;
typedef struct _GimpPathEditor GimpPathEditor; typedef struct _GimpPathEditor GimpPathEditor;