Remove Gallery Tab for Common profile 10/211410/1 submit/tizen/20190814.135241
authorKartik Tidke <kr.tidke@samsung.com>
Fri, 2 Aug 2019 19:46:00 +0000 (01:16 +0530)
committerKartik Tidke <kr.tidke@samsung.com>
Fri, 2 Aug 2019 19:46:00 +0000 (01:16 +0530)
This patch enables the identifier for COMMON and MOBILE profile.
Also, it removes the Gallery Tab only for Common Profile.
Gallery Tab is kept unchanged (ie. enabled) for Mobile profile.

Change-Id: I3cb88a5fd2ae50b0875d80b1a2be0e554acd9cf1
Signed-off-by: Kartik Tidke <kr.tidke@samsung.com>
inc/wallpaper-ui-service.h
src/wallpaper-ui-service-main.c
src/wallpaper-ui-service.c

index 3cd5460..bfdc9a1 100644 (file)
 #define PACKAGEID "org.tizen.wallpaper-ui-service"
 #endif
 
+typedef enum {
+       TIZEN_PROFILE_UNKNOWN = 0,
+       TIZEN_PROFILE_MOBILE = 0x1,
+       TIZEN_PROFILE_WEARABLE = 0x2,
+       TIZEN_PROFILE_TV = 0x4,
+       TIZEN_PROFILE_IVI = 0x8,
+       TIZEN_PROFILE_COMMON = 0x10,
+} tizen_profile_t;
+
+extern tizen_profile_t _get_tizen_profile();
+
+#define _MOBILE (_get_tizen_profile() == TIZEN_PROFILE_MOBILE)
+#define _COMMON (_get_tizen_profile() == TIZEN_PROFILE_COMMON)
+
 /**
  * @brief Enum for indicating type of selected image
  */
index f062b3f..71c28ae 100644 (file)
@@ -965,31 +965,33 @@ static Evas_Object *main_gengrid_add(Evas_Object *parent)
        gic_for_main->func.del = _preview_grid_content_del;
 
        /* Gallery icon */
-       s_item = (Thumbnail *)calloc(1, sizeof(Thumbnail));
-       if (s_item != NULL) {
-               if (setting_type == WALLPAPER_TYPE_DEFAULT) {
-                       if (ad->last_preview_img_path != NULL) {
-                               s_item->path = strdup(ad->last_preview_img_path);
+       if (!_COMMON) {
+               s_item = (Thumbnail *)calloc(1, sizeof(Thumbnail));
+               if (s_item != NULL) {
+                       if (setting_type == WALLPAPER_TYPE_DEFAULT) {
+                               if (ad->last_preview_img_path != NULL) {
+                                       s_item->path = strdup(ad->last_preview_img_path);
+                               } else {
+                                       char *iconPath = wallpaper_ui_service_get_icon_path("no_gallery_bg.png");
+                                       s_item->path = strdup(iconPath);
+                                       free(iconPath);
+                               }
                        } else {
-                               char *iconPath = wallpaper_ui_service_get_icon_path("no_gallery_bg.png");
-                               s_item->path = strdup(iconPath);
-                               free(iconPath);
+                               s_item->path = setting_value;
+                               s_item->bSelected = EINA_TRUE;
+
+                               edje_object_signal_emit(elm_layout_edje_get(s_item->content), "elm,focus_highlight,show", "app");
+                               /*elm_object_signal_emit(ad->preview_layout, "show_preview", "preview_image"); */
                        }
-               } else {
-                       s_item->path = setting_value;
-                       s_item->bSelected = EINA_TRUE;
 
-                       edje_object_signal_emit(elm_layout_edje_get(s_item->content), "elm,focus_highlight,show", "app");
-                       /*elm_object_signal_emit(ad->preview_layout, "show_preview", "preview_image"); */
+                       s_item->type = WALLPAPER_TYPE_GALLERY;
+                       s_item->index = index++;
+                       s_item->item = elm_gengrid_item_append(ad->gengrid, gic_for_main, s_item, _gallery_clicked_cb, s_item);
+                       s_item->title = strdup("IDS_LCKSCN_BODY_GALLERY");
+                       elm_atspi_accessible_name_set(s_item->item, "IDS_LCKSCN_BODY_FROM_GALLERY");
+                       elm_atspi_accessible_reading_info_type_set(s_item->item, ELM_ACCESSIBLE_READING_INFO_TYPE_NAME);
+                       elm_atspi_accessible_translation_domain_set(s_item->item, PKGNAME);
                }
-
-               s_item->type = WALLPAPER_TYPE_GALLERY;
-               s_item->index = index++;
-               s_item->item = elm_gengrid_item_append(ad->gengrid, gic_for_main, s_item, _gallery_clicked_cb, s_item);
-               s_item->title = strdup("IDS_LCKSCN_BODY_GALLERY");
-               elm_atspi_accessible_name_set(s_item->item, "IDS_LCKSCN_BODY_FROM_GALLERY");
-               elm_atspi_accessible_reading_info_type_set(s_item->item, ELM_ACCESSIBLE_READING_INFO_TYPE_NAME);
-               elm_atspi_accessible_translation_domain_set(s_item->item, PKGNAME);
        }
 
        const char *defaultImageDir = wallpaper_ui_service_get_settings_wallpapers_path();
index 30b65a7..e793a96 100644 (file)
@@ -24,6 +24,7 @@
 #include <Evas.h>
 #include <vconf.h>
 #include <system_settings.h>
+#include <system_info.h>
 #include <media_content.h>
 #include <fcntl.h>
 #include <app_control_internal.h>
@@ -492,4 +493,37 @@ int get_max_prescale_img_size(wallpaper_ui_service_appdata *app)
        return MAX(w, h);
 }
 
+tizen_profile_t _get_tizen_profile()
+{
+       static tizen_profile_t profile = TIZEN_PROFILE_UNKNOWN;
+       if (__builtin_expect(profile != TIZEN_PROFILE_UNKNOWN, 1))
+               return profile;
+
+       char *profileName;
+       system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
+       switch (*profileName) {
+       case 'm':
+       case 'M':
+               profile = TIZEN_PROFILE_MOBILE;
+               break;
+       case 'w':
+       case 'W':
+               profile = TIZEN_PROFILE_WEARABLE;
+               break;
+       case 't':
+       case 'T':
+               profile = TIZEN_PROFILE_TV;
+               break;
+       case 'i':
+       case 'I':
+               profile = TIZEN_PROFILE_IVI;
+               break;
+       default: // common or unknown ==> ALL ARE COMMON.
+               profile = TIZEN_PROFILE_COMMON;
+       }
+
+       free(profileName);
+       return profile;
+}
+
 /* End of file */