Commit 3613a86b authored by Alexander Larsson's avatar Alexander Larsson Committed by Alexander Larsson

Require new gnome-vfs

2003-11-05  Alexander Larsson  <alexl@redhat.com>

	* configure.in:
	Require new gnome-vfs

	* components/tree/nautilus-tree-view.c:
	* libnautilus-private/nautilus-desktop-link-monitor.c:
	* libnautilus-private/nautilus-desktop-link.[ch]:
	* libnautilus-private/nautilus-monitor.c:
	* libnautilus-private/nautilus-trash-directory.c:
	* libnautilus-private/nautilus-trash-monitor.[ch]:
	* src/nautilus-application.c:
	Use gnome-vfs-volume-manager instead of nautilus-volume-manager.c

	* libnautilus-private/nautilus-desktop-icon-file.c:
	Set the volume on the nautilusfile

	* libnautilus-private/nautilus-directory-async.c:
	Load volume info from link

	* libnautilus-private/nautilus-file-attributes.h:
	* libnautilus-private/nautilus-mime-actions.c:
	Add new VOLUMES attribute

	* libnautilus-private/nautilus-file-private.h:
	Add has_volume and has_drive to NautilusFile

	* libnautilus-private/nautilus-file.[ch]:
	Add has_volume and has_drive to NautilusFile
	Volumes/drives are sorted separately

	* libnautilus-private/nautilus-link-desktop-file.[ch]:
	* libnautilus-private/nautilus-link.[ch]:
	Read drive and volume id from links

	* src/file-manager/fm-desktop-icon-view.c:
	* src/file-manager/nautilus-desktop-icon-view-ui.xml:
	Remove volume ops. Remove disks menu

	* src/file-manager/fm-directory-view.c:
	* src/file-manager/nautilus-directory-view-ui.xml:
	Implement volume ops using gnome-vfs

	* src/file-manager/fm-properties-window.c:
	Handle drives/volumes

	* src/nautilus-window.c:
	Make a nicer title for some specific locations

	* libnautilus-private/nautilus-volume-monitor.[ch]:
	* libnautilus-private/Makefile.am
	remove this old crap
parent fb27d908
2003-11-05 Alexander Larsson <alexl@redhat.com>
* configure.in:
Require new gnome-vfs
* components/tree/nautilus-tree-view.c:
* libnautilus-private/nautilus-desktop-link-monitor.c:
* libnautilus-private/nautilus-desktop-link.[ch]:
* libnautilus-private/nautilus-monitor.c:
* libnautilus-private/nautilus-trash-directory.c:
* libnautilus-private/nautilus-trash-monitor.[ch]:
* src/nautilus-application.c:
Use gnome-vfs-volume-manager instead of nautilus-volume-manager.c
* libnautilus-private/nautilus-desktop-icon-file.c:
Set the volume on the nautilusfile
* libnautilus-private/nautilus-directory-async.c:
Load volume info from link
* libnautilus-private/nautilus-file-attributes.h:
* libnautilus-private/nautilus-mime-actions.c:
Add new VOLUMES attribute
* libnautilus-private/nautilus-file-private.h:
Add has_volume and has_drive to NautilusFile
* libnautilus-private/nautilus-file.[ch]:
Add has_volume and has_drive to NautilusFile
Volumes/drives are sorted separately
* libnautilus-private/nautilus-link-desktop-file.[ch]:
* libnautilus-private/nautilus-link.[ch]:
Read drive and volume id from links
* src/file-manager/fm-desktop-icon-view.c:
* src/file-manager/nautilus-desktop-icon-view-ui.xml:
Remove volume ops. Remove disks menu
* src/file-manager/fm-directory-view.c:
* src/file-manager/nautilus-directory-view-ui.xml:
Implement volume ops using gnome-vfs
* src/file-manager/fm-properties-window.c:
Handle drives/volumes
* src/nautilus-window.c:
Make a nicer title for some specific locations
* libnautilus-private/nautilus-volume-monitor.[ch]:
* libnautilus-private/Makefile.am
remove this old crap
2003-11-03 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-bonobo-extensions.h:
......
......@@ -44,13 +44,13 @@
#include <gtk/gtktreeview.h>
#include <libgnome/gnome-i18n.h>
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libgnomevfs/gnome-vfs-volume-monitor.h>
#include <libnautilus-private/nautilus-file-attributes.h>
#include <libnautilus-private/nautilus-file-operations.h>
#include <libnautilus-private/nautilus-global-preferences.h>
#include <libnautilus-private/nautilus-program-choosing.h>
#include <libnautilus-private/nautilus-tree-view-drag-dest.h>
#include <libnautilus-private/nautilus-icon-factory.h>
#include <libnautilus-private/nautilus-volume-monitor.h>
struct NautilusTreeViewDetails {
GtkWidget *scrolled_window;
......@@ -463,23 +463,17 @@ theme_changed_callback (GObject *icon_factory, gpointer callback_data)
static void
add_root_for_volume (NautilusTreeView *view,
const NautilusVolume *volume)
GnomeVFSVolume *volume)
{
char *icon, *mount_uri, *name;
if (nautilus_volume_is_in_removable_blacklist (volume)) {
return;
}
if (!nautilus_volume_is_removable (volume)) {
if (!gnome_vfs_volume_is_user_visible (volume)) {
return;
}
/* Name uniqueness is handled by nautilus-desktop-link-monitor.c... */
icon = nautilus_volume_get_icon (volume);
mount_uri = nautilus_volume_get_target_uri (volume);
name = nautilus_volume_get_name (volume);
icon = gnome_vfs_volume_get_icon (volume);
mount_uri = gnome_vfs_volume_get_activation_uri (volume);
name = gnome_vfs_volume_get_display_name (volume);
nautilus_tree_model_add_root_uri (view->details->child_model,
mount_uri, name, icon);
......@@ -491,29 +485,21 @@ add_root_for_volume (NautilusTreeView *view,
}
static void
volume_mounted_callback (NautilusVolumeMonitor *volume_monitor,
NautilusVolume *volume,
volume_mounted_callback (GnomeVFSVolumeMonitor *volume_monitor,
GnomeVFSVolume *volume,
NautilusTreeView *view)
{
add_root_for_volume (view, volume);
}
static gboolean
add_one_volume_root (const NautilusVolume *volume, gpointer callback_data)
{
add_root_for_volume (NAUTILUS_TREE_VIEW (callback_data), volume);
return TRUE;
}
static void
volume_unmounted_callback (NautilusVolumeMonitor *volume_monitor,
NautilusVolume *volume,
volume_unmounted_callback (GnomeVFSVolumeMonitor *volume_monitor,
GnomeVFSVolume *volume,
NautilusTreeView *view)
{
char *mount_uri;
mount_uri = nautilus_volume_get_target_uri (volume);
mount_uri = gnome_vfs_volume_get_activation_uri (volume);
nautilus_tree_model_remove_root_uri (view->details->child_model,
mount_uri);
g_free (mount_uri);
......@@ -525,8 +511,9 @@ create_tree (NautilusTreeView *view)
{
GtkCellRenderer *cell;
GtkTreeViewColumn *column;
NautilusVolumeMonitor *volume_monitor;
GnomeVFSVolumeMonitor *volume_monitor;
char *home_uri;
GList *volumes, *l;
view->details->child_model = nautilus_tree_model_new ();
view->details->sort_model = GTK_TREE_MODEL_SORT
......@@ -546,10 +533,13 @@ create_tree (NautilusTreeView *view)
nautilus_tree_model_add_root_uri (view->details->child_model, "network:///", _("Network Neighbourhood"), "gnome-fs-network");
#endif
volume_monitor = nautilus_volume_monitor_get ();
nautilus_volume_monitor_each_mounted_volume (volume_monitor,
add_one_volume_root,
view);
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) {
add_root_for_volume (view, l->data);
gnome_vfs_volume_unref (l->data);
}
g_list_free (volumes);
g_signal_connect_object (volume_monitor, "volume_mounted",
G_CALLBACK (volume_mounted_callback), view, 0);
......
......@@ -12,7 +12,7 @@ GLIB_REQUIRED=2
GNOME_DESKTOP_REQUIRED=2.1.0
GNOME_REQUIRED=2.1.1
GNOME_UI_REQUIRED=2.3.3
GNOME_VFS_REQUIRED=2.3.5
GNOME_VFS_REQUIRED=2.5.0
ORBIT_REQUIRED=2.4.0
PANGO_REQUIRED=1.1.2
GTK_REQUIRED=2.1.1
......
......@@ -176,8 +176,6 @@ libnautilus_private_la_SOURCES = \
nautilus-vfs-file.h \
nautilus-view-identifier.c \
nautilus-view-identifier.h \
nautilus-volume-monitor.c \
nautilus-volume-monitor.h \
$(NULL)
fsattributesdir = $(datadir)/nautilus
......
......@@ -179,6 +179,7 @@ update_info_from_link (NautilusDesktopIconFile *icon_file)
NautilusFile *file;
GnomeVFSFileInfo *file_info;
NautilusDesktopLink *link;
GnomeVFSVolume *volume;
file = NAUTILUS_FILE (icon_file);
......@@ -204,6 +205,10 @@ update_info_from_link (NautilusDesktopIconFile *icon_file)
GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE |
GNOME_VFS_FILE_INFO_FIELDS_SIZE |
GNOME_VFS_FILE_INFO_FIELDS_LINK_COUNT;
volume = nautilus_desktop_link_get_volume (link);
nautilus_file_set_volume (file, volume);
gnome_vfs_volume_unref (volume);
file->details->file_info_is_up_to_date = TRUE;
......
......@@ -39,6 +39,7 @@
#include <gtk/gtkstock.h>
#include <libgnome/gnome-i18n.h>
#include <libgnomevfs/gnome-vfs.h>
#include <libgnomevfs/gnome-vfs-volume-monitor.h>
#include <libnautilus-private/nautilus-trash-monitor.h>
#include <string.h>
......@@ -48,6 +49,9 @@ struct NautilusDesktopLinkMonitorDetails {
NautilusDesktopLink *home_link;
NautilusDesktopLink *trash_link;
gulong mount_id;
gulong unmount_id;
GList *volume_links;
};
......@@ -108,76 +112,25 @@ nautilus_desktop_link_monitor_delete_link (NautilusDesktopLinkMonitor *monitor,
}
}
static gboolean
volume_name_exists (NautilusDesktopLinkMonitor *monitor,
const char *name)
{
GList *l;
char *other_name;
for (l = monitor->details->volume_links; l != NULL; l = l->next) {
other_name = nautilus_desktop_link_get_display_name (l->data);
if (strcmp (name, other_name) == 0) {
g_free (other_name);
return TRUE;
}
g_free (other_name);
}
return FALSE;
}
static void
create_volume_link (NautilusDesktopLinkMonitor *monitor,
const NautilusVolume *volume)
GnomeVFSVolume *volume)
{
NautilusDesktopLink *link;
char *volume_name;
char *unique_name;
int index;
if (nautilus_volume_is_in_removable_blacklist (volume)) {
if (!gnome_vfs_volume_is_user_visible (volume)) {
return;
}
/* FIXME bugzilla.gnome.org 45412: Design a comprehensive desktop mounting strategy */
if (!nautilus_volume_is_removable (volume)) {
return;
}
volume_name = nautilus_volume_get_name (volume);
index = 1;
unique_name = g_strdup (volume_name);
while (volume_name_exists (monitor, unique_name)) {
g_free (unique_name);
index++;
unique_name = g_strdup_printf ("%s (%d)", volume_name, index);
}
if (index != 1) {
nautilus_volume_monitor_set_volume_name (nautilus_volume_monitor_get (),
volume, unique_name);
}
g_free (volume_name);
g_free (unique_name);
link = nautilus_desktop_link_new_from_volume (volume);
monitor->details->volume_links = g_list_prepend (monitor->details->volume_links, link);
}
static gboolean
create_one_volume_link (const NautilusVolume *volume, gpointer callback_data)
{
create_volume_link (NAUTILUS_DESKTOP_LINK_MONITOR (callback_data),
volume);
return TRUE;
}
static void
volume_mounted_callback (NautilusVolumeMonitor *volume_monitor,
NautilusVolume *volume,
volume_mounted_callback (GnomeVFSVolumeMonitor *volume_monitor,
GnomeVFSVolume *volume,
NautilusDesktopLinkMonitor *monitor)
{
create_volume_link (monitor, volume);
......@@ -185,29 +138,28 @@ volume_mounted_callback (NautilusVolumeMonitor *volume_monitor,
static void
volume_unmounted_callback (NautilusVolumeMonitor *volume_monitor,
NautilusVolume *volume,
volume_unmounted_callback (GnomeVFSVolumeMonitor *volume_monitor,
GnomeVFSVolume *volume,
NautilusDesktopLinkMonitor *monitor)
{
GList *l;
NautilusDesktopLink *link;
char *mount_path;
GnomeVFSVolume *other_volume;
link = NULL;
for (l = monitor->details->volume_links; l != NULL; l = l->next) {
mount_path = nautilus_desktop_link_get_mount_path (l->data);
if (strcmp (mount_path, nautilus_volume_get_mount_path (volume)) == 0) {
other_volume = nautilus_desktop_link_get_volume (l->data);
if (volume == other_volume) {
gnome_vfs_volume_unref (other_volume);
link = l->data;
g_free (mount_path);
break;
}
g_free (mount_path);
gnome_vfs_volume_unref (other_volume);
}
if (link) {
g_object_unref (link);
monitor->details->volume_links = g_list_remove (monitor->details->volume_links, link);
g_object_unref (link);
}
}
......@@ -254,6 +206,9 @@ static void
nautilus_desktop_link_monitor_init (gpointer object, gpointer klass)
{
NautilusDesktopLinkMonitor *monitor;
GList *l, *volumes;
GnomeVFSVolume *volume;
GnomeVFSVolumeMonitor *volume_monitor;
monitor = NAUTILUS_DESKTOP_LINK_MONITOR (object);
......@@ -270,9 +225,14 @@ nautilus_desktop_link_monitor_init (gpointer object, gpointer klass)
monitor->details->trash_link = nautilus_desktop_link_new (NAUTILUS_DESKTOP_LINK_TRASH);
}
nautilus_volume_monitor_each_mounted_volume (nautilus_volume_monitor_get (),
create_one_volume_link,
monitor);
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;
create_volume_link (monitor, volume);
gnome_vfs_volume_unref (volume);
}
g_list_free (volumes);
eel_preferences_add_callback (NAUTILUS_PREFERENCES_DESKTOP_HOME_VISIBLE,
desktop_home_visible_changed,
......@@ -282,10 +242,10 @@ nautilus_desktop_link_monitor_init (gpointer object, gpointer klass)
monitor);
g_signal_connect_object (nautilus_volume_monitor_get (), "volume_mounted",
G_CALLBACK (volume_mounted_callback), monitor, 0);
g_signal_connect_object (nautilus_volume_monitor_get (), "volume_unmounted",
G_CALLBACK (volume_unmounted_callback), monitor, 0);
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",
G_CALLBACK (volume_unmounted_callback), monitor, 0);
}
......@@ -319,6 +279,13 @@ desktop_link_monitor_finalize (GObject *object)
eel_preferences_remove_callback (NAUTILUS_PREFERENCES_DESKTOP_TRASH_VISIBLE,
desktop_trash_visible_changed,
monitor);
if (monitor->details->mount_id != 0) {
g_source_remove (monitor->details->mount_id);
}
if (monitor->details->unmount_id != 0) {
g_source_remove (monitor->details->unmount_id);
}
g_free (monitor->details);
......
......@@ -53,7 +53,7 @@ struct NautilusDesktopLinkDetails {
gulong trash_state_handler;
/* Just for volume icons: */
char *mount_path;
GnomeVFSVolume *volume;
};
static void nautilus_desktop_link_init (gpointer object,
......@@ -162,49 +162,45 @@ nautilus_desktop_link_new (NautilusDesktopLinkType type)
}
NautilusDesktopLink *
nautilus_desktop_link_new_from_volume (const NautilusVolume *volume)
nautilus_desktop_link_new_from_volume (GnomeVFSVolume *volume)
{
NautilusDesktopLink *link;
const char *mount_path;
char *underscore_mount_path, *p;
GnomeVFSDrive *drive;
char *name;
link = NAUTILUS_DESKTOP_LINK (g_object_new (NAUTILUS_TYPE_DESKTOP_LINK, NULL));
link->details->type = NAUTILUS_DESKTOP_LINK_VOLUME;
mount_path = nautilus_volume_get_mount_path (volume);
link->details->mount_path = g_strdup (mount_path);
/* Convert slashes in the mount path to underscores and skip
first slash */
while (*mount_path == '/') {
mount_path ++;
}
underscore_mount_path = g_strdup (mount_path);
for (p = underscore_mount_path; *p != 0; p++) {
if (*p == '/') {
*p = '_';
}
}
link->details->volume = gnome_vfs_volume_ref (volume);
link->details->filename = g_strconcat ("mount_", underscore_mount_path, NULL);
g_free (underscore_mount_path);
/* We try to use the drive name to get somewhat stable filenames
for metadata */
drive = gnome_vfs_volume_get_drive (volume);
if (drive != NULL) {
name = gnome_vfs_drive_get_display_name (drive);
} else {
name = gnome_vfs_volume_get_display_name (volume);
}
gnome_vfs_drive_unref (drive);
link->details->display_name = nautilus_volume_get_name (volume);
link->details->filename = g_strconcat (name, ".volume", NULL);
g_free (name);
link->details->activation_uri = nautilus_volume_get_target_uri (volume);
link->details->icon = nautilus_volume_get_icon (volume);
link->details->display_name = gnome_vfs_volume_get_display_name (volume);
link->details->activation_uri = gnome_vfs_volume_get_activation_uri (volume);
link->details->icon = gnome_vfs_volume_get_icon (volume);
create_icon_file (link);
return link;
}
char *
nautilus_desktop_link_get_mount_path (NautilusDesktopLink *link)
GnomeVFSVolume *
nautilus_desktop_link_get_volume (NautilusDesktopLink *link)
{
g_assert (link->details->type == NAUTILUS_DESKTOP_LINK_VOLUME);
return g_strdup (link->details->mount_path);
return gnome_vfs_volume_ref (link->details->volume);
}
......@@ -368,7 +364,7 @@ desktop_link_finalize (GObject *object)
}
if (link->details->type == NAUTILUS_DESKTOP_LINK_VOLUME) {
g_free (link->details->mount_path);
gnome_vfs_volume_unref (link->details->volume);
}
g_free (link->details->filename);
......
......@@ -26,7 +26,7 @@
#define NAUTILUS_DESKTOP_LINK_H
#include <libnautilus-private/nautilus-file.h>
#include <libnautilus-private/nautilus-volume-monitor.h>
#include <libgnomevfs/gnome-vfs-volume.h>
#define NAUTILUS_TYPE_DESKTOP_LINK \
(nautilus_desktop_link_get_type ())
......@@ -59,7 +59,7 @@ typedef enum {
GType nautilus_desktop_link_get_type (void);
NautilusDesktopLink * nautilus_desktop_link_new (NautilusDesktopLinkType type);
NautilusDesktopLink * nautilus_desktop_link_new_from_volume (const NautilusVolume *volume);
NautilusDesktopLink * nautilus_desktop_link_new_from_volume (GnomeVFSVolume *volume);
NautilusDesktopLinkType nautilus_desktop_link_get_link_type (NautilusDesktopLink *link);
char * nautilus_desktop_link_get_file_name (NautilusDesktopLink *link);
char * nautilus_desktop_link_get_display_name (NautilusDesktopLink *link);
......@@ -68,7 +68,7 @@ char * nautilus_desktop_link_get_activation_uri (NautilusDeskto
gboolean nautilus_desktop_link_get_date (NautilusDesktopLink *link,
NautilusDateType date_type,
time_t *date);
char * nautilus_desktop_link_get_mount_path (NautilusDesktopLink *link);
GnomeVFSVolume * nautilus_desktop_link_get_volume (NautilusDesktopLink *link);
gboolean nautilus_desktop_link_can_rename (NautilusDesktopLink *link);
gboolean nautilus_desktop_link_rename (NautilusDesktopLink *link,
......
......@@ -40,6 +40,7 @@
#include <libgnomevfs/gnome-vfs-ops.h>
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libgnomevfs/gnome-vfs-mime-monitor.h>
#include <libgnomevfs/gnome-vfs-volume-monitor.h>
#include <libxml/parser.h>
#include <stdio.h>
#include <stdlib.h>
......@@ -119,7 +120,9 @@ static void link_info_done (NautilusDirectory *directory,
NautilusFile *file,
const char *uri,
const char *name,
const char *icon);
const char *icon,
gulong drive_id,
gulong volume_id);
static gboolean file_needs_high_priority_work_done (NautilusDirectory *directory,
NautilusFile *file);
static gboolean file_needs_low_priority_work_done (NautilusDirectory *directory,
......@@ -539,6 +542,10 @@ nautilus_directory_set_up_request (Request *request,
request->file_info = TRUE;
request->link_info = TRUE;
}
if (file_attributes & NAUTILUS_FILE_ATTRIBUTE_VOLUMES) {
request->link_info = TRUE;
}
if (file_attributes & NAUTILUS_FILE_ATTRIBUTE_DISPLAY_NAME) {
request->file_info = TRUE;
......@@ -1727,7 +1734,7 @@ lacks_link_info (NautilusFile *file)
should_look_for_dot_directory_file (file)) {
return TRUE;
} else {
link_info_done (file->details->directory, file, NULL, NULL, NULL);
link_info_done (file->details->directory, file, NULL, NULL, NULL, 0, 0);
return FALSE;
}
} else {
......@@ -2887,8 +2894,14 @@ link_info_done (NautilusDirectory *directory,
NautilusFile *file,
const char *uri,
const char *name,
const char *icon)
const char *icon,
gulong drive_id,
gulong volume_id)
{
GnomeVFSVolumeMonitor *monitor;
GnomeVFSVolume *volume;
GnomeVFSDrive *drive;
file->details->link_info_is_up_to_date = TRUE;
file->details->got_link_info = TRUE;
......@@ -2900,6 +2913,22 @@ link_info_done (NautilusDirectory *directory,
file->details->custom_icon = g_strdup (icon);
nautilus_file_clear_cached_display_name (file);
volume = NULL;
if (volume_id != 0) {
monitor = gnome_vfs_get_volume_monitor ();
volume = gnome_vfs_volume_monitor_get_volume_by_id (monitor, volume_id);
}
nautilus_file_set_volume (file, volume);
gnome_vfs_volume_unref (volume);
drive = NULL;
if (drive_id != 0) {
monitor = gnome_vfs_get_volume_monitor ();
drive = gnome_vfs_volume_monitor_get_drive_by_id (monitor, drive_id);
}
nautilus_file_set_drive (file, drive);
gnome_vfs_drive_unref (drive);
nautilus_directory_async_state_changed (directory);
}
......@@ -2914,7 +2943,9 @@ static void
link_info_read_done (NautilusDirectory *directory,
const char *uri,
const char *name,
const char *icon)
const char *icon,
gulong drive_id,
gulong volume_id)
{
NautilusFile *file;
......@@ -2923,7 +2954,7 @@ link_info_read_done (NautilusDirectory *directory,
directory->details->link_info_read_state = NULL;
nautilus_file_ref (file);
link_info_done (directory, file, uri, name, icon);
link_info_done (directory, file, uri, name, icon, drive_id, volume_id);
nautilus_file_changed (file);
if (!should_read_link_info_sync (file)) {
......@@ -2942,6 +2973,7 @@ link_info_nautilus_link_read_callback (GnomeVFSResult result,
{
NautilusDirectory *directory;
char *buffer, *uri, *name, *icon;
gulong drive_id, volume_id;
directory = NAUTILUS_DIRECTORY (callback_data);
......@@ -2954,17 +2986,17 @@ link_info_nautilus_link_read_callback (GnomeVFSResult result,
uri = NULL;
name = NULL;
icon = NULL;
volume_id = drive_id = 0;
} else {
/* The libxml parser requires a zero-terminated array. */
buffer = g_realloc (file_contents, bytes_read + 1);
buffer[bytes_read] = '\0';
uri = nautilus_link_get_link_uri_given_file_contents (NULL, buffer, bytes_read);
name = nautilus_link_get_link_name_given_file_contents (NULL, buffer, bytes_read);
icon = nautilus_link_get_link_icon_given_file_contents (NULL, buffer, bytes_read);
nautilus_link_get_link_info_given_file_contents (buffer, bytes_read,
&uri, &name, &icon, &drive_id, &volume_id);
g_free (buffer);
}
link_info_read_done (directory, uri, name, icon);
link_info_read_done (directory, uri, name, icon, drive_id, volume_id);
g_free (uri);
g_free (name);
g_free (icon);
......@@ -3065,7 +3097,7 @@ link_info_start (NautilusDirectory *directory,
/* If it's not a link we are done. If it is, we need to read it. */
if (!(nautilus_style_link || (is_directory && dot_directory_uri != NULL) )) {
link_info_done (directory, file, NULL, NULL, NULL);
link_info_done (directory, file, NULL, NULL, NULL, 0, 0);
} else if (should_read_link_info_sync (file)) {
directory->details->link_info_read_state = g_new0 (LinkInfoReadState, 1);
directory->details->link_info_read_state->file = file;
......
......@@ -42,6 +42,7 @@ typedef enum {
NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE = 1 << 9,
NAUTILUS_FILE_ATTRIBUTE_TOP_LEFT_TEXT = 1 << 10,
NAUTILUS_FILE_ATTRIBUTE_DISPLAY_NAME = 1 << 11,
NAUTILUS_FILE_ATTRIBUTE_VOLUMES = 1 << 12,
} NautilusFileAttributes;
#endif /* NAUTILUS_FILE_ATTRIBUTES_H */
......@@ -126,7 +126,11 @@ struct NautilusFileDetails
eel_boolean_bit got_link_info : 1;
eel_boolean_bit link_info_is_up_to_date : 1;
eel_boolean_bit is_thumbnailing : 1;
eel_boolean_bit is_thumbnailing : 1;
eel_boolean_bit has_volume : 1;
eel_boolean_bit has_drive : 1;
};
NautilusFile *nautilus_file_new_from_info (NautilusDirectory *directory,
......@@ -180,5 +184,10 @@ GnomeVFSFileInfo * nautilus_file_peek_vfs_file_info (NautilusFil
void nautilus_file_set_is_thumbnailing (NautilusFile *file,
gboolean is_thumbnailing);
/* Volumes: */
void nautilus_file_set_drive (NautilusFile *file,
GnomeVFSDrive *drive);
void nautilus_file_set_volume (NautilusFile *file,
GnomeVFSVolume *volume);
#endif
......@@ -43,7 +43,6 @@
#include "nautilus-trash-directory.h"
#include "nautilus-trash-file.h"
#include "nautilus-vfs-file.h"
#include "nautilus-volume-monitor.h"
#include <eel/eel-debug.h>
#include <eel/eel-glib-extensions.h>
#include <eel/eel-gtk-extensions.h>
......@@ -57,6 +56,9 @@
#include <libgnomevfs/gnome-vfs-file-info.h>
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libgnomevfs/gnome-vfs-volume.h>
#include <libgnomevfs/gnome-vfs-volume-monitor.h>
#include <libgnomevfs/gnome-vfs-drive.h>
#include <libxml/parser.h>
#include <pwd.h>
#include <stdlib.h>
......@@ -830,6 +832,63 @@ nautilus_file_can_rename (NautilusFile *file)
return can_rename;
}
gboolean
nautilus_file_has_volume (NautilusFile *file)
{
g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE);
return file->details->has_volume;
}
gboolean
nautilus_file_has_drive (NautilusFile *file)
{
g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE);
return file->details->has_drive;
}
void
nautilus_file_set_volume (NautilusFile *file,
GnomeVFSVolume *volume)
{
file->details->has_volume = volume != NULL;