"IDS_ST_BODY_FLIGHT_MODE"
};
-static int MENU_SIZE =
- sizeof(menu_its) / sizeof(menu_its[0]);
-
static char *
_gl_menu_title_text_get(void *data, Evas_Object *obj, const char *part)
{
}
static char *
-_gl_menu_text_get(void *data, Evas_Object *obj, const char *part)
+_gl_menu_text_get_poweroff(void *data, Evas_Object *obj, const char *part)
{
- Item_Data *id = (Item_Data *)data;
- int index = id->index;
+ if (!strncmp(part, "elm.text", sizeof("elm.text")))
+ return strdup(_(menu_its[0]));
+
+ return NULL;
+}
+static char *
+_gl_menu_text_get_airplane(void *data, Evas_Object *obj, const char *part)
+{
if (!strncmp(part, "elm.text", sizeof("elm.text")))
- return strdup(_(menu_its[index]));
+ return strdup(_(menu_its[1]));
return NULL;
}
static void
-_gl_sel_cb(void *data, Evas_Object *obj, void *event_info)
+_gl_sel_poweroff_cb(void *data, Evas_Object *obj, void *event_info)
{
const struct popup_ops *ops = data;
+
+ _D("poweroff is chosen");
+ elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
+ poweroff_clicked(ops);
+
+ return;
+}
+
+static void
+_gl_sel_airplane_cb(void *data, Evas_Object *obj, void *event_info)
+{
bundle *b = NULL;
- Elm_Object_Item *it = (Elm_Object_Item *)event_info;
- Item_Data *id = (Item_Data *)elm_object_item_data_get(it);
int is_flight_mode = 0;
int ret = 0;
elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
- if (id->index == 0) {
- _D("poweroff is chosen");
- poweroff_clicked(ops);
- }
- else if (id->index == 1) {
_D("flight mode is chosen");
ret = vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &is_flight_mode);
if (ret < 0) {
load_simple_popup(b, &flightmode_ops);
else
set_flight_icon(!is_flight_mode);
- } else
- _E("Wrong button is pressed");
return;
}
-Evas_Object *_gl_menu_contents_get(void *data, Evas_Object *obj, const char *part)
+static Evas_Object *_gl_menu_contents_get_airplane(void *data, Evas_Object *obj, const char *part)
{
- Evas_Object *check = NULL;
+ Evas_Object *check;
Powerkey_Item_Data *id = data;
- int index = id->index;
int is_value = 0;
int ret = 0;
if (!strncmp(part, "elm.icon", sizeof("elm.icon"))) {
- switch (index) {
- case POWERKEY_FLIGHT_MODE:
+ _D("index = AIRPLANE_MODE");
check = elm_check_add(obj);
- if (check == NULL) {
- _E("Error in adding check button");
+ if (!check) {
+ _E("BAD check!");
return NULL;
}
flight_icon = check;
evas_object_propagate_events_set(check, EINA_TRUE);
id->check = check;
- break;
+ return check;
+ } else
+ return NULL;
+}
- case POWERKEY_POWER_OFF:
- break;
+static Evas_Object *_gl_menu_contents_get_poweroff(void *data, Evas_Object *obj, const char *part)
+{
+ Evas_Object *img;
+ Evas_Coord w, h;
- default:
- _E("Invalid index(%d)", index);
- break;
+ if (!strncmp(part, "elm.icon", sizeof("elm.icon"))) {
+ _D("index = POWEROFF_MODE");
+ img = elm_image_add(obj);
+ if (!img) {
+ _E("BAD image!");
+ return NULL;
}
- }
-
- return check;
+ elm_image_file_set(img, RESDIR"/saving_device_options_power_off.png", NULL);
+ elm_image_object_size_get(img, &w, &h);
+ evas_object_size_hint_min_set(img, w, h);
+ return img;
+ } else
+ return NULL;
}
static void pm_state_changed(keynode_t *key, void *data)
Elm_Object_Item *nf_it;
Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new();
Elm_Genlist_Item_Class *ttc = elm_genlist_item_class_new();
+ Elm_Genlist_Item_Class *utc = elm_genlist_item_class_new();
Elm_Genlist_Item_Class *ptc = elm_genlist_item_class_new();
Item_Data *id;
- int i = 0;
+ int i;
ad = (appdata_s *)application_info;
if (ad == NULL) return;
ttc->func.text_get = _gl_menu_title_text_get;
ttc->func.del = NULL;
- itc->item_style = "1text.1icon.1";
- itc->func.text_get = _gl_menu_text_get;
- itc->func.content_get = _gl_menu_contents_get;
+ itc->item_style = "1text.1icon";
+ itc->func.text_get = _gl_menu_text_get_poweroff;
+ itc->func.content_get = _gl_menu_contents_get_poweroff;
itc->func.del = NULL;
ptc->item_style = "padding";
ptc->func.del = NULL;
+ utc->item_style = "1text.1icon.1";
+ utc->func.text_get = _gl_menu_text_get_airplane;
+ utc->func.content_get = _gl_menu_contents_get_airplane;
+ utc->func.del = NULL;
+
+ ptc->item_style = "padding";
+ ptc->func.del = NULL;
+
/* back key */
eext_object_event_callback_add(genlist, EEXT_CALLBACK_BACK, event_back_key_up, (void*)ops);
elm_genlist_item_append(genlist, ttc, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
- _D("MENU_SIZE=%d", MENU_SIZE);
- for (i = 0; i < MENU_SIZE; i++) {
- _D("menu_its[%d] = %s", i, menu_its[i]);
- id = calloc(sizeof(Item_Data), 1);
- id->index = i;
- id->item = elm_genlist_item_append(genlist, itc, id, NULL, ELM_GENLIST_ITEM_NONE, _gl_sel_cb, ops);
- }
+ i = 0;
+ id = calloc(sizeof(Item_Data), 1);
+ id->index = i;
+ id->item = elm_genlist_item_append(genlist, itc, id, NULL, ELM_GENLIST_ITEM_NONE, _gl_sel_poweroff_cb, ops);
+
+ i++;
+ id = calloc(sizeof(Item_Data), 1);
+ id->index = i;
+ id->item = elm_genlist_item_append(genlist, utc, id, NULL, ELM_GENLIST_ITEM_NONE, _gl_sel_airplane_cb, ops);
elm_genlist_item_append(genlist, ptc, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
elm_genlist_item_class_free(itc);
elm_genlist_item_class_free(ttc);
+ elm_genlist_item_class_free(utc);
elm_genlist_item_class_free(ptc);
nf_it = elm_naviframe_item_push(ad->nf, NULL, NULL, NULL, genlist, "empty");