Commit 703b961a authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

Added a confirmation dialog for "delete palette".

1999-12-19  Michael Natterer  <mitch@gimp.org>

	* app/palette.c: Added a confirmation dialog for "delete palette".

	* app/gradient.c
	* app/palette.c: Attach help_data strings to the gradient/palette
	ops buttons (for context help).
parent 35f73431
1999-12-19 Michael Natterer <mitch@gimp.org>
* app/palette.c: Added a confirmation dialog for "delete palette".
* app/gradient.c
* app/palette.c: Attach help_data strings to the gradient/palette
ops buttons (for context help).
Sun Dec 19 13:16:51 CET 1999 Sven Neumann <sven@gimp.org>
* plug-ins/bmp/bmp.c
......
......@@ -329,6 +329,7 @@ static void gradient_editor_drop_gradient (GtkWidget *widget,
/* Gradient editor functions */
static GtkWidget *ed_create_button (gchar *label,
gchar *help_data,
gdouble xalign,
gdouble yalign,
GtkSignalFunc signal_func,
......@@ -967,35 +968,45 @@ gradient_editor_create (void)
gtk_container_add (GTK_CONTAINER (frame), gvbox);
/* Buttons for gradient functions */
button = ed_create_button (_("New Gradient"), 0.5, 0.5,
button = ed_create_button (_("New Gradient"),
"dialogs/gradient_editor/new_gradient.html",
0.5, 0.5,
GTK_SIGNAL_FUNC (ed_new_gradient_callback),
NULL);
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
button = ed_create_button (_("Copy Gradient"), 0.5, 0.5,
button = ed_create_button (_("Copy Gradient"),
"dialogs/gradient_editor/copy_gradient.html",
0.5, 0.5,
GTK_SIGNAL_FUNC (ed_copy_gradient_callback),
NULL);
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
button = ed_create_button (_("Delete Gradient"), 0.5, 0.5,
button = ed_create_button (_("Delete Gradient"),
"dialogs/gradient_editor/delete_gradient.html",
0.5, 0.5,
GTK_SIGNAL_FUNC (ed_delete_gradient_callback),
NULL);
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
button = ed_create_button (_("Rename Gradient"), 0.5, 0.5,
button = ed_create_button (_("Rename Gradient"),
"dialogs/gradient_editor/rename_gradient.html",
0.5, 0.5,
GTK_SIGNAL_FUNC (ed_rename_gradient_callback),
NULL);
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
button = ed_create_button (_("Save as POV-Ray"), 0.5, 0.5,
button = ed_create_button (_("Save as POV-Ray"),
"dialogs/gradient_editor/save_as_pov_ray.html",
0.5, 0.5,
GTK_SIGNAL_FUNC (ed_save_pov_callback),
NULL);
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
......@@ -1012,7 +1023,7 @@ gradient_editor_create (void)
gtk_widget_show (hbox);
/* Zoom all button */
button = ed_create_button (_("Zoom all"), 0.5, 0.5,
button = ed_create_button (_("Zoom all"), NULL, 0.5, 0.5,
GTK_SIGNAL_FUNC (ed_zoom_all_callback),
g_editor);
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
......@@ -1352,6 +1363,7 @@ ed_update_editor (int flags)
static GtkWidget *
ed_create_button (gchar *label,
gchar *help_data,
gdouble xalign,
gdouble yalign,
GtkSignalFunc signal_func,
......@@ -1373,6 +1385,9 @@ ed_create_button (gchar *label,
signal_func,
data);
if (help_data)
gimp_help_set_help_data (button, NULL, help_data);
return button;
}
......@@ -1874,7 +1889,7 @@ ed_delete_gradient_callback (GtkWidget *widget,
gimp_standard_help_func,
"dialogs/gradient_editor/delete_gradient.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
FALSE, FALSE, FALSE,
_("Delete"), ed_do_delete_gradient_callback,
NULL, NULL, FALSE, FALSE,
......
......@@ -329,6 +329,7 @@ static void gradient_editor_drop_gradient (GtkWidget *widget,
/* Gradient editor functions */
static GtkWidget *ed_create_button (gchar *label,
gchar *help_data,
gdouble xalign,
gdouble yalign,
GtkSignalFunc signal_func,
......@@ -967,35 +968,45 @@ gradient_editor_create (void)
gtk_container_add (GTK_CONTAINER (frame), gvbox);
/* Buttons for gradient functions */
button = ed_create_button (_("New Gradient"), 0.5, 0.5,
button = ed_create_button (_("New Gradient"),
"dialogs/gradient_editor/new_gradient.html",
0.5, 0.5,
GTK_SIGNAL_FUNC (ed_new_gradient_callback),
NULL);
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
button = ed_create_button (_("Copy Gradient"), 0.5, 0.5,
button = ed_create_button (_("Copy Gradient"),
"dialogs/gradient_editor/copy_gradient.html",
0.5, 0.5,
GTK_SIGNAL_FUNC (ed_copy_gradient_callback),
NULL);
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
button = ed_create_button (_("Delete Gradient"), 0.5, 0.5,
button = ed_create_button (_("Delete Gradient"),
"dialogs/gradient_editor/delete_gradient.html",
0.5, 0.5,
GTK_SIGNAL_FUNC (ed_delete_gradient_callback),
NULL);
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
button = ed_create_button (_("Rename Gradient"), 0.5, 0.5,
button = ed_create_button (_("Rename Gradient"),
"dialogs/gradient_editor/rename_gradient.html",
0.5, 0.5,
GTK_SIGNAL_FUNC (ed_rename_gradient_callback),
NULL);
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
button = ed_create_button (_("Save as POV-Ray"), 0.5, 0.5,
button = ed_create_button (_("Save as POV-Ray"),
"dialogs/gradient_editor/save_as_pov_ray.html",
0.5, 0.5,
GTK_SIGNAL_FUNC (ed_save_pov_callback),
NULL);
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
......@@ -1012,7 +1023,7 @@ gradient_editor_create (void)
gtk_widget_show (hbox);
/* Zoom all button */
button = ed_create_button (_("Zoom all"), 0.5, 0.5,
button = ed_create_button (_("Zoom all"), NULL, 0.5, 0.5,
GTK_SIGNAL_FUNC (ed_zoom_all_callback),
g_editor);
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
......@@ -1352,6 +1363,7 @@ ed_update_editor (int flags)
static GtkWidget *
ed_create_button (gchar *label,
gchar *help_data,
gdouble xalign,
gdouble yalign,
GtkSignalFunc signal_func,
......@@ -1373,6 +1385,9 @@ ed_create_button (gchar *label,
signal_func,
data);
if (help_data)
gimp_help_set_help_data (button, NULL, help_data);
return button;
}
......@@ -1874,7 +1889,7 @@ ed_delete_gradient_callback (GtkWidget *widget,
gimp_standard_help_func,
"dialogs/gradient_editor/delete_gradient.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
FALSE, FALSE, FALSE,
_("Delete"), ed_do_delete_gradient_callback,
NULL, NULL, FALSE, FALSE,
......
......@@ -329,6 +329,7 @@ static void gradient_editor_drop_gradient (GtkWidget *widget,
/* Gradient editor functions */
static GtkWidget *ed_create_button (gchar *label,
gchar *help_data,
gdouble xalign,
gdouble yalign,
GtkSignalFunc signal_func,
......@@ -967,35 +968,45 @@ gradient_editor_create (void)
gtk_container_add (GTK_CONTAINER (frame), gvbox);
/* Buttons for gradient functions */
button = ed_create_button (_("New Gradient"), 0.5, 0.5,
button = ed_create_button (_("New Gradient"),
"dialogs/gradient_editor/new_gradient.html",
0.5, 0.5,
GTK_SIGNAL_FUNC (ed_new_gradient_callback),
NULL);
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
button = ed_create_button (_("Copy Gradient"), 0.5, 0.5,
button = ed_create_button (_("Copy Gradient"),
"dialogs/gradient_editor/copy_gradient.html",
0.5, 0.5,
GTK_SIGNAL_FUNC (ed_copy_gradient_callback),
NULL);
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
button = ed_create_button (_("Delete Gradient"), 0.5, 0.5,
button = ed_create_button (_("Delete Gradient"),
"dialogs/gradient_editor/delete_gradient.html",
0.5, 0.5,
GTK_SIGNAL_FUNC (ed_delete_gradient_callback),
NULL);
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
button = ed_create_button (_("Rename Gradient"), 0.5, 0.5,
button = ed_create_button (_("Rename Gradient"),
"dialogs/gradient_editor/rename_gradient.html",
0.5, 0.5,
GTK_SIGNAL_FUNC (ed_rename_gradient_callback),
NULL);
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
button = ed_create_button (_("Save as POV-Ray"), 0.5, 0.5,
button = ed_create_button (_("Save as POV-Ray"),
"dialogs/gradient_editor/save_as_pov_ray.html",
0.5, 0.5,
GTK_SIGNAL_FUNC (ed_save_pov_callback),
NULL);
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
......@@ -1012,7 +1023,7 @@ gradient_editor_create (void)
gtk_widget_show (hbox);
/* Zoom all button */
button = ed_create_button (_("Zoom all"), 0.5, 0.5,
button = ed_create_button (_("Zoom all"), NULL, 0.5, 0.5,
GTK_SIGNAL_FUNC (ed_zoom_all_callback),
g_editor);
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
......@@ -1352,6 +1363,7 @@ ed_update_editor (int flags)
static GtkWidget *
ed_create_button (gchar *label,
gchar *help_data,
gdouble xalign,
gdouble yalign,
GtkSignalFunc signal_func,
......@@ -1373,6 +1385,9 @@ ed_create_button (gchar *label,
signal_func,
data);
if (help_data)
gimp_help_set_help_data (button, NULL, help_data);
return button;
}
......@@ -1874,7 +1889,7 @@ ed_delete_gradient_callback (GtkWidget *widget,
gimp_standard_help_func,
"dialogs/gradient_editor/delete_gradient.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
FALSE, FALSE, FALSE,
_("Delete"), ed_do_delete_gradient_callback,
NULL, NULL, FALSE, FALSE,
......
......@@ -137,7 +137,7 @@ static void palette_entry_free (PaletteEntry *);
static void palette_entries_free (PaletteEntries *);
static void palette_entries_load (gchar *);
static void palette_entries_save (PaletteEntries *, gchar *);
static void palette_save_palettes ();
static void palette_save_palettes (void);
static void palette_entries_list_insert (PaletteEntries *entries);
......@@ -175,6 +175,9 @@ palettes_init (gint no_data)
{
if (!no_data)
datafiles_read_directories (palette_path, palette_entries_load, 0);
if (!default_palette_entries && palette_entries_list)
default_palette_entries = palette_entries_list->data;
}
void
......@@ -1787,13 +1790,13 @@ palette_dialog_new_callback (GtkWidget *widget,
}
static void
palette_dialog_delete_callback (GtkWidget *widget,
gpointer data)
palette_dialog_do_delete_callback (GtkWidget *widget,
gpointer data)
{
PaletteDialog *palette;
PaletteDialog *palette;
PaletteEntries *entries;
palette = data;
palette = (PaletteDialog *) data;
if (palette && palette->entries)
{
......@@ -1805,6 +1808,70 @@ palette_dialog_delete_callback (GtkWidget *widget,
palette_refresh_all ();
}
gtk_widget_destroy (gtk_widget_get_toplevel (widget));
gtk_widget_set_sensitive (palette->shell, TRUE);
}
static void
palette_dialog_cancel_delete_callback (GtkWidget *widget,
gpointer data)
{
PaletteDialog *palette;
palette = (PaletteDialog *) data;
gtk_widget_destroy (gtk_widget_get_toplevel (widget));
gtk_widget_set_sensitive (palette->shell, TRUE);
}
static void
palette_dialog_delete_callback (GtkWidget *widget,
gpointer data)
{
PaletteDialog *palette;
GtkWidget *dialog;
GtkWidget *vbox;
GtkWidget *label;
gchar *str;
palette = data;
if (!palette || !palette->entries)
return;
dialog = gimp_dialog_new (_("Delete Palette"), "delete_palette",
gimp_standard_help_func,
"dialogs/palette_editor/delete_palette.html",
GTK_WIN_POS_MOUSE,
FALSE, FALSE, FALSE,
_("Delete"), palette_dialog_do_delete_callback,
palette, NULL, FALSE, FALSE,
_("Cancel"), palette_dialog_cancel_delete_callback,
palette, NULL, TRUE, TRUE,
NULL);
/* The main vbox */
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox);
gtk_widget_show (vbox);
str = g_strdup_printf (_("Are you sure you want to delete\n"
"\"%s\" from the list and from disk?"),
palette->entries->name);
label = gtk_label_new (str);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
g_free (str);
gtk_widget_show (dialog);
gtk_widget_set_sensitive (palette->shell, FALSE);
}
static void
......@@ -2239,6 +2306,8 @@ palette_dialog_new (gint vert)
GTK_SIGNAL_FUNC (palette_dialog_new_callback),
(gpointer) palette);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gimp_help_set_help_data (button, NULL,
"dialogs/palette_editor/new_palette.html");
gtk_widget_show (button);
button = gtk_button_new_with_label (_("Delete"));
......@@ -2248,6 +2317,8 @@ palette_dialog_new (gint vert)
GTK_SIGNAL_FUNC (palette_dialog_delete_callback),
(gpointer) palette);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gimp_help_set_help_data (button, NULL,
"dialogs/palette_editor/delete_palette.html");
gtk_widget_show (button);
button = gtk_button_new_with_label (_("Import"));
......@@ -2257,6 +2328,8 @@ palette_dialog_new (gint vert)
GTK_SIGNAL_FUNC (palette_dialog_import_callback),
(gpointer) palette);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gimp_help_set_help_data (button, NULL,
"dialogs/palette_editor/import_palette.html");
gtk_widget_show (button);
button = gtk_button_new_with_label (_("Merge"));
......@@ -2266,6 +2339,8 @@ palette_dialog_new (gint vert)
GTK_SIGNAL_FUNC (palette_dialog_merge_callback),
(gpointer) palette);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gimp_help_set_help_data (button, NULL,
"dialogs/palette_editor/merge_palette.html");
gtk_widget_show (button);
}
......
......@@ -137,7 +137,7 @@ static void palette_entry_free (PaletteEntry *);
static void palette_entries_free (PaletteEntries *);
static void palette_entries_load (gchar *);
static void palette_entries_save (PaletteEntries *, gchar *);
static void palette_save_palettes ();
static void palette_save_palettes (void);
static void palette_entries_list_insert (PaletteEntries *entries);
......@@ -175,6 +175,9 @@ palettes_init (gint no_data)
{
if (!no_data)
datafiles_read_directories (palette_path, palette_entries_load, 0);
if (!default_palette_entries && palette_entries_list)
default_palette_entries = palette_entries_list->data;
}
void
......@@ -1787,13 +1790,13 @@ palette_dialog_new_callback (GtkWidget *widget,
}
static void
palette_dialog_delete_callback (GtkWidget *widget,
gpointer data)
palette_dialog_do_delete_callback (GtkWidget *widget,
gpointer data)
{
PaletteDialog *palette;
PaletteDialog *palette;
PaletteEntries *entries;
palette = data;
palette = (PaletteDialog *) data;
if (palette && palette->entries)
{
......@@ -1805,6 +1808,70 @@ palette_dialog_delete_callback (GtkWidget *widget,
palette_refresh_all ();
}
gtk_widget_destroy (gtk_widget_get_toplevel (widget));
gtk_widget_set_sensitive (palette->shell, TRUE);
}
static void
palette_dialog_cancel_delete_callback (GtkWidget *widget,
gpointer data)
{
PaletteDialog *palette;
palette = (PaletteDialog *) data;
gtk_widget_destroy (gtk_widget_get_toplevel (widget));
gtk_widget_set_sensitive (palette->shell, TRUE);
}
static void
palette_dialog_delete_callback (GtkWidget *widget,
gpointer data)
{
PaletteDialog *palette;
GtkWidget *dialog;
GtkWidget *vbox;
GtkWidget *label;
gchar *str;
palette = data;
if (!palette || !palette->entries)
return;
dialog = gimp_dialog_new (_("Delete Palette"), "delete_palette",
gimp_standard_help_func,
"dialogs/palette_editor/delete_palette.html",
GTK_WIN_POS_MOUSE,
FALSE, FALSE, FALSE,
_("Delete"), palette_dialog_do_delete_callback,
palette, NULL, FALSE, FALSE,
_("Cancel"), palette_dialog_cancel_delete_callback,
palette, NULL, TRUE, TRUE,
NULL);
/* The main vbox */
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox);
gtk_widget_show (vbox);
str = g_strdup_printf (_("Are you sure you want to delete\n"
"\"%s\" from the list and from disk?"),
palette->entries->name);
label = gtk_label_new (str);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
g_free (str);
gtk_widget_show (dialog);
gtk_widget_set_sensitive (palette->shell, FALSE);
}
static void
......@@ -2239,6 +2306,8 @@ palette_dialog_new (gint vert)
GTK_SIGNAL_FUNC (palette_dialog_new_callback),
(gpointer) palette);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gimp_help_set_help_data (button, NULL,
"dialogs/palette_editor/new_palette.html");
gtk_widget_show (button);
button = gtk_button_new_with_label (_("Delete"));
......@@ -2248,6 +2317,8 @@ palette_dialog_new (gint vert)
GTK_SIGNAL_FUNC (palette_dialog_delete_callback),
(gpointer) palette);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gimp_help_set_help_data (button, NULL,
"dialogs/palette_editor/delete_palette.html");
gtk_widget_show (button);
button = gtk_button_new_with_label (_("Import"));
......@@ -2257,6 +2328,8 @@ palette_dialog_new (gint vert)
GTK_SIGNAL_FUNC (palette_dialog_import_callback),
(gpointer) palette);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gimp_help_set_help_data (button, NULL,
"dialogs/palette_editor/import_palette.html");
gtk_widget_show (button);
button = gtk_button_new_with_label (_("Merge"));
......@@ -2266,6 +2339,8 @@ palette_dialog_new (gint vert)
GTK_SIGNAL_FUNC (palette_dialog_merge_callback),
(gpointer) palette);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gimp_help_set_help_data (button, NULL,
"dialogs/palette_editor/merge_palette.html");
gtk_widget_show (button);
}
......
......@@ -329,6 +329,7 @@ static void gradient_editor_drop_gradient (GtkWidget *widget,
/* Gradient editor functions */
static GtkWidget *ed_create_button (gchar *label,
gchar *help_data,
gdouble xalign,
gdouble yalign,
GtkSignalFunc signal_func,
......@@ -967,35 +968,45 @@ gradient_editor_create (void)
gtk_container_add (GTK_CONTAINER (frame), gvbox);
/* Buttons for gradient functions */
button = ed_create_button (_("New Gradient"), 0.5, 0.5,
button = ed_create_button (_("New Gradient"),
"dialogs/gradient_editor/new_gradient.html",
0.5, 0.5,
GTK_SIGNAL_FUNC (ed_new_gradient_callback),
NULL);
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
button = ed_create_button (_("Copy Gradient"), 0.5, 0.5,
button = ed_create_button (_("Copy Gradient"),
"dialogs/gradient_editor/copy_gradient.html",
0.5, 0.5,
GTK_SIGNAL_FUNC (ed_copy_gradient_callback),
NULL);
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
button = ed_create_button (_("Delete Gradient"), 0.5, 0.5,
button = ed_create_button (_("Delete Gradient"),
"dialogs/gradient_editor/delete_gradient.html",
0.5, 0.5,
GTK_SIGNAL_FUNC (ed_delete_gradient_callback),
NULL);
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
button = ed_create_button (_("Rename Gradient"), 0.5, 0.5,
button = ed_create_button (_("Rename Gradient"),
"dialogs/gradient_editor/rename_gradient.html",
0.5, 0.5,
GTK_SIGNAL_FUNC (ed_rename_gradient_callback),
NULL);
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
gtk_box_pack_start (GTK_BOX (gvbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
button = ed_create_button (_("Save as POV-Ray"), 0.5, 0.5,
button = ed_create_button (_("Save as POV-Ray"),
"dialogs/gradient_editor/save_as_pov_ray.html",
0.5, 0.5,
GTK_SIGNAL_FUNC (ed_save_pov_callback),
NULL);
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
......@@ -1012,7 +1023,7 @@ gradient_editor_create (void)
gtk_widget_show (hbox);
/* Zoom all button */
button = ed_create_button (_("Zoom all"), 0.5, 0.5,
button = ed_create_button (_("Zoom all"), NULL, 0.5, 0.5,
GTK_SIGNAL_FUNC (ed_zoom_all_callback),
g_editor);
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
......@@ -1352,6 +1363,7 @@ ed_update_editor (int flags)
static GtkWidget *
ed_create_button (gchar *label,
gchar *help_data,
gdouble xalign,
gdouble yalign,
GtkSignalFunc signal_func,
......@@ -1373,6 +1385,9 @@ ed_create_button (gchar *label,
signal_func,
data);
if (help_data)
gimp_help_set_help_data (button, NULL, help_data);
return button;
}
......@@ -1874,7 +1889,7 @@ ed_delete_gradient_callback (GtkWidget *widget,
gimp_standard_help_func,
"dialogs/gradient_editor/delete_gradient.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
FALSE, FALSE, FALSE,
_("Delete"), ed_do_delete_gradient_callback,
NULL, NULL, FALSE, FALSE,
......
......@@ -137,7 +137,7 @@ static void palette_entry_free (PaletteEntry *);
static void palette_entries_free (PaletteEntries *);
static void palette_entries_load (gchar *);
static void palette_entries_save (PaletteEntries *, gchar *);
static void palette_save_palettes ();
static void palette_save_palettes (void);
static void palette_entries_list_insert (PaletteEntries *entries);
......@@ -175,6 +175,9 @@ palettes_init (gint no_data)
{
if (!no_data)
datafiles_read_directories (palette_path, palette_entries_load, 0);
if (!default_palette_entries && palette_entries_list)
default_palette_entries = palette_entries_list->data;
}
void
......@@ -1787,13 +1790,13 @@ palette_dialog_new_callback (GtkWidget *widget,
}
static void
palette_dialog_delete_callback (GtkWidget *widget,
gpointer data)
palette_dialog_do_delete_callback (GtkWidget *widget,
gpointer data)
{
PaletteDialog *palette;
PaletteDialog *palette;
PaletteEntries *entries;
palette = data;
palette = (PaletteDialog *) data;
if (palette && palette->entries)
{
......@@ -1805,6 +1808,70 @@ palette_dialog_delete_callback (GtkWidget *widget,
palette_refresh_all ();
}
gtk_widget_destroy (gtk_widget_get_toplevel (widget));
gtk_widget_set_sensitive (palette->shell, TRUE);
}
static void
palette_dialog_cancel_delete_callback (GtkWidget *widget,
gpointer data)
{
PaletteDialog *palette;
palette = (PaletteDialog *) data;
gtk_widget_destroy (gtk_widget_get_toplevel (widget));
gtk_widget_set_sensitive (palette->shell, TRUE);
}