[Utopia] [patch] make g-v-m run gnome-mount silently on startup



Hey,

Attached patch makes g-v-m pass --no-ui to gnome-mount on start up. This
prevents error dialogs from gnome-mount in the event a volume cannot be
mounted which is probably what we want when a user logs in.

There are no changes to any strings. OK to commit?

    David

 ChangeLog     |   10 ++++++++++
 src/manager.c |   21 +++++++++++++--------
 2 files changed, 23 insertions(+), 8 deletions(-)

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-volume-manager/ChangeLog,v
retrieving revision 1.227
diff -u -p -r1.227 ChangeLog
--- ChangeLog	12 Jan 2006 21:38:39 -0000	1.227
+++ ChangeLog	17 Jan 2006 17:31:21 -0000
@@ -1,3 +1,13 @@
+2006-01-17  David Zeuthen  <davidz redhat com>
+
+	* src/manager.c (gvm_device_mount): Take an extra argument that
+	says whether the mount program should show error dialogs
+	(cda_extra_cb, gvm_ask_mixed, gvm_cdrom_policy)
+	(block_device_added): Pass FALSE to gvm_device_mount() to specify
+	that we want dialogs
+	(mount_all): Pass TRUE to gvm_device_mount() to specify
+	that we don't want dialogs
+
 2006-01-12  Jeffrey Stedfast  <fejj novell com>
 
 	* configure.in Bumped version to 1.5.9
Index: src/manager.c
===================================================================
RCS file: /cvs/gnome/gnome-volume-manager/src/manager.c,v
retrieving revision 1.115
diff -u -p -r1.115 manager.c
--- src/manager.c	12 Jan 2006 21:33:50 -0000	1.115
+++ src/manager.c	17 Jan 2006 17:31:23 -0000
@@ -1291,7 +1291,7 @@ gvm_device_mounted (const char *udi)
  * @return TRUE iff the mount was succesful
  */
 static gboolean
-gvm_device_mount (const char *udi, int apply_policy)
+gvm_device_mount (const char *udi, int apply_policy, gboolean no_ui)
 {
 	char *mount_point, *fstype, *options[2], **poptions;
 	struct _MountPolicy *policy;
@@ -1315,8 +1315,12 @@ gvm_device_mount (const char *udi, int a
 		policy->apply = apply_policy;
 		
 		g_hash_table_insert (mount_table, policy->udi, policy);
-		
-		command = g_strdup_printf ("%s --hal-udi=%%h", gnome_mount);
+
+		if (no_ui) {
+			command = g_strdup_printf ("%s --no-ui --hal-udi=%%h", gnome_mount);
+		} else {
+			command = g_strdup_printf ("%s --hal-udi=%%h", gnome_mount);
+		}
 		retval = gvm_run_command (command, udi, NULL, NULL);
 		g_free (command);
 		
@@ -1456,7 +1460,7 @@ cda_extra_cb (GvmPromptCtx *ctx, int act
 	switch (action) {
 	case GVM_RESPONSE_BROWSE:
 		if (!gvm_udi_is_subfs_mount (ctx->udi))
-			gvm_device_mount (ctx->udi, TRUE);
+			gvm_device_mount (ctx->udi, TRUE, FALSE);
 		break;
 	case GVM_RESPONSE_PLAY:
 		gvm_run_cdplayer (ctx->udi, ctx->device, NULL);
@@ -1491,7 +1495,7 @@ gvm_ask_mixed (const char *udi)
 		gvm_prompt (ctx, 0, NULL);
 	} else if (config.automount_media) {
 		if (!gvm_udi_is_subfs_mount (udi))
-			gvm_device_mount (udi, TRUE);
+			gvm_device_mount (udi, TRUE, FALSE);
 	} else if (config.autoplay_cda) {
 		gvm_run_cdplayer (udi, device, NULL);
 	}
@@ -1626,7 +1630,7 @@ gvm_cdrom_policy (const char *udi)
 		gvm_ask_mixed (udi);
 	} else if (has_data) {
 		if (config.automount_media && !gvm_udi_is_subfs_mount (udi))
-			gvm_device_mount (udi, TRUE);
+			gvm_device_mount (udi, TRUE, FALSE);
 	} else if (is_blank) {
 		if ((type = gvm_cdrom_media_is_writable (udi)))
 			gvm_run_cdburner (udi, type, device, NULL);
@@ -1784,7 +1788,7 @@ block_device_added (const char *udi, con
 	if (config.automount_drives && mountable) {
 		if (!gvm_udi_is_subfs_mount (udi)) {
 			if (gvm_automount_enabled (udi)) {
-				gvm_device_mount (udi, TRUE);
+				gvm_device_mount (udi, TRUE, FALSE);
 			} else {
 				dbg ("storage.automount_enabled_hint set to false on %s, not mounting\n", udi);
 			}
@@ -2340,7 +2344,8 @@ mount_all (LibHalContext *ctx)
 		/* mount the device */
 		if ((dev = libhal_device_get_property_string (ctx, udi, "block.device", &error))) {
 			dbg ("mount_all: mounting %s\n", dev);
-			gvm_device_mount (udi, FALSE);
+			/* don't make the mount program put up error dialogs */
+			gvm_device_mount (udi, FALSE, TRUE);
 			libhal_free_string (dev);
 		} else {
 			warn ("mount_all: no device for udi=%s: %s", udi, error.message);


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