[gimp] app: attach the "Reset all filters" dialog to Gimp
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: attach the "Reset all filters" dialog to Gimp
- Date: Sun, 25 Sep 2016 18:33:26 +0000 (UTC)
commit 99319182b7ce96aaeacca73f67cec1c698b6a287
Author: Michael Natterer <mitch gimp org>
Date: Sun Sep 25 20:32:50 2016 +0200
app: attach the "Reset all filters" dialog to Gimp
so it's not shown multiple times.
app/actions/plug-in-commands.c | 49 ++++++++++++++++++++++++++--------------
1 files changed, 32 insertions(+), 17 deletions(-)
---
diff --git a/app/actions/plug-in-commands.c b/app/actions/plug-in-commands.c
index 4092228..7ccfecb 100644
--- a/app/actions/plug-in-commands.c
+++ b/app/actions/plug-in-commands.c
@@ -49,6 +49,8 @@
#include "widgets/gimpmessagebox.h"
#include "widgets/gimpmessagedialog.h"
+#include "dialogs/dialogs.h"
+
#include "actions.h"
#include "plug-in-commands.h"
#include "procedure-commands.h"
@@ -164,31 +166,44 @@ plug_in_reset_all_cmd_callback (GtkAction *action,
GtkWidget *dialog;
return_if_no_gimp (gimp, data);
- dialog = gimp_message_dialog_new (_("Reset all Filters"), GIMP_STOCK_QUESTION,
- NULL, 0,
- gimp_standard_help_func, NULL,
+#define RESET_FILTERS_DIALOG_KEY "gimp-reset-all-filters-dialog"
+
+ dialog = dialogs_get_dialog (G_OBJECT (gimp), RESET_FILTERS_DIALOG_KEY);
+
+ if (! dialog)
+ {
+ 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,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GIMP_STOCK_RESET, GTK_RESPONSE_OK,
+ NULL);
- NULL);
+ gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
+ GTK_RESPONSE_OK,
+ GTK_RESPONSE_CANCEL,
+ -1);
- gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
- GTK_RESPONSE_OK,
- GTK_RESPONSE_CANCEL,
- -1);
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (plug_in_reset_all_response),
+ gimp);
- 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?"));
- gimp_message_box_set_primary_text (GIMP_MESSAGE_DIALOG (dialog)->box,
- _("Do you really want to reset all "
- "filters to default values?"));
+ dialogs_attach_dialog (G_OBJECT (gimp), RESET_FILTERS_DIALOG_KEY, dialog);
+ }
- gtk_widget_show (dialog);
+ gtk_window_present (GTK_WINDOW (dialog));
}
+
+/* private functions */
+
static void
plug_in_reset_all_response (GtkWidget *dialog,
gint response_id,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]