Synchronize interactive installation popup timeouts 36/34636/1
authorManuel Bachmann <manuel.bachmann@open.eurogiciel.org>
Thu, 29 Jan 2015 18:18:23 +0000 (19:18 +0100)
committerManuel Bachmann <manuel.bachmann@open.eurogiciel.org>
Thu, 29 Jan 2015 18:18:23 +0000 (19:18 +0100)
Installation confirmation job was waiting for 10 seconds,
but the actual popup window could be shown infinitely,
letting the user click without purpose.

As notification-display-service now handles a "timeout"
parameter, send it so the popup window gracefully
disappears.

Change-Id: I48b5073726c970caa5ed30e52c812ad7f350bf19
Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
server/src/pkgmgr-server.c

index 5987b08..e931800 100644 (file)
@@ -630,6 +630,7 @@ int create_popup(struct appdata *ad)
        char *button1_text = dgettext("sys_string", "IDS_COM_SK_YES");
        char *button2_text = dgettext("sys_string", "IDS_COM_SK_NO");
        */
+       char *timeout_text = "10";
        char *button1_text = "Yes";
        char *button2_text = "No";
        char *buttons_text = malloc(strlen(button1_text) +
@@ -638,7 +639,7 @@ int create_popup(struct appdata *ad)
        strcat(buttons_text, ",");
        strcat(buttons_text, button2_text);
 
-       bundle_add (b, "timeout", "0");
+       bundle_add (b, "timeout", timeout_text);
        bundle_add (b, "noresize", "1");
        bundle_add (b, "buttons", buttons_text);
 
@@ -668,7 +669,7 @@ int create_popup(struct appdata *ad)
        /* Catch user response */
        int button;
 
-       err = notification_wait_response (noti, 10, &button, NULL);
+       err = notification_wait_response (noti, atoi(timeout_text), &button, NULL);
        if (err != NOTIFICATION_ERROR_NONE) {
                DBG("Failed to wait for user response, defaulting to 'no'\n");
                button = 2;