[gnome-bluetooth] Make some parts of BluetoothClient available



commit d65821b3f633809addfb91bb88728292b17b0bb8
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Jun 29 09:59:02 2009 +0100

    Make some parts of BluetoothClient available
    
    To simplify enumeration in other applications.

 applet/main.c                  |    1 +
 lib/Makefile.am                |    7 +++-
 lib/bluetooth-chooser.c        |    1 +
 lib/bluetooth-client-private.h |   63 ++++++++++++++++++++++++++++++++++++++++
 lib/bluetooth-client.c         |    1 +
 lib/bluetooth-client.h         |   48 +-----------------------------
 lib/bluetooth-enums.h          |   20 ++++++++++++
 lib/test-client.c              |    1 +
 properties/adapter.c           |    1 +
 wizard/main.c                  |    1 +
 10 files changed, 95 insertions(+), 49 deletions(-)
---
diff --git a/applet/main.c b/applet/main.c
index 2df0bcb..0008c02 100644
--- a/applet/main.c
+++ b/applet/main.c
@@ -33,6 +33,7 @@
 #include <unique/uniqueapp.h>
 
 #include <bluetooth-client.h>
+#include <bluetooth-client-private.h>
 #include <bluetooth-chooser.h>
 #include <bluetooth-killswitch.h>
 
diff --git a/lib/Makefile.am b/lib/Makefile.am
index dd5ed45..43a3c14 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -8,6 +8,7 @@ lib_LTLIBRARIES = libgnome-bluetooth.la
 
 libcommon_la_SOURCES =						\
 		bluetooth-client.h bluetooth-client.c		\
+		bluetooth-client-private.h			\
 		bluetooth-agent.h bluetooth-agent.c		\
 		bluetooth-killswitch.h bluetooth-killswitch.c	\
 		obex-agent.h obex-agent.c			\
@@ -22,6 +23,7 @@ libcommon_la_LDFLAGS = -no-undefined $(AM_LDFLAGS)
 libgnome_bluetooth_la_SOURCES =				\
 	bluetooth-enums.h				\
 	bluetooth-client.h bluetooth-client.c		\
+	bluetooth-client-private.h			\
 	marshal.h marshal.c				\
 	gnome-bluetooth-enum-types.h			\
 	gnome-bluetooth-enum-types.c			\
@@ -40,6 +42,7 @@ libgnome_bluetooth_la_LDFLAGS =				\
 
 gnomebluetoothdir = $(pkgincludedir)
 gnomebluetooth_HEADERS =				\
+	bluetooth-client.h				\
 	bluetooth-chooser.h				\
 	bluetooth-chooser-button.h			\
 	bluetooth-enums.h				\
@@ -129,7 +132,7 @@ bluetooth-agent-glue.h: bluetooth-agent.xml
 obex-agent-glue.h: obex-agent.xml
 	$(DBUS_BINDING_TOOL) --prefix=obex_agent --mode=glib-server --output=$@ $<
 
-gnome_bluetooth_headers_to_scan_for_enums = bluetooth-client.h bluetooth-enums.h
+gnome_bluetooth_headers_to_scan_for_enums = bluetooth-enums.h
 # Generate the enums source code, with glib-mkenums:
 # This is based on the same Makefile.am stuff in pango:
 gnome_bluetooth_built_headers = gnome-bluetooth-enum-types.h
@@ -150,7 +153,7 @@ gnome-bluetooth-enum-types.c: $(gnome_bluetooth_headers_to_scan_for_enums) Makef
 	(cd $(srcdir) && glib-mkenums \
 			--fhead "#include <bluetooth-enums.h>\n" \
 			--fhead "#include \"gnome-bluetooth-enum-types.h\"\n" \
-			--fhead "#include \"bluetooth-client.h\"\n" \
+			--fhead "#include \"bluetooth-enums.h\"\n" \
 			--fhead "#include <glib-object.h>" \
 		      	--fprod "\n/* enumerations from \"@filename \" */" \
 			--vhead "GType\n enum_name@_get_type (void)\n{\n  static GType etype = 0;\n  if (etype == 0) {\n    static const G Type@Value values[] = {" 	\
diff --git a/lib/bluetooth-chooser.c b/lib/bluetooth-chooser.c
index e66e8ea..70103ed 100644
--- a/lib/bluetooth-chooser.c
+++ b/lib/bluetooth-chooser.c
@@ -31,6 +31,7 @@
 #include <glib/gi18n-lib.h>
 
 #include "bluetooth-client.h"
+#include "bluetooth-client-private.h"
 #include "bluetooth-chooser.h"
 #include "gnome-bluetooth-enum-types.h"
 #include "bling-spinner.h"
diff --git a/lib/bluetooth-client-private.h b/lib/bluetooth-client-private.h
new file mode 100644
index 0000000..5c0ea75
--- /dev/null
+++ b/lib/bluetooth-client-private.h
@@ -0,0 +1,63 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2005-2008  Marcel Holtmann <marcel holtmann org>
+ *
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifndef __BLUETOOTH_CLIENT_PRIVATE_H
+#define __BLUETOOTH_CLIENT_PRIVATE_H
+
+#include <glib-object.h>
+#include <gtk/gtk.h>
+#include <dbus/dbus-glib.h>
+#include <bluetooth-enums.h>
+
+G_BEGIN_DECLS
+
+DBusGProxy *bluetooth_client_get_default_adapter(BluetoothClient *client);
+
+gboolean bluetooth_client_start_discovery(BluetoothClient *client);
+gboolean bluetooth_client_stop_discovery(BluetoothClient *client);
+
+typedef void (*BluetoothClientCreateDeviceFunc) (BluetoothClient *client, const char *path, gpointer data);
+
+gboolean bluetooth_client_create_device(BluetoothClient *client,
+			const char *address, const char *agent,
+			BluetoothClientCreateDeviceFunc func, gpointer data);
+
+gboolean bluetooth_client_set_trusted(BluetoothClient *client,
+					const char *device, gboolean trusted);
+
+typedef void (*BluetoothClientConnectFunc) (BluetoothClient *client,
+					    gboolean success,
+					    gpointer data);
+
+gboolean bluetooth_client_connect_service(BluetoothClient *client,
+					  const char *device,
+					  BluetoothClientConnectFunc func,
+					  gpointer data);
+gboolean bluetooth_client_disconnect_service (BluetoothClient *client,
+					      const char *device,
+					      BluetoothClientConnectFunc func,
+					      gpointer data);
+
+G_END_DECLS
+
+#endif /* __BLUETOOTH_CLIENT_PRIVATE_H */
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index 3ebfcb5..ffd7527 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -32,6 +32,7 @@
 #include <dbus/dbus-glib.h>
 
 #include "bluetooth-client.h"
+#include "bluetooth-client-private.h"
 #include "bluetooth-client-glue.h"
 
 #include "marshal.h"
diff --git a/lib/bluetooth-client.h b/lib/bluetooth-client.h
index 71ea6c6..d375d27 100644
--- a/lib/bluetooth-client.h
+++ b/lib/bluetooth-client.h
@@ -31,26 +31,6 @@
 
 G_BEGIN_DECLS
 
-typedef enum {
-	BLUETOOTH_COLUMN_PROXY,
-	BLUETOOTH_COLUMN_ADDRESS,
-	BLUETOOTH_COLUMN_ALIAS,
-	BLUETOOTH_COLUMN_NAME,
-	BLUETOOTH_COLUMN_TYPE,
-	BLUETOOTH_COLUMN_ICON,
-	BLUETOOTH_COLUMN_RSSI,
-	BLUETOOTH_COLUMN_DEFAULT,
-	BLUETOOTH_COLUMN_PAIRED,
-	BLUETOOTH_COLUMN_TRUSTED,
-	BLUETOOTH_COLUMN_CONNECTED,
-	BLUETOOTH_COLUMN_DISCOVERING,
-	BLUETOOTH_COLUMN_LEGACYPAIRING,
-	BLUETOOTH_COLUMN_POWERED,
-	BLUETOOTH_COLUMN_SERVICES,
-	BLUETOOTH_COLUMN_UUIDS,
-	_BLUETOOTH_NUM_COLUMNS /*< skip >*/
-} BluetoothColumn;
-
 #define BLUETOOTH_TYPE_CLIENT (bluetooth_client_get_type())
 #define BLUETOOTH_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
 					BLUETOOTH_TYPE_CLIENT, BluetoothClient))
@@ -79,6 +59,7 @@ GType bluetooth_client_get_type(void);
 BluetoothClient *bluetooth_client_new(void);
 
 GtkTreeModel *bluetooth_client_get_model(BluetoothClient *client);
+
 GtkTreeModel *bluetooth_client_get_filter_model(BluetoothClient *client,
 				GtkTreeModelFilterVisibleFunc func,
 				gpointer data, GDestroyNotify destroy);
@@ -89,33 +70,6 @@ GtkTreeModel *bluetooth_client_get_device_filter_model(BluetoothClient *client,
 		DBusGProxy *adapter, GtkTreeModelFilterVisibleFunc func,
 				gpointer data, GDestroyNotify destroy);
 
-DBusGProxy *bluetooth_client_get_default_adapter(BluetoothClient *client);
-
-gboolean bluetooth_client_start_discovery(BluetoothClient *client);
-gboolean bluetooth_client_stop_discovery(BluetoothClient *client);
-
-typedef void (*BluetoothClientCreateDeviceFunc) (BluetoothClient *client, const char *path, gpointer data);
-
-gboolean bluetooth_client_create_device(BluetoothClient *client,
-			const char *address, const char *agent,
-			BluetoothClientCreateDeviceFunc func, gpointer data);
-
-gboolean bluetooth_client_set_trusted(BluetoothClient *client,
-					const char *device, gboolean trusted);
-
-typedef void (*BluetoothClientConnectFunc) (BluetoothClient *client,
-					    gboolean success,
-					    gpointer data);
-
-gboolean bluetooth_client_connect_service(BluetoothClient *client,
-					  const char *device,
-					  BluetoothClientConnectFunc func,
-					  gpointer data);
-gboolean bluetooth_client_disconnect_service (BluetoothClient *client,
-					      const char *device,
-					      BluetoothClientConnectFunc func,
-					      gpointer data);
-
 const gchar *bluetooth_type_to_string(guint type);
 gboolean bluetooth_verify_address (const char *bdaddr);
 const char *bluetooth_uuid_to_string (const char *uuid);
diff --git a/lib/bluetooth-enums.h b/lib/bluetooth-enums.h
index 97919a8..7163607 100644
--- a/lib/bluetooth-enums.h
+++ b/lib/bluetooth-enums.h
@@ -59,6 +59,26 @@ typedef enum {
 #define BLUETOOTH_TYPE_INPUT (BLUETOOTH_TYPE_KEYBOARD | BLUETOOTH_TYPE_MOUSE | BLUETOOTH_TYPE_TABLET | BLUETOOTH_TYPE_JOYPAD)
 #define BLUETOOTH_TYPE_AUDIO (BLUETOOTH_TYPE_HEADSET | BLUETOOTH_TYPE_HEADPHONES | BLUETOOTH_TYPE_OTHER_AUDIO)
 
+typedef enum {
+	BLUETOOTH_COLUMN_PROXY,
+	BLUETOOTH_COLUMN_ADDRESS,
+	BLUETOOTH_COLUMN_ALIAS,
+	BLUETOOTH_COLUMN_NAME,
+	BLUETOOTH_COLUMN_TYPE,
+	BLUETOOTH_COLUMN_ICON,
+	BLUETOOTH_COLUMN_RSSI,
+	BLUETOOTH_COLUMN_DEFAULT,
+	BLUETOOTH_COLUMN_PAIRED,
+	BLUETOOTH_COLUMN_TRUSTED,
+	BLUETOOTH_COLUMN_CONNECTED,
+	BLUETOOTH_COLUMN_DISCOVERING,
+	BLUETOOTH_COLUMN_LEGACYPAIRING,
+	BLUETOOTH_COLUMN_POWERED,
+	BLUETOOTH_COLUMN_SERVICES,
+	BLUETOOTH_COLUMN_UUIDS,
+	_BLUETOOTH_NUM_COLUMNS /*< skip >*/
+} BluetoothColumn;
+
 G_END_DECLS
 
 #endif /* __BLUETOOTH_ENUMS_H */
diff --git a/lib/test-client.c b/lib/test-client.c
index 02f3862..57edcc2 100644
--- a/lib/test-client.c
+++ b/lib/test-client.c
@@ -30,6 +30,7 @@
 #include <dbus/dbus-glib.h>
 
 #include "bluetooth-client.h"
+#include "bluetooth-client-private.h"
 
 static BluetoothClient *client;
 static GtkTreeSelection *selection;
diff --git a/properties/adapter.c b/properties/adapter.c
index 738f791..7bbf158 100644
--- a/properties/adapter.c
+++ b/properties/adapter.c
@@ -32,6 +32,7 @@
 #include <dbus/dbus-glib.h>
 
 #include <bluetooth-client.h>
+#include <bluetooth-client-private.h>
 #include <bluetooth-killswitch.h>
 #include <bluetooth-chooser.h>
 #include <bluetooth-plugin-manager.h>
diff --git a/wizard/main.c b/wizard/main.c
index 44cbddf..83260ed 100644
--- a/wizard/main.c
+++ b/wizard/main.c
@@ -35,6 +35,7 @@
 
 #include <bling-spinner.h>
 #include <bluetooth-client.h>
+#include <bluetooth-client-private.h>
 #include <bluetooth-chooser.h>
 #include <bluetooth-agent.h>
 #include <bluetooth-plugin-manager.h>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]