Author: jannis
Date: 2008-12-18 00:42:34 +0000 (Thu, 18 Dec 2008)
New Revision: 29033

Modified:
   thunar/branches/port-to-gio/ChangeLog
   thunar/branches/port-to-gio/configure.in.in
   thunar/branches/port-to-gio/thunar/Makefile.am
   thunar/branches/port-to-gio/thunar/thunar-file.c
   thunar/branches/port-to-gio/thunar/thunar-file.h
Log:
        * configure.in.in: Add dependency on GIO 2.16 and updated GLib
          dependency to 2.16 as well.
        * thunar/Makefile.am: Add compiler and linker flags for GLib and GIO.
        * thunar/thunar-file.{c,h}: Add GFile and GFileInfo members to
          ThunarFile. Replace the macro thunar_file_has_parent() with a
          function implementation based on g_file_get_parent().

Modified: thunar/branches/port-to-gio/ChangeLog
===================================================================
--- thunar/branches/port-to-gio/ChangeLog       2008-12-17 19:30:49 UTC (rev 
29032)
+++ thunar/branches/port-to-gio/ChangeLog       2008-12-18 00:42:34 UTC (rev 
29033)
@@ -1,3 +1,12 @@
+2008-12-18     Jannis Pohlmann <jan...@xfce.org>
+
+       * configure.in.in: Add dependency on GIO 2.16 and updated GLib
+         dependency to 2.16 as well.
+       * thunar/Makefile.am: Add compiler and linker flags for GLib and GIO.
+       * thunar/thunar-file.{c,h}: Add GFile and GFileInfo members to 
+         ThunarFile. Replace the macro thunar_file_has_parent() with a 
+         function implementation based on g_file_get_parent().
+
 2008-12-08     Nick Schermer <n...@xfce.org>
 
        * thunar/thunar-standard-view.c: Go back and forward using the

Modified: thunar/branches/port-to-gio/configure.in.in
===================================================================
--- thunar/branches/port-to-gio/configure.in.in 2008-12-17 19:30:49 UTC (rev 
29032)
+++ thunar/branches/port-to-gio/configure.in.in 2008-12-18 00:42:34 UTC (rev 
29033)
@@ -159,11 +159,12 @@
 dnl *** Check for required packages ***
 dnl ***********************************
 XDT_CHECK_PACKAGE([EXO], [exo-0.3], [0.3.92])
-XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.12.0])
+XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.16.0])
 XDT_CHECK_PACKAGE([GTHREAD], [gthread-2.0], [2.12.0])
 XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.10.0])
 XDT_CHECK_PACKAGE([GDK_PIXBUF], [gdk-pixbuf-2.0], [2.10.0])
 XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.2.2])
+XDT_CHECK_PACKAGE([GIO], [gio-2.0], [2.16.0])
 
 dnl *********************************************
 dnl *** Check for libpng (with various names) ***

Modified: thunar/branches/port-to-gio/thunar/Makefile.am
===================================================================
--- thunar/branches/port-to-gio/thunar/Makefile.am      2008-12-17 19:30:49 UTC 
(rev 29032)
+++ thunar/branches/port-to-gio/thunar/Makefile.am      2008-12-18 00:42:34 UTC 
(rev 29033)
@@ -195,6 +195,8 @@
 Thunar_CFLAGS =                                                                
\
        $(EXO_CFLAGS)                                                   \
        $(GTHREAD_CFLAGS)                                               \
+       $(GLIB_CFLAGS)                                                  \
+       $(GIO_CFLAGS)                                                   \
        $(LIBSM_CFLAGS)                                                 \
        $(PLATFORM_CFLAGS)
 
@@ -209,6 +211,8 @@
        $(top_builddir)/thunarx/libthunarx-$(THUNAR_VERSION_API).la     \
        $(EXO_LIBS)                                                     \
        $(GTHREAD_LIBS)                                                 \
+       $(GLIB_LIBS)                                                    \
+       $(GIO_LIBS)                                                     \
        $(LIBSM_LIBS)
 
 Thunar_DEPENDENCIES =                                                  \

Modified: thunar/branches/port-to-gio/thunar/thunar-file.c
===================================================================
--- thunar/branches/port-to-gio/thunar/thunar-file.c    2008-12-17 19:30:49 UTC 
(rev 29032)
+++ thunar/branches/port-to-gio/thunar/thunar-file.c    2008-12-18 00:42:34 UTC 
(rev 29033)
@@ -300,6 +300,10 @@
   /* release the file info */
   thunar_vfs_info_unref (file->info);
 
+  /* release the GIO info */
+  g_object_unref (file->gfile);
+  g_object_unref (file->ginfo);
+
   (*G_OBJECT_CLASS (thunar_file_parent_class)->finalize) (object);
 }
 
@@ -591,9 +595,12 @@
 thunar_file_get_for_info (ThunarVfsInfo *info)
 {
   ThunarFile *file;
+  gchar      *uri;
 
   _thunar_return_val_if_fail (info != NULL, NULL);
 
+  uri = thunar_vfs_path_dup_uri (info->path);
+          
   /* check if we already have a cached version of that file */
   file = thunar_file_cache_lookup (info->path);
   if (G_UNLIKELY (file != NULL))
@@ -605,7 +612,14 @@
       if (!thunar_vfs_info_matches (file->info, info))
         {
           thunar_vfs_info_unref (file->info);
+
+          g_object_unref (file->gfile);
+          g_object_unref (file->ginfo);
+
           file->info = thunar_vfs_info_ref (info);
+          file->gfile = g_file_new_for_uri (uri);
+          file->ginfo = g_file_query_info (file->gfile, "standard::*", 
G_FILE_QUERY_INFO_NONE, NULL, NULL);
+
           thunar_file_changed (file);
         }
     }
@@ -615,10 +629,16 @@
       file = g_object_new (THUNAR_TYPE_FILE, NULL);
       file->info = thunar_vfs_info_ref (info);
 
+      /* create GFile and GFileInfo */
+      file->gfile = g_file_new_for_uri (uri);
+      file->ginfo = g_file_query_info (file->gfile, "standard::*", 
G_FILE_QUERY_INFO_NONE, NULL, NULL);
+
       /* insert the file into the cache */
       g_hash_table_insert (file_cache, thunar_vfs_path_ref (info->path), file);
     }
 
+  g_free (uri);
+
   return file;
 }
 
@@ -1596,7 +1616,36 @@
 }
 
 
+
 /**
+ * thunar_file_has_parent:
+ * @file : a #ThunarFile instance.
+ *
+ * Checks whether it is possible to determine the parent #ThunarFile
+ * for @file.
+ *
+ * Return value: whether @file has a parent.
+ **/
+gboolean
+thunar_file_has_parent (const ThunarFile *file)
+{
+  GFile *parent;
+
+  _thunar_return_val_if_fail (THUNAR_IS_FILE (file), FALSE);
+
+  parent = g_file_get_parent (file->gfile);
+
+  if (G_LIKELY (parent != NULL))
+    {
+      g_object_unref (parent);
+      return TRUE;
+    }
+  else
+    return FALSE;
+}
+
+
+/**
  * thunar_file_get_icon_name:
  * @file       : a #ThunarFile instance.
  * @icon_state : the state of the @file<!---->s icon we are interested in.

Modified: thunar/branches/port-to-gio/thunar/thunar-file.h
===================================================================
--- thunar/branches/port-to-gio/thunar/thunar-file.h    2008-12-17 19:30:49 UTC 
(rev 29032)
+++ thunar/branches/port-to-gio/thunar/thunar-file.h    2008-12-18 00:42:34 UTC 
(rev 29033)
@@ -25,6 +25,7 @@
 #include <thunarx/thunarx.h>
 
 #include <glib.h>
+#include <gio/gio.h>
 
 G_BEGIN_DECLS;
 
@@ -105,11 +106,14 @@
 
 struct _ThunarFile
 {
-  GObject __parent__;
+  GObject        __parent__;
 
   /*< private >*/
   ThunarVfsInfo *info;
-  guint flags;
+  guint          flags;
+
+  GFile         *gfile;
+  GFileInfo     *ginfo;
 };
 
 GType             thunar_file_get_type             (void) G_GNUC_CONST;
@@ -206,17 +210,9 @@
 
 gboolean         thunar_file_is_desktop              (const ThunarFile *file);
 
-/**
- * thunar_file_has_parent:
- * @file : a #ThunarFile instance.
- *
- * Checks whether it is possible to determine the parent #ThunarFile
- * for @file.
- *
- * Return value: whether @file has a parent.
- **/
-#define thunar_file_has_parent(file) (!thunar_vfs_path_is_root (THUNAR_FILE 
((file))->info->path))
+gboolean         thunar_file_has_parent              (const ThunarFile *file);
 
+
 /**
  * thunar_file_get_info:
  * @file : a #ThunarFile instance.

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to