.cleanup = setting_display_wallpaper_cleanup,
};
-
+#define SETTING_WALLPAPER_HOME_SCREEN "Wallpaper" // ug-image-viewer parameter
+#define SETTING_WALLPAPER_LOCK_SCREEN "Lockscreen" // ug-image-viewer parameter
+#define SETTING_WALLPAPER_HOME_AND_LOCK "Wallpaper & Lockscreen" // ug-image-viewer parameter
+#define SETTING_WALLPAPER_POPUP_TIMER 3
/* ***************************************************
*
*basic func
*
***************************************************/
+#if DISABLED_CODE
static void __setting_display_wallpaper_vconf_change_cb(keynode_t *key, void *data)
{
SETTING_TRACE_BEGIN;
__setting_display_wallpaper_vconf_change_cb);
return 0;
}
+#endif
-static void __destroy_gallery_ug_cb(ui_gadget_h ug, void *priv)
+static void __setting_display_wallpaper_imageviewer_ug_result_cb(ui_gadget_h ug, service_h result, void *priv)
{
SETTING_TRACE_BEGIN;
- setting_retm_if(priv == NULL, "Data parameter is NULL");
- SettingDisplayUG *ad = (SettingDisplayUG *) priv; /* ad is point to priv */
+ /* error check */
+ retm_if(priv == NULL, "Data parameter is NULL");
+
+ SettingDisplayUG *ad = (SettingDisplayUG *) priv;
+
+ if (result) {
+ char *path = NULL;
+ switch(ad->cur_sel) {
+ case WALLPAPER_CUR_SEL_HOME_SCREEN:
+ {
+ service_get_extra_data(result, "homescreen_path", &path);
+ if (path == NULL) {
+ ad->wallpaper_changed = EINA_FALSE;
+ return;
+ }
+ break;
+ }
+ case WALLPAPER_CUR_SEL_LOCK_SCREEN:
+ {
+ service_get_extra_data(result, "lockscreen_path", &path);
+ if (path == NULL) {
+ ad->wallpaper_changed = EINA_FALSE;
+ return;
+ }
+ break;
+ }
+ case WALLPAPER_CUR_SEL_HOME_AND_LOCK_SCREEN:
+ {
+ service_get_extra_data(result, "homescreen_path", &path);
+ if (path == NULL) {
+ ad->wallpaper_changed = EINA_FALSE;
+ return;
+ }
+ service_get_extra_data(result, "lockscreen_path", &path);
+ if (path == NULL) {
+ ad->wallpaper_changed = EINA_FALSE;
+ return;
+ }
+ break;
+ }
+ default:
+ ad->wallpaper_changed = EINA_FALSE;
+ return;
+ }
+
+ ad->wallpaper_changed = EINA_TRUE;
+ }
if (ug) {
ug_destroy(ug);
- ad->ug_loading = NULL;
+ ad->ug_imageviewer = NULL;
}
- /* restore the '<-' button on the navigate bar */
- Elm_Object_Item *navi_it = elm_naviframe_top_item_get(ad->navi_bar);
- ret_if(!navi_it);
- Evas_Object *back_btn = elm_object_item_part_content_get(navi_it, "prev_btn");
+ if (ad->ug_gallery) {
+ ug_destroy(ad->ug_gallery);
+ ad->ug_gallery = NULL;
+ }
- if (back_btn != NULL) {
- elm_object_style_set(back_btn, NAVI_BACK_BUTTON_STYLE); /* take into effect */
+ if (ad->wallpaper_changed == EINA_FALSE) {
+ SETTING_TRACE("wallpaper not changed");
+ return;
}
char text[MAX_DISPLAY_NAME_LEN_ON_UI +1] = {0, };
setting_create_sel_info_popup(ad->view_layout,
&(ad->selInfoPop_layout),
&(ad->selInfoPop));
- elm_notify_timeout_set(ad->selInfoPop, 3);
+ elm_notify_timeout_set(ad->selInfoPop, SETTING_WALLPAPER_POPUP_TIMER);
edje_object_part_text_set(_EDJ(ad->selInfoPop_layout), "elm.text", text);
ad->cur_sel = WALLPAPER_CUR_SEL_NONE;
+ ad->wallpaper_changed = EINA_FALSE;
+}
+
+static void __setting_display_wallpaper_imageviewer_ug_destroy_cb(ui_gadget_h ug, void *priv)
+{
+ SETTING_TRACE_BEGIN;
+ setting_retm_if(priv == NULL, "Data parameter is NULL");
+ SettingDisplayUG *ad = (SettingDisplayUG *) priv; /* ad is point to priv */
+
+ if (ug) {
+ ug_destroy(ug);
+ ad->ug_imageviewer = NULL;
+ }
+}
+
+static void __setting_display_wallpaper_gallery_ug_result_cb(ui_gadget_h ug, service_h result, void *priv)
+{
+ SETTING_TRACE_BEGIN;
+ /* error check */
+ retm_if(priv == NULL, "Data parameter is NULL");
+
+ SettingDisplayUG *ad = (SettingDisplayUG *) priv;
+
+ if (result) {
+ char *path = NULL;
+ service_get_extra_data(result, "path", &path);
+ setting_retm_if(path == NULL, "path is NULL");
+
+ service_h service;
+ if (service_create(&service)) {
+ return;
+ }
+
+ service_add_extra_data(service, "Path", path);
+ service_add_extra_data(service, "View Mode", "SETAS");
+
+ SETTING_TRACE("Path = %s", path);
+
+ switch(ad->cur_sel) {
+ case WALLPAPER_CUR_SEL_HOME_SCREEN:
+ service_add_extra_data(service, "Setas type", SETTING_WALLPAPER_HOME_SCREEN);
+ break;
+ case WALLPAPER_CUR_SEL_LOCK_SCREEN:
+ service_add_extra_data(service, "Setas type", SETTING_WALLPAPER_LOCK_SCREEN);
+ break;
+ case WALLPAPER_CUR_SEL_HOME_AND_LOCK_SCREEN:
+ service_add_extra_data(service, "Setas type", SETTING_WALLPAPER_HOME_AND_LOCK);
+ break;
+ default:
+ service_destroy(service);
+ SETTING_TRACE_ERROR("ad->cur_sel is error");
+ return;
+ }
+
+ struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
+ setting_retm_if(cbs == NULL, "calloc failed");
+
+ cbs->layout_cb = setting_display_layout_ug_cb;
+ cbs->result_cb = __setting_display_wallpaper_imageviewer_ug_result_cb;
+ cbs->destroy_cb = __setting_display_wallpaper_imageviewer_ug_destroy_cb;
+ cbs->priv = (void *)ad;
+
+ ad->ug_imageviewer = ug_create(ad->ug_gallery, "image-viewer-efl", UG_MODE_FULLVIEW, service, cbs);
+
+ if (NULL == ad->ug_imageviewer) { /* error handling */
+ SETTING_TRACE_ERROR("NULL == ad->ug_imageviewer");
+ setting_create_simple_popup(ad, ad->win_get, NULL, _(UNSUPPORTED_FUNCTION));
+ }
+
+ service_destroy(service);
+ FREE(cbs);
+ }
+}
+
+static void __setting_display_wallpaper_gallery_ug_destroy_cb(ui_gadget_h ug, void *priv)
+{
+ SETTING_TRACE_BEGIN;
+ setting_retm_if(priv == NULL, "Data parameter is NULL");
+ SettingDisplayUG *ad = (SettingDisplayUG *) priv; /* ad is point to priv */
+
+ if (ad->ug_imageviewer == NULL) {
+ ug_destroy(ug);
+ ad->ug_gallery = NULL;
+ } else {
+ return;
+ }
+
+ Elm_Object_Item *navi_it = elm_naviframe_top_item_get(ad->navi_bar);
+ retm_if(navi_it == NULL, "navi_it is NULL");
+ Evas_Object *back_btn = elm_object_item_part_content_get(navi_it, "prev_btn");
+
+ if (back_btn != NULL) {
+ elm_object_style_set(back_btn, NAVI_BACK_BUTTON_STYLE); /* take into effect */
+ }
}
static void __setting_display_wallpaper_ug_launch(void *data)
return;
}
- service_add_extra_data(svc, "launch-type", "select-setas");
- service_add_extra_data(svc, "setas-type", "wallpaper");
+ service_add_extra_data(svc, "launch-type", "select-one");
service_add_extra_data(svc, "file-type", "image");
struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
}
cbs->layout_cb = setting_display_layout_ug_cb;
- cbs->result_cb = NULL;
- cbs->destroy_cb = __destroy_gallery_ug_cb;
+ cbs->result_cb = __setting_display_wallpaper_gallery_ug_result_cb;
+ cbs->destroy_cb = __setting_display_wallpaper_gallery_ug_destroy_cb;
cbs->priv = (void *)ad;
- ad->ug_loading = ug_create(ad->ug, "gallery-efl", UG_MODE_FULLVIEW, svc, cbs);
+ ad->ug_gallery = ug_create(ad->ug, "gallery-efl", UG_MODE_FULLVIEW, svc, cbs);
+ SETTING_TRACE("ad->ug_gallery = %p", ad->ug_gallery);
- if (NULL == ad->ug_loading) { /* error handling */
- SETTING_TRACE_ERROR("NULL == ad->ug_loading");
+ if (NULL == ad->ug_gallery) { /* error handling */
+ SETTING_TRACE_ERROR("NULL == ad->ug_gallery");
setting_create_simple_popup(ad, ad->win_get, NULL, _(UNSUPPORTED_FUNCTION));
}
SettingDisplayUG *ad = (SettingDisplayUG *) data;
if (!safeStrCmp("IDS_ST_MBODY_HOME_SCREEN_WALLPAPER", list_item->keyStr)) {
+ ad->cur_sel = WALLPAPER_CUR_SEL_HOME_SCREEN;
__setting_display_wallpaper_ug_launch(ad);
} else if (!safeStrCmp("IDS_ST_MBODY_LOCK_SCREEN_WALLPAPER_M_NOUN", list_item->keyStr)) {
+ ad->cur_sel = WALLPAPER_CUR_SEL_LOCK_SCREEN;
__setting_display_wallpaper_ug_launch(ad);
} else if (!safeStrCmp(SETTING_WALLPAPER_HOME_AND_LOCK_SCREEN, list_item->keyStr)) {
+ ad->cur_sel = WALLPAPER_CUR_SEL_HOME_AND_LOCK_SCREEN;
__setting_display_wallpaper_ug_launch(ad);
} else {
/* do nothing */
}
setting_view_display_wallpaper.is_create = 1;
+#if DISABLED_CODE
__setting_display_wallpaper_listen_vconf_change(ad);
+#endif
return SETTING_RETURN_SUCCESS;
}
retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
SettingDisplayUG *ad = (SettingDisplayUG *) cb; /* ad is point to cb */
+#if DISABLED_CODE
__setting_display_wallpaper_unlisten_vconf_change();
+#endif
if (ad->selInfoPop) {
evas_object_del(ad->selInfoPop);