gvfs r1726 - in trunk: . hal programs



Author: davidz
Date: Mon Apr  7 20:50:52 2008
New Revision: 1726
URL: http://svn.gnome.org/viewvc/gvfs?rev=1726&view=rev

Log:
2008-04-07  David Zeuthen  <davidz redhat com>

        * hal/ghalvolume.c (g_hal_volume_new): Unbreak the gphoto2 backend
        by allowing automounting.

        * programs/gvfs-mount.c (main, unmount_all_with_scheme): Add a
        new option --unmount-scheme

        * AUTHORS: Add cdda and gphoto2 backends



Modified:
   trunk/AUTHORS
   trunk/ChangeLog
   trunk/hal/ghalvolume.c
   trunk/programs/gvfs-mount.c

Modified: trunk/AUTHORS
==============================================================================
--- trunk/AUTHORS	(original)
+++ trunk/AUTHORS	Mon Apr  7 20:50:52 2008
@@ -18,6 +18,14 @@
 Backends
 =====================================
 
+CDDA backend
+============
+David Zeuthen <davidz redhat com>
+
+Gphoto2 backend
+===============
+David Zeuthen <davidz redhat com>
+
 Archive Backend
 ===============
 Benjamin Otte <otte gnome org>

Modified: trunk/hal/ghalvolume.c
==============================================================================
--- trunk/hal/ghalvolume.c	(original)
+++ trunk/hal/ghalvolume.c	Mon Apr  7 20:50:52 2008
@@ -519,10 +519,6 @@
 
       if (foreign_mount_root == NULL)
         return NULL;
-
-      /* We don't want to automount cameras as the gphoto backend
-         blocks access from other apps */
-      ignore_automount = TRUE;
     }
 #endif
   else

Modified: trunk/programs/gvfs-mount.c
==============================================================================
--- trunk/programs/gvfs-mount.c	(original)
+++ trunk/programs/gvfs-mount.c	Mon Apr  7 20:50:52 2008
@@ -43,11 +43,13 @@
 static gboolean mount_unmount = FALSE;
 static gboolean mount_list = FALSE;
 static gboolean mount_list_info = FALSE;
+static const char *unmount_scheme = NULL;
 
-static GOptionEntry entries[] = 
+static const GOptionEntry entries[] = 
 {
   { "mountable", 'm', 0, G_OPTION_ARG_NONE, &mount_mountable, "Mount as mountable", NULL },
   { "unmount", 'u', 0, G_OPTION_ARG_NONE, &mount_unmount, "Unmount", NULL},
+  { "unmount-scheme", 's', 0, G_OPTION_ARG_STRING, &unmount_scheme, "Unmount all mounts with the given scheme", NULL},
   { "list", 'l', 0, G_OPTION_ARG_NONE, &mount_list, "List", NULL},
   { "list-info", 'i', 0, G_OPTION_ARG_NONE, &mount_list_info, "List extra information", NULL},
   { NULL }
@@ -502,6 +504,34 @@
   g_list_free (mounts);
 }
 
+static void
+unmount_all_with_scheme (const char *scheme)
+{
+  GVolumeMonitor *volume_monitor;
+  GList *mounts;
+  GList *l;
+
+  volume_monitor = g_volume_monitor_get();
+
+  /* populate gvfs network mounts */
+  iterate_gmain();
+
+  mounts = g_volume_monitor_get_mounts (volume_monitor);
+  for (l = mounts; l != NULL; l = l->next) {
+    GMount *mount = G_MOUNT (l->data);
+    GFile *root;
+
+    root = g_mount_get_root (mount);
+    if (g_file_has_uri_scheme (root, scheme)) {
+            unmount (root);
+    }
+    g_object_unref (root);
+  }
+  g_list_foreach (mounts, (GFunc)g_object_unref, NULL);
+  g_list_free (mounts);
+
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -523,6 +553,10 @@
   
   if (mount_list)
     list_monitor_items ();
+  else if (unmount_scheme != NULL)
+    {
+      unmount_all_with_scheme (unmount_scheme);
+    }
   else if (argc > 1)
     {
       int i;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]