Change the dbus-glib to gdbus in mobile 42/89642/1
authorHyuk Lee <hyuk0512.lee@samsung.com>
Mon, 26 Sep 2016 07:50:16 +0000 (16:50 +0900)
committerHyuk Lee <hyuk0512.lee@samsung.com>
Mon, 26 Sep 2016 07:50:16 +0000 (16:50 +0900)
Change-Id: I2cd23d086221a31f34f62e87dea15027a1947ab8
Signed-off-by: Hyuk Lee <hyuk0512.lee@samsung.com>
CMakeLists.txt
packaging/org.tizen.bt-syspopup.spec
src/bt-syspopup-m.c
src/bt-syspopup-m.h

index dbb2996afa56cb096c34d8eee8ac1a46eb5bac41..6464287f8dfc603e457a5c767f632c4793e66c7b 100644 (file)
@@ -55,6 +55,9 @@ pkg_check_modules(pkgs REQUIRED
        capi-media-player
        dlog
        dbus-glib-1
+       dbus-1
+       glib-2.0
+       gio-2.0
        ecore
        ecore-input
        ecore-imf
index 645966a2c1a430e25ddbfe918e47ef420a308566..06ad2d44666e02ae2ebf49ca80b19af7e4be5105 100644 (file)
@@ -26,6 +26,9 @@ BuildRequires:  pkgconfig(syspopup)
 BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(dbus-glib-1)
 BuildRequires:  pkgconfig(glib-2.0)
+BuildRequires:  pkgconfig(dbus-1)
+BuildRequires:  pkgconfig(gio-2.0)
+BuildRequires:  pkgconfig(gio-unix-2.0)
 BuildRequires:  pkgconfig(aul)
 BuildRequires:  pkgconfig(edbus)
 BuildRequires:  pkgconfig(feedback)
index e923be83d75c495625ccaace438ab2c6fbec1ee3..22797044f4d3e3f8adb487a63f60d5a96fdd6c1f 100644 (file)
@@ -40,6 +40,9 @@
 #include <app_control.h>
 #include <app_control_internal.h>
 #include <efl_extension.h>
+#include <glib.h>
+#include <gio/gio.h>
+#include <gio/giotypes.h>
 
 static void __bluetooth_delete_input_view(struct bt_popup_appdata *ad);
 static void __bluetooth_win_del(void *data);
@@ -477,11 +480,11 @@ static void __bluetooth_remove_all_event(struct bt_popup_appdata *ad)
        switch (ad->event_type) {
        case BT_EVENT_PIN_REQUEST:
 
-               dbus_g_proxy_call_no_reply(ad->agent_proxy,
-                                          "ReplyPinCode",
-                                          G_TYPE_UINT, BT_AGENT_CANCEL,
-                                          G_TYPE_STRING, "", G_TYPE_INVALID,
-                                          G_TYPE_INVALID);
+               g_dbus_proxy_call(ad->agent_proxy,
+                               "ReplyPinCode",
+                               g_variant_new("(us)", BT_AGENT_CANCEL, ""),
+                               G_DBUS_CALL_FLAGS_NONE,
+                               -1, NULL, NULL, NULL);
 
                break;
 
@@ -494,20 +497,21 @@ static void __bluetooth_remove_all_event(struct bt_popup_appdata *ad)
 
        case BT_EVENT_PASSKEY_CONFIRM_REQUEST:
 
-               dbus_g_proxy_call_no_reply(ad->agent_proxy,
-                                          "ReplyConfirmation",
-                                          G_TYPE_UINT, BT_AGENT_CANCEL,
-                                          G_TYPE_INVALID, G_TYPE_INVALID);
+               g_dbus_proxy_call(ad->agent_proxy,
+                               "ReplyConfirmation",
+                               g_variant_new("(u)", BT_AGENT_CANCEL),
+                               G_DBUS_CALL_FLAGS_NONE,
+                               -1, NULL, NULL, NULL);
 
                break;
 
        case BT_EVENT_PASSKEY_REQUEST:
 
-               dbus_g_proxy_call_no_reply(ad->agent_proxy,
-                                          "ReplyPasskey",
-                                          G_TYPE_UINT, BT_AGENT_CANCEL,
-                                          G_TYPE_STRING, "", G_TYPE_INVALID,
-                                          G_TYPE_INVALID);
+               g_dbus_proxy_call(ad->agent_proxy,
+                               "ReplyPasskey",
+                               g_variant_new("(us)", BT_AGENT_CANCEL, ""),
+                               G_DBUS_CALL_FLAGS_NONE,
+                               -1, NULL, NULL, NULL);
 
                break;
 
@@ -517,10 +521,11 @@ static void __bluetooth_remove_all_event(struct bt_popup_appdata *ad)
 
        case BT_EVENT_AUTHORIZE_REQUEST:
 
-               dbus_g_proxy_call_no_reply(ad->agent_proxy,
-                                          "ReplyAuthorize",
-                                          G_TYPE_UINT, BT_AGENT_CANCEL,
-                                          G_TYPE_INVALID, G_TYPE_INVALID);
+               g_dbus_proxy_call(ad->agent_proxy,
+                               "ReplyAuthorize",
+                               g_variant_new("(u)", BT_AGENT_CANCEL),
+                               G_DBUS_CALL_FLAGS_NONE,
+                               -1, NULL, NULL, NULL);
 
                break;
 
@@ -554,10 +559,11 @@ static void __bluetooth_remove_all_event(struct bt_popup_appdata *ad)
        case BT_EVENT_MESSAGE_REQUEST:
        case BT_EVENT_EXCHANGE_REQUEST:
 
-               dbus_g_proxy_call_no_reply(ad->agent_proxy,
-                                          "ReplyAuthorize",
-                                          G_TYPE_UINT, BT_AGENT_CANCEL,
-                                          G_TYPE_INVALID, G_TYPE_INVALID);
+               g_dbus_proxy_call(ad->agent_proxy,
+                               "ReplyAuthorize",
+                               g_variant_new("(u)", BT_AGENT_CANCEL),
+                               G_DBUS_CALL_FLAGS_NONE,
+                               -1, NULL, NULL, NULL);
 
                break;
 
@@ -661,15 +667,17 @@ static void __bluetooth_input_request_cb(void *data,
                     (response == BT_AGENT_ACCEPT) ? "Accept" : "Cancel");
 
        if (ad->event_type == BT_EVENT_PIN_REQUEST) {
-               dbus_g_proxy_call_no_reply(ad->agent_proxy,
-                                  "ReplyPinCode", G_TYPE_UINT, response,
-                                  G_TYPE_STRING, convert_input_text,
-                                  G_TYPE_INVALID, G_TYPE_INVALID);
+               g_dbus_proxy_call(ad->agent_proxy,
+                               "ReplyPinCode",
+                               g_variant_new("(us)", response, convert_input_text),
+                               G_DBUS_CALL_FLAGS_NONE,
+                               -1, NULL, NULL, NULL);
        } else {
-               dbus_g_proxy_call_no_reply(ad->agent_proxy,
-                                  "ReplyPasskey", G_TYPE_UINT, response,
-                                  G_TYPE_STRING, convert_input_text,
-                                  G_TYPE_INVALID, G_TYPE_INVALID);
+               g_dbus_proxy_call(ad->agent_proxy,
+                               "ReplyPasskey",
+                               g_variant_new("(us)", response, convert_input_text),
+                               G_DBUS_CALL_FLAGS_NONE,
+                               -1, NULL, NULL, NULL);
        }
        __bluetooth_delete_input_view(ad);
 
@@ -698,13 +706,17 @@ static void __bluetooth_passkey_confirm_cb(void *data,
        const char *event = elm_object_text_get(obj);
 
        if (!g_strcmp0(event, BT_STR_CONFIRM)) {
-               dbus_g_proxy_call_no_reply(ad->agent_proxy, "ReplyConfirmation",
-                                          G_TYPE_UINT, BT_AGENT_ACCEPT,
-                                          G_TYPE_INVALID, G_TYPE_INVALID);
+               g_dbus_proxy_call(ad->agent_proxy,
+                               "ReplyConfirmation",
+                               g_variant_new("(u)", BT_AGENT_ACCEPT),
+                               G_DBUS_CALL_FLAGS_NONE,
+                               -1, NULL, NULL, NULL);
        } else {
-               dbus_g_proxy_call_no_reply(ad->agent_proxy, "ReplyConfirmation",
-                                          G_TYPE_UINT, BT_AGENT_CANCEL,
-                                          G_TYPE_INVALID, G_TYPE_INVALID);
+               g_dbus_proxy_call(ad->agent_proxy,
+                               "ReplyConfirmation",
+                               g_variant_new("(u)", BT_AGENT_CANCEL),
+                               G_DBUS_CALL_FLAGS_NONE,
+                               -1, NULL, NULL, NULL);
        }
 
        evas_object_del(obj);
@@ -872,9 +884,11 @@ static void __bluetooth_authorization_request_cb(void *data,
                reply_val = BT_AGENT_CANCEL;
        }
 
-       dbus_g_proxy_call_no_reply(ad->agent_proxy, "ReplyAuthorize",
-               G_TYPE_UINT, reply_val,
-               G_TYPE_INVALID, G_TYPE_INVALID);
+       g_dbus_proxy_call(ad->agent_proxy,
+                               "ReplyAuthorize",
+                               g_variant_new("(u)", reply_val),
+                               G_DBUS_CALL_FLAGS_NONE,
+                               -1, NULL, NULL, NULL);
 
        ad->make_trusted = FALSE;
 
@@ -904,13 +918,17 @@ static void __bluetooth_push_authorization_request_cb(void *data,
        const char *event = elm_object_text_get(obj);
 
        if (!g_strcmp0(event, BT_STR_OK))
-               dbus_g_proxy_call_no_reply(ad->obex_proxy, "ReplyAuthorize",
-                                          G_TYPE_UINT, BT_AGENT_ACCEPT,
-                                          G_TYPE_INVALID, G_TYPE_INVALID);
+               g_dbus_proxy_call(ad->obex_proxy,
+                               "ReplyAuthorize",
+                               g_variant_new("(u)", BT_AGENT_ACCEPT),
+                               G_DBUS_CALL_FLAGS_NONE,
+                               -1, NULL, NULL, NULL);
        else
-               dbus_g_proxy_call_no_reply(ad->obex_proxy, "ReplyAuthorize",
-                                          G_TYPE_UINT, BT_AGENT_CANCEL,
-                                          G_TYPE_INVALID, G_TYPE_INVALID);
+               g_dbus_proxy_call(ad->obex_proxy,
+                               "ReplyAuthorize",
+                               g_variant_new("(u)", BT_AGENT_CANCEL),
+                               G_DBUS_CALL_FLAGS_NONE,
+                               -1, NULL, NULL, NULL);
 
        __bluetooth_win_del(ad);
 }
@@ -1302,15 +1320,18 @@ static void __bluetooth_input_mouseup_cb(void *data,
                        return;
 
                if (ad->event_type == BT_EVENT_PIN_REQUEST) {
-                       dbus_g_proxy_call_no_reply(ad->agent_proxy,
-                                          "ReplyPinCode", G_TYPE_UINT, response,
-                                          G_TYPE_STRING, convert_input_text,
-                                          G_TYPE_INVALID, G_TYPE_INVALID);
+                       g_dbus_proxy_call(ad->agent_proxy,
+                               "ReplyPinCode",
+                               g_variant_new("(us)", response, convert_input_text),
+                               G_DBUS_CALL_FLAGS_NONE,
+                               -1, NULL, NULL, NULL);
+
                } else {
-                       dbus_g_proxy_call_no_reply(ad->agent_proxy,
-                                          "ReplyPasskey", G_TYPE_UINT, response,
-                                          G_TYPE_STRING, convert_input_text,
-                                          G_TYPE_INVALID, G_TYPE_INVALID);
+                       g_dbus_proxy_call(ad->agent_proxy,
+                               "ReplyPasskey",
+                               g_variant_new("(us)", response, convert_input_text),
+                               G_DBUS_CALL_FLAGS_NONE,
+                               -1, NULL, NULL, NULL);
                }
                __bluetooth_delete_input_view(ad);
                free(convert_input_text);
@@ -1884,11 +1905,14 @@ static void __bluetooth_delete_input_view(struct bt_popup_appdata *ad)
        FN_END;
 }
 
-static DBusGProxy* __bluetooth_create_agent_proxy(DBusGConnection *conn,
+static GDBusProxy* __bluetooth_create_agent_proxy(GDBusConnection *conn,
                                                                const char *path)
 {
-       return dbus_g_proxy_new_for_name(conn, "org.projectx.bt", path,
-                                                       "org.bluez.Agent1");
+       return g_dbus_proxy_new_sync(conn, G_DBUS_PROXY_FLAGS_NONE,
+                       NULL, "org.projectx.bt",
+                       path,
+                       "org.bluez.Agent1",
+                       NULL, NULL);
 }
 
 static void
@@ -2449,14 +2473,14 @@ static Evas_Object *__bluetooth_create_win(const char *name)
 
 static void __bluetooth_session_init(struct bt_popup_appdata *ad)
 {
-       DBusGConnection *conn = NULL;
+       GDBusConnection *conn = NULL;
        GError *err = NULL;
 
 #if 0
        g_type_init();
 #endif
 
-       conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, &err);
+       conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, NULL);
 
        if (!conn) {
                BT_ERR("ERROR: Can't get on system bus [%s]",
@@ -2467,10 +2491,12 @@ static void __bluetooth_session_init(struct bt_popup_appdata *ad)
 
        ad->conn = conn;
 
-       ad->obex_proxy = dbus_g_proxy_new_for_name(conn,
-                                                  "org.bluez.frwk_agent",
-                                                  "/org/obex/ops_agent",
-                                                  "org.openobex.Agent");
+       ad->obex_proxy = g_dbus_proxy_new_sync(conn, G_DBUS_PROXY_FLAGS_NONE,
+                       NULL, "org.bluez.frwk_agent",
+                       "/org/obex/ops_agent",
+                       "org.openobex.Agent",
+                       NULL, &err);
+
        if (!ad->obex_proxy)
                BT_ERR("Could not create obex dbus proxy");
 
@@ -2553,7 +2579,7 @@ static void __bluetooth_terminate(void *data)
        __bluetooth_ime_hide();
 
        if (ad->conn) {
-               dbus_g_connection_unref(ad->conn);
+               g_object_unref(ad->conn);
                ad->conn = NULL;
        }
 
index d8973d355fd4ba8093ebc6c18459f1fbea360371..8dbdec249ef79c03714c5159d69f2c857bcdd59d 100644 (file)
@@ -29,6 +29,7 @@
 #include <glib.h>
 #include <dbus/dbus-glib.h>
 #include <player.h>
+#include <gio/gio.h>
 
 #define BT_PACKAGE_NAME "org.tizen.bt-syspopup"
 
@@ -283,10 +284,10 @@ struct bt_popup_appdata {
 
        Ecore_Timer *timer;
 
-       DBusGProxy *agent_proxy;
-       DBusGProxy *obex_proxy;
+       GDBusProxy *agent_proxy;
+       GDBusProxy *obex_proxy;
        E_DBus_Connection *EDBusHandle;
-       DBusGConnection *conn;
+       GDBusConnection *conn;
 
        int changed_mode;
        bt_rotate_mode_t rotation;