gimp r27622 - in trunk: . app/actions



Author: neo
Date: Tue Nov 11 20:37:15 2008
New Revision: 27622
URL: http://svn.gnome.org/viewvc/gimp?rev=27622&view=rev

Log:
2008-11-11  Sven Neumann  <sven gimp org>

	Bug 560300 â Document History did not clear when "Keep record of
	used files" was unchecked
	
	* app/actions/documents-commands.c 
(documents_clear_cmd_callback):
	don't purge the entire GtkRecentManager, but only clear items
	added by GIMP. Do this regardless of the "save-document-history"
	gimprc option.



Modified:
   trunk/ChangeLog
   trunk/app/actions/documents-commands.c

Modified: trunk/app/actions/documents-commands.c
==============================================================================
--- trunk/app/actions/documents-commands.c	(original)
+++ trunk/app/actions/documents-commands.c	Tue Nov 11 20:37:15 2008
@@ -170,15 +170,12 @@
 {
   GimpContainerEditor *editor  = GIMP_CONTAINER_EDITOR (data);
   GimpContext         *context = gimp_container_view_get_context (editor->view);
+  GimpImagefile       *imagefile = gimp_context_get_imagefile (context);
+  const gchar         *uri;
 
-  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);
 }
@@ -190,65 +187,67 @@
   GimpContainerEditor *editor  = GIMP_CONTAINER_EDITOR (data);
   GimpContext         *context = gimp_container_view_get_context (editor->view);
   Gimp                *gimp    = context->gimp;
+  GtkWidget           *dialog;
 
-  if (gimp->config->save_document_history)
-    {
-      GtkWidget *dialog;
+  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,
 
-      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."));
+                                    GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+                                    GTK_STOCK_CLEAR,  GTK_RESPONSE_OK,
 
-      if (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK)
-        {
-          GError *error = NULL;
+                                    NULL);
 
-          gimp_container_clear (gimp->documents);
+  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
+                                           GTK_RESPONSE_OK,
+                                           GTK_RESPONSE_CANCEL,
+                                           -1);
 
-          gtk_recent_manager_purge_items (gtk_recent_manager_get_default (),
-                                          &error);
+  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 images from "
+                               "the recent documents list."));
+
+  if (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK)
+    {
+      GtkRecentManager *manager = gtk_recent_manager_get_default ();
+      GList            *items;
+      GList            *list;
 
-          if (error)
+      items = gtk_recent_manager_get_items (manager);
+
+      for (list = items; list; list = list->next)
+        {
+          GtkRecentInfo *info = list->data;
+
+          if (gtk_recent_info_has_application (info,
+                                               "GNU Image Manipulation Program"))
             {
-              gimp_message_literal (gimp, G_OBJECT (dialog), GIMP_MESSAGE_ERROR,
-				    error->message);
-              g_clear_error (&error);
+              gtk_recent_manager_remove_item (manager,
+                                              gtk_recent_info_get_uri (info),
+                                              NULL);
             }
+
+          gtk_recent_info_unref (info);
         }
 
-      gtk_widget_destroy (dialog);
-    }
-  else
-    {
+      g_list_free (items);
+
       gimp_container_clear (gimp->documents);
     }
+
+  gtk_widget_destroy (dialog);
 }
 
 void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]