File thunar-shares-plugin-0.2.0-port-to-thunarx-2.patch of Package thunar-plugins

diff -urNp thunar-shares-plugin-0.2.0.orig/configure.in thunar-shares-plugin-0.2.0/configure.in
--- thunar-shares-plugin-0.2.0.orig/configure.in	2009-02-15 21:00:53.000000000 +0100
+++ thunar-shares-plugin-0.2.0/configure.in	2011-01-23 11:16:26.000000000 +0100
@@ -21,7 +21,7 @@ m4_define([tsp_debug_default], [ifelse(t
 dnl -------------------------------------------------------
 dnl Init autoconf
 dnl -------------------------------------------------------
-AC_COPYRIGHT([Copyright (c) 2008 Daniel Morales <daniel@daniel.com.uy>.])
+AC_COPYRIGHT([Copyright (c) 2009-2010 Daniel Morales <daniel@daniel.com.uy>.])
 AC_INIT([thunar-shares-plugin], [tsp_version], [thunar-dev@xfce.org])
 AC_CONFIG_SRCDIR([thunar-plugin/thunar-shares-plugin.c])
 AC_PREREQ(2.59)
@@ -49,15 +49,14 @@ AC_PROG_INTLTOOL([0.31])
 dnl -------------------------------------------------------
 dnl Check headers
 dnl -------------------------------------------------------
-AC_CHECK_HEADERS([string.h sys/types.h sys/wait.h time.h]) 
+AC_CHECK_HEADERS([string.h sys/types.h sys/wait.h time.h sys/stat.h unistd.h]) 
 
 dnl -------------------------------------------------------
 dnl Packages checks
 dnl -------------------------------------------------------
 XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.12.0])
-XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.10.0])
-XDT_CHECK_PACKAGE([THUNARX], [thunarx-1], [0.8.0])
-XDT_CHECK_PACKAGE([THUNARVFS], [thunar-vfs-1], [0.8.0])
+XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.18.0])
+XDT_CHECK_PACKAGE([THUNARX], [thunarx-2], [1.0.1])
 
 dnl -------------------------------------------------------
 dnl Languages
diff -urNp thunar-shares-plugin-0.2.0.orig/libshares/libshares-util.c thunar-shares-plugin-0.2.0/libshares/libshares-util.c
--- thunar-shares-plugin-0.2.0.orig/libshares/libshares-util.c	2009-02-15 20:54:41.000000000 +0100
+++ thunar-shares-plugin-0.2.0/libshares/libshares-util.c	2011-01-23 13:06:43.000000000 +0100
@@ -25,18 +25,23 @@
 #include <glib/gstdio.h>
 #include <gtk/gtk.h>
 
-#include <thunar-vfs/thunar-vfs.h>
+#include <sys/stat.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <gio/gio.h>
 #include <thunarx/thunarx.h>
 
 #include "libshares-util.h"
 #include "shares.h"
 
-static gboolean tsp_ask_perms   (gboolean     need_r,
-                                 gboolean     need_w,
-                                 gboolean     need_x);
+static gboolean tsp_ask_perms   (void);
 
 static gboolean tsp_check_perms (const gchar *path,
-                                 gboolean     is_writable);
+                                 gboolean     is_writable,
+                                 gboolean     guests_ok);
 
 /**
  * libshares_get_local_file:
@@ -190,7 +195,7 @@ libshares_shares_share (const gchar  *fi
     }
   }
 
-  if (tsp_check_perms (file_local, is_writable))
+  if (tsp_check_perms (file_local, is_writable, guests_ok))
   {
     share_info = g_new0 (ShareInfo, 1);
 
@@ -289,17 +294,17 @@ gboolean
 libshares_is_shareable (ThunarxFileInfo *info)
 {
   gboolean retval;
-  gchar   *scheme;
+  GFile   *file;
 
   if (!thunarx_file_info_is_directory (info)){
     return FALSE;
   }
 
-  scheme = thunarx_file_info_get_uri_scheme (info);
+  file = thunarx_file_info_get_location (info);
 
-  retval = g_str_equal ("file", scheme);
+  retval = g_file_is_native (file);
 
-  g_free (scheme);
+  g_object_unref (file);
 
   return retval;
 }
@@ -315,19 +320,22 @@ libshares_is_shareable (ThunarxFileInfo
 gboolean
 libshares_check_owner (ThunarxFileInfo *info)
 {
-  ThunarVfsInfo *vfsinfo;
-  gboolean retval = TRUE;
-  gboolean owner_only;
+  GFileInfo *fileinfo;
+  gboolean   retval = TRUE;
+  gboolean   owner_only;
+  guint32    uid;
 
   if (shares_has_owner_only (&owner_only, NULL))
   {
     if (owner_only)
     {
-      vfsinfo = thunarx_file_info_get_vfs_info (info);
+      fileinfo = thunarx_file_info_get_file_info (info);
 
-      retval = (geteuid () == vfsinfo->uid);
+      uid = g_file_info_get_attribute_uint32 (fileinfo, G_FILE_ATTRIBUTE_UNIX_UID);
 
-      thunar_vfs_info_unref (vfsinfo);
+      retval = (geteuid () == uid);
+
+      g_object_unref (fileinfo);
     }
   }
 
@@ -336,9 +344,7 @@ libshares_check_owner (ThunarxFileInfo *
 
 /* Asks to the user if we can change the permissions of the folder */
 static gboolean
-tsp_ask_perms (gboolean  need_r,
-               gboolean  need_w,
-               gboolean  need_x)
+tsp_ask_perms (void)
 {
   return libshares_ask_user (_("Thunar needs to add some permissions to your folder in order to share it. Do you agree?"));
 }
@@ -346,35 +352,33 @@ tsp_ask_perms (gboolean  need_r,
 /* Checks if the current file has the necesary permissions */
 static gboolean
 tsp_check_perms (const gchar *path,
-                 gboolean     is_writable)
+                 gboolean     is_writable,
+                 gboolean     guests_ok)
 {
   struct stat st;
-  gboolean    need_r;
-  gboolean    need_w;
-  gboolean    need_x;
   mode_t      new_mode;
   mode_t      mode;
+  mode_t      need_mask;
 
-  if (stat (path, &st) != 0)
+  if (g_stat (path, &st) != 0)
     return FALSE;
 
-  mode = st.st_mode;
-
-  new_mode = mode;
+  new_mode = mode = st.st_mode;
 
-  need_r = (mode & THUNAR_VFS_FILE_MODE_OTH_READ) == 0;
-  new_mode |= THUNAR_VFS_FILE_MODE_OTH_READ;
+  /* go+rx is necesary to guest enabled shares */
+  if (guests_ok)
+    new_mode |= (S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
 
-  need_w = is_writable && (mode & THUNAR_VFS_FILE_MODE_OTH_WRITE) == 0;
-  if (need_w)
-    new_mode |= THUNAR_VFS_FILE_MODE_OTH_WRITE;
+  /* go+w is necesary to writable shares */
+  if (is_writable)
+    new_mode |= (S_IWGRP | S_IWOTH);
 
-  need_x = (mode & THUNAR_VFS_FILE_MODE_OTH_EXEC) == 0;
-  new_mode |= THUNAR_VFS_FILE_MODE_OTH_EXEC;
+  /* Compare both modes */
+  need_mask = new_mode & ~mode;
 
-  if (need_r || need_w || need_x)
+  if (need_mask != 0)
   {
-    if (!tsp_ask_perms (need_r, need_w, need_x))
+    if (!tsp_ask_perms ())
       return FALSE;
 #ifdef G_ENABLE_DEBUG
     g_message ("Changing permissions of '%s'", path);
diff -urNp thunar-shares-plugin-0.2.0.orig/libshares/Makefile.am thunar-shares-plugin-0.2.0/libshares/Makefile.am
--- thunar-shares-plugin-0.2.0.orig/libshares/Makefile.am	2009-02-15 20:54:41.000000000 +0100
+++ thunar-shares-plugin-0.2.0/libshares/Makefile.am	2011-01-23 11:16:26.000000000 +0100
@@ -17,14 +17,12 @@ libshares_la_CFLAGS =					\
 	$(PLATFORM_CFLAGS)				\
 	$(GTK_CFLAGS)					\
 	$(GLIB_CFLAGS)					\
-	$(THUNARX_CFLAGS)				\
-	$(THUNARVFS_CFLAGS)
+	$(THUNARX_CFLAGS)
 
 libshares_la_LDFLAGS =					\
 	$(GTK_LIBS)					\
 	$(GLIB_LIBS)					\
 	$(THUNARX_LIBS)					\
-	$(THUNARVFS_LIBS)				\
 	$(PLATFORM_LDFLAGS)
 
 # vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
diff -urNp thunar-shares-plugin-0.2.0.orig/thunar-plugin/Makefile.am thunar-shares-plugin-0.2.0/thunar-plugin/Makefile.am
--- thunar-shares-plugin-0.2.0.orig/thunar-plugin/Makefile.am	2009-02-15 20:54:41.000000000 +0100
+++ thunar-shares-plugin-0.2.0/thunar-plugin/Makefile.am	2011-01-23 11:16:26.000000000 +0100
@@ -7,7 +7,7 @@ INCLUDES =							\
 	-DDATADIR=\"$(datadir)\"				\
 	$(PLATFORM_CPPFLAGS)
 
-extensionsdir = $(libdir)/thunarx-1
+extensionsdir = $(libdir)/thunarx-2
 extensions_LTLIBRARIES = thunar-shares-plugin.la
 
 thunar_shares_plugin_la_SOURCES =				\
@@ -19,8 +19,7 @@ thunar_shares_plugin_la_CFLAGS =				\
 	$(PLATFORM_CFLAGS)					\
 	$(GTK_CFLAGS)						\
 	$(GLIB_CFLAGS)						\
-	$(THUNARX_CFLAGS)					\
-	$(THUNARVFS_CFLAGS)
+	$(THUNARX_CFLAGS)
 
 thunar_shares_plugin_la_LDFLAGS =				\
 	-avoid-version						\
@@ -29,7 +28,6 @@ thunar_shares_plugin_la_LDFLAGS =				\
 	$(GTK_LIBS)						\
 	$(GLIB_LIBS)						\
 	$(THUNARX_LIBS)						\
-	$(THUNARVFS_LIBS)					\
 	$(PLATFORM_LDFLAGS)
 
 thunar_shares_plugin_la_LIBADD=					\