gimp r25190 - in trunk: . app/actions app/core app/file app/gui docs
- From: neo svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r25190 - in trunk: . app/actions app/core app/file app/gui docs
- Date: Mon, 24 Mar 2008 11:11:15 +0000 (GMT)
Author: neo
Date: Mon Mar 24 11:11:15 2008
New Revision: 25190
URL: http://svn.gnome.org/viewvc/gimp?rev=25190&view=rev
Log:
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.
Removed:
trunk/app/core/gimp-documents.c
trunk/app/core/gimp-documents.h
Modified:
trunk/ChangeLog
trunk/app/actions/documents-commands.c
trunk/app/core/Makefile.am
trunk/app/core/gimp-gui.c
trunk/app/core/gimp-gui.h
trunk/app/core/gimp.c
trunk/app/core/gimpdocumentlist.c
trunk/app/core/gimpimagefile.c
trunk/app/core/gimpimagefile.h
trunk/app/file/file-open.c
trunk/app/file/file-save.c
trunk/app/gui/gui-vtable.c
trunk/app/gui/gui.c
trunk/docs/gimp.1.in
Modified: trunk/app/actions/documents-commands.c
==============================================================================
--- trunk/app/actions/documents-commands.c (original)
+++ trunk/app/actions/documents-commands.c Mon Mar 24 11:11:15 2008
@@ -30,7 +30,6 @@
#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"
@@ -170,8 +169,17 @@
gpointer 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);
+
+ gtk_recent_manager_remove_item (gtk_recent_manager_get_default (),
+ gimp_object_get_name (GIMP_OBJECT (imagefile)),
+ NULL);
}
void
@@ -207,12 +215,12 @@
dialog, G_CONNECT_SWAPPED);
gimp_message_box_set_primary_text (GIMP_MESSAGE_DIALOG (dialog)->box,
- _("Remove all entries from the "
- "document history?"));
+ _("Clear the Recent Documents list?"));
gimp_message_box_set_text (GIMP_MESSAGE_DIALOG (dialog)->box,
_("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)
{
@@ -221,7 +229,8 @@
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,
"%s", error->message);
Modified: trunk/app/core/Makefile.am
==============================================================================
--- trunk/app/core/Makefile.am (original)
+++ trunk/app/core/Makefile.am Mon Mar 24 11:11:15 2008
@@ -24,8 +24,6 @@
gimp.h \
gimp-contexts.c \
gimp-contexts.h \
- gimp-documents.c \
- gimp-documents.h \
gimp-edit.c \
gimp-edit.h \
gimp-gradients.c \
Modified: trunk/app/core/gimp-gui.c
==============================================================================
--- trunk/app/core/gimp-gui.c (original)
+++ trunk/app/core/gimp-gui.c Mon Mar 24 11:11:15 2008
@@ -62,6 +62,7 @@
gimp->gui.pdb_dialog_set = NULL;
gimp->gui.pdb_dialog_close = NULL;
gimp->gui.recent_list_add_uri = NULL;
+ gimp->gui.recent_list_load = NULL;
}
void
@@ -430,3 +431,12 @@
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);
+}
Modified: trunk/app/core/gimp-gui.h
==============================================================================
--- trunk/app/core/gimp-gui.h (original)
+++ trunk/app/core/gimp-gui.h Mon Mar 24 11:11:15 2008
@@ -84,6 +84,7 @@
gboolean (* recent_list_add_uri) (Gimp *gimp,
const gchar *uri,
const gchar *mime_type);
+ void (* recent_list_load) (Gimp *gimp);
};
@@ -154,5 +155,7 @@
gboolean gimp_recent_list_add_uri (Gimp *gimp,
const gchar *uri,
const gchar *mime_type);
+void gimp_recent_list_load (Gimp *gimp);
+
#endif /* __GIMP_GUI_H__ */
Modified: trunk/app/core/gimp.c
==============================================================================
--- trunk/app/core/gimp.c (original)
+++ trunk/app/core/gimp.c Mon Mar 24 11:11:15 2008
@@ -44,7 +44,6 @@
#include "gimp.h"
#include "gimp-contexts.h"
-#include "gimp-documents.h"
#include "gimp-gradients.h"
#include "gimp-modules.h"
#include "gimp-parasites.h"
@@ -624,8 +623,6 @@
gimp_real_exit (Gimp *gimp,
gboolean force)
{
- GError *error = NULL;
-
if (gimp->be_verbose)
g_print ("EXIT: %s\n", G_STRFUNC);
@@ -639,13 +636,6 @@
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_parasiterc_save (gimp);
gimp_unitrc_save (gimp);
@@ -816,8 +806,6 @@
gimp_restore (Gimp *gimp,
GimpInitStatusFunc status_callback)
{
- GError *error = NULL;
-
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (status_callback != NULL);
@@ -849,20 +837,12 @@
if (! gimp->no_fonts)
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 */
- status_callback (NULL, _("Templates"), 0.7);
+ status_callback (NULL, _("Templates"), 0.6);
gimp_templates_load (gimp);
/* initialize the module list */
- status_callback (NULL, _("Modules"), 0.8);
+ status_callback (NULL, _("Modules"), 0.7);
gimp_modules_load (gimp);
g_signal_emit (gimp, gimp_signals[RESTORE], 0, status_callback);
Modified: trunk/app/core/gimpdocumentlist.c
==============================================================================
--- trunk/app/core/gimpdocumentlist.c (original)
+++ trunk/app/core/gimpdocumentlist.c Mon Mar 24 11:11:15 2008
@@ -24,26 +24,14 @@
#include "core-types.h"
+#include "config/gimpcoreconfig.h"
+
#include "gimp.h"
#include "gimpdocumentlist.h"
#include "gimpimagefile.h"
-static void gimp_document_list_config_iface_init (GimpConfigInterface *iface);
-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";
+G_DEFINE_TYPE (GimpDocumentList, gimp_document_list, GIMP_TYPE_LIST)
static void
@@ -56,99 +44,6 @@
{
}
-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 *
gimp_document_list_new (Gimp *gimp)
{
@@ -172,12 +67,15 @@
const gchar *uri,
const gchar *mime_type)
{
+ Gimp *gimp;
GimpImagefile *imagefile;
GimpContainer *container;
g_return_val_if_fail (GIMP_IS_DOCUMENT_LIST (document_list), NULL);
g_return_val_if_fail (uri != NULL, NULL);
+ gimp = document_list->gimp;
+
container = GIMP_CONTAINER (document_list);
imagefile = (GimpImagefile *) gimp_container_get_child_by_name (container,
@@ -189,14 +87,15 @@
}
else
{
- imagefile = gimp_imagefile_new (document_list->gimp, uri);
+ imagefile = gimp_imagefile_new (gimp, uri);
gimp_container_add (container, GIMP_OBJECT (imagefile));
g_object_unref (imagefile);
}
- g_object_set (imagefile->thumbnail,
- "image-mimetype", mime_type,
- NULL);
+ gimp_imagefile_set_mime_type (imagefile, mime_type);
+
+ if (gimp->config->save_document_history)
+ gimp_recent_list_add_uri (gimp, uri, mime_type);
return imagefile;
}
Modified: trunk/app/core/gimpimagefile.c
==============================================================================
--- trunk/app/core/gimpimagefile.c (original)
+++ trunk/app/core/gimpimagefile.c Mon Mar 24 11:11:15 2008
@@ -184,6 +184,17 @@
}
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
gimp_imagefile_update (GimpImagefile *imagefile)
{
gchar *uri;
Modified: trunk/app/core/gimpimagefile.h
==============================================================================
--- trunk/app/core/gimpimagefile.h (original)
+++ trunk/app/core/gimpimagefile.h Mon Mar 24 11:11:15 2008
@@ -47,7 +47,6 @@
Gimp *gimp;
GimpThumbnail *thumbnail;
- gchar *mime_type;
gchar *description;
gboolean static_desc;
};
@@ -64,6 +63,8 @@
GimpImagefile * gimp_imagefile_new (Gimp *gimp,
const gchar *uri);
+void gimp_imagefile_set_mime_type (GimpImagefile *imagefile,
+ const gchar *mime_type);
void gimp_imagefile_update (GimpImagefile *imagefile);
void gimp_imagefile_create_thumbnail (GimpImagefile *imagefile,
GimpContext *context,
Modified: trunk/app/file/file-open.c
==============================================================================
--- trunk/app/file/file-open.c (original)
+++ trunk/app/file/file-open.c Mon Mar 24 11:11:15 2008
@@ -362,9 +362,6 @@
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 */
@@ -448,9 +445,6 @@
gimp_document_list_add_uri (GIMP_DOCUMENT_LIST (gimp->documents),
uri, mime_type);
-
- if (gimp->config->save_document_history)
- gimp_recent_list_add_uri (gimp, uri, mime_type);
}
else
{
Modified: trunk/app/file/file-save.c
==============================================================================
--- trunk/app/file/file-save.c (original)
+++ trunk/app/file/file-save.c Mon Mar 24 11:11:15 2008
@@ -183,9 +183,6 @@
/* only save a thumbnail if we are saving as XCF, see bug #25272 */
if (GIMP_PROCEDURE (file_proc)->proc_type == GIMP_INTERNAL)
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)
{
Modified: trunk/app/gui/gui-vtable.c
==============================================================================
--- trunk/app/gui/gui-vtable.c (original)
+++ trunk/app/gui/gui-vtable.c Mon Mar 24 11:11:15 2008
@@ -35,6 +35,8 @@
#include "core/gimpcontext.h"
#include "core/gimpgradient.h"
#include "core/gimpimage.h"
+#include "core/gimpimagefile.h"
+#include "core/gimplist.h"
#include "core/gimppalette.h"
#include "core/gimppattern.h"
#include "core/gimpprogress.h"
@@ -123,6 +125,8 @@
static gboolean gui_recent_list_add_uri (Gimp *gimp,
const gchar *uri,
const gchar *mime_type);
+static void gui_recent_list_load (Gimp *gimp);
+
/* public functions */
@@ -153,6 +157,7 @@
gimp->gui.pdb_dialog_set = gui_pdb_dialog_set;
gimp->gui.pdb_dialog_close = gui_pdb_dialog_close;
gimp->gui.recent_list_add_uri = gui_recent_list_add_uri;
+ gimp->gui.recent_list_load = gui_recent_list_load;
}
@@ -593,17 +598,12 @@
const gchar *uri,
const gchar *mime_type)
{
- GtkRecentManager *manager;
- GtkRecentData recent;
- const gchar *groups[2] = { "Graphics", NULL };
+ GtkRecentData recent;
+ const gchar *groups[2] = { "Graphics", NULL };
g_return_val_if_fail (GIMP_IS_GIMP (gimp), 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 */
recent.display_name = NULL;
@@ -616,5 +616,47 @@
recent.groups = (gchar **) groups;
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);
}
Modified: trunk/app/gui/gui.c
==============================================================================
--- trunk/app/gui/gui.c (original)
+++ trunk/app/gui/gui.c Mon Mar 24 11:11:15 2008
@@ -436,7 +436,11 @@
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);
}
Modified: trunk/docs/gimp.1.in
==============================================================================
--- trunk/docs/gimp.1.in (original)
+++ trunk/docs/gimp.1.in Mon Mar 24 11:11:15 2008
@@ -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
gimp - an image manipulation and paint program.
@@ -193,9 +193,6 @@
together with the tool, colors, brush, pattern and gradient
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
settings. Options such as widget color and fonts sizes can be set
here.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]