]> err.no Git - mapper/commitdiff
Fix maemo specific bluetooth D-Bus code so it works.
authorKaj-Michael Lang <milang@onion.tal.org>
Mon, 17 Sep 2007 10:45:51 +0000 (13:45 +0300)
committerKaj-Michael Lang <milang@onion.tal.org>
Mon, 17 Sep 2007 10:45:51 +0000 (13:45 +0300)
src/bt-maemo.c
src/bt.h
src/gps-browse.c

index 40a94bd55c27b86ca00c09f6e886fc532cf3ee02..d12e2b25f6d52c435908347d2369c1415837cf0b 100644 (file)
@@ -4,13 +4,21 @@
 
 #ifdef WITH_HILDON_DBUS_BT
 
+#include <fcntl.h>
+
 #include <libosso.h>
 #include <osso-helplib.h>
 #include <osso-ic-dbus.h>
 #include <osso-ic.h>
 #include <hildon-widgets/hildon-banner.h>
 
+#include <bt-dbus.h>
+
 #include "bt-maemo-marshal.h"
+#include "bt.h"
+#include "gps.h"
+#include "settings.h"
+#include "ui-common.h"
 
 /*****************************************************************************/
 
@@ -19,12 +27,8 @@ channel_cb_connect(GIOChannel * src, GIOCondition condition, gpointer data)
 {
 _gps_read_buf_curr = _gps_read_buf;
 _gps_read_buf_last = _gps_read_buf + GPS_READ_BUF_SIZE - 1;
-
 set_conn_state(RCVR_UP);
-
-_input_sid = g_io_add_watch_full(_channel, G_PRIORITY_HIGH_IDLE,
-                G_IO_IN | G_IO_PRI, channel_cb_input, NULL, NULL);
-
+_input_sid = g_io_add_watch_full(_channel, G_PRIORITY_HIGH_IDLE, G_IO_IN | G_IO_PRI, channel_cb_input, NULL, NULL);
 _connect_sid = 0;
 return FALSE;
 }
@@ -100,7 +104,7 @@ if (-1 == (_fd = open(fdpath, O_RDONLY))) {
        _error_sid = g_io_add_watch_full(_channel, G_PRIORITY_HIGH_IDLE,
                G_IO_ERR | G_IO_HUP, channel_cb_error, NULL, NULL);
        _connect_sid = g_io_add_watch_full(_channel, G_PRIORITY_HIGH_IDLE,
-               G_IO_OUT, channel_cb_connect, NULL,     NULL);
+               G_IO_OUT, channel_cb_connect, NULL, NULL);
        }
 g_free(fdpath);
 }
@@ -126,8 +130,7 @@ if (_conn_state == RCVR_DOWN && _rcvr_mac) {
                                confirm = hildon_note_new_confirmation(GTK_WINDOW(_window),
                                             _("Failed to connect to GPS receiver.  Retry?"));
 
-                               if (GTK_RESPONSE_OK ==
-                                   gtk_dialog_run(GTK_DIALOG(confirm)))
+                               if (GTK_RESPONSE_OK == gtk_dialog_run(GTK_DIALOG(confirm)))
                                        rcvr_connect_later();   /* Try again later. */
                                else
                                        set_conn_state(RCVR_OFF);
@@ -195,7 +198,7 @@ void rcvr_connect_later()
 _clater_sid = g_timeout_add(1000, (GSourceFunc) rcvr_connect_now, NULL);
 }
 
-void
+static void
 scan_cb_dev_found(DBusGProxy * sig_proxy, const gchar * bda,
                  const gchar * name, gpointer * class, guchar rssi, gint coff,
                  ScanInfo * scan_info)
@@ -205,7 +208,8 @@ gtk_list_store_append(scan_info->store, &iter);
 gtk_list_store_set(scan_info->store, &iter, 0, g_strdup(bda), 1, g_strdup(name), -1);
 }
 
-void scan_cb_search_complete(DBusGProxy * sig_proxy, ScanInfo * scan_info)
+static void 
+scan_cb_search_complete(DBusGProxy * sig_proxy, ScanInfo * scan_info)
 {
 gtk_widget_destroy(scan_info->banner);
 dbus_g_proxy_disconnect_signal(sig_proxy, BTSEARCH_DEV_FOUND_SIG,
@@ -245,7 +249,7 @@ DBusGConnection *dbus_conn;
                return 2;
        }
 
-       dbus_g_object_register_marshaller(g_cclosure_user_marshal_VOID__STRING_STRING_POINTER_UCHAR_UINT,
+       dbus_g_object_register_marshaller(_bt_maemo_VOID__STRING_STRING_POINTER_UCHAR_UINT,
             G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, DBUS_TYPE_G_UCHAR_ARRAY,
             G_TYPE_UCHAR, G_TYPE_UINT, G_TYPE_INVALID);
 
index 6463d9b55bb0cbd1e07e33348f5f38561a95fd31..567c895982fbf018371ea1d84592c88dfc0f3fab 100644 (file)
--- a/src/bt.h
+++ b/src/bt.h
@@ -3,6 +3,8 @@
 
 #define _GNU_SOURCE
 
+#include <dbus/dbus-glib.h>
+
 #include "utils.h"
 #include "mapper-types.h"
 
@@ -34,6 +36,10 @@ struct _ScanInfo {
        GtkWidget *banner;
        GtkListStore *store;
        guint sid;
+#ifdef WITH_HILDON_DBUS_BT
+       DBusGProxy *req_proxy;
+       DBusGProxy *sig_proxy;
+#endif
 };
 
 ConnState _conn_state;
index 73e5486902b0a6646e434792c1b281a7a042077d..b150cd03f23383decb436543aa7a416a6d477539 100644 (file)
 
 #include <sqlite3.h>
 
+#ifdef WITH_HILDON_DBUS_BT
+#include <bt-dbus.h>
+#endif
+
 #include "utils.h"
 #include "mapper-types.h"
 #include "bt.h"
@@ -102,10 +106,9 @@ gboolean scan_bluetooth(GtkWidget * widget, ScanInfo * scan_info)
 
        gtk_widget_destroy(dialog);
 
-#ifdef BT_HILDON_DBUS
+#ifdef WITH_HILDON_DBUS_BT
        /* Clean up D-Bus. */
-       dbus_g_proxy_call(scan_info->req_proxy, BTSEARCH_STOP_SEARCH_REQ,
-                         &error, G_TYPE_INVALID, G_TYPE_INVALID);
+       dbus_g_proxy_call(scan_info->req_proxy, BTSEARCH_STOP_SEARCH_REQ, &error, G_TYPE_INVALID, G_TYPE_INVALID);
        g_object_unref(scan_info->req_proxy);
        g_object_unref(scan_info->sig_proxy);
 #endif