Do not any longer keep the document history in two places. We only use

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

	Do not any longer keep the document history in two places. We 
only
	use GtkRecentManager now:

	* app/core/Makefile.am
	* app/core/gimp-documents.[ch]: removed these files.

	* app/core/gimpdocumentlist.c: removed code to load and save the
	"documents" file.
	(gimp_document_list_add_uri): call gimp_recent_list_add_uri() 
here.

	* app/core/gimpimagefile.[ch]: added function to set the 
mime-type.

	* app/core/gimp.c (gimp_restore): removed code to load the
	document history.
	(gimp_real_exit): removed code to save it.
	
	* app/core/gimp-gui.[ch]: extended the vtable with a method to
	populate the document list.

	* app/gui/gui-vtable.c: added code to populate the document 
history
	from the list of recently used files kept by GtkRecentManager.

	* app/gui/gui.c (gui_restore_callback): load the recent files 
here.

	* app/file/file-open.c
	* app/file/file-save.c: no need to call 
gimp_recent_list_add_uri()
	any longer as gimp_document_list_add_uri() does that for us now.

	* app/actions/documents-commands.c 
(documents_clear_cmd_callback):
	purge the items from GtkRecentManager. Also changed the dialog 
to
	emphasize that this operation now affects the document history 
in
	all applications.

	* docs/gimp.1.in: removed reference to "documents" file.


svn path=/trunk/; revision=25190
This commit is contained in:
Sven Neumann 2008-03-24 11:11:15 +00:00 committed by Sven Neumann
parent b087159552
commit 3344c1b3bc
16 changed files with 146 additions and 301 deletions

View file

@ -1,3 +1,40 @@
2008-03-24 Sven Neumann <sven@gimp.org>
Do not any longer keep the document history in two places. We only
use GtkRecentManager now:
* app/core/Makefile.am
* app/core/gimp-documents.[ch]: removed these files.
* app/core/gimpdocumentlist.c: removed code to load and save the
"documents" file.
(gimp_document_list_add_uri): call gimp_recent_list_add_uri() here.
* app/core/gimpimagefile.[ch]: added function to set the mime-type.
* app/core/gimp.c (gimp_restore): removed code to load the
document history.
(gimp_real_exit): removed code to save it.
* app/core/gimp-gui.[ch]: extended the vtable with a method to
populate the document list.
* app/gui/gui-vtable.c: added code to populate the document history
from the list of recently used files kept by GtkRecentManager.
* app/gui/gui.c (gui_restore_callback): load the recent files here.
* app/file/file-open.c
* app/file/file-save.c: no need to call gimp_recent_list_add_uri()
any longer as gimp_document_list_add_uri() does that for us now.
* app/actions/documents-commands.c (documents_clear_cmd_callback):
purge the items from GtkRecentManager. Also changed the dialog to
emphasize that this operation now affects the document history in
all applications.
* docs/gimp.1.in: removed reference to "documents" file.
2008-03-23 Mukund Sivaraman <muks@mukund.org> 2008-03-23 Mukund Sivaraman <muks@mukund.org>
* HACKING: Updated section on getting dependencies, as we don't * HACKING: Updated section on getting dependencies, as we don't

View file

@ -30,7 +30,6 @@
#include "config/gimpcoreconfig.h" #include "config/gimpcoreconfig.h"
#include "core/gimp.h" #include "core/gimp.h"
#include "core/gimp-documents.h"
#include "core/gimpcontainer.h" #include "core/gimpcontainer.h"
#include "core/gimpcontext.h" #include "core/gimpcontext.h"
#include "core/gimpimagefile.h" #include "core/gimpimagefile.h"
@ -170,8 +169,17 @@ documents_remove_cmd_callback (GtkAction *action,
gpointer data) gpointer data)
{ {
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data); GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data);
GimpContext *context;
GimpImagefile *imagefile;
context = gimp_container_view_get_context (editor->view);
imagefile = gimp_context_get_imagefile (context);
gimp_container_view_remove_active (editor->view); gimp_container_view_remove_active (editor->view);
gtk_recent_manager_remove_item (gtk_recent_manager_get_default (),
gimp_object_get_name (GIMP_OBJECT (imagefile)),
NULL);
} }
void void
@ -207,12 +215,12 @@ documents_clear_cmd_callback (GtkAction *action,
dialog, G_CONNECT_SWAPPED); dialog, G_CONNECT_SWAPPED);
gimp_message_box_set_primary_text (GIMP_MESSAGE_DIALOG (dialog)->box, gimp_message_box_set_primary_text (GIMP_MESSAGE_DIALOG (dialog)->box,
_("Remove all entries from the " _("Clear the Recent Documents list?"));
"document history?"));
gimp_message_box_set_text (GIMP_MESSAGE_DIALOG (dialog)->box, gimp_message_box_set_text (GIMP_MESSAGE_DIALOG (dialog)->box,
_("Clearing the document history will permanently " _("Clearing the document history will permanently "
"remove all currently listed entries.")); "remove all items from the recent documents "
"list in all applications."));
if (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK) if (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK)
{ {
@ -221,7 +229,8 @@ documents_clear_cmd_callback (GtkAction *action,
gimp_container_clear (gimp->documents); gimp_container_clear (gimp->documents);
if (! gimp_documents_save (gimp, &error)) if (! gtk_recent_manager_purge_items (gtk_recent_manager_get_default (),
&error))
{ {
gimp_message (gimp, G_OBJECT (dialog), GIMP_MESSAGE_ERROR, gimp_message (gimp, G_OBJECT (dialog), GIMP_MESSAGE_ERROR,
"%s", error->message); "%s", error->message);

View file

@ -24,8 +24,6 @@ libappcore_a_sources = \
gimp.h \ gimp.h \
gimp-contexts.c \ gimp-contexts.c \
gimp-contexts.h \ gimp-contexts.h \
gimp-documents.c \
gimp-documents.h \
gimp-edit.c \ gimp-edit.c \
gimp-edit.h \ gimp-edit.h \
gimp-gradients.c \ gimp-gradients.c \

View file

@ -1,108 +0,0 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <glib-object.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpconfig/gimpconfig.h"
#include "core-types.h"
#include "config/gimpcoreconfig.h"
#include "gimp.h"
#include "gimp-documents.h"
#include "gimpdocumentlist.h"
/* functions to load and save the gimp documents files */
gboolean
gimp_documents_load (Gimp *gimp,
GError **error)
{
gchar *filename;
GError *my_error = NULL;
gboolean success;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
g_return_val_if_fail (GIMP_IS_DOCUMENT_LIST (gimp->documents), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
filename = gimp_personal_rc_file ("documents");
if (gimp->be_verbose)
g_print ("Parsing '%s'\n", gimp_filename_to_utf8 (filename));
success = gimp_config_deserialize_file (GIMP_CONFIG (gimp->documents),
filename,
GINT_TO_POINTER (gimp->config->thumbnail_size),
&my_error);
if (! success)
{
if (my_error->code == GIMP_CONFIG_ERROR_OPEN_ENOENT)
{
g_clear_error (&my_error);
success = TRUE;
}
else
{
g_propagate_error (error, my_error);
}
}
g_free (filename);
return success;
}
gboolean
gimp_documents_save (Gimp *gimp,
GError **error)
{
const gchar *header =
"GIMP documents\n"
"\n"
"This file will be entirely rewritten each time you exit.";
const gchar *footer =
"end of documents";
gchar *filename;
gboolean success;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
g_return_val_if_fail (GIMP_IS_DOCUMENT_LIST (gimp->documents), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
filename = gimp_personal_rc_file ("documents");
if (gimp->be_verbose)
g_print ("Writing '%s'\n", gimp_filename_to_utf8 (filename));
success = gimp_config_serialize_to_file (GIMP_CONFIG (gimp->documents),
filename,
header, footer, NULL,
error);
g_free (filename);
return success;
}

View file

@ -1,29 +0,0 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_DOCUMENTS_H__
#define __GIMP_DOCUMENTS_H__
gboolean gimp_documents_load (Gimp *gimp,
GError **error);
gboolean gimp_documents_save (Gimp *gimp,
GError **error);
#endif /* __GIMP_DOCUMENTS_H__ */

View file

@ -62,6 +62,7 @@ gimp_gui_init (Gimp *gimp)
gimp->gui.pdb_dialog_set = NULL; gimp->gui.pdb_dialog_set = NULL;
gimp->gui.pdb_dialog_close = NULL; gimp->gui.pdb_dialog_close = NULL;
gimp->gui.recent_list_add_uri = NULL; gimp->gui.recent_list_add_uri = NULL;
gimp->gui.recent_list_load = NULL;
} }
void void
@ -430,3 +431,12 @@ gimp_recent_list_add_uri (Gimp *gimp,
return FALSE; return FALSE;
} }
void
gimp_recent_list_load (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
if (gimp->gui.recent_list_load)
gimp->gui.recent_list_load (gimp);
}

View file

@ -84,6 +84,7 @@ struct _GimpGui
gboolean (* recent_list_add_uri) (Gimp *gimp, gboolean (* recent_list_add_uri) (Gimp *gimp,
const gchar *uri, const gchar *uri,
const gchar *mime_type); const gchar *mime_type);
void (* recent_list_load) (Gimp *gimp);
}; };
@ -154,5 +155,7 @@ gboolean gimp_pdb_dialog_close (Gimp *gimp,
gboolean gimp_recent_list_add_uri (Gimp *gimp, gboolean gimp_recent_list_add_uri (Gimp *gimp,
const gchar *uri, const gchar *uri,
const gchar *mime_type); const gchar *mime_type);
void gimp_recent_list_load (Gimp *gimp);
#endif /* __GIMP_GUI_H__ */ #endif /* __GIMP_GUI_H__ */

View file

@ -44,7 +44,6 @@
#include "gimp.h" #include "gimp.h"
#include "gimp-contexts.h" #include "gimp-contexts.h"
#include "gimp-documents.h"
#include "gimp-gradients.h" #include "gimp-gradients.h"
#include "gimp-modules.h" #include "gimp-modules.h"
#include "gimp-parasites.h" #include "gimp-parasites.h"
@ -624,8 +623,6 @@ static gboolean
gimp_real_exit (Gimp *gimp, gimp_real_exit (Gimp *gimp,
gboolean force) gboolean force)
{ {
GError *error = NULL;
if (gimp->be_verbose) if (gimp->be_verbose)
g_print ("EXIT: %s\n", G_STRFUNC); g_print ("EXIT: %s\n", G_STRFUNC);
@ -639,13 +636,6 @@ gimp_real_exit (Gimp *gimp,
gimp_fonts_reset (gimp); gimp_fonts_reset (gimp);
if (gimp->config->save_document_history)
if (! gimp_documents_save (gimp, &error))
{
gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, "%s", error->message);
g_clear_error (&error);
}
gimp_templates_save (gimp); gimp_templates_save (gimp);
gimp_parasiterc_save (gimp); gimp_parasiterc_save (gimp);
gimp_unitrc_save (gimp); gimp_unitrc_save (gimp);
@ -816,8 +806,6 @@ void
gimp_restore (Gimp *gimp, gimp_restore (Gimp *gimp,
GimpInitStatusFunc status_callback) GimpInitStatusFunc status_callback)
{ {
GError *error = NULL;
g_return_if_fail (GIMP_IS_GIMP (gimp)); g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (status_callback != NULL); g_return_if_fail (status_callback != NULL);
@ -849,20 +837,12 @@ gimp_restore (Gimp *gimp,
if (! gimp->no_fonts) if (! gimp->no_fonts)
gimp_fonts_load (gimp); gimp_fonts_load (gimp);
/* initialize the document history */
status_callback (NULL, _("Documents"), 0.6);
if (! gimp_documents_load (gimp, &error))
{
gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, "%s", error->message);
g_clear_error (&error);
}
/* initialize the template list */ /* initialize the template list */
status_callback (NULL, _("Templates"), 0.7); status_callback (NULL, _("Templates"), 0.6);
gimp_templates_load (gimp); gimp_templates_load (gimp);
/* initialize the module list */ /* initialize the module list */
status_callback (NULL, _("Modules"), 0.8); status_callback (NULL, _("Modules"), 0.7);
gimp_modules_load (gimp); gimp_modules_load (gimp);
g_signal_emit (gimp, gimp_signals[RESTORE], 0, status_callback); g_signal_emit (gimp, gimp_signals[RESTORE], 0, status_callback);

View file

@ -24,26 +24,14 @@
#include "core-types.h" #include "core-types.h"
#include "config/gimpcoreconfig.h"
#include "gimp.h" #include "gimp.h"
#include "gimpdocumentlist.h" #include "gimpdocumentlist.h"
#include "gimpimagefile.h" #include "gimpimagefile.h"
static void gimp_document_list_config_iface_init (GimpConfigInterface *iface); G_DEFINE_TYPE (GimpDocumentList, gimp_document_list, GIMP_TYPE_LIST)
static gboolean gimp_document_list_serialize (GimpConfig *config,
GimpConfigWriter *writer,
gpointer data);
static gboolean gimp_document_list_deserialize (GimpConfig *config,
GScanner *scanner,
gint nest_level,
gpointer data);
G_DEFINE_TYPE_WITH_CODE (GimpDocumentList, gimp_document_list, GIMP_TYPE_LIST,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
gimp_document_list_config_iface_init))
static const gchar document_symbol[] = "document";
static void static void
@ -56,99 +44,6 @@ gimp_document_list_init (GimpDocumentList *list)
{ {
} }
static void
gimp_document_list_config_iface_init (GimpConfigInterface *iface)
{
iface->serialize = gimp_document_list_serialize;
iface->deserialize = gimp_document_list_deserialize;
}
static gboolean
gimp_document_list_serialize (GimpConfig *config,
GimpConfigWriter *writer,
gpointer data)
{
GList *list;
for (list = GIMP_LIST (config)->list; list; list = list->next)
{
gimp_config_writer_open (writer, document_symbol);
gimp_config_writer_string (writer, GIMP_OBJECT (list->data)->name);
gimp_config_writer_close (writer);
}
return TRUE;
}
static gboolean
gimp_document_list_deserialize (GimpConfig *config,
GScanner *scanner,
gint nest_level,
gpointer data)
{
GimpDocumentList *document_list = GIMP_DOCUMENT_LIST (config);
GTokenType token;
gint size;
size = GPOINTER_TO_INT (data);
g_scanner_scope_add_symbol (scanner, 0,
document_symbol, (gpointer) document_symbol);
token = G_TOKEN_LEFT_PAREN;
while (g_scanner_peek_next_token (scanner) == token)
{
token = g_scanner_get_next_token (scanner);
switch (token)
{
case G_TOKEN_LEFT_PAREN:
token = G_TOKEN_SYMBOL;
break;
case G_TOKEN_SYMBOL:
token = G_TOKEN_RIGHT_PAREN;
if (scanner->value.v_symbol == document_symbol)
{
gchar *uri = NULL;
if (! gimp_scanner_parse_string (scanner, &uri))
{
token = G_TOKEN_STRING;
break;
}
if (uri)
{
GimpImagefile *imagefile;
imagefile = gimp_imagefile_new (document_list->gimp, uri);
g_free (uri);
gimp_container_add (GIMP_CONTAINER (document_list),
GIMP_OBJECT (imagefile));
g_object_unref (imagefile);
}
}
break;
case G_TOKEN_RIGHT_PAREN:
token = G_TOKEN_LEFT_PAREN;
break;
default: /* do nothing */
break;
}
}
gimp_list_reverse (GIMP_LIST (document_list));
return gimp_config_deserialize_return (scanner, token, nest_level);
}
GimpContainer * GimpContainer *
gimp_document_list_new (Gimp *gimp) gimp_document_list_new (Gimp *gimp)
{ {
@ -172,12 +67,15 @@ gimp_document_list_add_uri (GimpDocumentList *document_list,
const gchar *uri, const gchar *uri,
const gchar *mime_type) const gchar *mime_type)
{ {
Gimp *gimp;
GimpImagefile *imagefile; GimpImagefile *imagefile;
GimpContainer *container; GimpContainer *container;
g_return_val_if_fail (GIMP_IS_DOCUMENT_LIST (document_list), NULL); g_return_val_if_fail (GIMP_IS_DOCUMENT_LIST (document_list), NULL);
g_return_val_if_fail (uri != NULL, NULL); g_return_val_if_fail (uri != NULL, NULL);
gimp = document_list->gimp;
container = GIMP_CONTAINER (document_list); container = GIMP_CONTAINER (document_list);
imagefile = (GimpImagefile *) gimp_container_get_child_by_name (container, imagefile = (GimpImagefile *) gimp_container_get_child_by_name (container,
@ -189,14 +87,15 @@ gimp_document_list_add_uri (GimpDocumentList *document_list,
} }
else else
{ {
imagefile = gimp_imagefile_new (document_list->gimp, uri); imagefile = gimp_imagefile_new (gimp, uri);
gimp_container_add (container, GIMP_OBJECT (imagefile)); gimp_container_add (container, GIMP_OBJECT (imagefile));
g_object_unref (imagefile); g_object_unref (imagefile);
} }
g_object_set (imagefile->thumbnail, gimp_imagefile_set_mime_type (imagefile, mime_type);
"image-mimetype", mime_type,
NULL); if (gimp->config->save_document_history)
gimp_recent_list_add_uri (gimp, uri, mime_type);
return imagefile; return imagefile;
} }

View file

@ -183,6 +183,17 @@ gimp_imagefile_new (Gimp *gimp,
return imagefile; return imagefile;
} }
void
gimp_imagefile_set_mime_type (GimpImagefile *imagefile,
const gchar *mime_type)
{
g_return_if_fail (GIMP_IS_IMAGEFILE (imagefile));
g_object_set (imagefile->thumbnail,
"image-mimetype", mime_type,
NULL);
}
void void
gimp_imagefile_update (GimpImagefile *imagefile) gimp_imagefile_update (GimpImagefile *imagefile)
{ {

View file

@ -47,7 +47,6 @@ struct _GimpImagefile
Gimp *gimp; Gimp *gimp;
GimpThumbnail *thumbnail; GimpThumbnail *thumbnail;
gchar *mime_type;
gchar *description; gchar *description;
gboolean static_desc; gboolean static_desc;
}; };
@ -64,6 +63,8 @@ GType gimp_imagefile_get_type (void) G_GNUC_CONST;
GimpImagefile * gimp_imagefile_new (Gimp *gimp, GimpImagefile * gimp_imagefile_new (Gimp *gimp,
const gchar *uri); const gchar *uri);
void gimp_imagefile_set_mime_type (GimpImagefile *imagefile,
const gchar *mime_type);
void gimp_imagefile_update (GimpImagefile *imagefile); void gimp_imagefile_update (GimpImagefile *imagefile);
void gimp_imagefile_create_thumbnail (GimpImagefile *imagefile, void gimp_imagefile_create_thumbnail (GimpImagefile *imagefile,
GimpContext *context, GimpContext *context,

View file

@ -362,9 +362,6 @@ file_open_with_proc_and_display (Gimp *gimp,
gimp_imagefile_save_thumbnail (imagefile, mime_type, image); gimp_imagefile_save_thumbnail (imagefile, mime_type, image);
} }
} }
if (gimp->config->save_document_history)
gimp_recent_list_add_uri (gimp, uri, mime_type);
} }
/* the display owns the image now */ /* the display owns the image now */
@ -448,9 +445,6 @@ file_open_layers (Gimp *gimp,
gimp_document_list_add_uri (GIMP_DOCUMENT_LIST (gimp->documents), gimp_document_list_add_uri (GIMP_DOCUMENT_LIST (gimp->documents),
uri, mime_type); uri, mime_type);
if (gimp->config->save_document_history)
gimp_recent_list_add_uri (gimp, uri, mime_type);
} }
else else
{ {

View file

@ -183,9 +183,6 @@ file_save (GimpImage *image,
/* only save a thumbnail if we are saving as XCF, see bug #25272 */ /* only save a thumbnail if we are saving as XCF, see bug #25272 */
if (GIMP_PROCEDURE (file_proc)->proc_type == GIMP_INTERNAL) if (GIMP_PROCEDURE (file_proc)->proc_type == GIMP_INTERNAL)
gimp_imagefile_save_thumbnail (imagefile, file_proc->mime_type, image); gimp_imagefile_save_thumbnail (imagefile, file_proc->mime_type, image);
if (image->gimp->config->save_document_history)
gimp_recent_list_add_uri (image->gimp, uri, file_proc->mime_type);
} }
else if (status != GIMP_PDB_CANCEL) else if (status != GIMP_PDB_CANCEL)
{ {

View file

@ -35,6 +35,8 @@
#include "core/gimpcontext.h" #include "core/gimpcontext.h"
#include "core/gimpgradient.h" #include "core/gimpgradient.h"
#include "core/gimpimage.h" #include "core/gimpimage.h"
#include "core/gimpimagefile.h"
#include "core/gimplist.h"
#include "core/gimppalette.h" #include "core/gimppalette.h"
#include "core/gimppattern.h" #include "core/gimppattern.h"
#include "core/gimpprogress.h" #include "core/gimpprogress.h"
@ -123,6 +125,8 @@ static gboolean gui_pdb_dialog_close (Gimp *gimp,
static gboolean gui_recent_list_add_uri (Gimp *gimp, static gboolean gui_recent_list_add_uri (Gimp *gimp,
const gchar *uri, const gchar *uri,
const gchar *mime_type); const gchar *mime_type);
static void gui_recent_list_load (Gimp *gimp);
/* public functions */ /* public functions */
@ -153,6 +157,7 @@ gui_vtable_init (Gimp *gimp)
gimp->gui.pdb_dialog_set = gui_pdb_dialog_set; gimp->gui.pdb_dialog_set = gui_pdb_dialog_set;
gimp->gui.pdb_dialog_close = gui_pdb_dialog_close; gimp->gui.pdb_dialog_close = gui_pdb_dialog_close;
gimp->gui.recent_list_add_uri = gui_recent_list_add_uri; gimp->gui.recent_list_add_uri = gui_recent_list_add_uri;
gimp->gui.recent_list_load = gui_recent_list_load;
} }
@ -593,17 +598,12 @@ gui_recent_list_add_uri (Gimp *gimp,
const gchar *uri, const gchar *uri,
const gchar *mime_type) const gchar *mime_type)
{ {
GtkRecentManager *manager; GtkRecentData recent;
GtkRecentData recent; const gchar *groups[2] = { "Graphics", NULL };
const gchar *groups[2] = { "Graphics", NULL };
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE); g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
g_return_val_if_fail (uri != NULL, FALSE); g_return_val_if_fail (uri != NULL, FALSE);
manager = gtk_recent_manager_get_default ();
g_return_val_if_fail (manager != NULL, FALSE);
/* use last part of the URI */ /* use last part of the URI */
recent.display_name = NULL; recent.display_name = NULL;
@ -616,5 +616,47 @@ gui_recent_list_add_uri (Gimp *gimp,
recent.groups = (gchar **) groups; recent.groups = (gchar **) groups;
recent.is_private = FALSE; recent.is_private = FALSE;
return gtk_recent_manager_add_full (manager, uri, &recent); return gtk_recent_manager_add_full (gtk_recent_manager_get_default (),
uri, &recent);
}
static void
gui_recent_list_load (Gimp *gimp)
{
GList *items;
GList *list;
g_return_if_fail (GIMP_IS_GIMP (gimp));
gimp_container_freeze (gimp->documents);
gimp_container_clear (gimp->documents);
items = gtk_recent_manager_get_items (gtk_recent_manager_get_default ());
for (list = items; list; list = list->next)
{
GtkRecentInfo *info = list->data;
if (gtk_recent_info_has_application (info,
"GNU Image Manipulation Program"))
{
GimpImagefile *imagefile;
imagefile = gimp_imagefile_new (gimp,
gtk_recent_info_get_uri (info));
gimp_imagefile_set_mime_type (imagefile,
gtk_recent_info_get_mime_type (info));
gimp_container_add (gimp->documents, GIMP_OBJECT (imagefile));
g_object_unref (imagefile);
}
gtk_recent_info_unref (info);
}
g_list_free (items);
gimp_list_reverse (GIMP_LIST (gimp->documents));
gimp_container_thaw (gimp->documents);
} }

View file

@ -436,7 +436,11 @@ gui_restore_callback (Gimp *gimp,
g_type_class_unref (g_type_class_ref (GIMP_TYPE_COLOR_SELECTOR_PALETTE)); g_type_class_unref (g_type_class_ref (GIMP_TYPE_COLOR_SELECTOR_PALETTE));
(* status_callback) (NULL, _("Tool Options"), 1.0); /* initialize the document history */
status_callback (NULL, _("Documents"), 0.9);
gimp_recent_list_load (gimp);
status_callback (NULL, _("Tool Options"), 1.0);
gimp_tools_restore (gimp); gimp_tools_restore (gimp);
} }

View file

@ -1,4 +1,4 @@
.TH GIMP 1 "February 23 2008" "Version @GIMP_VERSION@" "GIMP Manual Pages" .TH GIMP 1 "March 23 2008" "Version @GIMP_VERSION@" "GIMP Manual Pages"
.SH NAME .SH NAME
gimp - an image manipulation and paint program. gimp - an image manipulation and paint program.
@ -193,9 +193,6 @@ placed in users' home directories the first time GIMP is run.
together with the tool, colors, brush, pattern and gradient together with the tool, colors, brush, pattern and gradient
associated to that device. associated to that device.
\fB$HOME\fP/@gimpdir@/documents - lists all images that have been
opened or saved using GIMP.
\fB$HOME\fP/@gimpdir@/gtkrc - users set of GIMP-specific GTK config \fB$HOME\fP/@gimpdir@/gtkrc - users set of GIMP-specific GTK config
settings. Options such as widget color and fonts sizes can be set settings. Options such as widget color and fonts sizes can be set
here. here.