From cf1e3e4525b344993d3fa036cb20adb5f4723178 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Mon, 24 Mar 2008 23:03:23 +0000 Subject: [PATCH] only fiddle with GtkRecentManager when "save-document-history" is enabled. 2008-03-25 Sven Neumann * 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 --- ChangeLog | 9 +++ app/actions/documents-commands.c | 119 ++++++++++++++++--------------- app/config/gimprc-blurbs.h | 3 +- app/dialogs/preferences-dialog.c | 2 +- 4 files changed, 75 insertions(+), 58 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5691842990..aa2a5fac92 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-03-25 Sven Neumann + + * 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 * app/widgets/gimplanguagestore.[ch] diff --git a/app/actions/documents-commands.c b/app/actions/documents-commands.c index 942055fabe..98427c63fb 100644 --- a/app/actions/documents-commands.c +++ b/app/actions/documents-commands.c @@ -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 diff --git a/app/config/gimprc-blurbs.h b/app/config/gimprc-blurbs.h index 5ec7f4f1b8..45b104aa40 100644 --- a/app/config/gimprc-blurbs.h +++ b/app/config/gimprc-blurbs.h @@ -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.") diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c index 375b7f4620..f9052a0f7f 100644 --- a/app/dialogs/preferences-dialog.c +++ b/app/dialogs/preferences-dialog.c @@ -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));