- Update obexftp patch from upstream

This commit is contained in:
Bastien Nocera 2008-09-29 09:25:19 +00:00
parent 505d943872
commit b82a98d5be
2 changed files with 209 additions and 43 deletions

View File

@ -1,11 +1,60 @@
Index: daemon/obexftp-marshal.list
===================================================================
--- daemon/obexftp-marshal.list (revision 2022)
+++ daemon/obexftp-marshal.list (working copy)
@@ -1,2 +1,4 @@
+VOID:STRING
VOID:STRING,STRING
+VOID:STRING,STRING,STRING
VOID:STRING,STRING,UINT64
Index: daemon/daemon-main.c
===================================================================
--- daemon/daemon-main.c (revision 2022)
+++ daemon/daemon-main.c (working copy)
@@ -65,6 +65,12 @@
dbus_error_free (&derror);
exit (1);
}
+
+ GLogLevelFlags fatal_mask;
+
+ fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
+ fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
+ g_log_set_always_fatal (fatal_mask);
}
void
Index: daemon/gvfsbackendobexftp.c Index: daemon/gvfsbackendobexftp.c
=================================================================== ===================================================================
--- daemon/gvfsbackendobexftp.c (revision 2008) --- daemon/gvfsbackendobexftp.c (revision 2022)
+++ daemon/gvfsbackendobexftp.c (working copy) +++ daemon/gvfsbackendobexftp.c (working copy)
@@ -96,6 +96,15 @@ @@ -69,7 +69,7 @@
char *display_name;
char *bdaddr;
- guint type;
+ char *icon_name;
DBusGConnection *connection;
DBusGProxy *manager_proxy;
@@ -96,177 +96,106 @@
G_DEFINE_TYPE (GVfsBackendObexftp, g_vfs_backend_obexftp, G_VFS_TYPE_BACKEND); G_DEFINE_TYPE (GVfsBackendObexftp, g_vfs_backend_obexftp, G_VFS_TYPE_BACKEND);
-/* This should all live in bluez-gnome, and we
- * should depend on it */
-enum {
- BLUETOOTH_TYPE_ANY = 1,
- BLUETOOTH_TYPE_PHONE = 1 << 1,
- BLUETOOTH_TYPE_MODEM = 1 << 2,
- BLUETOOTH_TYPE_COMPUTER = 1 << 3,
- BLUETOOTH_TYPE_NETWORK = 1 << 4,
- BLUETOOTH_TYPE_HEADSET = 1 << 5,
- BLUETOOTH_TYPE_KEYBOARD = 1 << 6,
- BLUETOOTH_TYPE_MOUSE = 1 << 7,
- BLUETOOTH_TYPE_CAMERA = 1 << 8,
- BLUETOOTH_TYPE_PRINTER = 1 << 9
-};
+static void session_connect_error_cb (DBusGProxy *proxy, +static void session_connect_error_cb (DBusGProxy *proxy,
+ const char *session_object, + const char *session_object,
+ const gchar *error_name, + const gchar *error_name,
@ -14,46 +63,134 @@ Index: daemon/gvfsbackendobexftp.c
+static void session_connected_cb (DBusGProxy *proxy, +static void session_connected_cb (DBusGProxy *proxy,
+ const char *session_object, + const char *session_object,
+ gpointer user_data); + gpointer user_data);
+
/* This should all live in bluez-gnome, and we -static const char *
* should depend on it */ -_get_icon_from_type (guint type)
enum { +/* Used to detect broken listings from
@@ -207,66 +216,86 @@ + * old Nokia 3650s */
return g_str_has_prefix(bdaddr, "00:60:57"); +static gboolean
+_is_nokia_3650 (const char *bdaddr)
{
- switch (type)
- {
- case BLUETOOTH_TYPE_PHONE:
- return "phone";
- break;
- case BLUETOOTH_TYPE_MODEM:
- return "modem";
- break;
- case BLUETOOTH_TYPE_COMPUTER:
- return "network-server";
- break;
- case BLUETOOTH_TYPE_NETWORK:
- return "network-wireless";
- break;
- case BLUETOOTH_TYPE_HEADSET:
- return "stock_headphones";
- break;
- case BLUETOOTH_TYPE_KEYBOARD:
- return "input-keyboard";
- break;
- case BLUETOOTH_TYPE_MOUSE:
- return "input-mouse";
- break;
- case BLUETOOTH_TYPE_CAMERA:
- return "camera-photo";
- break;
- case BLUETOOTH_TYPE_PRINTER:
- return "printer";
- break;
- default:
- return "bluetooth";
- break;
- }
+ /* Don't ask, Nokia seem to use a Bluetooth
+ * HCI from Murata */
+ return g_str_has_prefix(bdaddr, "00:60:57");
} }
-static int
-_get_type_from_class (guint class)
+static char * +static char *
+get_name_and_class (DBusGProxy *device, guint32 *type) +get_name_and_icon (DBusGProxy *device, char **icon_name)
+{ {
- switch ((class & 0x1f00) >> 8)
+ GHashTable *hash; + GHashTable *hash;
+ +
+ if (dbus_g_proxy_call (device, "GetProperties", NULL, + if (dbus_g_proxy_call (device, "GetProperties", NULL,
+ G_TYPE_INVALID, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), + G_TYPE_INVALID, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE),
+ &hash, G_TYPE_INVALID) != FALSE) + &hash, G_TYPE_INVALID) != FALSE)
+ { {
- case 0x01:
- return BLUETOOTH_TYPE_COMPUTER;
- case 0x02:
- switch ((class & 0xfc) >> 2)
+ GValue *value; + GValue *value;
+ char *name; + char *name;
+ +
+ value = g_hash_table_lookup (hash, "Name"); + value = g_hash_table_lookup (hash, "Name");
+ name = value ? g_value_dup_string(value) : NULL; + name = value ? g_value_dup_string(value) : NULL;
+ +
+ value = g_hash_table_lookup (hash, "Class"); + value = g_hash_table_lookup (hash, "Icon");
+ if (value) + if (value)
+ { {
+ *type = _get_type_from_class (g_value_get_uint (value)); - case 0x01:
+ } - case 0x02:
- case 0x03:
- case 0x05:
- return BLUETOOTH_TYPE_PHONE;
- case 0x04:
- return BLUETOOTH_TYPE_MODEM;
+ *icon_name = g_value_dup_string (value);
}
- break;
- case 0x03:
- return BLUETOOTH_TYPE_NETWORK;
- case 0x04:
- switch ((class & 0xfc) >> 2)
+ else + else
+ { {
+ *type = BLUETOOTH_TYPE_ANY; - case 0x01:
+ } - return BLUETOOTH_TYPE_HEADSET;
+ *icon_name = g_strdup ("bluetooth");
}
- break;
- case 0x05:
- switch ((class & 0xc0) >> 6)
- {
- case 0x01:
- return BLUETOOTH_TYPE_KEYBOARD;
- case 0x02:
- return BLUETOOTH_TYPE_MOUSE;
- }
- break;
- case 0x06:
- if (class & 0x80)
- return BLUETOOTH_TYPE_PRINTER;
- if (class & 0x20)
- return BLUETOOTH_TYPE_CAMERA;
- break;
+ g_hash_table_destroy (hash);
+ return name; + return name;
+ } }
+
- return BLUETOOTH_TYPE_ANY;
+ return NULL; + return NULL;
+} }
+
-/* Used to detect broken listings from
- * old Nokia 3650s */
-static gboolean
-_is_nokia_3650 (const char *bdaddr)
-{
- /* Don't ask, Nokia seem to use a Bluetooth
- * HCI from Murata */
- return g_str_has_prefix(bdaddr, "00:60:57");
-}
-
static gchar * static gchar *
_get_device_properties (const char *bdaddr, guint32 *type) -_get_device_properties (const char *bdaddr, guint32 *type)
+_get_device_properties (const char *bdaddr, char **icon_name)
{ {
DBusGConnection *connection; DBusGConnection *connection;
DBusGProxy *manager; DBusGProxy *manager;
@ -122,7 +259,7 @@ Index: daemon/gvfsbackendobexftp.c
- } - }
+ DBusGProxy *device; + DBusGProxy *device;
+ device = dbus_g_proxy_new_for_name (connection, "org.bluez", device_path, "org.bluez.Device"); + device = dbus_g_proxy_new_for_name (connection, "org.bluez", device_path, "org.bluez.Device");
+ name = get_name_and_class (device, type); + name = get_name_and_icon (device, icon_name);
+ g_object_unref (device); + g_object_unref (device);
} }
g_object_unref (adapter); g_object_unref (adapter);
@ -132,7 +269,15 @@ Index: daemon/gvfsbackendobexftp.c
g_object_unref (manager); g_object_unref (manager);
dbus_g_connection_unref (connection); dbus_g_connection_unref (connection);
@@ -312,6 +341,15 @@ @@ -282,6 +211,7 @@
g_free (backend->display_name);
g_free (backend->bdaddr);
+ g_free (backend->icon_name);
g_free (backend->files_listing);
g_free (backend->directory);
@@ -312,6 +242,15 @@
"org.openobex", "org.openobex",
"/org/openobex", "/org/openobex",
"org.openobex.Manager"); "org.openobex.Manager");
@ -148,7 +293,17 @@ Index: daemon/gvfsbackendobexftp.c
} }
static gboolean static gboolean
@@ -531,6 +569,37 @@ @@ -437,8 +376,7 @@
g_file_info_set_file_type (info, G_FILE_TYPE_DIRECTORY);
g_file_info_set_content_type (info, "inode/directory");
g_file_info_set_name (info, "/");
- g_vfs_backend_set_icon_name (backend,
- _get_icon_from_type (op_backend->type));
+ g_vfs_backend_set_icon_name (backend, op_backend->icon_name);
display = g_strdup_printf (_("%s on %s"), "/", op_backend->display_name);
g_file_info_set_display_name (info, display);
g_free (display);
@@ -531,6 +469,37 @@
} }
static void static void
@ -186,7 +341,7 @@ Index: daemon/gvfsbackendobexftp.c
cancelled_cb (DBusGProxy *proxy, gpointer user_data) cancelled_cb (DBusGProxy *proxy, gpointer user_data)
{ {
GVfsBackendObexftp *op_backend = G_VFS_BACKEND_OBEXFTP (user_data); GVfsBackendObexftp *op_backend = G_VFS_BACKEND_OBEXFTP (user_data);
@@ -559,24 +628,6 @@ @@ -559,24 +528,6 @@
_exit (1); _exit (1);
} }
@ -211,7 +366,7 @@ Index: daemon/gvfsbackendobexftp.c
static void static void
do_mount (GVfsBackend *backend, do_mount (GVfsBackend *backend,
GVfsJobMount *job, GVfsJobMount *job,
@@ -590,7 +641,7 @@ @@ -590,7 +541,7 @@
const gchar *path = NULL; const gchar *path = NULL;
char *server; char *server;
GMountSpec *obexftp_mount_spec; GMountSpec *obexftp_mount_spec;
@ -220,7 +375,7 @@ Index: daemon/gvfsbackendobexftp.c
g_print ("+ do_mount\n"); g_print ("+ do_mount\n");
@@ -616,10 +667,11 @@ @@ -616,10 +567,11 @@
} }
/* FIXME, Have a way for the mount to be cancelled, see: /* FIXME, Have a way for the mount to be cancelled, see:
@ -234,7 +389,24 @@ Index: daemon/gvfsbackendobexftp.c
DBUS_TYPE_G_OBJECT_PATH, &path, G_TYPE_INVALID) == FALSE) DBUS_TYPE_G_OBJECT_PATH, &path, G_TYPE_INVALID) == FALSE)
{ {
g_free (op_backend->bdaddr); g_free (op_backend->bdaddr);
@@ -676,14 +728,20 @@ @@ -636,14 +588,13 @@
path,
"org.openobex.Session");
- op_backend->display_name = _get_device_properties (op_backend->bdaddr, &op_backend->type);
+ op_backend->display_name = _get_device_properties (op_backend->bdaddr, &op_backend->icon_name);
if (!op_backend->display_name)
op_backend->display_name = g_strdup (op_backend->bdaddr);
g_vfs_backend_set_display_name (G_VFS_BACKEND (op_backend),
op_backend->display_name);
- g_vfs_backend_set_icon_name (G_VFS_BACKEND (op_backend),
- _get_icon_from_type (op_backend->type));
+ g_vfs_backend_set_icon_name (G_VFS_BACKEND (op_backend), op_backend->icon_name);
obexftp_mount_spec = g_mount_spec_new ("obex");
server = g_strdup_printf ("[%s]", op_backend->bdaddr);
@@ -676,14 +627,20 @@
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT64, G_TYPE_INVALID); G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT64, G_TYPE_INVALID);
/* Now wait until the device is connected */ /* Now wait until the device is connected */
@ -262,7 +434,7 @@ Index: daemon/gvfsbackendobexftp.c
{ {
g_message ("mount failed, didn't connect"); g_message ("mount failed, didn't connect");
@@ -694,12 +752,17 @@ @@ -694,12 +651,17 @@
g_object_unref (op_backend->session_proxy); g_object_unref (op_backend->session_proxy);
op_backend->session_proxy = NULL; op_backend->session_proxy = NULL;
@ -283,7 +455,7 @@ Index: daemon/gvfsbackendobexftp.c
g_vfs_job_succeeded (G_VFS_JOB (job)); g_vfs_job_succeeded (G_VFS_JOB (job));
g_print ("- do_mount\n"); g_print ("- do_mount\n");
@@ -1482,6 +1545,12 @@ @@ -1482,6 +1444,12 @@
/* TransferStarted */ /* TransferStarted */
dbus_g_object_register_marshaller(obexftp_marshal_VOID__STRING_STRING_UINT64, dbus_g_object_register_marshaller(obexftp_marshal_VOID__STRING_STRING_UINT64,
G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT64, G_TYPE_INVALID); G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT64, G_TYPE_INVALID);
@ -296,12 +468,3 @@ Index: daemon/gvfsbackendobexftp.c
} }
/* /*
Index: daemon/obexftp-marshal.list
===================================================================
--- daemon/obexftp-marshal.list (revision 2008)
+++ daemon/obexftp-marshal.list (working copy)
@@ -1,2 +1,4 @@
+VOID:STRING
VOID:STRING,STRING
+VOID:STRING,STRING,STRING
VOID:STRING,STRING,UINT64

View File

@ -1,7 +1,7 @@
Summary: Backends for the gio framework in GLib Summary: Backends for the gio framework in GLib
Name: gvfs Name: gvfs
Version: 1.0.1 Version: 1.0.1
Release: 1%{?dist} Release: 2%{?dist}
License: LGPLv2+ License: LGPLv2+
Group: System Environment/Libraries Group: System Environment/Libraries
URL: http://www.gtk.org URL: http://www.gtk.org
@ -30,7 +30,7 @@ BuildRequires: automake autoconf
BuildRequires: libtool BuildRequires: libtool
Patch1: gvfs-0.99.2-archive-integration.patch Patch1: gvfs-0.99.2-archive-integration.patch
Patch2: gvfs-obexftp-updated-apis-2.patch Patch2: gvfs-obexftp-updated-apis-3.patch
%description %description
The gvfs package provides backend implementations for the gio The gvfs package provides backend implementations for the gio
@ -251,6 +251,9 @@ update-desktop-database &> /dev/null ||:
%changelog %changelog
* Mon Sep 29 2008 - Bastien Nocera <bnocera@redhat.com> - 1.0.1-2
- Update obexftp patch from upstream
* Wed Sep 24 2008 Matthias Clasen <mclasen@redhat.com> - 1.0.1-1 * Wed Sep 24 2008 Matthias Clasen <mclasen@redhat.com> - 1.0.1-1
- Update to 1.0.1 - Update to 1.0.1