packages: xfce4-places-plugin/xfce4-places-plugin.spec, xfce4-places-plugin...

baggins baggins at pld-linux.org
Tue Feb 22 00:34:44 CET 2011


Author: baggins                      Date: Mon Feb 21 23:34:44 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- ported from thunar-vfs to gio/udev

---- Files affected:
packages/xfce4-places-plugin:
   xfce4-places-plugin.spec (1.13 -> 1.14) , xfce4-places-plugin-gio.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/xfce4-places-plugin/xfce4-places-plugin.spec
diff -u packages/xfce4-places-plugin/xfce4-places-plugin.spec:1.13 packages/xfce4-places-plugin/xfce4-places-plugin.spec:1.14
--- packages/xfce4-places-plugin/xfce4-places-plugin.spec:1.13	Sun Feb 20 10:50:43 2011
+++ packages/xfce4-places-plugin/xfce4-places-plugin.spec	Tue Feb 22 00:34:39 2011
@@ -3,24 +3,28 @@
 Summary(pl.UTF-8):	Wtyczka places dla panelu Xfce
 Name:		xfce4-places-plugin
 Version:	1.2.0
-Release:	5
+Release:	5.14
 License:	GPL v2
 Group:		X11/Applications
 Source0:	http://archive.xfce.org/src/panel-plugins/xfce4-places-plugin/1.2/%{name}-%{version}.tar.bz2
 # Source0-md5:	f2d8c13340b3d52c5a7f6e2b9cdc55e3
 Patch0:		port-to-exo-1.patch
 Patch1:		%{name}-ui.patch
+Patch2:		%{name}-gio.patch
 URL:		http://goodies.xfce.org/projects/panel-plugins/xfce4-places-plugin
-BuildRequires:	Thunar-devel >= 0.8.0
+BuildRequires:	Thunar-devel >= 1.2.0
 BuildRequires:	autoconf
 BuildRequires:	automake
 BuildRequires:	exo-devel >= 0.6.0
 BuildRequires:	gettext-devel
+BuildRequires:	glib2-devel >= 1:2.22.0
+BuildRequires:	gtk+2-devel >= 2:2.14.0
 BuildRequires:	intltool
+BuildRequires:	libnotify-devel >= 0.4.0
 BuildRequires:	libtool
 BuildRequires:	libxfce4ui-devel >= 4.8.0
+BuildRequires:	libxfce4util-devel >= 4.8.0
 BuildRequires:	pkgconfig
-BuildRequires:	thunar-vfs-devel
 BuildRequires:	xfce4-dev-tools >= 4.8.0
 BuildRequires:	xfce4-panel-devel >= 4.8.0
 Requires:	xfce4-panel >= 4.8.0
@@ -51,11 +55,13 @@
 %setup -q
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
 
 %build
 %{__libtoolize}
 %{__aclocal}
 %{__autoconf}
+%{__autoheader}
 %{__automake}
 %configure
 
@@ -87,6 +93,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.14  2011/02/21 23:34:39  baggins
+- ported from thunar-vfs to gio/udev
+
 Revision 1.13  2011/02/20 09:50:43  baggins
 - rel 5
 - port to libxfce4ui

================================================================
Index: packages/xfce4-places-plugin/xfce4-places-plugin-gio.patch
diff -u /dev/null packages/xfce4-places-plugin/xfce4-places-plugin-gio.patch:1.1
--- /dev/null	Tue Feb 22 00:34:44 2011
+++ packages/xfce4-places-plugin/xfce4-places-plugin-gio.patch	Tue Feb 22 00:34:39 2011
@@ -0,0 +1,1697 @@
+diff -urN xfce4-places-plugin-1.2.0/config.h.in xfce4-places-plugin-1.2.0-gio/config.h.in
+--- xfce4-places-plugin-1.2.0/config.h.in	2009-07-31 08:21:07.000000000 +0200
++++ xfce4-places-plugin-1.2.0-gio/config.h.in	2011-02-20 20:01:21.000000000 +0100
+@@ -24,14 +24,17 @@
+ /* Define if the GNU gettext() function is already present or preinstalled. */
+ #undef HAVE_GETTEXT
+ 
++/* Define if gio-unix-2.0 >= 2.18.0 present */
++#undef HAVE_GIO_UNIX
++
+ /* Define to 1 if you have the <inttypes.h> header file. */
+ #undef HAVE_INTTYPES_H
+ 
+ /* Define if your <locale.h> file defines LC_MESSAGES. */
+ #undef HAVE_LC_MESSAGES
+ 
+-/* Define if libxfce4panel-1.0 >= 4.5.92 present */
+-#undef HAVE_LIBXFCE4PANEL_46
++/* Define if libnotify >= 0.4.0 present */
++#undef HAVE_LIBNOTIFY
+ 
+ /* Define to 1 if you have the <locale.h> header file. */
+ #undef HAVE_LOCALE_H
+@@ -60,6 +63,13 @@
+ /* Define to 1 if you have the <unistd.h> header file. */
+ #undef HAVE_UNISTD_H
+ 
++/* Define to the sub-directory in which libtool stores uninstalled libraries.
++   */
++#undef LT_OBJDIR
++
++/* Define to 1 if your C compiler doesn't accept -c and -o together. */
++#undef NO_MINUS_C_MINUS_O
++
+ /* Name of package */
+ #undef PACKAGE
+ 
+@@ -75,6 +85,9 @@
+ /* Define to the one symbol short name of this package. */
+ #undef PACKAGE_TARNAME
+ 
++/* Define to the home page for this package. */
++#undef PACKAGE_URL
++
+ /* Define to the version of this package. */
+ #undef PACKAGE_VERSION
+ 
+diff -urN xfce4-places-plugin-1.2.0/configure.in xfce4-places-plugin-1.2.0-gio/configure.in
+--- xfce4-places-plugin-1.2.0/configure.in	2011-02-22 00:24:48.666428766 +0100
++++ xfce4-places-plugin-1.2.0-gio/configure.in	2011-02-22 00:24:29.168428767 +0100
+@@ -15,20 +15,29 @@
+ 
+ dnl check for basic programs
+ AC_PROG_CC()
++AM_PROG_CC_C_O
+ AC_PROG_INSTALL()
+ AC_PROG_LIBTOOL()
+ AC_PROG_INTLTOOL()
+ 
+ dnl check for required packages
+-XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.6.0])
+-XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.3.90.2])
++XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.22.0])
++XDT_CHECK_PACKAGE([GIO], [gio-2.0], [2.22.0])
++XDT_CHECK_PACKAGE([GMODULE], [gmodule-2.0], [2.22.0])
++XDT_CHECK_PACKAGE([GOBJECT], [gobject-2.0], [2.22.0])
++XDT_CHECK_PACKAGE([GTHREAD], [gthread-2.0], [2.22.0])
++XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.14.0])
++XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.8.0])
+ XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-1], [4.8.0])
+ XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-1.0], [4.8.0])
+-XDT_CHECK_PACKAGE([THUNAR_VFS], [thunar-vfs-1], [0.3.2])
+ XDT_CHECK_PACKAGE([EXO], [exo-1], [0.5.0])
+ 
+-dnl check for optional packages/versions
+-XDT_CHECK_OPTIONAL_PACKAGE([LIBXFCE4PANEL_46], [libxfce4panel-1.0], [4.5.92], [libxfce4panel46], [Take advantage of Xfce 4.6 panel changes])
++XDT_CHECK_OPTIONAL_PACKAGE([GIO_UNIX], [gio-unix-2.0], [2.22.0], [gio-unix],
++    [gio-unix, for special treatment of mount points on UNIX])
++
++dnl *** Optional support for libnotify ***
++XDT_CHECK_OPTIONAL_PACKAGE([LIBNOTIFY], [libnotify], [0.4.0], [notifications],
++                           [Mount notification support], [yes])
+ 
+ dnl check for i18n support
+ XDT_I18N([ar be ca cs da de dz el en_GB eo es et eu fi fr gl he hu id it ja ka ko lt lv mk nb nl pa pl pt_BR pt ro ru sq sv tr uk ur ur_PK zh_CN zh_TW])
+diff -urN xfce4-places-plugin-1.2.0/panel-plugin/Makefile.am xfce4-places-plugin-1.2.0-gio/panel-plugin/Makefile.am
+--- xfce4-places-plugin-1.2.0/panel-plugin/Makefile.am	2011-02-22 00:24:48.668428766 +0100
++++ xfce4-places-plugin-1.2.0-gio/panel-plugin/Makefile.am	2011-02-22 00:08:59.944428766 +0100
+@@ -6,11 +6,13 @@
+ 
+ xfce4_popup_places_CFLAGS =						\
+ 	$(LIBX11_CFLAGS)						\
++	$(EXO_CFLAGS)							\
+ 	$(GTK_CFLAGS)
+ 
+ xfce4_popup_places_LDADD =						\
+ 	$(LIBX11_LDFLAGS)						\
+ 	$(LIBX11_LIBS)							\
++	$(EXO_LIBS)							\
+ 	$(GTK_LIBS)
+ 
+ 
+@@ -20,7 +22,14 @@
+ plugin_PROGRAMS =							\
+ 	xfce4-places-plugin
+ 
++if HAVE_LIBNOTIFY
++xfce4_places_plugin_notify_sources =					\
++	model_volumes_notify.c						\
++	model_volumes_notify.h
++endif
++
+ xfce4_places_plugin_SOURCES =						\
++	$(xfce4_places_plugin_notify_sources)				\
+ 	places.c							\
+ 	places.h							\
+ 	support.c							\
+@@ -38,28 +47,39 @@
+ 	model_volumes.c							\
+ 	model_volumes.h							\
+ 	button.c							\
+-	button.h							\
+-	xfce46-compat.c							\
+-	xfce46-compat.h
+-
++	button.h
+ 
+ 
+ xfce4_places_plugin_CFLAGS =						\
+ 	-I$(top_builddir)						\
+ 	-I$(top_srcdir)							\
+ 	-DPACKAGE_LOCALE_DIR=\"$(localedir)\"				\
+-	$(GTK_CFLAGS)							\
++	$(GIO_CFLAGS)							\
++	$(GIO_UNIX_CFLAGS)						\
++	$(GLIB_CFLAGS)							\
++	$(GTHREAD_CFLAGS)						\
++	$(GTK_CFLAGS)							\
++	$(LIBNOTIFY_CFLAGS)						\
++	$(LIBX11_CFLAGS)						\
+ 	$(LIBXFCE4UTIL_CFLAGS)						\
+ 	$(LIBXFCE4UI_CFLAGS)						\
+ 	$(LIBXFCE4PANEL_CFLAGS)						\
+-        $(THUNAR_VFS_CFLAGS)						\
++	$(EXO_CFLAGS)							\
+ 	$(PLATFORM_CFLAGS)
+ 
+ xfce4_places_plugin_LDADD =						\
++	$(GIO_LIBS)							\
++	$(GIO_UNIX_LIBS)						\
++	$(GLIB_LIBS)							\
++	$(GTHREAD_LIBS)							\
++	$(GTK_LIBS)							\
++	$(LIBNOTIFY_LIBS)						\
++	$(LIBX11_LDFLAGS)						\
++	$(LIBX11_LIBS)							\
+ 	$(LIBXFCE4UTIL_LIBS)						\
+ 	$(LIBXFCE4UI_LIBS)						\
+ 	$(LIBXFCE4PANEL_LIBS)						\
+-	@THUNAR_VFS_LIBS@
++	$(EXO_LIBS)
+ 
+ 
+ #
+diff -urN xfce4-places-plugin-1.2.0/panel-plugin/model.h xfce4-places-plugin-1.2.0-gio/panel-plugin/model.h
+--- xfce4-places-plugin-1.2.0/panel-plugin/model.h	2008-01-09 02:20:42.000000000 +0100
++++ xfce4-places-plugin-1.2.0-gio/panel-plugin/model.h	2011-02-21 13:56:54.727869084 +0100
+@@ -23,6 +23,7 @@
+ #define _XFCE_PANEL_PLACES_MODEL_H
+ 
+ #include <glib.h>
++#include <gio/gio.h>
+ 
+ /* Places Bookmark Action */
+ typedef struct _PlacesBookmarkAction PlacesBookmarkAction;
+@@ -59,7 +60,7 @@
+     gchar                 *label;          /* must not be NULL */
+     gchar                 *uri;            /* may be NULL */
+     places_uri_scheme      uri_scheme;    
+-    gchar                 *icon;           /* may be NULL */
++    GIcon                 *icon;           /* may be NULL */
+     PlacesBookmarkAction  *primary_action; /* may be NULL */
+     gboolean               force_gray;
+     GList                 *actions;        /* may be NULL (empty) */
+diff -urN xfce4-places-plugin-1.2.0/panel-plugin/model_system.c xfce4-places-plugin-1.2.0-gio/panel-plugin/model_system.c
+--- xfce4-places-plugin-1.2.0/panel-plugin/model_system.c	2009-05-24 07:23:15.000000000 +0200
++++ xfce4-places-plugin-1.2.0-gio/panel-plugin/model_system.c	2011-02-21 13:37:10.860869083 +0100
+@@ -30,13 +30,11 @@
+ #include <string.h>
+ 
+ #include <glib.h>
++#include <gio/gio.h>
+ 
+ #include <libxfce4util/libxfce4util.h>
+ 
+-#define EXO_API_SUBJECT_TO_CHANGE
+-#include <thunar-vfs/thunar-vfs.h>
+-
+-#define TRASH          THUNAR_VFS_CHECK_VERSION(0,4,0)
++#define TRASH          1
+ #define XDG_USER_DIRS  GLIB_CHECK_VERSION(2,14,0)
+ 
+ #define pbg_priv(pbg) ((PBSysData*) pbg->priv)
+@@ -49,7 +47,7 @@
+     gchar         *desktop_dir;     /* NULL => no desktop or desktop is same as home */
+ #if TRASH
+     gboolean       trash_is_empty;
+-    ThunarVfsPath *trash_path;
++    GFile *trash_path;
+ #endif
+ 
+ } PBSysData;
+@@ -72,7 +70,7 @@
+     g_assert(bookmark != NULL);
+ 
+     if(bookmark->icon != NULL){
+-        g_free(bookmark->icon);
++        g_object_unref(bookmark->icon);
+         bookmark->icon = NULL;
+     }
+ }
+@@ -80,15 +78,14 @@
+ 
+ #if TRASH
+ static gboolean
+-pbsys_trash_is_empty(const ThunarVfsInfo *trash_info)
++pbsys_trash_is_empty(GFileInfo *trash_info)
+ {
+-    if (trash_info->custom_icon == NULL)
+-        return FALSE;
+-    if (strcmp("user-trash-full", trash_info->custom_icon) == 0)
+-        return FALSE;
+-    if (strcmp("gnome-fs-trash-full", trash_info->custom_icon) == 0)
++    guint item_count = g_file_info_get_attribute_uint32(trash_info,
++                                                        G_FILE_ATTRIBUTE_TRASH_ITEM_COUNT);
++    if(item_count == 0)
++        return TRUE;
++    else
+         return FALSE;
+-    return TRUE;
+ }
+ #endif
+ 
+@@ -130,7 +127,7 @@
+     PlacesBookmark *bookmark;
+     PlacesBookmarkAction *open, *terminal;
+ #if TRASH
+-    ThunarVfsInfo *trash_info;
++    GFileInfo *trash_info;
+ #endif
+     const gchar *home_dir = xfce_get_homedir();
+     gchar *desktop_dir;
+@@ -142,7 +139,7 @@
+     /* Home */
+     bookmark                = places_bookmark_create((gchar*) g_get_user_name());
+     bookmark->uri           = (gchar*) home_dir;
+-    bookmark->icon          = "user-home";
++    bookmark->icon          = g_themed_icon_new("user-home");
+ 
+     terminal                 = places_create_open_terminal_action(bookmark);
+     bookmark->actions        = g_list_prepend(bookmark->actions, terminal);
+@@ -159,15 +156,20 @@
+     bookmark->uri_scheme    = PLACES_URI_SCHEME_TRASH;
+     bookmark->finalize      = pbsys_finalize_trash_bookmark;;
+ 
+-    /* Try for an icon from ThunarVFS to indicate whether trash is empty or not */
++    /* Try for an icon to indicate whether trash is empty or not */
+     
+-    trash_info = thunar_vfs_info_new_for_path(pbg_priv(bookmark_group)->trash_path, NULL);
++    trash_info = g_file_query_info(pbg_priv(bookmark_group)->trash_path,
++                    "trash::*",
++                    G_FILE_QUERY_INFO_NONE,
++                    NULL, NULL);
+     pbg_priv(bookmark_group)->trash_is_empty = pbsys_trash_is_empty(trash_info);
+-    if(trash_info->custom_icon != NULL)
+-        bookmark->icon = g_strdup(trash_info->custom_icon);
++    if (bookmark->icon != NULL)
++        g_object_unref(bookmark->icon);
++    if (pbg_priv(bookmark_group)->trash_is_empty)
++        bookmark->icon = g_themed_icon_new("user-trash");
+     else
+-        bookmark->icon = g_strdup("user-trash-full");
+-    thunar_vfs_info_unref(trash_info);
++        bookmark->icon = g_themed_icon_new("user-trash-full");
++    g_object_unref(trash_info);
+ 
+     open                     = places_create_open_action(bookmark);
+     bookmark->actions        = g_list_prepend(bookmark->actions, open);
+@@ -185,7 +187,7 @@
+     if(desktop_dir != NULL){
+         bookmark                = places_bookmark_create(_("Desktop"));
+         bookmark->uri           = desktop_dir;
+-        bookmark->icon          = "user-desktop";
++        bookmark->icon          = g_themed_icon_new("user-desktop");
+         bookmark->finalize      = pbsys_finalize_desktop_bookmark;
+ 
+ 
+@@ -201,7 +203,7 @@
+     /* File System (/) */
+     bookmark                = places_bookmark_create(_("File System"));
+     bookmark->uri           = "/";
+-    bookmark->icon          = "gtk-harddisk";
++    bookmark->icon          = g_themed_icon_new("gtk-harddisk");
+ 
+     terminal                 = places_create_open_terminal_action(bookmark);
+     bookmark->actions        = g_list_prepend(bookmark->actions, terminal);
+@@ -220,7 +222,7 @@
+     gchar *desktop_dir;
+ #if TRASH
+     gboolean trash_is_empty;
+-    ThunarVfsInfo *trash_info;
++    GFileInfo *trash_info;
+ #endif
+ 
+     if(!pbg_priv(bookmark_group)->check_changed)
+@@ -236,9 +238,12 @@
+ 
+ #if TRASH
+     /* see if trash gets a different icon (e.g., was empty, now full) */
+-    trash_info = thunar_vfs_info_new_for_path(pbg_priv(bookmark_group)->trash_path, NULL);
++    trash_info = g_file_query_info(pbg_priv(bookmark_group)->trash_path,
++                    "trash::*",
++                    G_FILE_QUERY_INFO_NONE,
++                    NULL, NULL);
+     trash_is_empty = pbsys_trash_is_empty(trash_info);
+-    thunar_vfs_info_unref(trash_info);
++    g_object_unref(trash_info);
+     
+     if(trash_is_empty != pbg_priv(bookmark_group)->trash_is_empty)
+         return TRUE;
+@@ -251,8 +256,7 @@
+ pbsys_finalize(PlacesBookmarkGroup *bookmark_group)
+ {
+ #if TRASH
+-    thunar_vfs_path_unref(pbg_priv(bookmark_group)->trash_path);
+-    thunar_vfs_shutdown();
++    g_object_unref(pbg_priv(bookmark_group)->trash_path);
+ #endif
+ 
+     g_free(pbg_priv(bookmark_group)->desktop_dir);
+@@ -273,8 +277,7 @@
+     bookmark_group->priv          = g_new0(PBSysData, 1);
+     
+ #if TRASH
+-    thunar_vfs_init();
+-    pbg_priv(bookmark_group)->trash_path = thunar_vfs_path_get_for_trash();
++    pbg_priv(bookmark_group)->trash_path = g_file_new_for_uri("trash:///");
+ #endif
+ 
+     return bookmark_group;
+diff -urN xfce4-places-plugin-1.2.0/panel-plugin/model_user.c xfce4-places-plugin-1.2.0-gio/panel-plugin/model_user.c
+--- xfce4-places-plugin-1.2.0/panel-plugin/model_user.c	2009-05-24 07:23:15.000000000 +0200
++++ xfce4-places-plugin-1.2.0-gio/panel-plugin/model_user.c	2011-02-21 13:38:12.549869084 +0100
+@@ -168,7 +168,7 @@
+         /* create the BookmarkInfo container */
+         bookmark        = places_bookmark_create(name);           /* label needs to be freed */
+         bookmark->uri   = path;                                   /* uri   needs to be freed */
+-        bookmark->icon  = "folder";
++        bookmark->icon  = g_themed_icon_new("folder");
+         bookmark->priv  = GINT_TO_POINTER(pbuser_dir_exists(path));
+         bookmark->finalize = pbuser_finalize_bookmark;
+ 
+@@ -213,7 +213,7 @@
+             clone                 = places_bookmark_create(g_strdup(orig->label));
+             clone->uri            = g_strdup(orig->uri);
+             clone->uri_scheme     = orig->uri_scheme;
+-            clone->icon           = orig->icon;
++            clone->icon           = g_object_ref(orig->icon);
+             clone->finalize       = pbuser_finalize_bookmark;
+     
+             terminal              = places_create_open_terminal_action(clone);
+diff -urN xfce4-places-plugin-1.2.0/panel-plugin/model_volumes.c xfce4-places-plugin-1.2.0-gio/panel-plugin/model_volumes.c
+--- xfce4-places-plugin-1.2.0/panel-plugin/model_volumes.c	2009-07-31 07:31:42.000000000 +0200
++++ xfce4-places-plugin-1.2.0-gio/panel-plugin/model_volumes.c	2011-02-22 00:17:53.185428766 +0100
+@@ -27,8 +27,15 @@
+ #include "model_volumes.h"
+ #include "support.h"
+ 
+-#define EXO_API_SUBJECT_TO_CHANGE
+-#include <thunar-vfs/thunar-vfs.h>
++#include <gio/gio.h>
++#ifdef HAVE_GIO_UNIX
++#include <gio/gunixmounts.h>
++#endif
++#include <gtk/gtk.h>
++ 
++#ifdef HAVE_LIBNOTIFY
++#include "model_volumes_notify.h"
++#endif
+ 
+ #include <libxfce4util/libxfce4util.h>
+ 
+@@ -38,76 +45,156 @@
+ 
+ typedef struct
+ {
+-
+-    ThunarVfsVolumeManager *volume_manager;
++    GVolumeMonitor *volume_monitor;
+     gboolean   changed;
+     gboolean   mount_and_open_by_default;
+-
+ } PBVolData;
+ 
+ 
+ /********** Actions Callbacks **********/
++static void
++pbvol_eject_finish(GObject *object,
++                GAsyncResult *result,
++                gpointer user_data)
++{
++    GVolume *volume = G_VOLUME(object);
++    GError *error = NULL;
++
++    g_return_if_fail(G_IS_VOLUME(object));
++    g_return_if_fail(G_IS_ASYNC_RESULT(result));
++
++    if (!g_volume_eject_with_operation_finish(volume, result, &error)) {
++         /* ignore GIO errors handled internally */
++         if(error->domain != G_IO_ERROR || error->code != G_IO_ERROR_FAILED_HANDLED) {
++             gchar *volume_name = g_volume_get_name(volume);
++             places_show_error_dialog(error,
++                                 _("Failed to eject \"%s\""),
++                                 volume_name);
++             g_free(volume_name);
++         }
++         g_error_free(error);
++    }
++
++#ifdef HAVE_LIBNOTIFY
++    pbvol_notify_eject_finish(volume);
++#endif
++}
+ 
+ static void
+ pbvol_eject(PlacesBookmarkAction *action)
+ {
+-    GError *error = NULL;
+-    ThunarVfsVolume *volume;
++    GVolume *volume;
+ 
+     DBG("Eject");
+ 
+-    g_return_if_fail(THUNAR_VFS_IS_VOLUME(action->priv));
+-    volume = THUNAR_VFS_VOLUME(action->priv);
++    g_return_if_fail(G_IS_VOLUME(action->priv));
++    volume = G_VOLUME(action->priv);
+ 
+-    if(!thunar_vfs_volume_eject(volume, NULL, &error)){
+-        places_show_error_dialog(error,
+-                                 _("Failed to eject \"%s\""),
+-                                 thunar_vfs_volume_get_name (volume));
+-        g_error_free (error);
++    if (g_volume_can_eject(volume)) {
++#ifdef HAVE_LIBNOTIFY
++        pbvol_notify_eject(volume);
++#endif
++        g_volume_eject_with_operation(volume, G_MOUNT_UNMOUNT_NONE, NULL,
++                           NULL,
++                           pbvol_eject_finish,
++                           g_object_ref(volume));
+     }
+ }
+ 
+ static void
+-pbvol_unmount(PlacesBookmarkAction *action)
++pbvol_unmount_finish(GObject *object,
++                GAsyncResult *result,
++                gpointer user_data)
+ {
++    GMount *mount = G_MOUNT(object);
+     GError *error = NULL;
+-    ThunarVfsVolume *volume;
++
++    g_return_if_fail(G_IS_MOUNT(object));
++    g_return_if_fail(G_IS_ASYNC_RESULT(result));
++
++    if (!g_mount_unmount_with_operation_finish(mount, result, &error)) {
++         /* ignore GIO errors handled internally */
++         if (error->domain != G_IO_ERROR || error->code != G_IO_ERROR_FAILED_HANDLED) {
++             gchar *mount_name = g_mount_get_name(mount);
++             places_show_error_dialog(error,
++                                     _("Failed to unmount \"%s\""),
++                                     mount_name);
++             g_free(mount_name);
++         }
++         g_error_free (error);
++    }
++
++#ifdef HAVE_LIBNOTIFY
++    pbvol_notify_unmount_finish(mount);
++#endif
++}
++
++static void
++pbvol_unmount(PlacesBookmarkAction *action)
++{
++    GVolume *volume;
++    GMount *mount;
+ 
+     DBG("Unmount");
+ 
+-    g_return_if_fail(THUNAR_VFS_IS_VOLUME(action->priv));
+-    volume = THUNAR_VFS_VOLUME(action->priv);
++    g_return_if_fail(G_IS_VOLUME(action->priv));
++    volume = G_VOLUME(action->priv);
++    mount = g_volume_get_mount(volume);
++
++    if (mount) {
++#ifdef HAVE_LIBNOTIFY
++        pbvol_notify_unmount(mount);
++#endif
++        g_mount_unmount_with_operation(mount, G_MOUNT_UNMOUNT_NONE, NULL,
++                            NULL,
++                            pbvol_unmount_finish, 
++                            g_object_ref(volume));
++    }
++}
+ 
+-    if(thunar_vfs_volume_is_mounted(volume)){
+-        if(!thunar_vfs_volume_unmount(volume, NULL, &error)){
++static void
++pbvol_mount_finish(GObject *object,
++                GAsyncResult *result,
++                gpointer user_data)
++{
++    GVolume *volume = G_VOLUME(object);
++    GError *error = NULL;
+ 
+-            places_show_error_dialog(error,
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/xfce4-places-plugin/xfce4-places-plugin.spec?r1=1.13&r2=1.14&f=u



More information about the pld-cvs-commit mailing list