Commit 2c6d7892 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

app/actions/edit-commands.c made the "Reset all tool options" and "Clear

2005-07-08  Michael Natterer  <mitch@gimp.org>

	* app/actions/edit-commands.c
	* app/actions/tool-options-commands.c: made the "Reset all tool
	options" and "Clear undo history" dialogs modal and simplified the
	code to use gimp_dialog_run() instead of a separate callback
	function.
parent 0cf2783c
2005-07-08 Michael Natterer <mitch@gimp.org>
* app/actions/edit-commands.c
* app/actions/tool-options-commands.c: made the "Reset all tool
options" and "Clear undo history" dialogs modal and simplified the
code to use gimp_dialog_run() instead of a separate callback
function.
2005-07-08 Michael Natterer <mitch@gimp.org>
* libgimpwidgets/gimppageselector.[ch]: moved all instance members
......
......@@ -59,9 +59,6 @@
static void edit_paste (GimpDisplay *gdisp,
gboolean paste_into);
static void edit_undo_clear_response (GtkWidget *dialog,
gint response_id,
GimpImage *gimage);
static void cut_named_buffer_callback (GtkWidget *widget,
const gchar *name,
gpointer data);
......@@ -108,7 +105,9 @@ edit_undo_clear_cmd_callback (GtkAction *action,
return_if_no_widget (widget, data);
dialog = gimp_message_dialog_new (_("Clear Undo History"), GIMP_STOCK_WARNING,
widget, 0,
widget,
GTK_DIALOG_MODAL |
GTK_DIALOG_DESTROY_WITH_PARENT,
gimp_standard_help_func,
GIMP_HELP_EDIT_UNDO_CLEAR,
......@@ -122,13 +121,13 @@ edit_undo_clear_cmd_callback (GtkAction *action,
GTK_RESPONSE_CANCEL,
-1);
g_signal_connect_object (gimage, "disconnect",
g_signal_connect_object (gtk_widget_get_toplevel (widget), "unmap",
G_CALLBACK (gtk_widget_destroy),
dialog, G_CONNECT_SWAPPED);
g_signal_connect (dialog, "response",
G_CALLBACK (edit_undo_clear_response),
gimage);
g_signal_connect_object (gimage, "disconnect",
G_CALLBACK (gtk_widget_destroy),
dialog, G_CONNECT_SWAPPED);
gimp_message_box_set_primary_text (GIMP_MESSAGE_DIALOG (dialog)->box,
_("Really clear image's undo history?"));
......@@ -147,7 +146,14 @@ edit_undo_clear_cmd_callback (GtkAction *action,
"image will gain %s of memory."), size);
g_free (size);
gtk_widget_show (dialog);
if (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK)
{
gimp_image_undo_disable (gimage);
gimp_image_undo_enable (gimage);
gimp_image_flush (gimage);
}
gtk_widget_destroy (dialog);
}
void
......@@ -355,21 +361,6 @@ edit_paste (GimpDisplay *gdisp,
}
}
static void
edit_undo_clear_response (GtkWidget *dialog,
gint response_id,
GimpImage *gimage)
{
gtk_widget_destroy (dialog);
if (response_id == GTK_RESPONSE_OK)
{
gimp_image_undo_disable (gimage);
gimp_image_undo_enable (gimage);
gimp_image_flush (gimage);
}
}
static void
cut_named_buffer_callback (GtkWidget *widget,
const gchar *name,
......
......@@ -181,28 +181,6 @@ tool_options_reset_cmd_callback (GtkAction *action,
gimp_tool_options_reset (tool_info->tool_options);
}
static void
tool_options_reset_all_response (GtkWidget *dialog,
gint response_id,
Gimp *gimp)
{
gtk_widget_destroy (dialog);
if (response_id == GTK_RESPONSE_OK)
{
GList *list;
for (list = GIMP_LIST (gimp->tool_info_list)->list;
list;
list = g_list_next (list))
{
GimpToolInfo *tool_info = list->data;
gimp_tool_options_reset (tool_info->tool_options);
}
}
}
void
tool_options_reset_all_cmd_callback (GtkAction *action,
gpointer data)
......@@ -211,7 +189,9 @@ tool_options_reset_all_cmd_callback (GtkAction *action,
GtkWidget *dialog;
dialog = gimp_message_dialog_new (_("Reset Tool Options"), GIMP_STOCK_QUESTION,
GTK_WIDGET (editor), 0,
GTK_WIDGET (editor),
GTK_DIALOG_MODAL |
GTK_DIALOG_DESTROY_WITH_PARENT,
gimp_standard_help_func, NULL,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
......@@ -224,19 +204,31 @@ tool_options_reset_all_cmd_callback (GtkAction *action,
GTK_RESPONSE_CANCEL,
-1);
g_signal_connect_object (editor, "unmap",
g_signal_connect_object (gtk_widget_get_toplevel (GTK_WIDGET (editor)),
"unmap",
G_CALLBACK (gtk_widget_destroy),
dialog, G_CONNECT_SWAPPED);
g_signal_connect (dialog, "response",
G_CALLBACK (tool_options_reset_all_response),
editor->ui_manager->gimp);
gimp_message_box_set_primary_text (GIMP_MESSAGE_DIALOG (dialog)->box,
_("Do you really want to reset all "
"tool options to default values?"));
gtk_widget_show (dialog);
if (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK)
{
Gimp *gimp = editor->ui_manager->gimp;
GList *list;
for (list = GIMP_LIST (gimp->tool_info_list)->list;
list;
list = g_list_next (list))
{
GimpToolInfo *tool_info = list->data;
gimp_tool_options_reset (tool_info->tool_options);
}
}
gtk_widget_destroy (dialog);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment