Re: [Utopia] gvm mounting too much at startup



On Tue, Nov 02, 2004 at 09:48:36AM -0500, David Zeuthen wrote:
> On Tue, 2004-11-02 at 13:38 +0100, Sjoerd Simons wrote:
> > On Wed, Sep 22, 2004 at 04:19:38PM +0100, Bastien Nocera wrote:
> > > On Wed, 2004-09-22 at 17:17 +0200, Sjoerd Simons wrote:
> > > > On Tue, Sep 21, 2004 at 09:49:43AM +0200, Sjoerd Simons wrote:
> > > > > Hi,
> > > > > 
> > > > >   I got some complaints from debian users that gvm mounts too much on
> > > > >   startup.  After some research it seems that g-v-m just mounts
> > > > >   everything on startup even if ``mount removable drives/media'' is
> > > > >   turned off. This is easy to fix ofcourse.
> > > > > 
> > > > >   More ``problematic'' is that some people don't seem to like it that
> > > > >   their static disks are mounted on startup. For example some stray
> > > > >   windows or os X partition. Maybe a ``Mount static disks on session
> > > > >   start'' option would be
> > > > >   nice for this. Any opinions about this ? 
> > > > 
> > > >   Patch which does this is attached.
> > > 
> > > That doesn't have its place in the preferences UI, IMO.
> > 
> > Another way to solve this problem attached. It allows one to specify a boolean
> > property in hal called storage.policy.manual_mount, which when true causes gvm
> > to not automagically mount the volume.
> > 
> 
> Hmm - what about just making g-v-m respect the already defined property
> storage.automount_enabled_hint that is defined in the hal spec?

Attached patch does that :)

  Sjoerd
-- 
Don't make a big deal out of everything; just deal with everything.
Index: src/manager.c
===================================================================
RCS file: /cvs/gnome/gnome-volume-manager/src/manager.c,v
retrieving revision 1.35
diff -u -r1.35 manager.c
--- src/manager.c	25 Oct 2004 19:12:11 -0000	1.35
+++ src/manager.c	4 Nov 2004 10:25:02 -0000
@@ -243,6 +243,26 @@
 	return retval;
 }
 
+/* Returns true if the storage policy indicates this should be manually 
+ * mounted */
+static gboolean
+gvm_is_manual_mount(LibHalContext *ctx, const char *udi) {
+  gchar *parent;
+  gboolean ret = FALSE;
+
+  parent = hal_device_get_property_string(ctx, udi, "info.parent");
+  if (hal_device_property_exists (hal_ctx, parent, 
+                                  "storage.automount_enabled_hint")) {
+      ret = !hal_device_get_property_bool (hal_ctx, parent,
+                                          "storage.automount_enabled_hint");
+  }
+  if (hal_device_property_exists (hal_ctx, udi, 
+                                  "storage.automount_enabled_hint")) {
+      ret = !hal_device_get_property_bool (hal_ctx, udi,
+                                          "storage.automount_enabled_hint");
+  }
+  return ret;
+}
 /*
  * gvm_check_dvd - is this a Video DVD?  If so, do something about it.
  *
@@ -556,6 +576,8 @@
 
 	switch (action) {
 	case MOUNT:
+		if (gvm_is_manual_mount(hal_ctx, udi))
+			break;
 		gvm_device_mount (device);
 		mounted_volumes_policy_queue = g_slist_append (mounted_volumes_policy_queue, g_strdup (udi));
 		break;
@@ -632,7 +654,7 @@
 	} else if (has_audio && has_data) {
 		gvm_ask_mixed (udi);
 	} else if (has_data) {
-		if (config.automount_media) {
+		if (config.automount_media && !gvm_is_manual_mount(hal_ctx, udi)) {
 			gvm_device_mount (device);
 			mounted_volumes_policy_queue = g_slist_append (mounted_volumes_policy_queue, g_strdup (udi));
 		}
@@ -690,9 +712,10 @@
 	} else {
 		dbg ("Added: %s\n", device);
 		
-		if (config.automount_drives) {
+		if (config.automount_drives && !gvm_is_manual_mount(hal_ctx, udi)) {
 			gvm_device_mount (device);
-			mounted_volumes_policy_queue = g_slist_append (mounted_volumes_policy_queue, g_strdup (udi));
+			mounted_volumes_policy_queue = 
+        g_slist_append (mounted_volumes_policy_queue, g_strdup (udi));
 		}
 	}
 
@@ -754,9 +777,10 @@
 	/* folks, we have a new device! */
 	dbg ("Added: %s\n", device);
 	
-	if (config.automount_drives) {
+	if (config.automount_drives && !gvm_is_manual_mount(ctx, udi)) {
 		gvm_device_mount (device);
-		mounted_volumes_policy_queue = g_slist_append (mounted_volumes_policy_queue, g_strdup (udi));
+		mounted_volumes_policy_queue = 
+      g_slist_append (mounted_volumes_policy_queue, g_strdup (udi));
 	}
 	
 out:
@@ -964,6 +988,9 @@
 		    strcmp (hal_device_get_property_string (ctx, udi, 
 							    "volume.fsusage"), 
 			    "filesystem") != 0)
+			continue;
+    /* only automagically mount when manual_mount is not specified */
+		if (gvm_is_manual_mount(ctx, udi)) 
 			continue;
 
 		device_file = hal_device_get_property_string (ctx, udi,


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