Re: [Utopia] gvm mounting too much at startup



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.

  Sjoerd
-- 
What is research but a blind date with knowledge?
		-- Will Harvey
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	2 Nov 2004 12:34:41 -0000
@@ -243,6 +243,14 @@
 	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) {
+  return 
+    hal_device_property_exists (hal_ctx, udi, "storage.policy.manual_mount") &&
+    hal_device_get_property_bool (hal_ctx, udi, "storage.policy.manual_mount");
+}
 /*
  * gvm_check_dvd - is this a Video DVD?  If so, do something about it.
  *
@@ -556,6 +564,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 +642,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 +700,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 +765,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:
@@ -965,6 +977,9 @@
 							    "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,
 							      "block.device");

Attachment: signature.asc
Description: Digital signature



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