1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
--- libnautilus-private/apps_nautilus_preferences.schemas.in 20 Feb 2004 10:33:46 -0000
+++ libnautilus-private/apps_nautilus_preferences.schemas.in 6 May 2004 06:37:07 -0000
@@ -808,6 +808,21 @@
</schema>
<schema>
+ <key>/schemas/apps/nautilus/desktop/volumes_visible</key>
+ <applyto>/apps/nautilus/desktop/volumes_visible</applyto>
+ <owner>nautilus</owner>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short>Show mounted volumes on the desktop</short>
+ <long>
+ If this is set to true, icons linking to mounted
+ volumes will be put on the desktop.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/nautilus/desktop/home_icon_name</key>
<applyto>/apps/nautilus/desktop/home_icon_name</applyto>
<owner>nautilus</owner>
--- libnautilus-private/nautilus-desktop-link-monitor.c 12 Dec 2003 19:07:17 -0000 1.9
+++ libnautilus-private/nautilus-desktop-link-monitor.c 6 May 2004 06:37:08 -0000
@@ -116,13 +116,18 @@ create_volume_link (NautilusDesktopLinkM
GnomeVFSVolume *volume)
{
NautilusDesktopLink *link;
-
+
+ link = NULL;
+
if (!gnome_vfs_volume_is_user_visible (volume)) {
return;
}
- link = nautilus_desktop_link_new_from_volume (volume);
- monitor->details->volume_links = g_list_prepend (monitor->details->volume_links, link);
+ if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_DESKTOP_VOLUMES_VISIBLE)) {
+ link = nautilus_desktop_link_new_from_volume (volume);
+ monitor->details->volume_links = g_list_prepend (monitor->details->volume_links, link);
+ }
+
}
@@ -221,6 +226,30 @@ desktop_trash_visible_changed (gpointer
}
static void
+desktop_volumes_visible_changed (gpointer callback_data)
+{
+ GnomeVFSVolumeMonitor *volume_monitor;
+ NautilusDesktopLinkMonitor *monitor;
+ GList *l, *volumes;
+
+ volume_monitor = gnome_vfs_get_volume_monitor ();
+ monitor = NAUTILUS_DESKTOP_LINK_MONITOR (callback_data);
+
+ if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_DESKTOP_VOLUMES_VISIBLE) && monitor->details->volume_links == NULL) {
+ volumes = gnome_vfs_volume_monitor_get_mounted_volumes (volume_monitor);
+ for (l = volumes; l != NULL; l = l->next) {
+ create_volume_link (monitor, l->data);
+ gnome_vfs_volume_unref (l->data);
+ }
+ g_list_free (volumes);
+ } else {
+ g_list_foreach (monitor->details->volume_links, (GFunc)g_object_unref, NULL);
+ g_list_free (monitor->details->volume_links);
+ monitor->details->volume_links = NULL;
+ }
+}
+
+static void
nautilus_desktop_link_monitor_init (gpointer object, gpointer klass)
{
NautilusDesktopLinkMonitor *monitor;
@@ -248,6 +277,7 @@ nautilus_desktop_link_monitor_init (gpoi
}
volume_monitor = gnome_vfs_get_volume_monitor ();
+
volumes = gnome_vfs_volume_monitor_get_mounted_volumes (volume_monitor);
for (l = volumes; l != NULL; l = l->next) {
volume = l->data;
@@ -265,8 +295,10 @@ nautilus_desktop_link_monitor_init (gpoi
eel_preferences_add_callback (NAUTILUS_PREFERENCES_DESKTOP_TRASH_VISIBLE,
desktop_trash_visible_changed,
monitor);
+ eel_preferences_add_callback (NAUTILUS_PREFERENCES_DESKTOP_VOLUMES_VISIBLE,
+ desktop_volumes_visible_changed,
+ monitor);
-
monitor->details->mount_id = g_signal_connect_object (volume_monitor, "volume_mounted",
G_CALLBACK (volume_mounted_callback), monitor, 0);
monitor->details->unmount_id = g_signal_connect_object (volume_monitor, "volume_unmounted",
@@ -311,6 +343,9 @@ desktop_link_monitor_finalize (GObject *
monitor);
eel_preferences_remove_callback (NAUTILUS_PREFERENCES_DESKTOP_TRASH_VISIBLE,
desktop_trash_visible_changed,
+ monitor);
+ eel_preferences_remove_callback (NAUTILUS_PREFERENCES_DESKTOP_VOLUMES_VISIBLE,
+ desktop_volumes_visible_changed,
monitor);
if (monitor->details->mount_id != 0) {
--- libnautilus-private/nautilus-global-preferences.h 20 Feb 2004 10:33:49 -0000 1.122
+++ libnautilus-private/nautilus-global-preferences.h 6 May 2004 06:37:08 -0000
@@ -177,6 +177,7 @@ typedef enum
#define NAUTILUS_PREFERENCES_DESKTOP_COMPUTER_NAME "desktop/computer_icon_name"
#define NAUTILUS_PREFERENCES_DESKTOP_TRASH_VISIBLE "desktop/trash_icon_visible"
#define NAUTILUS_PREFERENCES_DESKTOP_TRASH_NAME "desktop/trash_icon_name"
+#define NAUTILUS_PREFERENCES_DESKTOP_VOLUMES_VISIBLE "desktop/volumes_visible"
void nautilus_global_preferences_init (void);
void nautilus_global_preferences_init_with_folder_browsing (void);
|