[Xfce4-commits] <thunar:nick/patch-queue> Use GIO for storing the emblems metadata.
Nick Schermer
noreply at xfce.org
Thu Dec 17 16:36:01 CET 2009
Updating branch refs/heads/nick/patch-queue
to 1b9bca8093fc7a0695db7f2365833fbb14cf93a2 (commit)
from 3ca1eb0866741edd5f3e22e240db74ead30356cf (commit)
commit 1b9bca8093fc7a0695db7f2365833fbb14cf93a2
Author: Nick Schermer <nick at xfce.org>
Date: Thu Dec 17 16:33:41 2009 +0100
Use GIO for storing the emblems metadata.
use-gio-for-storing-the-emblems-metadata.patch | 835 ++++++++++++++++++++++++
1 files changed, 835 insertions(+), 0 deletions(-)
diff --git a/use-gio-for-storing-the-emblems-metadata.patch b/use-gio-for-storing-the-emblems-metadata.patch
new file mode 100644
index 0000000..5df919e
--- /dev/null
+++ b/use-gio-for-storing-the-emblems-metadata.patch
@@ -0,0 +1,835 @@
+From d3e0a6dc8e806fd7778958df240c6636cc09485e Mon Sep 17 00:00:00 2001
+From: Nick Schermer <nick at xfce.org>
+Date: Thu, 17 Dec 2009 14:39:47 +0100
+Subject: [PATCH] Use GIO for storing the emblems metadata.
+
+This drops the tdb code from Thunar and uses GIO for storing
+and reading the metadata.
+
+To keep the patch small, the tdb directory has not been removed
+yet. After applying the patch you should run:
+ git rm -r tdb
+
+Signed-off-by: Nick Schermer <nick at xfce.org>
+---
+ Makefile.am | 1 -
+ configure.in.in | 2 -
+ thunar/Makefile.am | 4 -
+ thunar/thunar-file.c | 109 +---------
+ thunar/thunar-file.h | 9 -
+ thunar/thunar-metafile.c | 458 -------------------------------------------
+ thunar/thunar-metafile.h | 65 ------
+ thunarx/thunarx-file-info.h | 3 +-
+ 8 files changed, 13 insertions(+), 638 deletions(-)
+ delete mode 100644 thunar/thunar-metafile.c
+ delete mode 100644 thunar/thunar-metafile.h
+
+diff --git a/Makefile.am b/Makefile.am
+index 18e2c9c..31f1065 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -5,7 +5,6 @@ SUBDIRS = \
+ pixmaps \
+ po \
+ po-doc \
+- tdb \
+ thunarx \
+ thunar \
+ docs \
+diff --git a/configure.in.in b/configure.in.in
+index b551100..f632ba9 100644
+--- a/configure.in.in
++++ b/configure.in.in
+@@ -275,8 +275,6 @@ plugins/thunar-uca/Makefile
+ plugins/thunar-wallpaper/Makefile
+ po/Makefile.in
+ po-doc/Makefile
+-tdb/Makefile
+-tdb/tdbconfig.h
+ thunar/Makefile
+ thunarx/Makefile
+ thunarx/thunarx-2.pc
+diff --git a/thunar/Makefile.am b/thunar/Makefile.am
+index 6c5b20c..dad4d5b 100644
+--- a/thunar/Makefile.am
++++ b/thunar/Makefile.am
+@@ -127,8 +127,6 @@ Thunar_SOURCES = \
+ thunar-location-dialog.h \
+ thunar-location-entry.c \
+ thunar-location-entry.h \
+- thunar-metafile.c \
+- thunar-metafile.h \
+ thunar-misc-jobs.c \
+ thunar-misc-jobs.h \
+ thunar-navigator.c \
+@@ -232,7 +230,6 @@ Thunar_LDFLAGS = \
+ $(PLATFORM_LDFLAGS)
+
+ Thunar_LDADD = \
+- $(top_builddir)/tdb/libtdb.la \
+ $(top_builddir)/thunarx/libthunarx-$(THUNARX_VERSION_API).la \
+ $(EXO_LIBS) \
+ $(GTHREAD_LIBS) \
+@@ -242,7 +239,6 @@ Thunar_LDADD = \
+ $(LIBXFCE4UI_LIBS)
+
+ Thunar_DEPENDENCIES = \
+- $(top_builddir)/tdb/libtdb.la \
+ $(top_builddir)/thunarx/libthunarx-$(THUNARX_VERSION_API).la
+
+ if HAVE_DBUS
+diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
+index a633242..f8e89e5 100644
+--- a/thunar/thunar-file.c
++++ b/thunar/thunar-file.c
+@@ -69,8 +69,7 @@
+
+ /* Additional flags associated with a ThunarFile */
+ #define THUNAR_FILE_IN_DESTRUCTION 0x04
+-#define THUNAR_FILE_OWNS_METAFILE_REFERENCE 0x08
+-#define THUNAR_FILE_OWNS_EMBLEM_NAMES 0x10
++#define THUNAR_FILE_OWNS_EMBLEM_NAMES 0x08
+
+
+ /* the watch count is stored in the GObject data
+@@ -110,7 +109,6 @@ static gboolean thunar_file_denies_access_permission (const ThunarFile
+ ThunarFileMode usr_permissions,
+ ThunarFileMode grp_permissions,
+ ThunarFileMode oth_permissions);
+-static ThunarMetafile *thunar_file_get_metafile (ThunarFile *file);
+ static void thunar_file_monitor (GFileMonitor *monitor,
+ GFile *path,
+ GFile *other_path,
+@@ -124,7 +122,6 @@ G_LOCK_DEFINE_STATIC (file_cache_mutex);
+
+
+ static ThunarUserManager *user_manager;
+-static ThunarMetafile *metafile;
+ static GHashTable *file_cache;
+ static guint32 effective_user_id;
+ static GQuark thunar_file_thumb_path_quark;
+@@ -288,10 +285,6 @@ thunar_file_finalize (GObject *object)
+ g_hash_table_remove (file_cache, file->gfile);
+ G_UNLOCK (file_cache_mutex);
+
+- /* drop a reference on the metadata if we own one */
+- if ((file->flags & THUNAR_FILE_OWNS_METAFILE_REFERENCE) != 0)
+- g_object_unref (G_OBJECT (metafile));
+-
+ /* release file info */
+ if (file->info != NULL)
+ g_object_unref (file->info);
+@@ -512,31 +505,6 @@ thunar_file_denies_access_permission (const ThunarFile *file,
+
+
+
+-static ThunarMetafile*
+-thunar_file_get_metafile (ThunarFile *file)
+-{
+- if ((file->flags & THUNAR_FILE_OWNS_METAFILE_REFERENCE) == 0)
+- {
+- /* take a reference on the metafile for this file */
+- if (G_UNLIKELY (metafile == NULL))
+- {
+- metafile = thunar_metafile_get_default ();
+- g_object_add_weak_pointer (G_OBJECT (metafile), (gpointer) &metafile);
+- }
+- else
+- {
+- g_object_ref (G_OBJECT (metafile));
+- }
+-
+- /* remember that we own a reference now */
+- file->flags |= THUNAR_FILE_OWNS_METAFILE_REFERENCE;
+- }
+-
+- return metafile;
+-}
+-
+-
+-
+ static void
+ thunar_file_monitor_update (GFile *path,
+ GFileMonitorEvent event_type)
+@@ -2431,8 +2399,8 @@ thunar_file_get_emblem_names (ThunarFile *file)
+ /* check if we need to load the emblems_list from the metafile */
+ if (G_UNLIKELY ((file->flags & THUNAR_FILE_OWNS_EMBLEM_NAMES) == 0))
+ {
+- emblem_string = thunar_file_get_metadata (file, THUNAR_METAFILE_KEY_EMBLEMS, "");
+- if (G_UNLIKELY (*emblem_string != '\0'))
++ emblem_string = g_file_info_get_attribute_string (file->info, "metadata::emblems");
++ if (G_UNLIKELY (emblem_string != NULL && *emblem_string != '\0'))
+ {
+ emblem_names = g_strsplit (emblem_string, ";", -1);
+ g_object_set_qdata_full (G_OBJECT (file), thunar_file_emblem_names_quark,
+@@ -2498,6 +2466,7 @@ thunar_file_set_emblem_names (ThunarFile *file,
+ gchar **emblems;
+ gchar *emblems_string;
+ gint n;
++ GError *error = NULL;
+
+ _thunar_return_if_fail (THUNAR_IS_FILE (file));
+
+@@ -2525,7 +2494,13 @@ thunar_file_set_emblem_names (ThunarFile *file,
+
+ /* store the emblem list in the file's metadata */
+ emblems_string = g_strjoinv (";", emblems);
+- thunar_file_set_metadata (file, THUNAR_METAFILE_KEY_EMBLEMS, emblems_string, "");
++ if (!g_file_set_attribute_string (file->gfile, "metadata::emblems",
++ emblems_string, G_FILE_QUERY_INFO_NONE,
++ NULL, &error))
++ {
++ g_warning ("Failed to store emblems metadata: %s", error->message);
++ g_error_free (error);
++ }
+ g_free (emblems_string);
+
+ /* tell everybody that we have changed */
+@@ -2777,68 +2752,6 @@ thunar_file_get_icon_name (const ThunarFile *file,
+
+
+ /**
+- * thunar_file_get_metadata:
+- * @file : a #ThunarFile instance.
+- * @key : a #ThunarMetaFileKey.
+- * @default_value : the default value for @key in @file
+- * which is returned when @key isn't
+- * explicitly set for @file (may be
+- * %NULL).
+- *
+- * Returns the metadata available for @key in @file.
+- *
+- * The returned string is owned by the @file and uses
+- * an internal buffer that will be overridden on the
+- * next call to any of the metadata retrieval methods.
+- *
+- * Return value: the metadata available for @key in @file
+- * or @default_value if @key is not set for
+- * @file.
+- **/
+-const gchar*
+-thunar_file_get_metadata (ThunarFile *file,
+- ThunarMetafileKey key,
+- const gchar *default_value)
+-{
+- _thunar_return_val_if_fail (THUNAR_IS_FILE (file), NULL);
+- _thunar_return_val_if_fail (key < THUNAR_METAFILE_N_KEYS, NULL);
+-
+- return thunar_metafile_fetch (thunar_file_get_metafile (file),
+- file->gfile, key,
+- default_value);
+-}
+-
+-
+-
+-/**
+- * thunar_file_set_metadata:
+- * @file : a #ThunarFile instance.
+- * @key : a #ThunarMetafileKey.
+- * @value : the new value for @key on @file.
+- * @default_value : the default for @key on @file.
+- *
+- * Sets the metadata available for @key in @file to
+- * the given @value.
+- **/
+-void
+-thunar_file_set_metadata (ThunarFile *file,
+- ThunarMetafileKey key,
+- const gchar *value,
+- const gchar *default_value)
+-{
+- _thunar_return_if_fail (THUNAR_IS_FILE (file));
+- _thunar_return_if_fail (key < THUNAR_METAFILE_N_KEYS);
+- _thunar_return_if_fail (default_value != NULL);
+- _thunar_return_if_fail (value != NULL);
+-
+- thunar_metafile_store (thunar_file_get_metafile (file),
+- file->gfile, key, value,
+- default_value);
+-}
+-
+-
+-
+-/**
+ * thunar_file_watch:
+ * @file : a #ThunarFile instance.
+ *
+diff --git a/thunar/thunar-file.h b/thunar/thunar-file.h
+index a353671..aa853f3 100644
+--- a/thunar/thunar-file.h
++++ b/thunar/thunar-file.h
+@@ -27,7 +27,6 @@
+
+ #include <thunar/thunar-enum-types.h>
+ #include <thunar/thunar-gio-extensions.h>
+-#include <thunar/thunar-metafile.h>
+ #include <thunar/thunar-user.h>
+
+ G_BEGIN_DECLS;
+@@ -228,14 +227,6 @@ gchar *thunar_file_get_icon_name (const ThunarFile *fil
+ ThunarFileIconState icon_state,
+ GtkIconTheme *icon_theme);
+
+-const gchar *thunar_file_get_metadata (ThunarFile *file,
+- ThunarMetafileKey key,
+- const gchar *default_value);
+-void thunar_file_set_metadata (ThunarFile *file,
+- ThunarMetafileKey key,
+- const gchar *value,
+- const gchar *default_value);
+-
+ void thunar_file_watch (ThunarFile *file);
+ void thunar_file_unwatch (ThunarFile *file);
+
+diff --git a/thunar/thunar-metafile.c b/thunar/thunar-metafile.c
+deleted file mode 100644
+index 1d49f1e..0000000
+--- a/thunar/thunar-metafile.c
++++ /dev/null
+@@ -1,458 +0,0 @@
+-/* $Id$ */
+-/*-
+- * Copyright (c) 2005-2006 Benedikt Meurer <benny at xfce.org>
+- * Copyright (c) 2009 Jannis Pohlmann <jannis at xfce.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
+- */
+-
+-#ifdef HAVE_CONFIG_H
+-#include <config.h>
+-#endif
+-
+-#ifdef HAVE_ERRNO_H
+-#include <errno.h>
+-#endif
+-#ifdef HAVE_FCNTL_H
+-#include <fcntl.h>
+-#endif
+-#ifdef HAVE_MEMORY_H
+-#include <memory.h>
+-#endif
+-#ifdef HAVE_STDLIB_H
+-#include <stdlib.h>
+-#endif
+-#ifdef HAVE_STRING_H
+-#include <string.h>
+-#endif
+-
+-#include <gio/gio.h>
+-
+-#include <exo/exo.h>
+-
+-#include <tdb/tdb.h>
+-
+-#include <thunar/thunar-metafile.h>
+-#include <thunar/thunar-private.h>
+-
+-
+-
+-static void thunar_metafile_class_init (ThunarMetafileClass *klass);
+-static void thunar_metafile_init (ThunarMetafile *metafile);
+-static void thunar_metafile_finalize (GObject *object);
+-static TDB_DATA thunar_metafile_read (ThunarMetafile *metafile,
+- TDB_DATA data);
+-
+-
+-
+-struct _ThunarMetafileClass
+-{
+- GObjectClass __parent__;
+-};
+-
+-struct _ThunarMetafile
+-{
+- GObject __parent__;
+-
+- TDB_CONTEXT *context;
+- TDB_DATA data;
+-};
+-
+-
+-
+-static GObjectClass *thunar_metafile_parent_class;
+-
+-
+-
+-GType
+-thunar_metafile_get_type (void)
+-{
+- static GType type = G_TYPE_INVALID;
+-
+- if (G_UNLIKELY (type == G_TYPE_INVALID))
+- {
+- static const GTypeInfo info =
+- {
+- sizeof (ThunarMetafileClass),
+- NULL,
+- NULL,
+- (GClassInitFunc) thunar_metafile_class_init,
+- NULL,
+- NULL,
+- sizeof (ThunarMetafile),
+- 0,
+- (GInstanceInitFunc) thunar_metafile_init,
+- NULL,
+- };
+-
+- type = g_type_register_static (G_TYPE_OBJECT, I_("ThunarMetafile"), &info, 0);
+- }
+-
+- return type;
+-}
+-
+-
+-
+-static void
+-thunar_metafile_class_init (ThunarMetafileClass *klass)
+-{
+- GObjectClass *gobject_class;
+-
+- /* determine the parent type class */
+- thunar_metafile_parent_class = g_type_class_peek_parent (klass);
+-
+- gobject_class = G_OBJECT_CLASS (klass);
+- gobject_class->finalize = thunar_metafile_finalize;
+-}
+-
+-
+-
+-static void
+-thunar_metafile_init (ThunarMetafile *metafile)
+-{
+- gchar *path;
+-
+- /* determine the path to the metafile database (create directories as required) */
+- path = xfce_resource_save_location (XFCE_RESOURCE_CACHE, "Thunar/metafile.tdb", TRUE);
+- if (G_UNLIKELY (path == NULL))
+- {
+- path = xfce_resource_save_location (XFCE_RESOURCE_CACHE, "Thunar/", FALSE);
+- g_warning ("Failed to create the Thunar cache directory in %s", path);
+- g_free (path);
+- return;
+- }
+-
+- /* try to open the metafile database file */
+- metafile->context = tdb_open (path, 0, TDB_DEFAULT, O_CREAT | O_RDWR, 0600);
+- if (G_UNLIKELY (metafile->context == NULL))
+- g_warning ("Failed to open metafile database in %s: %s.", path, g_strerror (errno));
+-
+- /* release the path */
+- g_free (path);
+-}
+-
+-
+-
+-static void
+-thunar_metafile_finalize (GObject *object)
+-{
+- ThunarMetafile *metafile = THUNAR_METAFILE (object);
+-
+- /* close the database (if open) */
+- if (G_LIKELY (metafile->context != NULL))
+- tdb_close (metafile->context);
+-
+- /* release any pending data */
+- if (G_LIKELY (metafile->data.dptr != NULL))
+- free (metafile->data.dptr);
+-
+- (*G_OBJECT_CLASS (thunar_metafile_parent_class)->finalize) (object);
+-}
+-
+-
+-
+-static TDB_DATA
+-thunar_metafile_read (ThunarMetafile *metafile,
+- TDB_DATA data)
+-{
+- /* perform the fetch operation on the database */
+- data = tdb_fetch (metafile->context, data);
+- if (G_UNLIKELY (data.dptr != NULL))
+- {
+- /* validate the result */
+- if (data.dsize < sizeof (guint32)
+- || (data.dsize % sizeof (guint32)) != 0
+- || data.dptr[data.dsize - 1] != '\0')
+- {
+- free (data.dptr);
+- data.dptr = NULL;
+- data.dsize = 0;
+- }
+- }
+-
+- return data;
+-}
+-
+-
+-
+-/**
+- * thunar_metafile_get_default:
+- *
+- * Returns a reference to the default #ThunarMetafile
+- * instance. There can be only one #ThunarMetafile
+- * instance at any time.
+- *
+- * The caller is responsible to free the returned
+- * object using g_object_unref() when no longer
+- * needed.
+- *
+- * Return value: a reference to the default #ThunarMetafile
+- * instance.
+- **/
+-ThunarMetafile*
+-thunar_metafile_get_default (void)
+-{
+- static ThunarMetafile *metafile = NULL;
+-
+- if (G_UNLIKELY (metafile == NULL))
+- {
+- /* allocate a new metafile instance. */
+- metafile = g_object_new (THUNAR_TYPE_METAFILE, NULL);
+- g_object_add_weak_pointer (G_OBJECT (metafile), (gpointer) &metafile);
+- }
+- else
+- {
+- /* take a reference for the caller */
+- g_object_ref (G_OBJECT (metafile));
+- }
+-
+- return metafile;
+-}
+-
+-
+-
+-/**
+- * thunar_metafile_fetch:
+- * @metafile : a #ThunarMetafile.
+- * @file : a #Gfile.
+- * @key : a #ThunarMetafileKey.
+- * @default_value : the default value for @key,
+- * which may be %NULL.
+- *
+- * Fetches the value for @key on @path in
+- * @metafile. Returns a pointer to the
+- * value if found, or the default value
+- * if the @key is explicitly not set for
+- * @path in @metafile, as specified in
+- * @default_value.
+- *
+- * The returned string is owned by @metafile
+- * and is only valid until the next call to
+- * thunar_metafile_fetch(), so you might need
+- * to take a copy of the value if you need to
+- * keep for a longer period.
+- *
+- * Return value: the value for @key on @path
+- * in @metafile or the default
+- * value for @key, as specified
+- * by @default_value.
+- **/
+-const gchar*
+-thunar_metafile_fetch (ThunarMetafile *metafile,
+- GFile *file,
+- ThunarMetafileKey key,
+- const gchar *default_value)
+-{
+- const guchar *dend;
+- const guchar *dp;
+- TDB_DATA key_data;
+- gssize key_size;
+- gchar *key_path = NULL;
+-
+- _thunar_return_val_if_fail (THUNAR_IS_METAFILE (metafile), NULL);
+- _thunar_return_val_if_fail (G_IS_FILE (file), NULL);
+- _thunar_return_val_if_fail (key < THUNAR_METAFILE_N_KEYS, NULL);
+-
+- /* check if the database handle is available */
+- if (G_UNLIKELY (metafile->context == NULL))
+- goto use_default_value;
+-
+- /* determine the string representation of the path (using the URI for non-local paths) */
+- key_path = g_file_get_uri (file);
+- key_size = strlen (key_path);
+-
+- if (G_UNLIKELY (key_size <= 0))
+- goto use_default_value;
+-
+- /* generate the key data */
+- key_data.dptr = key_path;
+- key_data.dsize = key_size - 1;
+-
+- /* release any earlier result data */
+- if (G_LIKELY (metafile->data.dptr != NULL))
+- free (metafile->data.dptr);
+-
+- /* perform the fetch operation on the database */
+- metafile->data = thunar_metafile_read (metafile, key_data);
+- if (G_LIKELY (metafile->data.dptr == NULL))
+- goto use_default_value;
+-
+- /* lookup the value for the given key */
+- dp = (const guchar *) metafile->data.dptr;
+- dend = dp + metafile->data.dsize;
+- for (;;)
+- {
+- /* check if we have a match */
+- if (*dp == (guint) key)
+- {
+- g_free (key_path);
+- return (const gchar *) (dp + 1);
+- }
+-
+- /* lookup the next entry */
+- do
+- {
+- /* skip another 4 bytes */
+- dp += sizeof (guint32);
+- if (G_UNLIKELY (dp == dend))
+- goto use_default_value;
+- }
+- while (*(dp - 1) != '\0');
+- }
+-
+- /* use the default value */
+-use_default_value:
+- g_free (key_path);
+- return default_value;
+-}
+-
+-
+-
+-/**
+- * thunar_metafile_store:
+- * @metafile : a #ThunarMetafile.
+- * @file : a #GFile.
+- * @key : a #ThunarMetafileKey.
+- * @value : the new value for @key on @path.
+- * @default_value : the default value for @key on @path.
+- *
+- * Stores the given @value for @key on @path in
+- * @metafile.
+- *
+- * No error is returned from this method, but
+- * the store operation may nevertheless fail,
+- * so don't depend on the success of the operation.
+- *
+- * Note that if @value equals the @default_value
+- * for @key, it isn't stored in the @metafile to
+- * save memory.
+- **/
+-void
+-thunar_metafile_store (ThunarMetafile *metafile,
+- GFile *file,
+- ThunarMetafileKey key,
+- const gchar *value,
+- const gchar *default_value)
+-{
+- TDB_DATA value_data;
+- TDB_DATA key_data;
+- gssize value_size;
+- gssize key_size;
+- gchar *buffer;
+- gchar *bp;
+- gchar *key_path;
+-
+- _thunar_return_if_fail (THUNAR_IS_METAFILE (metafile));
+- _thunar_return_if_fail (G_IS_FILE (file));
+- _thunar_return_if_fail (key < THUNAR_METAFILE_N_KEYS);
+- _thunar_return_if_fail (value != NULL);
+- _thunar_return_if_fail (default_value != NULL);
+-
+- /* check if the database handle is available */
+- if (G_UNLIKELY (metafile->context == NULL))
+- return;
+-
+- /* determine the string representation of the file */
+- key_path = g_file_get_uri (file);
+- key_size = strlen (key_path);
+-
+- if (G_UNLIKELY (key_size <= 0))
+- return;
+-
+- /* generate the key data */
+- key_data.dptr = key_path;
+- key_data.dsize = key_size - 1;
+-
+- /* fetch the current value for the key */
+- value_data = thunar_metafile_read (metafile, key_data);
+-
+- /* determine the size required for the new value */
+- value_size = strlen (value) + 2;
+- value_size = ((value_size + sizeof (guint32) - 1) / sizeof (guint32)) * sizeof (guint32);
+-
+- /* allocate a buffer to merge the existing value set with the new value */
+- buffer = g_new0 (gchar, value_data.dsize + value_size);
+-
+- /* copy the new value to the buffer if it's not equal to the default value */
+- if (G_LIKELY (strcmp (value, default_value) != 0))
+- {
+- buffer[0] = key;
+- strcpy (buffer + 1, value);
+- bp = buffer + value_size;
+- }
+- else
+- {
+- bp = buffer;
+- }
+-
+- /* copy the existing entries (if any) */
+- if (G_LIKELY (value_data.dptr != NULL))
+- {
+- const guchar *vp = (const guchar *) value_data.dptr;
+- const guchar *vend = vp + value_data.dsize;
+- const guchar *vx;
+-
+- for (; vp < vend; vp = vx)
+- {
+- /* grab a pointer to the next entry (thereby calc
+- * the length of this entry).
+- */
+- for (vx = vp + sizeof (guint32); *(vx - 1) != '\0'; vx += sizeof (guint32))
+- ;
+-
+- /* verify the vx pointer */
+- _thunar_assert (vx <= vend);
+- _thunar_assert (vx > vp);
+-
+- /* check if we should copy the entry */
+- if (*vp != key)
+- {
+- memcpy (bp, vp, vx - vp);
+- bp += (vx - vp);
+- }
+- }
+-
+- /* verify the buffer space */
+- _thunar_assert (bp <= buffer + value_data.dsize + value_size);
+- _thunar_assert ((bp - buffer) % sizeof (guint32) == 0);
+-
+- /* release the previous value set */
+- free (value_data.dptr);
+- }
+-
+- /* delete the key from the database if the new
+- * value set is the same as the default value set.
+- */
+- if (G_UNLIKELY (bp == buffer))
+- {
+- tdb_delete (metafile->context, key_data);
+- }
+- else
+- {
+- /* setup the new value set */
+- value_data.dptr = buffer;
+- value_data.dsize = bp - buffer;
+-
+- /* execute the store operation */
+- tdb_store (metafile->context, key_data, value_data, TDB_REPLACE);
+- }
+-
+- /* free the file URI */
+- g_free (key_path);
+-
+- /* free the buffer space */
+- g_free (buffer);
+-}
+-
+diff --git a/thunar/thunar-metafile.h b/thunar/thunar-metafile.h
+deleted file mode 100644
+index bd70d1f..0000000
+--- a/thunar/thunar-metafile.h
++++ /dev/null
+@@ -1,65 +0,0 @@
+-/* $Id$ */
+-/*-
+- * Copyright (c) 2005 Benedikt Meurer <benny at xfce.org>
+- * Copyright (c) 2009 Jannis Pohlmann <jannis at xfce.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
+- */
+-
+-#ifndef __THUNAR_METAFILE_H__
+-#define __THUNAR_METAFILE_H__
+-
+-#include <gio/gio.h>
+-
+-G_BEGIN_DECLS;
+-
+-typedef struct _ThunarMetafileClass ThunarMetafileClass;
+-typedef struct _ThunarMetafile ThunarMetafile;
+-
+-#define THUNAR_TYPE_METAFILE (thunar_metafile_get_type ())
+-#define THUNAR_METAFILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THUNAR_TYPE_METAFILE, ThunarMetafile))
+-#define THUNAR_METAFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), THUNAR_TYPE_METAFILE, ThunarMetafileClass))
+-#define THUNAR_IS_METAFILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THUNAR_TYPE_METAFILE))
+-#define THUNAR_IS_METAFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), THUNAR_TYPE_METAFILE))
+-#define THUNAR_METAFILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THUNAR_TYPE_METAFILE, ThunarMetafileClass))
+-
+-/**
+- * ThunarMetafileKey:
+- * @THUNAR_METAFILE_KEY_EMBLEMS :
+- **/
+-typedef enum /*< enum >*/
+-{
+- THUNAR_METAFILE_KEY_EMBLEMS,
+- THUNAR_METAFILE_N_KEYS,
+-} ThunarMetafileKey;
+-
+-GType thunar_metafile_get_type (void) G_GNUC_CONST;
+-
+-ThunarMetafile *thunar_metafile_get_default (void);
+-
+-const gchar *thunar_metafile_fetch (ThunarMetafile *metafile,
+- GFile *file,
+- ThunarMetafileKey key,
+- const gchar *default_value);
+-
+-void thunar_metafile_store (ThunarMetafile *metafile,
+- GFile *file,
+- ThunarMetafileKey key,
+- const gchar *value,
+- const gchar *default_value);
+-
+-G_END_DECLS;
+-
+-#endif /* !__THUNAR_METAFILE_H__ */
+diff --git a/thunarx/thunarx-file-info.h b/thunarx/thunarx-file-info.h
+index 13a7001..0e78600 100644
+--- a/thunarx/thunarx-file-info.h
++++ b/thunarx/thunarx-file-info.h
+@@ -45,7 +45,8 @@ G_BEGIN_DECLS;
+ "time::*," \
+ "thumbnail::*," \
+ "trash::*," \
+- "unix::*"
++ "unix::*," \
++ "metadata::emblems"
+
+ /**
+ * Filesystem information namespaces available in the #GFileInfo
+--
+1.6.5.6
+
More information about the Xfce4-commits
mailing list