Re: [Utopia] gvm mounting too much at startup
- From: Sjoerd Simons <sjoerd luon net>
- To: utopia-list gnome org
- Subject: Re: [Utopia] gvm mounting too much at startup
- Date: Wed, 22 Sep 2004 17:17:58 +0200
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.
Sjoerd
--
Elliptic paraboloids for sale.
Index: gnome-volume-manager.schemas.in
===================================================================
RCS file: /cvs/gnome/gnome-volume-manager/gnome-volume-manager.schemas.in,v
retrieving revision 1.7
diff -u -r1.7 gnome-volume-manager.schemas.in
--- gnome-volume-manager.schemas.in 13 Aug 2004 17:11:56 -0000 1.7
+++ gnome-volume-manager.schemas.in 22 Sep 2004 14:55:55 -0000
@@ -2,6 +2,17 @@
<schemalist>
<schema>
+ <key>/schemas/desktop/gnome/volume_manager/automount_static_drives</key>
+ <applyto>/desktop/gnome/volume_manager/automount_static_drives</applyto>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short>Automount static drives on session start</short>
+ <long>Whether gnome-volume-manager should automatically mount
+ static storage drives on session start.</long>
+ </locale>
+ </schema>
+ <schema>
<key>/schemas/desktop/gnome/volume_manager/automount_drives</key>
<applyto>/desktop/gnome/volume_manager/automount_drives</applyto>
<type>bool</type>
Index: gnome-volume-properties.glade
===================================================================
RCS file: /cvs/gnome/gnome-volume-manager/gnome-volume-properties.glade,v
retrieving revision 1.3
diff -u -r1.3 gnome-volume-properties.glade
--- gnome-volume-properties.glade 13 Aug 2004 17:11:56 -0000 1.3
+++ gnome-volume-properties.glade 22 Sep 2004 14:55:56 -0000
@@ -122,10 +122,29 @@
<property name="spacing">0</property>
<child>
+ <widget class="GtkCheckButton" id="automount_static_drives_cb">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Mount static drives on session start</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
<widget class="GtkCheckButton" id="automount_drives_cb">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes">_Mount removable drives when hot-plugged</property>
+ <property name="label" translatable="yes">Mount removable drives when hot-plugged</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
Index: src/gvm.h
===================================================================
RCS file: /cvs/gnome/gnome-volume-manager/src/gvm.h,v
retrieving revision 1.4
diff -u -r1.4 gvm.h
--- src/gvm.h 13 Aug 2004 17:11:56 -0000 1.4
+++ src/gvm.h 22 Sep 2004 14:55:56 -0000
@@ -5,6 +5,7 @@
struct gvm_configuration {
GConfClient *client;
+ gboolean automount_static_drives;
gboolean automount_drives;
gboolean automount_media;
gboolean autobrowse;
Index: src/manager.c
===================================================================
RCS file: /cvs/gnome/gnome-volume-manager/src/manager.c,v
retrieving revision 1.32
diff -u -r1.32 manager.c
--- src/manager.c 20 Sep 2004 16:12:22 -0000 1.32
+++ src/manager.c 22 Sep 2004 14:55:56 -0000
@@ -66,6 +66,8 @@
static void
gvm_load_config (void)
{
+ config.automount_static_drives = gconf_client_get_bool (config.client,
+ GCONF_ROOT "automount_static_drives", NULL);
config.automount_drives = gconf_client_get_bool (config.client,
GCONF_ROOT "automount_drives", NULL);
config.automount_media = gconf_client_get_bool (config.client,
@@ -950,9 +952,8 @@
char **volumes;
char *udi;
char *device_file;
-
- if (!config.automount_media)
- return;
+ char *drive_udi = NULL;
+ gboolean do_mount;
volumes = hal_find_device_by_capability (ctx, "volume", &num_volumes);
for (i = 0; i < num_volumes; i++) {
@@ -972,6 +973,22 @@
"volume.fsusage"),
"filesystem") != 0)
continue;
+
+ drive_udi = hal_device_get_property_string(ctx, udi, "info.parent");
+
+ if (hal_device_property_exists(ctx, drive_udi, "storage.hotpluggable") &&
+ hal_device_get_property_bool(ctx, drive_udi, "storage.hotpluggable")) {
+ do_mount = config.automount_drives;
+ } else if (
+ hal_device_property_exists(ctx, drive_udi, "storage.removable") &&
+ hal_device_get_property_bool(ctx, drive_udi, "storage.removable")) {
+ do_mount = config.automount_media;
+ } else {
+ do_mount = config.automount_static_drives;
+ }
+ hal_free_string(drive_udi);
+
+ if (!do_mount) continue;
device_file = hal_device_get_property_string (ctx, udi,
"block.device");
Index: src/properties.c
===================================================================
RCS file: /cvs/gnome/gnome-volume-manager/src/properties.c,v
retrieving revision 1.11
diff -u -r1.11 properties.c
--- src/properties.c 13 Aug 2004 19:49:44 -0000 1.11
+++ src/properties.c 22 Sep 2004 14:55:57 -0000
@@ -33,6 +33,7 @@
#endif
GtkWidget *dialog;
+GtkWidget *automount_static_drives_cb;
GtkWidget *automount_drives_cb;
GtkWidget *automount_media_cb;
GtkWidget *autobrowse_cb;
@@ -79,6 +80,8 @@
static void
write_config (void)
{
+ gconf_client_set_bool (config.client, GCONF_ROOT "automount_static_drives",
+ config.automount_static_drives, NULL);
gconf_client_set_bool (config.client, GCONF_ROOT "automount_drives",
config.automount_drives, NULL);
gconf_client_set_bool (config.client, GCONF_ROOT "automount_media",
@@ -114,6 +117,8 @@
static void
signal_response (void)
{
+ config.automount_static_drives = GTK_TOGGLE_BUTTON
+ (automount_static_drives_cb)->active;
config.automount_drives = GTK_TOGGLE_BUTTON
(automount_drives_cb)->active;
config.automount_media = GTK_TOGGLE_BUTTON
@@ -203,6 +208,8 @@
{
lock_config = TRUE;
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (automount_static_drives_cb),
+ config.automount_static_drives);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (automount_drives_cb),
config.automount_drives);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (automount_media_cb),
@@ -246,6 +253,8 @@
static void
read_config (void)
{
+ config.automount_static_drives = gconf_client_get_bool (config.client,
+ GCONF_ROOT "automount_static_drives", NULL);
config.automount_drives = gconf_client_get_bool (config.client,
GCONF_ROOT "automount_drives", NULL);
config.automount_media = gconf_client_get_bool (config.client,
@@ -438,6 +447,8 @@
g_object_unref (icon_theme);
+ automount_static_drives_cb =
+ glade_xml_get_widget (xml, "automount_static_drives_cb");
automount_drives_cb = glade_xml_get_widget (xml, "automount_drives_cb");
automount_media_cb = glade_xml_get_widget (xml, "automount_media_cb");
autobrowse_cb = glade_xml_get_widget (xml, "autobrowse_cb");
@@ -486,6 +497,8 @@
read_config ();
+ gtk_signal_connect (GTK_OBJECT (automount_static_drives_cb), "toggled",
+ GTK_SIGNAL_FUNC (signal_response), NULL);
gtk_signal_connect (GTK_OBJECT (automount_drives_cb), "toggled",
GTK_SIGNAL_FUNC (signal_response), NULL);
gtk_signal_connect (GTK_OBJECT (automount_media_cb), "toggled",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]