Modify logic to set Home screen wallpaper.
[apps/native/menu-screen.git] / src / menu_screen.c
old mode 100755 (executable)
new mode 100644 (file)
index e209c2c..66765d8
@@ -265,10 +265,10 @@ static void _create_bg(void)
        evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        evas_object_size_hint_min_set(bg, width, height);
        evas_object_size_hint_max_set(bg, width, height);
-       if (!elm_image_file_set(bg, buf, NULL)) {
+       if (buf == NULL || !elm_image_file_set(bg, buf, NULL)) {
                _E("Failed to set image file : %s", buf);
                if (!elm_image_file_set(bg, util_get_file_path(IMAGE_DIR"/home_001.png"), NULL)) {
-                       _E("Failed to set default image file: %s", util_get_file_path(IMAGE_DIR"/home_001.png")); 
+                       _E("Failed to set default image file: %s", util_get_file_path(IMAGE_DIR"/home_001.png"));
                        return;
                }
        }
@@ -326,13 +326,19 @@ static void _fini_theme(void)
 static Evas_Object *_create_conformant(Evas_Object *win)
 {
        Evas_Object *conformant;
+       char *device_profile;
 
        conformant = elm_conformant_add(win);
        retv_if(NULL == conformant, NULL);
 
        evas_object_size_hint_weight_set(conformant, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       elm_win_indicator_mode_set(menu_screen_info.win, ELM_WIN_INDICATOR_SHOW);
-       elm_win_indicator_opacity_set(menu_screen_info.win, ELM_WIN_INDICATOR_TRANSLUCENT);
+       device_profile = util_get_device_profile();
+       if (device_profile) {
+               if (!strcmp(device_profile, "mobile")) {
+                       elm_win_indicator_mode_set(menu_screen_info.win, ELM_WIN_INDICATOR_SHOW);
+                       elm_win_indicator_opacity_set(menu_screen_info.win, ELM_WIN_INDICATOR_TRANSLUCENT);
+               }
+       }
        elm_object_signal_emit(conformant, "elm,state,indicator,overlap", "elm");
        evas_object_data_set(conformant, "win", win);
        evas_object_show(conformant);
@@ -340,6 +346,9 @@ static Evas_Object *_create_conformant(Evas_Object *win)
        elm_win_resize_object_add(win, conformant);
        elm_win_conformant_set(win, EINA_TRUE);
 
+       if (device_profile)
+               free(device_profile);
+
        return conformant;
 }
 
@@ -500,23 +509,30 @@ static void _language_changed_cb(app_event_info_h event_info, void *data)
 
        count = page_scroller_count_page(scroller);
        page_max_app = (unsigned int) evas_object_data_get(scroller, "page_max_app");
-       for (i = 0; i < count; i ++) {
+       for (i = 0; i < count; i++) {
                page = page_scroller_get_page_at(scroller, i);
                if (!page) continue;
                if (mapbuf_is_enabled(page)) {
                        mapbuf_disable(page, 1);
                }
 
-               for (j = 0; j < page_max_app; j ++) {
+               for (j = 0; j < page_max_app; j++) {
                        app_info_h app_info = NULL;
                        char *name;
                        int ret;
+                       char *package;
 
                        item = page_get_item_at(page, j);
                        if (!item) continue;
 
-                       app_manager_get_app_info(item_get_package(item), &app_info);
+                       package = item_get_package(item);
+                       if (!package) continue;
 
+                       ret = app_manager_get_app_info(package, &app_info);
+                       if (ret != APP_MANAGER_ERROR_NONE || !app_info) {
+                               _E("Failed to get app info");
+                               continue;
+                       }
                        ret = app_info_get_label(app_info, &name);
                        if (APP_MANAGER_ERROR_NONE != ret) {
                                _E("Failed to get label from : %s", item_get_package(item));