Use dbus connection instead of dbus_g_connection 51/69851/1 accepted/tizen/common/20160517.174237 accepted/tizen/ivi/20160517.083729 accepted/tizen/mobile/20160517.083913 accepted/tizen/tv/20160517.083718 accepted/tizen/wearable/20160517.083752 submit/tizen/20160517.054553
authorDoHyun Pyun <dh79.pyun@samsung.com>
Tue, 17 May 2016 05:27:50 +0000 (14:27 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Tue, 17 May 2016 05:27:50 +0000 (14:27 +0900)
In later, we should replace this event filter logic as gdbus.
Because dbus_connection_setup_with_g_main function will be deprecated.

Change-Id: I8caf059bbe881498799a43a7733368fd686d32a0
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
bt-share/src/bt-share-ipc.c

index 2e30a26..2e9b10d 100644 (file)
@@ -18,7 +18,6 @@
  */
 
 #include <dbus/dbus-glib-lowlevel.h>
-#include <dbus/dbus-glib.h>
 #include <dbus/dbus.h>
 #include <glib.h>
 #include <time.h>
@@ -495,20 +494,26 @@ static DBusHandlerResult __event_filter(DBusConnection *sys_conn,
 gboolean _bt_init_dbus_signal(void)
 {
        DBG("+");
-       DBusGConnection *conn;
-       GError *err = NULL;
        DBusError dbus_error;
 
-       conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, &err);
-       if (!conn) {
+       dbus_error_init(&dbus_error);
+
+       if (dbus_connection == NULL) {
+               dbus_connection = dbus_bus_get(DBUS_BUS_SYSTEM, &dbus_error);
+       }
+
+       if (dbus_connection == NULL) {
                ERR(" DBUS get failed");
-               g_error_free(err);
+               if (dbus_error_is_set(&dbus_error)) {
+                       ERR("D-Bus Error: %s\n", dbus_error.message);
+                       dbus_error_free(&dbus_error);
+               }
                return FALSE;
        }
-       dbus_connection = dbus_g_connection_get_connection(conn);
+
+       dbus_connection_setup_with_g_main(dbus_connection, NULL);
 
        /* Add the filter for network client functions */
-       dbus_error_init(&dbus_error);
        dbus_connection_add_filter(dbus_connection, __event_filter, NULL, NULL);
        dbus_bus_add_match(dbus_connection,
                        "type=signal,interface=" BT_BLUEZ_INTERFACE