From a8598c696912263b5bef8497c69bce74ddcbb260 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Fri, 16 May 2003 11:53:50 +0000 Subject: [PATCH] added dialog_factory and dialog_identifier parameters to the constructors 2003-05-16 Michael Natterer * app/gui/color-notebook.[ch]: added dialog_factory and dialog_identifier parameters to the constructors and register the color_notebook with the passed factory as foreign dialog. * app/widgets/gimpcolorpanel.c: changed accordingly. * app/gui/dialogs.c * app/gui/colormap-editor-commands.c * app/gui/gradient-editor-commands.c * app/gui/palette-editor-commands.c * app/widgets/gimptoolbox-color-area.c: added session management for the color notebooks created here. --- ChangeLog | 15 +++++++++++++ app/actions/colormap-commands.c | 3 +++ app/actions/colormap-editor-commands.c | 3 +++ app/actions/gradient-editor-commands.c | 5 +++++ app/actions/palette-editor-commands.c | 3 +++ app/dialogs/color-dialog.c | 30 +++++++++++++++++++++++++- app/dialogs/color-dialog.h | 4 ++++ app/dialogs/dialogs.c | 10 +++++++++ app/gui/color-notebook.c | 30 +++++++++++++++++++++++++- app/gui/color-notebook.h | 4 ++++ app/gui/colormap-editor-commands.c | 3 +++ app/gui/dialogs.c | 10 +++++++++ app/gui/gradient-editor-commands.c | 5 +++++ app/gui/palette-editor-commands.c | 3 +++ app/widgets/gimpcolordialog.c | 30 +++++++++++++++++++++++++- app/widgets/gimpcolordialog.h | 4 ++++ app/widgets/gimpcolorpanel.c | 1 + app/widgets/gimptoolbox-color-area.c | 20 ++++++++++------- 18 files changed, 172 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index d132f07365..2b32e35a81 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2003-05-16 Michael Natterer + + * app/gui/color-notebook.[ch]: added dialog_factory and + dialog_identifier parameters to the constructors and register the + color_notebook with the passed factory as foreign dialog. + + * app/widgets/gimpcolorpanel.c: changed accordingly. + + * app/gui/dialogs.c + * app/gui/colormap-editor-commands.c + * app/gui/gradient-editor-commands.c + * app/gui/palette-editor-commands.c + * app/widgets/gimptoolbox-color-area.c: added session management for + the color notebooks created here. + 2003-05-16 Michael Natterer * app/gui/vectors-commands.c (vectors_sel_to_vectors_cmd_callback): diff --git a/app/actions/colormap-commands.c b/app/actions/colormap-commands.c index a2ea893365..7fcb998de2 100644 --- a/app/actions/colormap-commands.c +++ b/app/actions/colormap-commands.c @@ -33,6 +33,7 @@ #include "widgets/gimpcolormapeditor.h" #include "color-notebook.h" +#include "dialogs.h" #include "colormap-editor-commands.h" #include "gimp-intl.h" @@ -100,6 +101,8 @@ colormap_editor_edit_color_cmd_callback (GtkWidget *widget, _("Edit Indexed Color"), GIMP_STOCK_CONVERT_INDEXED, _("Edit Indexed Image Palette Color"), + global_dialog_factory, + "gimp-colormap-editor-color-dialog", (const GimpRGB *) &color, colormap_editor_color_notebook_callback, editor, diff --git a/app/actions/colormap-editor-commands.c b/app/actions/colormap-editor-commands.c index a2ea893365..7fcb998de2 100644 --- a/app/actions/colormap-editor-commands.c +++ b/app/actions/colormap-editor-commands.c @@ -33,6 +33,7 @@ #include "widgets/gimpcolormapeditor.h" #include "color-notebook.h" +#include "dialogs.h" #include "colormap-editor-commands.h" #include "gimp-intl.h" @@ -100,6 +101,8 @@ colormap_editor_edit_color_cmd_callback (GtkWidget *widget, _("Edit Indexed Color"), GIMP_STOCK_CONVERT_INDEXED, _("Edit Indexed Image Palette Color"), + global_dialog_factory, + "gimp-colormap-editor-color-dialog", (const GimpRGB *) &color, colormap_editor_color_notebook_callback, editor, diff --git a/app/actions/gradient-editor-commands.c b/app/actions/gradient-editor-commands.c index 31b1999cb3..079e2a5aa6 100644 --- a/app/actions/gradient-editor-commands.c +++ b/app/actions/gradient-editor-commands.c @@ -32,6 +32,7 @@ #include "widgets/gimpviewabledialog.h" #include "color-notebook.h" +#include "dialogs.h" #include "gradient-editor-commands.h" #include "gimp-intl.h" @@ -83,6 +84,8 @@ gradient_editor_left_color_cmd_callback (GtkWidget *widget, _("Left Endpoint Color"), GIMP_STOCK_TOOL_BLEND, _("Gradient Segment's Left Endpoint Color"), + global_dialog_factory, + "gimp-gradient-editor-color-dialog", &editor->control_sel_l->left_color, gradient_editor_left_color_changed, editor, @@ -199,6 +202,8 @@ gradient_editor_right_color_cmd_callback (GtkWidget *widget, _("Right Endpoint Color"), GIMP_STOCK_TOOL_BLEND, _("Gradient Segment's Right Endpoint Color"), + global_dialog_factory, + "gimp-gradient-editor-color-dialog", &editor->control_sel_l->right_color, gradient_editor_right_color_changed, editor, diff --git a/app/actions/palette-editor-commands.c b/app/actions/palette-editor-commands.c index 441b54b8e4..13a5b892b5 100644 --- a/app/actions/palette-editor-commands.c +++ b/app/actions/palette-editor-commands.c @@ -32,6 +32,7 @@ #include "widgets/gimptoolbox-color-area.h" #include "color-notebook.h" +#include "dialogs.h" #include "palette-editor-commands.h" #include "gimp-intl.h" @@ -96,6 +97,8 @@ palette_editor_edit_color_cmd_callback (GtkWidget *widget, _("Edit Palette Color"), GTK_STOCK_SELECT_COLOR, _("Edit Color Palette Entry"), + global_dialog_factory, + "gimp-palette-editor-color-dialog", (const GimpRGB *) &editor->color->color, palette_editor_color_notebook_callback, editor, diff --git a/app/dialogs/color-dialog.c b/app/dialogs/color-dialog.c index b9e691f288..c64e8ecf19 100644 --- a/app/dialogs/color-dialog.c +++ b/app/dialogs/color-dialog.c @@ -32,6 +32,7 @@ #include "gui-types.h" +#include "widgets/gimpdialogfactory.h" #include "widgets/gimpviewabledialog.h" #include "color-history.h" @@ -86,6 +87,8 @@ static ColorNotebook * const gchar *wmclass_name, const gchar *stock_id, const gchar *desc, + GimpDialogFactory *dialog_factory, + const gchar *dialog_identifier, const GimpRGB *color, ColorNotebookCallback callback, gpointer client_data, @@ -138,6 +141,8 @@ static GList *color_notebooks = NULL; ColorNotebook * color_notebook_new (const gchar *title, + GimpDialogFactory *dialog_factory, + const gchar *dialog_identifier, const GimpRGB *color, ColorNotebookCallback callback, gpointer client_data, @@ -149,6 +154,8 @@ color_notebook_new (const gchar *title, "color_selection", NULL, NULL, + dialog_factory, + dialog_identifier, color, callback, client_data, wants_updates, show_alpha); @@ -159,6 +166,8 @@ color_notebook_viewable_new (GimpViewable *viewable, const gchar *title, const gchar *stock_id, const gchar *desc, + GimpDialogFactory *dialog_factory, + const gchar *dialog_identifier, const GimpRGB *color, ColorNotebookCallback callback, gpointer client_data, @@ -170,6 +179,8 @@ color_notebook_viewable_new (GimpViewable *viewable, "color_selection", stock_id, desc, + dialog_factory, + dialog_identifier, color, callback, client_data, wants_updates, show_alpha); @@ -182,7 +193,13 @@ color_notebook_free (ColorNotebook *cnp) color_notebooks = g_list_remove (color_notebooks, cnp); - gtk_widget_destroy (cnp->shell); + /* may be already destroyed by dialog factory */ + if (cnp->shell) + { + g_object_remove_weak_pointer (G_OBJECT (cnp->shell), + (gpointer *) &cnp->shell); + gtk_widget_destroy (cnp->shell); + } g_free (cnp); } @@ -262,6 +279,8 @@ color_notebook_new_internal (GimpViewable *viewable, const gchar *wmclass_name, const gchar *stock_id, const gchar *desc, + GimpDialogFactory *dialog_factory, + const gchar *dialog_identifier, const GimpRGB *color, ColorNotebookCallback callback, gpointer client_data, @@ -280,6 +299,10 @@ color_notebook_new_internal (GimpViewable *viewable, GtkWidget *arrow; gint i; + g_return_val_if_fail (dialog_factory == NULL || + GIMP_IS_DIALOG_FACTORY (dialog_factory), NULL); + g_return_val_if_fail (dialog_factory == NULL || dialog_identifier != NULL, + NULL); g_return_val_if_fail (color != NULL, NULL); cnp = g_new0 (ColorNotebook, 1); @@ -327,6 +350,11 @@ color_notebook_new_internal (GimpViewable *viewable, NULL); + g_object_add_weak_pointer (G_OBJECT (cnp->shell), (gpointer *) &cnp->shell); + + gimp_dialog_factory_add_foreign (dialog_factory, dialog_identifier, + cnp->shell); + main_vbox = gtk_vbox_new (FALSE, 4); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 4); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (cnp->shell)->vbox), main_vbox); diff --git a/app/dialogs/color-dialog.h b/app/dialogs/color-dialog.h index 77cad00c37..22efde2eaf 100644 --- a/app/dialogs/color-dialog.h +++ b/app/dialogs/color-dialog.h @@ -35,6 +35,8 @@ typedef void (* ColorNotebookCallback) (ColorNotebook *cnb, ColorNotebook * color_notebook_new (const gchar *title, + GimpDialogFactory *dialog_factory, + const gchar *dialog_identifier, const GimpRGB *color, ColorNotebookCallback callback, gpointer callback_data, @@ -45,6 +47,8 @@ ColorNotebook * color_notebook_viewable_new (GimpViewable *viewable, const gchar *title, const gchar *stock_id, const gchar *desc, + GimpDialogFactory *dialog_factory, + const gchar *dialog_identifier, const GimpRGB *color, ColorNotebookCallback callback, gpointer callback_data, diff --git a/app/dialogs/dialogs.c b/app/dialogs/dialogs.c index 8147b91c86..e679801351 100644 --- a/app/dialogs/dialogs.c +++ b/app/dialogs/dialogs.c @@ -77,6 +77,16 @@ static const GimpDialogFactoryEntry toplevel_entries[] = { "gimp-perspective-tool-dialog", NULL, 0, TRUE, TRUE, FALSE, FALSE }, + { "gimp-toolbox-color-dialog", + NULL, 0, TRUE, TRUE, FALSE, FALSE }, + { "gimp-gradient-editor-color-dialog", + NULL, 0, TRUE, TRUE, FALSE, FALSE }, + { "gimp-palette-editor-color-dialog", + NULL, 0, TRUE, TRUE, FALSE, FALSE }, + + { "gimp-colormap-editor-color-dialog", + NULL, 0, FALSE, TRUE, FALSE, FALSE }, + /* ordinary toplevels */ { "gimp-file-new-dialog", dialogs_file_new_new, 0, FALSE, TRUE, FALSE, FALSE }, diff --git a/app/gui/color-notebook.c b/app/gui/color-notebook.c index b9e691f288..c64e8ecf19 100644 --- a/app/gui/color-notebook.c +++ b/app/gui/color-notebook.c @@ -32,6 +32,7 @@ #include "gui-types.h" +#include "widgets/gimpdialogfactory.h" #include "widgets/gimpviewabledialog.h" #include "color-history.h" @@ -86,6 +87,8 @@ static ColorNotebook * const gchar *wmclass_name, const gchar *stock_id, const gchar *desc, + GimpDialogFactory *dialog_factory, + const gchar *dialog_identifier, const GimpRGB *color, ColorNotebookCallback callback, gpointer client_data, @@ -138,6 +141,8 @@ static GList *color_notebooks = NULL; ColorNotebook * color_notebook_new (const gchar *title, + GimpDialogFactory *dialog_factory, + const gchar *dialog_identifier, const GimpRGB *color, ColorNotebookCallback callback, gpointer client_data, @@ -149,6 +154,8 @@ color_notebook_new (const gchar *title, "color_selection", NULL, NULL, + dialog_factory, + dialog_identifier, color, callback, client_data, wants_updates, show_alpha); @@ -159,6 +166,8 @@ color_notebook_viewable_new (GimpViewable *viewable, const gchar *title, const gchar *stock_id, const gchar *desc, + GimpDialogFactory *dialog_factory, + const gchar *dialog_identifier, const GimpRGB *color, ColorNotebookCallback callback, gpointer client_data, @@ -170,6 +179,8 @@ color_notebook_viewable_new (GimpViewable *viewable, "color_selection", stock_id, desc, + dialog_factory, + dialog_identifier, color, callback, client_data, wants_updates, show_alpha); @@ -182,7 +193,13 @@ color_notebook_free (ColorNotebook *cnp) color_notebooks = g_list_remove (color_notebooks, cnp); - gtk_widget_destroy (cnp->shell); + /* may be already destroyed by dialog factory */ + if (cnp->shell) + { + g_object_remove_weak_pointer (G_OBJECT (cnp->shell), + (gpointer *) &cnp->shell); + gtk_widget_destroy (cnp->shell); + } g_free (cnp); } @@ -262,6 +279,8 @@ color_notebook_new_internal (GimpViewable *viewable, const gchar *wmclass_name, const gchar *stock_id, const gchar *desc, + GimpDialogFactory *dialog_factory, + const gchar *dialog_identifier, const GimpRGB *color, ColorNotebookCallback callback, gpointer client_data, @@ -280,6 +299,10 @@ color_notebook_new_internal (GimpViewable *viewable, GtkWidget *arrow; gint i; + g_return_val_if_fail (dialog_factory == NULL || + GIMP_IS_DIALOG_FACTORY (dialog_factory), NULL); + g_return_val_if_fail (dialog_factory == NULL || dialog_identifier != NULL, + NULL); g_return_val_if_fail (color != NULL, NULL); cnp = g_new0 (ColorNotebook, 1); @@ -327,6 +350,11 @@ color_notebook_new_internal (GimpViewable *viewable, NULL); + g_object_add_weak_pointer (G_OBJECT (cnp->shell), (gpointer *) &cnp->shell); + + gimp_dialog_factory_add_foreign (dialog_factory, dialog_identifier, + cnp->shell); + main_vbox = gtk_vbox_new (FALSE, 4); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 4); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (cnp->shell)->vbox), main_vbox); diff --git a/app/gui/color-notebook.h b/app/gui/color-notebook.h index 77cad00c37..22efde2eaf 100644 --- a/app/gui/color-notebook.h +++ b/app/gui/color-notebook.h @@ -35,6 +35,8 @@ typedef void (* ColorNotebookCallback) (ColorNotebook *cnb, ColorNotebook * color_notebook_new (const gchar *title, + GimpDialogFactory *dialog_factory, + const gchar *dialog_identifier, const GimpRGB *color, ColorNotebookCallback callback, gpointer callback_data, @@ -45,6 +47,8 @@ ColorNotebook * color_notebook_viewable_new (GimpViewable *viewable, const gchar *title, const gchar *stock_id, const gchar *desc, + GimpDialogFactory *dialog_factory, + const gchar *dialog_identifier, const GimpRGB *color, ColorNotebookCallback callback, gpointer callback_data, diff --git a/app/gui/colormap-editor-commands.c b/app/gui/colormap-editor-commands.c index a2ea893365..7fcb998de2 100644 --- a/app/gui/colormap-editor-commands.c +++ b/app/gui/colormap-editor-commands.c @@ -33,6 +33,7 @@ #include "widgets/gimpcolormapeditor.h" #include "color-notebook.h" +#include "dialogs.h" #include "colormap-editor-commands.h" #include "gimp-intl.h" @@ -100,6 +101,8 @@ colormap_editor_edit_color_cmd_callback (GtkWidget *widget, _("Edit Indexed Color"), GIMP_STOCK_CONVERT_INDEXED, _("Edit Indexed Image Palette Color"), + global_dialog_factory, + "gimp-colormap-editor-color-dialog", (const GimpRGB *) &color, colormap_editor_color_notebook_callback, editor, diff --git a/app/gui/dialogs.c b/app/gui/dialogs.c index 8147b91c86..e679801351 100644 --- a/app/gui/dialogs.c +++ b/app/gui/dialogs.c @@ -77,6 +77,16 @@ static const GimpDialogFactoryEntry toplevel_entries[] = { "gimp-perspective-tool-dialog", NULL, 0, TRUE, TRUE, FALSE, FALSE }, + { "gimp-toolbox-color-dialog", + NULL, 0, TRUE, TRUE, FALSE, FALSE }, + { "gimp-gradient-editor-color-dialog", + NULL, 0, TRUE, TRUE, FALSE, FALSE }, + { "gimp-palette-editor-color-dialog", + NULL, 0, TRUE, TRUE, FALSE, FALSE }, + + { "gimp-colormap-editor-color-dialog", + NULL, 0, FALSE, TRUE, FALSE, FALSE }, + /* ordinary toplevels */ { "gimp-file-new-dialog", dialogs_file_new_new, 0, FALSE, TRUE, FALSE, FALSE }, diff --git a/app/gui/gradient-editor-commands.c b/app/gui/gradient-editor-commands.c index 31b1999cb3..079e2a5aa6 100644 --- a/app/gui/gradient-editor-commands.c +++ b/app/gui/gradient-editor-commands.c @@ -32,6 +32,7 @@ #include "widgets/gimpviewabledialog.h" #include "color-notebook.h" +#include "dialogs.h" #include "gradient-editor-commands.h" #include "gimp-intl.h" @@ -83,6 +84,8 @@ gradient_editor_left_color_cmd_callback (GtkWidget *widget, _("Left Endpoint Color"), GIMP_STOCK_TOOL_BLEND, _("Gradient Segment's Left Endpoint Color"), + global_dialog_factory, + "gimp-gradient-editor-color-dialog", &editor->control_sel_l->left_color, gradient_editor_left_color_changed, editor, @@ -199,6 +202,8 @@ gradient_editor_right_color_cmd_callback (GtkWidget *widget, _("Right Endpoint Color"), GIMP_STOCK_TOOL_BLEND, _("Gradient Segment's Right Endpoint Color"), + global_dialog_factory, + "gimp-gradient-editor-color-dialog", &editor->control_sel_l->right_color, gradient_editor_right_color_changed, editor, diff --git a/app/gui/palette-editor-commands.c b/app/gui/palette-editor-commands.c index 441b54b8e4..13a5b892b5 100644 --- a/app/gui/palette-editor-commands.c +++ b/app/gui/palette-editor-commands.c @@ -32,6 +32,7 @@ #include "widgets/gimptoolbox-color-area.h" #include "color-notebook.h" +#include "dialogs.h" #include "palette-editor-commands.h" #include "gimp-intl.h" @@ -96,6 +97,8 @@ palette_editor_edit_color_cmd_callback (GtkWidget *widget, _("Edit Palette Color"), GTK_STOCK_SELECT_COLOR, _("Edit Color Palette Entry"), + global_dialog_factory, + "gimp-palette-editor-color-dialog", (const GimpRGB *) &editor->color->color, palette_editor_color_notebook_callback, editor, diff --git a/app/widgets/gimpcolordialog.c b/app/widgets/gimpcolordialog.c index b9e691f288..c64e8ecf19 100644 --- a/app/widgets/gimpcolordialog.c +++ b/app/widgets/gimpcolordialog.c @@ -32,6 +32,7 @@ #include "gui-types.h" +#include "widgets/gimpdialogfactory.h" #include "widgets/gimpviewabledialog.h" #include "color-history.h" @@ -86,6 +87,8 @@ static ColorNotebook * const gchar *wmclass_name, const gchar *stock_id, const gchar *desc, + GimpDialogFactory *dialog_factory, + const gchar *dialog_identifier, const GimpRGB *color, ColorNotebookCallback callback, gpointer client_data, @@ -138,6 +141,8 @@ static GList *color_notebooks = NULL; ColorNotebook * color_notebook_new (const gchar *title, + GimpDialogFactory *dialog_factory, + const gchar *dialog_identifier, const GimpRGB *color, ColorNotebookCallback callback, gpointer client_data, @@ -149,6 +154,8 @@ color_notebook_new (const gchar *title, "color_selection", NULL, NULL, + dialog_factory, + dialog_identifier, color, callback, client_data, wants_updates, show_alpha); @@ -159,6 +166,8 @@ color_notebook_viewable_new (GimpViewable *viewable, const gchar *title, const gchar *stock_id, const gchar *desc, + GimpDialogFactory *dialog_factory, + const gchar *dialog_identifier, const GimpRGB *color, ColorNotebookCallback callback, gpointer client_data, @@ -170,6 +179,8 @@ color_notebook_viewable_new (GimpViewable *viewable, "color_selection", stock_id, desc, + dialog_factory, + dialog_identifier, color, callback, client_data, wants_updates, show_alpha); @@ -182,7 +193,13 @@ color_notebook_free (ColorNotebook *cnp) color_notebooks = g_list_remove (color_notebooks, cnp); - gtk_widget_destroy (cnp->shell); + /* may be already destroyed by dialog factory */ + if (cnp->shell) + { + g_object_remove_weak_pointer (G_OBJECT (cnp->shell), + (gpointer *) &cnp->shell); + gtk_widget_destroy (cnp->shell); + } g_free (cnp); } @@ -262,6 +279,8 @@ color_notebook_new_internal (GimpViewable *viewable, const gchar *wmclass_name, const gchar *stock_id, const gchar *desc, + GimpDialogFactory *dialog_factory, + const gchar *dialog_identifier, const GimpRGB *color, ColorNotebookCallback callback, gpointer client_data, @@ -280,6 +299,10 @@ color_notebook_new_internal (GimpViewable *viewable, GtkWidget *arrow; gint i; + g_return_val_if_fail (dialog_factory == NULL || + GIMP_IS_DIALOG_FACTORY (dialog_factory), NULL); + g_return_val_if_fail (dialog_factory == NULL || dialog_identifier != NULL, + NULL); g_return_val_if_fail (color != NULL, NULL); cnp = g_new0 (ColorNotebook, 1); @@ -327,6 +350,11 @@ color_notebook_new_internal (GimpViewable *viewable, NULL); + g_object_add_weak_pointer (G_OBJECT (cnp->shell), (gpointer *) &cnp->shell); + + gimp_dialog_factory_add_foreign (dialog_factory, dialog_identifier, + cnp->shell); + main_vbox = gtk_vbox_new (FALSE, 4); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 4); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (cnp->shell)->vbox), main_vbox); diff --git a/app/widgets/gimpcolordialog.h b/app/widgets/gimpcolordialog.h index 77cad00c37..22efde2eaf 100644 --- a/app/widgets/gimpcolordialog.h +++ b/app/widgets/gimpcolordialog.h @@ -35,6 +35,8 @@ typedef void (* ColorNotebookCallback) (ColorNotebook *cnb, ColorNotebook * color_notebook_new (const gchar *title, + GimpDialogFactory *dialog_factory, + const gchar *dialog_identifier, const GimpRGB *color, ColorNotebookCallback callback, gpointer callback_data, @@ -45,6 +47,8 @@ ColorNotebook * color_notebook_viewable_new (GimpViewable *viewable, const gchar *title, const gchar *stock_id, const gchar *desc, + GimpDialogFactory *dialog_factory, + const gchar *dialog_identifier, const GimpRGB *color, ColorNotebookCallback callback, gpointer callback_data, diff --git a/app/widgets/gimpcolorpanel.c b/app/widgets/gimpcolorpanel.c index ec4cf7c4b0..b88124f67c 100644 --- a/app/widgets/gimpcolorpanel.c +++ b/app/widgets/gimpcolorpanel.c @@ -260,6 +260,7 @@ gimp_color_panel_clicked (GtkButton *button) { panel->color_notebook = color_notebook_new (GIMP_COLOR_BUTTON (button)->title, + NULL, NULL, (const GimpRGB *) &color, gimp_color_panel_select_callback, panel, diff --git a/app/widgets/gimptoolbox-color-area.c b/app/widgets/gimptoolbox-color-area.c index be1ee9cd66..424a984ae0 100644 --- a/app/widgets/gimptoolbox-color-area.c +++ b/app/widgets/gimptoolbox-color-area.c @@ -35,11 +35,13 @@ #include "core/gimp.h" #include "core/gimpcontext.h" +#include "gimpdialogfactory.h" #include "gimpdnd.h" #include "gimptoolbox.h" #include "gimptoolbox-color-area.h" #include "gui/color-notebook.h" +#include "gui/dialogs.h" #ifdef DISPLAY_FILTERS #include "gdisplay_color.h" @@ -371,7 +373,8 @@ color_area_select_callback (ColorNotebook *color_notebook, static void color_area_edit (GimpContext *context) { - GimpRGB color; + GimpRGB color; + const gchar *title; if (! color_notebook_active) { @@ -386,13 +389,16 @@ color_area_edit (GimpContext *context) edit_color = active_color; -#define FG_TITLE _("Change Foreground Color") -#define BG_TITLE _("Change Background Color") + if (active_color == FOREGROUND) + title = _("Change Foreground Color"); + else + title = _("Change Background Color"); if (! color_notebook) { - color_notebook = color_notebook_new (active_color == FOREGROUND ? - FG_TITLE : BG_TITLE, + color_notebook = color_notebook_new (title, + global_dialog_factory, + "gimp-toolbox-color-dialog", (const GimpRGB *) &color, color_area_select_callback, context, TRUE, FALSE); @@ -400,9 +406,7 @@ color_area_edit (GimpContext *context) } else { - color_notebook_set_title (color_notebook, - active_color == FOREGROUND ? - FG_TITLE : BG_TITLE); + color_notebook_set_title (color_notebook, title); color_notebook_set_color (color_notebook, &color); if (! color_notebook_active)