rpms/bluez-gnome/devel 0001-Fix-getting-names-of-remote-devices.patch, NONE, 1.1 bluetooth-sendto-ods-svn.patch, NONE, 1.1 bluez-gnome.spec, 1.57, 1.58

Bastien Nocera hadess at fedoraproject.org
Wed Sep 24 01:06:42 UTC 2008


Author: hadess

Update of /cvs/pkgs/rpms/bluez-gnome/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv25607

Modified Files:
	bluez-gnome.spec 
Added Files:
	0001-Fix-getting-names-of-remote-devices.patch 
	bluetooth-sendto-ods-svn.patch 
Log Message:
* Tue Sep 23 2008 - Bastien Nocera <bnocera at redhat.com> - 1.4-4
- Update bluetooth-sendto to the BlueZ 4.x API, and obex-data-server
  SVN APIs


0001-Fix-getting-names-of-remote-devices.patch:

--- NEW FILE 0001-Fix-getting-names-of-remote-devices.patch ---
>From 71bd2202a5407af206f2476de20e379d8bbea264 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess at hadess.net>
Date: Tue, 23 Sep 2008 17:53:49 -0700
Subject: [PATCH] Fix getting names of remote devices

Look in the BlueZ device database to find the name of the
remote device, porting code from BlueZ 3.x to the 4.x APIs
---
 sendto/main.c |   80 +++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 52 insertions(+), 28 deletions(-)

diff --git a/sendto/main.c b/sendto/main.c
index daccf91..044bbbc 100644
--- a/sendto/main.c
+++ b/sendto/main.c
@@ -415,52 +415,76 @@ static void create_notify(DBusGProxy *proxy,
 							G_TYPE_INVALID);
 }
 
+static char *
+get_name (DBusGProxy *device)
+{
+	GHashTable *hash;
+
+	if (dbus_g_proxy_call(device, "GetProperties", NULL,
+			      G_TYPE_INVALID, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE),
+			      &hash, G_TYPE_INVALID) != FALSE) {
+		GValue *value;
+		char *name;
+
+		value = g_hash_table_lookup(hash, "Name");
+		name = value ? g_value_dup_string(value) : NULL;
+		g_hash_table_destroy(hash);
+		return name;
+	}
+
+	return NULL;
+}
+
 static gchar *get_device_name(const gchar *address)
 {
 	DBusGConnection *connection;
-	DBusGProxy *manager, *proxy;
-	gchar *adapter, *name;
+	DBusGProxy *manager;
+	GPtrArray *adapters;
+	gchar *name;
+	guint i;
+
+	name = NULL;
 
 	connection = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL);
 	if (connection == NULL)
-		return NULL;
+		return name;
 
 	manager = dbus_g_proxy_new_for_name(connection, "org.bluez",
-					"/org/bluez", "org.bluez.Manager");
+					    "/", "org.bluez.Manager");
 	if (manager == NULL) {
 		dbus_g_connection_unref(connection);
-		return NULL;
+		return name;
 	}
 
-	if (dbus_g_proxy_call(manager, "DefaultAdapter", NULL, G_TYPE_INVALID,
-			G_TYPE_STRING, &adapter, G_TYPE_INVALID) == FALSE) {
+	if (dbus_g_proxy_call(manager, "ListAdapters", NULL,
+			      G_TYPE_INVALID, dbus_g_type_get_collection ("GPtrArray", DBUS_TYPE_G_OBJECT_PATH), &adapters,
+			      G_TYPE_INVALID) == FALSE) {
 		g_object_unref(manager);
 		dbus_g_connection_unref(connection);
-		return NULL;
+		return name;
 	}
 
-	g_object_unref(manager);
-
-	proxy = dbus_g_proxy_new_for_name(connection, "org.bluez",
-						adapter, "org.bluez.Adapter");
-	if (proxy == NULL) {
-		g_free(adapter);
-		dbus_g_connection_unref(connection);
-		return NULL;
-	}
-
-	g_free(adapter);
-
-	if (dbus_g_proxy_call(proxy, "GetRemoteName", NULL,
-			G_TYPE_STRING, address, G_TYPE_INVALID,
-			G_TYPE_STRING, &name, G_TYPE_INVALID) == FALSE) {
-		g_object_unref(proxy);
-		dbus_g_connection_unref(connection);
-		return NULL;
+	for (i = 0; i < adapters->len && name == NULL; i++)
+	{
+		DBusGProxy *adapter;
+		char *device_path;
+
+		adapter = dbus_g_proxy_new_for_name(connection, "org.bluez",
+						    g_ptr_array_index (adapters, i), "org.bluez.Adapter");
+		if (dbus_g_proxy_call(adapter, "FindDevice", NULL,
+				      G_TYPE_STRING, address, G_TYPE_INVALID,
+				      DBUS_TYPE_G_OBJECT_PATH, &device_path, G_TYPE_INVALID) != FALSE) {
+			DBusGProxy *device;
+			device = dbus_g_proxy_new_for_name(connection, "org.bluez", device_path, "org.bluez.Device");
+			name = get_name(device);
+			g_object_unref(device);
+			break;
+		}
+		g_object_unref(adapter);
 	}
 
-	g_object_unref(proxy);
-
+	g_ptr_array_free(adapters, TRUE);
+	g_object_unref(manager);
 	dbus_g_connection_unref(connection);
 
 	return name;
-- 
1.6.0.1


bluetooth-sendto-ods-svn.patch:

--- NEW FILE bluetooth-sendto-ods-svn.patch ---
diff --git a/sendto/main.c b/sendto/main.c
index 044bbbc..f0c435b 100644
--- a/sendto/main.c
+++ b/sendto/main.c
@@ -619,6 +619,7 @@ int main(int argc, char *argv[])
 	dbus_g_proxy_begin_call(proxy, "CreateBluetoothSession",
 				create_notify, NULL, NULL,
 				G_TYPE_STRING, option_device,
+				G_TYPE_STRING, "00:00:00:00:00:00",
 				G_TYPE_STRING, "opp", G_TYPE_INVALID);
 
 	gtk_main();


Index: bluez-gnome.spec
===================================================================
RCS file: /cvs/pkgs/rpms/bluez-gnome/devel/bluez-gnome.spec,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- bluez-gnome.spec	14 Sep 2008 21:07:30 -0000	1.57
+++ bluez-gnome.spec	24 Sep 2008 01:06:12 -0000	1.58
@@ -1,6 +1,6 @@
 Name:		bluez-gnome
 Version:	1.4
-Release:	3%{?dist}
+Release:	4%{?dist}
 Summary:	Bluetooth pairing and control applet
 
 Group:		Applications/System
@@ -8,6 +8,9 @@
 URL:		http://www.bluez.org/
 Source0:	http://www.kernel.org/pub/linux/bluetooth/%{name}-%{version}.tar.gz
 
+Patch0:		0001-Fix-getting-names-of-remote-devices.patch
+Patch1:		bluetooth-sendto-ods-svn.patch
+
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 ExcludeArch:	s390 s390x
@@ -44,6 +47,8 @@
 
 %prep
 %setup -q
+%patch0 -p1 -b .bluez4
+%patch1 -p1 -b .ods-svn
 
 %build
 %configure --disable-mime-update --disable-desktop-update --disable-icon-update
@@ -136,6 +141,10 @@
 %{_mandir}/man1/bluetooth-analyzer.1.gz
 
 %changelog
+* Tue Sep 23 2008 - Bastien Nocera <bnocera at redhat.com> - 1.4-4
+- Update bluetooth-sendto to the BlueZ 4.x API, and obex-data-server
+  SVN APIs
+
 * Sun Sep 14 2008 - David Woodhouse <David.Woodhouse at intel.com>
 - Tidy up specfile, fix source URL
 




More information about the fedora-extras-commits mailing list