[Xfce4-commits] r29961 - in libexo/branches/exo-thumbnailers: . docs/reference docs/reference/tmpl exo

Jannis Pohlmann jannis at xfce.org
Fri May 15 03:00:30 CEST 2009


Author: jannis
Date: 2009-05-15 01:00:30 +0000 (Fri, 15 May 2009)
New Revision: 29961

Added:
   libexo/branches/exo-thumbnailers/docs/reference/tmpl/exo-thumbnailer.sgml
   libexo/branches/exo-thumbnailers/exo/exo-thumbnailer.c
   libexo/branches/exo-thumbnailers/exo/exo-thumbnailer.h
Modified:
   libexo/branches/exo-thumbnailers/ChangeLog
   libexo/branches/exo-thumbnailers/docs/reference/exo-docs.sgml
   libexo/branches/exo-thumbnailers/docs/reference/exo-sections.txt
   libexo/branches/exo-thumbnailers/docs/reference/exo.types
   libexo/branches/exo-thumbnailers/exo/Makefile.am
   libexo/branches/exo-thumbnailers/exo/exo.h
Log:
	* docs/reference/exo-docs.sgml, docs/reference/exo-sections.txt,
	  docs/reference/exo.types, docs/reference/tmpl/exo-thumbnailer.sgml:
	  Add API docs section for ExoThumbnailer.
	* exo/Makefile.am, exo/exo-thumbnailer.{c,h}, exo/exo.h: Add
	  client-side implementation of the thumbnail management D-Bus
	  specification. Just as the server side, it doesn't do anything yet.

Modified: libexo/branches/exo-thumbnailers/ChangeLog
===================================================================
--- libexo/branches/exo-thumbnailers/ChangeLog	2009-05-14 20:08:45 UTC (rev 29960)
+++ libexo/branches/exo-thumbnailers/ChangeLog	2009-05-15 01:00:30 UTC (rev 29961)
@@ -1,3 +1,12 @@
+2009-05-15	Jannis Pohlmann <jannis at xfce.org>
+
+	* docs/reference/exo-docs.sgml, docs/reference/exo-sections.txt,
+	  docs/reference/exo.types, docs/reference/tmpl/exo-thumbnailer.sgml: 
+	  Add API docs section for ExoThumbnailer.
+	* exo/Makefile.am, exo/exo-thumbnailer.{c,h}, exo/exo.h: Add 
+	  client-side implementation of the thumbnail management D-Bus
+	  specification. Just as the server side, it doesn't do anything yet.
+
 2009-05-14	Jannis Pohlmann <jannis at xfce.org>
 
 	* exo-thumbnailers/Makefile.am: Add the missing Makefile.am.

Modified: libexo/branches/exo-thumbnailers/docs/reference/exo-docs.sgml
===================================================================
--- libexo/branches/exo-thumbnailers/docs/reference/exo-docs.sgml	2009-05-14 20:08:45 UTC (rev 29960)
+++ libexo/branches/exo-thumbnailers/docs/reference/exo-docs.sgml	2009-05-15 01:00:30 UTC (rev 29961)
@@ -14,6 +14,7 @@
 <!ENTITY exo-cell-renderer-icon SYSTEM "xml/exo-cell-renderer-icon.xml">
 <!ENTITY exo-job SYSTEM "xml/exo-job.xml">
 <!ENTITY exo-simple-job SYSTEM "xml/exo-simple-job.xml">
+<!ENTITY exo-thumbnailer SYSTEM "xml/exo-thumbnailer.xml">
 <!ENTITY exo-gdk-pixbuf-extensions SYSTEM "xml/exo-gdk-pixbuf-extensions.xml">
 <!ENTITY exo-gobject-extensions SYSTEM "xml/exo-gobject-extensions.xml">
 <!ENTITY exo-gtk-extensions SYSTEM "xml/exo-gtk-extensions.xml">
@@ -105,6 +106,24 @@
 
       <variablelist>
         <varlistentry>
+          <term>D-Bus</term>
+          <listitem>
+            <para>
+              TODO
+            </para>
+          </listitem>
+        </varlistentry>
+
+        <varlistentry>
+          <term>D-Bus GLib Bindings</term>
+          <listitem>
+            <para>
+              TODO
+            </para>
+          </listitem>
+        </varlistentry>
+
+        <varlistentry>
           <term>GLib</term>
           <listitem>
             <para>
@@ -284,6 +303,16 @@
     &exo-simple-job;
   </part>
 
+  <part id="exo-thumbnailers">
+    <title>Thumbnail Management</title>
+
+    <para>
+      TODO
+    </para>
+
+    &exo-thumbnailer;
+  </part>
+
   <part id="exo-extensions">
     <title>Extensions to existing frameworks</title>
 

Modified: libexo/branches/exo-thumbnailers/docs/reference/exo-sections.txt
===================================================================
--- libexo/branches/exo-thumbnailers/docs/reference/exo-sections.txt	2009-05-14 20:08:45 UTC (rev 29960)
+++ libexo/branches/exo-thumbnailers/docs/reference/exo-sections.txt	2009-05-15 01:00:30 UTC (rev 29961)
@@ -375,6 +375,37 @@
 
 
 <SECTION>
+<FILE>exo-thumbnailer</FILE>
+<TITLE>ExoThumbnailer</TITLE>
+ExoThumbnailer
+exo_thumbnailer_get_default
+exo_thumbnailer_queue
+exo_thumbnailer_queue_uri
+exo_thumbnailer_unqueue
+exo_thumbnailer_unqueue_list
+exo_thumbnailer_move
+exo_thumbnailer_move_uri
+exo_thumbnailer_copy
+exo_thumbnailer_copy_uri
+exo_thumbnailer_delete
+exo_thumbnailer_delete_uri
+exo_thumbnailer_cleanup
+<SUBSECTION Standard>
+ExoThumbnailerPrivate
+ExoThumbnailerClass
+EXO_TYPE_THUMBNAILER
+EXO_THUMBNAILER
+EXO_THUMBNAILER_CLASS
+EXO_IS_THUMBNAILER
+EXO_IS_THUMBNAILER_CLASS
+EXO_THUMBNAILER_GET_CLASS
+<SUBSECTION Private>
+exo_thumbnailer_get_type
+</SECTION>
+
+
+
+<SECTION>
 <FILE>exo-gdk-pixbuf-extensions</FILE>
 <TITLE>Extensions to gdk-pixbuf</TITLE>
 exo_gdk_pixbuf_colorize

Modified: libexo/branches/exo-thumbnailers/docs/reference/exo.types
===================================================================
--- libexo/branches/exo-thumbnailers/docs/reference/exo.types	2009-05-14 20:08:45 UTC (rev 29960)
+++ libexo/branches/exo-thumbnailers/docs/reference/exo.types	2009-05-15 01:00:30 UTC (rev 29961)
@@ -17,6 +17,8 @@
 exo_job_get_type
 exo_simple_job_get_type
 
+exo_thumbnailer_get_type
+
 exo_xsession_client_get_type
 exo_md5_digest_get_type
 exo_mount_point_get_type

Added: libexo/branches/exo-thumbnailers/docs/reference/tmpl/exo-thumbnailer.sgml
===================================================================
--- libexo/branches/exo-thumbnailers/docs/reference/tmpl/exo-thumbnailer.sgml	                        (rev 0)
+++ libexo/branches/exo-thumbnailers/docs/reference/tmpl/exo-thumbnailer.sgml	2009-05-15 01:00:30 UTC (rev 29961)
@@ -0,0 +1,142 @@
+<!-- ##### SECTION Title ##### -->
+ExoThumbnailer
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### STRUCT ExoThumbnailer ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION exo_thumbnailer_get_default ##### -->
+<para>
+
+</para>
+
+ at error: 
+ at Returns: 
+
+
+<!-- ##### FUNCTION exo_thumbnailer_queue ##### -->
+<para>
+
+</para>
+
+ at thumbnailer: 
+ at uris: 
+ at mime_hints: 
+ at Returns: 
+
+
+<!-- ##### FUNCTION exo_thumbnailer_queue_uri ##### -->
+<para>
+
+</para>
+
+ at thumbnailer: 
+ at uri: 
+ at mime_hint: 
+ at Returns: 
+
+
+<!-- ##### FUNCTION exo_thumbnailer_unqueue ##### -->
+<para>
+
+</para>
+
+ at thumbnailer: 
+ at handle: 
+
+
+<!-- ##### FUNCTION exo_thumbnailer_unqueue_list ##### -->
+<para>
+
+</para>
+
+ at thumbnailer: 
+ at handles: 
+
+
+<!-- ##### FUNCTION exo_thumbnailer_move ##### -->
+<para>
+
+</para>
+
+ at thumbnailer: 
+ at from_uris: 
+ at to_uris: 
+
+
+<!-- ##### FUNCTION exo_thumbnailer_move_uri ##### -->
+<para>
+
+</para>
+
+ at thumbnailer: 
+ at from_uri: 
+ at to_uri: 
+
+
+<!-- ##### FUNCTION exo_thumbnailer_copy ##### -->
+<para>
+
+</para>
+
+ at thumbnailer: 
+ at from_uris: 
+ at to_uris: 
+
+
+<!-- ##### FUNCTION exo_thumbnailer_copy_uri ##### -->
+<para>
+
+</para>
+
+ at thumbnailer: 
+ at from_uri: 
+ at to_uri: 
+
+
+<!-- ##### FUNCTION exo_thumbnailer_delete ##### -->
+<para>
+
+</para>
+
+ at thumbnailer: 
+ at uris: 
+
+
+<!-- ##### FUNCTION exo_thumbnailer_delete_uri ##### -->
+<para>
+
+</para>
+
+ at thumbnailer: 
+ at uris: 
+
+
+<!-- ##### FUNCTION exo_thumbnailer_cleanup ##### -->
+<para>
+
+</para>
+
+ at thumbnailer: 
+ at uri_prefix: 
+ at since: 
+
+

Modified: libexo/branches/exo-thumbnailers/exo/Makefile.am
===================================================================
--- libexo/branches/exo-thumbnailers/exo/Makefile.am	2009-05-14 20:08:45 UTC (rev 29960)
+++ libexo/branches/exo-thumbnailers/exo/Makefile.am	2009-05-15 01:00:30 UTC (rev 29961)
@@ -29,6 +29,7 @@
 	exo-mount-point.h						\
 	exo-pango-extensions.h						\
 	exo-string.h							\
+	exo-thumbnailer.h						\
 	exo-toolbars-editor-dialog.h					\
 	exo-toolbars-editor.h						\
 	exo-toolbars-model.h						\
@@ -48,7 +49,8 @@
 	exo-aliasdef.c							\
 	exo-enum-types.c						\
 	exo-marshal.c							\
-	exo-marshal.h
+	exo-marshal.h							\
+	exo-thumbnailer-dbus-bindings.h
 
 libexoincludedir = $(includedir)/exo-0.3/exo
 
@@ -88,6 +90,8 @@
 	exo-thumbnail-preview.h						\
 	exo-thumbnail.c							\
 	exo-thumbnail.h							\
+	exo-thumbnailer.c						\
+	exo-thumbnailer.h						\
 	exo-toolbars-editor-dialog.c					\
 	exo-toolbars-editor.c						\
 	exo-toolbars-model.c						\
@@ -101,7 +105,10 @@
 	exo-xsession-client.c
 
 libexo_0_3_la_CFLAGS =							\
+	$(DBUS_CFLAGS)							\
+	$(DBUS_GLIB_CFLAGS)						\
 	$(GIO_CFLAGS)							\
+	$(GTHREAD_CFLAGS)						\
 	$(GTK_CFLAGS)							\
 	$(LIBXFCE4UTIL_CFLAGS)
 
@@ -112,7 +119,10 @@
 	-no-undefined
 
 libexo_0_3_la_LIBADD =							\
+	$(DBUS_LIBS)							\
+	$(DBUS_GLIB_LIBS)						\
 	$(GIO_LIBS)							\
+	$(GTHREAD_LIBS)							\
 	$(GTK_LIBS)							\
 	$(LIBXFCE4UTIL_LIBS)
 
@@ -198,6 +208,9 @@
 		--body exo-marshal.list ) >> xgen-emc \
 	&& cp xgen-emc exo-marshal.c \
 	&& rm -f xgen-emc
+
+exo-thumbnailer-dbus-bindings.h: $(top_srcdir)/exo-thumbnailers/exo-thumbnailer-service-dbus.xml Makefile
+	dbus-binding-tool --mode=glib-client $< > $@
 endif
 
 

Added: libexo/branches/exo-thumbnailers/exo/exo-thumbnailer.c
===================================================================
--- libexo/branches/exo-thumbnailers/exo/exo-thumbnailer.c	                        (rev 0)
+++ libexo/branches/exo-thumbnailers/exo/exo-thumbnailer.c	2009-05-15 01:00:30 UTC (rev 29961)
@@ -0,0 +1,495 @@
+/* vi:set et ai sw=2 sts=2 ts=2: */
+/*-
+ * Copyright (c) 2009 Jannis Pohlmann <jannis at xfce.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General 
+ * Public License along with this library; 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 <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+
+#include <exo/exo-thumbnailer.h>
+#include <exo/exo-thumbnailer-dbus-bindings.h>
+#include <exo/exo-private.h>
+
+
+
+#define EXO_THUMBNAILER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EXO_TYPE_THUMBNAILER, ExoThumbnailerPrivate))
+
+
+
+/* Property identifiers */
+enum
+{
+  PROP_0,
+};
+
+
+
+static void     exo_thumbnailer_class_init        (ExoThumbnailerClass *klass);
+static void     exo_thumbnailer_init              (ExoThumbnailer      *thumbnailer);
+static void     exo_thumbnailer_constructed       (GObject             *object);
+static void     exo_thumbnailer_finalize          (GObject             *object);
+static void     exo_thumbnailer_get_property      (GObject             *object,
+                                                   guint                prop_id,
+                                                   GValue              *value,
+                                                   GParamSpec          *pspec);
+static void     exo_thumbnailer_set_property      (GObject             *object,
+                                                   guint                prop_id,
+                                                   const GValue        *value,
+                                                   GParamSpec          *pspec);
+static gboolean exo_thumbnailer_ensure_dbus_ready (GError             **error);
+static void     exo_thumbnailer_ensure_dbus_down  (void);
+static void     exo_thumbnailer_handle_unqueue    (guint32              handle,
+                                                   ExoThumbnailer      *thumbnailer);
+static void     exo_thumbnailer_service_ready     (DBusGProxy          *proxy,
+                                                   const gchar        **uris,
+                                                   ExoThumbnailer      *thumbnailer);
+
+
+
+struct _ExoThumbnailerClass
+{
+  GObjectClass __parent__;
+};
+
+struct _ExoThumbnailer
+{
+  GObject __parent__;
+
+  ExoThumbnailerPrivate *priv;
+};
+
+struct _ExoThumbnailerPrivate
+{
+  DBusGConnection *connection;
+  DBusGProxy      *proxy;
+  GMutex          *mutex;
+  GList           *handles;
+};
+
+
+
+static GObjectClass    *exo_thumbnailer_parent_class = NULL;
+
+static DBusGConnection *exo_thumbnailer_dbus_connection = NULL;
+static DBusGProxy      *exo_thumbnailer_dbus_proxy = NULL;
+static gboolean         exo_thumbnailer_dbus_initialized = FALSE;
+static gint             exo_thumbnailer_dbus_refcount = 0;
+
+
+
+GType
+exo_thumbnailer_get_type (void)
+{
+  static GType type = G_TYPE_INVALID;
+
+  if (G_UNLIKELY (type == G_TYPE_INVALID))
+    {
+      type = g_type_register_static_simple (G_TYPE_OBJECT, 
+                                            "ExoThumbnailer",
+                                            sizeof (ExoThumbnailerClass),
+                                            (GClassInitFunc) exo_thumbnailer_class_init,
+                                            sizeof (ExoThumbnailer),
+                                            (GInstanceInitFunc) exo_thumbnailer_init,
+                                            0);
+    }
+
+  return type;
+}
+
+
+
+static void
+exo_thumbnailer_class_init (ExoThumbnailerClass *klass)
+{
+  GObjectClass *gobject_class;
+
+  g_type_class_add_private (klass, sizeof (ExoThumbnailerPrivate));
+
+  /* Determine the parent type class */
+  exo_thumbnailer_parent_class = g_type_class_peek_parent (klass);
+
+  gobject_class = G_OBJECT_CLASS (klass);
+  gobject_class->constructed = exo_thumbnailer_constructed; 
+  gobject_class->finalize = exo_thumbnailer_finalize; 
+  gobject_class->get_property = exo_thumbnailer_get_property;
+  gobject_class->set_property = exo_thumbnailer_set_property;
+}
+
+
+
+static void
+exo_thumbnailer_init (ExoThumbnailer *thumbnailer)
+{
+  thumbnailer->priv = EXO_THUMBNAILER_GET_PRIVATE (thumbnailer);
+
+  thumbnailer->priv->mutex = g_mutex_new ();
+  
+  thumbnailer->priv->connection = dbus_g_connection_ref (exo_thumbnailer_dbus_connection);
+  thumbnailer->priv->proxy = g_object_ref (exo_thumbnailer_dbus_proxy);
+
+  dbus_g_proxy_connect_signal (thumbnailer->priv->proxy, "Ready", 
+                               G_CALLBACK (exo_thumbnailer_service_ready), 
+                               thumbnailer, NULL);
+
+  thumbnailer->priv->handles = NULL;
+}
+
+
+
+static void
+exo_thumbnailer_constructed (GObject *object)
+{
+}
+
+
+
+static void
+exo_thumbnailer_finalize (GObject *object)
+{
+  ExoThumbnailer *thumbnailer = EXO_THUMBNAILER (object);
+
+  exo_thumbnailer_unqueue_list (thumbnailer, thumbnailer->priv->handles);
+
+  g_mutex_lock (thumbnailer->priv->mutex);
+
+  g_list_free (thumbnailer->priv->handles);
+  thumbnailer->priv->handles = NULL;
+
+  g_mutex_unlock (thumbnailer->priv->mutex);
+
+  g_mutex_free (thumbnailer->priv->mutex);
+
+  g_signal_handlers_disconnect_matched (thumbnailer->priv->proxy, G_SIGNAL_MATCH_DATA,
+                                        0, 0, NULL, NULL, thumbnailer);
+  g_object_unref (thumbnailer->priv->proxy);
+
+  dbus_g_connection_unref (thumbnailer->priv->connection);
+
+  exo_thumbnailer_ensure_dbus_down ();
+
+
+  (*G_OBJECT_CLASS (exo_thumbnailer_parent_class)->finalize) (object);
+}
+
+
+
+static void
+exo_thumbnailer_get_property (GObject    *object,
+                              guint       prop_id,
+                              GValue     *value,
+                              GParamSpec *pspec)
+{
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+
+
+static void
+exo_thumbnailer_set_property (GObject      *object,
+                              guint         prop_id,
+                              const GValue *value,
+                              GParamSpec   *pspec)
+{
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+
+
+static gboolean
+exo_thumbnailer_ensure_dbus_ready (GError **error)
+{
+  gboolean success = TRUE;
+
+  if (!exo_thumbnailer_dbus_initialized)
+    {
+      if (!g_thread_supported ())
+        g_thread_init (NULL);
+
+      /* Register error domain and marshallers */
+
+      exo_thumbnailer_dbus_initialized = TRUE;
+    }
+
+  if (exo_thumbnailer_dbus_refcount <= 0)
+    {
+      _exo_assert (exo_thumbnailer_dbus_connection == NULL);
+      _exo_assert (exo_thumbnailer_dbus_proxy == NULL);
+
+      exo_thumbnailer_dbus_connection = dbus_g_bus_get (DBUS_BUS_SESSION, error);
+
+      if (exo_thumbnailer_dbus_connection != NULL)
+        {
+          exo_thumbnailer_dbus_proxy = dbus_g_proxy_new_for_name (exo_thumbnailer_dbus_connection,
+                                                                  "org.freedesktop.thumbnailer.Generic",
+                                                                  "/org/freedesktop/Thumbnailer",
+                                                                  "org.freedesktop.thumbnailer.Generic");
+
+          dbus_g_proxy_add_signal (exo_thumbnailer_dbus_proxy, "Ready", 
+                                   G_TYPE_STRV, G_TYPE_INVALID);
+    
+          g_object_add_weak_pointer (G_OBJECT (exo_thumbnailer_dbus_proxy),
+                                     (gpointer) &exo_thumbnailer_dbus_proxy);
+        }
+      else
+        {
+          success = FALSE;
+        }
+    }
+
+  exo_thumbnailer_dbus_refcount += 1;
+
+  return TRUE;
+}
+
+
+
+static void
+exo_thumbnailer_ensure_dbus_down (void)
+{
+  if (exo_thumbnailer_dbus_refcount >= 0)
+    {
+      if (exo_thumbnailer_dbus_refcount == 1)
+        {
+          g_object_unref (exo_thumbnailer_dbus_proxy);
+
+          dbus_g_connection_unref (exo_thumbnailer_dbus_connection);
+          exo_thumbnailer_dbus_connection = NULL;
+        }
+
+      exo_thumbnailer_dbus_refcount -= 1;
+    }
+}
+
+
+
+static void
+exo_thumbnailer_handle_unqueue (guint32         handle,
+                                ExoThumbnailer *thumbnailer)
+{
+  _exo_return_if_fail (EXO_IS_THUMBNAILER (thumbnailer));
+
+  exo_thumbnailer_unqueue (thumbnailer, handle);
+}
+
+
+
+static void
+exo_thumbnailer_service_ready (DBusGProxy     *proxy,
+                               const gchar   **uris,
+                               ExoThumbnailer *thumbnailer)
+{
+  _exo_return_if_fail (EXO_IS_THUMBNAILER (thumbnailer));
+  _exo_return_if_fail (uris != NULL);
+}
+
+
+
+ExoThumbnailer *
+exo_thumbnailer_get_default (GError **error)
+{
+  static ExoThumbnailer *thumbnailer = NULL;
+
+  _exo_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+  if (G_UNLIKELY (thumbnailer == NULL))
+    {
+      if (!exo_thumbnailer_ensure_dbus_ready (error))
+        return NULL;
+
+      thumbnailer = g_object_new (EXO_TYPE_THUMBNAILER, NULL);
+      g_object_add_weak_pointer (G_OBJECT (thumbnailer), (gpointer) &thumbnailer);
+    }
+  else
+    {
+      g_object_ref (thumbnailer);
+    }
+
+  return thumbnailer;
+}
+
+
+
+guint32
+exo_thumbnailer_queue (ExoThumbnailer *thumbnailer,
+                       const gchar   **uris,
+                       const gchar   **mime_hints)
+{
+  guint32 handle = 0;
+
+  _exo_return_val_if_fail (EXO_IS_THUMBNAILER (thumbnailer), 0);
+  _exo_return_val_if_fail (uris != NULL, 0);
+  
+  g_mutex_lock (thumbnailer->priv->mutex);
+
+  if (exo_thumbnailer_proxy_queue (thumbnailer->priv->proxy, uris, mime_hints, 0, &handle, NULL))
+    {
+      thumbnailer->priv->handles = g_list_prepend (thumbnailer->priv->handles,
+                                                   GUINT_TO_POINTER (handle));
+    }
+  
+  g_mutex_unlock (thumbnailer->priv->mutex);
+
+  return handle;
+}
+
+
+
+guint32
+exo_thumbnailer_queue_uri (ExoThumbnailer *thumbnailer,
+                           const gchar    *uri,
+                           const gchar    *mime_hint)
+{
+  const gchar *uris[] = { NULL, NULL };
+  const gchar *mime_hints[] = { NULL, NULL };
+  guint32      handle = 0;
+
+  _exo_return_val_if_fail (EXO_IS_THUMBNAILER (thumbnailer), 0);
+  _exo_return_val_if_fail (uris != NULL, 0);
+
+  uris[0] = uri;
+  mime_hints[0] = mime_hint;
+
+  handle = exo_thumbnailer_queue (thumbnailer, uris, mime_hints);
+
+  return handle;
+}
+
+
+
+void
+exo_thumbnailer_unqueue (ExoThumbnailer *thumbnailer,
+                         guint32         handle)
+{
+  _exo_return_if_fail (EXO_IS_THUMBNAILER (thumbnailer));
+
+  g_mutex_lock (thumbnailer->priv->mutex);
+
+  if (exo_thumbnailer_proxy_unqueue (thumbnailer->priv->proxy, handle, NULL))
+    {
+      thumbnailer->priv->handles = g_list_remove_all (thumbnailer->priv->handles, 
+                                                      GUINT_TO_POINTER (handle));
+    }
+
+  g_mutex_unlock (thumbnailer->priv->mutex);
+}
+
+
+
+void
+exo_thumbnailer_unqueue_list (ExoThumbnailer *thumbnailer,
+                              GList          *handles)
+{
+  _exo_return_if_fail (EXO_IS_THUMBNAILER (thumbnailer));
+
+  g_list_foreach (handles, (GFunc) exo_thumbnailer_handle_unqueue, thumbnailer);
+}
+
+
+
+void
+exo_thumbnailer_move (ExoThumbnailer *thumbnailer,
+                      const gchar   **from_uris,
+                      const gchar   **to_uris)
+{
+  _exo_return_if_fail (EXO_IS_THUMBNAILER (thumbnailer));
+  _exo_return_if_fail (from_uris != NULL);
+  _exo_return_if_fail (to_uris != NULL);
+}
+
+
+
+void
+exo_thumbnailer_move_uri (ExoThumbnailer *thumbnailer,
+                          const gchar    *from_uri,
+                          const gchar    *to_uri)
+{
+  _exo_return_if_fail (EXO_IS_THUMBNAILER (thumbnailer));
+  _exo_return_if_fail (from_uri != NULL);
+  _exo_return_if_fail (to_uri != NULL);
+}
+
+
+
+void
+exo_thumbnailer_copy (ExoThumbnailer *thumbnailer,
+                      const gchar   **from_uris,
+                      const gchar   **to_uris)
+{
+  _exo_return_if_fail (EXO_IS_THUMBNAILER (thumbnailer));
+  _exo_return_if_fail (from_uris != NULL);
+  _exo_return_if_fail (to_uris != NULL);
+}
+
+
+
+void
+exo_thumbnailer_copy_uri (ExoThumbnailer *thumbnailer,
+                          const gchar   *from_uri,
+                          const gchar   *to_uri)
+{
+  _exo_return_if_fail (EXO_IS_THUMBNAILER (thumbnailer));
+  _exo_return_if_fail (from_uri != NULL);
+  _exo_return_if_fail (to_uri != NULL);
+}
+
+
+
+void
+exo_thumbnailer_delete (ExoThumbnailer *thumbnailer,
+                        const gchar   **uris)
+{
+  _exo_return_if_fail (EXO_IS_THUMBNAILER (thumbnailer));
+  _exo_return_if_fail (uris != NULL);
+}
+
+
+
+void
+exo_thumbnailer_delete_uri (ExoThumbnailer *thumbnailer,
+                            const gchar   **uri)
+{
+  _exo_return_if_fail (EXO_IS_THUMBNAILER (thumbnailer));
+  _exo_return_if_fail (uri != NULL);
+}
+
+
+
+void
+exo_thumbnailer_cleanup (ExoThumbnailer *thumbnailer,
+                         const gchar    *uri_prefix,
+                         guint32         since)
+{
+  _exo_return_if_fail (EXO_IS_THUMBNAILER (thumbnailer));
+}

Added: libexo/branches/exo-thumbnailers/exo/exo-thumbnailer.h
===================================================================
--- libexo/branches/exo-thumbnailers/exo/exo-thumbnailer.h	                        (rev 0)
+++ libexo/branches/exo-thumbnailers/exo/exo-thumbnailer.h	2009-05-15 01:00:30 UTC (rev 29961)
@@ -0,0 +1,74 @@
+/* vi:set et ai sw=2 sts=2 ts=2: */
+/*-
+ * Copyright (c) 2009 Jannis Pohlmann <jannis at xfce.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General 
+ * Public License along with this library; if not, write to the 
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __EXO_THUMBNAILER_H__
+#define __EXO_THUMBNAILER_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS;
+
+#define EXO_TYPE_THUMBNAILER            (exo_thumbnailer_get_type ())
+#define EXO_THUMBNAILER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXO_TYPE_THUMBNAILER, ExoThumbnailer))
+#define EXO_THUMBNAILER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), EXO_TYPE_THUMBNAILER, ExoThumbnailerClass))
+#define EXO_IS_THUMBNAILER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EXO_TYPE_THUMBNAILER))
+#define EXO_IS_THUMBNAILER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EXO_TYPE_THUMBNAILER)
+#define EXO_THUMBNAILER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), EXO_TYPE_THUMBNAILER, ExoThumbnailerClass))
+
+typedef struct _ExoThumbnailerPrivate ExoThumbnailerPrivate;
+typedef struct _ExoThumbnailerClass   ExoThumbnailerClass;
+typedef struct _ExoThumbnailer        ExoThumbnailer;
+
+GType           exo_thumbnailer_get_type     (void) G_GNUC_CONST;
+
+ExoThumbnailer *exo_thumbnailer_get_default  (GError        **error) G_GNUC_WARN_UNUSED_RESULT;
+guint32         exo_thumbnailer_queue        (ExoThumbnailer *thumbnailer,
+                                              const gchar   **uris,
+                                              const gchar   **mime_hints);
+guint32         exo_thumbnailer_queue_uri    (ExoThumbnailer *thumbnailer,
+                                              const gchar    *uri,
+                                              const gchar    *mime_hint);
+void            exo_thumbnailer_unqueue      (ExoThumbnailer *thumbnailer,
+                                              guint32         handle);
+void            exo_thumbnailer_unqueue_list (ExoThumbnailer *thumbnailer,
+                                              GList          *handles);
+void            exo_thumbnailer_move         (ExoThumbnailer *thumbnailer,
+                                              const gchar   **from_uris,
+                                              const gchar   **to_uris);
+void            exo_thumbnailer_move_uri     (ExoThumbnailer *thumbnailer,
+                                              const gchar    *from_uri,
+                                              const gchar    *to_uri);
+void            exo_thumbnailer_copy         (ExoThumbnailer *thumbnailer,
+                                              const gchar   **from_uris,
+                                              const gchar   **to_uris);
+void            exo_thumbnailer_copy_uri     (ExoThumbnailer *thumbnailer,
+                                              const gchar    *from_uri,
+                                              const gchar    *to_uri);
+void            exo_thumbnailer_delete       (ExoThumbnailer *thumbnailer,
+                                              const gchar   **uris);
+void            exo_thumbnailer_delete_uri   (ExoThumbnailer *thumbnailer,
+                                              const gchar    *uris);
+void            exo_thumbnailer_cleanup      (ExoThumbnailer *thumbnailer,
+                                              const gchar    *uri_prefix,
+                                              guint32         since);
+
+G_END_DECLS;
+
+#endif /* !__EXO_THUMBNAILER_H__ */

Modified: libexo/branches/exo-thumbnailers/exo/exo.h
===================================================================
--- libexo/branches/exo-thumbnailers/exo/exo.h	2009-05-14 20:08:45 UTC (rev 29960)
+++ libexo/branches/exo-thumbnailers/exo/exo.h	2009-05-15 01:00:30 UTC (rev 29961)
@@ -54,6 +54,7 @@
 #include <exo/exo-pango-extensions.h>
 #include <exo/exo-simple-job.h>
 #include <exo/exo-string.h>
+#include <exo/exo-thumbnailer.h>
 #include <exo/exo-toolbars-editor.h>
 #include <exo/exo-toolbars-editor-dialog.h>
 #include <exo/exo-toolbars-model.h>




More information about the Xfce4-commits mailing list