[Nautilus-list] Patch to add a 'monitor cdrom mounts' preference option
- From: Benedikt Roth <Benedikt Roth gmx net>
- To: nautilus-list lists eazel com
- Subject: [Nautilus-list] Patch to add a 'monitor cdrom mounts' preference option
- Date: Wed, 22 Aug 2001 15:49:49 +0200
Hi!
I made this patch to be able to disable nautilus to open a new window
when I mount a cdrom. I don't use magicdev and I think this is the wrong
place to look for such an option.
I'm not sure if the phrasing is perfect but I think it's a usefull change.
Regards,
Benedikt
? nautilus-monitor-cdrom-mounts.patch
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.4726
diff -p -u -r1.4726 ChangeLog
--- ChangeLog 2001/08/20 05:44:47 1.4726
+++ ChangeLog 2001/08/21 17:07:10
@@ -1,3 +1,16 @@
+2001-08-21 Benedikt Roth <Benedikt Roth gmx net>
+
+ * libnautilus-private/nautilus-global-preferences.c:
+ * libnautilus-private/nautilus-global-preferences.h:
+ * src/nautilus-application.c: (volume_mounted_callback),
+ (volume_unmounted_callback):
+ * src/nautilus-preferences-dialog.c:
+ Replaced check for magicdev configuration to check whether to open a
+ new window when a cdrom gets mounted with a new preference option
+ NAUTILUS_PREFERENCES_MONITOR_CDROM_MOUNTS
+ Added preference check whether to close existing windows if a cdrom
+ gets unmounted
+
2001-08-19 Maciej Stachowiak <mjs noisehavoc org>
* components/music/nautilus-music-view.c: (get_cell_text),
Index: libnautilus-private/nautilus-global-preferences.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-global-preferences.c,v
retrieving revision 1.173
diff -p -u -r1.173 nautilus-global-preferences.c
--- libnautilus-private/nautilus-global-preferences.c 2001/07/01 17:48:08 1.173
+++ libnautilus-private/nautilus-global-preferences.c 2001/08/21 17:07:18
@@ -252,7 +252,8 @@ typedef struct
/* The following table defines the default values and user level visibilities of
* Nautilus preferences. Each of these preferences does not necessarily need to
* have a UI item in the preferences dialog. To add an item to the preferences
- * dialog, see the NautilusPreferencesItemDescription tables later in this file.
+ * dialog, see the EelPreferencesItemDescription
+ * tables in src/nautilus-preferences-dialog.c.
*
* Field definitions:
*
@@ -463,6 +464,12 @@ static const PreferenceDefault preferenc
PREFERENCE_BOOLEAN,
EEL_USER_LEVEL_INTERMEDIATE,
{ EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (FALSE) },
+ { USER_LEVEL_NONE }
+ },
+ { NAUTILUS_PREFERENCES_MONITOR_CDROM_MOUNTS,
+ PREFERENCE_BOOLEAN,
+ EEL_USER_LEVEL_ADVANCED,
+ { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (TRUE) },
{ USER_LEVEL_NONE }
},
{ NAUTILUS_PREFERENCES_USE_EMACS_SHORTCUTS,
Index: libnautilus-private/nautilus-global-preferences.h
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-global-preferences.h,v
retrieving revision 1.97
diff -p -u -r1.97 nautilus-global-preferences.h
--- libnautilus-private/nautilus-global-preferences.h 2001/05/04 10:17:53 1.97
+++ libnautilus-private/nautilus-global-preferences.h 2001/08/21 17:07:19
@@ -60,6 +60,7 @@ BEGIN_GNOME_DECLS
/* Navigation */
#define NAUTILUS_PREFERENCES_HOME_URI "preferences/home_uri"
+#define NAUTILUS_PREFERENCES_MONITOR_CDROM_MOUNTS "preferences/monitor_cdrom_mounts"
#define NAUTILUS_PREFERENCES_HIDE_BUILT_IN_BOOKMARKS "preferences/hide_built_in_bookmarks"
/* Proxy */
Index: src/nautilus-application.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-application.c,v
retrieving revision 1.158
diff -p -u -r1.158 nautilus-application.c
--- src/nautilus-application.c 2001/08/15 21:04:00 1.158
+++ src/nautilus-application.c 2001/08/21 17:07:19
@@ -830,8 +830,8 @@ volume_mounted_callback (NautilusVolumeM
}
/* Open a window to the CD if the user has set that preference. */
- if (nautilus_volume_get_device_type (volume) == NAUTILUS_DEVICE_CDROM_DRIVE
- && gnome_config_get_bool ("/magicdev/Options/do_fileman_window=true")) {
+ if (nautilus_volume_get_device_type (volume) == NAUTILUS_DEVICE_CDROM_DRIVE
+ && eel_preferences_get_boolean (NAUTILUS_PREFERENCES_MONITOR_CDROM_MOUNTS)) {
window = nautilus_application_create_window (application);
uri = gnome_vfs_get_uri_from_local_path (nautilus_volume_get_mount_path (volume));
nautilus_window_go_to (window, uri);
@@ -890,7 +890,9 @@ volume_unmounted_callback (NautilusVolum
if (window != NULL && window_can_be_closed (window)) {
uri = nautilus_window_get_location (window);
path = gnome_vfs_get_local_path_from_uri (uri);
- if (eel_str_has_prefix (path, nautilus_volume_get_mount_path (volume))) {
+ if (eel_str_has_prefix (path, nautilus_volume_get_mount_path (volume))
+ && nautilus_volume_get_device_type (volume) == NAUTILUS_DEVICE_CDROM_DRIVE
+ && eel_preferences_get_boolean (NAUTILUS_PREFERENCES_MONITOR_CDROM_MOUNTS)) {
close_list = g_list_prepend (close_list, window);
}
g_free (path);
@@ -902,7 +904,7 @@ volume_unmounted_callback (NautilusVolum
for (node = close_list; node != NULL; node = node->next) {
window = NAUTILUS_WINDOW (node->data);
if (is_last_closable_window (window)) {
- /* Don't close the last or only window. Try to redirect to the default home directory. */
+ /* Don't close the last or only window. Try to redirect to the default home directory. */
nautilus_window_go_home (window);
} else {
nautilus_window_close (window);
Index: src/nautilus-preferences-dialog.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-preferences-dialog.c,v
retrieving revision 1.9
diff -p -u -r1.9 nautilus-preferences-dialog.c
--- src/nautilus-preferences-dialog.c 2001/05/04 10:18:35 1.9
+++ src/nautilus-preferences-dialog.c 2001/08/21 17:07:19
@@ -334,6 +334,11 @@ static EelPreferencesItemDescription nav
N_("Don't include the built-in bookmarks in the Bookmarks menu"),
EEL_PREFERENCE_ITEM_BOOLEAN
},
+ { N_("Monitor CDROM mounts"),
+ NAUTILUS_PREFERENCES_MONITOR_CDROM_MOUNTS,
+ N_("Open/close a window to a cdrom when it gets mounted/unmounted"),
+ EEL_PREFERENCE_ITEM_BOOLEAN
+ },
{ NULL }
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]