[Backup&reset] Reset DBus call added 33/157433/1
authorRadek Kintop <r.kintop@samsung.com>
Tue, 24 Oct 2017 11:25:22 +0000 (13:25 +0200)
committerRadek Kintop <r.kintop@samsung.com>
Tue, 24 Oct 2017 11:25:22 +0000 (13:25 +0200)
Change-Id: I0febd4f3c1d45626adf39f352716503ecf201c14
Signed-off-by: Radek Kintop <r.kintop@samsung.com>
packaging/org.tizen.setting.spec
setting-backup-and-reset/CMakeLists.txt
setting-backup-and-reset/src/setting-backup-and-reset-main-view.c

index bfcc8a269bab7c7723663fd94c2988c71eaf074b..21202b455e264598a46f31f61a1a4e331b2a6f25 100755 (executable)
@@ -45,6 +45,7 @@ BuildRequires:  pkgconfig(deviced)
 BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(dpm)
 BuildRequires:  pkgconfig(efl-extension)
+BuildRequires:  pkgconfig(edbus)
 BuildRequires:  pkgconfig(elementary)
 BuildRequires:  pkgconfig(feedback)
 BuildRequires:  pkgconfig(glib-2.0)
index 5f27f0dab2526f1e52dc6c2c5935ddab71efc29d..39b98ba6901f1755ab4be164e420ebdda249ee7a 100755 (executable)
@@ -10,6 +10,7 @@ pkg_check_modules(pkgs_setting_backup_and_reset REQUIRED
        auth-fw
        capi-appfw-application
        dlog
+       edbus
        efl-extension
        elementary
        libtzplatform-config
index 3c0c2bd7b56510f448586eb6506c1ff1f987516e..fe54e4123d5bb3ab05e35e51f3083596af1ade74 100755 (executable)
@@ -19,6 +19,8 @@
 
 #include <auth-passwd.h>
 #include <efl_extension.h>
+#include <E_DBus.h>
+
 
 #include "setting-backup-and-reset-main-view.h"
 #include "setting-backup-and-reset-cloud-view.h"
@@ -309,8 +311,20 @@ void _transit_del_cb(void *data, Elm_Transit *transit EINA_UNUSED)
        evas_object_freeze_events_set(data, EINA_FALSE);
 }
 
+
+static void _dbus_call_notify_cb(DBusPendingCall *pending, void *popup)
+{
+       SETTING_TRACE("dbus call end %p %d", pending,
+                                       dbus_pending_call_get_completed(pending));
+       if (TRUE == dbus_pending_call_get_completed(pending))
+               evas_object_del(popup);
+}
+
 static void create_transition_popup(SettingBackupReset *sbr)
 {
+       DBusMessage *message = NULL;
+       DBusConnection *conn = NULL;
+       DBusPendingCall *pending_call = NULL;
        Elm_Transit *transit;
        Eina_List *image_list = NULL;
 
@@ -342,6 +356,38 @@ static void create_transition_popup(SettingBackupReset *sbr)
        elm_transit_repeat_times_set(transit, 100);
        elm_transit_go(transit);
        evas_object_freeze_events_set(box, EINA_TRUE);
+
+       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+       if (!conn) {
+               SETTING_TRACE_WARNING("dbus_bus_get() error");
+               return;
+       }
+       message = dbus_message_new_signal("/com/samsung/factoryreset",
+                       "com.samsung.factoryreset.start",
+                       "setting");
+       if (!message) {
+               SETTING_TRACE_WARNING("dbus_message_new_signal() error");
+               dbus_connection_unref(conn);
+               return;
+       }
+       dbus_message_set_destination(message, "com.samsung.factoryreset");
+
+       if (FALSE ==
+               dbus_connection_send_with_reply(conn, message, &pending_call, 100)) {
+               SETTING_TRACE_WARNING("dbus_connection_send_with_reply() error");
+               dbus_message_unref(message);
+               dbus_connection_unref(conn);
+               return;
+       }
+
+       if (FALSE == dbus_pending_call_set_notify(pending_call,
+                       _dbus_call_notify_cb, popup, NULL)) {
+               SETTING_TRACE("dbus_pending_call_set_notify() error");
+       }
+
+       dbus_pending_call_block(pending_call);
+       dbus_message_unref(message);
+       dbus_connection_unref(conn);
 }
 
 static void _password_check_result_cb(app_control_h request,