bool ui_refresh_time(ePlayer *player, int time) { char buf[9], *fmt[2]; fmt[TIME_DISPLAY_ELAPSED] = "%i:%02i"; fmt[TIME_DISPLAY_LEFT] = "-%i:%02i"; snprintf(buf, sizeof(buf), fmt[player->cfg.time_display], (time / 60), (time % 60)); edje_object_part_text_set(player->gui.edje, "time_text", buf); evas_render(player->gui.evas); return true; }
void entrybox_item(Evas *e, Evas_Object *obj,int index, bool lp) { entry_info_struct *infostruct=(entry_info_struct *) evas_object_data_get(obj,"entry_info"); if(infostruct->curchar>=infostruct->maxchar) return; else if(index>=0 && index<=9) { (infostruct->entry)[infostruct->curchar]=((char)index)+'0'; (infostruct->entry)[infostruct->curchar+1]='\0'; infostruct->curchar++; edje_object_part_text_set(obj,"dlg_entrybox/entrytext",infostruct->entry); } }
static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; _elm_widget_mirrored_reload(obj); _mirrored_set(obj, elm_widget_mirrored_get(obj)); _elm_theme_object_set(obj, wd->frm, "frame", "base", elm_widget_style_get(obj)); edje_object_part_text_set(wd->frm, "elm.text", wd->label); if (wd->content) edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content); edje_object_scale_set(wd->frm, elm_widget_scale_get(obj) * _elm_config->scale); _sizing_eval(obj); }
/* set theme title text */ void theme_message_set(const char *txt) { if (edje_object_part_exists(o_bg, "exquisite.message")) { edje_object_part_text_set(o_bg, "exquisite.message", txt); edje_object_signal_emit(o_bg, "exquisite", "message"); } else { Edje_Message_String m; m.str = (char *)txt; edje_object_message_send(o_bg, EDJE_MESSAGE_STRING, 1, &m); } }
/* ecore timer callback */ static Eina_Bool _update_infos_cb(void *data) { Enna_Buffer *b; Evas_Object *obj; obj = data; b = enna_buffer_new(); set_enna_information(b); set_system_information(b); edje_object_part_text_set(obj, "sysinfo.text", b->buf); edje_object_signal_emit(obj, "sysinfo,show", "enna"); enna_buffer_free(b); return ECORE_CALLBACK_RENEW; }
void on_number_button_clicked(void *data, Evas_Object *obj, const char *emission, const char *source) { const char *n = data; char buf[1024]; int aux; int current = atoi(edje_object_part_text_get(obj, "input")); aux = atoi(n); aux += current*10; snprintf(buf, sizeof(buf), "%d", aux); edje_object_part_text_set(obj, "input", buf); }
EAPI void e_widget_button_label_set(Evas_Object *obj, const char *label) { E_Widget_Data *wd; int mw, mh; wd = e_widget_data_get(obj); edje_object_part_text_set(wd->o_button, "e.text.label", label); if ((label) && (label[0] != 0)) wd->type |= E_WIDGET_BUTTON_TEXT; else wd->type = ~(wd->type & E_WIDGET_BUTTON_TEXT); _e_wid_button_state_send(wd); edje_object_size_min_calc(wd->o_button, &mw, &mh); e_widget_size_min_set(obj, mw, mh); }
/* Text: render() */ static Etk_Bool _text_render(Etk_Tree_Model *model, Etk_Tree_Row *row, Etk_Geometry geometry, void *cell_data, Evas_Object *cell_objects[ETK_TREE_MAX_OBJECTS_PER_MODEL], Evas *evas) { char **text_data; int th; if (!(text_data = cell_data) || !cell_objects[0]) return ETK_FALSE; edje_object_part_text_set(cell_objects[0], "etk.text.label", *text_data); edje_object_size_min_calc(cell_objects[0], NULL, &th); evas_object_move(cell_objects[0], geometry.x, geometry.y + ((geometry.h - th) / 2)); evas_object_resize(cell_objects[0], geometry.w, geometry.h); evas_object_show(cell_objects[0]); return ETK_FALSE; }
void _eli_edje_frontend_menu_container_fill(Eli_App * eap, Evas_Object * container) { const char ** games; char * file; file = ecore_config_theme_with_path_from_name_get(eap->theme.gui.current); games = elitaire_available_games_get(); for (int i = 0; games[i][0]; i++) { Evas_Object * item; item = edje_object_add(evas_object_evas_get(container)); if (edje_object_file_set(item, file, "elitaire/element")) { Evas_Coord w, h; edje_object_size_min_get(item, NULL, &h); evas_object_geometry_get(container, NULL, NULL, &w, NULL); evas_object_resize(item, w, h); if (edje_object_part_exists(item, "elitaire_element_value")) { edje_object_part_text_set(item, "elitaire_element_value", games[i]); evas_object_show(item); edje_object_signal_callback_add(item, "item_selected", "item_selected", _eli_edje_frontend_new_game_cb, eap); esmart_container_element_append(container, item); } else { fprintf(stderr, _("Elitaire Error in %s: " "missing element_value part!\n"), file); evas_object_del(item); } } else { fprintf(stderr, _("Elitaire Error in %s: missing element group!\n"), file); evas_object_del(item); } } }
void entrybox_esc(Evas *e, Evas_Object *obj) { entry_info_struct *infostruct=(entry_info_struct *) evas_object_data_get(obj,"entry_info"); if(infostruct->curchar>0) { infostruct->curchar--; infostruct->entry[infostruct->curchar]='\0'; edje_object_part_text_set(obj,"dlg_entrybox/entrytext",infostruct->entry); } else { evas_object_focus_set(infostruct->parent,1); free(infostruct->entry); fini_entrybox(e,obj); (infostruct->handler)(e,obj,NULL); } }
/* Double: render() */ static Etk_Bool _double_render(Etk_Tree_Model *model, Etk_Tree_Row *row, Etk_Geometry geometry, void *cell_data, Evas_Object *cell_objects[ETK_TREE_MAX_OBJECTS_PER_MODEL], Evas *evas) { double *double_data; char string[256]; int th; if (!(double_data = cell_data) || !model || !cell_objects[0]) return ETK_FALSE; snprintf(string, 255, "%.2f", *double_data); edje_object_part_text_set(cell_objects[0], "etk.text.label", string); edje_object_size_min_calc(cell_objects[0], NULL, &th); evas_object_move(cell_objects[0], geometry.x, geometry.y + ((geometry.h - th) / 2)); evas_object_resize(cell_objects[0], geometry.w, geometry.h); evas_object_show(cell_objects[0]); return ETK_FALSE; }
void itask_menu_button(Itask *it) { it->o_button = edje_object_add(evas_object_evas_get(it->o_box)); evas_object_event_callback_add(it->o_button, EVAS_CALLBACK_MOUSE_DOWN, _itask_menu_cb_mouse_down, it); if (!e_theme_edje_object_set(it->o_button, "base/theme/modules/itask", "e/modules/itask/button")) edje_object_file_set(it->o_button, itask_theme_path, "e/modules/itask/button"); edje_object_signal_emit(it->o_button, "e,state,icon", "e"); edje_object_part_text_set(it->o_button, "label", ""); evas_object_show(it->o_button); e_box_pack_start(it->o_box, it->o_button); Itask_Item *ic; ic = E_NEW(Itask_Item,1); ic->itask = it; ic->o_holder = it->o_button; it->menubutton = ic; }
static void _enscribi_input_frame_cb_finished(void *data, Evas_Object *obj, const char *emission, const char *source) { Smart_Data *sd; Edje_Message_String msg; char *str; sd = data; msg.str = edje_object_part_text_get(obj, "result"); if (msg.str && strlen(msg.str) > 0) { printf("Result: %s\n", msg.str); if (sd->parent) edje_object_message_send(sd->parent, EDJE_MESSAGE_STRING, 188, &msg); evas_object_smart_callback_call(sd->obj, "input,selected", edje_object_part_text_get(obj, "result")); } edje_object_part_text_set(obj, "result", ""); }
/* Private Functions */ static void _e_toolbar_smart_add(Evas_Object *obj) { Evas *evas; E_Toolbar_Smart_Data *sd; Evas_Object *o; char buf[4096]; if ((!obj) || !(evas = evas_object_evas_get(obj))) return; sd = malloc(sizeof(E_Toolbar_Smart_Data)); if (!sd) return; sd->valign = 0.0; sd->path = NULL; evas_object_smart_data_set(obj, sd); snprintf(buf, sizeof(buf), "%s/fileman.edj", e_module_dir_get(conf_module)); o = edje_object_add(evas); sd->o_base = o; if (!e_theme_edje_object_set(o, "base/theme/modules/fileman", "modules/fileman/toolbar")) edje_object_file_set(o, buf, "modules/fileman/toolbar"); evas_object_smart_member_add(o, obj); edje_object_size_min_calc(o, &sd->w, &sd->h); o = e_widget_button_add(evas, _("Up"), "widget/up_dir", _e_toolbar_btn_cb, obj, NULL); sd->o_btn = o; edje_object_part_swallow(sd->o_base, "e.swallow.button", o); evas_object_show(o); edje_object_part_text_set(sd->o_base, "e.text.location", _("Location:")); o = e_widget_entry_add(evas, &(sd->path), NULL, NULL, NULL); sd->o_entry = o; edje_object_part_swallow(sd->o_base, "e.swallow.entry", o); evas_object_show(o); evas_object_smart_callback_add(sd->o_entry, "key_down", _e_toolbar_key_down_cb, obj); }
Etheme_Object * etheme_new(const char * t) { Etheme_Object * o; o = (Etheme_Object *) malloc(sizeof(Etheme_Object)); o->theme = (char *) strdup(t); o->thumbpath = e_preview_thumb_file_get(t); int size = strlen(t) - 4; /* without .edj */ o->label = malloc(sizeof(char) * size); o->label = strncpy(o->label, t, size); o->label[size] = 0; o->button = edje_object_add(evas); edje_object_file_set(o->button, default_theme, "fileman/icon_normal"); evas_object_resize(o->button, 100, 120); edje_object_part_text_set(o->button, "icon_title" , o->label); esmart_container_element_append(container, o->button); if (e_preview_thumb_check(t)) e_preview_thumb_generate(t); o->thumb = evas_object_image_add(evas); evas_object_image_size_set(o->thumb, 640, 480); evas_object_image_fill_set(o->thumb, 0, 0, 85, 85); e_preview_thumb_image(o->thumbpath, o->thumb); edje_object_part_swallow(o->button, "icon_swallow", o->thumb); evas_object_show(o->button); edje_object_signal_callback_add(o->button, "mouse,up,1", "icon_event", _preview_theme, o); return o; }
static void _update_gui(const madshelf_state_t* state) { Evas_Object* choicebox = evas_object_name_find(state->canvas, "contents"); Evas_Object* header = evas_object_name_find(state->canvas, "main_edje"); _loc_t* _loc = (_loc_t*)state->loc; choicebox_set_size(choicebox, eina_array_count_get(_loc->files)); choicebox_invalidate_interval(choicebox, 0, eina_array_count_get(_loc->files)); madshelf_disk_t* d = find_disk(state->disks, _loc->dir); char *text = xasprintf("<fixed>%s:</fixed>%s", d->short_name, _loc->dir + strlen(d->path)); edje_object_part_text_set(header, "title", text); free(text); set_sort_icon(state, state->sort); }
Evas_Object * elm_keypad_add(Evas_Object * parent) { // Evas_Object *obj; Instead I'm using the wd->widget variable Evas *e; Widget_Data *wd; wd = ELM_NEW(Widget_Data); e = evas_object_evas_get(parent); wd->widget = elm_widget_add(e); elm_widget_data_set(wd->widget, wd); elm_widget_del_hook_set(wd->widget, _del_hook); wd->keypad = edje_object_add(e); g_debug("keypad evas object: %d", wd->keypad); edje_object_file_set(wd->keypad, KEYPAD_FILE, "keypad"); edje_object_signal_callback_add(wd->keypad, "*", "input", _signal_clicked, wd->widget); edje_object_signal_callback_add(wd->keypad, "0", "mouse_up", _zero_mouse_up, wd->widget); edje_object_signal_callback_add(wd->keypad, "0", "mouse_down", _zero_mouse_down, wd->widget); edje_object_part_text_set(wd->keypad, "text2_desc", D_("ABC")); edje_object_part_text_set(wd->keypad, "text3_desc", D_("DEF")); edje_object_part_text_set(wd->keypad, "text4_desc", D_("GHI")); edje_object_part_text_set(wd->keypad, "text5_desc", D_("JKL")); edje_object_part_text_set(wd->keypad, "text6_desc", D_("MNO")); edje_object_part_text_set(wd->keypad, "text7_desc", D_("PQRS")); edje_object_part_text_set(wd->keypad, "text8_desc", D_("TUV")); edje_object_part_text_set(wd->keypad, "text9_desc", D_("XYZ")); elm_widget_resize_object_set(wd->widget, wd->keypad); //evas_object_smart_callback_add(wd->widget, "sub-object-del", _sub_del, wd->widget); _sizing_eval(wd->widget); return wd->widget; }
/* Progressbar: render() */ static Etk_Bool _progress_bar_render(Etk_Tree_Model *model, Etk_Tree_Row *row, Etk_Geometry geometry, void *cell_data, Evas_Object *cell_objects[ETK_TREE_MAX_OBJECTS_PER_MODEL], Evas *evas) { Etk_Tree_Model_Progressbar_Data *pbar_data; int w, h; if (!(pbar_data = cell_data) || !cell_objects[0]) return ETK_FALSE; edje_object_part_text_set(cell_objects[0], "etk.text.text", pbar_data->text ? pbar_data->text : ""); evas_object_data_set(cell_objects[0], "_Etk_Tree_Model_Progressbar::Row", row); edje_object_size_min_get(cell_objects[0], &w, &h); evas_object_move(cell_objects[0], geometry.x, geometry.y + ((geometry.h - h) / 2)); evas_object_resize(cell_objects[0], w > geometry.w ? w : geometry.w, h); edje_object_part_drag_value_set(cell_objects[0], "etk.dragable.filler", 0.0, 0.0); edje_object_part_drag_size_set(cell_objects[0], "etk.dragable.filler", pbar_data->fraction, 0.0); evas_object_show(cell_objects[0]); return ETK_FALSE; }
Url_Bar * url_bar_add(Evas_Object *webView, int width) { Evas *evas; Url_Bar *url_bar; if (!webView) return NULL; evas = evas_object_evas_get(webView); url_bar = (Url_Bar *)malloc(sizeof(Url_Bar)); url_bar->webView = webView; url_bar->area = evas_object_rectangle_add(evas); evas_object_name_set(url_bar->area, "url_barArea"); evas_object_color_set(url_bar->area, 255, 255, 255, 255); url_bar->entry = edje_object_add(evas); Eina_Bool ret = edje_object_file_set(url_bar->entry, THEME_DIR"/entry.edj", "control/entry/base/default"); if (!ret) { evas_object_del(url_bar->area); free(url_bar); return NULL; } edje_object_part_text_set(url_bar->entry, "url.text", ""); /* Set URL bar dimensions and show it */ url_bar_width_set(url_bar, width); evas_object_show(url_bar->area); evas_object_show(url_bar->entry); evas_object_event_callback_add(url_bar->entry, EVAS_CALLBACK_MOUSE_DOWN, on_urlbar_mouse_down, url_bar); evas_object_event_callback_add(url_bar->entry, EVAS_CALLBACK_KEY_DOWN, on_urlbar_key_down, url_bar); evas_object_event_callback_add(url_bar->entry, EVAS_CALLBACK_FOCUS_OUT, on_urlbar_focus_out, url_bar); return url_bar; }
/* externally accessible functions */ EAPI Evas_Object * e_widget_font_preview_add(Evas *evas, const char *text) { Evas_Object *obj, *o; E_Widget_Data *wd; obj = e_widget_add(evas); e_widget_del_hook_set(obj, _e_wid_del_hook); wd = calloc(1, sizeof(E_Widget_Data)); e_widget_data_set(obj, wd); /* Add Scrollpane */ o = e_scrollframe_add(evas); wd->o_scrollframe = o; e_scrollframe_policy_set(o, E_SCROLLFRAME_POLICY_OFF, E_SCROLLFRAME_POLICY_OFF); evas_object_show(o); e_widget_sub_object_add(obj, o); e_widget_resize_object_set(obj, o); evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_wid_focus_steal, obj); /* Add Text */ o = edje_object_add(evas); wd->o_text = o; e_theme_edje_object_set(o, "base/theme/widgets", "e/widgets/fontpreview"); evas_object_event_callback_add(wd->o_scrollframe, EVAS_CALLBACK_RESIZE, _e_wid_cb_scrollframe_resize, wd); e_scrollframe_child_set(wd->o_scrollframe, o); e_widget_sub_object_add(obj, o); evas_object_show(o); edje_object_part_text_set(wd->o_text, "e.fontpreview.text", text); evas_object_resize(obj, 40, 40); e_widget_size_min_set(obj, 40, 40); return obj; }
static Evas_Object *create_my_group(Evas *canvas, const char *text) { Evas_Object *edje; edje = edje_object_add(canvas); if (!edje) { EINA_LOG_CRIT("could not create edje object!"); return NULL; } if (!edje_object_file_set(edje, PACKAGE_DATA_DIR"/edje_example.edj", "my_group")) { int err = edje_object_load_error_get(edje); const char *errmsg = edje_load_error_str(err); EINA_LOG_ERR("could not load 'my_group' from edje_example.edj: %s", errmsg); evas_object_del(edje); return NULL; } if (text) { if (!edje_object_part_text_set(edje, "text", text)) { EINA_LOG_WARN("could not set the text. " "Maybe part 'text' does not exist?"); } } evas_object_move(edje, 0, 0); evas_object_resize(edje, WIDTH, HEIGHT); evas_object_show(edje); return edje; }
/** * Creates a check box widget * * @param evas pointer * @param label the text to asign to check widget * @param val pointer to int where changes are stored * @return the newly created evas object */ EAPI Evas_Object * e_widget_check_add(Evas *evas, const char *label, int *val) { Evas_Object *obj, *o; E_Widget_Data *wd; Evas_Coord mw, mh; obj = e_widget_add(evas); e_widget_del_hook_set(obj, _e_wid_del_hook); e_widget_focus_hook_set(obj, _e_wid_focus_hook); e_widget_activate_hook_set(obj, _e_wid_activate_hook); e_widget_disable_hook_set(obj, _e_wid_disable_hook); wd = calloc(1, sizeof(E_Widget_Data)); wd->valptr = val; e_widget_data_set(obj, wd); o = edje_object_add(evas); wd->o_check = o; e_theme_edje_object_set(o, "base/theme/widgets", "e/widgets/check"); edje_object_signal_callback_add(o, "e,action,toggle", "*", _e_wid_signal_cb1, obj); edje_object_part_text_set(o, "e.text.label", label); evas_object_show(o); edje_object_size_min_calc(o, &mw, &mh); e_widget_size_min_set(obj, mw, mh); if (wd->valptr) { if (*(wd->valptr)) edje_object_signal_emit(o, "e,state,checked", "e"); } e_widget_sub_object_add(obj, o); evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_wid_focus_steal, obj); e_widget_resize_object_set(obj, o); return obj; }
static void _init_contacts_page(struct MessageNewViewData *view) { Evas_Object *win, *btn; win = ui_utils_view_window_get(VIEW_PTR(*view)); view->layout_contacts = elm_layout_add(view->pager); elm_win_resize_object_add(win, view->layout_contacts); elm_layout_file_set(view->layout_contacts, phoneui_theme, "phoneui/messages/new/contacts"); evas_object_show(view->layout_contacts); edje_object_part_text_set(elm_layout_edje_get(view->layout_contacts), "contacts_title", D_("Add Contact")); view->contact_list_data.layout = view->layout_contacts; contact_list_add(&view->contact_list_data); btn = elm_button_add(win); elm_object_text_set(btn, D_("Back")); evas_object_smart_callback_add(btn, "clicked", _contacts_button_back_clicked, view); elm_object_part_content_set(view->layout_contacts, "contacts_button_back", btn); evas_object_show(btn); btn = elm_button_add(win); elm_object_text_set(btn, D_("Add")); evas_object_smart_callback_add(btn, "clicked", _contacts_button_add_clicked, view); elm_object_part_content_set(view->layout_contacts, "contacts_button_add", btn); evas_object_show(btn); contact_list_fill(&view->contact_list_data); elm_naviframe_item_simple_push(view->pager, view->layout_contacts); }
static void _dbus_cb_tracklist_metadata(void *data, DBusMessage *reply, DBusError *error) { DBusMessageIter array, item, iter, iter_val; Instance *inst = data; int type, cnt = 0; char *key, *tmp, *location = NULL; int title = 0; Evas_Object *empris = inst->empris; Evas_Object *o_popup = inst->o_popup; if (error) { if (!_dbus_check_msg(reply, error)) { printf("dbus garbage!\n"); goto error; } } edje_object_part_text_set (empris, "empris.artist", ""); edje_object_part_text_set (o_popup, "empris.artist", ""); edje_object_part_text_set (empris, "empris.title", ""); edje_object_part_text_set (o_popup, "empris.title", ""); edje_object_part_text_set (empris, "empris.album", ""); edje_object_part_text_set (o_popup, "empris.album", ""); dbus_message_iter_init(reply, &array); if(dbus_message_iter_get_arg_type(&array) == DBUS_TYPE_ARRAY) { dbus_message_iter_recurse(&array, &item); while(dbus_message_iter_get_arg_type(&item) == DBUS_TYPE_DICT_ENTRY) { dbus_message_iter_recurse(&item, &iter); if (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_STRING) { dbus_message_iter_get_basic(&iter, &key); } else { printf("not string{n"); goto error; } dbus_message_iter_next(&iter); if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT) { printf("not variant\n"); goto error; } if (!strcmp(key, "artist")) { dbus_message_iter_recurse (&iter, &iter_val); dbus_message_iter_get_basic (&iter_val, &tmp); if (tmp && tmp[0]) { edje_object_part_text_set (empris, "empris.artist", tmp); edje_object_part_text_set (o_popup, "empris.artist", tmp); } } else if (!strcmp(key, "title")) { dbus_message_iter_recurse (&iter, &iter_val); dbus_message_iter_get_basic (&iter_val, &tmp); if (tmp && tmp[0]) { edje_object_part_text_set (empris, "empris.title", tmp); edje_object_part_text_set (o_popup, "empris.title", tmp); title = 1; } } else if (!strcmp(key, "location")) { dbus_message_iter_recurse (&iter, &iter_val); dbus_message_iter_get_basic (&iter_val, &tmp); if (tmp && tmp[0]) { location = strdup(tmp); } } else if (!strcmp(key, "album")) { dbus_message_iter_recurse (&iter, &iter_val); dbus_message_iter_get_basic (&iter_val, &tmp); if (tmp && tmp[0]) { edje_object_part_text_set (empris, "empris.album", tmp); edje_object_part_text_set (o_popup, "empris.album", tmp); } } /* else if (!strcmp(key, "mtime")) * { * dbus_message_iter_recurse (&iter, &iter_val); * dbus_message_iter_get_basic (&iter_val, &(t->length)); * } */ dbus_message_iter_next(&item); } } if (!title && location) { char *tmp = _util_unescape(ecore_file_file_get(location), 0); if (tmp) { edje_object_part_text_set (empris, "empris.title", tmp); edje_object_part_text_set (o_popup, "empris.title", tmp); free(tmp); } free(location); } error: return; }
static void indicator_clock_changed_cb(void *data) { struct appdata *ad = (struct appdata *)data; char time_str[32]; char time_buf[128], ampm_buf[128]; char buf[256]; struct tm *ts = NULL; time_t ctime; int len; retif(data == NULL, , "Invalid parameter!"); /* Set time */ ctime = time(NULL); ts = localtime(&ctime); if (ts == NULL) return; if (timer != NULL) { ecore_timer_del(timer); timer = NULL; } memset(time_str, 0x00, sizeof(time_str)); memset(time_buf, 0x00, sizeof(time_buf)); memset(ampm_buf, 0x00, sizeof(ampm_buf)); memset(buf, 0x00, sizeof(buf)); timer = ecore_timer_add(60 - ts->tm_sec, (void *)indicator_clock_changed_cb, data); if (clock_mode == INDICATOR_CLOCK_MODE_12H) { char bf1[32] = { 0, }; int hour; if (ts->tm_hour >= 0 && ts->tm_hour < 12) snprintf(ampm_buf, sizeof(ampm_buf), LABEL_STRING, AMPM_FONT_SIZE, _("IDS_COM_POP_AM_M_ABB")); else snprintf(ampm_buf, sizeof(ampm_buf), LABEL_STRING, AMPM_FONT_SIZE, _("IDS_COM_POP_PM_M_ABB")); strftime(bf1, sizeof(bf1), "%l", ts); hour = atoi(bf1); strftime(bf1, sizeof(bf1), ":%M", ts); snprintf(time_str, sizeof(time_str), "%d%s", hour, bf1); // strftime(time_str, sizeof(time_str), "%I:%M", ts); } else { strftime(time_str, sizeof(time_str), "%H:%M", ts); } snprintf(time_buf, sizeof(time_buf), LABEL_STRING, TIME_FONT_SIZE, time_str); len = snprintf(buf, sizeof(buf), "%s%s", time_buf, ampm_buf); if (len < 0) { ERR("Unexpected ERROR!"); return; } INFO("[CLOCK MODULE] Timer Status : %d Time: %s", timer, buf); edje_object_part_text_set(elm_layout_edje_get(ad->layout_main), "elm.text.clock", buf); return; }
int e_syscon_show(E_Zone *zone, const char *defact) { Evas_Object *o, *o2; Evas_Coord mw, mh; int x, y, w, h, zx, zy, zw, zh; int iw, ih; Eina_List *l; double t; t = ecore_loop_time_get(); if (popup) { if ((t - show_time) > 0.5) { for (l = e_config->syscon.actions; l; l = l->next) { E_Config_Syscon_Action *sca; E_Action *a; if (!(sca = l->data)) continue; if (!sca->action) continue; a = e_action_find(sca->action); if (!a) continue; if (sca->is_main == 2) { a->func.go(NULL, sca->params); e_syscon_hide(); break; } } } return 0; } input_window = ecore_x_window_input_new(zone->container->win, zone->x, zone->y, zone->w, zone->h); ecore_x_window_show(input_window); if (!e_grabinput_get(input_window, 1, input_window)) { ecore_x_window_free(input_window); input_window = 0; return 0; } popup = e_popup_new(zone, 0, 0, 1, 1); if (!popup) { e_grabinput_release(input_window, input_window); ecore_x_window_free(input_window); input_window = 0; return 0; } evas_event_freeze(popup->evas); e_popup_layer_set(popup, E_LAYER_POPUP); handlers = eina_list_append (handlers, ecore_event_handler_add (ECORE_EVENT_KEY_DOWN, _cb_key_down, NULL)); handlers = eina_list_append (handlers, ecore_event_handler_add (ECORE_EVENT_MOUSE_BUTTON_DOWN, _cb_mouse_down, NULL)); handlers = eina_list_append (handlers, ecore_event_handler_add (ECORE_EVENT_MOUSE_BUTTON_UP, _cb_mouse_up, NULL)); handlers = eina_list_append (handlers, ecore_event_handler_add (ECORE_EVENT_MOUSE_MOVE, _cb_mouse_move, NULL)); handlers = eina_list_append (handlers, ecore_event_handler_add (ECORE_EVENT_MOUSE_WHEEL, _cb_mouse_wheel, NULL)); o = edje_object_add(popup->evas); o_bg = o; e_theme_edje_object_set(o, "base/theme/syscon", "e/widgets/syscon/main"); edje_object_part_text_set(o, "e.text.label", _("Cancel")); edje_object_signal_callback_add(o, "e,action,close", "", _cb_signal_close, NULL); edje_object_signal_callback_add(o, "e,action,syscon", "*", _cb_signal_syscon, NULL); act_count = 0; show_time = t; // main (default): // halt | suspend | desk_lock // secondary (default): // reboot | hibernate | logout // extra (example for illume): // home | close | kill o = e_flowlayout_add(popup->evas); o_flow_main = o; e_flowlayout_orientation_set(o, 1); e_flowlayout_flowdirection_set(o, 1, 1); e_flowlayout_homogenous_set(o, 1); o = e_flowlayout_add(popup->evas); o_flow_secondary = o; e_flowlayout_orientation_set(o, 1); e_flowlayout_flowdirection_set(o, 1, 1); e_flowlayout_homogenous_set(o, 1); o = e_flowlayout_add(popup->evas); o_flow_extra = o; e_flowlayout_orientation_set(o, 1); e_flowlayout_flowdirection_set(o, 1, 1); e_flowlayout_homogenous_set(o, 1); for (l = e_config->syscon.actions; l; l = l->next) { E_Config_Syscon_Action *sca; char buf[1024]; E_Action *a; int disabled; if (!(sca = l->data)) continue; if (!sca->action) continue; a = e_action_find(sca->action); if (!a) continue; disabled = 0; if ((!strcmp(sca->action, "logout")) && (!e_sys_action_possible_get(E_SYS_LOGOUT))) disabled = 1; else if ((!strcmp(sca->action, "halt")) && (!e_sys_action_possible_get(E_SYS_HALT))) disabled = 1; else if ((!strcmp(sca->action, "halt_now")) && (!e_sys_action_possible_get(E_SYS_HALT_NOW))) disabled = 1; else if ((!strcmp(sca->action, "reboot")) && (!e_sys_action_possible_get(E_SYS_REBOOT))) disabled = 1; else if ((!strcmp(sca->action, "suspend")) && (!e_sys_action_possible_get(E_SYS_SUSPEND))) disabled = 1; else if ((!strcmp(sca->action, "hibernate")) && (!e_sys_action_possible_get(E_SYS_HIBERNATE))) disabled = 1; o = edje_object_add(popup->evas); edje_object_signal_callback_add(o, "e,action,click", "", _cb_signal_action, sca); if (sca->button) { snprintf(buf, sizeof(buf), "e/widgets/syscon/item/%s", sca->button); e_theme_edje_object_set(o, "base/theme/widgets", buf); } else e_theme_edje_object_set(o, "base/theme/widgets", "e/widgets/syscon/item/button"); edje_object_part_text_set(o, "e.text.label", _(e_action_predef_label_get(sca->action, sca->params))); if (sca->icon) { o2 = e_icon_add(popup->evas); e_util_icon_theme_set(o2, sca->icon); edje_object_part_swallow(o, "e.swallow.icon", o2); evas_object_show(o2); if (disabled) edje_object_signal_emit(o2, "e,state,disabled", "e"); } if (disabled) edje_object_signal_emit(o, "e,state,disabled", "e"); if (sca->is_main) { e_flowlayout_pack_end(o_flow_main, o); iw = ih = e_config->syscon.main.icon_size * e_scale; } else { e_flowlayout_pack_end(o_flow_secondary, o); iw = ih = e_config->syscon.secondary.icon_size * e_scale; } edje_object_message_signal_process(o); edje_object_size_min_calc(o, &mw, &mh); if (mw > iw) iw = mw; if (mh > ih) ih = mh; e_flowlayout_pack_options_set(o, 1, 1, 0, 0, 0.5, 0.5, iw, ih, iw, ih); evas_object_show(o); } for (l = (Eina_List *)e_sys_con_extra_action_list_get(); l; l = l->next) { E_Sys_Con_Action *sca; char buf[1024]; sca = l->data; o = edje_object_add(popup->evas); edje_object_signal_callback_add(o, "e,action,click", "", _cb_signal_action_extra, sca); if (sca->button_name) { snprintf(buf, sizeof(buf), "e/widgets/syscon/item/%s", sca->button_name); e_theme_edje_object_set(o, "base/theme/widgets", buf); } else e_theme_edje_object_set(o, "base/theme/widgets", "e/widgets/syscon/item/button"); edje_object_part_text_set(o, "e.text.label", sca->label); if (sca->icon_group) { o2 = edje_object_add(popup->evas); e_util_edje_icon_set(o2, sca->icon_group); edje_object_part_swallow(o, "e.swallow.icon", o2); evas_object_show(o2); if (sca->disabled) edje_object_signal_emit(o2, "e,state,disabled", "e"); } if (sca->disabled) edje_object_signal_emit(o, "e,state,disabled", "e"); e_flowlayout_pack_end(o_flow_extra, o); iw = ih = e_config->syscon.extra.icon_size * e_scale; e_flowlayout_pack_options_set(o, 1, 1, 0, 0, 0.5, 0.5, iw, ih, iw, ih); evas_object_show(o); } e_flowlayout_fill_set(o_flow_main, 1); edje_object_part_swallow(o_bg, "e.swallow.main", o_flow_main); e_flowlayout_fill_set(o_flow_secondary, 1); edje_object_part_swallow(o_bg, "e.swallow.secondary", o_flow_secondary); e_flowlayout_fill_set(o_flow_extra, 1); edje_object_part_swallow(o_bg, "e.swallow.extra", o_flow_extra); e_zone_useful_geometry_get(zone, &zx, &zy, &zw, &zh); evas_object_resize(o_bg, zw, zh); edje_object_calc_force(o_bg); e_flowlayout_size_min_get(o_flow_main, &mw, &mh); edje_extern_object_min_size_set(o_flow_main, mw, mh); edje_object_part_swallow(o_bg, "e.swallow.main", o_flow_main); e_flowlayout_size_min_get(o_flow_secondary, &mw, &mh); edje_extern_object_min_size_set(o_flow_secondary, mw, mh); edje_object_part_swallow(o_bg, "e.swallow.secondary", o_flow_secondary); e_flowlayout_size_min_get(o_flow_extra, &mw, &mh); edje_extern_object_min_size_set(o_flow_extra, mw, mh); edje_object_part_swallow(o_bg, "e.swallow.extra", o_flow_extra); edje_object_size_min_calc(o_bg, &mw, &mh); w = mw; if (w > zw) w = zw; x = zx - zone->x + (zw - w) / 2; h = mh; if (h > zh) h = zh; y = zy - zone->y + (zh - h) / 2; e_popup_move_resize(popup, x, y, w, h); evas_object_move(o_bg, 0, 0); evas_object_resize(o_bg, w, h); evas_object_show(o_bg); e_popup_edje_bg_object_set(popup, o_bg); if (e_config->syscon.do_input) { deftimer = ecore_timer_add(e_config->syscon.timeout, _cb_timeout_defaction, NULL); if (defact) do_defact = eina_stringshare_add(defact); } evas_event_thaw(popup->evas); inevas = 0; e_popup_show(popup); return 1; }
static void _opinfo_op_registry_listener(void *data, const E_Fm2_Op_Registry_Entry *ere) { Evas_Object *o = data; char *total, buf[4096]; Edje_Message_Float msg; int mw, mh; if (!o || !ere) return; // Don't show if the operation keep less than 1 second if (!ere->needs_attention && (ere->start_time + 1.0 > ecore_loop_time_get())) return; // Update icon switch (ere->op) { case E_FM_OP_COPY: edje_object_signal_emit(o, "e,action,icon,copy", "e"); break; case E_FM_OP_MOVE: edje_object_signal_emit(o, "e,action,icon,move", "e"); break; case E_FM_OP_REMOVE: edje_object_signal_emit(o, "e,action,icon,delete", "e"); break; case E_FM_OP_SECURE_REMOVE: edje_object_signal_emit(o, "e,action,icon,secure_delete", "e"); break; default: edje_object_signal_emit(o, "e,action,icon,unknown", "e"); } // Update information text switch (ere->status) { case E_FM2_OP_STATUS_ABORTED: switch (ere->op) { case E_FM_OP_COPY: snprintf(buf, sizeof(buf), _("Copying is aborted")); break; case E_FM_OP_MOVE: snprintf(buf, sizeof(buf), _("Moving is aborted")); break; case E_FM_OP_REMOVE: snprintf(buf, sizeof(buf), _("Deleting is aborted")); break; case E_FM_OP_SECURE_REMOVE: snprintf(buf, sizeof(buf), _("Secure deletion is aborted")); break; default: snprintf(buf, sizeof(buf), _("Unknown operation from slave is aborted")); } break; default: total = e_util_size_string_get(ere->total); switch (ere->op) { case E_FM_OP_COPY: if (ere->finished) snprintf(buf, sizeof(buf), _("Copy of %s done"), total); else snprintf(buf, sizeof(buf), _("Copying %s (eta: %s)"), total, e_util_time_str_get(ere->eta)); break; case E_FM_OP_MOVE: if (ere->finished) snprintf(buf, sizeof(buf), _("Move of %s done"), total); else snprintf(buf, sizeof(buf), _("Moving %s (eta: %s)"), total, e_util_time_str_get(ere->eta)); break; case E_FM_OP_REMOVE: if (ere->finished) snprintf(buf, sizeof(buf), _("Delete done")); else snprintf(buf, sizeof(buf), _("Deleting files...")); break; case E_FM_OP_SECURE_REMOVE: if (ere->finished) snprintf(buf, sizeof(buf), _("Secure delete done")); else snprintf(buf, sizeof(buf), _("Securely deleting files...")); break; default: snprintf(buf, sizeof(buf), _("Unknown operation from slave %d"), ere->id); } E_FREE(total); } edje_object_part_text_set(o, "e.text.info", buf); // Update spinner wheel if ((ere->finished) || (ere->status == E_FM2_OP_STATUS_ABORTED)) { if (!evas_object_data_get(o, "stopped")) { evas_object_data_set(o, "stopped", o); edje_object_signal_emit(o, "e,state,busy,stop", "e"); } } if (ere->percent > 0) { if (!evas_object_data_get(o, "started")) { evas_object_data_set(o, "started", o); edje_object_signal_emit(o, "e,state,busy,start", "e"); } } // Show/hide the red attention led if (ere->needs_attention) { if (!evas_object_data_get(o, "attention_started")) { evas_object_data_set(o, "attention_started", o); edje_object_signal_emit(o, "e,state,attention,start", "e"); if (evas_object_data_get(o, "attention_stopped")) evas_object_data_del(o, "attention_stopped"); } } else { if (!evas_object_data_get(o, "attention_stopped")) { evas_object_data_set(o, "attention_stopped", o); edje_object_signal_emit(o, "e,state,attention,stop", "e"); if (evas_object_data_get(o, "attention_started")) evas_object_data_del(o, "attention_started"); } } // Update gauge edje_object_part_drag_size_set(o, "e.gauge.bar", ((double)(ere->percent)) / 100.0, 1.0); msg.val = ((double)(ere->percent)) / 100.0; edje_object_message_send(o, EDJE_MESSAGE_FLOAT, 1, &msg); // resize element to fit the box edje_object_size_min_calc(o, &mw, &mh); e_box_pack_options_set(o, 1, 0, 1, 0, 0.0, 0.0, mw, mh, 9999, mh); evas_object_show(o); }
/** * Creates a check box widget with icon * * @param evas pointer * @param label the text to asign to check widget * @param icon the path to the icon file * @param icon_w the minimum wdith of the icon * @param icon_h the minumum height of the icon * @param val pointer to int where changes are stored * @return the newly created evas object */ EAPI Evas_Object * e_widget_check_icon_add(Evas *evas, const char *label, const char *icon, int icon_w, int icon_h, int *val) { Evas_Object *obj, *o, *o2; E_Widget_Data *wd; Evas_Coord mw, mh; obj = e_widget_add(evas); e_widget_del_hook_set(obj, _e_wid_del_hook); e_widget_focus_hook_set(obj, _e_wid_focus_hook); e_widget_activate_hook_set(obj, _e_wid_activate_hook); e_widget_disable_hook_set(obj, _e_wid_disable_hook); wd = calloc(1, sizeof(E_Widget_Data)); wd->valptr = val; e_widget_data_set(obj, wd); o = edje_object_add(evas); wd->o_check = o; e_theme_edje_object_set(o, "base/theme/widgets", "e/widgets/check_icon"); edje_object_signal_callback_add(o, "e,action,toggle", "*", _e_wid_signal_cb1, obj); edje_object_part_text_set(o, "e.text.label", label); evas_object_show(o); if (label) { edje_object_signal_emit(o, "e,state,labeled", "e"); edje_object_message_signal_process(o); } if (icon) { if (icon[0] == '/') { o2 = e_icon_add(evas); e_icon_file_set(o2, icon); } else { o2 = edje_object_add(evas); e_util_edje_icon_set(o2, icon); } evas_object_size_hint_min_set(o2, icon_w, icon_h); edje_object_part_swallow(wd->o_check, "e.swallow.icon", o2); evas_object_show(o2); e_widget_sub_object_add(obj, o2); wd->o_icon = o2; } edje_object_size_min_calc(o, &mw, &mh); e_widget_size_min_set(obj, mw, mh); if (wd->valptr) { if (*(wd->valptr)) edje_object_signal_emit(o, "e,state,checked", "e"); } e_widget_sub_object_add(obj, o); evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_wid_focus_steal, obj); e_widget_resize_object_set(obj, o); return obj; }
EAPI void ede_gui_debug_text_set(const char *text) { edje_object_part_text_set(o_layout, "debug.panel.text", text); }
void create_pager(Evas_Object *parent, Evas_Object *pg, Pginfo *info, Measurements_Lists *ml) { Evas_Object *ed, *converters_list, *layout; pg = elm_naviframe_add(parent); elm_win_resize_object_add(parent, pg); evas_object_size_hint_weight_set(pg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(pg, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(pg); info->pager = pg; /*main page*/ layout = elm_layout_add(parent); if (!elm_layout_file_set(layout, PACKAGE_DATA_DIR "/default.edj", "main")) { DBG("Can't load Edje Layout %s", PACKAGE_DATA_DIR "/default.edj"); return; } evas_object_show(layout); elm_naviframe_item_simple_push(pg, layout); info->pg1 = layout; converters_list = elm_list_add(parent); elm_object_part_content_set(layout, "converters_list", converters_list); evas_object_size_hint_weight_set(converters_list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_fill_set(converters_list, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(converters_list); populate_converters_list(converters_list, info); /* distance conerter*/ layout = elm_layout_add(parent); if (!elm_layout_file_set(layout, PACKAGE_DATA_DIR "/default.edj", "distance_converter")) { DBG("Can't load Edje Layout %s", PACKAGE_DATA_DIR "/default.edj"); return; } evas_object_show(layout); ed = elm_layout_edje_get(layout); edje_object_part_text_set(ed, "equal", ""); edje_object_part_text_set(ed, "input", ""); edje_object_part_text_set(ed, "output", ""); ml->list_in = elm_list_add(parent); elm_object_part_content_set(layout, "measurements_in", ml->list_in); evas_object_size_hint_weight_set(ml->list_in, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_fill_set(ml->list_in, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(ml->list_in); populate_measurements_list_in(ml->list_in, ed, info); ml->list_out = elm_list_add(parent); elm_object_part_content_set(layout, "measurements_out", ml->list_out); evas_object_size_hint_weight_set(ml->list_out, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_fill_set(ml->list_out, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(ml->list_out); populate_measurements_list_out(ml->list_out, ed, info); /* Set callback functions */ edje_object_signal_callback_add(ed, "mouse,clicked,1", "bt_1", on_number_button_clicked, "1"); edje_object_signal_callback_add(ed, "mouse,clicked,1", "bt_2", on_number_button_clicked, "2"); edje_object_signal_callback_add(ed, "mouse,clicked,1", "bt_3", on_number_button_clicked, "3"); edje_object_signal_callback_add(ed, "mouse,clicked,1", "bt_4", on_number_button_clicked, "4"); edje_object_signal_callback_add(ed, "mouse,clicked,1", "bt_5", on_number_button_clicked, "5"); edje_object_signal_callback_add(ed, "mouse,clicked,1", "bt_6", on_number_button_clicked, "6"); edje_object_signal_callback_add(ed, "mouse,clicked,1", "bt_7", on_number_button_clicked, "7"); edje_object_signal_callback_add(ed, "mouse,clicked,1", "bt_8", on_number_button_clicked, "8"); edje_object_signal_callback_add(ed, "mouse,clicked,1", "bt_9", on_number_button_clicked, "9"); edje_object_signal_callback_add(ed, "mouse,clicked,1", "bt_0", on_number_button_clicked, "0"); edje_object_signal_callback_add(ed, "mouse,clicked,1", "bt_clear", on_number_button_clear, ml); edje_object_signal_callback_add(ed, "mouse,clicked,1", "bt_enter", on_number_button_enter, ml); edje_object_signal_callback_add(ed, "mouse,clicked,1", "back", back_page_1, info); elm_naviframe_item_simple_push(pg, layout); info->pg2 = layout; elm_naviframe_item_simple_promote(info->pager, info->pg1); }