Roman Moravcik wrote:
>>>I'm testing Thunar on FC5 beta3 and dvd devices icons aren't displayed
>>>in side panel.
>>>Icons of other devices are displayed correctly. Fedora has hal 0.5.7.
>>>Look at this screenshot:
>>>
>>>http://morgan.fbi.cz/thunar_side_panel.jpg
>>
>>This is strange, as Thunar simply uses the GNOME device icon names.
>>Which version of Tango/icon-naming-utils do you use?
>
> I have Tango 0.7.1 and icon-naming-utils 0.7.1. On CDR and CDRW disks
> icons are displayed.
Yeppa, there was a typo in the icon name. Can you try again?
Also, can you try the attached patch (with latest SVN) and tell me
whether gnome-{mount,umount,eject} work properly now?
> Roman
Benedikt
Index: thunar-vfs-volume-hal.c
===================================================================
--- thunar-vfs-volume-hal.c (revision 20454)
+++ thunar-vfs-volume-hal.c (working copy)
@@ -38,6 +38,7 @@
#include <libhal.h>
#include <libhal-storage.h>
+#include <thunar-vfs/thunar-vfs-exec.h>
#include <thunar-vfs/thunar-vfs-volume-hal.h>
#include <thunar-vfs/thunar-vfs-volume-private.h>
#include <thunar-vfs/thunar-vfs-alias.h>
@@ -205,45 +206,26 @@
{
ThunarVfsVolumeHal *volume_hal = THUNAR_VFS_VOLUME_HAL (volume);
gboolean result;
- gchar *standard_error;
- gchar *command_line;
+ gchar *program;
gchar *quoted;
- gint exit_status;
- /* generate the mount command */
- quoted = g_path_get_basename (volume_hal->device_file);
- command_line = g_strconcat ("eject ", quoted, NULL);
- g_free (quoted);
-
- /* execute the mount command */
- result = g_spawn_command_line_sync (command_line, NULL, &standard_error, &exit_status, error);
- if (G_LIKELY (result))
+ /* check if gnome-eject is present */
+ program = g_find_program_in_path ("gnome-eject");
+ if (G_LIKELY (program != NULL))
{
- /* check if the command failed */
- if (G_UNLIKELY (exit_status != 0))
- {
- /* drop additional whitespace from the stderr output */
- g_strstrip (standard_error);
-
- /* check if stderr output is usable as error message */
- if (G_LIKELY (*standard_error != '\0'))
- {
- /* use standard error message if not empty */
- g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, standard_error);
- }
- else
- {
- /* no useful information, *narf* */
- g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("Unknown error"));
- }
-
- /* and yes, we failed */
- result = FALSE;
- }
-
- /* release the stderr output */
- g_free (standard_error);
+ /* try to use gnome-eject then */
+ quoted = g_shell_quote (volume_hal->udi);
+ result = thunar_vfs_exec_sync ("%s -t -h %s", error, program, quoted);
+ g_free (program);
+ g_free (quoted);
}
+ else
+ {
+ /* use eject */
+ quoted = g_path_get_basename (volume_hal->device_file);
+ result = thunar_vfs_exec_sync ("eject %s", error, quoted);
+ g_free (quoted);
+ }
/* check if we were successfull */
if (G_LIKELY (result))
@@ -255,9 +237,6 @@
thunar_vfs_volume_changed (THUNAR_VFS_VOLUME (volume_hal));
}
- /* cleanup */
- g_free (command_line);
-
return result;
}
@@ -271,97 +250,43 @@
ThunarVfsVolumeHal *volume_hal = THUNAR_VFS_VOLUME_HAL (volume);
ThunarVfsPath *path;
gboolean result;
- gchar *standard_error;
- gchar *command_line;
gchar *mount_point;
+ gchar *program;
gchar *quoted;
- gint exit_status;
- /* generate the mount command */
- quoted = g_shell_quote (volume_hal->udi);
- command_line = g_strconcat ("pmount-hal ", quoted, NULL);
- g_free (quoted);
-
- /* execute the mount command */
- result = g_spawn_command_line_sync (command_line, NULL, &standard_error, &exit_status, NULL);
- if (G_LIKELY (result))
+ /* check if pmount-hal is present */
+ program = g_find_program_in_path ("pmount-hal");
+ if (G_LIKELY (program != NULL))
{
- /* check if the command failed */
- if (G_UNLIKELY (exit_status != 0))
- {
- /* drop additional whitespace from the stderr output */
- g_strstrip (standard_error);
-
- /* check if stderr output is usable as error message */
- if (G_LIKELY (*standard_error != '\0'))
- {
- /* use standard error message if not empty */
- g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, standard_error);
- }
- else
- {
- /* no useful information, *narf* */
- g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("Unknown error"));
- }
-
- /* and yes, we failed */
- result = FALSE;
- }
-
- /* release the stderr output */
- g_free (standard_error);
+ /* try to use pmount-hal then */
+ quoted = g_shell_quote (volume_hal->udi);
+ result = thunar_vfs_exec_sync ("%s %s", error, program, quoted);
+ g_free (program);
+ g_free (quoted);
}
- else /* pmount-hal is not available, so retry with simple "mount <mount-point>" */
+ else
{
- /* release the previous command line */
- g_free (command_line);
- command_line = NULL;
-
- /* determine the absolute path to the mount point */
- mount_point = thunar_vfs_path_dup_string (volume_hal->mount_point);
-
- /* generate the command line for the mount command */
- quoted = g_shell_quote (mount_point);
- command_line = g_strconcat ("mount ", quoted, NULL);
- g_free (quoted);
-
- /* execute the mount command */
- result = g_spawn_command_line_sync (command_line, NULL, &standard_error, &exit_status, error);
- if (G_LIKELY (result))
+ /* check if gnome-mount is present */
+ program = g_find_program_in_path ("gnome-mount");
+ if (G_LIKELY (program != NULL))
{
- /* check if the command failed */
- if (G_UNLIKELY (exit_status != 0))
- {
- /* drop additional whitespace from the stderr output */
- g_strstrip (standard_error);
-
- /* check if stderr output is usable as error message */
- if (G_LIKELY (*standard_error != '\0'))
- {
- /* use standard error message if not empty */
- g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, standard_error);
- }
- else
- {
- /* no useful information, *narf* */
- g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("Unknown error"));
- }
-
- /* and yes, we failed */
- result = FALSE;
- }
-
- /* release the stderr output */
- g_free (standard_error);
+ /* try to use gnome-mount then */
+ quoted = g_shell_quote (volume_hal->udi);
+ result = thunar_vfs_exec_sync ("%s -t -h %s", error, program, quoted);
+ g_free (program);
+ g_free (quoted);
}
-
- /* release the absolute path to the mount point */
- g_free (mount_point);
+ else
+ {
+ /* fallback to plain mount */
+ mount_point = thunar_vfs_path_dup_string (volume_hal->mount_point);
+ quoted = g_shell_quote (mount_point);
+ result = thunar_vfs_exec_sync ("mount %s", error, quoted);
+ g_free (mount_point);
+ g_free (quoted);
+ }
}
- /* cleanup */
- g_free (command_line);
-
/* check if we were successfull */
if (G_LIKELY (result))
{
@@ -399,90 +324,43 @@
{
ThunarVfsVolumeHal *volume_hal = THUNAR_VFS_VOLUME_HAL (volume);
gboolean result;
- gchar absolute_path[THUNAR_VFS_PATH_MAXSTRLEN];
- gchar *standard_error;
- gchar *command_line;
+ gchar *mount_point;
+ gchar *program;
gchar *quoted;
- gint exit_status;
- /* determine the absolute path to the mount point */
- if (thunar_vfs_path_to_string (volume_hal->mount_point, absolute_path, sizeof (absolute_path), error) < 0)
- return FALSE;
-
- /* generate the mount command */
- quoted = g_shell_quote (absolute_path);
- command_line = g_strconcat ("pumount ", quoted, NULL);
- g_free (quoted);
-
- /* execute the pumount command */
- result = g_spawn_command_line_sync (command_line, NULL, &standard_error, &exit_status, NULL);
- if (G_LIKELY (result))
+ /* check if pumount is present */
+ program = g_find_program_in_path ("pumount");
+ if (G_LIKELY (program != NULL))
{
- /* check if the command failed */
- if (G_UNLIKELY (exit_status != 0))
- {
- /* drop additional whitespace from the stderr output */
- g_strstrip (standard_error);
-
- /* check if stderr output is usable as error message */
- if (G_LIKELY (*standard_error != '\0'))
- {
- /* use standard error message if not empty */
- g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, standard_error);
- }
- else
- {
- /* no useful information, *narf* */
- g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("Unknown error"));
- }
-
- /* and yes, we failed */
- result = FALSE;
- }
-
- /* release the stderr output */
- g_free (standard_error);
+ /* try to use pumount then */
+ mount_point = thunar_vfs_path_dup_string (volume_hal->mount_point);
+ quoted = g_shell_quote (mount_point);
+ result = thunar_vfs_exec_sync ("%s %s", error, program, quoted);
+ g_free (mount_point);
+ g_free (program);
+ g_free (quoted);
}
- else /* pumount not available, retry with plain umount */
+ else
{
- /* release the previous command line */
- g_free (command_line);
- command_line = NULL;
-
- /* generate the mount command */
- quoted = g_shell_quote (absolute_path);
- command_line = g_strconcat ("umount ", quoted, NULL);
- g_free (quoted);
-
- /* execute the pumount command */
- result = g_spawn_command_line_sync (command_line, NULL, &standard_error, &exit_status, error);
- if (G_LIKELY (result))
+ /* check if gnome-umount is present */
+ program = g_find_program_in_path ("gnome-umount");
+ if (G_LIKELY (program != NULL))
{
- /* check if the command failed */
- if (G_UNLIKELY (exit_status != 0))
- {
- /* drop additional whitespace from the stderr output */
- g_strstrip (standard_error);
-
- /* check if stderr output is usable as error message */
- if (G_LIKELY (*standard_error != '\0'))
- {
- /* use standard error message if not empty */
- g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, standard_error);
- }
- else
- {
- /* no useful information, *narf* */
- g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("Unknown error"));
- }
-
- /* and yes, we failed */
- result = FALSE;
- }
-
- /* release the stderr output */
- g_free (standard_error);
+ /* try to use gnome-umount then */
+ quoted = g_shell_quote (volume_hal->udi);
+ result = thunar_vfs_exec_sync ("%s -t -h %s", error, program, quoted);
+ g_free (program);
+ g_free (quoted);
}
+ else
+ {
+ /* fallback to plain umount */
+ mount_point = thunar_vfs_path_dup_string (volume_hal->mount_point);
+ quoted = g_shell_quote (mount_point);
+ result = thunar_vfs_exec_sync ("umount %s", error, quoted);
+ g_free (mount_point);
+ g_free (quoted);
+ }
}
/* check if we were successfull */
@@ -495,9 +373,6 @@
thunar_vfs_volume_changed (THUNAR_VFS_VOLUME (volume_hal));
}
- /* cleanup */
- g_free (command_line);
-
return result;
}
@@ -927,7 +802,7 @@
/* print a warning message */
if (dbus_error_is_set (&error))
{
- g_warning ("Failed to connect to the HAL daemon: %s", error.message);
+ g_warning (_("Failed to connect to the HAL daemon: %s"), error.message);
dbus_error_free (&error);
}
}
_______________________________________________
Thunar-dev mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/thunar-dev