gimp r25964 - branches/soc-2008-tagging/app/core



Author: aurisj
Date: Tue Jun 17 20:52:31 2008
New Revision: 25964
URL: http://svn.gnome.org/viewvc/gimp?rev=25964&view=rev

Log:
2008-06-17  Aurimas JuÅka  <aurisj svn gnome org>

        Commited files missing in the last commit.


Added:
   branches/soc-2008-tagging/app/core/gimptagcache.c
Modified:
   branches/soc-2008-tagging/app/core/Makefile.am
   branches/soc-2008-tagging/app/core/core-types.h
   branches/soc-2008-tagging/app/core/gimp.c

Modified: branches/soc-2008-tagging/app/core/Makefile.am
==============================================================================
--- branches/soc-2008-tagging/app/core/Makefile.am	(original)
+++ branches/soc-2008-tagging/app/core/Makefile.am	Tue Jun 17 20:52:31 2008
@@ -310,6 +310,8 @@
 	gimpstrokeoptions.h			\
 	gimpsubprogress.c			\
 	gimpsubprogress.h			\
+	gimptagcache.c				\
+	gimptagcache.h				\
 	gimptagged.c				\
 	gimptagged.h				\
 	gimptemplate.c				\

Modified: branches/soc-2008-tagging/app/core/core-types.h
==============================================================================
--- branches/soc-2008-tagging/app/core/core-types.h	(original)
+++ branches/soc-2008-tagging/app/core/core-types.h	Tue Jun 17 20:52:31 2008
@@ -86,6 +86,7 @@
 /*  data objects  */
 
 typedef struct _GimpDataFactory      GimpDataFactory;
+typedef struct _GimpTagCache         GimpTagCache;
 typedef struct _GimpData             GimpData;
 typedef struct _GimpBrush            GimpBrush;
 typedef struct _GimpBrushClipboard   GimpBrushClipboard;

Modified: branches/soc-2008-tagging/app/core/gimp.c
==============================================================================
--- branches/soc-2008-tagging/app/core/gimp.c	(original)
+++ branches/soc-2008-tagging/app/core/gimp.c	Tue Jun 17 20:52:31 2008
@@ -58,6 +58,7 @@
 #include "gimpbuffer.h"
 #include "gimpcontext.h"
 #include "gimpdatafactory.h"
+#include "gimptagcache.h"
 #include "gimpdocumentlist.h"
 #include "gimpgradient.h"
 #include "gimpgradient-load.h"
@@ -230,6 +231,8 @@
   gimp->gradient_factory    = NULL;
   gimp->palette_factory     = NULL;
 
+  gimp->tag_cache           = NULL;
+
   gimp->pdb                 = gimp_pdb_new (gimp);
 
   xcf_init (gimp);
@@ -465,6 +468,9 @@
   memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->palette_factory),
                                       gui_size);
 
+  memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->tag_cache),
+                                      gui_size);
+
   memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->pdb), gui_size);
 
   memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->tool_info_list),
@@ -576,6 +582,8 @@
   gimp_object_set_static_name (GIMP_OBJECT (gimp->palette_factory),
                                "palette factory");
 
+  gimp->tag_cache = gimp_tag_cache_new (gimp);
+
   gimp_paint_init (gimp);
 
   /* Set the last values used to default values. */
@@ -849,6 +857,17 @@
   status_callback (NULL, _("Modules"), 0.7);
   gimp_modules_load (gimp);
 
+  /* update tag cache */
+  status_callback (NULL, _("Updating tag cache"), 0.8);
+  gimp_container_foreach (gimp->brush_factory->container,
+                          gimp_tag_cache_update, gimp->tag_cache);
+  gimp_container_foreach (gimp->pattern_factory->container,
+                          gimp_tag_cache_update, gimp->tag_cache);
+  gimp_container_foreach (gimp->palette_factory->container,
+                          gimp_tag_cache_update, gimp->tag_cache);
+  gimp_container_foreach (gimp->gradient_factory->container,
+                          gimp_tag_cache_update, gimp->tag_cache);
+
   g_signal_emit (gimp, gimp_signals[RESTORE], 0, status_callback);
 }
 

Added: branches/soc-2008-tagging/app/core/gimptagcache.c
==============================================================================
--- (empty file)
+++ branches/soc-2008-tagging/app/core/gimptagcache.c	Tue Jun 17 20:52:31 2008
@@ -0,0 +1,113 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimptagcache.c
+ * Copyright (C) 2008 Aurimas JuÅka <aurisj svn gnome org>
+ *
+ * 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 <stdlib.h>
+#include <string.h>
+
+#include <glib-object.h>
+
+#include "libgimpbase/gimpbase.h"
+#include "libgimpmath/gimpmath.h"
+#include "libgimpconfig/gimpconfig.h"
+
+#include "core-types.h"
+
+#include "gimp.h"
+#include "gimpcontext.h"
+#include "gimpdata.h"
+#include "gimptagcache.h"
+#include "gimplist.h"
+
+#include "gimp-intl.h"
+
+
+#define WRITABLE_PATH_KEY "gimp-data-cache-writable-path"
+
+
+static void    gimp_tag_cache_finalize     (GObject              *object);
+
+static gint64  gimp_tag_cache_get_memsize  (GimpObject           *object,
+                                               gint64               *gui_size);
+
+G_DEFINE_TYPE (GimpTagCache, gimp_tag_cache, GIMP_TYPE_OBJECT)
+
+#define parent_class gimp_tag_cache_parent_class
+
+
+static void
+gimp_tag_cache_class_init (GimpTagCacheClass *klass)
+{
+  GObjectClass    *object_class      = G_OBJECT_CLASS (klass);
+  GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass);
+
+  object_class->finalize         = gimp_tag_cache_finalize;
+
+  gimp_object_class->get_memsize = gimp_tag_cache_get_memsize;
+}
+
+static void
+gimp_tag_cache_init (GimpTagCache *cache)
+{
+  cache->gimp                   = NULL;
+}
+
+static void
+gimp_tag_cache_finalize (GObject *object)
+{
+  GimpTagCache *cache = GIMP_TAG_CACHE (object);
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static gint64
+gimp_tag_cache_get_memsize (GimpObject *object,
+                               gint64     *gui_size)
+{
+  GimpTagCache *cache = GIMP_TAG_CACHE (object);
+  gint64           memsize = 0;
+
+  return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
+                                                                  gui_size);
+}
+
+GimpTagCache *
+gimp_tag_cache_new (Gimp       *gimp)
+{
+  GimpTagCache *cache;
+
+  g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
+
+  cache = g_object_new (GIMP_TYPE_TAG_CACHE, NULL);
+
+  cache->gimp                   = gimp;
+
+  return cache;
+}
+
+void
+gimp_tag_cache_update (GimpTaggedInterface *tagged,
+                       GimpTagCache        *cache)
+{
+    GimpData *data = GIMP_DATA(tagged);
+    printf("resource received: %s\n", data->filename); 
+}



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