[maemo-commits] [maemo-commits] r13869 - projects/haf/trunk/hildon-fm/hildon-fm
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Mon Sep 17 20:17:16 EEST 2007
- Previous message: [maemo-commits] r13868 - in projects/haf/tags/hildon-desktop: . 0.0.36-2/debian 0.0.36-2/debian/config
- Next message: [maemo-commits] r13870 - projects/haf/trunk/hildon-fm
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: marivoll
Date: 2007-09-17 20:17:14 +0300 (Mon, 17 Sep 2007)
New Revision: 13869
Modified:
projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-obex.c
Log:
* hildon-fm/hildon-file-system-obex.c
(hildon_file_system_obex_rewrite_path): New, to fake the manual
symlink following needed by the current incomplete GnomeVFS obex
module.
(hildon_file_system_obex_create_child_location): Do not unescape
the URI since the host part is not stored in escaped form.
Modified: projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-obex.c
===================================================================
--- projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-obex.c 2007-09-17 16:45:32 UTC (rev 13868)
+++ projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-obex.c 2007-09-17 17:17:14 UTC (rev 13869)
@@ -33,6 +33,7 @@
#include "hildon-file-system-obex.h"
#include "hildon-file-system-settings.h"
#include "hildon-file-system-dynamic-device.h"
+#include "hildon-file-system-private.h"
#include "hildon-file-common-private.h"
@@ -42,6 +43,10 @@
hildon_file_system_obex_finalize (GObject *obj);
static void
hildon_file_system_obex_init (HildonFileSystemObex *device);
+GtkFilePath *
+hildon_file_system_obex_rewrite_path (HildonFileSystemSpecialLocation *location,
+ GtkFileSystem *filesystem,
+ const GtkFilePath *path);
HildonFileSystemSpecialLocation*
hildon_file_system_obex_create_child_location (HildonFileSystemSpecialLocation *location, gchar *uri);
@@ -53,7 +58,9 @@
hildon_file_system_obex,
HILDON_TYPE_FILE_SYSTEM_REMOTE_DEVICE);
+#if 0
static gchar *_unescape_base_uri (gchar *uri);
+#endif
static gchar *_uri_to_display_name (gchar *uri);
static void _uri_filler_function (gpointer data, gpointer user_data);
@@ -70,6 +77,8 @@
HILDON_FILE_SYSTEM_SPECIAL_LOCATION_CLASS (klass);
gobject_class->finalize = hildon_file_system_obex_finalize;
+
+ location->rewrite_path = hildon_file_system_obex_rewrite_path;
location->create_child_location =
hildon_file_system_obex_create_child_location;
@@ -127,11 +136,38 @@
G_OBJECT_CLASS (hildon_file_system_obex_parent_class)->finalize (obj);
}
+GtkFilePath *
+hildon_file_system_obex_rewrite_path (HildonFileSystemSpecialLocation *location,
+ GtkFileSystem *filesystem,
+ const GtkFilePath *path)
+{
+ /* XXX - the 'right' thing would be to follow the symlinks below
+ "obex:///" explicitly, but we would have to special case
+ that as well since in general symlinks should not be
+ followed by us but by the GnomeVFS module. So we just hack
+ the URIs...
+ */
+
+ GtkFilePath *new_path;
+ const char *str = gtk_file_path_get_string (path);
+
+ if (g_str_has_prefix (str, "obex:///"))
+ {
+ char *new_str = hildon_file_system_unescape_string (str);
+ strcpy (new_str + 7, new_str + 8);
+ new_path = gtk_file_path_new_steal (new_str);
+ }
+ else
+ new_path = gtk_file_path_copy (path);
+
+ return new_path;
+}
+
HildonFileSystemSpecialLocation*
hildon_file_system_obex_create_child_location (HildonFileSystemSpecialLocation *location, gchar *uri)
{
HildonFileSystemSpecialLocation *child = NULL;
- gchar *skipped, *found, *new_uri, *name;
+ gchar *skipped, *found, *name;
skipped = uri + strlen (location->basepath) + 1;
@@ -142,9 +178,7 @@
HILDON_FILE_SYSTEM_REMOTE_DEVICE (child)->accessible =
HILDON_FILE_SYSTEM_REMOTE_DEVICE (location)->accessible;
- new_uri = _unescape_base_uri (uri);
-
- name = _get_icon_from_uri (new_uri);
+ name = _get_icon_from_uri (uri);
if (name) {
hildon_file_system_special_location_set_icon (child, name);
g_free (name);
@@ -155,14 +189,12 @@
/* if this fails, NULL is returned and fallback is that
the obex addr in format [12:34:...] is shown */
- name = _uri_to_display_name (new_uri);
+ name = _uri_to_display_name (uri);
if (name) {
hildon_file_system_special_location_set_display_name (child, name);
g_free (name);
}
- g_free (new_uri);
-
child->basepath = g_strdup (uri);
child->failed_access_message = _("sfil_ib_cannot_connect_device");
child->permanent = FALSE;
@@ -178,6 +210,7 @@
return has_children;
}
+#if 0
/* very dependant on how things work now */
static gchar *
_unescape_base_uri (gchar *uri)
@@ -214,6 +247,7 @@
return ret;
}
+#endif
/* we'll cache addr & name pairs so we don't have to open D-BUS
connection each time, caching happens per process lifetime */
- Previous message: [maemo-commits] r13868 - in projects/haf/tags/hildon-desktop: . 0.0.36-2/debian 0.0.36-2/debian/config
- Next message: [maemo-commits] r13870 - projects/haf/trunk/hildon-fm
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
