Commit abc9110b authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

app/actions/plug-in-commands.c app/actions/templates-commands.c ported

2004-10-13  Sven Neumann  <sven@gimp.org>

	* app/actions/plug-in-commands.c
	* app/actions/templates-commands.c
	* app/actions/tool-options-commands.c: ported more boolean queries
	to GimpMessageDialog.
parent 2b2737f2
2004-10-13 Sven Neumann <sven@gimp.org>
* app/actions/plug-in-commands.c
* app/actions/templates-commands.c
* app/actions/tool-options-commands.c: ported more boolean queries
to GimpMessageDialog.
2004-10-13 Sven Neumann <sven@gimp.org>
 
* app/widgets/gimpmessagedialog.c: handle parent widget not being
......
......@@ -146,7 +146,7 @@ data_delete_data_cmd_callback (GtkAction *action,
delete_data->factory = view->factory;
delete_data->data = data;
dialog = gimp_message_dialog_new (_("Delete Object"), GIMP_STOCK_WARNING,
dialog = gimp_message_dialog_new (_("Delete Object"), GIMP_STOCK_QUESTION,
GTK_WIDGET (view), 0,
gimp_standard_help_func, NULL,
......
......@@ -36,6 +36,8 @@
#include "plug-in/plug-in-proc-def.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpmessagebox.h"
#include "widgets/gimpmessagedialog.h"
#include "display/gimpdisplay.h"
......@@ -47,9 +49,9 @@
/* local function prototypes */
static void plug_in_reset_all_callback (GtkWidget *widget,
gboolean reset_all,
gpointer data);
static void plug_in_reset_all_response (GtkWidget *dialog,
gint response_id,
Gimp *gimp);
/* public functions */
......@@ -185,37 +187,42 @@ void
plug_in_reset_all_cmd_callback (GtkAction *action,
gpointer data)
{
Gimp *gimp;
GtkWidget *qbox;
Gimp *gimp = action_data_get_gimp (data);
GtkWidget *dialog;
gimp = action_data_get_gimp (data);
if (! gimp)
return;
qbox = gimp_query_boolean_box (_("Reset all Filters"),
NULL,
gimp_standard_help_func,
GIMP_HELP_FILTER_RESET_ALL,
GTK_STOCK_DIALOG_QUESTION,
_("Do you really want to reset all "
"filters to default values?"),
GIMP_STOCK_RESET, GTK_STOCK_CANCEL,
NULL, NULL,
plug_in_reset_all_callback,
gimp);
gtk_widget_show (qbox);
dialog = gimp_message_dialog_new (_("Reset all Filters"), GIMP_STOCK_QUESTION,
NULL, 0,
gimp_standard_help_func, NULL,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GIMP_STOCK_RESET, GTK_RESPONSE_OK,
NULL);
g_signal_connect (dialog, "response",
G_CALLBACK (plug_in_reset_all_response),
gimp);
gimp_message_box_set_primary_text (GIMP_MESSAGE_DIALOG (dialog)->box,
_("Do you really want to reset all "
"filters to default values?"));
gtk_widget_show (dialog);
}
/* private functions */
static void
plug_in_reset_all_callback (GtkWidget *widget,
gboolean reset_all,
gpointer data)
plug_in_reset_all_response (GtkWidget *dialog,
gint response_id,
Gimp *gimp)
{
Gimp *gimp = GIMP (data);
gtk_widget_destroy (dialog);
if (reset_all)
if (response_id == GTK_RESPONSE_OK)
procedural_db_free_data (gimp);
}
......@@ -36,6 +36,8 @@
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpmessagebox.h"
#include "widgets/gimpmessagedialog.h"
#include "widgets/gimptemplateeditor.h"
#include "widgets/gimptemplateview.h"
#include "widgets/gimpviewabledialog.h"
......@@ -153,20 +155,20 @@ struct _GimpTemplateDeleteData
};
static void
templates_delete_template_callback (GtkWidget *widget,
gboolean delete,
gpointer data)
templates_delete_confirm_response (GtkWidget *dialog,
gint response_id,
GimpTemplateDeleteData *delete_data)
{
GimpTemplateDeleteData *delete_data = data;
if (! delete)
return;
gtk_widget_destroy (dialog);
if (gimp_container_have (delete_data->container,
GIMP_OBJECT (delete_data->template)))
if (response_id == GTK_RESPONSE_OK)
{
gimp_container_remove (delete_data->container,
GIMP_OBJECT (delete_data->template));
if (gimp_container_have (delete_data->container,
GIMP_OBJECT (delete_data->template)))
{
gimp_container_remove (delete_data->container,
GIMP_OBJECT (delete_data->template));
}
}
}
......@@ -188,32 +190,35 @@ templates_delete_template_cmd_callback (GtkAction *action,
{
GimpTemplateDeleteData *delete_data;
GtkWidget *dialog;
gchar *str;
delete_data = g_new0 (GimpTemplateDeleteData, 1);
delete_data->container = container;
delete_data->template = template;
str = g_strdup_printf (_("Are you sure you want to delete template '%s' "
"from the list and from disk?"),
GIMP_OBJECT (template)->name);
dialog =
gimp_message_dialog_new (_("Delete Template"), GIMP_STOCK_QUESTION,
GTK_WIDGET (editor), 0,
gimp_standard_help_func, NULL,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_DELETE, GTK_RESPONSE_OK,
dialog = gimp_query_boolean_box (_("Delete Template"),
GTK_WIDGET (editor),
gimp_standard_help_func, NULL,
GIMP_STOCK_QUESTION,
str,
GTK_STOCK_DELETE, GTK_STOCK_CANCEL,
G_OBJECT (template),
"disconnect",
templates_delete_template_callback,
delete_data);
NULL);
g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) g_free, delete_data);
g_signal_connect_object (template, "disconnect",
G_CALLBACK (gtk_widget_destroy),
dialog, G_CONNECT_SWAPPED);
g_free (str);
g_signal_connect (dialog, "response",
G_CALLBACK (templates_delete_confirm_response),
delete_data);
gimp_message_box_set_primary_text (GIMP_MESSAGE_DIALOG (dialog)->box,
_("Are you sure you want to delete "
"template '%s' from the list and "
"from disk?"),
GIMP_OBJECT (template)->name);
gtk_widget_show (dialog);
}
}
......
......@@ -36,6 +36,8 @@
#include "widgets/gimpeditor.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpmessagebox.h"
#include "widgets/gimpmessagedialog.h"
#include "widgets/gimptooloptionseditor.h"
#include "widgets/gimpuimanager.h"
......@@ -182,13 +184,13 @@ tool_options_reset_cmd_callback (GtkAction *action,
}
static void
tool_options_reset_all_callback (GtkWidget *widget,
gboolean reset_all,
gpointer data)
tool_options_reset_all_response (GtkWidget *dialog,
gint response_id,
Gimp *gimp)
{
Gimp *gimp = GIMP (data);
gtk_widget_destroy (dialog);
if (reset_all)
if (response_id == GTK_RESPONSE_OK)
{
GList *list;
......@@ -208,20 +210,30 @@ tool_options_reset_all_cmd_callback (GtkAction *action,
gpointer data)
{
GimpEditor *editor = GIMP_EDITOR (data);
GtkWidget *qbox;
qbox = gimp_query_boolean_box (_("Reset Tool Options"),
GTK_WIDGET (editor),
gimp_standard_help_func,
GIMP_HELP_TOOL_OPTIONS_RESET,
GTK_STOCK_DIALOG_QUESTION,
_("Do you really want to reset all "
"tool options to default values?"),
GIMP_STOCK_RESET, GTK_STOCK_CANCEL,
G_OBJECT (editor), "unmap",
tool_options_reset_all_callback,
editor->ui_manager->gimp);
gtk_widget_show (qbox);
GtkWidget *dialog;
dialog = gimp_message_dialog_new (_("Reset Tool Options"), GIMP_STOCK_QUESTION,
GTK_WIDGET (editor), 0,
gimp_standard_help_func, NULL,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GIMP_STOCK_RESET, GTK_RESPONSE_OK,
NULL);
g_signal_connect_object (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);
}
......
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