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



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

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

	* src/properties.c: Conditionally disable automounting properties
	and remove them from the UI.

	* 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
   trunk/src/properties.c

Modified: trunk/src/manager.c
==============================================================================
--- trunk/src/manager.c	(original)
+++ trunk/src/manager.c	Tue Apr 22 17:49:36 2008
@@ -146,6 +146,8 @@
 	/* Cameras */
 	AUTOPHOTO,
 	AUTOPHOTO_COMMAND,
+	AUTOVIDEOCAM,
+	AUTOVIDEOCAM_COMMAND,
 	AUTOWEBCAM,
 	AUTOWEBCAM_COMMAND,
 	
@@ -210,6 +212,8 @@
 	/* Cameras */
 	{ GCONF_ROOT "autophoto",                 TYPE_BOOL,   &config.autophoto                 },
 	{ GCONF_ROOT "autophoto_command",         TYPE_STRING, &config.autophoto_command         },
+	{ GCONF_ROOT "autovideocam",              TYPE_BOOL,   &config.autovideocam              },
+	{ GCONF_ROOT "autovideocam_command",      TYPE_STRING, &config.autovideocam_command      },
 	{ GCONF_ROOT "autowebcam",                TYPE_BOOL,   &config.autowebcam                },
 	{ GCONF_ROOT "autowebcam_command",        TYPE_STRING, &config.autowebcam_command        },
 	
@@ -4007,7 +4011,7 @@
 		return (result & USER_IS_LOCAL);
 	
 	/* querying ConsoleKit failed, fall back to old behavior */
-#ifdef __linux__	
+#ifdef __linux__
 	return gvm_user_is_local_fallback ();
 #else
 	return FALSE;

Modified: trunk/src/properties.c
==============================================================================
--- trunk/src/properties.c	(original)
+++ trunk/src/properties.c	Tue Apr 22 17:49:36 2008
@@ -5,7 +5,7 @@
  * Robert Love <rml novell com>
  * Jeffrey Stedfast <fejj novell com>
  *
- * (C) Copyright 2005-2007 Novell, Inc.
+ * (C) Copyright 2005-2008 Novell, Inc.
  *
  * Licensed under the GNU GPL v2.  See COPYING.
  */
@@ -37,42 +37,55 @@
 } type_t;
 
 enum {
+#ifdef ENABLE_AUTOMOUNT
+	/* Storage */
 	AUTOBROWSE,
 	AUTOBURN,
 	AUTOBURN_AUDIO_CD_COMMAND,
 	AUTOBURN_DATA_CD_COMMAND,
-	AUTOIPOD,
-	AUTOIPOD_COMMAND,
-	AUTOKEYBOARD,
-	AUTOKEYBOARD_COMMAND,
 	AUTOMOUNT_DRIVES,
 	AUTOMOUNT_MEDIA,
-	AUTOMOUSE,
-	AUTOMOUSE_COMMAND,
 	AUTOOPEN,
-	AUTOPHOTO,
-	AUTOPHOTO_COMMAND,
-	AUTOPILOT,
-	AUTOPILOT_COMMAND,
+	AUTORUN,
+#endif /* ENABLE_AUTOMOUNT */
+	
+	/* Multimedia */
+#ifdef ENABLE_AUTOMOUNT
 	AUTOPLAY_CDA,
 	AUTOPLAY_CDA_COMMAND,
 	AUTOPLAY_DVD,
 	AUTOPLAY_DVD_COMMAND,
+#endif /* ENABLE_AUTOMOUNT */
+	AUTOIPOD,
+	AUTOIPOD_COMMAND,
+	
+	/* Cameras */
+	AUTOPHOTO,
+	AUTOPHOTO_COMMAND,
+	AUTOVIDEOCAM,
+	AUTOVIDEOCAM_COMMAND,
+	AUTOWEBCAM,
+	AUTOWEBCAM_COMMAND,
+	
+	/* PDAs */
+	AUTOPILOT,
+	AUTOPILOT_COMMAND,
 	AUTOPOCKETPC,
 	AUTOPOCKETPC_COMMAND,
+	
+	/* Printers/Scanners */
 	AUTOPRINTER,
 	AUTOPRINTER_COMMAND,
-	AUTORUN,
 	AUTOSCANNER,
 	AUTOSCANNER_COMMAND,
+	
+	/* Input Devices */
+	AUTOKEYBOARD,
+	AUTOKEYBOARD_COMMAND,
+	AUTOMOUSE,
+	AUTOMOUSE_COMMAND,
 	AUTOTABLET,
 	AUTOTABLET_COMMAND,
-	AUTOVIDEOCAM,
-	AUTOVIDEOCAM_COMMAND,
-	AUTOWEBCAM,
-	AUTOWEBCAM_COMMAND,
-	AUTORUN_PATH,
-	AUTOOPEN_PATH,
 };
 
 static struct {
@@ -81,43 +94,55 @@
 	GtkWidget *widget;
 	gboolean need_daemon;
 } gvm_settings[] = {
+#ifdef ENABLE_AUTOMOUNT
+	/* Storage */
 	{ GCONF_ROOT "autobrowse",                TYPE_BOOL,   NULL, TRUE  },
 	{ GCONF_ROOT "autoburn",                  TYPE_BOOL,   NULL, FALSE },
 	{ GCONF_ROOT "autoburn_audio_cd_command", TYPE_STRING, NULL, FALSE },
 	{ GCONF_ROOT "autoburn_data_cd_command",  TYPE_STRING, NULL, FALSE },
-	{ GCONF_ROOT "autoipod",                  TYPE_BOOL,   NULL, TRUE  },
-	{ GCONF_ROOT "autoipod_command",          TYPE_STRING, NULL, FALSE },
-	{ GCONF_ROOT "autokeyboard",              TYPE_BOOL,   NULL, TRUE  },
-	{ GCONF_ROOT "autokeyboard_command",      TYPE_STRING, NULL, FALSE },
 	{ GCONF_ROOT "automount_drives",          TYPE_BOOL,   NULL, TRUE  },
 	{ GCONF_ROOT "automount_media",           TYPE_BOOL,   NULL, TRUE  },
-	{ GCONF_ROOT "automouse",                 TYPE_BOOL,   NULL, TRUE  },
-	{ GCONF_ROOT "automouse_command",         TYPE_STRING, NULL, FALSE },
 	{ GCONF_ROOT "autoopen",                  TYPE_BOOL,   NULL, TRUE  },
-	{ GCONF_ROOT "autophoto",                 TYPE_BOOL,   NULL, TRUE  },
-	{ GCONF_ROOT "autophoto_command",         TYPE_STRING, NULL, FALSE },
-	{ GCONF_ROOT "autopalmsync",              TYPE_BOOL,   NULL, TRUE  },
-	{ GCONF_ROOT "autopalmsync_command",      TYPE_STRING, NULL, FALSE },
+	{ GCONF_ROOT "autorun",                   TYPE_BOOL,   NULL, TRUE  },
+#endif /* ENABLE_AUTOMOUNT */
+	
+	/* Multimedia */
+#ifdef ENABLE_AUTOMOUNT
 	{ GCONF_ROOT "autoplay_cda",              TYPE_BOOL,   NULL, TRUE  },
 	{ GCONF_ROOT "autoplay_cda_command",      TYPE_STRING, NULL, FALSE },
 	{ GCONF_ROOT "autoplay_dvd",              TYPE_BOOL,   NULL, TRUE  },
 	{ GCONF_ROOT "autoplay_dvd_command",      TYPE_STRING, NULL, FALSE },
+#endif /* ENABLE_AUTOMOUNT */
+	{ GCONF_ROOT "autoipod",                  TYPE_BOOL,   NULL, TRUE  },
+	{ GCONF_ROOT "autoipod_command",          TYPE_STRING, NULL, FALSE },
+	
+	/* Cameras */
+	{ GCONF_ROOT "autophoto",                 TYPE_BOOL,   NULL, TRUE  },
+	{ GCONF_ROOT "autophoto_command",         TYPE_STRING, NULL, FALSE },
+	{ GCONF_ROOT "autovideocam",              TYPE_BOOL,   NULL, TRUE  },
+	{ GCONF_ROOT "autovideocam_command",      TYPE_STRING, NULL, FALSE },
+	{ GCONF_ROOT "autowebcam",                TYPE_BOOL,   NULL, TRUE  },
+	{ GCONF_ROOT "autowebcam_command",        TYPE_STRING, NULL, FALSE },
+	
+	/* PDAs */
+	{ GCONF_ROOT "autopalmsync",              TYPE_BOOL,   NULL, TRUE  },
+	{ GCONF_ROOT "autopalmsync_command",      TYPE_STRING, NULL, FALSE },
 	{ GCONF_ROOT "autopocketpc",              TYPE_BOOL,   NULL, TRUE  },
 	{ GCONF_ROOT "autopocketpc_command",      TYPE_STRING, NULL, FALSE },
+	
+	/* Printer/Scanner */
 	{ GCONF_ROOT "autoprinter",               TYPE_BOOL,   NULL, TRUE  },
 	{ GCONF_ROOT "autoprinter_command",       TYPE_STRING, NULL, FALSE },
-	{ GCONF_ROOT "autorun",                   TYPE_BOOL,   NULL, TRUE  },
 	{ GCONF_ROOT "autoscanner",               TYPE_BOOL,   NULL, TRUE  },
 	{ GCONF_ROOT "autoscanner_command",       TYPE_STRING, NULL, FALSE },
+	
+	/* Input Devices */
+	{ GCONF_ROOT "autokeyboard",              TYPE_BOOL,   NULL, TRUE  },
+	{ GCONF_ROOT "autokeyboard_command",      TYPE_STRING, NULL, FALSE },
+	{ GCONF_ROOT "automouse",                 TYPE_BOOL,   NULL, TRUE  },
+	{ GCONF_ROOT "automouse_command",         TYPE_STRING, NULL, FALSE },
 	{ GCONF_ROOT "autotablet",                TYPE_BOOL,   NULL, TRUE  },
 	{ GCONF_ROOT "autotablet_command",        TYPE_STRING, NULL, FALSE },
-	{ GCONF_ROOT "autovideocam",              TYPE_BOOL,   NULL, TRUE  },
-	{ GCONF_ROOT "autovideocam_command",      TYPE_STRING, NULL, FALSE },
-	{ GCONF_ROOT "autowebcam",                TYPE_BOOL,   NULL, TRUE  },
-	{ GCONF_ROOT "autowebcam_command",        TYPE_STRING, NULL, FALSE },
-	/* The following entries do not (yet) have a UI */
-	/*{ GCONF_ROOT "autorun_path",         TYPE_STRING, NULL, FALSE },*/
-	/*{ GCONF_ROOT "autoopen_path",        TYPE_STRING, NULL, FALSE },*/
 };
 
 static GHashTable *gvm_settings_hash = NULL;
@@ -152,10 +177,12 @@
 	
 	name = strrchr (key, '/') + 1;
 	if (!strncmp (name, "automount_", 10)) {
+#ifdef ENABLE_AUTOMOUNT
 		bool = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gvm_settings[AUTOMOUNT_MEDIA].widget)) ||
 			gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gvm_settings[AUTOMOUNT_DRIVES].widget));
 		gtk_widget_set_sensitive (gvm_settings[AUTOOPEN].widget, bool);
 		gtk_widget_set_sensitive (gvm_settings[AUTORUN].widget, bool);
+#endif
 	} else {
 		name = g_strdup_printf ("%s_hbox", name);
 		if ((hbox = glade_xml_get_widget (xml, name)))
@@ -205,10 +232,12 @@
 	gboolean bool;
 	size_t i;
 	
+#ifdef ENABLE_AUTOMOUNT
 	/* this is the only strange one */
 	bool = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gvm_settings[AUTOMOUNT_MEDIA].widget)) ||
 		gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gvm_settings[AUTOMOUNT_DRIVES].widget));
 	gtk_widget_set_sensitive (gvm_settings[AUTORUN].widget, bool);
+#endif
 	
 	/* checkboxes can enable/disable the ability to change other settings */
 	for (i = 0; i < G_N_ELEMENTS (gvm_settings); i++) {
@@ -231,9 +260,7 @@
  * close_cb - gtk call-back on the "Close" button
  */
 static void
-close_cb (GtkWidget *dialog,
-	  int response GNUC_UNUSED,
-	  gpointer user_data GNUC_UNUSED)
+close_cb (GtkWidget *dialog, int response GNUC_UNUSED, gpointer user_data GNUC_UNUSED)
 {
 	gtk_widget_destroy (dialog);
 	gtk_main_quit ();
@@ -301,11 +328,30 @@
 	size_t i;
 	
 	for (i = 0; i < G_N_ELEMENTS (icons); i++) {
-		icon = glade_xml_get_widget (xml, icons[i].name);
+		if (!(icon = glade_xml_get_widget (xml, icons[i].name)))
+			continue;
+		
 		set_icon (GTK_IMAGE (icon), theme, icons[i].icon, icons[i].fallback);
 	}
 }
 
+#ifndef ENABLE_AUTOMOUNT
+static void
+disable_automount_props (void)
+{
+	static const char *automount_props[] = { "storage_vbox", "audio_cd_vbox", "dvd_video_vbox" };
+	GtkWidget *widget;
+	size_t i;
+	
+	for (i = 0; i < G_N_ELEMENTS (automount_props); i++) {
+		if (!(widget = glade_xml_get_widget (xml, automount_props[i])))
+			continue;
+		
+		gtk_widget_destroy (widget);
+	}
+}
+#endif /* ! ENABLE_AUTOMOUNT */
+
 static void
 show_props (void)
 {
@@ -349,7 +395,9 @@
 		g_hash_table_insert (gvm_settings_hash, gvm_settings[i].key, GINT_TO_POINTER (i + 1));
 		
 		name = strrchr (gvm_settings[i].key, '/') + 1;
-		gvm_settings[i].widget = glade_xml_get_widget (xml, name);
+		if (!(gvm_settings[i].widget = glade_xml_get_widget (xml, name)))
+			continue;
+		
 		if (gvm_settings[i].type == TYPE_STRING) {
 			GtkWidget *fileentry;
 			char *str;
@@ -380,7 +428,11 @@
 	
 	set_sensitivity ();
 	
-	gtk_widget_show_all (props);
+#ifndef ENABLE_AUTOMOUNT
+	disable_automount_props ();
+#endif
+	
+	gtk_widget_show (props);
 }
 
 /** Check if HAL is running
@@ -466,7 +518,7 @@
 	size_t i;
 	
 	for (i = 0; !need_daemon && i < G_N_ELEMENTS (gvm_settings); i++) {
-		if (gvm_settings[i].need_daemon)
+		if (gvm_settings[i].need_daemon && gvm_settings[i].widget)
 			need_daemon = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gvm_settings[i].widget));
 	}
 	



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