diff options
author | Alexander Larsson <alexl@redhat.com> | 2003-06-27 15:14:22 +0000 |
---|---|---|
committer | Alexander Larsson <alexl@src.gnome.org> | 2003-06-27 15:14:22 +0000 |
commit | 0f758600b3f03bd7765d642647da9825c3f4e591 (patch) | |
tree | fe667a2a424b82d90f37f163201d16ac7c69c2ba /libnautilus-private | |
parent | c2083b09fd202ea913ad3cd4a3ee299713767cf2 (diff) | |
download | nautilus-0f758600b3f03bd7765d642647da9825c3f4e591.tar.gz |
This is based on a patch by Jürg Billeter <j@bitron.ch> which was partly
2003-06-27 Alexander Larsson <alexl@redhat.com>
This is based on a patch by Jürg Billeter <j@bitron.ch> which was
partly based on a patch by Wolfgang Pichler <madmin@dialog-telekom.at>.
* components/tree/nautilus-tree-model.[ch]:
Support multiple roots. New row_loaded signal that gets fired when a
directory has been fully loaded. New font-weight column.
* components/tree/nautilus-tree-view.c:
Remove tree expansion.
Populate multiple roots: ~/, / and mounted removable media.
Tree follows view uri.
* libnautilus-private/nautilus-desktop-link-monitor.c:
(create_volume_link), (nautilus_desktop_link_monitor_init),
(desktop_link_monitor_finalize):
Kill black_list, its moved to nautilus-volume-manager.
* libnautilus-private/nautilus-desktop-link.c:
(nautilus_desktop_link_new_from_volume):
Move get_icon_for_volume to nautilus-volume-manager
* libnautilus-private/nautilus-tree-view-drag-dest.c:
(file_for_path), (get_drop_target):
Handle NULL for root_uri, meaning drops on the background
are not allowed.
* libnautilus-private/nautilus-volume-monitor.[ch]:
(nautilus_volume_get_icon),
(nautilus_volume_is_in_removable_blacklist):
Add get_icon and the removable media blacklist.
Diffstat (limited to 'libnautilus-private')
-rw-r--r-- | libnautilus-private/nautilus-desktop-link-monitor.c | 30 | ||||
-rw-r--r-- | libnautilus-private/nautilus-desktop-link.c | 48 | ||||
-rw-r--r-- | libnautilus-private/nautilus-tree-view-drag-dest.c | 11 | ||||
-rw-r--r-- | libnautilus-private/nautilus-volume-monitor.c | 69 | ||||
-rw-r--r-- | libnautilus-private/nautilus-volume-monitor.h | 3 |
5 files changed, 82 insertions, 79 deletions
diff --git a/libnautilus-private/nautilus-desktop-link-monitor.c b/libnautilus-private/nautilus-desktop-link-monitor.c index 15b154772..da3fb979f 100644 --- a/libnautilus-private/nautilus-desktop-link-monitor.c +++ b/libnautilus-private/nautilus-desktop-link-monitor.c @@ -49,8 +49,6 @@ struct NautilusDesktopLinkMonitorDetails { NautilusDesktopLink *trash_link; GList *volume_links; - - GList *mount_black_list; }; @@ -112,23 +110,6 @@ nautilus_desktop_link_monitor_delete_link (NautilusDesktopLinkMonitor *monitor, static gboolean -volume_in_black_list (NautilusDesktopLinkMonitor *monitor, - const NautilusVolume *volume) -{ - GList *p; - - g_return_val_if_fail (NAUTILUS_IS_DESKTOP_LINK_MONITOR (monitor), TRUE); - - for (p = monitor->details->mount_black_list; p != NULL; p = p->next) { - if (strcmp ((char *) p->data, nautilus_volume_get_mount_path (volume)) == 0) { - return TRUE; - } - } - - return FALSE; -} - -static gboolean volume_name_exists (NautilusDesktopLinkMonitor *monitor, const char *name) { @@ -155,7 +136,7 @@ create_volume_link (NautilusDesktopLinkMonitor *monitor, char *unique_name; int index; - if (volume_in_black_list (monitor, volume)) { + if (nautilus_volume_is_in_removable_blacklist (volume)) { return; } @@ -273,17 +254,11 @@ static void nautilus_desktop_link_monitor_init (gpointer object, gpointer klass) { NautilusDesktopLinkMonitor *monitor; - GList *list; monitor = NAUTILUS_DESKTOP_LINK_MONITOR (object); monitor->details = g_new0 (NautilusDesktopLinkMonitorDetails, 1); - /* Set up default mount black list */ - list = g_list_prepend (NULL, g_strdup ("/proc")); - list = g_list_prepend (list, g_strdup ("/boot")); - monitor->details->mount_black_list = list; - /* We keep around a ref to the desktop dir */ monitor->details->desktop_dir = nautilus_directory_get (EEL_DESKTOP_URI); @@ -338,9 +313,6 @@ desktop_link_monitor_finalize (GObject *object) nautilus_directory_unref (monitor->details->desktop_dir); monitor->details->desktop_dir = NULL; - eel_g_list_free_deep (monitor->details->mount_black_list); - monitor->details->mount_black_list = NULL; - eel_preferences_remove_callback (NAUTILUS_PREFERENCES_DESKTOP_HOME_VISIBLE, desktop_home_visible_changed, monitor); diff --git a/libnautilus-private/nautilus-desktop-link.c b/libnautilus-private/nautilus-desktop-link.c index 66eaa3a0b..e1ec5635e 100644 --- a/libnautilus-private/nautilus-desktop-link.c +++ b/libnautilus-private/nautilus-desktop-link.c @@ -161,52 +161,6 @@ nautilus_desktop_link_new (NautilusDesktopLinkType type) return link; } -static char * -get_icon_for_volume (const NautilusVolume *volume) -{ - char *icon_name; - - icon_name = "gnome-dev-harddisk"; - switch (nautilus_volume_get_device_type (volume)) { - case NAUTILUS_DEVICE_AUDIO_CD: - case NAUTILUS_DEVICE_CDROM_DRIVE: - icon_name = "gnome-dev-cdrom"; - break; - - case NAUTILUS_DEVICE_FLOPPY_DRIVE: - icon_name = "gnome-dev-floppy"; - break; - - case NAUTILUS_DEVICE_JAZ_DRIVE: - icon_name = "gnome-dev-jazdisk"; - break; - - case NAUTILUS_DEVICE_MEMORY_STICK: - icon_name = "gnome-dev-memory"; - break; - - case NAUTILUS_DEVICE_NFS: - icon_name = "gnome-fs-nfs"; - break; - - case NAUTILUS_DEVICE_SMB: - icon_name = "gnome-fs-smb"; - break; - - case NAUTILUS_DEVICE_ZIP_DRIVE: - icon_name = "gnome-dev-zipdisk"; - break; - - case NAUTILUS_DEVICE_APPLE: - case NAUTILUS_DEVICE_WINDOWS: - case NAUTILUS_DEVICE_CAMERA: - case NAUTILUS_DEVICE_UNKNOWN: - break; - } - - return g_strdup (icon_name); -} - NautilusDesktopLink * nautilus_desktop_link_new_from_volume (const NautilusVolume *volume) { @@ -239,7 +193,7 @@ nautilus_desktop_link_new_from_volume (const NautilusVolume *volume) link->details->display_name = nautilus_volume_get_name (volume); link->details->activation_uri = nautilus_volume_get_target_uri (volume); - link->details->icon = get_icon_for_volume (volume); + link->details->icon = nautilus_volume_get_icon (volume); create_icon_file (link); diff --git a/libnautilus-private/nautilus-tree-view-drag-dest.c b/libnautilus-private/nautilus-tree-view-drag-dest.c index b75b58400..acdc99e8e 100644 --- a/libnautilus-private/nautilus-tree-view-drag-dest.c +++ b/libnautilus-private/nautilus-tree-view-drag-dest.c @@ -254,8 +254,11 @@ file_for_path (NautilusTreeViewDragDest *dest, GtkTreePath *path) g_signal_emit (dest, signals[GET_FILE_FOR_PATH], 0, path, &file); } else { uri = get_root_uri (dest); - - file = nautilus_file_get (uri); + + file = NULL; + if (uri != NULL) { + file = nautilus_file_get (uri); + } g_free (uri); } @@ -302,6 +305,10 @@ get_drop_target (NautilusTreeViewDragDest *dest, char *target; file = file_for_path (dest, path); + if (file == NULL) { + return NULL; + } + target = nautilus_file_get_drop_target_uri (file); nautilus_file_unref (file); diff --git a/libnautilus-private/nautilus-volume-monitor.c b/libnautilus-private/nautilus-volume-monitor.c index 0eabca6b7..f3c7b50f2 100644 --- a/libnautilus-private/nautilus-volume-monitor.c +++ b/libnautilus-private/nautilus-volume-monitor.c @@ -834,6 +834,52 @@ nautilus_volume_get_name (const NautilusVolume *volume) } +char * +nautilus_volume_get_icon (const NautilusVolume *volume) +{ + char *icon_name; + + icon_name = "gnome-dev-harddisk"; + switch (nautilus_volume_get_device_type (volume)) { + case NAUTILUS_DEVICE_AUDIO_CD: + case NAUTILUS_DEVICE_CDROM_DRIVE: + icon_name = "gnome-dev-cdrom"; + break; + + case NAUTILUS_DEVICE_FLOPPY_DRIVE: + icon_name = "gnome-dev-floppy"; + break; + + case NAUTILUS_DEVICE_JAZ_DRIVE: + icon_name = "gnome-dev-jazdisk"; + break; + + case NAUTILUS_DEVICE_MEMORY_STICK: + icon_name = "gnome-dev-memory"; + break; + + case NAUTILUS_DEVICE_NFS: + icon_name = "gnome-fs-nfs"; + break; + + case NAUTILUS_DEVICE_SMB: + icon_name = "gnome-fs-smb"; + break; + + case NAUTILUS_DEVICE_ZIP_DRIVE: + icon_name = "gnome-dev-zipdisk"; + break; + + case NAUTILUS_DEVICE_APPLE: + case NAUTILUS_DEVICE_WINDOWS: + case NAUTILUS_DEVICE_CAMERA: + case NAUTILUS_DEVICE_UNKNOWN: + break; + } + + return g_strdup (icon_name); +} + /* modify_volume_name_for_display * * Modify volume to be in human readable form @@ -2172,6 +2218,29 @@ nautilus_volume_monitor_get_mount_name_for_display (NautilusVolumeMonitor *monit } } +/* + * HORRORS OF HORROR. + * This really should be fixed to not be needed (if it is?). + * I just moved it from the desktop icon code so it can be shared + * between the desktop icons and the sidebar tree. +*/ + +gboolean +nautilus_volume_is_in_removable_blacklist (const NautilusVolume *volume) +{ + char *blacklist[] = { "/proc", "/boot" }; + int i; + + for (i = 0; i < G_N_ELEMENTS (blacklist); i++) { + if (strcmp (blacklist[i], nautilus_volume_get_mount_path (volume)) == 0) { + return TRUE; + } + } + + return FALSE; +} + + #ifdef HAVE_CDDA static gboolean diff --git a/libnautilus-private/nautilus-volume-monitor.h b/libnautilus-private/nautilus-volume-monitor.h index 92c35d3ce..c827fbc5d 100644 --- a/libnautilus-private/nautilus-volume-monitor.h +++ b/libnautilus-private/nautilus-volume-monitor.h @@ -96,6 +96,7 @@ NautilusVolume *nautilus_volume_monitor_get_volume_for_path (Nau /* Volume operations. */ char * nautilus_volume_get_name (const NautilusVolume *volume); +char * nautilus_volume_get_icon (const NautilusVolume *volume); NautilusDeviceType nautilus_volume_get_device_type (const NautilusVolume *volume); gboolean nautilus_volume_is_removable (const NautilusVolume *volume); gboolean nautilus_volume_is_read_only (const NautilusVolume *volume); @@ -109,6 +110,6 @@ void nautilus_volume_free (Nau guint nautilus_volume_hash (const NautilusVolume *volume); gboolean nautilus_volume_is_equal (const NautilusVolume *volume1, const NautilusVolume *volume2); - +gboolean nautilus_volume_is_in_removable_blacklist (const NautilusVolume *volume); #endif /* NAUTILUS_VOLUME_MONITOR_H */ |