[Xfce4-commits] <exo:nick/remove-exo-mount-point> Use the GIO code for reading mount points in exo-mount.

Nick Schermer noreply at xfce.org
Fri Oct 23 14:00:02 CEST 2009


Updating branch refs/heads/nick/remove-exo-mount-point
         to 9e9a788ed6f54a9cc9a5b06c7fc646597ea99a2c (commit)
       from e30594c963df9e87bb8ce5c4675c4037da81fbe2 (commit)

commit 9e9a788ed6f54a9cc9a5b06c7fc646597ea99a2c
Author: Nick Schermer <nick at xfce.org>
Date:   Fri Oct 23 13:56:20 2009 +0200

    Use the GIO code for reading mount points in exo-mount.

 configure.in.in             |    2 +
 exo-mount/Makefile.am       |   15 ++-
 exo-mount/exo-mount-fstab.c |  282 -------------------------------------------
 exo-mount/exo-mount-fstab.h |   40 ------
 exo-mount/exo-mount-utils.c |   59 ---------
 exo-mount/exo-mount-utils.h |   32 -----
 exo-mount/main.c            |  164 +++++++++++++++++++++++--
 7 files changed, 163 insertions(+), 431 deletions(-)

diff --git a/configure.in.in b/configure.in.in
index b405820..43bee55 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -100,8 +100,10 @@ dnl *** Loopup hardcoded paths we use internally ***
 dnl ************************************************
 AC_PATH_PROG([PATH_MOUNT], [mount], [/bin/mount])
 AC_PATH_PROG([PATH_UMOUNT], [umount], [/bin/umount])
+AC_PATH_PROG([PATH_EJECT], [eject], [/usr/bin/eject])
 AC_SUBST([PATH_MOUNT])
 AC_SUBST([PATH_UMOUNT])
+AC_SUBST([PATH_EJECT])
 
 dnl ***************************************
 dnl *** Check for required Perl modules ***
diff --git a/exo-mount/Makefile.am b/exo-mount/Makefile.am
index f035efe..73e09b9 100644
--- a/exo-mount/Makefile.am
+++ b/exo-mount/Makefile.am
@@ -8,7 +8,8 @@ INCLUDES = 								\
 	-DLIBEXO_VERSION_API=\"$(LIBEXO_VERSION_API)\"			\
 	-DPACKAGE_LOCALE_DIR=\"$(localedir)\"				\
 	-DPATH_MOUNT=\"$(PATH_MOUNT)\"					\
-	-DPATH_UMOUNT=\"$(PATH_UMOUNT)\"
+	-DPATH_UMOUNT=\"$(PATH_UMOUNT)\"				\
+	-DPATH_EJECT=\"$(PATH_EJECT)\"
 
 defaultsdir = $(sysconfdir)/xdg/xfce4
 defaults_DATA = mount.rc
@@ -17,10 +18,6 @@ bin_PROGRAMS =								\
 	exo-mount
 
 exo_mount_SOURCES =							\
-	exo-mount-fstab.c						\
-	exo-mount-fstab.h						\
-	exo-mount-utils.c						\
-	exo-mount-utils.h						\
 	main.c
 
 if HAVE_HAL
@@ -32,7 +29,9 @@ endif
 exo_mount_CFLAGS =							\
 	$(GTK_CFLAGS)							\
 	$(HAL_CFLAGS)							\
-	$(LIBXFCE4UTIL_CFLAGS)
+	$(LIBXFCE4UTIL_CFLAGS)						\
+	$(GIO_CFLAGS)							\
+	$(GIO_UNIX_CFLAGS)
 
 exo_mount_LDFLAGS =							\
 	-no-undefined
@@ -45,7 +44,9 @@ exo_mount_LDADD =							\
 	$(GTK_LIBS)							\
 	$(HAL_LIBS)							\
 	$(LIBXFCE4UTIL_LIBS)						\
-	$(top_builddir)/exo/libexo-$(LIBEXO_VERSION_API).la \
+	$(GIO_LIBS)							\
+	$(GIO_UNIX_LIBS)						\
+	$(top_builddir)/exo/libexo-$(LIBEXO_VERSION_API).la		\
 	$(top_builddir)/exo-hal/libexo-hal-$(LIBEXO_VERSION_API).la
 
 # install apppropriate symlinks
diff --git a/exo-mount/exo-mount-fstab.c b/exo-mount/exo-mount-fstab.c
deleted file mode 100644
index 1164d81..0000000
--- a/exo-mount/exo-mount-fstab.c
+++ /dev/null
@@ -1,282 +0,0 @@
-/* $Id$ */
-/*-
- * Copyright (c) 2006-2007 Benedikt Meurer <benny 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 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef HAVE_MEMORY_H
-#include <memory.h>
-#endif
-#ifdef HAVE_PATHS_H
-#include <paths.h>
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
-#include <exo-mount/exo-mount-fstab.h>
-#include <exo-mount/exo-mount-utils.h>
-
-
-
-static gboolean exo_mount_fstab_exec   (const gchar *command,
-                                        const gchar *argument,
-                                        GError     **error);
-static gchar   *exo_mount_fstab_lookup (const gchar *device_file,
-                                        GError     **error) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
-
-
-
-static gboolean
-exo_mount_fstab_exec (const gchar *command,
-                      const gchar *argument,
-                      GError     **error)
-{
-  gboolean result;
-  gchar   *standard_error;
-  gchar   *command_line;
-  gchar   *quoted;
-  gint     status;
-
-  g_return_val_if_fail (command != NULL, FALSE);
-  g_return_val_if_fail (argument != NULL, FALSE);
-  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
-  /* generate the command line */
-  quoted = g_shell_quote (argument);
-  command_line = g_strconcat (command, " ", quoted, NULL);
-  g_free (quoted);
-
-  /* try to execute the command line */
-  result = g_spawn_command_line_sync (command_line, NULL, &standard_error, &status, error);
-  if (G_LIKELY (result))
-    {
-      /* check if the command failed */
-      if (G_UNLIKELY (status != 0))
-        {
-          /* drop additional whitespace from the stderr output */
-          g_strstrip (standard_error);
-
-          /* strip all trailing dots from the stderr output */
-          while (*standard_error != '\0' && standard_error[strlen (standard_error) - 1] == '.')
-            standard_error[strlen (standard_error) - 1] = '\0';
-
-          /* generate an error from the stderr output */
-          if (G_LIKELY (*standard_error != '\0'))
-            g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, "%s", standard_error);
-          else
-            g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("Unknown error"));
-
-          /* and yes, we failed */
-          result = FALSE;
-        }
-
-      /* release the stderr output */
-      g_free (standard_error);
-    }
-
-  /* cleanup */
-  g_free (command_line);
-
-  return result;
-}
-
-
-
-static gchar*
-exo_mount_fstab_lookup (const gchar *device_file,
-                        GError     **error)
-{
-  GError *err = NULL;
-  GSList *mount_points;
-  gchar  *path = NULL;
-
-  /* lookup the configured device in the file system table using the ExoMountPoint module */
-  mount_points = exo_mount_point_list_matched (EXO_MOUNT_POINT_MATCH_CONFIGURED | EXO_MOUNT_POINT_MATCH_DEVICE, device_file, NULL, NULL, &err);
-  if (G_LIKELY (mount_points != NULL))
-    {
-      /* take a copy of the folder path of the first matching mount point */
-      path = g_strdup (((const ExoMountPoint *) mount_points->data)->folder);
-
-      /* cleanup the mount points */
-      g_slist_foreach (mount_points, (GFunc) exo_mount_point_free, NULL);
-      g_slist_free (mount_points);
-    }
-  else if (err == NULL)
-    {
-      /* TRANSLATORS: a device is missing from the file system table (usually /etc/fstab) */
-      g_set_error (&err, G_FILE_ERROR, G_FILE_ERROR_INVAL, _("Device \"%s\" not found in file system device table"), device_file);
-    }
-
-  /* check if we failed */
-  if (G_UNLIKELY (err != NULL))
-    {
-      /* propagate the error */
-      g_propagate_error (error, err);
-      return NULL;
-    }
-
-  return path;
-}
-
-
-
-/**
- * exo_mount_fstab_contains:
- * @device_file : the absolute path to a block device file.
- *
- * Checks whether an entry for the @device_file exists in the
- * file system table file <tt>/etc/fstab</tt>. Returns %TRUE if
- * such an entry exists, %FALSE otherwise.
- *
- * Return value: %TRUE if an entry for @device_file is present
- *               in <tt>/dev/fstab</tt>, %FALSE otherwise.
- **/
-gboolean
-exo_mount_fstab_contains (const gchar *device_file)
-{
-  gchar *mount_point;
-
-  g_return_val_if_fail (g_path_is_absolute (device_file), FALSE);
-
-  /* check if we have an fstab entry */
-  mount_point = exo_mount_fstab_lookup (device_file, NULL);
-  if (G_LIKELY (mount_point != NULL))
-    {
-      /* jap, match found */
-      g_free (mount_point);
-      return TRUE;
-    }
-
-  /* no match */
-  return FALSE;
-}
-
-
-
-/**
- * exo_mount_fstab_eject:
- * @device_file : the absolute path to a block device file.
- * @error       : return location for errors or %NULL.
- *
- * Ejects the device identified by the @device_file. Returns
- * %TRUE if the device was successfully ejected, %FALSE otherwise.
- *
- * Return value: %TRUE on success, %FALSE if @error is set.
- **/
-gboolean
-exo_mount_fstab_eject (const gchar *device_file,
-                       GError     **error)
-{
-  gboolean result;
-  gchar   *mount_point;
-  gchar   *device_name;
-
-  g_return_val_if_fail (g_path_is_absolute (device_file), FALSE);
-  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
-  /* verify that the device is listed in the fstab */
-  mount_point = exo_mount_fstab_lookup (device_file, error);
-  if (G_UNLIKELY (mount_point == NULL))
-    return FALSE;
-  g_free (mount_point);
-
-  /* try to eject the device */
-  device_name = g_path_get_basename (device_file);
-  result = exo_mount_fstab_exec ("eject", device_name, error);
-  g_free (device_name);
-
-  return result;
-}
-
-
-
-/**
- * exo_mount_fstab_mount:
- * @device_file : the absolute path to a block device file.
- * @error       : return location for errors or %NULL.
- *
- * Mounts the device identified by the @device_file. Returns %TRUE
- * if the device was successfully mounted, %FALSE in case or an
- * error.
- *
- * Return value: %TRUE if successfull, %FALSE otherwise.
- **/
-gboolean
-exo_mount_fstab_mount (const gchar *device_file,
-                       GError     **error)
-{
-  gboolean result;
-  gchar   *mount_point;
-
-  g_return_val_if_fail (g_path_is_absolute (device_file), FALSE);
-  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
-  /* determine the mount point of the device from the fstab */
-  mount_point = exo_mount_fstab_lookup (device_file, error);
-  if (G_UNLIKELY (mount_point == NULL))
-    return FALSE;
-
-  /* try to mount the device */
-  result = exo_mount_fstab_exec (PATH_MOUNT, mount_point, error);
-
-  /* cleanup */
-  g_free (mount_point);
-
-  return result;
-}
-
-
-
-
-/**
- * exo_mount_fstab_unmount:
- * @device_file : the absolute path to a block device file.
- * @error       : return location for errors or %NULL.
- *
- * Unmounts the device identified by the @device_file. Returns
- * %TRUE if the device was successfully unmounted, %FALSE in
- * case of an error.
- *
- * Return value: %TRUE if successfull, %FALSE otherwise.
- **/
-gboolean
-exo_mount_fstab_unmount (const gchar *device_file,
-                         GError     **error)
-{
-  gboolean result;
-  gchar   *mount_point;
-
-  g_return_val_if_fail (g_path_is_absolute (device_file), FALSE);
-  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
-  /* determine the mount point of the device from the fstab */
-  mount_point = exo_mount_fstab_lookup (device_file, error);
-  if (G_UNLIKELY (mount_point == NULL))
-    return FALSE;
-
-  /* try to mount the device */
-  result = exo_mount_fstab_exec (PATH_UMOUNT, mount_point, error);
-
-  /* cleanup */
-  g_free (mount_point);
-
-  return result;
-}
diff --git a/exo-mount/exo-mount-fstab.h b/exo-mount/exo-mount-fstab.h
deleted file mode 100644
index 781df53..0000000
--- a/exo-mount/exo-mount-fstab.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* $Id$ */
-/*-
- * Copyright (c) 2006-2007 Benedikt Meurer <benny 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 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 __EXO_MOUNT_FSTAB_H__
-#define __EXO_MOUNT_FSTAB_H__
-
-#include <exo/exo.h>
-
-G_BEGIN_DECLS
-
-gboolean exo_mount_fstab_contains (const gchar *device_file);
-
-gboolean exo_mount_fstab_eject    (const gchar *device_file,
-                                   GError     **error);
-
-gboolean exo_mount_fstab_mount    (const gchar *device_file,
-                                   GError     **error);
-
-gboolean exo_mount_fstab_unmount  (const gchar *device_file,
-                                   GError     **error);
-
-G_END_DECLS
-
-#endif /* !__EXO_MOUNT_FSTAB_H__ */
diff --git a/exo-mount/exo-mount-utils.c b/exo-mount/exo-mount-utils.c
deleted file mode 100644
index 4ace355..0000000
--- a/exo-mount/exo-mount-utils.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* $Id$ */
-/*-
- * Copyright (c) 2006-2007 Benedikt Meurer <benny 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 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <exo-mount/exo-mount-utils.h>
-
-
-
-/**
- * exo_mount_utils_is_mounted:
- * @device_file     : an absolute path to a device file.
- * @readonly_return : if non-%NULL and the device is mounted, this
- *                    specifies whether the device was mounted ro.
- *
- * Returns %TRUE if the @device_file is already mounted
- * somewhere in the system, %FALSE otherwise.
- *
- * Return value: %TRUE if @device_file is mounted, else %FALSE.
- **/
-gboolean
-exo_mount_utils_is_mounted (const gchar *device_file,
-                            gboolean    *readonly_return)
-{
-  GSList *mount_points;
-
-  /* check if we have an active mount point for the device file */
-  mount_points = exo_mount_point_list_matched (EXO_MOUNT_POINT_MATCH_ACTIVE | EXO_MOUNT_POINT_MATCH_DEVICE, device_file, NULL, NULL, NULL);
-  if (G_LIKELY (mount_points != NULL))
-    {
-      /* check if the first matching device is mounted read-only */
-      if (G_LIKELY (readonly_return != NULL))
-        *readonly_return = ((((const ExoMountPoint *) mount_points->data)->flags & EXO_MOUNT_POINT_READ_ONLY) != 0);
-      g_slist_foreach (mount_points, (GFunc) exo_mount_point_free, NULL);
-      g_slist_free (mount_points);
-      return TRUE;
-    }
-
-  return FALSE;
-}
-
diff --git a/exo-mount/exo-mount-utils.h b/exo-mount/exo-mount-utils.h
deleted file mode 100644
index 2b61b95..0000000
--- a/exo-mount/exo-mount-utils.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* $Id$ */
-/*-
- * Copyright (c) 2006-2007 Benedikt Meurer <benny 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 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 __EXO_MOUNT_UTILS_H__
-#define __EXO_MOUNT_UTILS_H__
-
-#include <exo/exo.h>
-
-G_BEGIN_DECLS
-
-gboolean exo_mount_utils_is_mounted (const gchar *device_file,
-                                     gboolean    *readonly_return);
-
-G_END_DECLS
-
-#endif /* !__EXO_MOUNT_UTILS_H__ */
diff --git a/exo-mount/main.c b/exo-mount/main.c
index 1974d21..1ce40f8 100644
--- a/exo-mount/main.c
+++ b/exo-mount/main.c
@@ -44,12 +44,17 @@
 
 #include <glib/gstdio.h>
 
+#include <gio/gio.h>
+#define HAVE_GIO_UNIX
+#ifdef HAVE_GIO_UNIX
+#include <gio/gunixmounts.h>
+#endif
+
 #include <exo-hal/exo-hal.h>
 #include <exo/exo.h>
-#include <exo-mount/exo-mount-fstab.h>
+#ifdef HAVE_HAL
 #include <exo-mount/exo-mount-hal.h>
-#include <exo-mount/exo-mount-utils.h>
-
+#endif
 
 
 /* --- globals --- */
@@ -80,8 +85,140 @@ static GOptionEntry entries[] =
 
 
 
-int
-main (int argc, char **argv)
+static gboolean
+exo_mount_device_is_mounted (const gchar *device_file,
+                             gboolean    *readonly_return)
+{
+#ifdef HAVE_GIO_UNIX
+  GList           *lp;
+  GUnixMountEntry *mount_entry;
+  const gchar     *device_path;
+
+  /* get the mounted devices (from mtab) */
+  for (lp = g_unix_mounts_get (NULL); lp != NULL; lp = lp->next)
+    {
+      mount_entry = lp->data;
+
+      device_path = g_unix_mount_get_device_path (mount_entry);
+      if (exo_str_is_equal (device_path, device_file))
+        {
+          if (G_LIKELY (readonly_return != NULL))
+            *readonly_return = g_unix_mount_is_readonly (mount_entry);
+          return TRUE;
+        }
+    }
+#endif
+
+  return FALSE;
+}
+
+
+
+#ifdef HAVE_GIO_UNIX
+static gboolean
+exo_mount_device_lookup (const gchar      *device_file,
+                         GUnixMountPoint **mount_point_return,
+                         GError          **error)
+{
+  GList           *lp;
+  GUnixMountPoint *mount_point;
+  const gchar     *device_path;
+
+  /* get the known devices (from fstab) */
+  for (lp = g_unix_mount_points_get (NULL); lp != NULL; lp = lp->next)
+    {
+      mount_point = lp->data;
+
+      device_path = g_unix_mount_point_get_device_path (mount_point);
+      if (exo_str_is_equal (device_path, device_file))
+        {
+          if (G_LIKELY (mount_point_return != NULL))
+            *mount_point_return = mount_point;
+          return TRUE;
+        }
+    }
+
+  /* TRANSLATORS: a device is missing from the file system table (usually /etc/fstab) */
+  if (G_LIKELY (error != NULL))
+    g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_INVAL, _("Device \"%s\" not found in file system device table"), device_file);
+
+  return FALSE;
+}
+#endif
+
+
+
+static gboolean
+exo_mount_device_is_mount_point (const gchar *device_file)
+{
+#ifdef HAVE_GIO_UNIX
+  return exo_mount_device_lookup (device_file, NULL, NULL);
+#else
+  return FALSE;
+#endif
+}
+
+
+
+static void
+exo_mount_device_execute (const gchar  *device_file,
+                          const gchar  *command,
+                          GError      **error)
+{
+  gboolean         result;
+  gchar           *standard_error;
+  gchar           *command_line;
+  gchar           *quoted;
+  gint             status;
+  const gchar     *argument;
+#ifdef HAVE_GIO_UNIX
+  GUnixMountPoint *mount_point;
+
+  if (!exo_mount_device_lookup (device_file, &mount_point, error))
+    return;
+  argument = g_unix_mount_point_get_device_path (mount_point);
+#else
+  argument = device_file;
+#endif
+
+  /* generate the command line */
+  quoted = g_shell_quote (argument);
+  command_line = g_strconcat (command, " ", quoted, NULL);
+  g_free (quoted);
+
+  /* try to execute the command line */
+  result = g_spawn_command_line_sync (command_line, NULL, &standard_error, &status, error);
+  if (G_LIKELY (result))
+    {
+      /* check if the command failed */
+      if (G_UNLIKELY (status != 0))
+        {
+          /* drop additional whitespace from the stderr output */
+          g_strstrip (standard_error);
+
+          /* strip all trailing dots from the stderr output */
+          while (*standard_error != '\0' && standard_error[strlen (standard_error) - 1] == '.')
+            standard_error[strlen (standard_error) - 1] = '\0';
+
+          /* generate an error from the stderr output */
+          if (G_LIKELY (*standard_error != '\0'))
+            g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, "%s", standard_error);
+          else
+            g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("Unknown error"));
+        }
+
+      /* release the stderr output */
+      g_free (standard_error);
+    }
+
+  /* cleanup */
+  g_free (command_line);
+}
+
+
+
+gint
+main (gint argc, gchar **argv)
 {
 #ifdef HAVE_HAL
   ExoMountHalDevice *device;
@@ -137,6 +274,11 @@ main (int argc, char **argv)
       return EXIT_SUCCESS;
     }
 
+#ifndef HAVE_GIO_UNIX
+  g_warning (_("%s is not compiled with GIO-Unix support. Therefore it will "
+               "probably not work on this system."), g_get_prgname ());
+#endif
+
   /* make sure that either a device UDI or file was specified... */
   if (G_UNLIKELY (opt_hal_udi == NULL && opt_device == NULL))
     {
@@ -212,7 +354,7 @@ main (int argc, char **argv)
 #endif
 
   /* check if the device is currently mounted */
-  mounted = exo_mount_utils_is_mounted (opt_device, &mounted_readonly);
+  mounted = exo_mount_device_is_mounted (opt_device, &mounted_readonly);
   if ((!opt_eject && !opt_unmount && mounted)
       || (opt_unmount && !mounted))
     {
@@ -270,7 +412,7 @@ main (int argc, char **argv)
    * if so, we cannot use HAL to mount it.
    */
 #ifdef HAVE_HAL
-  if (!exo_mount_fstab_contains (opt_device))
+  if (!exo_mount_device_is_mount_point (opt_device))
     {
       /* perform the requested operation */
       if (G_LIKELY (opt_unmount))
@@ -285,11 +427,11 @@ main (int argc, char **argv)
     {
       /* perform the requested operation */
       if (G_LIKELY (opt_unmount))
-        exo_mount_fstab_unmount (opt_device, &err);
+        exo_mount_device_execute (opt_device, PATH_UMOUNT, &err);
       else if (G_LIKELY (opt_eject))
-        exo_mount_fstab_eject (opt_device, &err);
+        exo_mount_device_execute (opt_device, PATH_EJECT, &err);
       else
-        exo_mount_fstab_mount (opt_device, &err);
+        exo_mount_device_execute (opt_device, PATH_MOUNT, &err);
     }
 
   /* check if we have a notification process to kill */
@@ -304,7 +446,7 @@ main (int argc, char **argv)
 
   /* if we tried to mount, make sure it's really mounted now */
   if (err == NULL && (!opt_eject && !opt_unmount)
-      && !exo_mount_utils_is_mounted (opt_device, NULL))
+      && !exo_mount_device_is_mounted (opt_device, NULL))
     {
       /* although somebody claims that we were successfully, that's not the case */
       g_set_error (&err, G_FILE_ERROR, G_FILE_ERROR_FAILED,



More information about the Xfce4-commits mailing list