From 66b7fe24bac46cdc04ed408a5ac3da2b3766fc90 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Mon, 20 Jun 2005 19:28:49 +0000 Subject: [PATCH] app/actions/documents-actions.c app/actions/documents-commands.[ch] 2005-06-20 Michael Natterer * app/actions/documents-actions.c * app/actions/documents-commands.[ch] * app/widgets/gimphelp-ids.h * menus/documents-menu.xml: added "Clear document history" action, button, menu item and confirm dialog (bug #140001). --- ChangeLog | 8 ++++++ app/actions/documents-actions.c | 7 +++++ app/actions/documents-commands.c | 48 ++++++++++++++++++++++++++++++++ app/actions/documents-commands.h | 2 ++ menus/documents-menu.xml | 1 + 5 files changed, 66 insertions(+) diff --git a/ChangeLog b/ChangeLog index ddf641b664..7da10b95bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-06-20 Michael Natterer + + * app/actions/documents-actions.c + * app/actions/documents-commands.[ch] + * app/widgets/gimphelp-ids.h + * menus/documents-menu.xml: added "Clear document history" action, + button, menu item and confirm dialog (bug #140001). + 2005-06-20 Bill Skaggs * plug-ins/common/noisify.c: rename as "plug-in-rgb-noise" diff --git a/app/actions/documents-actions.c b/app/actions/documents-actions.c index e9514fe06f..142f7a6f2a 100644 --- a/app/actions/documents-actions.c +++ b/app/actions/documents-actions.c @@ -66,6 +66,12 @@ static GimpActionEntry documents_actions[] = G_CALLBACK (documents_remove_cmd_callback), GIMP_HELP_DOCUMENT_REMOVE }, + { "documents-clear", GTK_STOCK_CLEAR, + N_("_Clear History"), "", + N_("Clear the entire document history"), + G_CALLBACK (documents_clear_cmd_callback), + GIMP_HELP_DOCUMENT_CLEAR }, + { "documents-recreate-preview", GTK_STOCK_REFRESH, N_("Recreate _Preview"), "", N_("Recreate preview"), @@ -113,6 +119,7 @@ documents_actions_update (GimpActionGroup *group, SET_SENSITIVE ("documents-raise-or-open", imagefile); SET_SENSITIVE ("documents-file-open-dialog", TRUE); SET_SENSITIVE ("documents-remove", imagefile); + SET_SENSITIVE ("documents-clear", TRUE); SET_SENSITIVE ("documents-recreate-preview", imagefile); SET_SENSITIVE ("documents-reload-previews", imagefile); SET_SENSITIVE ("documents-remove-dangling", imagefile); diff --git a/app/actions/documents-commands.c b/app/actions/documents-commands.c index 15aa76570a..7d032d5767 100644 --- a/app/actions/documents-commands.c +++ b/app/actions/documents-commands.c @@ -30,6 +30,7 @@ #include "config/gimpcoreconfig.h" #include "core/gimp.h" +#include "core/gimp-documents.h" #include "core/gimpcontainer.h" #include "core/gimpcontext.h" #include "core/gimpimagefile.h" @@ -39,6 +40,8 @@ #include "widgets/gimpcontainerview.h" #include "widgets/gimpdocumentview.h" +#include "widgets/gimpmessagebox.h" +#include "widgets/gimpmessagedialog.h" #include "display/gimpdisplay.h" #include "display/gimpdisplay-foreach.h" @@ -164,6 +167,51 @@ documents_remove_cmd_callback (GtkAction *action, } } +void +documents_clear_cmd_callback (GtkAction *action, + gpointer data) +{ + GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data); + GimpContext *context; + GtkWidget *dialog; + + context = gimp_container_view_get_context (editor->view); + + dialog = gimp_message_dialog_new (_("Clear Document History"), + GIMP_STOCK_QUESTION, + GTK_WIDGET (editor), + GTK_DIALOG_MODAL | + GTK_DIALOG_DESTROY_WITH_PARENT, + gimp_standard_help_func, NULL, + + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_CLEAR, GTK_RESPONSE_OK, + + NULL); + + gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), + GTK_RESPONSE_OK, + GTK_RESPONSE_CANCEL, + -1); + + g_signal_connect_object (gtk_widget_get_toplevel (GTK_WIDGET (editor)), + "unmap", + G_CALLBACK (gtk_widget_destroy), + dialog, G_CONNECT_SWAPPED); + + gimp_message_box_set_primary_text (GIMP_MESSAGE_DIALOG (dialog)->box, + _("Do you really want to remove all " + "entries from the document history?")); + + if (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK) + { + gimp_container_clear (context->gimp->documents); + gimp_documents_save (context->gimp); + } + + gtk_widget_destroy (dialog); +} + void documents_recreate_preview_cmd_callback (GtkAction *action, gpointer data) diff --git a/app/actions/documents-commands.h b/app/actions/documents-commands.h index 024def5af4..772801c4ef 100644 --- a/app/actions/documents-commands.h +++ b/app/actions/documents-commands.h @@ -28,6 +28,8 @@ void documents_file_open_dialog_cmd_callback (GtkAction *action, gpointer data); void documents_remove_cmd_callback (GtkAction *action, gpointer data); +void documents_clear_cmd_callback (GtkAction *action, + gpointer data); void documents_recreate_preview_cmd_callback (GtkAction *action, gpointer data); void documents_reload_previews_cmd_callback (GtkAction *action, diff --git a/menus/documents-menu.xml b/menus/documents-menu.xml index 80213194e7..f230799cc3 100644 --- a/menus/documents-menu.xml +++ b/menus/documents-menu.xml @@ -7,6 +7,7 @@ +