gvfs r1423 - in trunk: . daemon
- From: hadess svn gnome org
- To: svn-commits-list gnome org
- Subject: gvfs r1423 - in trunk: . daemon
- Date: Thu, 28 Feb 2008 14:32:43 +0000 (GMT)
Author: hadess
Date: Thu Feb 28 14:32:43 2008
New Revision: 1423
URL: http://svn.gnome.org/viewvc/gvfs?rev=1423&view=rev
Log:
2008-02-28 Bastien Nocera <hadess hadess net>
* daemon/gvfsbackendobexftp-fl-parser.c (fl_parser_start_node_cb):
Fix the content-type of directories (inode/directory, not
x-directory/normal as in gnome-vfs)
Set file icons from the content-type
* daemon/gvfsbackendobexftp.c (_change_directory):
Add a FIXME, trying to change to a non-existant directory
errors out with "permission denied", which isn't the case
(_query_file_info_helper): set the right content-type and icon
for the root folder
(is_connected), (do_mount): Wait until we're connected to exit from
do_mount()
(do_open_for_read): Fix a crash when opening an inexistant file for
read
Modified:
trunk/ChangeLog
trunk/daemon/gvfsbackendobexftp-fl-parser.c
trunk/daemon/gvfsbackendobexftp.c
Modified: trunk/daemon/gvfsbackendobexftp-fl-parser.c
==============================================================================
--- trunk/daemon/gvfsbackendobexftp-fl-parser.c (original)
+++ trunk/daemon/gvfsbackendobexftp-fl-parser.c Thu Feb 28 14:32:43 2008
@@ -97,8 +97,13 @@
g_file_info_set_file_type (info, G_FILE_TYPE_REGULAR);
}
else if (strcmp (node_name, "folder") == 0) {
+ GIcon *icon;
g_file_info_set_file_type (info, G_FILE_TYPE_DIRECTORY);
- g_file_info_set_content_type (info, "x-directory/normal");
+ g_file_info_set_content_type (info, "inode/directory");
+
+ icon = g_themed_icon_new ("folder");
+ g_file_info_set_icon (info, icon);
+ g_object_unref (icon);
} else {
g_set_error (data->error,
G_MARKUP_ERROR,
@@ -122,6 +127,20 @@
g_free (mime_type);
}
+ if (g_file_info_get_content_type (info) == NULL) {
+ g_file_info_set_content_type (info, "application/octet-stream");
+ }
+
+ if (g_file_info_get_file_type (info) == G_FILE_TYPE_REGULAR) {
+ GIcon *icon;
+
+ icon = g_content_type_get_icon (g_file_info_get_content_type (info));
+ if (icon != NULL) {
+ g_file_info_set_icon (info, icon);
+ g_object_unref (icon);
+ }
+ }
+
/* Permissions on folders in OBEX has different semantics than POSIX.
* In POSIX, if a folder is not writable, it means that it's content
* can't be removed, whereas in OBEX, it just means that the folder
Modified: trunk/daemon/gvfsbackendobexftp.c
==============================================================================
--- trunk/daemon/gvfsbackendobexftp.c (original)
+++ trunk/daemon/gvfsbackendobexftp.c Thu Feb 28 14:32:43 2008
@@ -208,6 +208,8 @@
G_TYPE_INVALID) == FALSE)
{
g_message ("ChangeCurrentFolderToRoot failed");
+ //FIXME change the retval from org.openobex.Error.NotAuthorized to
+ //no such file or directory
return FALSE;
}
}
@@ -252,13 +254,17 @@
if (strcmp (filename, "/") == 0)
{
+ GIcon *icon;
char *display;
/* That happens when you want '/'
* and we don't have any info about it :( */
g_file_info_set_file_type (info, G_FILE_TYPE_DIRECTORY);
- g_file_info_set_content_type (info, "x-directory/normal");
+ g_file_info_set_content_type (info, "inode/directory");
g_file_info_set_name (info, "/");
+ icon = g_themed_icon_new ("bluetooth");
+ g_file_info_set_icon (info, icon);
+ g_object_unref (icon);
display = g_strdup_printf (_("%s on %s"), "/", op_backend->display_name);
g_file_info_set_display_name (info, display);
g_free (display);
@@ -379,6 +385,24 @@
_exit (1);
}
+static int
+is_connected (DBusGProxy *session_proxy, GVfsJob *job)
+{
+ GError *error = NULL;
+ gboolean connected;
+
+ if (dbus_g_proxy_call (session_proxy, "IsConnected", &error,
+ G_TYPE_INVALID,
+ G_TYPE_BOOLEAN, &connected, G_TYPE_INVALID) == FALSE)
+ {
+ g_vfs_job_failed_from_error (job, error);
+ g_error_free (error);
+ return -1;
+ }
+
+ return connected;
+}
+
static void
do_mount (GVfsBackend *backend,
GVfsJobMount *job,
@@ -392,6 +416,7 @@
const gchar *path = NULL;
char *server, *bdaddr;
GMountSpec *obexftp_mount_spec;
+ gboolean connected;
g_print ("+ do_mount\n");
@@ -475,6 +500,21 @@
dbus_g_proxy_add_signal(op_backend->session_proxy, "TransferStarted",
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT64, G_TYPE_INVALID);
+ /* Now wait until the device is connected */
+ connected = is_connected (op_backend->session_proxy, G_VFS_JOB (job));
+ while (connected == FALSE)
+ {
+ g_usleep (G_USEC_PER_SEC / 100);
+ connected = is_connected (op_backend->session_proxy, G_VFS_JOB (job));
+ }
+
+ if (connected < 0)
+ {
+ //FIXME bail out
+ g_message ("mount failed");
+ return;
+ }
+
g_free (bdaddr);
g_vfs_job_succeeded (G_VFS_JOB (job));
@@ -615,7 +655,6 @@
{
op_backend->doing_io = FALSE;
g_mutex_unlock (op_backend->mutex);
- g_free (basename);
close (fd);
g_vfs_job_failed_from_error (G_VFS_JOB (job),
op_backend->error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]