SET(SRCS
src/main.c
src/view/view_base.c
+ src/view/picture/view_picture_slider_generic.c
src/view/picture/view_picture_mode.c
src/view/picture/view_picture_contrast.c
+ src/view/picture/view_picture_brightness.c
src/view/system/view_clock.c
src/view/system/view_sleep_timer.c
src/view/system/view_wakeup_timer.c
void settings_picture_set_picture_mode(settings_picture_mode mode_to_set);
void settings_picture_set_contrast(int val);
+void settings_picture_set_brightness(int val);
settings_picture_mode settings_picture_get_picture_mode(void);
int settings_picture_get_contrast(void);
+int settings_picture_get_brightness(void);
+int settings_picture_get_max_brightness(void);
#endif /* __AIR_SETTINGS_PICTURE_H__ */
/* View ID - Picture */
#define VIEW_PICTURE_MODE "VIEW_PICTURE_MODE"
#define VIEW_PICTURE_CONTRAST "VIEW_PICTURE_CONTRAST"
+#define VIEW_PICTURE_BRIGHTNESS "VIEW_PICTURE_BRIGHTNESS"
/* View ID - System */
#define VIEW_CLOCK "VIEW_CLOCK"
#define STR_PICTURE_MODE "Picture Mode"
#define STR_CONTRAST "Contrast"
+#define STR_BRIGHTNESS "Brightness"
#define STR_LANGUAGE "Language"
#define STR_LOCATION "Location"
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __AIR_SETTINGS_VIEW_PICTURE_BRIGHTNESS_H__
+#define __AIR_SETTINGS_VIEW_PICTURE_BRIGHTNESS_H__
+
+#include "common/viewmgr.h"
+
+view_class *view_picture_brightness_get_vclass(void);
+
+#endif /* __AIR_SETTINGS_VIEW_PICTURE_BRIGHTNESS_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __AIR_SETTINGS_VIEW_PICTURE_SLIDER_GENERIC_H__
+#define __AIR_SETTINGS_VIEW_PICTURE_SLIDER_GENERIC_H__
+
+#include "common/viewmgr.h"
+
+typedef void (*set_value)(int val);
+typedef int (*get_value)(void);
+
+typedef struct {
+ const char *slider_title;
+
+ int slider_min_val;
+ int slider_max_val;
+ int slider_cur_val;
+ int slider_step;
+
+ set_value set_setting_value;
+ get_value get_setting_value;
+
+ void *generic_slider_data;
+} generic_slider_attr;
+
+view_class *view_picture_slider_generic_get_vclass(void);
+
+#endif /* __AIR_SETTINGS_VIEW_PICTURE_SLIDER_GENERIC_LAYOUT_H__ */
* limitations under the License.
*/
+#include <device/display.h>
#include "data/settings_picture.h"
#include "app_debug.h"
+#define DISPLAY_MAIN 0
+#define DEFAULT_MAX_BRIGHTNESS 100
+
+/* Display error:
+
+device_display_get_numbers() function fails in device/display module on
+ret = dbus_method_sync(DEVICED_BUS_NAME,
+ DEVICED_PATH_DISPLAY, DEVICED_INTERFACE_DISPLAY,
+ METHOD_GET_DISPLAY_COUNT, NULL, NULL);
+
+with the following error message
+E/SYSTEM_DEVICE(28384): dbus.c: dbus_method_sync(131) > g_dbus_proxy_call_sync error :
+org.tizen.system.deviced.display-GetDisplayCount (2-GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown:
+The name org.tizen.system.deviced was not provided by any .service files)
+
+That's why all device_display_* functions invoked here don't work */
+
+
+
/* Temporary - until real API is known */
static settings_picture_mode temp_mode = PICTURE_MODE_STANDARD;
static int temp_contrast = 50;
temp_contrast = val;
}
+void settings_picture_set_brightness(int val)
+{
+ int ret = DEVICE_ERROR_NONE;
+ int max = settings_picture_get_max_brightness();
+
+ if (max <= 0 || val < 0 || val > max) {
+ _ERR("Invalid parameters (max||val)");
+ return;
+ }
+
+ ret = device_display_set_brightness(DISPLAY_MAIN, val*max/100);
+ if (ret != DEVICE_ERROR_NONE)
+ _ERR("Failed to set brightness: %s", get_error_message(ret));
+}
+
settings_picture_mode settings_picture_get_picture_mode(void)
{
//@TODO: get picture mode
//@TODO: get contrast value
return temp_contrast;
}
+
+int settings_picture_get_brightness(void)
+{
+ int max, curr;
+ int ret = DEVICE_ERROR_NONE;
+
+ max = settings_picture_get_max_brightness();
+ if (max <= 0) {
+ _ERR("Invalid max brightness value");
+ return 0;
+ }
+
+ ret = device_display_get_brightness(0, &curr);
+ if (ret != DEVICE_ERROR_NONE) {
+ _ERR("Failed to get current brightness: %s", get_error_message(ret));
+ return 0;
+ }
+
+ return 100*curr/max;
+}
+
+int settings_picture_get_max_brightness(void)
+{
+ int max;
+ int ret = DEVICE_ERROR_NONE;
+
+ ret = device_display_get_max_brightness(0, &max);
+ if (ret != DEVICE_ERROR_NONE) {
+ _ERR("Failed to get max brightness: %s", get_error_message(ret));
+ return DEFAULT_MAX_BRIGHTNESS;
+ }
+
+ return max;
+}
*/
#include <Elementary.h>
-#include <device/display.h>
#include "common/layoutmgr.h"
#include "common/inputmgr.h"
#define PADDING_X 26
#define PADDING_Y 26
-#define BRIGHTNESS_DEFAULT "100%"
#define SCREEN_DEFAULT "16:9"
struct _priv {
},
{
.id = MENU_BRIGHTNESS,
- .title = "Brightness",
+ .title = STR_BRIGHTNESS,
.style = STYLE_STATUS_BTN,
- .disabled = EINA_TRUE,
+ .disabled = EINA_FALSE,
.status = _get_brightness,
.selected = _selected,
},
static char *_get_brightness(void *data, int id)
{
- SETTING_TRACE_BEGIN;
- char str[1024];
- int max, v;
- int r;
-
- r = device_display_get_numbers(&v);
- if (r != DEVICE_ERROR_NONE) {
- _ERR("failed to get number of display");
- return strdup(BRIGHTNESS_DEFAULT);
- }
+ char b_str[5] = {0, };
+ int b_val = settings_picture_get_brightness();
- r = device_display_get_max_brightness(0, &max);
- if (r != DEVICE_ERROR_NONE) {
- _ERR("failed to get max brightness");
- return strdup(BRIGHTNESS_DEFAULT);
- }
-
- r = device_display_get_brightness(0, &v);
- if (r != DEVICE_ERROR_NONE) {
- _ERR("failed to get brightness");
- return strdup(BRIGHTNESS_DEFAULT);
- }
+ if (b_val < 0)
+ return NULL;
- snprintf(str, sizeof(str), "%d%%", 100 * v / max);
+ snprintf(b_str, sizeof(b_str), "%d%%", b_val);
- return strdup(str);
+ return strdup(b_str);
}
static char *_get_screen_adj(void *data, int id)
if (!viewmgr_push_view(VIEW_PICTURE_CONTRAST))
_ERR("Push Picture contrast view failed.");
break;
+ case MENU_BRIGHTNESS:
+ if (!viewmgr_push_view(VIEW_PICTURE_BRIGHTNESS))
+ _ERR("Push Picture brightness view failed.");
+ break;
}
}
#include "view/view_base.h"
#include "view/picture/view_picture_mode.h"
#include "view/picture/view_picture_contrast.h"
+#include "view/picture/view_picture_brightness.h"
#include "view/system/view_clock.h"
#include "view/system/view_sleep_timer.h"
#include "view/system/view_wakeup_timer.h"
_ERR("Adding picture contrast view failed.");
return false;
}
+
+ if (!viewmgr_add_view(view_picture_brightness_get_vclass(), NULL)) {
+ _ERR("Adding picture brightness view failed.");
+ return false;
+ }
+
+
return true;
}
if (!viewmgr_remove_view(VIEW_PICTURE_CONTRAST))
_ERR("Remove picture contrast view failed.");
+
+ if (!viewmgr_remove_view(VIEW_PICTURE_BRIGHTNESS))
+ _ERR("Remove picture brightness view failed.");
}
static void _destroy_system_ui(void)
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "view/picture/view_picture_brightness.h"
+
+#include <app.h>
+
+#include "app_debug.h"
+#include "define.h"
+#include "common/inputmgr.h"
+#include "common/utils.h"
+#include "view/picture/view_picture_slider_generic.h"
+#include "data/settings_picture.h"
+
+struct _priv {
+ Evas_Object *base;
+ void *base_view_data;
+ const view_class *base_view_class;
+};
+
+static Evas_Object *_create(Evas_Object *win, void *data)
+{
+ struct _priv *priv = NULL;
+ generic_slider_attr g_slider_attr = {0, };
+
+ if (!win) {
+ _ERR("Get window object failed.");
+ return NULL;
+ }
+
+ priv = calloc(1, sizeof(struct _priv));
+ if (!priv) {
+ _ERR("Calloc failed.");
+ return NULL;
+ }
+
+ g_slider_attr.slider_title = STR_BRIGHTNESS;
+ g_slider_attr.slider_min_val = 0;
+ g_slider_attr.slider_max_val = settings_picture_get_max_brightness();
+ g_slider_attr.slider_cur_val = 100;
+ g_slider_attr.set_setting_value = settings_picture_set_brightness;
+ g_slider_attr.get_setting_value = settings_picture_get_brightness;
+
+ priv->base_view_class = view_picture_slider_generic_get_vclass();
+
+ if (!priv->base_view_class || !priv->base_view_class->create) {
+ _ERR("Failed to create generic slider view class.");
+ free(priv);
+ return NULL;
+ }
+
+ priv->base = priv->base_view_class->create(win, &g_slider_attr);
+ if (!priv->base) {
+ _ERR("Failed to create brightness view");
+ return NULL;
+ }
+
+ priv->base_view_data = g_slider_attr.generic_slider_data;
+
+ if (!viewmgr_set_view_data(VIEW_PICTURE_BRIGHTNESS, priv)) {
+ _ERR("Set view data failed.");
+ priv->base_view_class->destroy(priv->base_view_data);
+ free(priv);
+ return NULL;
+ }
+
+ return priv->base;
+}
+
+static void _show(void *data)
+{
+ struct _priv *priv = (struct _priv *)data;
+
+ if (!priv || !priv->base_view_class || !priv->base_view_class->show
+ || !priv->base_view_data) {
+ _ERR("Invalid parameter.");
+ return;
+ }
+
+ priv->base_view_class->show(priv->base_view_data);
+}
+
+static void _hide(void *data)
+{
+ struct _priv *priv = (struct _priv *)data;
+
+ if (!priv || !priv->base_view_class || !priv->base_view_class->hide
+ || !priv->base_view_data) {
+ _ERR("Invalid parameter.");
+ return;
+ }
+
+ priv->base_view_class->hide(priv->base_view_data);
+}
+
+static void _destroy(void *data)
+{
+ struct _priv *priv = (struct _priv *)data;
+
+ if (!priv || !priv->base_view_class || !priv->base_view_class->destroy
+ || !priv->base_view_data) {
+ _ERR("Invalid parameter.");
+ return;
+ }
+
+ priv->base_view_class->destroy(priv->base_view_data);
+
+ free(priv);
+}
+
+static view_class _vclass = {
+ .view_id = VIEW_PICTURE_BRIGHTNESS,
+ .create = _create,
+ .show = _show,
+ .hide = _hide,
+ .destroy = _destroy
+};
+
+view_class *view_picture_brightness_get_vclass(void)
+{
+ return &_vclass;
+}
* limitations under the License.
*/
-#include "view/picture/view_picture_mode.h"
+#include "view/picture/view_picture_contrast.h"
#include <app.h>
-#include <Elementary.h>
#include "app_debug.h"
#include "define.h"
#include "common/inputmgr.h"
#include "common/utils.h"
+#include "view/picture/view_picture_slider_generic.h"
#include "data/settings_picture.h"
-#define SLIDER_VAL_STR_L 4
-
struct _priv {
Evas_Object *base;
- Evas_Object *slider;
-
- int slider_val;
-};
-
-enum picture_contrast_eo_type {
- EO_PICTURE_CONTRAST_SLIDER
-};
-
-static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
- Evas_Event_Key_Down *ev);
-static void _changed_cb(int id, void *data, Evas_Object *obj);
-static void _set_current_value_str_position(struct _priv *priv);
-static void _update_slider_val(struct _priv *priv);
-
-static input_handler handler = {
- .changed = _changed_cb,
- .key_down = _key_down_cb
+ void *base_view_data;
+ const view_class *base_view_class;
};
static Evas_Object *_create(Evas_Object *win, void *data)
{
struct _priv *priv = NULL;
+ generic_slider_attr g_slider_attr = {0, };
if (!win) {
_ERR("Get window object failed.");
return NULL;
}
- priv->base = utils_add_layout(win, GRP_VIEW_GENERIC_SLIDER, EINA_TRUE);
- if (!priv->base) {
- _ERR("Add layout failed.");
- evas_object_del(priv->base);
+ g_slider_attr.slider_title = STR_CONTRAST;
+ g_slider_attr.slider_min_val = 0;
+ g_slider_attr.slider_max_val = 100;
+ g_slider_attr.slider_cur_val = 100;
+ g_slider_attr.set_setting_value = settings_picture_set_contrast;
+ g_slider_attr.get_setting_value = settings_picture_get_contrast;
+
+ priv->base_view_class = view_picture_slider_generic_get_vclass();
+
+ if (!priv->base_view_class || !priv->base_view_class->create) {
+ _ERR("Failed to create generic slider view class.");
free(priv);
return NULL;
}
- elm_object_part_text_set(priv->base, PART_TEXT, STR_CONTRAST);
- elm_object_part_text_set(priv->base, PART_VIEW_SLIDER_MIN, "0");
- elm_object_part_text_set(priv->base, PART_VIEW_SLIDER_MAX, "100");
-
- priv->slider = utils_add_slider(priv->base, PART_CONTENT, 50, 0, 100, 1);
- if (!priv->slider) {
- _ERR("Add slider failed.");
- evas_object_del(priv->slider);
- free(priv);
+ priv->base = priv->base_view_class->create(win, &g_slider_attr);
+ if (!priv->base) {
+ _ERR("Failed to create contrast view");
return NULL;
}
- inputmgr_add_callback(priv->slider, EO_PICTURE_CONTRAST_SLIDER, &handler, priv);
+
+ priv->base_view_data = g_slider_attr.generic_slider_data;
if (!viewmgr_set_view_data(VIEW_PICTURE_CONTRAST, priv)) {
_ERR("Set view data failed.");
- evas_object_del(priv->base);
+ priv->base_view_class->destroy(priv->base_view_data);
free(priv);
return NULL;
}
{
struct _priv *priv = (struct _priv *)data;
- if (!priv) {
+ if (!priv || !priv->base_view_class || !priv->base_view_class->show
+ || !priv->base_view_data) {
_ERR("Invalid parameter.");
return;
}
- evas_object_show(priv->base);
- elm_object_focus_set(priv->slider, EINA_TRUE);
-
- priv->slider_val = settings_picture_get_contrast();
- _update_slider_val(priv);
+ priv->base_view_class->show(priv->base_view_data);
}
static void _hide(void *data)
{
struct _priv *priv = (struct _priv *)data;
- if (!priv) {
+ if (!priv || !priv->base_view_class || !priv->base_view_class->hide
+ || !priv->base_view_data) {
_ERR("Invalid parameter.");
return;
}
- evas_object_hide(priv->base);
+ priv->base_view_class->hide(priv->base_view_data);
}
static void _destroy(void *data)
{
struct _priv *priv = (struct _priv *)data;
- if (!priv) {
+ if (!priv || !priv->base_view_class || !priv->base_view_class->destroy
+ || !priv->base_view_data) {
_ERR("Invalid parameter.");
return;
}
- evas_object_del(priv->base);
+ priv->base_view_class->destroy(priv->base_view_data);
free(priv);
}
{
return &_vclass;
}
-
-static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
- Evas_Event_Key_Down *ev)
-{
- struct _priv *priv = (struct _priv *)data;
-
- if (!ev || !priv) {
- _ERR("Invalid argument.");
- return;
- }
-
- if (!strcmp(ev->keyname, KEY_BACK) || (!strcmp(ev->keyname, KEY_ENTER)))
- viewmgr_pop_view();
-}
-
-static void _changed_cb(int id, void *data, Evas_Object *obj)
-{
- struct _priv *priv = (struct _priv *)data;
-
- if (!obj || !priv) {
- _ERR("Invalid argument.");
- return;
- }
-
- priv->slider_val = (int)elm_slider_value_get(obj);
- _set_current_value_str_position(priv);
- settings_picture_set_contrast(priv->slider_val);
-}
-
-static void _set_current_value_str_position(struct _priv *priv)
-{
- char val_str[SLIDER_VAL_STR_L] = {0, };
- Edje_Message_Int msg = {0,};
-
- if (!priv) {
- _ERR("Invalid parameter.");
- return;
- }
-
- msg.val = priv->slider_val;
- edje_object_message_send(elm_layout_edje_get(priv->base), EDJE_MESSAGE_INT, PIC_SLIDER_UPDATE_VAL, &msg);
-
- snprintf(val_str, SLIDER_VAL_STR_L, "%d", priv->slider_val);
- elm_object_part_text_set(priv->base, PART_VIEW_SLIDER_CUR, val_str);
-}
-
-
-static void _update_slider_val(struct _priv *priv)
-{
- if (!priv) {
- _ERR("Invalid parameter.");
- return;
- }
-
- elm_slider_value_set(priv->slider, priv->slider_val);
-
- _set_current_value_str_position(priv);
-}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "view/picture/view_picture_slider_generic.h"
+
+#include <app.h>
+#include <Elementary.h>
+
+#include "app_debug.h"
+#include "define.h"
+#include "common/inputmgr.h"
+#include "common/utils.h"
+
+#define SLIDER_VAL_STR_L 4
+
+struct _priv {
+ Evas_Object *base;
+ Evas_Object *slider;
+
+ int slider_val;
+
+ set_value settings_set_value;
+ get_value settings_get_value;
+};
+
+static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
+ Evas_Event_Key_Down *ev);
+static void _changed_cb(int id, void *data, Evas_Object *obj);
+static void _set_current_value_str_position(struct _priv *priv);
+static void _update_slider_val(struct _priv *priv);
+
+static input_handler handler = {
+ .changed = _changed_cb,
+ .key_down = _key_down_cb
+};
+
+static Evas_Object *_create(Evas_Object *win, void *data)
+{
+ struct _priv *priv = NULL;
+ generic_slider_attr *attr = (generic_slider_attr *)data;
+ char slider_min_val_str[SLIDER_VAL_STR_L] = {0, };
+ char slider_max_val_str[SLIDER_VAL_STR_L] = {0, };
+
+ if (!win || !attr) {
+ _ERR("Invalid parameter.");
+ return NULL;
+ }
+
+ priv = calloc(1, sizeof(struct _priv));
+ if (!priv) {
+ _ERR("Calloc failed.");
+ return NULL;
+ }
+
+ priv->base = utils_add_layout(win, GRP_VIEW_GENERIC_SLIDER, EINA_TRUE);
+ if (!priv->base) {
+ _ERR("Add layout failed.");
+ free(priv);
+ return NULL;
+ }
+
+ snprintf(slider_min_val_str, SLIDER_VAL_STR_L, "%d", attr->slider_min_val);
+ snprintf(slider_max_val_str, SLIDER_VAL_STR_L, "%d", attr->slider_max_val);
+
+ elm_object_part_text_set(priv->base, PART_TEXT, attr->slider_title);
+ elm_object_part_text_set(priv->base, PART_VIEW_SLIDER_MIN, slider_min_val_str);
+ elm_object_part_text_set(priv->base, PART_VIEW_SLIDER_MAX, slider_max_val_str);
+
+ priv->slider = utils_add_slider(priv->base, PART_CONTENT, 50,
+ attr->slider_min_val, attr->slider_max_val, attr->slider_step);
+ if (!priv->slider) {
+ _ERR("Add slider failed.");
+ evas_object_del(priv->slider);
+ free(priv);
+ return NULL;
+ }
+ inputmgr_add_callback(priv->slider, 0, &handler, priv);
+
+ priv->settings_set_value = attr->set_setting_value;
+ priv->settings_get_value = attr->get_setting_value;
+
+ attr->generic_slider_data = priv;
+
+ return priv->base;
+}
+
+static void _show(void *data)
+{
+ struct _priv *priv = (struct _priv *)data;
+
+ if (!priv || !priv->settings_get_value) {
+ _ERR("Invalid parameter.");
+ return;
+ }
+
+ evas_object_show(priv->base);
+ elm_object_focus_set(priv->slider, EINA_TRUE);
+
+ priv->slider_val = priv->settings_get_value();
+ _update_slider_val(priv);
+}
+
+static void _hide(void *data)
+{
+ struct _priv *priv = (struct _priv *)data;
+
+ if (!priv) {
+ _ERR("Invalid parameter.");
+ return;
+ }
+
+ evas_object_hide(priv->base);
+}
+
+static void _destroy(void *data)
+{
+ struct _priv *priv = (struct _priv *)data;
+
+ if (!priv) {
+ _ERR("Invalid parameter.");
+ return;
+ }
+
+ evas_object_del(priv->base);
+
+ free(priv);
+}
+
+static view_class _vclass = {
+ .view_id = NULL,
+ .create = _create,
+ .show = _show,
+ .hide = _hide,
+ .destroy = _destroy
+};
+
+view_class *view_picture_slider_generic_get_vclass(void)
+{
+ return &_vclass;
+}
+
+static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
+ Evas_Event_Key_Down *ev)
+{
+ struct _priv *priv = (struct _priv *)data;
+
+ if (!ev || !priv) {
+ _ERR("Invalid argument.");
+ return;
+ }
+
+ if (!strcmp(ev->keyname, KEY_BACK) || (!strcmp(ev->keyname, KEY_ENTER)))
+ viewmgr_pop_view();
+}
+
+static void _changed_cb(int id, void *data, Evas_Object *obj)
+{
+ struct _priv *priv = (struct _priv *)data;
+
+ if (!obj || !priv || !priv->settings_set_value) {
+ _ERR("Invalid argument.");
+ return;
+ }
+
+ priv->slider_val = (int)elm_slider_value_get(obj);
+ _set_current_value_str_position(priv);
+ priv->settings_set_value(priv->slider_val);
+}
+
+static void _set_current_value_str_position(struct _priv *priv)
+{
+ char val_str[SLIDER_VAL_STR_L] = {0, };
+ Edje_Message_Int msg = {0,};
+
+ if (!priv) {
+ _ERR("Invalid parameter.");
+ return;
+ }
+
+ msg.val = priv->slider_val;
+ edje_object_message_send(elm_layout_edje_get(priv->base), EDJE_MESSAGE_INT, PIC_SLIDER_UPDATE_VAL, &msg);
+
+ snprintf(val_str, SLIDER_VAL_STR_L, "%d", priv->slider_val);
+ elm_object_part_text_set(priv->base, PART_VIEW_SLIDER_CUR, val_str);
+}
+
+
+static void _update_slider_val(struct _priv *priv)
+{
+ if (!priv) {
+ _ERR("Invalid parameter.");
+ return;
+ }
+
+ elm_slider_value_set(priv->slider, priv->slider_val);
+
+ _set_current_value_str_position(priv);
+}