gnome-volume-manager r1359 - in trunk: . src



Author: fejj
Date: Tue Apr 22 14:53:49 2008
New Revision: 1359
URL: http://svn.gnome.org/viewvc/gnome-volume-manager?rev=1359&view=rev

Log:
2008-04-22  Jeffrey Stedfast  <fejj novell com>

	* src/manager.c: Conditionally disable all of the auto-mounting
	code which Nautilus is now supposed to handle starting with GNOME
	2.22, as far as I understand...



Modified:
   trunk/ChangeLog
   trunk/src/manager.c

Modified: trunk/src/manager.c
==============================================================================
--- trunk/src/manager.c	(original)
+++ trunk/src/manager.c	Tue Apr 22 14:53:49 2008
@@ -12,7 +12,7 @@
  *
  * Licensed under the GNU GPL v2.  See COPYING.
  *
- * (C) Copyright 2005-2007 Novell, Inc.
+ * (C) Copyright 2005-2008 Novell, Inc.
  */
 
 
@@ -65,6 +65,7 @@
 static char *gnome_mount = NULL;
 static LibHalContext *hal_ctx;
 
+#ifdef ENABLE_AUTOMOUNT
 struct _MountPolicy {
 	char *udi;
 	int apply;
@@ -76,6 +77,7 @@
 
 /* List of UDI's of all volumes mounted during the lifetime of the program */
 static GSList *mounted_volumes = NULL;
+#endif /* ENABLE_AUTOMOUNT */
 
 /* Table of active dialogs indexed by the udi of the device in question */
 static GHashTable *dialogs = NULL;
@@ -114,6 +116,7 @@
 } type_t;
 
 enum {
+#ifdef ENABLE_AUTOMOUNT
 	/* Storage */
 	FILEMANAGER,
 	AUTOBROWSE,
@@ -126,14 +129,17 @@
 	AUTOOPEN_PATH,
 	AUTORUN,
 	AUTORUN_PATH,
+#endif /* ENABLE_AUTOMOUNT */
 	
 	/* Multimedia */
+#ifdef ENABLE_AUTOMOUNT
 	AUTOPLAY_CDA,
 	AUTOPLAY_CDA_COMMAND,
 	AUTOPLAY_DVD,
 	AUTOPLAY_DVD_COMMAND,
 	AUTOPLAY_VCD,
 	AUTOPLAY_VCD_COMMAND,
+#endif /* ENABLE_AUTOMOUNT */
 	AUTOIPOD,
 	AUTOIPOD_COMMAND,
 	
@@ -174,6 +180,7 @@
 	type_t type;
 	void *var;
 } gvm_settings[] = {
+#ifdef ENABLE_AUTOMOUNT
 	/* Storage */
 	{ GCONF_ROOT "filemanager",               TYPE_STRING, &config.filemanager               },
 	{ GCONF_ROOT "autobrowse",                TYPE_BOOL,   &config.autobrowse                },
@@ -186,14 +193,17 @@
 	{ GCONF_ROOT "autoopen_path",             TYPE_STRING, &config.autoopen_path             },
 	{ GCONF_ROOT "autorun",                   TYPE_BOOL,   &config.autorun                   },
 	{ GCONF_ROOT "autorun_path",              TYPE_STRING, &config.autorun_path              },
+#endif /* ENABLE_AUTOMOUNT */
 	
 	/* Multimedia */
+#ifdef ENABLE_AUTOMOUNT
 	{ GCONF_ROOT "autoplay_cda",              TYPE_BOOL,   &config.autoplay_cda              },
 	{ GCONF_ROOT "autoplay_cda_command",      TYPE_STRING, &config.autoplay_cda_command      },
 	{ GCONF_ROOT "autoplay_dvd",              TYPE_BOOL,   &config.autoplay_dvd              },
 	{ GCONF_ROOT "autoplay_dvd_command",      TYPE_STRING, &config.autoplay_dvd_command      },
 	{ GCONF_ROOT "autoplay_vcd",              TYPE_BOOL,   &config.autoplay_vcd              },
 	{ GCONF_ROOT "autoplay_vcd_command",      TYPE_STRING, &config.autoplay_vcd_command      },
+#endif /* ENABLE_AUTOMOUNT */
 	{ GCONF_ROOT "autoipod",                  TYPE_BOOL,   &config.autoipod                  },
 	{ GCONF_ROOT "autoipod_command",          TYPE_STRING, &config.autoipod_command          },
 	
@@ -1281,6 +1291,7 @@
 		gvm_run_camera (ctx->udi, ctx->device, ctx->mount_point);
 }
 
+#ifdef ENABLE_AUTOMOUNT
 static gboolean
 is_exe (const char *path)
 {
@@ -1784,6 +1795,7 @@
 	if (config.autobrowse)
 		gvm_run_filemanager (udi, device, mount_point);
 }
+#endif /* ENABLE_AUTOMOUNT */
 
 static gboolean
 gvm_udi_is_subfs_mount (const char *udi)
@@ -1932,6 +1944,7 @@
 }
 
 
+#ifdef ENABLE_AUTOMOUNT
 enum {
 	MOUNT_CODEPAGE   = (1 << 0),
 	MOUNT_DATA       = (1 << 1),
@@ -2626,6 +2639,7 @@
 	
 	libhal_free_string (device);
 }
+#endif /* ENABLE_AUTOMOUNT */
 
 /*
  * gvm_media_changed - generic media change handler.
@@ -2680,6 +2694,7 @@
 
 typedef gboolean (* DeviceAddedHandler) (const char *udi, const char *capability);
 
+#ifdef ENABLE_AUTOMOUNT
 static gboolean
 block_device_added (const char *udi, const char *capability GNUC_UNUSED)
 {
@@ -2768,6 +2783,7 @@
 	
 	return TRUE;
 }
+#endif /* ENABLE_AUTOMOUNT */
 
 static gboolean
 camera_device_added (const char *udi, const char *capability GNUC_UNUSED)
@@ -2929,9 +2945,11 @@
 	const char *capability;
 	DeviceAddedHandler handler;
 } devices[] = {
+#ifdef ENABLE_AUTOMOUNT
 	{ "block",                 block_device_added        },
+#endif
 	{ "camera",                camera_device_added       },
-	/*{ "input",                 input_device_added        },*/ /* we don't handle generic input devices (yet?) */
+	/*{ "input",                 input_device_added        },*/
 	{ "input.keyboard",        input_device_added        },
 	{ "input.mouse",           input_device_added        },
 	{ "input.tablet",          input_device_added        },
@@ -2997,6 +3015,7 @@
 	
 	dbg ("Device removed: %s\n", udi);
 	
+#ifdef ENABLE_AUTOMOUNT
 	/* unmounted leftover mount point */
 	if ((device_udi = g_hash_table_lookup (device_table, udi))) {
 		if (gvm_device_unmount (device_udi)) {
@@ -3012,6 +3031,7 @@
 			}
 		}
 	}
+#endif /* ENABLE_AUTOMOUNT */
 	
 	if ((dialog = g_hash_table_lookup (dialogs, udi)))
 		gtk_dialog_response (dialog, GTK_RESPONSE_CANCEL);
@@ -3069,6 +3089,7 @@
 	if (mounted) {
 		dbg ("Mounted: %s\n", udi);
 		
+#ifdef ENABLE_AUTOMOUNT
 		if ((policy = g_hash_table_lookup (mount_table, udi))) {
 			char *device;
 			
@@ -3089,6 +3110,7 @@
 			dbg ("not in mount queue: %s\n", udi);
 			/*gvm_device_mounted (udi);*/
 		}
+#endif /* ENABLE_AUTOMOUNT */
 		
 #ifdef ENABLE_NOTIFY
 		statfs_mount_info_add (udi);
@@ -3101,10 +3123,10 @@
 		statfs_mount_info_remove (udi);
 #endif
 		
+#ifdef ENABLE_AUTOMOUNT
 		g_hash_table_remove (device_table, udi);
 		
 		/* unmount all volumes mounted during lifetime */
-		
 		for (l = mounted_volumes; l != NULL; l = n) {
 			n = l->next;
 			if (strcmp (udi, (const char *) l->data) == 0) {
@@ -3113,6 +3135,7 @@
 				break;
 			}
 		}
+#endif /* ENABLE_AUTOMOUNT */
 	}
 }
 
@@ -3375,6 +3398,7 @@
 }
 
 
+#ifdef ENABLE_AUTOMOUNT
 /** Attempt to mount all volumes; should be called on startup.
  *
  *  @param  ctx                 LibHal context
@@ -3487,6 +3511,7 @@
 		gvm_device_unmount (udi);
 	}
 }
+#endif /* ENABLE_AUTOMOUNT */
 
 
 static int sigterm_unix_signal_pipe_fds[2];
@@ -3524,7 +3549,9 @@
 	
 	dbg ("Received SIGTERM, initiating shutdown\n");
 	
+#ifdef ENABLE_AUTOMOUNT
 	unmount_all ();
+#endif
 	
 	gtk_main_quit ();
 	
@@ -3593,7 +3620,7 @@
 		
 		free_space = (double) buf.f_bavail / (double) buf.f_blocks;
 		twogb_blocks = (2 * 1024 * 1024) / buf.f_bsize;
-
+		
 		/*
 		   If we continue using up more and more space or if we pass
 		   the threshold value while running, we want to notify again
@@ -3662,7 +3689,9 @@
 {
 	dbg ("Received 'die', initiating shutdown\n");
 	
+#ifdef ENABLE_AUTOMOUNT
 	unmount_all ();
+#endif
 	
 	gtk_main_quit ();
 }
@@ -4099,9 +4128,12 @@
 	g_io_add_watch (sigterm_iochn, G_IO_IN, sigterm_iochn_data, NULL);
 	signal (SIGTERM, handle_sigterm);
 	
+#ifdef ENABLE_AUTOMOUNT
 	device_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
 					      (GDestroyNotify) libhal_free_string);
 	mount_table = g_hash_table_new (g_str_hash, g_str_equal);
+#endif
+	
 	dialogs = g_hash_table_new (g_str_hash, g_str_equal);
 	
 #ifdef ENABLE_NOTIFY
@@ -4111,8 +4143,10 @@
 	/* Initialize the statfs_mounts hash table */
 	statfs_mounts = g_hash_table_new (g_str_hash, g_str_equal);
 #endif
-
+	
+#ifdef ENABLE_AUTOMOUNT
 	mount_all (hal_ctx);
+#endif
 	
 #ifdef ENABLE_NOTIFY
 	/* Add a timeout for our statfs checking */
@@ -4127,8 +4161,11 @@
 	statfs_id = 0;
 #endif
 	
+#ifdef ENABLE_AUTOMOUNT
 	g_hash_table_destroy (device_table);
 	g_hash_table_destroy (mount_table);
+#endif
+	
 	g_object_unref (program);
 	
 	return 0;



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