only fiddle with GtkRecentManager when "save-document-history" is enabled.

2008-03-25  Sven Neumann  <sven@gimp.org>

	* app/actions/documents-commands.c: only fiddle with
	GtkRecentManager when "save-document-history" is enabled.

	* app/config/gimprc-blurbs.h
	* app/dialogs/preferences-dialog.c: changed description and 
label
	for the "save-document-history" option.


svn path=/trunk/; revision=25212
This commit is contained in:
Sven Neumann 2008-03-24 23:03:23 +00:00 committed by Sven Neumann
parent 244b50a357
commit cf1e3e4525
4 changed files with 75 additions and 58 deletions

View File

@ -1,3 +1,12 @@
2008-03-25 Sven Neumann <sven@gimp.org>
* app/actions/documents-commands.c: only fiddle with
GtkRecentManager when "save-document-history" is enabled.
* app/config/gimprc-blurbs.h
* app/dialogs/preferences-dialog.c: changed description and label
for the "save-document-history" option.
2008-03-24 Sven Neumann <sven@gimp.org>
* app/widgets/gimplanguagestore.[ch]

View File

@ -168,17 +168,17 @@ void
documents_remove_cmd_callback (GtkAction *action,
gpointer data)
{
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data);
GimpContext *context;
GimpImagefile *imagefile;
const gchar *uri;
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data);
GimpContext *context = gimp_container_view_get_context (editor->view);
context = gimp_container_view_get_context (editor->view);
imagefile = gimp_context_get_imagefile (context);
if (context->gimp->config->save_document_history)
{
GimpImagefile *imagefile = gimp_context_get_imagefile (context);
const gchar *uri = gimp_object_get_name (GIMP_OBJECT (imagefile));
uri = gimp_object_get_name (GIMP_OBJECT (imagefile));
gtk_recent_manager_remove_item (gtk_recent_manager_get_default (), uri, NULL);
gtk_recent_manager_remove_item (gtk_recent_manager_get_default (),
uri, NULL);
}
gimp_container_view_remove_active (editor->view);
}
@ -187,59 +187,66 @@ void
documents_clear_cmd_callback (GtkAction *action,
gpointer data)
{
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data);
GimpContext *context;
GtkWidget *dialog;
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data);
GimpContext *context = gimp_container_view_get_context (editor->view);
Gimp *gimp = context->gimp;
context = gimp_container_view_get_context (editor->view);
dialog = gimp_message_dialog_new (_("Clear Document History"),
GTK_STOCK_CLEAR,
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,
_("Clear the Recent Documents list?"));
gimp_message_box_set_text (GIMP_MESSAGE_DIALOG (dialog)->box,
_("Clearing the document history will permanently "
"remove all items from the recent documents "
"list in all applications."));
if (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK)
if (gimp->config->save_document_history)
{
Gimp *gimp = context->gimp;
GError *error = NULL;
GtkWidget *dialog;
gimp_container_clear (gimp->documents);
dialog = gimp_message_dialog_new (_("Clear Document History"),
GTK_STOCK_CLEAR,
GTK_WIDGET (editor),
GTK_DIALOG_MODAL |
GTK_DIALOG_DESTROY_WITH_PARENT,
gimp_standard_help_func, NULL,
if (! gtk_recent_manager_purge_items (gtk_recent_manager_get_default (),
&error))
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,
_("Clear the Recent Documents list?"));
gimp_message_box_set_text (GIMP_MESSAGE_DIALOG (dialog)->box,
_("Clearing the document history will "
"permanently remove all items from "
"the recent documents list in all "
"applications."));
if (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK)
{
gimp_message (gimp, G_OBJECT (dialog), GIMP_MESSAGE_ERROR,
"%s", error->message);
g_clear_error (&error);
}
}
GError *error = NULL;
gtk_widget_destroy (dialog);
gimp_container_clear (gimp->documents);
if (! gtk_recent_manager_purge_items (gtk_recent_manager_get_default (),
&error))
{
gimp_message (gimp, G_OBJECT (dialog), GIMP_MESSAGE_ERROR,
"%s", error->message);
g_clear_error (&error);
}
}
gtk_widget_destroy (dialog);
}
else
{
gimp_container_clear (gimp->documents);
}
}
void

View File

@ -266,7 +266,8 @@ N_("Remember the current tool, pattern, color, and brush across GIMP " \
"sessions.")
#define SAVE_DOCUMENT_HISTORY_BLURB \
N_("Add all opened and saved files to the document history on disk.")
N_("Keep a permanent record of all opened and saved files in the Recent " \
"Documents list.")
#define SAVE_SESSION_INFO_BLURB \
N_("Save the positions and sizes of the main dialogs when GIMP exits.")

View File

@ -1604,7 +1604,7 @@ prefs_dialog_new (Gimp *gimp,
vbox2 = prefs_frame_new (_("Document History"), GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (object, "save-document-history",
_("Save document _history on exit"),
_("Keep record of used files in the Recent Documents list"),
GTK_BOX (vbox2));