[patch] three simple patches



Hi,

Here are three simple patches for HEAD

 1. Add myself and my backends to the AUTHORS file. Dunno why they were
    missing.

 2. Unbreak the gphoto2 backend. See the archives where consensus was
    reached that only for 2.22 the gphoto2 backend was to be disabled
    like this. Better get this into HEAD early.

 3. Add an --unmount-scheme option to gvfs-mount. This is primarily
    useful in wrappers for legacy programs not yet using gio. So for
    e.g. for gthumb or f-spot in F9 I was planning to use this for
    in exec wrapper. But see [1].

Please apply. Thanks.

    David

[1] : unfortunately there's a bug in gvfs meaning that the reply to the
unmount call never arrives. So e.g. 'gvfs-mount --unmount-scheme
gphoto2' just hangs :-/. Oh, it *sometimes* works. I should probably
file a bug about this.

Index: AUTHORS
===================================================================
--- AUTHORS	(revision 1725)
+++ AUTHORS	(working copy)
@@ -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>

Index: hal/ghalvolume.c
===================================================================
--- hal/ghalvolume.c	(revision 1725)
+++ hal/ghalvolume.c	(working copy)
@@ -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
Index: programs/gvfs-mount.c
===================================================================
--- programs/gvfs-mount.c	(revision 1725)
+++ programs/gvfs-mount.c	(working copy)
@@ -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]