Remove syspopup sandbox/cmoreau/sp
authorChristophe Moreau <christophe.moreau@open.eurogiciel.org>
Mon, 22 Sep 2014 14:13:06 +0000 (16:13 +0200)
committerChristophe Moreau <christophe.moreau@open.eurogiciel.org>
Mon, 22 Sep 2014 14:13:06 +0000 (16:13 +0200)
Add calls to notification (notification-create, notification_insert) instead of previous syspopup_launch() and aul_launch_app()

Bug-Tizen: TC-1476

Signed-off-by: Christophe Moreau <christophe.moreau@open.eurogiciel.org>
CMakeLists.txt
include/util.h
packaging/net-config.spec
src/network-state.c
src/utils/util.c

index 2bdc82c..74949d8 100644 (file)
@@ -43,6 +43,7 @@ PKG_CHECK_MODULES(pkgs REQUIRED
        vconf
        wifi-direct
        tapi
+       notification
        libsystemd-daemon)
 
 FOREACH(flag ${pkgs_CFLAGS})
index 8a37f8a..602dae6 100644 (file)
@@ -28,6 +28,8 @@ extern "C" {
 
 #include "wifi.h"
 
+#define NET_CONFIG_APP_NAME     "net-config"
+
 GKeyFile *netconfig_keyfile_load(const char *pathname);
 void netconfig_keyfile_save(GKeyFile *keyfile, const char *pathname);
 
index a3a97b9..3b7dc46 100644 (file)
@@ -16,6 +16,7 @@ BuildRequires:  pkgconfig(wifi-direct)
 BuildRequires:  pkgconfig(tapi)
 Requires(post): /usr/bin/vconftool
 BuildRequires:    pkgconfig(libsystemd-daemon)
+BuildRequires:  pkgconfig(notification)
 %{?systemd_requires}
 
 %description
index d890e1d..420239e 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <vconf.h>
 #include <vconf-keys.h>
+#include <notification.h>
 
 #include "wifi.h"
 #include "log.h"
@@ -151,6 +152,7 @@ static void __netconfig_pop_3g_alert_syspoppup(void)
 {
        int rv = 0;
        int wifi_ug_state = 0;
+       notification_error_e err = NOTIFICATION_ERROR_NONE;
 
        vconf_get_int(VCONFKEY_WIFI_UG_RUN_STATE, &wifi_ug_state);
        if (wifi_ug_state == VCONFKEY_WIFI_UG_RUN_STATE_ON_FOREGROUND)
@@ -159,6 +161,38 @@ static void __netconfig_pop_3g_alert_syspoppup(void)
        DBG("Launch 3G alert network popup");
        // TODO : display a popup
 
+       notification_h noti = NULL;
+
+        noti = notification_create(NOTIFICATION_TYPE_NOTI);
+       if (noti == NULL) {
+               ERR("Failed to create notification \n");
+               return;
+       }
+
+        err = notification_set_pkgname(noti, NET_CONFIG_APP_NAME);
+       if (err != NOTIFICATION_ERROR_NONE) {
+               ERR("Unable to set pkgname \n");
+               return;
+       }
+
+       err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, "Cellular connection popup", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+       if (err != NOTIFICATION_ERROR_NONE) {
+               ERR("Unable to set notification title \n");
+               return;
+       }
+
+        err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "Connected" , NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+       if (err != NOTIFICATION_ERROR_NONE) {
+               ERR("Unable to set notification content \n");
+               return;
+       }
+
+        err = notification_insert(noti, NULL);
+       if (err != NOTIFICATION_ERROR_NONE) {
+               ERR("Unable to insert notification \n");
+               return;
+       }
+
 }
 
 static gboolean __netconfig_is_connected(const char *profile)
index 02ee0c2..92e4540 100644 (file)
@@ -27,6 +27,7 @@
 #include <vconf.h>
 #include <vconf-keys.h>
 #include <wifi-direct.h>
+#include <notification.h>
 
 #include "log.h"
 #include "util.h"
@@ -179,6 +180,7 @@ static void __netconfig_pop_device_picker(void)
 {
        int rv = 0;
        int wifi_ug_state = 0;
+       notification_error_e err = NOTIFICATION_ERROR_NONE;
 
        vconf_get_int(VCONFKEY_WIFI_UG_RUN_STATE, &wifi_ug_state);
        if (wifi_ug_state == VCONFKEY_WIFI_UG_RUN_STATE_ON_FOREGROUND)
@@ -187,6 +189,33 @@ static void __netconfig_pop_device_picker(void)
        DBG("Launch Wi-Fi device picker");
        // TODO : display a popup
 
+        notification_h noti = NULL;
+
+        noti = notification_create(NOTIFICATION_TYPE_NOTI);
+       if (noti == NULL) {
+               ERR("Failed to create notification \n");
+               return;
+       }
+
+        err = notification_set_pkgname(noti, NET_CONFIG_APP_NAME);
+       if (err != NOTIFICATION_ERROR_NONE) {
+               ERR("Unable to set pkgname \n");
+               return;
+       }
+
+        err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "wifi-qs : Launch Wi-Fi device picker" , NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+       if (err != NOTIFICATION_ERROR_NONE) {
+               ERR("Unable to set notification content \n");
+               return;
+       }
+
+        err = notification_insert(noti, NULL);
+       if (err != NOTIFICATION_ERROR_NONE) {
+               ERR("Unable to insert notification \n");
+               return;
+       }
+
+
 }
 
 static gboolean __netconfig_wifi_try_device_picker(gpointer data)
@@ -355,12 +384,68 @@ gboolean netconfig_iface_wifi_launch_direct(NetconfigWifi *wifi, GError **error)
 
 void netconfig_add_wifi_found_notification(void)
 {
+       notification_error_e err = NOTIFICATION_ERROR_NONE;
+
        INFO("Add wifi found notification");
+
+        notification_h noti = NULL;
+
+        noti = notification_create(NOTIFICATION_TYPE_NOTI);
+       if (noti == NULL) {
+               ERR("Failed to create notification \n");
+               return;
+       }
+
+        err = notification_set_pkgname(noti, NET_CONFIG_APP_NAME);
+       if (err != NOTIFICATION_ERROR_NONE) {
+               ERR("Unable to set pkgname \n");
+               return;
+       }
+
+        err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "Add wifi found notification" , NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+       if (err != NOTIFICATION_ERROR_NONE) {
+               ERR("Unable to set notification content \n");
+               return;
+       }
+
+        err = notification_insert(noti, NULL);
+       if (err != NOTIFICATION_ERROR_NONE) {
+               ERR("Unable to insert notification \n");
+               return;
+       }
 }
 
 void netconfig_del_wifi_found_notification(void)
 {
+       notification_error_e err = NOTIFICATION_ERROR_NONE;
+
        INFO("Delete wifi found notification");
+
+        notification_h noti = NULL;
+
+        noti = notification_create(NOTIFICATION_TYPE_NOTI);
+       if (noti == NULL) {
+               ERR("Failed to create notification \n");
+               return;
+       }
+
+        err = notification_set_pkgname(noti, NET_CONFIG_APP_NAME);
+       if (err != NOTIFICATION_ERROR_NONE) {
+               ERR("Unable to set pkgname \n");
+               return;
+       }
+
+        err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "Delete wifi found notification" , NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+       if (err != NOTIFICATION_ERROR_NONE) {
+               ERR("Unable to set notification content \n");
+               return;
+       }
+
+        err = notification_insert(noti, NULL);
+       if (err != NOTIFICATION_ERROR_NONE) {
+               ERR("Unable to insert notification \n");
+               return;
+       }
 }