GitLab repository storage has been migrated to hashed layout. Please contact Infrastructure team if you notice any issues with repositories or hooks.

Commit 6a50c270 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

added "name", "blurb", "stock_id" and "help_id" to struct

2004-09-26  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpdialogfactory.[ch]: added "name", "blurb",
	"stock_id" and "help_id" to struct GimpDialogFactoryEntry and to
	gimp_dialog_factory_dialog_register(). Added typedef
	GimpDialogConstructor which takes a GimpDialogFactoryEntry in
	addition to the parameters GimpDialogNewFunc takes. Added a
	constructor function pointer to GimpDialogFactory which defaults
	to a function that just returns entry->new_func(). Use that
	constructor instead of entry->new_func() for creating
	dialogs. Added public API gimp_dialog_factory_set_constructor().

	* app/dialogs/dialogs.c: register name, blurb, stock_id and
	help_id for all dockables so all the dialog info lives in one huge
	ugly table now. For the global_toolbox_factory and the
	global_dock_factory, set a constructor which creates a dockable
	around the widget returned by entry->new_func().

	* app/dialogs/dialogs-constructors.[ch]: don't create the dockable
	in each dialog constructor. Removes tons of code and reduces most
	constructors to a "return gimp_foo_new(...)" one-liner. Got rid of
	all static variables, they were from a time when GimpDialogFactory
	was unable to manage singletons.

	* app/widgets/gimpbrusheditor.[ch]
	* app/widgets/gimpgradienteditor.[ch]
	* app/widgets/gimppaletteeditor.[ch]: return GtkWidget, not
	GimpDataEditor from gimp_foo_editor_new().

	* app/widgets/gimpdataeditor.c: minor cleanups.
parent f6a205f8
2004-09-26 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpdialogfactory.[ch]: added "name", "blurb",
"stock_id" and "help_id" to struct GimpDialogFactoryEntry and to
gimp_dialog_factory_dialog_register(). Added typedef
GimpDialogConstructor which takes a GimpDialogFactoryEntry in
addition to the parameters GimpDialogNewFunc takes. Added a
constructor function pointer to GimpDialogFactory which defaults
to a function that just returns entry->new_func(). Use that
constructor instead of entry->new_func() for creating
dialogs. Added public API gimp_dialog_factory_set_constructor().
* app/dialogs/dialogs.c: register name, blurb, stock_id and
help_id for all dockables so all the dialog info lives in one huge
ugly table now. For the global_toolbox_factory and the
global_dock_factory, set a constructor which creates a dockable
around the widget returned by entry->new_func().
* app/dialogs/dialogs-constructors.[ch]: don't create the dockable
in each dialog constructor. Removes tons of code and reduces most
constructors to a "return gimp_foo_new(...)" one-liner. Got rid of
all static variables, they were from a time when GimpDialogFactory
was unable to manage singletons.
* app/widgets/gimpbrusheditor.[ch]
* app/widgets/gimpgradienteditor.[ch]
* app/widgets/gimppaletteeditor.[ch]: return GtkWidget, not
GimpDataEditor from gimp_foo_editor_new().
* app/widgets/gimpdataeditor.c: minor cleanups.
2004-09-26 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpcolordialog.c: moved stuff from new() to init().
......@@ -6,7 +37,7 @@
Ported GimpNavigationView to use actions for its buttons:
* app/menus/menus.c (menus_init): register a <GimpNaviagaionEditor>
* app/menus/menus.c (menus_init): register a <GimpNavigationEditor>
UI manager containing the "view" action group.
* app/actions/actions.c (action_data_get_foo): handle "data" being
......
This diff is collapsed.
......@@ -66,6 +66,11 @@ GtkWidget * dialogs_dock_new (GimpDialogFactory *factory,
/* dockables */
GtkWidget * dialogs_dockable_constructor (GimpDialogFactory *factory,
GimpDialogFactoryEntry *entry,
GimpContext *context,
gint preview_size);
GtkWidget * dialogs_tool_options_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
......@@ -147,7 +152,7 @@ GtkWidget * dialogs_vectors_list_view_new (GimpDialogFactory *factory,
GtkWidget * dialogs_path_list_view_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
GtkWidget * dialogs_indexed_palette_new (GimpDialogFactory *factory,
GtkWidget * dialogs_colormap_editor_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
GtkWidget * dialogs_histogram_editor_new (GimpDialogFactory *factory,
......@@ -156,11 +161,11 @@ GtkWidget * dialogs_histogram_editor_new (GimpDialogFactory *factory,
GtkWidget * dialogs_selection_editor_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
GtkWidget * dialogs_undo_history_new (GimpDialogFactory *factory,
GtkWidget * dialogs_undo_editor_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
GtkWidget * dialogs_navigation_view_new (GimpDialogFactory *factory,
GtkWidget * dialogs_navigation_editor_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
......
......@@ -20,17 +20,22 @@
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "dialogs-types.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpmenufactory.h"
#include "dialogs.h"
#include "dialogs-constructors.h"
#include "gimp-intl.h"
GimpDialogFactory *global_dialog_factory = NULL;
GimpDialogFactory *global_dock_factory = NULL;
......@@ -40,157 +45,269 @@ GimpDialogFactory *global_toolbox_factory = NULL;
static const GimpDialogFactoryEntry toplevel_entries[] =
{
/* foreign toplevels without constructor */
{ "gimp-brightness-contrast-tool-dialog",
{ "gimp-brightness-contrast-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-color-picker-tool-dialog",
{ "gimp-color-picker-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, TRUE, FALSE },
{ "gimp-colorize-tool-dialog",
{ "gimp-colorize-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-crop-tool-dialog",
{ "gimp-crop-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-curves-tool-dialog",
{ "gimp-curves-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-color-balance-tool-dialog",
{ "gimp-color-balance-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-hue-saturation-tool-dialog",
{ "gimp-hue-saturation-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-levels-tool-dialog",
{ "gimp-levels-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, TRUE, FALSE },
{ "gimp-measure-tool-dialog",
{ "gimp-measure-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-posterize-tool-dialog",
{ "gimp-posterize-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-rotate-tool-dialog",
{ "gimp-rotate-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-scale-tool-dialog",
{ "gimp-scale-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-shear-tool-dialog",
{ "gimp-shear-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-text-tool-dialog",
{ "gimp-text-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, TRUE, FALSE },
{ "gimp-threshold-tool-dialog",
{ "gimp-threshold-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-perspective-tool-dialog",
{ "gimp-perspective-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-toolbox-color-dialog",
{ "gimp-toolbox-color-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-gradient-editor-color-dialog",
{ "gimp-gradient-editor-color-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-palette-editor-color-dialog",
{ "gimp-palette-editor-color-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-colormap-editor-color-dialog",
{ "gimp-colormap-editor-color-dialog", NULL, NULL, NULL, NULL,
NULL, 0, FALSE, TRUE, FALSE, FALSE },
/* ordinary toplevels */
{ "gimp-image-new-dialog", dialogs_image_new_new,
0, FALSE, TRUE, FALSE, FALSE },
{ "gimp-file-open-dialog", dialogs_file_open_new,
0, TRUE, TRUE, TRUE, FALSE },
{ "gimp-file-open-location-dialog", dialogs_file_open_location_new,
0, FALSE, TRUE, FALSE, FALSE },
{ "gimp-file-save-dialog", dialogs_file_save_new,
0, FALSE, TRUE, TRUE, FALSE },
{ "gimp-image-new-dialog", NULL, NULL, NULL, NULL,
dialogs_image_new_new, 0,
FALSE, TRUE, FALSE, FALSE },
{ "gimp-file-open-dialog", NULL, NULL, NULL, NULL,
dialogs_file_open_new, 0,
TRUE, TRUE, TRUE, FALSE },
{ "gimp-file-open-location-dialog", NULL, NULL, NULL, NULL,
dialogs_file_open_location_new, 0,
FALSE, TRUE, FALSE, FALSE },
{ "gimp-file-save-dialog", NULL, NULL, NULL, NULL,
dialogs_file_save_new, 0,
FALSE, TRUE, TRUE, FALSE },
/* singleton toplevels */
{ "gimp-preferences-dialog", dialogs_preferences_get,
0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-module-dialog", dialogs_module_get,
0, TRUE, TRUE, TRUE, FALSE },
{ "gimp-tips-dialog", dialogs_tips_get,
0, TRUE, FALSE, FALSE, FALSE },
{ "gimp-about-dialog", dialogs_about_get,
0, TRUE, FALSE, FALSE, FALSE },
{ "gimp-error-dialog", dialogs_error_get,
0, TRUE, FALSE, FALSE, FALSE },
{ "gimp-quit-dialog", dialogs_quit_get,
0, TRUE, FALSE, FALSE, FALSE }
{ "gimp-preferences-dialog", NULL, NULL, NULL, NULL,
dialogs_preferences_get, 0,
TRUE, TRUE, FALSE, FALSE },
{ "gimp-module-dialog", NULL, NULL, NULL, NULL,
dialogs_module_get, 0,
TRUE, TRUE, TRUE, FALSE },
{ "gimp-tips-dialog", NULL, NULL, NULL, NULL,
dialogs_tips_get, 0,
TRUE, FALSE, FALSE, FALSE },
{ "gimp-about-dialog", NULL, NULL, NULL, NULL,
dialogs_about_get, 0,
TRUE, FALSE, FALSE, FALSE },
{ "gimp-error-dialog", NULL, NULL, NULL, NULL,
dialogs_error_get, 0,
TRUE, FALSE, FALSE, FALSE },
{ "gimp-quit-dialog", NULL, NULL, NULL, NULL,
dialogs_quit_get, 0,
TRUE, FALSE, FALSE, FALSE }
};
static const GimpDialogFactoryEntry dock_entries[] =
{
/* singleton dockables */
{ "gimp-tool-options", dialogs_tool_options_get,
0, TRUE, FALSE, FALSE, TRUE },
{ "gimp-device-status", dialogs_device_status_get,
0, TRUE, FALSE, FALSE, TRUE },
{ "gimp-error-console", dialogs_error_console_get,
0, TRUE, FALSE, FALSE, TRUE },
{ "gimp-tool-options",
N_("Tool Options"), NULL, GIMP_STOCK_TOOL_OPTIONS,
GIMP_HELP_TOOL_OPTIONS_DIALOG,
dialogs_tool_options_get, 0,
TRUE, FALSE, FALSE, TRUE },
{ "gimp-device-status",
N_("Devices"), N_("Device Status"), GIMP_STOCK_DEVICE_STATUS,
GIMP_HELP_DEVICE_STATUS_DIALOG,
dialogs_device_status_get, 0,
TRUE, FALSE, FALSE, TRUE },
{ "gimp-error-console",
N_("Errors"), N_("Error Console"), GIMP_STOCK_WARNING,
GIMP_HELP_ERRORS_DIALOG,
dialogs_error_console_get, 0,
TRUE, FALSE, FALSE, TRUE },
/* list views */
{ "gimp-image-list", dialogs_image_list_view_new,
GIMP_VIEW_SIZE_MEDIUM, FALSE, FALSE, FALSE, TRUE },
{ "gimp-brush-list", dialogs_brush_list_view_new,
GIMP_VIEW_SIZE_MEDIUM, FALSE, FALSE, FALSE, TRUE },
{ "gimp-pattern-list", dialogs_pattern_list_view_new,
GIMP_VIEW_SIZE_MEDIUM, FALSE, FALSE, FALSE, TRUE },
{ "gimp-gradient-list", dialogs_gradient_list_view_new,
GIMP_VIEW_SIZE_MEDIUM, FALSE, FALSE, FALSE, TRUE },
{ "gimp-palette-list", dialogs_palette_list_view_new,
GIMP_VIEW_SIZE_MEDIUM, FALSE, FALSE, FALSE, TRUE },
{ "gimp-font-list", dialogs_font_list_view_new,
GIMP_VIEW_SIZE_MEDIUM, FALSE, FALSE, FALSE, TRUE },
{ "gimp-tool-list", dialogs_tool_list_view_new,
GIMP_VIEW_SIZE_SMALL, FALSE, FALSE, FALSE, TRUE },
{ "gimp-buffer-list", dialogs_buffer_list_view_new,
GIMP_VIEW_SIZE_MEDIUM, FALSE, FALSE, FALSE, TRUE },
{ "gimp-document-list", dialogs_document_list_new,
GIMP_VIEW_SIZE_LARGE, FALSE, FALSE, FALSE, TRUE },
{ "gimp-template-list", dialogs_template_list_new,
GIMP_VIEW_SIZE_SMALL, FALSE, FALSE, FALSE, TRUE },
{ "gimp-image-list",
N_("Images"), NULL, GIMP_STOCK_IMAGES,
GIMP_HELP_IMAGE_DIALOG,
dialogs_image_list_view_new, GIMP_VIEW_SIZE_MEDIUM,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-brush-list",
N_("Brushes"), NULL, GIMP_STOCK_BRUSH,
GIMP_HELP_BRUSH_DIALOG,
dialogs_brush_list_view_new, GIMP_VIEW_SIZE_MEDIUM,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-pattern-list",
N_("Patterns"), NULL, GIMP_STOCK_PATTERN,
GIMP_HELP_PATTERN_DIALOG,
dialogs_pattern_list_view_new, GIMP_VIEW_SIZE_MEDIUM,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-gradient-list",
N_("Gradients"), NULL, GIMP_STOCK_GRADIENT,
GIMP_HELP_GRADIENT_DIALOG,
dialogs_gradient_list_view_new, GIMP_VIEW_SIZE_MEDIUM,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-palette-list",
N_("Palettes"), NULL, GIMP_STOCK_PALETTE,
GIMP_HELP_PALETTE_DIALOG,
dialogs_palette_list_view_new, GIMP_VIEW_SIZE_MEDIUM,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-font-list",
N_("Fonts"), NULL, GIMP_STOCK_FONT,
GIMP_HELP_FONT_DIALOG,
dialogs_font_list_view_new, GIMP_VIEW_SIZE_MEDIUM,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-tool-list",
N_("Tools"), NULL, GIMP_STOCK_TOOLS,
GIMP_HELP_TOOLS_DIALOG,
dialogs_tool_list_view_new, GIMP_VIEW_SIZE_SMALL,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-buffer-list",
N_("Buffers"), NULL, GIMP_STOCK_BUFFER,
GIMP_HELP_BUFFER_DIALOG,
dialogs_buffer_list_view_new, GIMP_VIEW_SIZE_MEDIUM,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-document-list",
N_("History"), N_("Document History"), GTK_STOCK_OPEN,
GIMP_HELP_DOCUMENT_DIALOG,
dialogs_document_list_new, GIMP_VIEW_SIZE_LARGE,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-template-list",
N_("Templates"), N_("Image Templates"), GIMP_STOCK_TEMPLATE,
GIMP_HELP_TEMPLATE_DIALOG,
dialogs_template_list_new, GIMP_VIEW_SIZE_SMALL,
FALSE, FALSE, FALSE, TRUE },
/* grid views */
{ "gimp-image-grid", dialogs_image_grid_view_new,
GIMP_VIEW_SIZE_MEDIUM, FALSE, FALSE, FALSE, TRUE },
{ "gimp-brush-grid", dialogs_brush_grid_view_new,
GIMP_VIEW_SIZE_MEDIUM, FALSE, FALSE, FALSE, TRUE },
{ "gimp-pattern-grid", dialogs_pattern_grid_view_new,
GIMP_VIEW_SIZE_MEDIUM, FALSE, FALSE, FALSE, TRUE },
{ "gimp-gradient-grid", dialogs_gradient_grid_view_new,
GIMP_VIEW_SIZE_MEDIUM, FALSE, FALSE, FALSE, TRUE },
{ "gimp-palette-grid", dialogs_palette_grid_view_new,
GIMP_VIEW_SIZE_MEDIUM, FALSE, FALSE, FALSE, TRUE },
{ "gimp-font-grid", dialogs_font_grid_view_new,
GIMP_VIEW_SIZE_MEDIUM, FALSE, FALSE, FALSE, TRUE },
{ "gimp-tool-grid", dialogs_tool_grid_view_new,
GIMP_VIEW_SIZE_SMALL, FALSE, FALSE, FALSE, TRUE },
{ "gimp-buffer-grid", dialogs_buffer_grid_view_new,
GIMP_VIEW_SIZE_MEDIUM, FALSE, FALSE, FALSE, TRUE },
{ "gimp-document-grid", dialogs_document_grid_new,
GIMP_VIEW_SIZE_LARGE, FALSE, FALSE, FALSE, TRUE },
{ "gimp-image-grid",
N_("Images"), NULL, GIMP_STOCK_IMAGES,
GIMP_HELP_IMAGE_DIALOG,
dialogs_image_grid_view_new, GIMP_VIEW_SIZE_MEDIUM,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-brush-grid",
N_("Brushes"), NULL, GIMP_STOCK_BRUSH,
GIMP_HELP_BRUSH_DIALOG,
dialogs_brush_grid_view_new, GIMP_VIEW_SIZE_MEDIUM,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-pattern-grid",
N_("Patterns"), NULL, GIMP_STOCK_PATTERN,
GIMP_HELP_PATTERN_DIALOG,
dialogs_pattern_grid_view_new, GIMP_VIEW_SIZE_MEDIUM,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-gradient-grid",
N_("Gradients"), NULL, GIMP_STOCK_GRADIENT,
GIMP_HELP_GRADIENT_DIALOG,
dialogs_gradient_grid_view_new, GIMP_VIEW_SIZE_MEDIUM,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-palette-grid",
N_("Palettes"), NULL, GIMP_STOCK_PALETTE,
GIMP_HELP_PALETTE_DIALOG,
dialogs_palette_grid_view_new, GIMP_VIEW_SIZE_MEDIUM,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-font-grid",
N_("Fonts"), NULL, GIMP_STOCK_FONT,
GIMP_HELP_FONT_DIALOG,
dialogs_font_grid_view_new, GIMP_VIEW_SIZE_MEDIUM,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-tool-grid",
N_("Tools"), NULL, GIMP_STOCK_TOOLS,
GIMP_HELP_TOOLS_DIALOG,
dialogs_tool_grid_view_new, GIMP_VIEW_SIZE_SMALL,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-buffer-grid",
N_("Buffers"), NULL, GIMP_STOCK_BUFFER,
GIMP_HELP_BUFFER_DIALOG,
dialogs_buffer_grid_view_new, GIMP_VIEW_SIZE_MEDIUM,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-document-grid",
N_("History"), N_("Document History"), GTK_STOCK_OPEN,
GIMP_HELP_DOCUMENT_DIALOG,
dialogs_document_grid_new, GIMP_VIEW_SIZE_LARGE,
FALSE, FALSE, FALSE, TRUE },
/* image related */
{ "gimp-layer-list", dialogs_layer_list_view_new,
0, FALSE, FALSE, FALSE, TRUE },
{ "gimp-channel-list", dialogs_channel_list_view_new,
0, FALSE, FALSE, FALSE, TRUE },
{ "gimp-vectors-list", dialogs_vectors_list_view_new,
0, FALSE, FALSE, FALSE, TRUE },
{ "gimp-indexed-palette", dialogs_indexed_palette_new,
0, FALSE, FALSE, FALSE, TRUE },
{ "gimp-histogram-editor", dialogs_histogram_editor_new,
0, FALSE, FALSE, FALSE, TRUE },
{ "gimp-selection-editor", dialogs_selection_editor_new,
0, FALSE, FALSE, FALSE, TRUE },
{ "gimp-undo-history", dialogs_undo_history_new,
0, FALSE, FALSE, FALSE, TRUE },
{ "gimp-layer-list",
N_("Layers"), NULL, GIMP_STOCK_LAYERS,
GIMP_HELP_LAYER_DIALOG,
dialogs_layer_list_view_new, 0,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-channel-list",
N_("Channels"), NULL, GIMP_STOCK_CHANNELS,
GIMP_HELP_CHANNEL_DIALOG,
dialogs_channel_list_view_new, 0,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-vectors-list",
N_("Paths"), NULL, GIMP_STOCK_PATHS,
GIMP_HELP_PATH_DIALOG,
dialogs_vectors_list_view_new, 0,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-indexed-palette",
N_("Colormap"), N_("Indexed Palette"), GIMP_STOCK_INDEXED_PALETTE,
GIMP_HELP_INDEXED_PALETTE_DIALOG,
dialogs_colormap_editor_new, 0,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-histogram-editor",
N_("Histogram"), NULL, GIMP_STOCK_HISTOGRAM,
GIMP_HELP_HISTOGRAM_DIALOG,
dialogs_histogram_editor_new, 0,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-selection-editor",
N_("Selection"), N_("Selection Editor"), GIMP_STOCK_TOOL_RECT_SELECT,
GIMP_HELP_SELECTION_DIALOG,
dialogs_selection_editor_new, 0,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-undo-history",
N_("Undo"), N_("Undo History"), GIMP_STOCK_UNDO_HISTORY,
GIMP_HELP_UNDO_DIALOG,
dialogs_undo_editor_new, 0,
FALSE, FALSE, FALSE, TRUE },
/* display related */
{ "gimp-navigation-view", dialogs_navigation_view_new,
0, FALSE, FALSE, FALSE, TRUE },
{ "gimp-navigation-view",
N_("Navigation"), N_("Display Navigation"), GIMP_STOCK_NAVIGATION,
GIMP_HELP_NAVIGATION_DIALOG,
dialogs_navigation_editor_new, 0,
FALSE, FALSE, FALSE, TRUE },
/* editors */
{ "gimp-color-editor", dialogs_color_editor_new,
0, FALSE, FALSE, FALSE, TRUE },
{ "gimp-color-editor",
N_("FG/BG"), N_("FG/BG Color"), GIMP_STOCK_DEFAULT_COLORS,
GIMP_HELP_COLOR_DIALOG,
dialogs_color_editor_new, 0,
FALSE, FALSE, FALSE, TRUE },
/* singleton editors */
{ "gimp-brush-editor", dialogs_brush_editor_get,
0, TRUE, FALSE, FALSE, TRUE },
{ "gimp-gradient-editor", dialogs_gradient_editor_get,
0, TRUE, FALSE, FALSE, TRUE },
{ "gimp-palette-editor", dialogs_palette_editor_get,
0, TRUE, FALSE, FALSE, TRUE },
{ "gimp-brush-editor",
N_("Brush Editor"), NULL, GIMP_STOCK_BRUSH,
GIMP_HELP_BRUSH_EDITOR_DIALOG,
dialogs_brush_editor_get, 0,
TRUE, FALSE, FALSE, TRUE },
{ "gimp-gradient-editor",
N_("Gradient Editor"), NULL, GIMP_STOCK_GRADIENT,
GIMP_HELP_GRADIENT_EDITOR_DIALOG,
dialogs_gradient_editor_get, 0,
TRUE, FALSE, FALSE, TRUE },
{ "gimp-palette-editor",
N_("Palette Editor"), NULL, GIMP_STOCK_PALETTE,
GIMP_HELP_PALETTE_EDITOR_DIALOG,
dialogs_palette_editor_get, 0,
TRUE, FALSE, FALSE, TRUE }
};
......@@ -214,15 +331,23 @@ dialogs_init (Gimp *gimp,
gimp_get_user_context (gimp),
menu_factory,
dialogs_toolbox_get);
gimp_dialog_factory_set_constructor (global_toolbox_factory,
dialogs_dockable_constructor);
global_dock_factory = gimp_dialog_factory_new ("dock",
gimp_get_user_context (gimp),
menu_factory,
dialogs_dock_new);
gimp_dialog_factory_set_constructor (global_dock_factory,
dialogs_dockable_constructor);
for (i = 0; i < G_N_ELEMENTS (toplevel_entries); i++)
gimp_dialog_factory_register_entry (global_dialog_factory,
toplevel_entries[i].identifier,
gettext (toplevel_entries[i].name),
gettext (toplevel_entries[i].blurb),
toplevel_entries[i].stock_id,
toplevel_entries[i].help_id,
toplevel_entries[i].new_func,
toplevel_entries[i].preview_size,
toplevel_entries[i].singleton,
......@@ -233,6 +358,10 @@ dialogs_init (Gimp *gimp,
for (i = 0; i < G_N_ELEMENTS (dock_entries); i++)
gimp_dialog_factory_register_entry (global_dock_factory,
dock_entries[i].identifier,
gettext (dock_entries[i].name),
gettext (dock_entries[i].blurb),
dock_entries[i].stock_id,
dock_entries[i].help_id,
dock_entries[i].new_func,
dock_entries[i].preview_size,
dock_entries[i].singleton,
......
......@@ -286,22 +286,22 @@ gimp_brush_editor_set_data (GimpDataEditor *editor,
/* public functions */
GimpDataEditor *
GtkWidget *
gimp_brush_editor_new (Gimp *gimp)
{
GimpBrushEditor *brush_editor;
GimpBrushEditor *editor;
brush_editor = g_object_new (GIMP_TYPE_BRUSH_EDITOR, NULL);
editor = g_object_new (GIMP_TYPE_BRUSH_EDITOR, NULL);
if (! gimp_data_editor_construct (GIMP_DATA_EDITOR (brush_editor),
if (! gimp_data_editor_construct (GIMP_DATA_EDITOR (editor),
gimp->brush_factory,
NULL, NULL, NULL))
{
g_object_unref (brush_editor);
g_object_unref (editor);
return NULL;
}
return GIMP_DATA_EDITOR (brush_editor);
return GTK_WIDGET (editor);
}
......
......@@ -58,9 +58,9 @@ struct _GimpBrushEditorClass
};
GType gimp_brush_editor_get_type (void) G_GNUC_CONST;
GType gimp_brush_editor_get_type (void) G_GNUC_CONST;
GimpDataEditor * gimp_brush_editor_new (Gimp *gimp);
GtkWidget * gimp_brush_editor_new (Gimp *gimp);
#endif /* __GIMP_BRUSH_EDITOR_H__ */
......@@ -47,12 +47,13 @@ static void gimp_data_editor_class_init (GimpDataEditorClass *klass);
static void gimp_data_editor_init (GimpDataEditor *view);
static void gimp_data_editor_docked_iface_init (GimpDockedInterface *docked_iface);
static void gimp_data_editor_dispose (GObject *object);
static void gimp_data_editor_set_aux_info (GimpDocked *docked,
GList *aux_info);
static GList * gimp_data_editor_get_aux_info (GimpDocked *docked);
static void gimp_data_editor_dispose (GObject *object);
static void gimp_data_editor_real_set_data (GimpDataEditor *editor,
GimpData *data);
......@@ -115,15 +116,13 @@ gimp_data_editor_get_type (void)
static void
gimp_data_editor_class_init (GimpDataEditorClass *klass)
{
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->dispose = gimp_data_editor_dispose;
object_class->dispose = gimp_data_editor_dispose;
klass->set_data = gimp_data_editor_real_set_data;
klass->set_data = gimp_data_editor_real_set_data;
}
static void
......@@ -169,6 +168,21 @@ gimp_data_editor_docked_iface_init (GimpDockedInterface *docked_iface)
docked_iface->get_aux_info = gimp_data_editor_get_aux_info;
}
static void
gimp_data_editor_dispose (GObject *object)
{
GimpDataEditor *editor = GIMP_DATA_EDITOR (object);
if (editor->data)
{
/* Save dirty data before we clear out */
gimp_data_editor_save_dirty (editor);
gimp_data_editor_set_data (editor, NULL);
}
G_OBJECT_CLASS (parent_class)->dispose (object);
}
#define AUX_INFO_CURRENT_DATA "current-data"
static void
......@@ -216,21 +230,6 @@ gimp_data_editor_get_aux_info (GimpDocked *docked)
return aux_info;
}
static void
gimp_data_editor_dispose (GObject *object)
{
GimpDataEditor *editor = GIMP_DATA_EDITOR (object);
if (editor->data)
{
/* Save dirty data before we clear out */
gimp_data_editor_save_dirty (editor);
gimp_data_editor_set_data (editor, NULL);
}
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
gimp_data_editor_real_set_data (GimpDataEditor *editor,
GimpData *data)
......
......@@ -64,6 +64,11 @@ static void gimp_dialog_factory_init (GimpDialogFactory *factory);
static void gimp_dialog_factory_dispose (GObject *object);
static void gimp_dialog_factory_finalize (GObject *object);
static GtkWidget *
gimp_dialog_factory_default_constructor (GimpDialogFactory *factory,
GimpDialogFactoryEntry *entry,
GimpContext *context,
gint preview_size);
static void gimp_dialog_factory_set_widget_data (GtkWidget *dialog,
GimpDialogFactory *factory,
GimpDialogFactoryEntry *entry);
......@@ -147,6 +152,7 @@ gimp_dialog_factory_init (GimpDialogFactory *factory)
{
factory->menu_factory = NULL;
factory->new_dock_func = NULL;
factory->constructor = gimp_dialog_factory_default_constructor;
factory->registered_dialogs = NULL;
factory->session_infos = NULL;
factory->open_dialogs = NULL;
......@@ -207,6 +213,10 @@ gimp_dialog_factory_finalize (GObject *object)
entry = (GimpDialogFactoryEntry *) list->data;
g_free (entry->identifier);
g_free (entry->name);
g_free (entry->blurb);
g_free (entry->stock_id);
g_free (entry->help_id);
g_free (entry);
}
......@@ -287,9 +297,25 @@ gimp_dialog_factory_from_name (const gchar *name)
return factory;
}
void
gimp_dialog_factory_set_constructor (GimpDialogFactory *factory,
GimpDialogConstructor constructor)