Change the dbus-glib to gdbus in wearable 66/89666/1
authorHyuk Lee <hyuk0512.lee@samsung.com>
Mon, 26 Sep 2016 09:08:30 +0000 (18:08 +0900)
committerHyuk Lee <hyuk0512.lee@samsung.com>
Mon, 26 Sep 2016 09:08:30 +0000 (18:08 +0900)
Change-Id: I040038961c055c99ee6237722e608033e4995879
Signed-off-by: Hyuk Lee <hyuk0512.lee@samsung.com>
CMakeLists.txt
packaging/org.tizen.bt-syspopup.spec
src/bt-syspopup-w.c
src/bt-syspopup-w.h

index dbb2996afa56cb096c34d8eee8ac1a46eb5bac41..ee99c3c018e068b7d617533f84c4c121cf42bd40 100644 (file)
@@ -30,6 +30,9 @@ pkg_check_modules(pkgs REQUIRED
        deviced
        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 79d464596059c0adef606c74ad6cdf0f1cd6ff1f..57315bb22a0c5162bbdb6e55ac8c12244532a6fb 100644 (file)
@@ -35,6 +35,8 @@
 #include <bundle.h>
 #include <bundle_internal.h>
 #include <app_control_internal.h>
+#include <glib.h>
+#include <gio/gio.h>
 
 #define COLOR_TABLE "/usr/apps/org.tizen.bt-syspopup/shared/res/tables/com.samsung.bt-syspopup_ChangeableColorTable.xml"
 #define FONT_TABLE "/usr/apps/org.tizen.bt-syspopup/shared/res/tables/com.samsung.bt-syspopup_FontInfoTable.xml"
@@ -279,11 +281,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;
 
@@ -296,21 +298,23 @@ 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);
+
                __unlock_display();
 
                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;
 
@@ -320,10 +324,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;
 
@@ -355,10 +360,11 @@ static void __bluetooth_remove_all_event(struct bt_popup_appdata *ad)
        case BT_EVENT_PUSH_AUTHORIZE_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;
 
@@ -384,10 +390,12 @@ static void __bluetooth_remove_all_event(struct bt_popup_appdata *ad)
 
        case BT_EVENT_SYSTEM_RESET_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);
+
                __unlock_display();
 
                break;
@@ -494,15 +502,19 @@ static void __bluetooth_passkey_confirm_cb(void *data,
        if (!g_strcmp0(style, "popup/circle/right")) {
                BT_INFO("Accept the pairing passkey");
                __bluetooth_send_signal_pairing_confirm_result(ad, 1);
-               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 {
                BT_INFO("Reject the pairing passkey");
                __bluetooth_send_signal_pairing_confirm_result(ad, 0);
-               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);
        }
        __unlock_display();
 
@@ -567,9 +579,11 @@ static void __bluetooth_reset_cb(void *data, Evas_Object *obj, void *event_info)
        const char *style = elm_object_style_get(obj);
 
        __bluetooth_send_signal_pairing_confirm_result(ad, 0);
-       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);
 
        if (!g_strcmp0(style, "popup/circle/right")) {
                BT_INFO("Confirm Soft reset");
@@ -621,9 +635,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);
 
        evas_object_del(obj);
        __bluetooth_win_del(ad);
@@ -1245,15 +1261,17 @@ static void __bluetooth_pincode_btn_cb(void *data, Evas_Object *obj,
        retm_if(po == NULL, "ad is NULL!");
 
        if (ad->event_type == BT_EVENT_PIN_REQUEST) {
-               dbus_g_proxy_call_no_reply(ad->agent_proxy,
-                                       "ReplyPinCode", G_TYPE_UINT, BT_AGENT_ACCEPT,
-                                       G_TYPE_STRING, po->pincode,
-                                       G_TYPE_INVALID, G_TYPE_INVALID);
+               g_dbus_proxy_call(ad->agent_proxy,
+                               "ReplyPinCode",
+                               g_variant_new("(us)", BT_AGENT_ACCEPT, po->pincode),
+                               G_DBUS_CALL_FLAGS_NONE,
+                               -1, NULL, NULL, NULL);
        } else {
-               dbus_g_proxy_call_no_reply(ad->agent_proxy,
-                                       "ReplyPasskey", G_TYPE_UINT, BT_AGENT_ACCEPT,
-                                       G_TYPE_STRING, po->pincode,
-                                       G_TYPE_INVALID, G_TYPE_INVALID);
+               g_dbus_proxy_call(ad->agent_proxy,
+                               "ReplyPasskey",
+                               g_variant_new("(us)", BT_AGENT_ACCEPT, po->pincode),
+                               G_DBUS_CALL_FLAGS_NONE,
+                               -1, NULL, NULL, NULL);
        }
 
        if (po->pincode) {
@@ -1574,15 +1592,17 @@ static void __bluetooth_draw_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)
 {
-       DBusGProxy *proxy;
+       GDBusProxy *proxy;
 
-       proxy = dbus_g_proxy_new_for_name(conn, "org.projectx.bt",
-                       path, "org.bluez.Agent1");
+       proxy = g_dbus_proxy_new_sync(conn, G_DBUS_PROXY_FLAGS_NONE,
+                       NULL, "org.projectx.bt",
+                       path, "org.bluez.Agent1",
+                       NULL, NULL);
        if (!proxy)
-               BT_ERR("dbus_g_proxy_new_for_name is failed");
+               BT_ERR("g_dbus_proxy_new_sync is failed");
 
        return proxy;
 
@@ -1681,10 +1701,11 @@ static int __bluetooth_launch_handler(struct bt_popup_appdata *ad,
                                free(conv_str);
 
                        __bluetooth_send_signal_pairing_confirm_result(ad, 1);
-                       dbus_g_proxy_call_no_reply(ad->agent_proxy,
+                       g_dbus_proxy_call(ad->agent_proxy,
                                        "ReplyConfirmation",
-                                       G_TYPE_UINT, BT_AGENT_ACCEPT,
-                                       G_TYPE_INVALID, G_TYPE_INVALID);
+                                       g_variant_new("(u)", BT_AGENT_ACCEPT),
+                                       G_DBUS_CALL_FLAGS_NONE,
+                                       -1, NULL, NULL, NULL);
                }
                break;
        }
@@ -1886,10 +1907,10 @@ static Evas_Object *__bluetooth_create_win(const char *name, void *data)
 
 static void __bluetooth_session_init(struct bt_popup_appdata *ad)
 {
-       DBusGConnection *conn = NULL;
+       GDBusConnection *conn = NULL;
        GError *err = NULL;
 
-       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]",
@@ -1900,10 +1921,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");
 
@@ -1966,7 +1989,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 aba394d2577eabc8be4005be1f83d89a56f33b0b..53efd07a7bdf2fa38d25437ae5bcb76346bd7698 100644 (file)
@@ -25,6 +25,7 @@
 #include <glib.h>
 #include <dbus/dbus-glib.h>
 #include <efl_extension.h>
+#include <gio/gio.h>
 
 #define BT_PACKAGE_NAME "org.tizen.bt-syspopup"
 #define BT_PREFIX "/usr/apps/"BT_PACKAGE_NAME
@@ -247,10 +248,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_popup_event_type_t event_type;