app/actions/documents-actions.c app/actions/documents-commands.[ch]

2005-06-20  Michael Natterer  <mitch@gimp.org>

	* 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).
This commit is contained in:
Michael Natterer 2005-06-20 19:28:49 +00:00 committed by Michael Natterer
parent bbb8d250d0
commit 66b7fe24ba
5 changed files with 66 additions and 0 deletions

View File

@ -1,3 +1,11 @@
2005-06-20 Michael Natterer <mitch@gimp.org>
* 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 <weskaggs@primate.ucdavis.edu>
* plug-ins/common/noisify.c: rename as "plug-in-rgb-noise"

View File

@ -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);

View File

@ -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)

View File

@ -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,

View File

@ -7,6 +7,7 @@
<menuitem action="documents-raise-or-open" />
<menuitem action="documents-file-open-dialog" />
<menuitem action="documents-remove" />
<menuitem action="documents-clear" />
<separator />
<menuitem action="documents-recreate-preview" />
<menuitem action="documents-reload-previews" />