[Xfce4-commits] <ristretto:master> Add RsttoFile object

Stephan Arts noreply at xfce.org
Wed Oct 12 22:08:01 CEST 2011


Updating branch refs/heads/master
         to 672b643eb57d8274b0b44836a85503305f0a0748 (commit)
       from 5f2070d331f4c412cd4e7f46313270be52584650 (commit)

commit 672b643eb57d8274b0b44836a85503305f0a0748
Author: Stephan Arts <stephan at xfce.org>
Date:   Wed Oct 12 22:07:51 2011 +0200

    Add RsttoFile object

 src/Makefile.am              |    6 +-
 src/file.c                   |  303 ++++++++++++++++++++++++++++++++++++++++++
 src/file.h                   |   88 ++++++++++++
 src/image_list.c             |   61 +++------
 src/image_list.h             |    8 +-
 src/image_viewer.c           |   44 ++++---
 src/image_viewer.h           |    2 +-
 src/main.c                   |   10 +-
 src/main_window.c            |   55 ++++----
 src/properties_dialog.c      |   30 ++---
 src/properties_dialog.h      |    2 +-
 src/thumbnail.c              |   21 ++--
 src/thumbnail.h              |    5 +-
 src/thumbnail_bar.c          |   29 +++-
 src/thumbnailer.c            |   29 ++---
 src/wallpaper_manager.c      |    5 +-
 src/wallpaper_manager.h      |    8 +-
 src/xfce_wallpaper_manager.c |   15 +-
 18 files changed, 550 insertions(+), 171 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 3d73f6b..4f2dbd6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -10,14 +10,14 @@ ristretto_SOURCES = \
 	main_window_ui.h \
 	main_window.c main_window.h \
 	wallpaper_manager.c wallpaper_manager.h \
-    monitor_chooser.c monitor_chooser.h \
+	monitor_chooser.c monitor_chooser.h \
 	xfce_wallpaper_manager.c xfce_wallpaper_manager.h \
-	gnome_wallpaper_manager.c gnome_wallpaper_manager.h \
 	app_menu_item.c app_menu_item.h \
 	thumbnail_bar.c thumbnail_bar.h \
 	thumbnail.c thumbnail.h \
 	thumbnailer.c thumbnailer.h \
-    marshal.c marshal.h \
+	marshal.c marshal.h \
+	file.c file.h \
 	main.c
 
 ristretto_CFLAGS = \
diff --git a/src/file.c b/src/file.c
new file mode 100644
index 0000000..fc59f22
--- /dev/null
+++ b/src/file.c
@@ -0,0 +1,303 @@
+/*
+ *  Copyright (c) Stephan Arts 2011 <stephan 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 Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <libxfce4util/libxfce4util.h>
+
+#include "file.h"
+
+static void
+rstto_file_init (GObject *);
+static void
+rstto_file_class_init (GObjectClass *);
+
+static void
+rstto_file_dispose (GObject *object);
+static void
+rstto_file_finalize (GObject *object);
+
+static void
+rstto_file_set_property (
+        GObject      *object,
+        guint         property_id,
+        const GValue *value,
+        GParamSpec   *pspec );
+static void
+rstto_file_get_property (
+        GObject    *object,
+        guint       property_id,
+        GValue     *value,
+        GParamSpec *pspec );
+
+static GObjectClass *parent_class = NULL;
+
+static GList *open_files = NULL;
+
+enum
+{
+    PROP_0,
+};
+
+GType
+rstto_file_get_type (void)
+{
+    static GType rstto_file_type = 0;
+
+    if (!rstto_file_type)
+    {
+        static const GTypeInfo rstto_file_info = 
+        {
+            sizeof (RsttoFileClass),
+            (GBaseInitFunc) NULL,
+            (GBaseFinalizeFunc) NULL,
+            (GClassInitFunc) rstto_file_class_init,
+            (GClassFinalizeFunc) NULL,
+            NULL,
+            sizeof (RsttoFile),
+            0,
+            (GInstanceInitFunc) rstto_file_init,
+            NULL
+        };
+
+        rstto_file_type = g_type_register_static (
+                G_TYPE_OBJECT,
+                "RsttoFile",
+                &rstto_file_info,
+                0 );
+    }
+    return rstto_file_type;
+}
+
+struct _RsttoFilePriv
+{
+    GFile *file;
+
+    gchar *display_name;
+    gchar *content_type;
+};
+
+
+static void
+rstto_file_init (GObject *object)
+{
+    RsttoFile *file = RSTTO_FILE (object);
+
+    file->priv = g_new0 (RsttoFilePriv, 1);
+}
+
+
+static void
+rstto_file_class_init (GObjectClass *object_class)
+{
+    RsttoFileClass *file_class = RSTTO_FILE_CLASS (object_class);
+
+    parent_class = g_type_class_peek_parent (file_class);
+
+    object_class->dispose = rstto_file_dispose;
+    object_class->finalize = rstto_file_finalize;
+
+    object_class->set_property = rstto_file_set_property;
+    object_class->get_property = rstto_file_get_property;
+}
+
+/**
+ * rstto_file_dispose:
+ * @object:
+ *
+ */
+static void
+rstto_file_dispose (GObject *object)
+{
+    RsttoFile *file = RSTTO_FILE (object);
+
+    if (file->priv)
+    {
+        if (file->priv->file)
+        {
+            g_object_unref (file->priv->file);
+            file->priv->file = NULL;
+        }
+        if (file->priv->display_name)
+        {
+            g_free (file->priv->display_name);
+            file->priv->display_name = NULL;
+        }
+        if (file->priv->content_type)
+        {
+            g_free (file->priv->content_type);
+            file->priv->content_type = NULL;
+        }
+
+        g_free (file->priv);
+        file->priv = NULL;
+
+	open_files = g_list_remove_all (open_files, file);
+    	g_debug ("Open files: %d", g_list_length (open_files));
+    }
+}
+
+/**
+ * rstto_file_finalize:
+ * @object:
+ *
+ */
+static void
+rstto_file_finalize (GObject *object)
+{
+    /*RsttoFile *file = RSTTO_FILE (object);*/
+}
+
+
+
+/**
+ * rstto_file_new:
+ *
+ *
+ * Singleton
+ */
+RsttoFile *
+rstto_file_new ( GFile *file )
+{
+    RsttoFile *o_file = NULL;
+    GList *iter = open_files;
+    while ( NULL != iter )
+    {
+        /* Check if the file is already opened, if so
+         * return that one.
+         */
+        if ( TRUE == g_file_equal (
+                RSTTO_FILE (iter->data)->priv->file,
+                file) )
+        {
+            return (RsttoFile *)iter->data;
+        }
+        iter = g_list_next (iter);
+    }
+
+    o_file = g_object_new (RSTTO_TYPE_FILE, NULL);
+    o_file->priv->file = file;
+    g_object_ref (file);
+
+
+    open_files = g_list_append (open_files, o_file);
+
+    return o_file;
+}
+
+
+static void
+rstto_file_set_property (
+        GObject *object,
+        guint property_id,
+        const GValue *value,
+        GParamSpec *pspec )
+{
+}
+
+static void
+rstto_file_get_property (
+        GObject *object,
+        guint property_id,
+        GValue *value,
+        GParamSpec *pspec )
+{
+}
+
+GFile *
+rstto_file_get_file ( RsttoFile *file )
+{
+    return file->priv->file;
+}
+
+gboolean
+rstto_file_equal ( RsttoFile *a, RsttoFile *b )
+{
+    return g_file_equal (a->priv->file, b->priv->file);
+}
+
+const gchar *
+rstto_file_get_display_name ( RsttoFile *file )
+{
+    GFileInfo *file_info = NULL;
+    const gchar *display_name;
+
+    if ( NULL == file->priv->display_name )
+    {
+        file_info = g_file_query_info (
+                file->priv->file,
+                G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
+                0,
+                NULL,
+                NULL );
+        if ( NULL != file_info )
+        {
+            display_name = g_file_info_get_display_name (file_info);
+            if ( NULL != display_name )
+            {
+                file->priv->display_name = g_strdup (display_name);
+            }
+            g_object_unref (file_info);
+        }
+    }
+
+    return (const gchar *)file->priv->display_name;
+}
+
+const gchar *
+rstto_file_get_path ( RsttoFile *file )
+{
+    return g_file_get_path (file->priv->file);
+}
+
+const gchar *
+rstto_file_get_uri ( RsttoFile *file )
+{
+    return g_file_get_uri (file->priv->file);
+}
+
+const gchar *
+rstto_file_get_content_type ( RsttoFile *file )
+{
+    GFileInfo *file_info = NULL;
+    const gchar *content_type;
+
+    if ( NULL == file->priv->content_type )
+    {
+        file_info = g_file_query_info (
+                file->priv->file,
+                "standard::content-type",
+                0,
+                NULL,
+                NULL );
+        if ( NULL != file_info )
+        {
+            content_type = g_file_info_get_content_type (file_info);
+            if ( NULL != content_type )
+            {
+                file->priv->content_type = g_strdup (content_type);
+            }
+            g_object_unref (file_info);
+        }
+    }
+
+    return (const gchar *)file->priv->content_type;
+}
diff --git a/src/file.h b/src/file.h
new file mode 100644
index 0000000..e7dae41
--- /dev/null
+++ b/src/file.h
@@ -0,0 +1,88 @@
+/*
+ *  Copyright (c) Stephan Arts 2011 <stephan 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 Library 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 __RISTRETTO_FILE_H__
+#define __RISTRETTO_FILE_H__
+
+G_BEGIN_DECLS
+
+#define RSTTO_TYPE_FILE rstto_file_get_type()
+
+#define RSTTO_FILE(obj)( \
+        G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+                RSTTO_TYPE_FILE, \
+                RsttoFile))
+
+#define RSTTO_IS_FILE(obj)( \
+        G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+                RSTTO_TYPE_FILE))
+
+#define RSTTO_FILE_CLASS(klass)( \
+        G_TYPE_CHECK_CLASS_CAST ((klass), \
+                RSTTO_TYPE_FILE, \
+                RsttoFileClass))
+
+#define RSTTO_IS_FILE_CLASS(klass)( \
+        G_TYPE_CHECK_CLASS_TYPE ((klass), \
+                RSTTO_TYPE_FILE()))
+
+
+typedef struct _RsttoFile RsttoFile;
+typedef struct _RsttoFilePriv RsttoFilePriv;
+
+struct _RsttoFile
+{
+    GObject parent;
+
+    RsttoFilePriv *priv;
+};
+
+typedef struct _RsttoFileClass RsttoFileClass;
+
+struct _RsttoFileClass
+{
+    GObjectClass parent_class;
+};
+
+RsttoFile *
+rstto_file_new ( GFile * );
+
+GType
+rstto_file_get_type ( void );
+
+GFile *
+rstto_file_get_file ( RsttoFile * );
+
+gboolean
+rstto_file_equal ( RsttoFile *, RsttoFile * );
+
+const gchar *
+rstto_file_get_display_name ( RsttoFile * );
+
+const gchar *
+rstto_file_get_path ( RsttoFile * );
+
+const gchar *
+rstto_file_get_uri ( RsttoFile * );
+
+const gchar *
+rstto_file_get_content_type ( RsttoFile * );
+
+G_END_DECLS
+
+#endif /* __RISTRETTO_FILE_H__ */
diff --git a/src/image_list.c b/src/image_list.c
index 28e09e7..870dbf3 100644
--- a/src/image_list.c
+++ b/src/image_list.c
@@ -25,6 +25,7 @@
 
 #include <libexif/exif-data.h>
 
+#include "file.h"
 #include "image_list.h"
 #include "settings.h"
 
@@ -45,11 +46,9 @@ rstto_image_list_iter_dispose(GObject *object);
 static RsttoImageListIter * rstto_image_list_iter_new ();
 
 static gint
-cb_rstto_image_list_image_name_compare_func (GFile *a, GFile *b);
+cb_rstto_image_list_image_name_compare_func (RsttoFile *a, RsttoFile *b);
 static gint
-cb_rstto_image_list_exif_date_compare_func (GFile *a, GFile *b);
-static gint
-cb_rstto_image_list_file_compare_func (GFile *a, GFile *file);
+cb_rstto_image_list_exif_date_compare_func (RsttoFile *a, RsttoFile *b);
 
 static GObjectClass *parent_class = NULL;
 static GObjectClass *iter_parent_class = NULL;
@@ -72,7 +71,7 @@ enum
 struct _RsttoImageListIterPriv
 {
     RsttoImageList *image_list;
-    GFile *file;
+    RsttoFile *file;
 };
 
 struct _RsttoImageListPriv
@@ -183,16 +182,15 @@ rstto_image_list_new (void)
 }
 
 gboolean
-rstto_image_list_add_file (RsttoImageList *image_list, GFile *file, GError **error)
+rstto_image_list_add_file (RsttoImageList *image_list, RsttoFile *file, GError **error)
 {
-    GList *image_iter = g_list_find_custom (image_list->priv->images, file, rstto_image_list_get_compare_func (image_list));
+    GList *image_iter = g_list_find (image_list->priv->images, file);
 
     if (!image_iter)
     {
         if (file)
         {
             image_list->priv->images = g_list_insert_sorted (image_list->priv->images, file, rstto_image_list_get_compare_func (image_list));
-            g_object_ref (file);
 
             image_list->priv->n_images++;
 
@@ -233,7 +231,7 @@ rstto_image_list_get_n_images (RsttoImageList *image_list)
 RsttoImageListIter *
 rstto_image_list_get_iter (RsttoImageList *image_list)
 {
-    GFile *file = NULL;
+    RsttoFile *file = NULL;
     RsttoImageListIter *iter = NULL;
     if (image_list->priv->images)
         file = image_list->priv->images->data;
@@ -247,10 +245,10 @@ rstto_image_list_get_iter (RsttoImageList *image_list)
 
 
 void
-rstto_image_list_remove_file (RsttoImageList *image_list, GFile *file)
+rstto_image_list_remove_file (RsttoImageList *image_list, RsttoFile *file)
 {
     GSList *iter = NULL;
-    GFile *afile = NULL;
+    RsttoFile *afile = NULL;
 
     if (g_list_find(image_list->priv->images, file))
     {
@@ -258,7 +256,7 @@ rstto_image_list_remove_file (RsttoImageList *image_list, GFile *file)
         iter = image_list->priv->iterators;
         while (iter)
         {
-            if (g_file_equal(rstto_image_list_iter_get_file (iter->data), file))
+            if (rstto_file_equal(rstto_image_list_iter_get_file (iter->data), file))
             {
                 if (rstto_image_list_iter_get_position (iter->data) == rstto_image_list_get_n_images (image_list)-1)
                 {
@@ -272,7 +270,7 @@ rstto_image_list_remove_file (RsttoImageList *image_list, GFile *file)
                  * it's a single item list,
                  * and we should force the image in this iter to NULL
                  */
-                if (g_file_equal(rstto_image_list_iter_get_file (iter->data), file))
+                if (rstto_file_equal(rstto_image_list_iter_get_file (iter->data), file))
                 {
                     ((RsttoImageListIter *)(iter->data))->priv->file = NULL;
                     g_signal_emit (G_OBJECT (iter->data), rstto_image_list_iter_signals[RSTTO_IMAGE_LIST_ITER_SIGNAL_CHANGED], 0, NULL);
@@ -283,13 +281,12 @@ rstto_image_list_remove_file (RsttoImageList *image_list, GFile *file)
 
         image_list->priv->images = g_list_remove (image_list->priv->images, file);
         iter = image_list->priv->iterators;
-        g_object_ref(file);
         while (iter)
         {
             afile = rstto_image_list_iter_get_file(iter->data);
             if (NULL != afile)
             {
-                if (g_file_equal(afile, file))
+                if (rstto_file_equal(afile, file))
                 {
                     rstto_image_list_iter_next (iter->data);
                 }
@@ -403,7 +400,7 @@ rstto_image_list_iter_dispose (GObject *object)
 }
 
 static RsttoImageListIter *
-rstto_image_list_iter_new (RsttoImageList *nav, GFile *file)
+rstto_image_list_iter_new (RsttoImageList *nav, RsttoFile *file)
 {
     RsttoImageListIter *iter;
 
@@ -415,7 +412,7 @@ rstto_image_list_iter_new (RsttoImageList *nav, GFile *file)
 }
 
 gboolean
-rstto_image_list_iter_find_file (RsttoImageListIter *iter, GFile *file)
+rstto_image_list_iter_find_file (RsttoImageListIter *iter, RsttoFile *file)
 {
     gint pos = g_list_index (iter->priv->image_list->priv->images, file);
     if (pos > -1)
@@ -445,7 +442,7 @@ rstto_image_list_iter_get_position (RsttoImageListIter *iter)
     return g_list_index (iter->priv->image_list->priv->images, iter->priv->file);
 }
 
-GFile *
+RsttoFile *
 rstto_image_list_iter_get_file (RsttoImageListIter *iter)
 {
     return iter->priv->file;
@@ -599,22 +596,10 @@ rstto_image_list_set_sort_by_date (RsttoImageList *image_list)
  * Return value: (see strcmp)
  */
 static gint
-cb_rstto_image_list_image_name_compare_func (GFile *a, GFile *b)
+cb_rstto_image_list_image_name_compare_func (RsttoFile *a, RsttoFile *b)
 {
-    GFileInfo *info_a = g_file_query_info (
-            a,
-            G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
-            0,
-            NULL,
-            NULL );
-    GFileInfo *info_b = g_file_query_info (
-            b,
-            G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
-            0,
-            NULL,
-            NULL );
-    const gchar *a_base = g_file_info_get_display_name (info_a);
-    const gchar *b_base = g_file_info_get_display_name (info_b);
+    const gchar *a_base = rstto_file_get_display_name (a);
+    const gchar *b_base = rstto_file_get_display_name (b);
     guint  ac;
     guint  bc;
     const gchar *ap = a_base;
@@ -678,8 +663,6 @@ cb_rstto_image_list_image_name_compare_func (GFile *a, GFile *b)
     }
 
 
-    g_object_unref (info_a);
-    g_object_unref (info_b);
     return result;
 }
 
@@ -693,12 +676,14 @@ cb_rstto_image_list_image_name_compare_func (GFile *a, GFile *b)
  * Return value: (see strcmp)
  */
 static gint
-cb_rstto_image_list_exif_date_compare_func (GFile *a, GFile *b)
+cb_rstto_image_list_exif_date_compare_func (RsttoFile *a, RsttoFile *b)
 {
     gint result = 0;
+    GFile *file_a = rstto_file_get_file (a);
+    GFile *file_b = rstto_file_get_file (b);
     
-    GFileInfo *file_info_a = g_file_query_info (a, "time::modified", 0, NULL, NULL);
-    GFileInfo *file_info_b = g_file_query_info (b, "time::modified", 0, NULL, NULL);
+    GFileInfo *file_info_a = g_file_query_info (file_a, "time::modified", 0, NULL, NULL);
+    GFileInfo *file_info_b = g_file_query_info (file_b, "time::modified", 0, NULL, NULL);
 
     guint64 a_i = g_file_info_get_attribute_uint64(file_info_a, "time::modified");
     guint64 b_i = g_file_info_get_attribute_uint64(file_info_b, "time::modified");
diff --git a/src/image_list.h b/src/image_list.h
index af277cd..b74b7ef 100644
--- a/src/image_list.h
+++ b/src/image_list.h
@@ -96,7 +96,7 @@ GType           rstto_image_list_get_type ();
 RsttoImageList *rstto_image_list_new ();
 
 gint     rstto_image_list_get_n_images (RsttoImageList *image_list);
-gboolean rstto_image_list_add_file (RsttoImageList *image_list, GFile *file, GError **);
+gboolean rstto_image_list_add_file (RsttoImageList *image_list, RsttoFile *file, GError **);
 
 GCompareFunc rstto_image_list_get_compare_func (RsttoImageList *image_list);
 void         rstto_image_list_set_compare_func (RsttoImageList *image_list, GCompareFunc func);
@@ -112,7 +112,7 @@ RsttoImageListIter *rstto_image_list_get_iter (RsttoImageList *image_list);
 /** Iter functions */
 GType       rstto_image_list_iter_get_type ();
 
-GFile *
+RsttoFile *
 rstto_image_list_iter_get_file ( RsttoImageListIter *iter );
 
 void        rstto_image_list_iter_previous (RsttoImageListIter *iter);
@@ -124,9 +124,9 @@ void        rstto_image_list_iter_set_position (RsttoImageListIter *iter, gint p
 void
 rstto_image_list_remove_all (RsttoImageList *image_list);
 void
-rstto_image_list_remove_file (RsttoImageList *image_list, GFile *file);
+rstto_image_list_remove_file (RsttoImageList *image_list, RsttoFile *file);
 gboolean
-rstto_image_list_iter_find_image (RsttoImageListIter *iter, GFile *file);
+rstto_image_list_iter_find_image (RsttoImageListIter *iter, RsttoFile *file);
 
 RsttoImageListIter *rstto_image_list_iter_clone (RsttoImageListIter *iter);
 
diff --git a/src/image_viewer.c b/src/image_viewer.c
index 7017577..6ee5610 100644
--- a/src/image_viewer.c
+++ b/src/image_viewer.c
@@ -23,6 +23,7 @@
 #include <gio/gio.h>
 #include <libexif/exif-data.h>
 
+#include "file.h"
 #include "image_viewer.h"
 #include "settings.h"
 #include "marshal.h"
@@ -47,7 +48,7 @@ typedef struct _RsttoImageViewerTransaction RsttoImageViewerTransaction;
 
 struct _RsttoImageViewerPriv
 {
-    GFile                       *file;
+    RsttoFile                   *file;
     RsttoSettings               *settings;
     GdkVisual                   *visual;
     GdkColormap                 *colormap;
@@ -103,7 +104,7 @@ struct _RsttoImageViewerPriv
 struct _RsttoImageViewerTransaction
 {
     RsttoImageViewer *viewer;
-    GFile            *file;
+    RsttoFile        *file;
     GCancellable     *cancellable;
     GdkPixbufLoader  *loader;
 
@@ -205,7 +206,7 @@ cb_rstto_zoom_direction_changed (
 static void
 rstto_image_viewer_load_image (
         RsttoImageViewer *viewer,
-        GFile *file,
+        RsttoFile *file,
         gdouble scale);
 static void
 rstto_image_viewer_transaction_free (RsttoImageViewerTransaction *tr);
@@ -898,10 +899,11 @@ rstto_image_viewer_new (void)
  *  - cancellable...
  */
 void
-rstto_image_viewer_set_file (RsttoImageViewer *viewer,
-                             GFile *file,
-                             gdouble scale,
-                             RsttoImageViewerOrientation orientation)
+rstto_image_viewer_set_file (
+        RsttoImageViewer *viewer,
+        RsttoFile *file,
+        gdouble scale,
+        RsttoImageViewerOrientation orientation)
 {
     
     /*
@@ -922,7 +924,7 @@ rstto_image_viewer_set_file (RsttoImageViewer *viewer,
             /*
              * If the old, and new file are equal, do nothing.
              */
-            if (!g_file_equal (viewer->priv->file, file))
+            if (!rstto_file_equal (viewer->priv->file, file))
             {
                 /*
                  * This will first need to return to the 'main' loop before it cleans up after itself.
@@ -937,8 +939,11 @@ rstto_image_viewer_set_file (RsttoImageViewer *viewer,
                     viewer->priv->transaction = NULL;
                 } 
 
+                g_object_ref (file);
                 g_object_unref (viewer->priv->file);
-                viewer->priv->file = g_file_dup(file);
+
+                viewer->priv->file = file;
+
                 rstto_image_viewer_load_image (
                         viewer,
                         viewer->priv->file,
@@ -947,8 +952,10 @@ rstto_image_viewer_set_file (RsttoImageViewer *viewer,
         }
         else
         {
-            viewer->priv->file = g_file_dup(file);
-            rstto_image_viewer_load_image (viewer, viewer->priv->file, scale); }
+            g_object_ref (file);
+            viewer->priv->file = file;
+            rstto_image_viewer_load_image (viewer, viewer->priv->file, scale);
+        }
     } 
     else
     {
@@ -987,7 +994,7 @@ rstto_image_viewer_set_file (RsttoImageViewer *viewer,
 static void
 rstto_image_viewer_load_image (
         RsttoImageViewer *viewer,
-        GFile *file,
+        RsttoFile *file,
         gdouble scale)
 {
     /*
@@ -1015,7 +1022,7 @@ rstto_image_viewer_load_image (
 
     viewer->priv->transaction = transaction;
 
-    g_file_read_async (transaction->file,
+    g_file_read_async (rstto_file_get_file (transaction->file),
                        0,
                        transaction->cancellable,
                        (GAsyncReadyCallback)cb_rstto_image_viewer_read_file_ready,
@@ -1269,7 +1276,10 @@ cb_rstto_image_viewer_value_changed(GtkAdjustment *adjustment, RsttoImageViewer
 }
 
 static void
-cb_rstto_image_viewer_read_file_ready (GObject *source_object, GAsyncResult *result, gpointer user_data)
+cb_rstto_image_viewer_read_file_ready (
+        GObject *source_object,
+        GAsyncResult *result,
+        gpointer user_data )
 {
     GFile *file = G_FILE (source_object);
     RsttoImageViewerTransaction *transaction = (RsttoImageViewerTransaction *)user_data;
@@ -1291,7 +1301,10 @@ cb_rstto_image_viewer_read_file_ready (GObject *source_object, GAsyncResult *res
 }
 
 static void
-cb_rstto_image_viewer_read_input_stream_ready (GObject *source_object, GAsyncResult *result, gpointer user_data)
+cb_rstto_image_viewer_read_input_stream_ready (
+        GObject *source_object,
+        GAsyncResult *result,
+        gpointer user_data )
 {
     GError *error = NULL;
     RsttoImageViewerTransaction *transaction = (RsttoImageViewerTransaction *)user_data;
@@ -2053,7 +2066,6 @@ rstto_button_press_event (
         viewer->priv->motion.h_val = viewer->hadjustment->value;
         viewer->priv->motion.v_val = viewer->vadjustment->value;
 
-        //if (viewer->priv->file != NULL && rstto_image_viewer_get_state (viewer) == RSTTO_IMAGE_VIEWER_STATE_NORMAL)
         if (viewer->priv->file != NULL )
         {
             if (!(event->state & (GDK_CONTROL_MASK)))
diff --git a/src/image_viewer.h b/src/image_viewer.h
index 7a69094..0dcbaaa 100644
--- a/src/image_viewer.h
+++ b/src/image_viewer.h
@@ -82,7 +82,7 @@ rstto_image_viewer_new ();
 void
 rstto_image_viewer_set_file (
         RsttoImageViewer *viewer,
-        GFile *file,
+        RsttoFile *file,
         gdouble scale,
         RsttoImageViewerOrientation orientation);
 
diff --git a/src/main.c b/src/main.c
index 73cf4d4..af3b7c5 100644
--- a/src/main.c
+++ b/src/main.c
@@ -30,6 +30,7 @@
 #include <libxfce4util/libxfce4util.h>
 #include <libexif/exif-data.h>
 
+#include "file.h"
 #include "image_list.h"
 #include "settings.h"
 #include "main_window.h"
@@ -176,7 +177,7 @@ cb_rstto_open_files (RsttoOpenFiles *rof)
 
                     if (strncmp (content_type, "image/", 6) == 0)
                     {
-                        if (rstto_image_list_add_file (rof->image_list, file, NULL) == TRUE)
+                        if (rstto_image_list_add_file (rof->image_list, rstto_file_new(file), NULL) == TRUE)
                         {
                             rstto_main_window_add_file_to_recent_files (file);
                         }
@@ -198,7 +199,7 @@ cb_rstto_open_files (RsttoOpenFiles *rof)
 
                                 if (strncmp (content_type, "image/", 6) == 0)
                                 {
-                                    rstto_image_list_add_file (rof->image_list, child_file, NULL);
+                                    rstto_image_list_add_file (rof->image_list, rstto_file_new(child_file), NULL);
                                 }
 
                                 g_object_unref (child_file);
@@ -207,6 +208,7 @@ cb_rstto_open_files (RsttoOpenFiles *rof)
                         }
                     }
                 }
+                g_object_unref (file);
             }
             rof->iter++;
             return TRUE;
@@ -225,7 +227,7 @@ cb_rstto_open_files (RsttoOpenFiles *rof)
 
                 if (strncmp (content_type, "image/", 6) == 0)
                 {
-                    if (rstto_image_list_add_file (rof->image_list, file, NULL) == TRUE)
+                    if (rstto_image_list_add_file (rof->image_list, rstto_file_new(file), NULL) == TRUE)
                     {
                         rstto_main_window_add_file_to_recent_files (file);
                     }
@@ -249,7 +251,7 @@ cb_rstto_open_files (RsttoOpenFiles *rof)
 
             if (strncmp (content_type, "image/", 6) == 0)
             {
-                rstto_image_list_add_file (rof->image_list, child_file, NULL);
+                rstto_image_list_add_file (rof->image_list, rstto_file_new(child_file), NULL);
             }
 
             g_object_unref (child_file);
diff --git a/src/main_window.c b/src/main_window.c
index 4fb4b9d..74142db 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -32,6 +32,7 @@
 #include <cairo/cairo.h>
 
 #include "settings.h"
+#include "file.h"
 #include "image_list.h"
 #include "image_viewer.h"
 #include "main_window.h"
@@ -447,7 +448,7 @@ rstto_main_window_init (RsttoMainWindow *window)
 
         if (!g_strcasecmp(desktop_type, "gnome"))
         {
-            window->priv->wallpaper_manager = rstto_gnome_wallpaper_manager_new();
+            //window->priv->wallpaper_manager = rstto_gnome_wallpaper_manager_new();
         }
 
         g_free (desktop_type);
@@ -853,11 +854,10 @@ rstto_main_window_new (RsttoImageList *image_list, gboolean fullscreen)
 static void
 rstto_main_window_image_list_iter_changed (RsttoMainWindow *window)
 {
-    gchar *file_basename = NULL;
+    const gchar *file_basename = NULL;
     gchar *title = NULL;
     gchar *status = NULL;
-    GFile *cur_file = NULL;
-    GFileInfo *file_info = NULL;
+    RsttoFile *cur_file = NULL;
     gint position, count, width, height;
     RsttoImageList *image_list = window->priv->props.image_list;
     GList *app_list, *iter;
@@ -875,25 +875,28 @@ rstto_main_window_image_list_iter_changed (RsttoMainWindow *window)
         cur_file = rstto_image_list_iter_get_file (window->priv->iter);
         if (NULL != cur_file)
         {
-            file_info = g_file_query_info (cur_file, "standard::content-type", 0, NULL, NULL);
-            content_type  = g_file_info_get_content_type (file_info);
+            content_type  = rstto_file_get_content_type (cur_file);
 
-            rstto_image_viewer_set_file (RSTTO_IMAGE_VIEWER(window->priv->image_viewer), cur_file, -1, RSTTO_IMAGE_VIEWER_ORIENT_NONE);
+            rstto_image_viewer_set_file (
+                    RSTTO_IMAGE_VIEWER(window->priv->image_viewer),
+                    cur_file,
+                    -1.0,
+                    RSTTO_IMAGE_VIEWER_ORIENT_NONE);
 
             app_list = g_app_info_get_all_for_type (content_type);
 
             for (iter = app_list; iter; iter = g_list_next (iter))
             {
-                GtkWidget *menu_item = rstto_app_menu_item_new (iter->data, cur_file);
+                GtkWidget *menu_item = rstto_app_menu_item_new (iter->data, rstto_file_get_file (cur_file));
                 gtk_menu_shell_append (GTK_MENU_SHELL (open_with_menu), menu_item);
-                menu_item = rstto_app_menu_item_new (iter->data, cur_file);
+                menu_item = rstto_app_menu_item_new (iter->data, rstto_file_get_file (cur_file));
                 gtk_menu_shell_append (GTK_MENU_SHELL (open_with_window_menu), menu_item);
             }
 
             gtk_widget_show_all (open_with_menu);
             gtk_widget_show_all (open_with_window_menu);
 
-            file_basename = g_file_get_basename (cur_file);
+            file_basename = rstto_file_get_display_name (cur_file);
 
             if (count > 1)
             {
@@ -908,8 +911,6 @@ rstto_main_window_image_list_iter_changed (RsttoMainWindow *window)
             {
                 status = g_strdup_printf ("%d x %d", width, height);
             }
-
-            g_free (file_basename);
         }
         else
         {
@@ -1473,7 +1474,7 @@ cb_rstto_main_window_navigationtoolbar_position_changed (GtkRadioAction *action,
 static void
 cb_rstto_main_window_set_as_wallpaper (GtkWidget *widget, RsttoMainWindow *window)
 {
-    GFile *file = NULL;
+    RsttoFile *file = NULL;
     gint response = GTK_RESPONSE_APPLY;
 
     if (window->priv->iter)
@@ -2185,7 +2186,7 @@ cb_rstto_main_window_open_image (GtkWidget *widget, RsttoMainWindow *window)
             while (_files_iter)
             {
                 file = _files_iter->data;
-                if (rstto_image_list_add_file (window->priv->props.image_list, file, NULL) == FALSE)
+                if (rstto_image_list_add_file (window->priv->props.image_list, rstto_file_new(file), NULL) == FALSE)
                 {
                     err_dialog = gtk_message_dialog_new(GTK_WINDOW(window),
                                                     GTK_DIALOG_MODAL,
@@ -2298,7 +2299,7 @@ cb_rstto_main_window_open_folder (GtkWidget *widget, RsttoMainWindow *window)
 
             if (strncmp (content_type, "image/", 6) == 0)
             {
-                rstto_image_list_add_file (window->priv->props.image_list, child_file, NULL);
+                rstto_image_list_add_file (window->priv->props.image_list,rstto_file_new(child_file), NULL);
             }
 
             g_object_unref (child_file);
@@ -2368,7 +2369,7 @@ cb_rstto_main_window_open_recent(GtkRecentChooser *chooser, RsttoMainWindow *win
 
                 if (strncmp (content_type, "image/", 6) == 0)
                 {
-                    rstto_image_list_add_file (window->priv->props.image_list, child_file, NULL);
+                    rstto_image_list_add_file (window->priv->props.image_list, rstto_file_new(child_file), NULL);
                 }
 
                 g_object_unref (child_file);
@@ -2384,7 +2385,7 @@ cb_rstto_main_window_open_recent(GtkRecentChooser *chooser, RsttoMainWindow *win
         }
         else
         {
-            if (rstto_image_list_add_file (window->priv->props.image_list, file, NULL) == FALSE)
+            if (rstto_image_list_add_file (window->priv->props.image_list, rstto_file_new(file), NULL) == FALSE)
             {
                 err_dialog = gtk_message_dialog_new(GTK_WINDOW(window),
                                                 GTK_DIALOG_MODAL,
@@ -2450,10 +2451,10 @@ cb_rstto_main_window_save_copy (GtkWidget *widget, RsttoMainWindow *window)
     if(response == GTK_RESPONSE_OK)
     {
         file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
-        s_file = rstto_image_list_iter_get_file (window->priv->iter);
+        s_file = rstto_file_get_file(rstto_image_list_iter_get_file (window->priv->iter));
         if (g_file_copy (s_file, file, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, NULL))
         {
-            rstto_image_list_add_file (window->priv->props.image_list, file, NULL);
+            rstto_image_list_add_file (window->priv->props.image_list, rstto_file_new(file), NULL);
         }
     }
 
@@ -2467,8 +2468,8 @@ cb_rstto_main_window_properties (GtkWidget *widget, RsttoMainWindow *window)
     /* The display object is owned by gdk, do not unref it */
     GdkDisplay *display = gdk_display_get_default();
     GError *error = NULL;
-    GFile *file = rstto_image_list_iter_get_file (window->priv->iter);
-    gchar *uri = NULL;
+    RsttoFile *file = rstto_image_list_iter_get_file (window->priv->iter);
+    const gchar *uri = NULL;
     GtkWidget *dialog = NULL;
     gboolean use_thunar_properties = rstto_settings_get_boolean_property (
             window->priv->settings_manager,
@@ -2482,7 +2483,7 @@ cb_rstto_main_window_properties (GtkWidget *widget, RsttoMainWindow *window)
          */
         if ( TRUE == use_thunar_properties )
         {
-            uri = g_file_get_uri(file);
+            uri = rstto_file_get_uri(file);
             if(dbus_g_proxy_call(window->priv->filemanager_proxy,
                                  "DisplayFileProperties",
                                  &error,
@@ -2499,7 +2500,6 @@ cb_rstto_main_window_properties (GtkWidget *widget, RsttoMainWindow *window)
                 gtk_dialog_run (GTK_DIALOG(dialog));
                 gtk_widget_destroy(dialog);
             }
-            g_free(uri);
         }
         else
         {
@@ -2521,7 +2521,7 @@ cb_rstto_main_window_properties (GtkWidget *widget, RsttoMainWindow *window)
 static void
 cb_rstto_main_window_close (GtkWidget *widget, RsttoMainWindow *window)
 {
-    GFile *file = rstto_image_list_iter_get_file (window->priv->iter);
+    RsttoFile *file = rstto_image_list_iter_get_file (window->priv->iter);
     rstto_image_list_remove_file (window->priv->props.image_list, file);
 
     rstto_main_window_update_buttons (window);
@@ -2556,8 +2556,8 @@ cb_rstto_main_window_close_all (GtkWidget *widget, RsttoMainWindow *window)
 static void
 cb_rstto_main_window_delete (GtkWidget *widget, RsttoMainWindow *window)
 {
-    GFile *file = rstto_image_list_iter_get_file (window->priv->iter);
-    gchar *file_basename = g_file_get_basename (file);
+    RsttoFile *file = rstto_image_list_iter_get_file (window->priv->iter);
+    const gchar *file_basename = rstto_file_get_display_name(file);
     GtkWidget *dialog;
     g_return_if_fail (rstto_image_list_get_n_images (window->priv->props.image_list) > 0);
 
@@ -2571,7 +2571,7 @@ cb_rstto_main_window_delete (GtkWidget *widget, RsttoMainWindow *window)
     g_object_ref (file);
     if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
     {
-        if (g_file_trash (file, NULL, NULL) == TRUE)
+        if (g_file_trash (rstto_file_get_file(file), NULL, NULL) == TRUE)
         {
             rstto_image_list_remove_file (window->priv->props.image_list, file);
         }
@@ -2581,7 +2581,6 @@ cb_rstto_main_window_delete (GtkWidget *widget, RsttoMainWindow *window)
         }
     }
     gtk_widget_destroy (dialog);
-    g_free (file_basename);
     g_object_unref (file);
 }
 
diff --git a/src/properties_dialog.c b/src/properties_dialog.c
index 72eec38..cb03cba 100644
--- a/src/properties_dialog.c
+++ b/src/properties_dialog.c
@@ -22,6 +22,7 @@
 #include <libxfce4util/libxfce4util.h>
 
 #include "settings.h"
+#include "file.h"
 #include "properties_dialog.h"
 
 static void
@@ -47,7 +48,7 @@ rstto_properties_dialog_get_property (
 static void
 properties_dialog_set_file (
         RsttoPropertiesDialog *dialog,
-        GFile *file);
+        RsttoFile *file);
 
 static GtkWidgetClass *parent_class = NULL;
 
@@ -59,7 +60,7 @@ enum
 
 struct _RsttoPropertiesDialogPriv
 {
-    GFile *file;
+    RsttoFile *file;
     RsttoSettings *settings;
 
     GtkWidget *name_entry;
@@ -301,7 +302,7 @@ rstto_properties_dialog_class_init (GObjectClass *object_class)
     pspec = g_param_spec_object ("file",
                                  "",
                                  "",
-                                 G_TYPE_FILE,
+                                 RSTTO_TYPE_FILE,
                                  G_PARAM_READWRITE);
     g_object_class_install_property (object_class,
                                      PROP_FILE,
@@ -354,35 +355,22 @@ rstto_properties_dialog_get_property (
 static void
 properties_dialog_set_file (
         RsttoPropertiesDialog *dialog,
-        GFile *file)
+        RsttoFile *file)
 {
-    GFileInfo *file_info = NULL;
     gchar *description;
 
     dialog->priv->file = file;
 
     if (dialog->priv->file)
     {
-        file_info = g_file_query_info (
-                dialog->priv->file,
-                "standard::content-type,standard::edit-name,standard::size,time::modified,time_accessed",
-                0,
-                NULL,
-                NULL);
-        description = g_content_type_get_description (
-                g_file_info_get_attribute_string (
-                        file_info,
-                        "standard::content-type")
-                );
+        description = g_content_type_get_description (rstto_file_get_content_type (file));
         gtk_label_set_text (
                 GTK_LABEL (dialog->priv->mime_content_label),
                 description
                 );
         gtk_entry_set_text (
                 GTK_ENTRY (dialog->priv->name_entry),
-                g_file_info_get_attribute_string (
-                        file_info,
-                        "standard::edit-name")
+                rstto_file_get_display_name (file)
                 );
         g_free (description);
     }
@@ -395,9 +383,9 @@ properties_dialog_set_file (
 GtkWidget *
 rstto_properties_dialog_new (
         GtkWindow *parent,
-        GFile *file)
+        RsttoFile *file)
 {
-    gchar *title = g_strdup_printf (_("%s - Properties"), g_file_get_basename(file));
+    gchar *title = g_strdup_printf (_("%s - Properties"), rstto_file_get_display_name (file));
     GtkWidget *dialog = g_object_new (RSTTO_TYPE_PROPERTIES_DIALOG,
                                       "title", title,
                                       "icon-name", GTK_STOCK_PROPERTIES,
diff --git a/src/properties_dialog.h b/src/properties_dialog.h
index 0714b12..a1b6e55 100644
--- a/src/properties_dialog.h
+++ b/src/properties_dialog.h
@@ -64,7 +64,7 @@ rstto_properties_dialog_get_type();
 GtkWidget *
 rstto_properties_dialog_new (
         GtkWindow *parent,
-        GFile *file
+        RsttoFile *file
         );
 
 G_END_DECLS
diff --git a/src/thumbnail.c b/src/thumbnail.c
index 5deb5d8..b3ace00 100644
--- a/src/thumbnail.c
+++ b/src/thumbnail.c
@@ -23,12 +23,13 @@
 
 #include <libexif/exif-data.h>
 
+#include "file.h"
 #include "image_list.h"
 #include "thumbnail.h"
 
 struct _RsttoThumbnailPriv
 {
-    GFile       *file;
+    RsttoFile   *file;
     GdkPixbuf   *pixbuf;
     GdkPixbuf   *thumb_pixbuf;
     gchar       *thumbnail_path;
@@ -275,12 +276,11 @@ rstto_thumbnail_paint(RsttoThumbnail *thumb)
 }
 
 GtkWidget *
-rstto_thumbnail_new (GFile *file)
+rstto_thumbnail_new (RsttoFile *file)
 {
-    gchar *file_basename;
-    gchar *filename;
-    gchar *file_uri;
+    const gchar *file_uri;
     gchar *file_uri_checksum;
+    gchar *filename;
 
     RsttoThumbnail *thumb;
 
@@ -291,23 +291,20 @@ rstto_thumbnail_new (GFile *file)
     thumb->priv->file = file ;
     g_object_ref (file);
 
-    file_basename = g_file_get_basename (file);
-    file_uri = g_file_get_uri (file);
+    file_uri = rstto_file_get_uri (file);
     file_uri_checksum = g_compute_checksum_for_string (G_CHECKSUM_MD5, file_uri, strlen (file_uri));
     filename = g_strconcat (file_uri_checksum, ".png", NULL);
 
     thumb->priv->thumbnail_path = g_build_path ("/", g_get_home_dir(), ".thumbnails", "normal", filename, NULL);
 
-    gtk_widget_set_tooltip_text(GTK_WIDGET(thumb), file_basename);
+    gtk_widget_set_tooltip_text(GTK_WIDGET(thumb), rstto_file_get_display_name (file));
 
-    g_free (file_basename);
-    g_free (file_uri);
     g_free (file_uri_checksum);
-
+    g_free (filename);
     return GTK_WIDGET(thumb);
 }
 
-GFile *
+RsttoFile *
 rstto_thumbnail_get_file (RsttoThumbnail *thumb)
 {
     return thumb->priv->file;
diff --git a/src/thumbnail.h b/src/thumbnail.h
index 077045c..cd07599 100644
--- a/src/thumbnail.h
+++ b/src/thumbnail.h
@@ -61,8 +61,9 @@ struct _RsttoThumbnailClass
 
 GType      rstto_thumbnail_get_type();
 
-GtkWidget  *rstto_thumbnail_new (GFile *);
-GFile *
+GtkWidget  *rstto_thumbnail_new ( RsttoFile * );
+
+RsttoFile *
 rstto_thumbnail_get_file (RsttoThumbnail *thumb);
 
 
diff --git a/src/thumbnail_bar.c b/src/thumbnail_bar.c
index 8822e71..50ab259 100644
--- a/src/thumbnail_bar.c
+++ b/src/thumbnail_bar.c
@@ -24,6 +24,7 @@
 #include <libxfce4ui/libxfce4ui.h>
 #include <libexif/exif-data.h>
 
+#include "file.h"
 #include "image_list.h"
 #include "thumbnail.h"
 #include "thumbnail_bar.h"
@@ -71,9 +72,15 @@ static void
 rstto_thumbnail_bar_unrealize(GtkWidget *widget);
 
 static void
-cb_rstto_thumbnail_bar_image_list_new_file (RsttoImageList *image_list, GFile *file, gpointer user_data);
+cb_rstto_thumbnail_bar_image_list_new_file (
+        RsttoImageList *image_list,
+        RsttoFile *file,
+        gpointer user_data);
 static void
-cb_rstto_thumbnail_bar_image_list_remove_file (RsttoImageList *image_list, GFile *file, gpointer user_data);
+cb_rstto_thumbnail_bar_image_list_remove_file (
+        RsttoImageList *image_list,
+        RsttoFile *file,
+        gpointer user_data);
 static void
 cb_rstto_thumbnail_bar_image_list_remove_all (RsttoImageList *image_list, gpointer user_data);
 void
@@ -656,8 +663,8 @@ static gint
 cb_rstto_thumbnail_bar_compare (GtkWidget *a, GtkWidget *b, gpointer user_data)
 {
     RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR (user_data);
-    GFile *a_i = rstto_thumbnail_get_file (RSTTO_THUMBNAIL (a));
-    GFile *b_i = rstto_thumbnail_get_file (RSTTO_THUMBNAIL (b));
+    RsttoFile *a_i = rstto_thumbnail_get_file (RSTTO_THUMBNAIL (a));
+    RsttoFile *b_i = rstto_thumbnail_get_file (RSTTO_THUMBNAIL (b));
 
     return rstto_image_list_get_compare_func (bar->priv->image_list) (a_i, b_i);
 }
@@ -865,7 +872,10 @@ cb_rstto_thumbnail_bar_image_list_iter_changed (RsttoImageListIter *iter, gpoint
 }
 
 static void
-cb_rstto_thumbnail_bar_image_list_new_file (RsttoImageList *image_list, GFile *file, gpointer user_data)
+cb_rstto_thumbnail_bar_image_list_new_file (
+        RsttoImageList *image_list,
+        RsttoFile *file,
+        gpointer user_data)
 {
     RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR (user_data);
     GtkWidget *thumb;
@@ -875,7 +885,7 @@ cb_rstto_thumbnail_bar_image_list_new_file (RsttoImageList *image_list, GFile *f
 
     for (iter = bar->priv->thumbs; iter != NULL; iter = g_list_next (iter))
     {
-        if (g_file_equal(file,rstto_thumbnail_get_file (iter->data)))
+        if (rstto_file_equal(file,rstto_thumbnail_get_file (iter->data)))
             return;
     }
 
@@ -891,14 +901,17 @@ cb_rstto_thumbnail_bar_image_list_new_file (RsttoImageList *image_list, GFile *f
 }
 
 static void
-cb_rstto_thumbnail_bar_image_list_remove_file (RsttoImageList *image_list, GFile *file, gpointer user_data)
+cb_rstto_thumbnail_bar_image_list_remove_file (
+        RsttoImageList *image_list,
+        RsttoFile *file,
+        gpointer user_data )
 {
     RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR (user_data);
     GList *iter = bar->priv->thumbs;
 
     while (iter)
     {
-        if (g_file_equal(rstto_thumbnail_get_file(iter->data), file))
+        if (rstto_file_equal(rstto_thumbnail_get_file(iter->data), file))
         {
             GtkWidget *widget = iter->data;
             gtk_container_remove (GTK_CONTAINER (bar), widget);
diff --git a/src/thumbnailer.c b/src/thumbnailer.c
index cad90e5..0ff0022 100644
--- a/src/thumbnailer.c
+++ b/src/thumbnailer.c
@@ -25,6 +25,7 @@
 #include <gio/gio.h>
 #include <dbus/dbus-glib.h>
 
+#include "file.h"
 #include "thumbnail.h"
 #include "thumbnailer.h"
 #include "marshal.h"
@@ -347,16 +348,15 @@ static gboolean
 rstto_thumbnailer_queue_request_timer (
         RsttoThumbnailer *thumbnailer)
 {
-    gchar **uris;
+    const gchar **uris;
     const gchar **mimetypes;
     GSList *iter;
     gint i = 0;
-    GFile *file;
+    RsttoFile *file;
     GError *error = NULL;
-    GFileInfo *file_info;
 
     uris = g_new0 (
-            gchar *,
+            const gchar *,
             g_slist_length(thumbnailer->priv->queue) + 1);
     mimetypes = g_new0 (
             const gchar *,
@@ -368,19 +368,8 @@ rstto_thumbnailer_queue_request_timer (
         if (iter->data)
         {
             file = rstto_thumbnail_get_file (RSTTO_THUMBNAIL(iter->data));
-            uris[i] = g_file_get_uri (file);
-            file_info = g_file_query_info (
-                    file,
-                    "standard::content-type",
-                    0,
-                    NULL,
-                    NULL);
-            if (file_info)
-            {
-                mimetypes[i] = g_file_info_get_attribute_string (
-                        file_info,
-                        "standard::content-type");
-            }
+            uris[i] = rstto_file_get_uri (file);
+            mimetypes[i] = rstto_file_get_content_type (file);
         }
         iter = g_slist_next(iter);
         i++;
@@ -427,11 +416,11 @@ cb_rstto_thumbnailer_thumbnail_ready (
 {
     RsttoThumbnailer *thumbnailer = RSTTO_THUMBNAILER (data);
     RsttoThumbnail *thumbnail;
-    GFile *file;
+    RsttoFile *file;
     GSList *iter = thumbnailer->priv->queue;
     GSList *prev;
     gint x = 0;
-    gchar *f_uri;
+    const gchar *f_uri;
     while (iter)
     {
         if ((uri[x] == NULL) || (iter->data == NULL))
@@ -441,7 +430,7 @@ cb_rstto_thumbnailer_thumbnail_ready (
 
         thumbnail = iter->data;
         file = rstto_thumbnail_get_file (thumbnail);
-        f_uri = g_file_get_uri (file);
+        f_uri = rstto_file_get_uri (file);
         if (strcmp (uri[x], f_uri) == 0)
         {
             rstto_thumbnail_update (thumbnail);
diff --git a/src/wallpaper_manager.c b/src/wallpaper_manager.c
index 778488d..a79ca60 100644
--- a/src/wallpaper_manager.c
+++ b/src/wallpaper_manager.c
@@ -24,12 +24,13 @@
 #include <gtk/gtk.h>
 #include <gio/gio.h>
 
+#include "file.h"
 #include "wallpaper_manager.h"
 
 gint 
 rstto_wallpaper_manager_configure_dialog_run (
         RsttoWallpaperManager *self,
-        GFile *file)
+        RsttoFile *file)
 {
     return RSTTO_WALLPAPER_MANAGER_GET_IFACE (self)->configure_dialog_run(self, file);
 }
@@ -43,7 +44,7 @@ rstto_wallpaper_manager_check_running (RsttoWallpaperManager *self)
 gboolean
 rstto_wallpaper_manager_set (
         RsttoWallpaperManager *self,
-        GFile *file)
+        RsttoFile *file)
 {
     return RSTTO_WALLPAPER_MANAGER_GET_IFACE (self)->set (self, file);
 }
diff --git a/src/wallpaper_manager.h b/src/wallpaper_manager.h
index 374910b..886fab1 100644
--- a/src/wallpaper_manager.h
+++ b/src/wallpaper_manager.h
@@ -41,8 +41,8 @@ typedef struct _RsttoWallpaperManagerIface RsttoWallpaperManagerIface;
 struct _RsttoWallpaperManagerIface {
     GTypeInterface parent;
 
-    gint (*configure_dialog_run) (RsttoWallpaperManager *self, GFile *file);
-    gboolean (*set) (RsttoWallpaperManager *self, GFile *file);
+    gint (*configure_dialog_run) (RsttoWallpaperManager *self, RsttoFile *file);
+    gboolean (*set) (RsttoWallpaperManager *self, RsttoFile *file);
     gboolean (*check_running) (RsttoWallpaperManager *self);
 };
 
@@ -55,12 +55,12 @@ rstto_wallpaper_manager_check_running (RsttoWallpaperManager *self);
 gint
 rstto_wallpaper_manager_configure_dialog_run (
         RsttoWallpaperManager *self,
-        GFile *file);
+        RsttoFile *file);
 
 gboolean
 rstto_wallpaper_manager_set (
         RsttoWallpaperManager *self,
-        GFile *file);
+        RsttoFile *file);
 
 G_END_DECLS
 
diff --git a/src/xfce_wallpaper_manager.c b/src/xfce_wallpaper_manager.c
index 90087d8..3722b81 100644
--- a/src/xfce_wallpaper_manager.c
+++ b/src/xfce_wallpaper_manager.c
@@ -26,6 +26,7 @@
 #include <libxfce4util/libxfce4util.h>
 #include <gio/gio.h>
 
+#include "file.h"
 #include "monitor_chooser.h"
 #include "wallpaper_manager.h"
 #include "xfce_wallpaper_manager.h"
@@ -74,7 +75,7 @@ struct _RsttoXfceWallpaperManagerPriv
     RsttoColor *color1;
     RsttoColor *color2;
 
-    GFile *file;
+    RsttoFile *file;
 
     GtkWidget *monitor_chooser;
     GtkWidget *style_combo;
@@ -93,7 +94,7 @@ enum
 static gint 
 rstto_xfce_wallpaper_manager_configure_dialog_run (
         RsttoWallpaperManager *self,
-        GFile *file)
+        RsttoFile *file)
 {
     RsttoXfceWallpaperManager *manager = RSTTO_XFCE_WALLPAPER_MANAGER (self);
     gint response = 0;
@@ -103,7 +104,7 @@ rstto_xfce_wallpaper_manager_configure_dialog_run (
             RSTTO_MONITOR_CHOOSER(manager->priv->monitor_chooser),
             manager->priv->monitor,
             gdk_pixbuf_new_from_file_at_size(
-                    g_file_get_path(file),
+                    rstto_file_get_path(file),
                     500,
                     500,
                     NULL),
@@ -144,11 +145,11 @@ rstto_xfce_wallpaper_manager_check_running (RsttoWallpaperManager *self)
 }
 
 static gboolean
-rstto_xfce_wallpaper_manager_set (RsttoWallpaperManager *self, GFile *file)
+rstto_xfce_wallpaper_manager_set (RsttoWallpaperManager *self, RsttoFile *file)
 {
     RsttoXfceWallpaperManager *manager = RSTTO_XFCE_WALLPAPER_MANAGER (self);
 
-    gchar *uri = g_file_get_path (file);
+    const gchar *uri = rstto_file_get_path (file);
 
     gchar *image_path_prop = g_strdup_printf (
             "/backdrop/screen%d/monitor%d/image-path",
@@ -285,7 +286,7 @@ rstto_xfce_wallpaper_manager_init (GObject *object)
 {
     RsttoXfceWallpaperManager *manager = RSTTO_XFCE_WALLPAPER_MANAGER (object);
 
-    manager->priv = g_new0 (RsttoXfceWallpaperManagerPriv, 1);
+    manager->priv = g_new0(RsttoXfceWallpaperManagerPriv, 1);
     manager->priv->channel = xfconf_channel_new ("xfce4-desktop");
     manager->priv->color1 = g_new0 (RsttoColor, 1);
     manager->priv->color1->a = 0xffff;
@@ -607,7 +608,7 @@ cb_monitor_chooser_changed (
             RSTTO_MONITOR_CHOOSER(manager->priv->monitor_chooser),
             monitor_id,
             gdk_pixbuf_new_from_file_at_size(
-                g_file_get_path(manager->priv->file),
+                rstto_file_get_path(manager->priv->file),
                 500,
                 500,
                 NULL),


More information about the Xfce4-commits mailing list