[Xfce4-commits] r30001 - in thunar/branches/migration-to-gio: . thunar
Jannis Pohlmann
jannis at xfce.org
Fri Jun 12 02:21:24 CEST 2009
Author: jannis
Date: 2009-06-12 00:21:23 +0000 (Fri, 12 Jun 2009)
New Revision: 30001
Added:
thunar/branches/migration-to-gio/thunar/thunar-image.c
thunar/branches/migration-to-gio/thunar/thunar-image.h
thunar/branches/migration-to-gio/thunar/thunar-thumbnailer-dbus.xml
thunar/branches/migration-to-gio/thunar/thunar-thumbnailer.c
thunar/branches/migration-to-gio/thunar/thunar-thumbnailer.h
Removed:
thunar/branches/migration-to-gio/thunar/thunar-thumbnail-generator.c
thunar/branches/migration-to-gio/thunar/thunar-thumbnail-generator.h
Modified:
thunar/branches/migration-to-gio/ChangeLog
thunar/branches/migration-to-gio/thunar/Makefile.am
thunar/branches/migration-to-gio/thunar/thunar-file.c
thunar/branches/migration-to-gio/thunar/thunar-file.h
thunar/branches/migration-to-gio/thunar/thunar-folder.c
thunar/branches/migration-to-gio/thunar/thunar-icon-factory.c
thunar/branches/migration-to-gio/thunar/thunar-list-model.c
thunar/branches/migration-to-gio/thunar/thunar-marshal.list
thunar/branches/migration-to-gio/thunar/thunar-path-entry.c
thunar/branches/migration-to-gio/thunar/thunar-private.h
thunar/branches/migration-to-gio/thunar/thunar-properties-dialog.c
Log:
* Makefile.am, thunar/thunar-image.{c,h},
thunar/thunar-thumbnailer-dbus.xml, thunar/thunar-thumbnailer.{c,h}:
Add two new classes ThunarImage and ThunarThumbnailer. ThunarImage
is a subclass of GtkImage which takes a ThunarFile and
asynchronously loads a thumbnail for the file using the
org.freedesktop.thumbnails.Thumbnailer D-Bus service.
ThunarThumbnailer is essentially a proxy client for this service
which adds a few convenience methods around the DBusGProxy API. It
can be used by other classes to request thumbnails over D-Bus.
* thunar/thunar-file.{c,h}: Add a new method
thunar_file_get_thumbnail_path(), which returns the thumbnail path
for a ThunarFile. GFileInfo has something similar but unfortunately
it's only set if the thumbnail exists, which means you have to
reload the GFileInfo whenever a new thumbnail has been generated ...
and unfortunately that requires a thunar_file_reload() which causes
a lot of flicker. Another new method is
thunar_file_get_preview_icon() which returns a preview GIcon that
can act as a thumbnail replacement if there is any.
* thunar/thunar-folder.c: Make sure never to emit the "files-added"
signal with an empty list.
* thunar/thunar-icon-factory.c: Use thunar_file_get_preview_icon() and
thunar_file_get_thumbnail_path() to load ThunarFile icons. Drop the
reference on ThunarThumbnailGenerator. Thumbnails are now requested
by ThunarListModel and ThunarImage instead of the icon factory.
* thunar/thunar-list-model.c: Request thumbnails from
ThunarThumbnailer whenever the "files-added" signal is emitted.
Unqueue all pending requests when the folder changes or the list
model is destroyed. Still missing: thumbnail requests after file
change events.
* thunar/thunar-marshal.list: Add another marshaller:
VOID:UINT,POINTER,UINT,STRING.
* thunar/thunar-private.h: Remove ifdefs for GLib <= 2.14.
* thunar/thunar-properties-dialog.c: Use ThunarImage for the file
icon instead of a regular GtkImage.
* thunar/thunar-thumbnail-generator.{c,h}: Remove the
ThunarThumbnailerGenerator class. We no longer need it.
Modified: thunar/branches/migration-to-gio/ChangeLog
===================================================================
--- thunar/branches/migration-to-gio/ChangeLog 2009-06-10 21:55:45 UTC (rev 30000)
+++ thunar/branches/migration-to-gio/ChangeLog 2009-06-12 00:21:23 UTC (rev 30001)
@@ -1,3 +1,42 @@
+2009-06-12 Jannis Pohlmann <jannis at xfce.org>
+
+ * Makefile.am, thunar/thunar-image.{c,h},
+ thunar/thunar-thumbnailer-dbus.xml, thunar/thunar-thumbnailer.{c,h}:
+ Add two new classes ThunarImage and ThunarThumbnailer. ThunarImage
+ is a subclass of GtkImage which takes a ThunarFile and
+ asynchronously loads a thumbnail for the file using the
+ org.freedesktop.thumbnails.Thumbnailer D-Bus service.
+ ThunarThumbnailer is essentially a proxy client for this service
+ which adds a few convenience methods around the DBusGProxy API. It
+ can be used by other classes to request thumbnails over D-Bus.
+ * thunar/thunar-file.{c,h}: Add a new method
+ thunar_file_get_thumbnail_path(), which returns the thumbnail path
+ for a ThunarFile. GFileInfo has something similar but unfortunately
+ it's only set if the thumbnail exists, which means you have to
+ reload the GFileInfo whenever a new thumbnail has been generated ...
+ and unfortunately that requires a thunar_file_reload() which causes
+ a lot of flicker. Another new method is
+ thunar_file_get_preview_icon() which returns a preview GIcon that
+ can act as a thumbnail replacement if there is any.
+ * thunar/thunar-folder.c: Make sure never to emit the "files-added"
+ signal with an empty list.
+ * thunar/thunar-icon-factory.c: Use thunar_file_get_preview_icon() and
+ thunar_file_get_thumbnail_path() to load ThunarFile icons. Drop the
+ reference on ThunarThumbnailGenerator. Thumbnails are now requested
+ by ThunarListModel and ThunarImage instead of the icon factory.
+ * thunar/thunar-list-model.c: Request thumbnails from
+ ThunarThumbnailer whenever the "files-added" signal is emitted.
+ Unqueue all pending requests when the folder changes or the list
+ model is destroyed. Still missing: thumbnail requests after file
+ change events.
+ * thunar/thunar-marshal.list: Add another marshaller:
+ VOID:UINT,POINTER,UINT,STRING.
+ * thunar/thunar-private.h: Remove ifdefs for GLib <= 2.14.
+ * thunar/thunar-properties-dialog.c: Use ThunarImage for the file
+ icon instead of a regular GtkImage.
+ * thunar/thunar-thumbnail-generator.{c,h}: Remove the
+ ThunarThumbnailerGenerator class. We no longer need it.
+
2009-05-12 Jannis Pohlmann <jannis at xfce.org>
* configure.in.in: Depend on libexo-0.3.101svn-r29948 for
Modified: thunar/branches/migration-to-gio/thunar/Makefile.am
===================================================================
--- thunar/branches/migration-to-gio/thunar/Makefile.am 2009-06-10 21:55:45 UTC (rev 30000)
+++ thunar/branches/migration-to-gio/thunar/Makefile.am 2009-06-12 00:21:23 UTC (rev 30001)
@@ -99,6 +99,8 @@
thunar-icon-renderer.h \
thunar-icon-view.c \
thunar-icon-view.h \
+ thunar-image.c \
+ thunar-image.h \
thunar-io-jobs.c \
thunar-io-jobs.h \
thunar-io-jobs-util.c \
@@ -187,10 +189,10 @@
thunar-throbber.h \
thunar-throbber-fallback.c \
thunar-throbber-fallback.h \
+ thunar-thumbnailer.c \
+ thunar-thumbnailer.h \
thunar-thumbnail-frame.c \
thunar-thumbnail-frame.h \
- thunar-thumbnail-generator.c \
- thunar-thumbnail-generator.h \
thunar-transfer-job.c \
thunar-transfer-job.h \
thunar-trash-action.c \
@@ -245,13 +247,15 @@
if HAVE_DBUS
thunar_built_sources += \
- thunar-dbus-service-infos.h
+ thunar-dbus-service-infos.h \
+ thunar-thumbnailer-proxy.h
thunar_dbus_sources = \
thunar-dbus-client.c \
thunar-dbus-client.h \
thunar-dbus-service.c \
- thunar-dbus-service.h
+ thunar-dbus-service.h \
+ thunar-thumbnailer-proxy.h
Thunar_CFLAGS += \
-DDBUS_API_SUBJECT_TO_CHANGE \
@@ -320,6 +324,12 @@
if HAVE_DBUS
thunar-dbus-service-infos.h: $(srcdir)/thunar-dbus-service-infos.xml Makefile
dbus-binding-tool --prefix=thunar_dbus_service --mode=glib-server $(srcdir)/thunar-dbus-service-infos.xml > thunar-dbus-service-infos.h
+
+thunar-thumbnailer-proxy.h: $(srcdir)/thunar-thumbnailer-dbus.xml Makefile
+ dbus-binding-tool --mode=glib-client \
+ $(srcdir)/thunar-thumbnailer-dbus.xml > thunar-thumbnailer-proxy.h \
+ && sed -i -e 's/org_freedesktop_thumbnails_Thumbnailer/thunar_thumbnailer_proxy/g' \
+ thunar-thumbnailer-proxy.h
endif
thunar-throbber-fallback.c: $(srcdir)/thunar-throbber-fallback.png Makefile
Modified: thunar/branches/migration-to-gio/thunar/thunar-file.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-file.c 2009-06-10 21:55:45 UTC (rev 30000)
+++ thunar/branches/migration-to-gio/thunar/thunar-file.c 2009-06-12 00:21:23 UTC (rev 30001)
@@ -67,7 +67,9 @@
"standard::*," \
"unix::*," \
"access::*," \
- "time::*"
+ "time::*," \
+ "thumbnail::*," \
+ "preview::*"
#define THUNAR_FILE_G_FILE_INFO_FILESYSTEM_NAMESPACE \
"filesystem::*"
@@ -344,6 +346,9 @@
g_free (file->display_name);
g_free (file->basename);
+ /* free the thumbnail path */
+ g_free (file->thumbnail_path);
+
/* release file */
g_object_unref (file->gfile);
@@ -453,11 +458,6 @@
static void
thunar_file_info_changed (ThunarxFileInfo *file_info)
{
- /* reset the thumbnail state, so the next thunar_icon_factory_load_file_icon()
- * invokation will recheck the thumbnail.
- */
- thunar_file_set_thumb_state (THUNAR_FILE (file_info), THUNAR_FILE_THUMB_STATE_UNKNOWN);
-
/* tell the file monitor that this file changed */
thunar_file_monitor_file_changed (THUNAR_FILE (file_info));
}
@@ -725,6 +725,8 @@
GError **error)
{
GKeyFile *key_file;
+ gchar *basename;
+ gchar *md5_hash;
gchar *uri;
_thunar_return_val_if_fail (THUNAR_IS_FILE (file), FALSE);
@@ -759,6 +761,9 @@
g_free (file->display_name);
g_free (file->basename);
+ /* free thumbnail path */
+ g_free (file->thumbnail_path);
+
/* query a new file info */
file->info = g_file_query_info (file->gfile,
THUNAR_FILE_G_FILE_INFO_NAMESPACE,
@@ -831,6 +836,16 @@
g_free (uri);
}
+ /* determine thumbnail path */
+ uri = g_file_get_uri (file->gfile);
+ md5_hash = g_compute_checksum_for_string (G_CHECKSUM_MD5, uri, -1);
+ basename = g_strdup_printf ("%s.png", md5_hash);
+ file->thumbnail_path = g_build_filename (xfce_get_homedir (), ".thumbnails",
+ "normal", basename, NULL);
+ g_free (basename);
+ g_free (md5_hash);
+ g_free (uri);
+
return (file->info != NULL);
}
@@ -2423,6 +2438,15 @@
+const gchar *
+thunar_file_get_thumbnail_path (const ThunarFile *file)
+{
+ _thunar_return_val_if_fail (THUNAR_IS_FILE (file), NULL);
+ return file->thumbnail_path;
+}
+
+
+
/**
* thunar_file_get_custom_icon:
* @file : a #ThunarFile instance.
@@ -2442,6 +2466,18 @@
+GIcon *
+thunar_file_get_preview_icon (const ThunarFile *file)
+{
+ _thunar_return_val_if_fail (THUNAR_IS_FILE (file), NULL);
+ _thunar_return_val_if_fail (file->info != NULL, NULL);
+
+ return G_ICON (g_file_info_get_attribute_object (file->info,
+ G_FILE_ATTRIBUTE_PREVIEW_ICON));
+}
+
+
+
/**
* thunar_file_get_icon_name:
* @file : a #ThunarFile instance.
Modified: thunar/branches/migration-to-gio/thunar/thunar-file.h
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-file.h 2009-06-10 21:55:45 UTC (rev 30000)
+++ thunar/branches/migration-to-gio/thunar/thunar-file.h 2009-06-12 00:21:23 UTC (rev 30001)
@@ -122,6 +122,7 @@
gchar *custom_icon_name;
gchar *display_name;
gchar *basename;
+ gchar *thumbnail_path;
guint flags;
};
@@ -216,6 +217,7 @@
const gchar *custom_icon,
GError **error);
+GIcon *thunar_file_get_preview_icon (const ThunarFile *file);
gchar *thunar_file_get_icon_name (const ThunarFile *file,
ThunarFileIconState icon_state,
GtkIconTheme *icon_theme);
@@ -247,6 +249,7 @@
GList *thunar_file_list_to_g_file_list (GList *file_list);
gboolean thunar_file_is_desktop (const ThunarFile *file);
+const gchar *thunar_file_get_thumbnail_path (const ThunarFile *file);
/**
* thunar_file_is_root:
Modified: thunar/branches/migration-to-gio/thunar/thunar-folder.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-folder.c 2009-06-10 21:55:45 UTC (rev 30000)
+++ thunar/branches/migration-to-gio/thunar/thunar-folder.c 2009-06-12 00:21:23 UTC (rev 30001)
@@ -460,8 +460,11 @@
folder->files = folder->new_files;
folder->new_files = NULL;
- /* emit a "files-added" signal for the new files */
- g_signal_emit (G_OBJECT (folder), folder_signals[FILES_ADDED], 0, folder->files);
+ if (folder->files != NULL)
+ {
+ /* emit a "files-added" signal for the new files */
+ g_signal_emit (G_OBJECT (folder), folder_signals[FILES_ADDED], 0, folder->files);
+ }
}
/* we did it, the folder is loaded */
Modified: thunar/branches/migration-to-gio/thunar/thunar-icon-factory.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-icon-factory.c 2009-06-10 21:55:45 UTC (rev 30000)
+++ thunar/branches/migration-to-gio/thunar/thunar-icon-factory.c 2009-06-12 00:21:23 UTC (rev 30001)
@@ -38,7 +38,6 @@
#include <thunar/thunar-preferences.h>
#include <thunar/thunar-private.h>
#include <thunar/thunar-thumbnail-frame.h>
-#include <thunar/thunar-thumbnail-generator.h>
@@ -64,37 +63,37 @@
-static void thunar_icon_factory_class_init (ThunarIconFactoryClass *klass);
-static void thunar_icon_factory_init (ThunarIconFactory *factory);
-static void thunar_icon_factory_dispose (GObject *object);
-static void thunar_icon_factory_finalize (GObject *object);
-static void thunar_icon_factory_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-static void thunar_icon_factory_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static gboolean thunar_icon_factory_changed (GSignalInvocationHint *ihint,
- guint n_param_values,
- const GValue *param_values,
- gpointer user_data);
-static gboolean thunar_icon_factory_sweep_timer (gpointer user_data);
-static void thunar_icon_factory_sweep_timer_destroy (gpointer user_data);
-static GdkPixbuf *thunar_icon_factory_load_from_file (ThunarIconFactory *factory,
- const gchar *path,
- gint size);
-static GdkPixbuf *thunar_icon_factory_lookup_icon (ThunarIconFactory *factory,
- const gchar *name,
- gint size,
- gboolean wants_default);
-static void thunar_icon_factory_mark_recently_used (ThunarIconFactory *factory,
- GdkPixbuf *pixbuf);
-static guint thunar_icon_key_hash (gconstpointer data);
-static gboolean thunar_icon_key_equal (gconstpointer a,
- gconstpointer b);
-static GdkPixbuf *thunar_icon_factory_load_fallback (gint size);
+static void thunar_icon_factory_class_init (ThunarIconFactoryClass *klass);
+static void thunar_icon_factory_init (ThunarIconFactory *factory);
+static void thunar_icon_factory_dispose (GObject *object);
+static void thunar_icon_factory_finalize (GObject *object);
+static void thunar_icon_factory_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void thunar_icon_factory_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static gboolean thunar_icon_factory_changed (GSignalInvocationHint *ihint,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer user_data);
+static gboolean thunar_icon_factory_sweep_timer (gpointer user_data);
+static void thunar_icon_factory_sweep_timer_destroy (gpointer user_data);
+static GdkPixbuf *thunar_icon_factory_load_from_file (ThunarIconFactory *factory,
+ const gchar *path,
+ gint size);
+static GdkPixbuf *thunar_icon_factory_lookup_icon (ThunarIconFactory *factory,
+ const gchar *name,
+ gint size,
+ gboolean wants_default);
+static void thunar_icon_factory_mark_recently_used (ThunarIconFactory *factory,
+ GdkPixbuf *pixbuf);
+static guint thunar_icon_key_hash (gconstpointer data);
+static gboolean thunar_icon_key_equal (gconstpointer a,
+ gconstpointer b);
+static GdkPixbuf *thunar_icon_factory_load_fallback (gint size);
@@ -107,7 +106,6 @@
{
GObject __parent__;
- ThunarThumbnailGenerator *thumbnail_generator;
ThunarVfsThumbFactory *thumbnail_factory;
ThunarPreferences *preferences;
@@ -137,9 +135,9 @@
static GObjectClass *thunar_icon_factory_parent_class = NULL;
static GQuark thunar_icon_factory_quark = 0;
-static GQuark thunar_icon_thumb_path_quark = 0;
+static GQuark thunar_icon_thumb_uri_quark = 0;
static GQuark thunar_icon_thumb_time_quark = 0;
-static GQuark thunar_file_thumb_path_quark = 0;
+static GQuark thunar_file_thumb_uri_quark = 0;
@@ -181,11 +179,11 @@
thunar_icon_factory_parent_class = g_type_class_peek_parent (klass);
/* setup the thunar-icon-thumb-{path,time} quarks */
- thunar_icon_thumb_path_quark = g_quark_from_static_string ("thunar-icon-thumb-path");
+ thunar_icon_thumb_uri_quark = g_quark_from_static_string ("thunar-icon-thumb-path");
thunar_icon_thumb_time_quark = g_quark_from_static_string ("thunar-icon-thumb-time");
/* setup the thunar-file-thumb-path quark */
- thunar_file_thumb_path_quark = g_quark_from_static_string ("thunar-file-thumb-path");
+ thunar_file_thumb_uri_quark = g_quark_from_static_string ("thunar-file-thumb-path");
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->dispose = thunar_icon_factory_dispose;
@@ -245,9 +243,6 @@
factory->thumbnail_factory = thunar_vfs_thumb_factory_new ((THUNAR_THUMBNAIL_SIZE > 128)
? THUNAR_VFS_THUMB_SIZE_LARGE
: THUNAR_VFS_THUMB_SIZE_NORMAL);
-
- /* setup the thumbnail generator */
- factory->thumbnail_generator = thunar_thumbnail_generator_new (factory->thumbnail_factory);
}
@@ -289,9 +284,6 @@
/* disconnect from the thumbnail factory */
g_object_unref (G_OBJECT (factory->thumbnail_factory));
- /* disconnect from the thumbnail generator */
- g_object_unref (G_OBJECT (factory->thumbnail_generator));
-
/* remove the "changed" emission hook from the GtkIconTheme class */
g_signal_remove_emission_hook (g_signal_lookup ("changed", GTK_TYPE_ICON_THEME), factory->changed_hook_id);
@@ -921,14 +913,23 @@
ThunarFileIconState icon_state,
gint icon_size)
{
- ThunarFileThumbState thumb_state;
- ThunarVfsInfo *info;
- ThunarVfsPath *path;
- ThunarIconKey key;
- GdkPixbuf *icon = NULL;
- guint64 time;
- gchar *icon_name;
- gchar *thumb_path;
+ GInputStream *stream;
+ GtkIconInfo *icon_info;
+#if 0
+ TumblerFileInfo *info;
+ const gchar *content_type;
+#endif
+ const gchar *thumbnail_path;
+ GdkPixbuf *icon = NULL;
+ GIcon *gicon;
+#if 0
+ gchar **uris;
+ gchar **types;
+#endif
+ gchar *icon_name;
+#if 0
+ gchar *uri;
+#endif
_thunar_return_val_if_fail (THUNAR_IS_ICON_FACTORY (factory), NULL);
_thunar_return_val_if_fail (THUNAR_IS_FILE (file), NULL);
@@ -948,110 +949,50 @@
/* check if thumbnails are enabled and we can display a thumbnail for the item */
if (G_LIKELY (factory->show_thumbnails && thunar_file_is_regular (file)))
{
- /* determine the thumbnail state */
- thumb_state = thunar_file_get_thumb_state (file);
+ gicon = thunar_file_get_preview_icon (file);
- /* check if we haven't yet determine the thumbnail state */
- if (thumb_state == THUNAR_FILE_THUMB_STATE_UNKNOWN)
+ if (gicon != NULL)
{
-again:
- /* determine the ThunarVfsInfo for the file */
- info = thunarx_file_info_get_vfs_info (THUNARX_FILE_INFO (file));
- if (info != NULL)
+ if (G_IS_THEMED_ICON (gicon))
{
- /* try to load an existing thumbnail for the file */
- thumb_path = thunar_vfs_thumb_factory_lookup_thumbnail (factory->thumbnail_factory, info);
+ icon_info = gtk_icon_theme_lookup_by_gicon (factory->icon_theme,
+ gicon, icon_size,
+ GTK_ICON_LOOKUP_USE_BUILTIN);
- /* check if we can generate a thumbnail in case there's none yet */
- if (G_UNLIKELY (thumb_path == NULL && thunar_vfs_thumb_factory_can_thumbnail (factory->thumbnail_factory, info)))
+ if (icon_info != NULL)
{
- /* schedule the thumbnail loading for the file */
- thunar_thumbnail_generator_enqueue (factory->thumbnail_generator, file);
-
- /* set the thumbnail state to "loading" */
- thumb_state = THUNAR_FILE_THUMB_STATE_LOADING;
+ icon = gtk_icon_info_load_icon (icon_info, NULL);
+ gtk_icon_info_free (icon_info);
}
+ }
+ else if (G_IS_LOADABLE_ICON (gicon))
+ {
+ stream = g_loadable_icon_load (G_LOADABLE_ICON (icon), icon_size, NULL,
+ NULL, NULL);
- if (G_LIKELY (thumb_path != NULL))
+ if (stream != NULL)
{
- thumb_state = THUNAR_FILE_THUMB_STATE_READY;
- g_object_set_qdata_full (G_OBJECT (file), thunar_file_thumb_path_quark, thumb_path, g_free);
+ icon = gdk_pixbuf_new_from_stream (stream, NULL, NULL);
+ g_object_unref (stream);
}
- else if (thumb_state != THUNAR_FILE_THUMB_STATE_LOADING)
- {
- thumb_state = THUNAR_FILE_THUMB_STATE_NONE;
- }
+ }
- /* apply the new state */
- thunar_file_set_thumb_state (file, thumb_state);
+ g_object_unref (gicon);
- /* release the file info */
- thunar_vfs_info_unref (info);
- }
+ if (icon != NULL)
+ return icon;
}
-
- /* check if we have a thumbnail path loaded */
- if (thumb_state == THUNAR_FILE_THUMB_STATE_READY)
+ else
{
- thumb_path = g_object_get_qdata (G_OBJECT (file), thunar_file_thumb_path_quark);
- if (G_LIKELY (thumb_path != NULL))
+ thumbnail_path = thunar_file_get_thumbnail_path (file);
+ if (thumbnail_path != NULL)
{
- /* try to load the thumbnail for the given path */
- icon = thunar_icon_factory_lookup_icon (factory, thumb_path, icon_size, FALSE);
- if (G_LIKELY (icon != NULL))
- {
- /* determine the VFS info for the file */
- info = thunarx_file_info_get_vfs_info (THUNARX_FILE_INFO (file));
- if (info != NULL)
- {
- /* determine mtime and path for the thumbnail */
- path = g_object_get_qdata (G_OBJECT (icon), thunar_icon_thumb_path_quark);
- time = GPOINTER_TO_UINT (g_object_get_qdata (G_OBJECT (icon), thunar_icon_thumb_time_quark));
-
- /* check if mtime and path was already associated with the thumbnail */
- if (G_UNLIKELY (path == NULL))
- {
- /* just save mtime and path for the thumbnail */
- g_object_set_qdata_full (G_OBJECT (icon), thunar_icon_thumb_path_quark,
- thunar_vfs_path_ref (info->path),
- (GDestroyNotify) thunar_vfs_path_unref);
- g_object_set_qdata (G_OBJECT (icon), thunar_icon_thumb_time_quark,
- GUINT_TO_POINTER (info->mtime));
- }
- else if (G_UNLIKELY (time != info->mtime || !thunar_vfs_path_equal (path, info->path)))
- {
- /* the thumbnail is no longer valid, remove it from our internal cache */
- key.name = thumb_path;
- key.size = icon_size;
-
- /* try to remove based on the key */
- if (g_hash_table_remove (factory->icon_cache, &key))
- {
- /* we only restart the operation if we were successfull, else we could recurse infinitely */
- thumb_state = THUNAR_FILE_THUMB_STATE_UNKNOWN;
- g_object_unref (G_OBJECT (icon));
- goto again;
- }
- }
-
- /* release the info */
- thunar_vfs_info_unref (info);
-
- /* ok, we have a valid thumbnail */
- return icon;
- }
- }
+ icon = thunar_icon_factory_load_from_file (factory, thumbnail_path,
+ icon_size);
+ if (icon != NULL)
+ return icon;
}
}
-
- /* check if we are currently loading a thumbnail */
- if (G_UNLIKELY (thumb_state == THUNAR_FILE_THUMB_STATE_LOADING))
- {
- /* check if the icon theme supports the loading icon */
- icon = thunar_icon_factory_lookup_icon (factory, "gnome-fs-loading-icon", icon_size, FALSE);
- if (G_LIKELY (icon != NULL))
- return icon;
- }
}
/* lookup the icon name for the icon in the given state and load the icon */
Added: thunar/branches/migration-to-gio/thunar/thunar-image.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-image.c (rev 0)
+++ thunar/branches/migration-to-gio/thunar/thunar-image.c 2009-06-12 00:21:23 UTC (rev 30001)
@@ -0,0 +1,396 @@
+/* vi:set et ai sw=2 sts=2 ts=2: */
+/*-
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include <thunar/thunar-application.h>
+#include <thunar/thunar-image.h>
+#include <thunar/thunar-icon-factory.h>
+#include <thunar/thunar-private.h>
+#include <thunar/thunar-thumbnailer.h>
+
+
+
+#define THUNAR_IMAGE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), THUNAR_TYPE_IMAGE, ThunarImagePrivate))
+
+
+
+/* Property identifiers */
+enum
+{
+ PROP_0,
+ PROP_FILE,
+};
+
+
+
+static void thunar_image_finalize (GObject *object);
+static void thunar_image_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void thunar_image_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void thunar_image_file_changed (ThunarImage *image);
+static void thunar_image_thumbnailer_error (ThunarThumbnailer *thumbnailer,
+ guint handle,
+ const gchar **uris,
+ gint code,
+ const gchar *message,
+ ThunarImage *image);
+static void thunar_image_thumbnailer_finished (ThunarThumbnailer *thumbnailer,
+ guint handle,
+ ThunarImage *image);
+static void thunar_image_thumbnailer_started (ThunarThumbnailer *thumbnailer,
+ guint handle,
+ ThunarImage *image);
+
+
+
+struct _ThunarImageClass
+{
+ GtkImageClass __parent__;
+};
+
+struct _ThunarImage
+{
+ GtkImage __parent__;
+
+ ThunarImagePrivate *priv;
+};
+
+struct _ThunarImagePrivate
+{
+ ThunarThumbnailer *thumbnailer;
+ ThunarFile *file;
+ guint thumbnailer_handle;
+};
+
+
+
+G_DEFINE_TYPE (ThunarImage, thunar_image, GTK_TYPE_IMAGE);
+
+
+
+static void
+thunar_image_class_init (ThunarImageClass *klass)
+{
+ GObjectClass *gobject_class;
+
+ g_type_class_add_private (klass, sizeof (ThunarImagePrivate));
+
+ gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->finalize = thunar_image_finalize;
+ gobject_class->get_property = thunar_image_get_property;
+ gobject_class->set_property = thunar_image_set_property;
+
+ g_object_class_install_property (gobject_class, PROP_FILE,
+ g_param_spec_object ("file",
+ "file",
+ "file",
+ THUNAR_TYPE_FILE,
+ G_PARAM_READWRITE));
+}
+
+
+
+static void
+thunar_image_init (ThunarImage *image)
+{
+ image->priv = THUNAR_IMAGE_GET_PRIVATE (image);
+ image->priv->file = NULL;
+
+ g_signal_connect (image, "notify::file", G_CALLBACK (thunar_image_file_changed), NULL);
+
+ image->priv->thumbnailer = thunar_thumbnailer_new ();
+}
+
+
+
+static void
+thunar_image_finalize (GObject *object)
+{
+ ThunarImage *image = THUNAR_IMAGE (object);
+
+ thunar_image_set_file (image, NULL);
+
+ g_object_unref (image->priv->thumbnailer);
+
+ (*G_OBJECT_CLASS (thunar_image_parent_class)->finalize) (object);
+}
+
+
+
+static void
+thunar_image_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ ThunarImage *image = THUNAR_IMAGE (object);
+
+ switch (prop_id)
+ {
+ case PROP_FILE:
+ g_value_set_object (value, image->priv->file);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+
+
+static void
+thunar_image_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ ThunarImage *image = THUNAR_IMAGE (object);
+
+ switch (prop_id)
+ {
+ case PROP_FILE:
+ thunar_image_set_file (image, g_value_get_object (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+
+
+static void
+thunar_image_file_changed (ThunarImage *image)
+{
+ ThunarIconFactory *icon_factory;
+ GtkIconTheme *icon_theme;
+ GdkPixbuf *icon;
+ GdkScreen *screen;
+
+ _thunar_return_if_fail (THUNAR_IS_IMAGE (image));
+
+ if (image->priv->thumbnailer_handle != 0)
+ {
+ thunar_thumbnailer_unqueue (image->priv->thumbnailer,
+ image->priv->thumbnailer_handle);
+
+ image->priv->thumbnailer_handle = 0;
+
+ g_signal_handlers_disconnect_matched (image->priv->thumbnailer,
+ G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL,
+ image);
+ }
+
+ gtk_image_set_from_pixbuf (GTK_IMAGE (image), NULL);
+
+ if (image->priv->file != NULL)
+ {
+ g_signal_connect (image->priv->thumbnailer, "error",
+ G_CALLBACK (thunar_image_thumbnailer_error), image);
+ g_signal_connect (image->priv->thumbnailer, "finished",
+ G_CALLBACK (thunar_image_thumbnailer_finished), image);
+ g_signal_connect (image->priv->thumbnailer, "started",
+ G_CALLBACK (thunar_image_thumbnailer_started), image);
+
+ if (!thunar_thumbnailer_queue_file (image->priv->thumbnailer, image->priv->file,
+ &image->priv->thumbnailer_handle))
+ {
+ g_signal_handlers_disconnect_matched (image->priv->thumbnailer,
+ G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL,
+ image);
+ }
+
+ screen = gtk_widget_get_screen (GTK_WIDGET (image));
+ icon_theme = gtk_icon_theme_get_for_screen (screen);
+ icon_factory = thunar_icon_factory_get_for_icon_theme (icon_theme);
+
+ icon = thunar_icon_factory_load_file_icon (icon_factory, image->priv->file,
+ THUNAR_FILE_ICON_STATE_DEFAULT, 48);
+
+ gtk_image_set_from_pixbuf (GTK_IMAGE (image), icon);
+
+ g_object_unref (icon_factory);
+ }
+}
+
+
+
+static void
+thunar_image_thumbnailer_error (ThunarThumbnailer *thumbnailer,
+ guint handle,
+ const gchar **uris,
+ gint code,
+ const gchar *message,
+ ThunarImage *image)
+{
+ ThunarIconFactory *icon_factory;
+ GtkIconTheme *icon_theme;
+ GdkPixbuf *icon;
+ GdkScreen *screen;
+
+ _thunar_return_if_fail (THUNAR_IS_IMAGE (image));
+
+ if (image->priv->thumbnailer_handle != handle)
+ return;
+
+ image->priv->thumbnailer_handle = 0;
+
+ if (image->priv->file == NULL)
+ {
+ gtk_image_set_from_pixbuf (GTK_IMAGE (image), NULL);
+ }
+ else
+ {
+ screen = gtk_widget_get_screen (GTK_WIDGET (image));
+ icon_theme = gtk_icon_theme_get_for_screen (screen);
+ icon_factory = thunar_icon_factory_get_for_icon_theme (icon_theme);
+
+ icon = thunar_icon_factory_load_file_icon (icon_factory, image->priv->file,
+ THUNAR_FILE_ICON_STATE_DEFAULT, 48);
+
+ gtk_image_set_from_pixbuf (GTK_IMAGE (image), icon);
+
+ g_object_unref (icon_factory);
+ }
+}
+
+
+
+static void
+thunar_image_thumbnailer_finished (ThunarThumbnailer *thumbnailer,
+ guint handle,
+ ThunarImage *image)
+{
+ ThunarIconFactory *icon_factory;
+ GtkIconTheme *icon_theme;
+ GdkPixbuf *icon;
+ GdkScreen *screen;
+
+ _thunar_return_if_fail (THUNAR_IS_IMAGE (image));
+
+ if (image->priv->thumbnailer_handle != handle)
+ return;
+
+ image->priv->thumbnailer_handle = 0;
+
+ g_signal_handlers_disconnect_matched (image->priv->thumbnailer,
+ G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL,
+ image);
+
+ if (image->priv->file == NULL)
+ {
+ gtk_image_set_from_pixbuf (GTK_IMAGE (image), NULL);
+ }
+ else
+ {
+ /* TODO we only need to reload if the thumbnail was regenerated */
+ thunar_file_changed (image->priv->file);
+
+ screen = gtk_widget_get_screen (GTK_WIDGET (image));
+ icon_theme = gtk_icon_theme_get_for_screen (screen);
+ icon_factory = thunar_icon_factory_get_for_icon_theme (icon_theme);
+
+ icon = thunar_icon_factory_load_file_icon (icon_factory, image->priv->file,
+ THUNAR_FILE_ICON_STATE_DEFAULT, 48);
+
+ gtk_image_set_from_pixbuf (GTK_IMAGE (image), icon);
+
+ g_object_unref (icon_factory);
+ }
+}
+
+
+
+static void
+thunar_image_thumbnailer_started (ThunarThumbnailer *thumbnailer,
+ guint handle,
+ ThunarImage *image)
+{
+ ThunarIconFactory *icon_factory;
+ GtkIconTheme *icon_theme;
+ GdkPixbuf *icon;
+ GdkScreen *screen;
+
+ _thunar_return_if_fail (THUNAR_IS_IMAGE (image));
+
+ if (image->priv->thumbnailer_handle != handle)
+ return;
+
+ if (image->priv->file == NULL)
+ {
+ gtk_image_set_from_pixbuf (GTK_IMAGE (image), NULL);
+ }
+ else
+ {
+ screen = gtk_widget_get_screen (GTK_WIDGET (image));
+ icon_theme = gtk_icon_theme_get_for_screen (screen);
+ icon_factory = thunar_icon_factory_get_for_icon_theme (icon_theme);
+
+ icon = thunar_icon_factory_load_icon (icon_factory, "gnome-fs-loading-icon", 48,
+ NULL, FALSE);
+
+ gtk_image_set_from_pixbuf (GTK_IMAGE (image), icon);
+
+ g_object_unref (icon_factory);
+ }
+}
+
+
+
+GtkWidget *
+thunar_image_new (void)
+{
+ return g_object_new (THUNAR_TYPE_IMAGE, NULL);
+}
+
+
+
+void
+thunar_image_set_file (ThunarImage *image,
+ ThunarFile *file)
+{
+ _thunar_return_if_fail (THUNAR_IS_IMAGE (image));
+
+ if (image->priv->file != NULL)
+ {
+ if (image->priv->file == file)
+ return;
+
+ g_object_unref (image->priv->file);
+ }
+
+ if (file != NULL)
+ image->priv->file = g_object_ref (file);
+ else
+ image->priv->file = NULL;
+
+ g_object_notify (G_OBJECT (image), "file");
+}
Added: thunar/branches/migration-to-gio/thunar/thunar-image.h
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-image.h (rev 0)
+++ thunar/branches/migration-to-gio/thunar/thunar-image.h 2009-06-12 00:21:23 UTC (rev 30001)
@@ -0,0 +1,47 @@
+/* vi:set et ai sw=2 sts=2 ts=2: */
+/*-
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __THUNAR_IMAGE_H__
+#define __THUNAR_IMAGE_H__
+
+#include <thunar/thunar-file.h>
+
+G_BEGIN_DECLS;
+
+#define THUNAR_TYPE_IMAGE (thunar_image_get_type ())
+#define THUNAR_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THUNAR_TYPE_IMAGE, ThunarImage))
+#define THUNAR_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), THUNAR_TYPE_IMAGE, ThunarImageClass))
+#define THUNAR_IS_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THUNAR_TYPE_IMAGE))
+#define THUNAR_IS_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), THUNAR_TYPE_IMAGE)
+#define THUNAR_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THUNAR_TYPE_IMAGE, ThunarImageClass))
+
+typedef struct _ThunarImagePrivate ThunarImagePrivate;
+typedef struct _ThunarImageClass ThunarImageClass;
+typedef struct _ThunarImage ThunarImage;
+
+GType thunar_image_get_type (void) G_GNUC_CONST;
+
+GtkWidget *thunar_image_new (void) G_GNUC_MALLOC;
+void thunar_image_set_file (ThunarImage *image,
+ ThunarFile *file);
+
+G_END_DECLS;
+
+#endif /* !__THUNAR_IMAGE_H__ */
Modified: thunar/branches/migration-to-gio/thunar/thunar-list-model.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-list-model.c 2009-06-10 21:55:45 UTC (rev 30000)
+++ thunar/branches/migration-to-gio/thunar/thunar-list-model.c 2009-06-12 00:21:23 UTC (rev 30001)
@@ -29,10 +29,12 @@
#include <string.h>
#endif
+#include <thunar/thunar-application.h>
#include <thunar/thunar-file-monitor.h>
#include <thunar/thunar-gobject-extensions.h>
#include <thunar/thunar-list-model.h>
#include <thunar/thunar-private.h>
+#include <thunar/thunar-thumbnailer.h>
#include <thunar/thunar-user.h>
@@ -189,6 +191,21 @@
static gint sort_by_type (const ThunarFile *a,
const ThunarFile *b,
gboolean case_sensitive);
+static void thunar_list_model_thumbnailer_error (ThunarThumbnailer *thumbnailer,
+ guint request,
+ const gchar **uris,
+ gint code,
+ const gchar *message,
+ ThunarListModel *store);
+static void thunar_list_model_thumbnailer_finished (ThunarThumbnailer *thumbnailer,
+ guint request,
+ ThunarListModel *store);
+static void thunar_list_model_thumbnailer_ready (ThunarThumbnailer *thumbnailer,
+ const gchar **uris,
+ ThunarListModel *store);
+static void thunar_list_model_thumbnailer_started (ThunarThumbnailer *thumbnailer,
+ guint request,
+ ThunarListModel *store);
@@ -238,6 +255,10 @@
gint (*sort_func) (const ThunarFile *a,
const ThunarFile *b,
gboolean case_sensitive);
+
+ ThunarThumbnailer *thumbnailer;
+ GHashTable *thumbnailer_files;
+ GList *thumbnailer_requests;
};
struct _SortTuple
@@ -479,7 +500,22 @@
* connect "changed" to every single ThunarFile we own.
*/
store->file_monitor = thunar_file_monitor_get_default ();
- g_signal_connect (G_OBJECT (store->file_monitor), "file-changed", G_CALLBACK (thunar_list_model_file_changed), store);
+ g_signal_connect (G_OBJECT (store->file_monitor), "file-changed",
+ G_CALLBACK (thunar_list_model_file_changed), store);
+
+ store->thumbnailer_files = g_hash_table_new_full (g_str_hash, g_str_equal,
+ g_free, NULL);
+ store->thumbnailer_requests = NULL;
+
+ store->thumbnailer = thunar_thumbnailer_new ();
+ g_signal_connect (store->thumbnailer, "error",
+ G_CALLBACK (thunar_list_model_thumbnailer_error), store);
+ g_signal_connect (store->thumbnailer, "finished",
+ G_CALLBACK (thunar_list_model_thumbnailer_finished), store);
+ g_signal_connect (store->thumbnailer, "ready",
+ G_CALLBACK (thunar_list_model_thumbnailer_ready), store);
+ g_signal_connect (store->thumbnailer, "started",
+ G_CALLBACK (thunar_list_model_thumbnailer_started), store);
}
@@ -488,7 +524,20 @@
thunar_list_model_finalize (GObject *object)
{
ThunarListModel *store = THUNAR_LIST_MODEL (object);
+ GList *lp;
+ /* unqueue all pending thumbnailer requests */
+ for (lp = store->thumbnailer_requests; lp != NULL; lp = lp->next)
+ thunar_thumbnailer_unqueue (store->thumbnailer, GPOINTER_TO_UINT (lp->data));
+
+ /* destroy the URI to thumbnailer request mapping */
+ g_hash_table_unref (store->thumbnailer_files);
+
+ /* release the reference on the thumbnailer */
+ g_signal_handlers_disconnect_matched (store->thumbnailer, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, store);
+ g_object_unref (store->thumbnailer);
+
/* unlink from the folder (if any) */
thunar_list_model_set_folder (store, NULL);
@@ -1290,6 +1339,8 @@
ThunarFile *file;
GSList *prev = NULL;
GSList *row;
+ GList *lp;
+ guint request;
gint *indices;
gint index = 0;
@@ -1300,7 +1351,20 @@
*/
path = gtk_tree_path_new_from_indices (0, -1);
indices = gtk_tree_path_get_indices (path);
+
+ if (thunar_thumbnailer_queue_files (store->thumbnailer, files, &request))
+ {
+ for (lp = files; lp != NULL; lp = lp->next)
+ {
+ g_hash_table_insert (store->thumbnailer_files,
+ thunar_file_dup_uri (lp->data),
+ GUINT_TO_POINTER (request));
+ }
+ store->thumbnailer_requests = g_list_prepend (store->thumbnailer_requests,
+ GUINT_TO_POINTER (request));
+ }
+
/* process all added files */
for (; files != NULL; files = files->next)
{
@@ -1616,6 +1680,82 @@
+static void
+thunar_list_model_thumbnailer_error (ThunarThumbnailer *thumbnailer,
+ guint request,
+ const gchar **uris,
+ gint code,
+ const gchar *message,
+ ThunarListModel *store)
+{
+ guint n;
+
+ _thunar_return_if_fail (THUNAR_IS_THUMBNAILER (thumbnailer));
+ _thunar_return_if_fail (uris != NULL);
+ _thunar_return_if_fail (message != NULL);
+ _thunar_return_if_fail (THUNAR_IS_LIST_MODEL (store));
+
+ for (n = 0; uris[n] != NULL; ++n)
+ g_hash_table_remove (store->thumbnailer_files, uris[n]);
+}
+
+
+
+static void
+thunar_list_model_thumbnailer_finished (ThunarThumbnailer *thumbnailer,
+ guint request,
+ ThunarListModel *store)
+{
+ _thunar_return_if_fail (THUNAR_IS_THUMBNAILER (thumbnailer));
+ _thunar_return_if_fail (THUNAR_IS_LIST_MODEL (store));
+
+ store->thumbnailer_requests = g_list_remove_all (store->thumbnailer_requests,
+ GUINT_TO_POINTER (request));
+}
+
+
+
+static void
+thunar_list_model_thumbnailer_ready (ThunarThumbnailer *thumbnailer,
+ const gchar **uris,
+ ThunarListModel *store)
+{
+ ThunarFile *file;
+ GFile *gfile;
+ guint n;
+
+ _thunar_return_if_fail (THUNAR_IS_THUMBNAILER (thumbnailer));
+ _thunar_return_if_fail (uris != NULL);
+ _thunar_return_if_fail (THUNAR_IS_LIST_MODEL (store));
+
+ for (n = 0; uris[n] != NULL; ++n)
+ {
+ if (g_hash_table_lookup (store->thumbnailer_files, uris[n]) != NULL)
+ {
+ gfile = g_file_new_for_uri (uris[n]);
+ file = thunar_file_cache_lookup (gfile);
+ g_object_unref (gfile);
+
+ if (file != NULL)
+ thunar_file_changed (file);
+
+ g_hash_table_remove (store->thumbnailer_files, uris[n]);
+ }
+ }
+}
+
+
+
+static void
+thunar_list_model_thumbnailer_started (ThunarThumbnailer *thumbnailer,
+ guint request,
+ ThunarListModel *store)
+{
+ /* TODO Set the status of the corresponding ThunarFile's to LOADING */
+}
+
+
+
/**
* thunar_list_model_new:
*
@@ -1645,11 +1785,7 @@
thunar_list_model_new_with_folder (ThunarFolder *folder)
{
_thunar_return_val_if_fail (THUNAR_IS_FOLDER (folder), NULL);
-
- /* allocate the new list model */
- return g_object_new (THUNAR_TYPE_LIST_MODEL,
- "folder", folder,
- NULL);
+ return g_object_new (THUNAR_TYPE_LIST_MODEL, "folder", folder, NULL);
}
@@ -1793,6 +1929,11 @@
if (G_UNLIKELY (store->folder == folder))
return;
+ g_hash_table_remove_all (store->thumbnailer_files);
+
+ for (lp = store->thumbnailer_requests; lp != NULL; lp = lp->next)
+ thunar_thumbnailer_unqueue (store->thumbnailer, GPOINTER_TO_UINT (lp->data));
+
/* unlink from the previously active folder (if any) */
if (G_LIKELY (store->folder != NULL))
{
Modified: thunar/branches/migration-to-gio/thunar/thunar-marshal.list
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-marshal.list 2009-06-10 21:55:45 UTC (rev 30000)
+++ thunar/branches/migration-to-gio/thunar/thunar-marshal.list 2009-06-12 00:21:23 UTC (rev 30001)
@@ -6,3 +6,4 @@
VOID:BOXED,POINTER
VOID:STRING,STRING
VOID:UINT64,UINT,UINT,UINT
+VOID:UINT,POINTER,UINT,STRING
Modified: thunar/branches/migration-to-gio/thunar/thunar-path-entry.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-path-entry.c 2009-06-10 21:55:45 UTC (rev 30000)
+++ thunar/branches/migration-to-gio/thunar/thunar-path-entry.c 2009-06-12 00:21:23 UTC (rev 30001)
@@ -831,6 +831,9 @@
current_folder = (folder_path != NULL) ? thunar_file_get (folder_path, NULL) : NULL;
current_file = (file_path != NULL) ? thunar_file_get (file_path, NULL) : NULL;
+ /* TODO Fix bug with non-existent folders */
+ _thunar_assert (current_folder == NULL || thunar_file_is_directory (current_folder));
+
/* determine the entry completion */
completion = gtk_entry_get_completion (GTK_ENTRY (path_entry));
Modified: thunar/branches/migration-to-gio/thunar/thunar-private.h
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-private.h 2009-06-10 21:55:45 UTC (rev 30000)
+++ thunar/branches/migration-to-gio/thunar/thunar-private.h 2009-06-12 00:21:23 UTC (rev 30001)
@@ -91,8 +91,6 @@
}G_STMT_END
#endif
-#if GLIB_CHECK_VERSION(2,14,0)
-
#define XDG_USER_DIRS_PACKAGE "xdg-user-dirs"
#define LOCALE_FILE_NAME "user-dirs.locale"
@@ -107,27 +105,9 @@
#define THUNAR_USER_DIRECTORY_VIDEOS G_USER_DIRECTORY_VIDEOS
#define THUNAR_USER_N_DIRECTORIES (8)
-#if GLIB_CHECK_VERSION(2, 14, 0)
gchar *_thunar_get_xdg_user_dirs_locale (void);
-#endif
extern const gchar *_thunar_user_directory_names[THUNAR_USER_N_DIRECTORIES+1];
-#else /* GLIB_CHECK_VERSION(2,14,0) */
-typedef enum
-{
- THUNAR_USER_DIRECTORY_DESKTOP = 0,
- THUNAR_USER_DIRECTORY_DOCUMENTS,
- THUNAR_USER_DIRECTORY_DOWNLOAD,
- THUNAR_USER_DIRECTORY_MUSIC,
- THUNAR_USER_DIRECTORY_PICTURES,
- THUNAR_USER_DIRECTORY_PUBLIC_SHARE,
- THUNAR_USER_DIRECTORY_TEMPLATES,
- THUNAR_USER_DIRECTORY_VIDEOS,
- THUNAR_USER_N_DIRECTORIES
-} ThunarUserDirectory;
-
-#endif /*GLIB_CHECK_VERSION(2,14,0) */
-
G_END_DECLS;
#endif /* !__THUNAR_PRIVATE_H__ */
Modified: thunar/branches/migration-to-gio/thunar/thunar-properties-dialog.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-properties-dialog.c 2009-06-10 21:55:45 UTC (rev 30000)
+++ thunar/branches/migration-to-gio/thunar/thunar-properties-dialog.c 2009-06-12 00:21:23 UTC (rev 30001)
@@ -34,6 +34,7 @@
#include <exo/exo.h>
#include <thunar/thunar-abstract-dialog.h>
+#include <thunar/thunar-application.h>
#include <thunar/thunar-chooser-button.h>
#include <thunar/thunar-dialogs.h>
#include <thunar/thunar-emblem-chooser.h>
@@ -41,6 +42,7 @@
#include <thunar/thunar-gobject-extensions.h>
#include <thunar/thunar-gtk-extensions.h>
#include <thunar/thunar-icon-factory.h>
+#include <thunar/thunar-image.h>
#include <thunar/thunar-io-jobs.h>
#include <thunar/thunar-job.h>
#include <thunar/thunar-marshal.h>
@@ -131,7 +133,6 @@
GtkWidget *volume_image;
GtkWidget *volume_label;
GtkWidget *permissions_chooser;
-
};
@@ -277,7 +278,7 @@
gtk_box_pack_start (GTK_BOX (box), dialog->icon_button, FALSE, TRUE, 0);
gtk_widget_show (dialog->icon_button);
- dialog->icon_image = gtk_image_new ();
+ dialog->icon_image = thunar_image_new ();
gtk_box_pack_start (GTK_BOX (box), dialog->icon_image, FALSE, TRUE, 0);
gtk_widget_show (dialog->icon_image);
@@ -833,7 +834,6 @@
const gchar *content_type;
const gchar *name;
const gchar *path;
- GdkPixbuf *icon;
GVolume *volume;
guint64 size;
GIcon *gicon;
@@ -858,12 +858,8 @@
gtk_window_set_title (GTK_WINDOW (dialog), str);
g_free (str);
- /* update the icon */
- icon = thunar_icon_factory_load_file_icon (icon_factory, dialog->file, THUNAR_FILE_ICON_STATE_DEFAULT, 48);
- gtk_image_set_from_pixbuf (GTK_IMAGE (dialog->icon_image), icon);
- gtk_window_set_icon (GTK_WINDOW (dialog), icon);
- if (G_LIKELY (icon != NULL))
- g_object_unref (G_OBJECT (icon));
+ /* update the preview image */
+ thunar_image_set_file (THUNAR_IMAGE (dialog->icon_image), dialog->file);
/* check if the icon may be changed (only for writable .desktop files) */
g_object_ref (G_OBJECT (dialog->icon_image));
Added: thunar/branches/migration-to-gio/thunar/thunar-thumbnailer-dbus.xml
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-thumbnailer-dbus.xml (rev 0)
+++ thunar/branches/migration-to-gio/thunar/thunar-thumbnailer-dbus.xml 2009-06-12 00:21:23 UTC (rev 30001)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<node name="/org/freedesktop/thumbnails/Thumbnailer">
+ <interface name="org.freedesktop.thumbnails.Thumbnailer">
+ <method name="Queue">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
+ <arg type="as" name="uris" direction="in" />
+ <arg type="as" name="mime_hints" direction="in" />
+ <arg type="u" name="handle_to_unqueue" direction="in" />
+ <arg type="u" name="handle" direction="out" />
+ </method>
+
+ <method name="Unqueue">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
+ <arg type="u" name="handle" direction="in" />
+ </method>
+
+ <signal name="Started">
+ <arg type="u" name="handle" />
+ </signal>
+
+ <signal name="Finished">
+ <arg type="u" name="handle" />
+ </signal>
+
+ <signal name="Ready">
+ <arg type="as" name="uris" />
+ </signal>
+
+ <signal name="Error">
+ <arg type="u" name="handle" />
+ <arg type="as" name="failed_uris" />
+ <arg type="i" name="error_code" />
+ <arg type="s" name="message" />
+ </signal>
+ </interface>
+</node>
Added: thunar/branches/migration-to-gio/thunar/thunar-thumbnailer.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-thumbnailer.c (rev 0)
+++ thunar/branches/migration-to-gio/thunar/thunar-thumbnailer.c 2009-06-12 00:21:23 UTC (rev 30001)
@@ -0,0 +1,434 @@
+/* $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
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+
+#include <thunar/thunar-marshal.h>
+#include <thunar/thunar-private.h>
+#include <thunar/thunar-thumbnailer.h>
+#include <thunar/thunar-thumbnailer-proxy.h>
+
+
+
+/* signal identifiers */
+enum
+{
+ SIGNAL_ERROR,
+ SIGNAL_FINISHED,
+ SIGNAL_READY,
+ SIGNAL_STARTED,
+ LAST_SIGNAL,
+};
+
+
+
+static void thunar_thumbnailer_finalize (GObject *object);
+static void thunar_thumbnailer_thumbnailer_error (DBusGProxy *proxy,
+ guint handle,
+ const gchar **uris,
+ gint code,
+ const gchar *message,
+ ThunarThumbnailer *thumbnailer);
+static void thunar_thumbnailer_thumbnailer_finished (DBusGProxy *proxy,
+ guint handle,
+ ThunarThumbnailer *thumbnailer);
+static void thunar_thumbnailer_thumbnailer_ready (DBusGProxy *proxy,
+ const gchar **uris,
+ ThunarThumbnailer *thumbnailer);
+static void thunar_thumbnailer_thumbnailer_started (DBusGProxy *proxy,
+ guint handle,
+ ThunarThumbnailer *thumbnailer);
+
+
+
+struct _ThunarThumbnailerClass
+{
+ GObjectClass __parent__;
+};
+
+struct _ThunarThumbnailer
+{
+ GObject __parent__;
+
+ DBusGProxy *thumbnailer_proxy;
+ GMutex *lock;
+ GList *requests;
+};
+
+
+
+static DBusGProxy *thunar_thumbnailer_proxy;
+static guint thumbnailer_signals[LAST_SIGNAL];
+
+
+
+G_DEFINE_TYPE (ThunarThumbnailer, thunar_thumbnailer, G_TYPE_OBJECT);
+
+
+
+static void
+thunar_thumbnailer_class_init (ThunarThumbnailerClass *klass)
+{
+ GObjectClass *gobject_class;
+
+ gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->finalize = thunar_thumbnailer_finalize;
+
+ /* TODO this should actually be VOID:UINT,POINTER,INT,STRING */
+ thumbnailer_signals[SIGNAL_ERROR] =
+ g_signal_new ("error",
+ THUNAR_TYPE_THUMBNAILER,
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ _thunar_marshal_VOID__UINT_POINTER_UINT_STRING,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_UINT,
+ G_TYPE_STRV,
+ G_TYPE_UINT,
+ G_TYPE_STRING);
+
+ thumbnailer_signals[SIGNAL_FINISHED] =
+ g_signal_new ("finished",
+ THUNAR_TYPE_THUMBNAILER,
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__UINT,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_UINT);
+
+ thumbnailer_signals[SIGNAL_READY] =
+ g_signal_new ("ready",
+ THUNAR_TYPE_THUMBNAILER,
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_STRV);
+
+ thumbnailer_signals[SIGNAL_STARTED] =
+ g_signal_new ("started",
+ THUNAR_TYPE_THUMBNAILER,
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__UINT,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_UINT);
+}
+
+
+
+static void
+thunar_thumbnailer_init (ThunarThumbnailer *thumbnailer)
+{
+ DBusGConnection *connection;
+
+ thumbnailer->lock = g_mutex_new ();
+
+ connection = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
+
+ if (connection != NULL)
+ {
+ if (thunar_thumbnailer_proxy == NULL)
+ {
+ thunar_thumbnailer_proxy =
+ dbus_g_proxy_new_for_name (connection,
+ "org.freedesktop.thumbnails.Thumbnailer",
+ "/org/freedesktop/thumbnails/Thumbnailer",
+ "org.freedesktop.thumbnails.Thumbnailer");
+
+ g_object_add_weak_pointer (G_OBJECT (thunar_thumbnailer_proxy),
+ (gpointer) &thunar_thumbnailer_proxy);
+
+ thumbnailer->thumbnailer_proxy = thunar_thumbnailer_proxy;
+
+ /* TODO this should actually be VOID:UINT,POINTER,INT,STRING */
+ dbus_g_object_register_marshaller (_thunar_marshal_VOID__UINT_POINTER_UINT_STRING,
+ G_TYPE_NONE,
+ G_TYPE_UINT,
+ G_TYPE_STRV,
+ G_TYPE_UINT,
+ G_TYPE_STRING,
+ G_TYPE_INVALID);
+
+ dbus_g_object_register_marshaller ((GClosureMarshal) g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE,
+ G_TYPE_STRV,
+ G_TYPE_INVALID);
+
+ dbus_g_proxy_add_signal (thumbnailer->thumbnailer_proxy, "Error",
+ G_TYPE_UINT, G_TYPE_STRV, G_TYPE_UINT, G_TYPE_STRING,
+ G_TYPE_INVALID);
+
+ dbus_g_proxy_add_signal (thumbnailer->thumbnailer_proxy, "Finished",
+ G_TYPE_UINT, G_TYPE_INVALID);
+
+ dbus_g_proxy_add_signal (thumbnailer->thumbnailer_proxy, "Ready",
+ G_TYPE_STRV, G_TYPE_INVALID);
+
+ dbus_g_proxy_add_signal (thumbnailer->thumbnailer_proxy, "Started",
+ G_TYPE_UINT, G_TYPE_INVALID);
+ }
+ else
+ {
+ thumbnailer->thumbnailer_proxy = g_object_ref (thunar_thumbnailer_proxy);
+ }
+
+ dbus_g_proxy_connect_signal (thumbnailer->thumbnailer_proxy, "Error",
+ G_CALLBACK (thunar_thumbnailer_thumbnailer_error),
+ thumbnailer, NULL);
+
+ dbus_g_proxy_connect_signal (thumbnailer->thumbnailer_proxy, "Finished",
+ G_CALLBACK (thunar_thumbnailer_thumbnailer_finished),
+ thumbnailer, NULL);
+
+ dbus_g_proxy_connect_signal (thumbnailer->thumbnailer_proxy, "Ready",
+ G_CALLBACK (thunar_thumbnailer_thumbnailer_ready),
+ thumbnailer, NULL);
+
+ dbus_g_proxy_connect_signal (thumbnailer->thumbnailer_proxy, "Started",
+ G_CALLBACK (thunar_thumbnailer_thumbnailer_started),
+ thumbnailer, NULL);
+
+ dbus_g_connection_unref (connection);
+ }
+}
+
+
+
+static void
+thunar_thumbnailer_finalize (GObject *object)
+{
+ ThunarThumbnailer *thumbnailer = THUNAR_THUMBNAILER (object);
+
+ /* acquire the thumbnailer lock */
+ g_mutex_lock (thumbnailer->lock);
+
+ /* release the thumbnail factory */
+ if (thumbnailer->thumbnailer_proxy != NULL)
+ {
+ g_signal_handlers_disconnect_matched (thumbnailer->thumbnailer_proxy,
+ G_SIGNAL_MATCH_DATA, 0, 0,
+ NULL, NULL, thumbnailer);
+ g_object_unref (thumbnailer->thumbnailer_proxy);
+ }
+
+ /* release the thumbnailer lock */
+ g_mutex_unlock (thumbnailer->lock);
+
+ /* release the mutex */
+ g_mutex_free (thumbnailer->lock);
+
+ (*G_OBJECT_CLASS (thunar_thumbnailer_parent_class)->finalize) (object);
+}
+
+
+
+static void
+thunar_thumbnailer_thumbnailer_error (DBusGProxy *proxy,
+ guint handle,
+ const gchar **uris,
+ gint code,
+ const gchar *message,
+ ThunarThumbnailer *thumbnailer)
+{
+ _thunar_return_if_fail (DBUS_IS_G_PROXY (proxy));
+ _thunar_return_if_fail (uris != NULL);
+ _thunar_return_if_fail (message != NULL);
+ _thunar_return_if_fail (THUNAR_IS_THUMBNAILER (thumbnailer));
+
+ g_debug ("error");
+
+ g_signal_emit (thumbnailer, thumbnailer_signals[SIGNAL_ERROR], 0,
+ handle, uris, code, message);
+}
+
+
+
+static void
+thunar_thumbnailer_thumbnailer_finished (DBusGProxy *proxy,
+ guint handle,
+ ThunarThumbnailer *thumbnailer)
+{
+ _thunar_return_if_fail (DBUS_IS_G_PROXY (proxy));
+ _thunar_return_if_fail (THUNAR_IS_THUMBNAILER (thumbnailer));
+
+ g_signal_emit (thumbnailer, thumbnailer_signals[SIGNAL_FINISHED], 0, handle);
+}
+
+
+
+static void
+thunar_thumbnailer_thumbnailer_ready (DBusGProxy *proxy,
+ const gchar **uris,
+ ThunarThumbnailer *thumbnailer)
+{
+ _thunar_return_if_fail (DBUS_IS_G_PROXY (proxy));
+ _thunar_return_if_fail (uris != NULL);
+ _thunar_return_if_fail (THUNAR_IS_THUMBNAILER (thumbnailer));
+
+ g_signal_emit (thumbnailer, thumbnailer_signals[SIGNAL_READY], 0, uris);
+}
+
+
+
+static void
+thunar_thumbnailer_thumbnailer_started (DBusGProxy *proxy,
+ guint handle,
+ ThunarThumbnailer *thumbnailer)
+{
+ _thunar_return_if_fail (DBUS_IS_G_PROXY (proxy));
+ _thunar_return_if_fail (THUNAR_IS_THUMBNAILER (thumbnailer));
+
+ g_signal_emit (thumbnailer, thumbnailer_signals[SIGNAL_STARTED], 0, handle);
+}
+
+
+
+/**
+ * thunar_thumbnailer_new:
+ *
+ * Allocates a new #ThunarThumbnailer object, which can be used to
+ * generate and store thumbnails for files.
+ *
+ * The caller is responsible to free the returned
+ * object using g_object_unref() when no longer needed.
+ *
+ * Return value: a newly allocated #ThunarThumbnailer.
+ **/
+ThunarThumbnailer*
+thunar_thumbnailer_new (void)
+{
+ return g_object_new (THUNAR_TYPE_THUMBNAILER, NULL);
+}
+
+
+
+gboolean
+thunar_thumbnailer_queue_file (ThunarThumbnailer *thumbnailer,
+ ThunarFile *file,
+ guint *handle)
+{
+ const gchar *mime_hints[2] = { NULL, NULL };
+ gboolean success = FALSE;
+ gchar *uris[2] = { NULL, NULL };
+
+ _thunar_return_val_if_fail (THUNAR_IS_THUMBNAILER (thumbnailer), FALSE);
+ _thunar_return_val_if_fail (THUNAR_IS_FILE (file), FALSE);
+ _thunar_return_val_if_fail (handle != NULL, FALSE);
+
+ /* acquire the thumbnailer lock */
+ g_mutex_lock (thumbnailer->lock);
+
+ if (thumbnailer->thumbnailer_proxy != NULL)
+ {
+ uris[0] = thunar_file_dup_uri (file);
+ mime_hints[0] = thunar_file_get_content_type (file);
+
+ success =thunar_thumbnailer_proxy_queue (thumbnailer->thumbnailer_proxy,
+ (const gchar **)uris,
+ mime_hints, 0, handle, NULL);
+
+ g_free (uris[0]);
+ }
+
+ /* release the thumbnailer lock */
+ g_mutex_unlock (thumbnailer->lock);
+
+ return success;
+}
+
+
+
+gboolean
+thunar_thumbnailer_queue_files (ThunarThumbnailer *thumbnailer,
+ GList *files,
+ guint *handle)
+{
+ const gchar **mime_hints;
+ gboolean success = FALSE;
+ GList *lp;
+ gchar **uris;
+ guint n;
+
+ _thunar_return_val_if_fail (THUNAR_IS_THUMBNAILER (thumbnailer), FALSE);
+ _thunar_return_val_if_fail (files != NULL, FALSE);
+ _thunar_return_val_if_fail (handle != NULL, FALSE);
+
+ /* acquire the thumbnailer lock */
+ g_mutex_lock (thumbnailer->lock);
+
+ if (thumbnailer->thumbnailer_proxy != NULL)
+ {
+ uris = g_new0 (gchar *, g_list_length (files) + 1);
+ mime_hints = g_new0 (const gchar *, g_list_length (files) + 1);
+
+ for (lp = g_list_last (files), n = 0; lp != NULL; lp = lp->prev, ++n)
+ {
+ uris[n] = thunar_file_dup_uri (lp->data);
+ mime_hints[n] = thunar_file_get_content_type (lp->data);
+ }
+
+ uris[n] = NULL;
+ mime_hints[n] = NULL;
+
+ success = thunar_thumbnailer_proxy_queue (thumbnailer->thumbnailer_proxy,
+ (const gchar **)uris, mime_hints,
+ 0, handle, NULL);
+
+ g_strfreev (uris);
+ g_free (mime_hints);
+ }
+
+ /* release the thumbnailer lock */
+ g_mutex_unlock (thumbnailer->lock);
+
+ return success;
+}
+
+
+
+void
+thunar_thumbnailer_unqueue (ThunarThumbnailer *thumbnailer,
+ guint handle)
+{
+ _thunar_return_if_fail (THUNAR_IS_THUMBNAILER (thumbnailer));
+
+ /* acquire the thumbnailer lock */
+ g_mutex_lock (thumbnailer->lock);
+
+ if (thumbnailer->thumbnailer_proxy != NULL)
+ thunar_thumbnailer_proxy_unqueue (thumbnailer->thumbnailer_proxy, handle, NULL);
+
+ /* release the thumbnailer lock */
+ g_mutex_unlock (thumbnailer->lock);
+}
Added: thunar/branches/migration-to-gio/thunar/thunar-thumbnailer.h
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-thumbnailer.h (rev 0)
+++ thunar/branches/migration-to-gio/thunar/thunar-thumbnailer.h 2009-06-12 00:21:23 UTC (rev 30001)
@@ -0,0 +1,52 @@
+/* $Id$ */
+/*-
+ * 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_THUMBNAILER_H__
+#define __THUNAR_THUMBNAILER_H__
+
+#include <thunar/thunar-file.h>
+
+G_BEGIN_DECLS;
+
+typedef struct _ThunarThumbnailerClass ThunarThumbnailerClass;
+typedef struct _ThunarThumbnailer ThunarThumbnailer;
+
+#define THUNAR_TYPE_THUMBNAILER (thunar_thumbnailer_get_type ())
+#define THUNAR_THUMBNAILER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THUNAR_TYPE_THUMBNAILER, ThunarThumbnailer))
+#define THUNAR_THUMBNAILER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), THUNAR_TYPE_THUMBNAILER, ThunarThumbnailerClass))
+#define THUNAR_IS_THUMBNAILER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THUNAR_TYPE_THUMBNAILER))
+#define THUNAR_IS_THUMBNAILER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), THUNAR_TYPE_THUMBNAILER))
+#define THUNAR_THUMBNAILER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THUNAR_TYPE_THUMBNAILER, ThunarThumbnailerClass))
+
+GType thunar_thumbnailer_get_type (void) G_GNUC_CONST;
+
+ThunarThumbnailer *thunar_thumbnailer_new (void) G_GNUC_MALLOC;
+
+gboolean thunar_thumbnailer_queue_file (ThunarThumbnailer *generator,
+ ThunarFile *file,
+ guint *handle);
+gboolean thunar_thumbnailer_queue_files (ThunarThumbnailer *generator,
+ GList *files,
+ guint *handle);
+void thunar_thumbnailer_unqueue (ThunarThumbnailer *thumbnailer,
+ guint handle);
+
+G_END_DECLS;
+
+#endif /* !__THUNAR_THUMBNAILER_H__ */
More information about the Xfce4-commits
mailing list