Commit c4b8cdd4 authored by Darin Adler's avatar Darin Adler
Browse files

A pass at cleaning up the volume monitor. Made all the details of

	NautilusVolume private.

	* libnautilus-private/filesystem-attributes.xml: Changed the
	"description" string to be named "default_volume_name" and also
	marked it to be localized.

	* libnautilus-private/nautilus-file-utilities.h:
	* libnautilus-private/nautilus-file-utilities.c:
	(nautilus_get_data_file_path):
	Added a new utility function to locate a file that's either in the
	user's directory or in the Nautilus datadir.

	* src/nautilus-property-browser.c: (read_browser_xml): Use
	nautilus_get_data_file_path.

	* libnautilus-private/nautilus-trash-directory.c:
	(get_trash_volume):
	* libnautilus-private/nautilus-trash-monitor.c:
	(add_one_volume_trash):
	* src/file-manager/fm-desktop-icon-view.c: (volume_in_black_list),
	(create_unique_volume_name), (create_mount_link),
	(volume_unmounted_callback), (update_disks_menu):
	* src/nautilus-application.c: (volume_mounted_callback),
	(volume_unmounted_callback):
	* src/nautilus-bookmark-list.c:
	(nautilus_bookmark_list_get_file_path):
	Use only calls from the NautilusVolume public API -- no getting at
	the structure directly. Also fix callers that were using
	nautilus_volume_monitor_get_volume_mount_uri to correctly
	understand that they get the mount path, not the mount URI.

	* libnautilus-private/nautilus-volume-monitor.h:
	* libnautilus-private/nautilus-volume-monitor.c:
	(load_file_system_table): Fix storage leaks. Use the new
	nautilus_get_data_file_path. Translate the default volume names as
	they are loaded. Check for duplicate entries while loading the
	table. Don't bother checking the name of the root node, since
	there are plenty of other things about the file that we don't
	check and there's no reason we particularly need to check that.
	Fix some storage leaks. Free the doc, since I'm not seeing a
	"nautilus --quit" segfault.
	(nautilus_volume_monitor_initialize): Only initialize stuff that
	g_new0 won't set up for us.
	(nautilus_volume_is_removable): Rename so it's a call on
	NautilusVolume, not the NautilusVolumeMonitor.
	(volume_is_removable): Fix logic so we don't have to have so many
	different calls to fclose.
	(nautilus_volume_get_name): Rename so it's a call on
	NautilusVolume, not the NautilusVolumeMonitor.
	(modify_volume_name_for_display): Don't bother supplying a name if
	passed NULL, since that won't ever be helpful the way this is used.
	(nautilus_volume_get_target_uri): Rename so it's a call on
	NautilusVolume, not the NautilusVolumeMonitor.
	(nautilus_volume_should_integrate_trash): Rename so it's a call on
	NautilusVolume, not the NautilusVolumeMonitor. Get the information
	from the file system type, so we don't have to copy it into each
	NautilusVolume object.
	(nautilus_volume_get_mount_path): Rename so it's a call on
	NautilusVolume, and don't call it a URI since it's really a path.
	(nautilus_volume_get_device_type): New call.
	(make_volume_name_from_path): Get the default from the file system
	type rather than passing it in.
	(free_mount_list): Get rid of some dumb extra code.
	(copy_volume), (nautilus_volume_free): Update for smaller set of
	fields.
	(create_volume), (finish_creating_volume),
	(finish_creating_volume_and_prepend): Restructure so we don't need
	to keep so much stuff around in the NautilusVolume object.

	* src/nautilus-first-time-druid.c:
	(druid_set_first_time_file_flag): Some tiny tweaking.
parent bda50441
2001-08-15 Darin Adler <darin@bentspoon.com>
A pass at cleaning up the volume monitor. Made all the details of
NautilusVolume private.
* libnautilus-private/filesystem-attributes.xml: Changed the
"description" string to be named "default_volume_name" and also
marked it to be localized.
* libnautilus-private/nautilus-file-utilities.h:
* libnautilus-private/nautilus-file-utilities.c:
(nautilus_get_data_file_path):
Added a new utility function to locate a file that's either in the
user's directory or in the Nautilus datadir.
* src/nautilus-property-browser.c: (read_browser_xml): Use
nautilus_get_data_file_path.
* libnautilus-private/nautilus-trash-directory.c:
(get_trash_volume):
* libnautilus-private/nautilus-trash-monitor.c:
(add_one_volume_trash):
* src/file-manager/fm-desktop-icon-view.c: (volume_in_black_list),
(create_unique_volume_name), (create_mount_link),
(volume_unmounted_callback), (update_disks_menu):
* src/nautilus-application.c: (volume_mounted_callback),
(volume_unmounted_callback):
* src/nautilus-bookmark-list.c:
(nautilus_bookmark_list_get_file_path):
Use only calls from the NautilusVolume public API -- no getting at
the structure directly. Also fix callers that were using
nautilus_volume_monitor_get_volume_mount_uri to correctly
understand that they get the mount path, not the mount URI.
* libnautilus-private/nautilus-volume-monitor.h:
* libnautilus-private/nautilus-volume-monitor.c:
(load_file_system_table): Fix storage leaks. Use the new
nautilus_get_data_file_path. Translate the default volume names as
they are loaded. Check for duplicate entries while loading the
table. Don't bother checking the name of the root node, since
there are plenty of other things about the file that we don't
check and there's no reason we particularly need to check that.
Fix some storage leaks. Free the doc, since I'm not seeing a
"nautilus --quit" segfault.
(nautilus_volume_monitor_initialize): Only initialize stuff that
g_new0 won't set up for us.
(nautilus_volume_is_removable): Rename so it's a call on
NautilusVolume, not the NautilusVolumeMonitor.
(volume_is_removable): Fix logic so we don't have to have so many
different calls to fclose.
(nautilus_volume_get_name): Rename so it's a call on
NautilusVolume, not the NautilusVolumeMonitor.
(modify_volume_name_for_display): Don't bother supplying a name if
passed NULL, since that won't ever be helpful the way this is used.
(nautilus_volume_get_target_uri): Rename so it's a call on
NautilusVolume, not the NautilusVolumeMonitor.
(nautilus_volume_should_integrate_trash): Rename so it's a call on
NautilusVolume, not the NautilusVolumeMonitor. Get the information
from the file system type, so we don't have to copy it into each
NautilusVolume object.
(nautilus_volume_get_mount_path): Rename so it's a call on
NautilusVolume, and don't call it a URI since it's really a path.
(nautilus_volume_get_device_type): New call.
(make_volume_name_from_path): Get the default from the file system
type rather than passing it in.
(free_mount_list): Get rid of some dumb extra code.
(copy_volume), (nautilus_volume_free): Update for smaller set of
fields.
(create_volume), (finish_creating_volume),
(finish_creating_volume_and_prepend): Restructure so we don't need
to keep so much stuff around in the NautilusVolume object.
* src/nautilus-first-time-druid.c:
(druid_set_first_time_file_flag): Some tiny tweaking.
2001-08-15 Maciej Stachowiak <mjs@noisehavoc.org>
* components/music/Makefile.am: Revert accidental commit of not
......
<?xml version="1.0"?>
<FilesystemAttributes>
<filesystem name="affs" trash="no" description="affs"/>
<filesystem name="afs" trash="yes" description="AFS Network Volume"/>
<filesystem name="auto" trash="no" description="Auto-detected Volume"/>
<filesystem name="cdda" trash="no" description="CD Digital Audio"/>
<filesystem name="cdrom" trash="no" description="CDROM Drive"/>
<filesystem name="devfs" trash="no" description="Hardware Device Volume"/>
<filesystem name="ext2" trash="yes" description="Ext2 Linux Volume"/>
<filesystem name="ext3" trash="yes" description="Ext3 Linux Volume"/>
<filesystem name="fat" trash="yes" description="MSDOS Volume"/>
<filesystem name="iso9660" trash="no" description="CDROM Volume"/>
<filesystem name="hpfs" trash="no" description="Windows NT Volume"/>
<filesystem name="minix" trash="no" description="Minix Volume"/>
<filesystem name="msdos" trash="no" description="MSDOS Volume"/>
<filesystem name="nfs" trash="yes" description="NFS Network Volume"/>
<filesystem name="proc" trash="no" description="System Volume"/>
<filesystem name="reiserfs" trash="yes" description="ReiserFS Linux Volume"/>
<filesystem name="smb" trash="yes" description="Windows Fileshare Volume"/>
<filesystem name="udf" trash="no" description="DVD Volume"/>
<filesystem name="ufs" trash="yes" description="Solaris/BSD Volume"/>
<filesystem name="umsdos" trash="no" description="Enhanced DOS Volume"/>
<filesystem name="vfat" trash="yes" description="Windows Volume"/>
<filesystem name="xenix" trash="no" description="Xenix Volume"/>
<filesystem name="xfs" trash="yes" description="XFS Linux Volume"/>
<filesystem name="xiafs" trash="no" description="xiafs"/>
<filesystem name="unknown" trash="no" description="Unknown Filesystem"/>
<filesystem name="affs" _default_volume_name="AFFS Volume"/>
<filesystem name="afs" _default_volume_name="AFS Network Volume" trash="yes"/>
<filesystem name="auto" _default_volume_name="Auto-detected Volume"/>
<filesystem name="cdda" _default_volume_name="CD Digital Audio"/>
<filesystem name="cdrom" _default_volume_name="CD-ROM Drive"/>
<filesystem name="devfs" _default_volume_name="Hardware Device Volume"/>
<filesystem name="ext2" _default_volume_name="Ext2 Linux Volume" trash="yes"/>
<filesystem name="ext3" _default_volume_name="Ext3 Linux Volume" trash="yes"/>
<filesystem name="fat" _default_volume_name="MSDOS Volume" trash="yes"/>
<filesystem name="iso9660" _default_volume_name="CDROM Volume"/>
<filesystem name="hpfs" _default_volume_name="Windows NT Volume"/>
<filesystem name="minix" _default_volume_name="Minix Volume"/>
<filesystem name="msdos" _default_volume_name="MSDOS Volume"/>
<filesystem name="nfs" _default_volume_name="NFS Network Volume" trash="yes"/>
<filesystem name="proc" _default_volume_name="System Volume"/>
<filesystem name="reiserfs" _default_volume_name="ReiserFS Linux Volume" trash="yes"/>
<filesystem name="smb" _default_volume_name="Windows Shared Volume" trash="yes"/>
<filesystem name="udf" _default_volume_name="DVD Volume"/>
<filesystem name="ufs" _default_volume_name="Solaris/BSD Volume" trash="yes"/>
<filesystem name="umsdos" _default_volume_name="Enhanced DOS Volume"/>
<filesystem name="vfat" _default_volume_name="Windows VFAT Volume" trash="yes"/>
<filesystem name="xenix" _default_volume_name="Xenix Volume"/>
<filesystem name="xfs" _default_volume_name="XFS Linux Volume" trash="yes"/>
<filesystem name="xiafs" _default_volume_name="XIAFS Volume"/>
</FilesystemAttributes>
......@@ -287,6 +287,31 @@ nautilus_pixmap_file (const char *partial_path)
return NULL;
}
char *
nautilus_get_data_file_path (const char *partial_path)
{
char *path;
char *user_directory;
/* first try the user's home directory */
user_directory = nautilus_get_user_directory ();
path = nautilus_make_path (user_directory, partial_path);
g_free (user_directory);
if (g_file_exists (path)) {
return path;
}
g_free (path);
/* next try the shared directory */
path = nautilus_make_path (NAUTILUS_DATADIR, partial_path);
if (g_file_exists (path)) {
return path;
}
g_free (path);
return NULL;
}
char *
nautilus_unique_temporary_file_name (void)
{
......
......@@ -47,7 +47,6 @@ char * nautilus_get_desktop_directory (void);
char * nautilus_get_gmc_desktop_directory (void);
char * nautilus_get_pixmap_directory (void);
/* See if the user_main_directory exists. This should be called before
* nautilus_get_user_main_directory, which creates the directory.
*/
......@@ -63,6 +62,9 @@ gboolean nautilus_user_main_directory_exists (void);
*/
char * nautilus_pixmap_file (const char *partial_path);
/* Locate a file in either the uers directory or the datadir. */
char * nautilus_get_data_file_path (const char *partial_path);
/* Returns the build time stamp the Nautilus binary.
* This is useful to be able to tell builds apart.
* A return value of NULL means unknown time stamp.
......
......@@ -140,6 +140,8 @@ get_trash_volume (NautilusTrashDirectory *trash,
TrashVolume **trash_volume,
GnomeVFSURI **volume_mount_uri)
{
char *uri_str;
/* Quick out if we already know about this volume. */
*trash_volume = g_hash_table_lookup (trash->details->volumes,
volume);
......@@ -148,12 +150,13 @@ get_trash_volume (NautilusTrashDirectory *trash,
return FALSE;
}
if (!nautilus_volume_monitor_should_integrate_trash (volume)) {
if (!nautilus_volume_should_integrate_trash (volume)) {
return FALSE;
}
*volume_mount_uri = gnome_vfs_uri_new
(nautilus_volume_monitor_get_volume_mount_uri (volume));
uri_str = gnome_vfs_get_uri_from_local_path (nautilus_volume_get_mount_path (volume));
*volume_mount_uri = gnome_vfs_uri_new (uri_str);
g_free (uri_str);
if (*trash_volume == NULL) {
/* Make the structure used to track the trash for this volume. */
......
......@@ -215,19 +215,21 @@ static gboolean
add_one_volume_trash (const NautilusVolume *volume,
gpointer callback_data)
{
char *uri_str;
GnomeVFSURI *volume_mount_point_uri;
GnomeVFSURI *trash_uri;
GList **result;
result = (GList **)callback_data;
result = (GList **) callback_data;
if (nautilus_volume_monitor_should_integrate_trash (volume)) {
if (nautilus_volume_should_integrate_trash (volume)) {
/* Get the uri of the volume mount point as the place
* "near" which to look for trash on the given volume.
*/
volume_mount_point_uri = gnome_vfs_uri_new (
nautilus_volume_monitor_get_volume_mount_uri (volume));
uri_str = gnome_vfs_get_uri_from_local_path (nautilus_volume_get_mount_path (volume));
volume_mount_point_uri = gnome_vfs_uri_new (uri_str);
g_free (uri_str);
g_assert (volume_mount_point_uri != NULL);
......
......@@ -34,7 +34,7 @@ typedef struct NautilusVolumeMonitorDetails NautilusVolumeMonitorDetails;
#define NAUTILUS_TYPE_VOLUME_MONITOR (nautilus_volume_monitor_get_type())
#define NAUTILUS_VOLUME_MONITOR(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_VOLUME_MONITOR, NautilusVolumeMonitor))
#define NAUTILUS_VOLUME_MONITOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_VOLUME_MONITOR, NautilusVolumeMonitorClass))
#define IS_NAUTILUS_VOLUME_MONITOR(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_VOLUME_MONITOR))
#define NAUTILUS_IS_VOLUME_MONITOR(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_VOLUME_MONITOR))
struct NautilusVolumeMonitor {
GtkObject parent;
......@@ -42,7 +42,6 @@ struct NautilusVolumeMonitor {
};
typedef struct NautilusVolume NautilusVolume;
typedef struct NautilusFilesystemType NautilusFilesystemType;
struct NautilusVolumeMonitorClass {
GtkObjectClass parent_class;
......@@ -59,6 +58,7 @@ struct NautilusVolumeMonitorClass {
};
typedef enum {
NAUTILUS_DEVICE_UNKNOWN,
NAUTILUS_DEVICE_AUDIO_CD,
NAUTILUS_DEVICE_CAMERA,
NAUTILUS_DEVICE_CDROM_DRIVE,
......@@ -66,57 +66,34 @@ typedef enum {
NAUTILUS_DEVICE_JAZ_DRIVE,
NAUTILUS_DEVICE_MEMORY_STICK,
NAUTILUS_DEVICE_NFS,
NAUTILUS_DEVICE_ZIP_DRIVE,
NAUTILUS_DEVICE_UNKNOWN
NAUTILUS_DEVICE_ZIP_DRIVE
} NautilusDeviceType;
typedef struct {
char *name;
char *description;
gboolean use_trash;
} NautilusVolumeInfo;
struct NautilusVolume {
NautilusDeviceType device_type;
char *device_path;
char *mount_path;
char *volume_name;
char *filesystem;
char *description;
gboolean is_removable;
gboolean is_read_only;
gboolean use_trash;
gboolean audio_cd;
};
typedef gboolean (* NautilusEachVolumeFunction) (const NautilusVolume *, gpointer);
typedef gboolean (* NautilusEachVolumeCallback) (const NautilusVolume *, gpointer callback_data);
GtkType nautilus_volume_monitor_get_type (void);
NautilusVolumeMonitor *nautilus_volume_monitor_get (void);
char *nautilus_volume_monitor_get_volume_name (const NautilusVolume *volume);
void nautilus_volume_monitor_mount_unmount_removable (NautilusVolumeMonitor *monitor,
const char *mount_point,
gboolean should_mount);
gboolean nautilus_volume_monitor_volume_is_mounted (NautilusVolumeMonitor *monitor,
const NautilusVolume *mount_point);
gboolean nautilus_volume_monitor_volume_is_removable (const NautilusVolume *volume);
gboolean nautilus_volume_monitor_is_volume_link (const char *path);
gboolean nautilus_volume_monitor_should_integrate_trash (const NautilusVolume *volume);
const char *nautilus_volume_monitor_get_volume_mount_uri (const NautilusVolume *volume);
void nautilus_volume_monitor_each_mounted_volume (NautilusVolumeMonitor *monitor,
NautilusEachVolumeFunction function,
gpointer context);
const GList *nautilus_volume_monitor_get_removable_volumes (NautilusVolumeMonitor *monitor);
void nautilus_volume_monitor_free_volume (NautilusVolume *volume);
char *nautilus_volume_monitor_get_target_uri (const NautilusVolume *volume);
NautilusEachVolumeCallback callback,
gpointer callback_data);
const GList * nautilus_volume_monitor_get_removable_volumes (NautilusVolumeMonitor *monitor);
char * nautilus_volume_monitor_get_mount_name_for_display (NautilusVolumeMonitor *monitor,
const NautilusVolume *volume);
void nautilus_volume_monitor_set_volume_name (NautilusVolumeMonitor *monitor,
const NautilusVolume *volume,
const char *volume_name);
char *nautilus_volume_monitor_get_mount_name_for_display (NautilusVolumeMonitor *monitor,
NautilusVolume *volume);
/* Volume operations. */
char * nautilus_volume_get_name (const NautilusVolume *volume);
NautilusDeviceType nautilus_volume_get_device_type (const NautilusVolume *volume);
gboolean nautilus_volume_is_removable (const NautilusVolume *volume);
gboolean nautilus_volume_should_integrate_trash (const NautilusVolume *volume);
const char * nautilus_volume_get_mount_path (const NautilusVolume *volume);
char * nautilus_volume_get_target_uri (const NautilusVolume *volume);
#endif /* NAUTILUS_VOLUME_MONITOR_H */
2001-08-15 Darin Adler <darin@bentspoon.com>
* POTFILES.in: Add the file system XML file.
2001-08-06 Yukihiro Nakai <nakai@gnome.gr.jp>
* ja.po: Update Japanese translation.
......
applets/launcher/nautilus-launcher-applet.c
applets/preferences-applet/nautilus-preferences-applet.c
components/adapter/Nautilus_ComponentAdapterFactory_std.oaf.in
components/hardware/nautilus-hardware-view.c
components/hardware/Nautilus_View_hardware.oaf.in
components/hardware/nautilus-hardware-view.c
components/help/Nautilus_View_help.oaf.in
components/help/converters/gnome-db2html2/gdb3html.c
components/help/converters/gnome-db2html2/sect-elements.c
components/help/converters/gnome-db2html2/toc-elements.c
components/help/hyperbola-filefmt.c
components/help/hyperbola-nav-tree.c
components/help/hyperbola-nav-index.c
components/help/hyperbola-nav-tree.c
components/help/hyperbola-types.h
components/help/Nautilus_View_help.oaf.in
components/history/nautilus-history-view.c
components/history/Nautilus_View_history.oaf.in
components/image-viewer/nautilus-image-view.c
components/history/nautilus-history-view.c
components/image-viewer/Nautilus_View_image.oaf.in
components/loser/content/nautilus-content-loser.c
components/loser/content/nautilus-content-loser-ui.xml
components/image-viewer/nautilus-image-view.c
components/loser/content/Nautilus_View_content-loser.oaf.in
components/loser/sidebar/nautilus-sidebar-loser.c
components/loser/sidebar/nautilus-sidebar-loser-ui.xml
components/loser/content/nautilus-content-loser-ui.xml
components/loser/content/nautilus-content-loser.c
components/loser/sidebar/Nautilus_View_sidebar-loser.oaf.in
components/loser/sidebar/nautilus-sidebar-loser-ui.xml
components/loser/sidebar/nautilus-sidebar-loser.c
components/mozilla/Nautilus_View_mozilla.oaf.in
components/mozilla/mozilla-preferences.cpp
components/mozilla/nautilus-mozilla-encoding-tables.c
components/mozilla/nautilus-mozilla-content-view.c
components/mozilla/nautilus-mozilla-encoding-tables.c
components/mozilla/nautilus-mozilla-ui.xml
components/mozilla/Nautilus_View_mozilla.oaf.in
components/music/Nautilus_View_music.oaf.in
components/music/mpg123.c
components/music/nautilus-music-view.c
components/music/Nautilus_View_music.oaf.in
components/news/nautilus-news.c
components/news/Nautilus_View_news.oaf.in
components/notes/nautilus-notes.c
components/news/nautilus-news.c
components/notes/Nautilus_View_notes.oaf.in
components/sample/nautilus-sample-content-view.c
components/sample/nautilus-sample-content-view-ui.xml
components/notes/nautilus-notes.c
components/sample/Nautilus_View_sample.oaf.in
components/text/nautilus-text-view.c
components/text/nautilus-text-view-ui.xml
components/sample/nautilus-sample-content-view-ui.xml
components/sample/nautilus-sample-content-view.c
components/text/Nautilus_View_text.oaf.in
components/text/nautilus-text-view-ui.xml
components/text/nautilus-text-view.c
components/text/services/google.xml
components/text/services/webster.xml
components/throbber/Nautilus_Control_throbber.oaf.in
......@@ -56,17 +56,18 @@ icons/default.xml
icons/gnome/gnome.xml
icons/sierra/sierra.xml
icons/tahoe/tahoe.xml
libnautilus-private/filesystem-attributes.xml
libnautilus-private/nautilus-customization-data.c
libnautilus-private/nautilus-druid.c
libnautilus-private/nautilus-druid-page-eazel.c
libnautilus-private/nautilus-druid.c
libnautilus-private/nautilus-entry.c
libnautilus-private/nautilus-file.c
libnautilus-private/nautilus-file-operations.c
libnautilus-private/nautilus-file-operations-progress.c
libnautilus-private/nautilus-file-operations.c
libnautilus-private/nautilus-file.c
libnautilus-private/nautilus-font-factory.c
libnautilus-private/nautilus-global-preferences.c
libnautilus-private/nautilus-icon-container.c
libnautilus-private/nautilus-icon-canvas-item.c
libnautilus-private/nautilus-icon-container.c
libnautilus-private/nautilus-icon-dnd.c
libnautilus-private/nautilus-icon-factory.c
libnautilus-private/nautilus-icon-text-item.c
......@@ -80,8 +81,8 @@ libnautilus-private/nautilus-trash-file.c
libnautilus-private/nautilus-undo-signal-handlers.c
libnautilus-private/nautilus-view-identifier.c
libnautilus-private/nautilus-volume-monitor.c
libnautilus/nautilus-clipboard.c
libnautilus/nautilus-clipboard-ui.xml
libnautilus/nautilus-clipboard.c
nautilus.desktop.in
src/Nautilus_shell.oaf.in
src/file-manager/fm-desktop-icon-view.c
......
......@@ -350,7 +350,7 @@ volume_in_black_list (FMDesktopIconView *icon_view,
g_return_val_if_fail (FM_IS_DESKTOP_ICON_VIEW (icon_view), TRUE);
for (p = icon_view->details->mount_black_list; p != NULL; p = p->next) {
if (strcmp ((char *) p->data, volume->mount_path) == 0) {
if (strcmp ((char *) p->data, nautilus_volume_get_mount_path (volume)) == 0) {
return TRUE;
}
}
......@@ -374,7 +374,7 @@ create_unique_volume_name (const NautilusVolume *volume)
*/
index = 1;
volume_name = nautilus_volume_monitor_get_volume_name (volume);
volume_name = nautilus_volume_get_name (volume);
uri_path = g_strdup_printf ("%s/%s", desktop_directory, volume_name);
uri = gnome_vfs_uri_new (uri_path);
......@@ -398,7 +398,7 @@ create_unique_volume_name (const NautilusVolume *volume)
volume_name = new_name;
}
original_volume_name = nautilus_volume_monitor_get_volume_name (volume);
original_volume_name = nautilus_volume_get_name (volume);
if (strcmp (volume_name, original_volume_name) != 0) {
nautilus_volume_monitor_set_volume_name (nautilus_volume_monitor_get (),
volume, volume_name);
......@@ -423,22 +423,18 @@ create_mount_link (FMDesktopIconView *icon_view,
}
/* FIXME bugzilla.eazel.com 5412: Design a comprehensive desktop mounting strategy */
if (!nautilus_volume_monitor_volume_is_removable (volume)) {
if (!nautilus_volume_is_removable (volume)) {
return;
}
/* Get icon type */
switch (volume->device_type) {
icon_name = "i-blockdev";
switch (nautilus_volume_get_device_type (volume)) {
case NAUTILUS_DEVICE_AUDIO_CD:
case NAUTILUS_DEVICE_CDROM_DRIVE:
icon_name = "i-cdrom";
break;
case NAUTILUS_DEVICE_CAMERA:
icon_name = "i-blockdev";
break;
case NAUTILUS_DEVICE_FLOPPY_DRIVE:
icon_name = "i-floppy";
break;
......@@ -459,15 +455,12 @@ create_mount_link (FMDesktopIconView *icon_view,
icon_name = "i-zipdisk";
break;
case NAUTILUS_DEVICE_CAMERA:
case NAUTILUS_DEVICE_UNKNOWN:
icon_name = "i-blockdev";
break;
default:
icon_name = "i-blockdev";
break;
}
target_uri = nautilus_volume_monitor_get_target_uri (volume);
target_uri = nautilus_volume_get_target_uri (volume);
volume_name = create_unique_volume_name (volume);
......@@ -860,7 +853,7 @@ volume_unmounted_callback (NautilusVolumeMonitor *monitor,
g_assert (volume != NULL);
volume_name = nautilus_volume_monitor_get_volume_name (volume);
volume_name = nautilus_volume_get_name (volume);
if (volume_name == NULL) {
return;
}
......@@ -1244,7 +1237,7 @@ update_disks_menu (FMDesktopIconView *view)
(view->details->ui,
command_name,
mount_or_unmount_removable_volume,
mount_parameters_new (view, volume->mount_path),
mount_parameters_new (view, nautilus_volume_get_mount_path (volume)),
mount_parameters_free_wrapper);
g_free (command_name);
......
......@@ -830,10 +830,10 @@ volume_mounted_callback (NautilusVolumeMonitor *monitor, NautilusVolume *volume,
}
/* Open a window to the CD if the user has set that preference. */
if (volume->device_type == NAUTILUS_DEVICE_CDROM_DRIVE
if (nautilus_volume_get_device_type (volume) == NAUTILUS_DEVICE_CDROM_DRIVE
&& gnome_config_get_bool ("/magicdev/Options/do_fileman_window=true")) {
window = nautilus_application_create_window (application);
uri = gnome_vfs_get_uri_from_local_path (volume->mount_path);
uri = gnome_vfs_get_uri_from_local_path (nautilus_volume_get_mount_path (volume));
nautilus_window_go_to (window, uri);
g_free (uri);
}
......@@ -890,7 +890,7 @@ volume_unmounted_callback (NautilusVolumeMonitor *monitor, NautilusVolume *volum
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, volume->mount_path)) {
if (eel_str_has_prefix (path, nautilus_volume_get_mount_path (volume))) {
close_list = g_list_prepend (close_list, window);
}
g_free (path);
......
......@@ -338,13 +338,11 @@ nautilus_bookmark_list_get_file_path (NautilusBookmarkList *bookmarks)
/* currently hardwired */
static char *file_path = NULL;
char *user_directory;
if (file_path == NULL) {
char *user_directory;
user_directory = nautilus_get_user_directory ();
file_path = nautilus_make_path (user_directory, "bookmarks.xml");
g_free (user_directory);
}
......
......@@ -169,25 +169,20 @@ druid_set_first_time_file_flag (void)
{
FILE *stream;
char *user_directory, *druid_flag_file_name;
const char * const blurb =
_("Existence of this file indicates that the Nautilus configuration druid\n"
"has been presented.\n\n"
"You can manually erase this file to present the druid again.\n");
user_directory = nautilus_get_user_directory ();
druid_flag_file_name = g_strdup_printf ("%s/%s",
user_directory,
"first-time-flag");
druid_flag_file_name = nautilus_make_path (user_directory, "first-time-flag");
g_free (user_directory);
stream = fopen (druid_flag_file_name, "w");
if (stream) {
const char *blurb =
_("Existence of this file indicates that the Nautilus configuration druid\n"
"has been presented.\n\n"
"You can manually erase this file to present the druid again.\n\n");
if (stream != NULL) {
fwrite (blurb, sizeof (char), strlen (blurb), stream);
fclose (stream);
}
g_free (druid_flag_file_name);
}
......
......@@ -747,44 +747,13 @@ category_clicked_callback (GtkWidget *widget, char *category_name)
property_browser->details->selected_button = widget;
}
/* fetch the path of the xml file. First, try to find it in the home directory, but it
we can't find it there, try the shared directory */
static char *
get_xml_path (NautilusPropertyBrowser *property_browser)
{
char *xml_path;
char *user_directory;
user_directory = nautilus_get_user_directory ();
/* first try the user's home directory */