Remove Profile Build Dependency: Do it at runtime 09/116009/6
authorYunjin Lee <yunjin-.lee@samsung.com>
Wed, 22 Feb 2017 09:57:06 +0000 (18:57 +0900)
committerYunjin Lee <yunjin-.lee@samsung.com>
Wed, 15 Mar 2017 08:37:24 +0000 (17:37 +0900)
- This is for Tizen 4.0.

  : Tizen 4.0 Configurability and Build Blocks require
    to remove all profile-depending build options in spec files.
  (No More profile macros)

- It is recommended to distinguish features/profiles at runtime.
 unless it incurs too much overhead, which requires you to
 create multiple binaries and subpackages.

Change-Id: I4cdc99aa36ad67da39e93ce494ce8d28930ea935
Signed-off-by: Yunjin Lee <yunjin-.lee@samsung.com>
CMakeLists.txt
packaging/askuser.spec
src/agent/notification-daemon/CMakeLists.txt
src/agent/notification-daemon/GuiRunner.cpp

index 0845f5a..8f4b679 100644 (file)
@@ -72,12 +72,6 @@ IF (BUILD_WITH_SYSTEMD_DAEMON)
     ADD_DEFINITIONS("-DBUILD_WITH_SYSTEMD_DAEMON")
 ENDIF (BUILD_WITH_SYSTEMD_DAEMON)
 
-IF (NOTIFICATION_UI STREQUAL MOBILE)
-    ADD_DEFINITIONS("-DMOBILE_UI")
-ELSEIF (NOTIFICATION_UI STREQUAL CIRCLE)
-    ADD_DEFINITIONS("-DCIRCLE_UI")
-ENDIF (NOTIFICATION_UI)
-
 IF (RES_DIR)
     ADD_DEFINITIONS("-DRES_DIR=\"${RES_DIR}\"")
 ELSE (RES_DIR)
index 6655eab..da1d691 100644 (file)
@@ -28,6 +28,7 @@ BuildRequires: pkgconfig(glib-2.0)
 BuildRequires: pkgconfig(pkgmgr-info)
 BuildRequires: pkgconfig(vconf)
 BuildRequires: pkgconfig(capi-ui-efl-util)
+BuildRequires: pkgconfig(capi-system-info)
 BuildRequires: coregl
 BuildRequires: edje-bin
 
@@ -35,12 +36,6 @@ BuildRequires: edje-bin
 %define build_type RELEASE
 %endif
 
-%if "%{?profile}" == "wearable"
-%define notification_ui CIRCLE
-%else
-%define notification_ui MOBILE
-%endif
-
 %description
 Daemon allowing user to grant or deny acces for given application and privilege
 
@@ -95,7 +90,6 @@ export LDFLAGS+="-Wl,--rpath=%{_libdir}"
         -DCMAKE_BUILD_TYPE=%{?build_type} \
         -DBUILD_WITH_SYSTEMD_DAEMON=%{?with_systemd_daemon} \
         -DCMAKE_VERBOSE_MAKEFILE=ON \
-        -DNOTIFICATION_UI=%{?notification_ui} \
         -DRES_DIR="/usr/share/askuser/res"
 make %{?jobs:-j%jobs}
 
index 32e34a4..6b9f25b 100644 (file)
@@ -7,6 +7,7 @@ PKG_CHECK_MODULES(ASKUSER_NOTIFICATION_DEP
     libsystemd
     vconf
     capi-ui-efl-util
+    capi-system-info
 )
 
 INCLUDE_DIRECTORIES(SYSTEM
index 1fb29cf..8bd036b 100644 (file)
@@ -29,6 +29,7 @@
 #include <libintl.h>
 #include <vconf.h>
 #include <efl_util.h>
+#include <system_info.h>
 
 #include <unistd.h>
 
@@ -185,120 +186,126 @@ void GuiRunner::initialize()
     elm_win_override_set(m_win, EINA_TRUE);
     elm_win_alpha_set(m_win, EINA_TRUE);
 
-#ifdef MOBILE_UI
-
-    // popup
-    m_popup = elm_popup_add(m_win);
-    if (!m_popup) {
-        ALOGE("EFL : Failed to add popup");
-        throw Exception("Elementary failed");
-    }
-    elm_popup_align_set(m_popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
-    elm_object_part_text_set(m_popup, "title,text", popupTitle);
-    evas_object_size_hint_weight_set(m_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-
-    // layout
-    m_layout = elm_layout_add(m_popup);
-    elm_layout_file_set(m_layout, RES_DIR"/popup_custom.edj", "popup_checkview_layout_mobile");
-    evas_object_size_hint_weight_set(m_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-
-    // content
-    m_content = elm_label_add(m_layout);
-    if (!m_content) {
-        ALOGE("EFL : Failed to add content");
-        throw Exception("Enlightement failed");
-    }
-    elm_object_style_set(m_content, "popup/default");
-    elm_label_line_wrap_set(m_content, ELM_WRAP_MIXED);
-    evas_object_size_hint_weight_set(m_content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-    evas_object_size_hint_align_set(m_content, EVAS_HINT_FILL, EVAS_HINT_FILL);
-    elm_object_part_content_set(m_layout, "elm.swallow.content", m_content);
-
-    // checkbox
-    m_checkbox = elm_check_add(m_layout);
-    if (!m_checkbox) {
-        ALOGE("EFL : Failed to add checkbox");
-        throw Exception("Enlightement failed");
+    char *profileName = nullptr;
+    system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
+    if (!profileName) {
+        ALOGE("profileName is NULL");
+        throw Exception("get profileName failed");
     }
-    elm_object_part_content_set(m_layout, "elm.swallow.end", m_checkbox);
-    elm_object_text_set(m_checkbox, checkBoxText);
-    elm_check_state_set(m_checkbox, EINA_FALSE);
-    evas_object_show(m_checkbox);
-
-    // buttons
-    m_denyButton = elm_button_add(m_popup);
-    if (!m_denyButton) {
-        ALOGE("EFL : Failed to add deny button");
-        throw Exception("Enlightement failed");
-    }
-    elm_object_part_content_set(m_popup, "button1", m_denyButton);
-    elm_object_text_set(m_denyButton, dgettext(PROJECT_NAME,
-                                           "IDS_IDLE_BUTTON_DENY"));
-
-    m_allowButton = elm_button_add(m_popup);
-    if (!m_allowButton) {
-        ALOGE("EFL : Failed to add allow button");
-        throw Exception("Enlightement failed");
+    std::unique_ptr<char, decltype(free)*> profileNamePtr(profileName, free);
+    if (*profileName != 'w' && *profileName != 'W') {
+        // popup
+        m_popup = elm_popup_add(m_win);
+        if (!m_popup) {
+            ALOGE("EFL : Failed to add popup");
+            throw Exception("Elementary failed");
+        }
+        elm_popup_align_set(m_popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
+        elm_object_part_text_set(m_popup, "title,text", popupTitle);
+        evas_object_size_hint_weight_set(m_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+        // layout
+        m_layout = elm_layout_add(m_popup);
+        elm_layout_file_set(m_layout, RES_DIR"/popup_custom.edj", "popup_checkview_layout_mobile");
+        evas_object_size_hint_weight_set(m_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+        // content
+        m_content = elm_label_add(m_layout);
+        if (!m_content) {
+            ALOGE("EFL : Failed to add content");
+            throw Exception("Enlightement failed");
+        }
+        elm_object_style_set(m_content, "popup/default");
+        elm_label_line_wrap_set(m_content, ELM_WRAP_MIXED);
+        evas_object_size_hint_weight_set(m_content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+        evas_object_size_hint_align_set(m_content, EVAS_HINT_FILL, EVAS_HINT_FILL);
+        elm_object_part_content_set(m_layout, "elm.swallow.content", m_content);
+
+        // checkbox
+        m_checkbox = elm_check_add(m_layout);
+        if (!m_checkbox) {
+            ALOGE("EFL : Failed to add checkbox");
+            throw Exception("Enlightement failed");
+        }
+        elm_object_part_content_set(m_layout, "elm.swallow.end", m_checkbox);
+        elm_object_text_set(m_checkbox, checkBoxText);
+        elm_check_state_set(m_checkbox, EINA_FALSE);
+        evas_object_show(m_checkbox);
+
+        // buttons
+        m_denyButton = elm_button_add(m_popup);
+        if (!m_denyButton) {
+            ALOGE("EFL : Failed to add deny button");
+            throw Exception("Enlightement failed");
+        }
+        elm_object_part_content_set(m_popup, "button1", m_denyButton);
+        elm_object_text_set(m_denyButton, dgettext(PROJECT_NAME,
+                                               "IDS_IDLE_BUTTON_DENY"));
+
+        m_allowButton = elm_button_add(m_popup);
+        if (!m_allowButton) {
+            ALOGE("EFL : Failed to add allow button");
+            throw Exception("Enlightement failed");
+        }
+        elm_object_part_content_set(m_popup, "button2", m_allowButton);
+        elm_object_text_set(m_allowButton, dgettext(PROJECT_NAME,
+                                                "IDS_IDLE_BUTTON_ALLOW_ABB7"));
+        elm_object_content_set(m_popup, m_layout);
+        evas_object_show(m_popup);
+
+    } else {
+        Evas_Object *icon;
+
+        m_popup = elm_popup_add(m_win);
+        elm_object_style_set(m_popup, "circle");
+
+        m_layout = elm_layout_add(m_popup);
+        elm_layout_theme_set(m_layout, "layout", "popup", "content/circle/buttons2");
+        elm_object_part_text_set(m_layout, "elm.text.title", popupTitle);
+        elm_object_content_set(m_popup, m_layout);
+
+        m_layoutInner = elm_layout_add(m_layout);
+        elm_layout_file_set(m_layoutInner, RES_DIR"/popup_custom.edj", "popup_checkview_internal");
+        evas_object_size_hint_weight_set(m_layoutInner, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+        elm_object_part_content_set(m_layout, "elm.swallow.content", m_layoutInner);
+
+        m_content = elm_label_add(m_layoutInner);
+        elm_object_style_set(m_content, "popup/default");
+        elm_label_line_wrap_set(m_content, ELM_WRAP_MIXED);
+        evas_object_size_hint_weight_set(m_content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+        evas_object_size_hint_align_set(m_content, EVAS_HINT_FILL, EVAS_HINT_FILL);
+        elm_object_part_content_set(m_layoutInner, "label", m_content);
+
+
+        m_checkbox = elm_check_add(m_popup);
+        elm_object_style_set(m_checkbox, "popup");
+        elm_object_text_set(m_checkbox, checkBoxText);
+        elm_check_state_set(m_checkbox, EINA_FALSE);
+        evas_object_size_hint_align_set(m_checkbox, EVAS_HINT_FILL, 0.0);
+        elm_object_part_content_set(m_layoutInner, "elm.swallow.end", m_checkbox);
+        evas_object_show(m_checkbox);
+
+        m_allowButton = elm_button_add(m_popup);
+        elm_object_style_set(m_allowButton, "popup/circle/right");
+        elm_object_part_content_set(m_popup, "button2", m_allowButton);
+
+        icon = elm_image_add(m_allowButton);
+        elm_image_file_set(icon, RES_DIR"/tw_ic_popup_btn_check.png", NULL);
+        evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+        elm_object_part_content_set(m_allowButton, "elm.swallow.content", icon);
+        evas_object_show(icon);
+
+        m_denyButton = elm_button_add(m_popup);
+        elm_object_style_set(m_denyButton, "popup/circle/left");
+        elm_object_part_content_set(m_popup, "button1", m_denyButton);
+
+        icon = elm_image_add(m_denyButton);
+        elm_image_file_set(icon, RES_DIR"/tw_ic_popup_btn_delete.png", NULL);
+        elm_object_part_content_set(m_denyButton, "elm.swallow.content", icon);
+        evas_object_show(icon);
+
+        evas_object_show(m_popup);
     }
-    elm_object_part_content_set(m_popup, "button2", m_allowButton);
-    elm_object_text_set(m_allowButton, dgettext(PROJECT_NAME,
-                                            "IDS_IDLE_BUTTON_ALLOW_ABB7"));
-    elm_object_content_set(m_popup, m_layout);
-    evas_object_show(m_popup);
-
-#elif defined(CIRCLE_UI)
-    Evas_Object *icon;
-
-    m_popup = elm_popup_add(m_win);
-    elm_object_style_set(m_popup, "circle");
-
-    m_layout = elm_layout_add(m_popup);
-    elm_layout_theme_set(m_layout, "layout", "popup", "content/circle/buttons2");
-    elm_object_part_text_set(m_layout, "elm.text.title", popupTitle);
-    elm_object_content_set(m_popup, m_layout);
-
-    m_layoutInner = elm_layout_add(m_layout);
-    elm_layout_file_set(m_layoutInner, RES_DIR"/popup_custom.edj", "popup_checkview_internal");
-    evas_object_size_hint_weight_set(m_layoutInner, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-    elm_object_part_content_set(m_layout, "elm.swallow.content", m_layoutInner);
-
-    m_content = elm_label_add(m_layoutInner);
-    elm_object_style_set(m_content, "popup/default");
-    elm_label_line_wrap_set(m_content, ELM_WRAP_MIXED);
-    evas_object_size_hint_weight_set(m_content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-    evas_object_size_hint_align_set(m_content, EVAS_HINT_FILL, EVAS_HINT_FILL);
-    elm_object_part_content_set(m_layoutInner, "label", m_content);
-
-
-    m_checkbox = elm_check_add(m_popup);
-    elm_object_style_set(m_checkbox, "popup");
-    elm_object_text_set(m_checkbox, checkBoxText);
-    elm_check_state_set(m_checkbox, EINA_FALSE);
-    evas_object_size_hint_align_set(m_checkbox, EVAS_HINT_FILL, 0.0);
-    elm_object_part_content_set(m_layoutInner, "elm.swallow.end", m_checkbox);
-    evas_object_show(m_checkbox);
-
-    m_allowButton = elm_button_add(m_popup);
-    elm_object_style_set(m_allowButton, "popup/circle/right");
-    elm_object_part_content_set(m_popup, "button2", m_allowButton);
-
-    icon = elm_image_add(m_allowButton);
-    elm_image_file_set(icon, RES_DIR"/tw_ic_popup_btn_check.png", NULL);
-    evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-    elm_object_part_content_set(m_allowButton, "elm.swallow.content", icon);
-    evas_object_show(icon);
-
-    m_denyButton = elm_button_add(m_popup);
-    elm_object_style_set(m_denyButton, "popup/circle/left");
-    elm_object_part_content_set(m_popup, "button1", m_denyButton);
-
-    icon = elm_image_add(m_denyButton);
-    elm_image_file_set(icon, RES_DIR"/tw_ic_popup_btn_delete.png", NULL);
-    elm_object_part_content_set(m_denyButton, "elm.swallow.content", icon);
-    evas_object_show(icon);
-
-    evas_object_show(m_popup);
-#endif
     // callbacks
     elm_win_indicator_opacity_set(m_win, ELM_WIN_INDICATOR_OPAQUE);
     elm_win_indicator_mode_set(m_win, ELM_WIN_INDICATOR_SHOW);