static Forecasts * _forecasts_new(Evas *evas) { Forecasts *w; char buf[4096]; w = E_NEW(Forecasts, 1); w->forecasts_obj = edje_object_add(evas); snprintf(buf, sizeof(buf), "%s/forecasts.edj", e_module_dir_get(forecasts_config->module)); if (!e_theme_edje_object_set(w->forecasts_obj, "base/theme/modules/forecasts", "modules/forecasts/main")) edje_object_file_set(w->forecasts_obj, buf, "modules/forecasts/main"); evas_object_show(w->forecasts_obj); w->icon_obj = edje_object_add(evas); if (!e_theme_edje_object_set(w->icon_obj, "base/theme/modules/forecasts/icons", "modules/forecasts/icons/3200")) edje_object_file_set(w->icon_obj, buf, "modules/forecasts/icons/3200"); edje_object_part_swallow(w->forecasts_obj, "icon", w->icon_obj); return w; }
static E_Gadcon_Client * _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) { Instance *inst; E_Gadcon_Client *gcc; char buf[PATH_MAX]; snprintf(buf, sizeof(buf), "%s/exalt.edj", e_module_dir_get(exalt_config->module)); inst = E_NEW(Instance, 1); inst->o_button = edje_object_add(gc->evas); if (!e_theme_edje_object_set(inst->o_button, "base/theme/modules/exalt", "modules/exalt/main")) edje_object_file_set(inst->o_button, buf, "e/modules/exalt/main"); gcc = e_gadcon_client_new(gc, name, id, style, inst->o_button); gcc->data = inst; inst->gcc = gcc; evas_object_event_callback_add(inst->o_button, EVAS_CALLBACK_MOUSE_DOWN, _cb_mouse_down, inst); exalt_config->instances = evas_list_append(exalt_config->instances, inst); exalt_dbus_notify_set( exalt_config->conn, _exalt_notify_cb, inst); return gcc; }
static void _forecasts_display_set(Instance *inst, int ok) { char buf[4096]; char m[4096]; if (!inst) return; snprintf(m, sizeof(m), "%s/forecasts.edj", e_module_dir_get(forecasts_config->module)); snprintf(buf, sizeof(buf), "modules/forecasts/icons/%d", inst->condition.code); if (!e_theme_edje_object_set(inst->forecasts->icon_obj, "base/theme/modules/forecasts/icons", buf)) edje_object_file_set(inst->forecasts->icon_obj, m, buf); edje_object_part_swallow(inst->forecasts->forecasts_obj, "icon", inst->forecasts->icon_obj); if (!inst->ci->show_text) edje_object_signal_emit(inst->forecasts_obj, "e,state,description,hide", "e"); else edje_object_signal_emit(inst->forecasts_obj, "e,state,description,show", "e"); snprintf(buf, sizeof(buf), "%d°%c", inst->condition.temp, inst->units.temp); edje_object_part_text_set(inst->forecasts->forecasts_obj, "e.text.temp", buf); edje_object_part_text_set(inst->forecasts->forecasts_obj, "e.text.description", inst->condition.desc); edje_object_part_text_set(inst->forecasts->forecasts_obj, "e.text.location", inst->location); if (inst->gcc->gadcon->orient == E_GADCON_ORIENT_FLOAT) _right_values_update(inst); //Updating right two icons description if (inst->popup) _forecasts_popup_destroy(inst); inst->popup = NULL; }
/* externally accessible functions */ EAPI Evas_Object * e_widget_label_add(Evas *evas, const char *label) { Evas_Object *obj, *o; Evas_Coord mw, mh; E_Widget_Data *wd; obj = e_widget_add(evas); e_widget_del_hook_set(obj, _e_wid_del_hook); e_widget_disable_hook_set(obj, _e_wid_disable_hook); wd = calloc(1, sizeof(E_Widget_Data)); e_widget_data_set(obj, wd); o = edje_object_add(evas); e_theme_edje_object_set(o, "base/theme/widgets", "e/widgets/label"); wd->text = o; edje_object_part_text_set(o, "e.text.label", label); evas_object_show(o); edje_object_size_min_calc(o, &mw, &mh); e_widget_can_focus_set(obj, 0); e_widget_size_min_set(obj, mw, mh); e_widget_sub_object_add(obj, o); e_widget_resize_object_set(obj, o); return obj; }
static E_Gadcon_Client * _gc_init (E_Gadcon * gc, const char *name, const char *id, const char *style) { Evas_Object *o; E_Gadcon_Client *gcc; Evas *evas; Instance *inst; char buf[4096]; inst = E_NEW (Instance, 1); inst->ci = _empris_config_item_get (id); if (!inst->ci->id) inst->ci->id = eina_stringshare_add (id); o = edje_object_add (gc->evas); snprintf (buf, sizeof (buf), "%s/empris.edj", e_module_dir_get (empris_config->module)); if (!e_theme_edje_object_set (o, "base/theme/modules/empris", "modules/empris/main")) edje_object_file_set (o, buf, "modules/empris/main"); evas_object_show (o); gcc = e_gadcon_client_new (gc, name, id, style, o); gcc->data = inst; inst->gcc = gcc; inst->empris = o; _empris_popup_create(inst, buf); evas_object_event_callback_add (o, EVAS_CALLBACK_MOUSE_DOWN, _empris_cb_mouse_down, inst); evas_object_event_callback_add (inst->empris, EVAS_CALLBACK_MOUSE_IN, _empris_cb_mouse_in, inst); evas_object_event_callback_add (inst->empris, EVAS_CALLBACK_MOUSE_OUT, _empris_cb_mouse_out, inst); edje_object_signal_callback_add (o, "empris,play", "", _empris_cb_play, inst); edje_object_signal_callback_add (o, "empris,stop", "", _empris_cb_stop, inst); edje_object_signal_callback_add (o, "empris,pause", "", _empris_cb_pause, inst); edje_object_signal_callback_add (o, "empris,next", "", _empris_cb_next, inst); edje_object_signal_callback_add (o, "empris,previous", "", _empris_cb_previous, inst); inst->cb_player_track_change = e_dbus_signal_handler_add (conn, bus_name, "/Player", mpris_interface, "TrackChange", _dbus_cb_track_change, inst); inst->cb_player_status_change = e_dbus_signal_handler_add (conn, bus_name, "/Player", mpris_interface, "StatusChange", _dbus_cb_status_change, inst); _dbus_send_msg("/TrackList", "GetCurrentTrack", _dbus_cb_current_track, inst); empris_config->instances = eina_list_append (empris_config->instances, inst); return gcc; }
/* Gadcon Api Functions */ static E_Gadcon_Client * _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) { E_Music_Control_Instance *inst; E_Music_Control_Module_Context *ctxt; EINA_SAFETY_ON_NULL_RETURN_VAL(music_control_mod, NULL); ctxt = music_control_mod->data; inst = calloc(1, sizeof(E_Music_Control_Instance)); inst->ctxt = ctxt; inst->gadget = edje_object_add(gc->evas); e_theme_edje_object_set(inst->gadget, "base/theme/modules/music-control", "modules/music-control/main"); inst->gcc = e_gadcon_client_new(gc, name, id, style, inst->gadget); inst->gcc->data = inst; evas_object_event_callback_add(inst->gadget, EVAS_CALLBACK_MOUSE_DOWN, music_control_mouse_down_cb, inst); ctxt->instances = eina_list_append(ctxt->instances, inst); _actions_register(ctxt); return inst->gcc; }
/* externally accessible functions */ EAPI Evas_Object * e_widget_frametable_add(Evas *evas, const char *label, int homogenous) { 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_disable_hook_set(obj, _e_wid_disable_hook); wd = calloc(1, sizeof(E_Widget_Data)); e_widget_data_set(obj, wd); o = edje_object_add(evas); wd->o_frame = o; e_theme_edje_object_set(o, "base/theme/widgets", "e/widgets/frame"); edje_object_part_text_set(o, "e.text.label", label); evas_object_show(o); e_widget_sub_object_add(obj, o); e_widget_resize_object_set(obj, o); o = e_table_add(evas); wd->o_table = o; e_table_homogenous_set(o, homogenous); edje_object_part_swallow(wd->o_frame, "e.swallow.content", o); e_widget_sub_object_add(obj, o); evas_object_show(o); edje_object_size_min_calc(wd->o_frame, &mw, &mh); e_widget_size_min_set(obj, mw, mh); return obj; }
EAPI E_Gadcon_Popup * e_gadcon_popup_new(E_Gadcon_Client *gcc) { E_Gadcon_Popup *pop; Evas_Object *o; E_Zone *zone; pop = E_OBJECT_ALLOC(E_Gadcon_Popup, E_GADCON_POPUP_TYPE, _e_gadcon_popup_free); if (!pop) return NULL; zone = e_gadcon_client_zone_get(gcc); pop->win = e_popup_new(zone, 0, 0, 0, 0); e_popup_layer_set(pop->win, 350); o = edje_object_add(pop->win->evas); e_theme_edje_object_set(o, "base/theme/gadman", "e/gadman/popup"); evas_object_show(o); evas_object_move(o, 0, 0); e_popup_edje_bg_object_set(pop->win, o); pop->o_bg = o; pop->gcc = gcc; pop->gadcon_lock = 1; pop->gadcon_was_locked = 0; return pop; }
static E_Gadcon_Client * _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) { Evas_Object *o; E_Gadcon_Client *gcc; Instance *inst; inst = E_NEW(Instance, 1); o = edje_object_add(gc->evas); if (alarm_config->theme) { char buf[4096]; snprintf(buf, sizeof(buf), "%s/alarm.edj", e_module_dir_get(alarm_config->module)); edje_object_file_set(o, buf, THEME_MAIN); } else e_theme_edje_object_set(o, THEME_IN_E, THEME_MAIN); edje_object_signal_callback_add(o, EDJE_SIG_RECV_ALARM_STATE_ON, _cb_edje_alarm_state_on, NULL); edje_object_signal_callback_add(o, EDJE_SIG_RECV_ALARM_STATE_OFF, _cb_edje_alarm_state_off, NULL); edje_object_signal_callback_add(o, EDJE_SIG_RECV_ALARM_RING_STOP, _cb_edje_alarm_ring_stop, NULL); gcc = e_gadcon_client_new(gc, name, id, style, o); gcc->data = inst; inst->gcc = gcc; inst->obj = o; inst->orient = E_GADCON_ORIENT_HORIZ; evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _button_cb_mouse_down, inst); alarm_config->instances = eina_list_append(alarm_config->instances, inst); alarm_details_change(); switch (alarm_config->alarms_state) { case ALARM_STATE_ON: edje_object_signal_emit(o, EDJE_SIG_SEND_ALARM_STATE_ON); break; case ALARM_STATE_OFF: edje_object_signal_emit(o, EDJE_SIG_SEND_ALARM_STATE_OFF); break; case ALARM_STATE_RINGING: edje_object_signal_emit(o, EDJE_SIG_SEND_ALARM_RING_START); break; } e_config_save_queue(); return gcc; }
/** * Sets the theme group to be used by the editable object. * This function has to be called, or the cursor and the selection won't be * visible. * * @param editable an editable object * @param category the theme category to use for the editable object * @param group the theme group to use for the editable object */ EAPI void e_editable_theme_set(Evas_Object *editable, const char *category, const char *group) { E_Editable_Smart_Data *sd; char *obj_group; const char *data; if (evas_object_smart_smart_get(editable) != _e_editable_smart) SMARTERRNR(); if ((!editable) || (!(sd = evas_object_smart_data_get(editable)))) return; if ((!category) || (!group)) return; obj_group = alloca(strlen(group) + strlen("/selection") + 1); /* Gets the theme for the text object */ sprintf(obj_group, "%s/text", group); e_theme_edje_object_set(sd->text_object, category, obj_group); sd->average_char_w = -1; sd->average_char_h = -1; /* Gets the theme for the cursor */ sprintf(obj_group, "%s/cursor", group); e_theme_edje_object_set(sd->cursor_object, category, obj_group); edje_object_size_min_get(sd->cursor_object, &sd->cursor_width, NULL); if (sd->cursor_width < 1) sd->cursor_width = 1; /* Gets the theme for the selection */ sprintf(obj_group, "%s/selection", group); e_theme_edje_object_set(sd->selection_object, category, obj_group); data = edje_object_data_get(sd->selection_object, "on_foreground"); if ((data) && (strcmp(data, "1") == 0)) { sd->selection_on_fg = 1; evas_object_stack_above(sd->selection_object, sd->text_object); } else { sd->selection_on_fg = 0; evas_object_stack_below(sd->selection_object, sd->text_object); } _e_editable_text_update(editable); _e_editable_cursor_update(editable); }
Evas_Object * e_widget_spectrum_add(Evas *evas, E_Color_Component mode, E_Color *cv) { 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_disable_hook_set(obj, _e_wid_disable_hook); wd = calloc(1, sizeof(E_Widget_Data)); e_widget_data_set(obj, wd); wd->cv = cv; wd->mode = mode; o = edje_object_add(evas); wd->o_edje = o; e_theme_edje_object_set(o, "base/theme/widgets", "e/widgets/spectrum"); evas_object_show(o); edje_object_size_min_calc(o, &mw, &mh); e_widget_size_min_set(obj, mw, mh); 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); evas_object_intercept_resize_callback_add(o, _e_wid_resize, wd); evas_object_intercept_move_callback_add(o, _e_wid_move, wd); o = e_spectrum_add(evas); e_spectrum_color_value_set(o, cv); e_spectrum_mode_set(o, mode); e_widget_sub_object_add(obj, o); evas_object_show(o); wd->o_spectrum = o; edje_object_part_swallow(wd->o_edje, "e.swallow.content", o); o = evas_object_rectangle_add(evas); evas_object_repeat_events_set(o, EINA_TRUE); evas_object_color_set(o, 0, 0, 0, 0); e_widget_sub_object_add(obj, o); evas_object_show(o); evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_wid_cb_down, obj); evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, _e_wid_cb_move, obj); evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, _e_wid_cb_up, obj); wd->o_event = o; e_widget_spectrum_update(obj, 0); return obj; }
static E_Gadcon_Client * _gc_init (E_Gadcon * gc, const char *name, const char *id, const char *style) { Evas_Object *o; E_Gadcon_Client *gcc; Evas *evas; Instance *inst; char buf[4096]; inst = E_NEW (Instance, 1); inst->ci = _mpdule_config_item_get (id); if (!inst->ci->id) inst->ci->id = eina_stringshare_add (id); o = edje_object_add (gc->evas); snprintf (buf, sizeof (buf), "%s/mpdule.edj", e_module_dir_get (mpdule_config->module)); if (!e_theme_edje_object_set (o, "base/theme/modules/mpdule", "modules/mpdule/main")) edje_object_file_set (o, buf, "modules/mpdule/main"); evas_object_show (o); gcc = e_gadcon_client_new (gc, name, id, style, o); gcc->data = inst; inst->gcc = gcc; inst->mpdule = o; _mpdule_popup_create(inst, buf); evas_object_event_callback_add (o, EVAS_CALLBACK_MOUSE_DOWN, _mpdule_cb_mouse_down, inst); evas_object_event_callback_add (inst->mpdule, EVAS_CALLBACK_MOUSE_IN, _mpdule_cb_mouse_in, inst); evas_object_event_callback_add (inst->mpdule, EVAS_CALLBACK_MOUSE_OUT, _mpdule_cb_mouse_out, inst); edje_object_signal_callback_add (o, "mpdule,play", "", _mpdule_cb_play, inst); edje_object_signal_callback_add (o, "mpdule,stop", "", _mpdule_cb_stop, inst); edje_object_signal_callback_add (o, "mpdule,pause", "", _mpdule_cb_pause, inst); edje_object_signal_callback_add (o, "mpdule,next", "", _mpdule_cb_next, inst); edje_object_signal_callback_add (o, "mpdule,previous", "", _mpdule_cb_previous, inst); _mpdule_connect (inst); _mpdule_update_song (inst); inst->update_timer = ecore_timer_add (inst->ci->poll_time, _mpdule_update_song_cb, inst); mpdule_config->instances = eina_list_append (mpdule_config->instances, inst); return gcc; }
/* externally accessible functions */ EAPI Evas_Object * e_widget_button_add(Evas *evas, const char *label, const char *icon, void (*func) (void *data, void *data2), void *data, void *data2) { 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->func = func; wd->data = data; wd->data2 = data2; e_widget_data_set(obj, wd); o = edje_object_add(evas); wd->o_button = o; e_theme_edje_object_set(o, "base/theme/widgets", "e/widgets/button"); edje_object_signal_callback_add(o, "e,action,click", "", _e_wid_signal_cb1, obj); if ((label) && (label[0] != 0)) { edje_object_part_text_set(o, "e.text.label", label); wd->type |= E_WIDGET_BUTTON_TEXT; } 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); evas_object_show(o); if (icon) { o = e_icon_add(evas); wd->o_icon = o; e_util_icon_theme_set(o, icon); edje_object_part_swallow(wd->o_button, "e.swallow.icon", o); e_widget_sub_object_add(obj, o); evas_object_show(o); wd->type |= E_WIDGET_BUTTON_ICON; } _e_wid_button_state_send(wd); edje_object_size_min_calc(wd->o_button, &mw, &mh); e_widget_size_min_set(obj, mw, mh); return obj; }
EAPI void e_obj_dialog_obj_theme_set(E_Obj_Dialog *od, char *theme_cat, char *theme_obj) { E_OBJECT_CHECK(od); E_OBJECT_TYPE_CHECK(od, E_OBJ_DIALOG_TYPE); e_theme_edje_object_set(od->bg_object, theme_cat, theme_obj); evas_object_move(od->bg_object, 0, 0); evas_object_show(od->bg_object); edje_object_signal_callback_add(od->bg_object, "e,action,close", "", _e_obj_dialog_cb_close, od); }
static E_Gadcon_Client * _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) { Evas_Object *o; E_Gadcon_Client *gcc; Config_Face *inst; inst = eina_hash_find(temperature_config->faces, id); if (!inst) { inst = E_NEW(Config_Face, 1); inst->id = eina_stringshare_add(id); inst->poll_interval = 128; inst->low = 30; inst->high = 80; inst->sensor_type = SENSOR_TYPE_NONE; inst->sensor_name = NULL; inst->temp = -900; inst->units = CELSIUS; #ifdef HAVE_EEZE inst->backend = UDEV; #endif if (!temperature_config->faces) temperature_config->faces = eina_hash_string_superfast_new(NULL); eina_hash_direct_add(temperature_config->faces, inst->id, inst); } if (!inst->id) inst->id = eina_stringshare_add(id); E_CONFIG_LIMIT(inst->poll_interval, 1, 1024); E_CONFIG_LIMIT(inst->low, 0, 100); E_CONFIG_LIMIT(inst->high, 0, 220); E_CONFIG_LIMIT(inst->units, CELSIUS, FAHRENHEIT); #ifdef HAVE_EEZE E_CONFIG_LIMIT(inst->backend, TEMPGET, UDEV); #endif o = edje_object_add(gc->evas); e_theme_edje_object_set(o, "base/theme/modules/temperature", "e/modules/temperature/main"); gcc = e_gadcon_client_new(gc, name, id, style, o); gcc->data = inst; inst->gcc = gcc; inst->o_temp = o; inst->module = temperature_config->module; inst->have_temp = EINA_FALSE; temperature_face_update_config(inst); evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _temperature_face_cb_mouse_down, inst); return gcc; }
static Evas_Object * _forecasts_popup_icon_create(Evas *evas, int code) { char buf[4096]; char m[4096]; Evas_Object *o; snprintf(m, sizeof(m), "%s/forecasts.edj", e_module_dir_get(forecasts_config->module)); o = edje_object_add(evas); snprintf(buf, sizeof(buf), "modules/forecasts/icons/%d", code); if (!e_theme_edje_object_set(o, "base/theme/modules/forecasts/icons", buf)) edje_object_file_set(o, m, buf); return o; }
static void _empris_popup_create (Instance * inst, const char *dir) { Evas *evas; Evas_Object *o_popup; char buf[4096]; if (inst->ci->show_popup) { inst->popup = e_gadcon_popup_new (inst->gcc); evas = inst->popup->win->evas; o_popup = edje_object_add (evas); if (!e_theme_edje_object_set (o_popup, "base/theme/modules/empris", "modules/empris/popup")) { if (dir) { edje_object_file_set (o_popup, dir, "modules/empris/popup"); } else { snprintf(buf, sizeof(buf), "%s/empris.edj", e_module_dir_get(empris_config->module)); edje_object_file_set(o_popup, buf, "modules/empris/popup"); } } evas_object_show (o_popup); e_gadcon_popup_content_set (inst->popup, o_popup); edje_object_size_min_calc (o_popup, NULL, NULL); inst->o_popup = o_popup; edje_object_signal_callback_add (o_popup, "empris,play", "", _empris_cb_play, inst); edje_object_signal_callback_add (o_popup, "empris,stop", "", _empris_cb_stop, inst); edje_object_signal_callback_add (o_popup, "empris,pause", "", _empris_cb_pause, inst); edje_object_signal_callback_add (o_popup, "empris,next", "", _empris_cb_next, inst); edje_object_signal_callback_add (o_popup, "empris,previous", "", _empris_cb_previous, inst); } else { inst->popup = NULL; inst->o_popup = NULL; } }
/** * Module specific face initialisation. * * It is called when a new face is created. * Currently E_Gadget creates one when you call e_gadget_new(), * but doesn't let you create more faces. I'm hoping to get * changed. * * @param data the pointer you passed to e_gadget_new(). * @param face a pointer to your E_Gadget_Face. * @ingroup Emu_Module_Gadget_Group */ static E_Gadcon_Client * _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) { E_Gadcon_Client *gcc = NULL; Emu_Face *emu_face; emu_face = E_NEW(Emu_Face, 1); if (emu_face) { Evas_Object *o; char buf[4096]; o = edje_object_add(gc->evas); if ((!e_theme_edje_object_set(o, "base/theme/modules/emu", "modules/emu/main")) /*&& (_emu_module_edje)*/) edje_object_file_set(o, _emu_module_edje, "modules/emu/main"); edje_object_signal_emit(o, "passive", ""); gcc = e_gadcon_client_new(gc, name, id, style, o); gcc->data = emu_face; emu_face->gcc = gcc; emu_face->o_button = o; emu_face->menus = NULL; emu_face->name = eina_stringshare_add("Emu tester"); snprintf(buf, sizeof(buf), "%s/bin/emu_client", e_module_dir_get(emu_module)); emu_face->command = eina_stringshare_add(buf); if (emu_face->command) { emu_face->del = ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _emu_cb_exe_del, emu_face); emu_face->add = ecore_event_handler_add(ECORE_EXE_EVENT_ADD, _emu_cb_exe_add, emu_face); emu_face->read = ecore_event_handler_add(ECORE_EXE_EVENT_DATA, _emu_cb_exe_data, emu_face); emu_face->exe = ecore_exe_pipe_run(emu_face->command, ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_WRITE | ECORE_EXE_PIPE_READ_LINE_BUFFERED /*| ECORE_EXE_RESPAWN */ , emu_face); if (!emu_face->exe) e_module_dialog_show(NULL, D_("Enlightenment Emu Module - error"), D_("There is no emu.")); } e_gadcon_client_util_menu_attach(gcc); evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _emu_face_cb_mouse_down, emu_face); } return gcc; }
static Uptime * _ut_new (Evas * evas) { Uptime *ut; char buf[PATH_MAX]; ut = E_NEW (Uptime, 1); snprintf (buf, sizeof (buf), "%s/uptime.edj", e_module_dir_get (ut_config->module)); ut->ut_obj = edje_object_add (evas); if (!e_theme_edje_object_set (ut->ut_obj, "base/theme/modules/uptime", "modules/uptime/main")) edje_object_file_set (ut->ut_obj, buf, "modules/uptime/main"); evas_object_show (ut->ut_obj); return ut; }
static Wlan * _wlan_new (Evas * evas) { Wlan *wlan; char buf[PATH_MAX]; wlan = E_NEW (Wlan, 1); wlan->wlan_obj = edje_object_add (evas); snprintf (buf, sizeof (buf), "%s/wlan.edj", e_module_dir_get (wlan_config->module)); if (!e_theme_edje_object_set (wlan->wlan_obj, "base/theme/modules/wlan", "modules/wlan/main")) edje_object_file_set (wlan->wlan_obj, buf, "modules/wlan/main"); evas_object_show (wlan->wlan_obj); return wlan; }
static Mail * _mail_new (Evas * evas) { Mail *mail; char buf[4096]; mail = E_NEW (Mail, 1); mail->mail_obj = edje_object_add (evas); snprintf (buf, sizeof (buf), "%s/mail.edj", e_module_dir_get (mail_config->module)); if (!e_theme_edje_object_set (mail->mail_obj, "base/theme/modules/mail", "modules/mail/main")) edje_object_file_set (mail->mail_obj, buf, "modules/mail/main"); evas_object_show (mail->mail_obj); return mail; }
/* 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); }
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 E_Gadcon_Client * _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) { Evas_Object *o; E_Gadcon_Client *gcc; Instance *inst; battery_config->full = -2; battery_config->time_left = -2; battery_config->time_full = -2; battery_config->have_battery = -2; battery_config->have_power = -2; inst = E_NEW(Instance, 1); o = edje_object_add(gc->evas); e_theme_edje_object_set(o, "base/theme/modules/battery", "e/modules/battery/main"); gcc = e_gadcon_client_new(gc, name, id, style, o); gcc->data = inst; inst->gcc = gcc; inst->o_battery = o; inst->warning = NULL; inst->popup_battery = NULL; #ifdef HAVE_EEZE eeze_init(); #elif !defined __OpenBSD__ e_dbus_init(); e_hal_init(); #endif evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _button_cb_mouse_down, inst); battery_config->instances = eina_list_append(battery_config->instances, inst); _battery_config_updated(); return gcc; }
/* internal calls */ static Evas_Object * _theme_obj_new(Evas *e, const char *custom_dir, const char *group) { Evas_Object *o; o = edje_object_add(e); if (!e_theme_edje_object_set(o, "base/theme/modules/illume", group)) { if (custom_dir) { char buf[PATH_MAX]; snprintf(buf, sizeof(buf), "%s/illume.edj", custom_dir); if (edje_object_file_set(o, buf, group)) { printf("OK FALLBACK %s\n", buf); } } } return o; }
static E_Gadcon_Client * _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) { Evas_Object *o; E_Gadcon_Client *gcc; Instance *inst; char buf[PATH_MAX]; inst = E_NEW(Instance, 1); inst->ci = _tclock_config_item_get(id); if (!inst->ci->id) inst->ci->id = eina_stringshare_add(id); o = edje_object_add(gc->evas); snprintf(buf, sizeof(buf), "%s/tclock.edj", tclock_config->mod_dir); if (!e_theme_edje_object_set(o, "base/theme/modules/tclock", "modules/tclock/main")) edje_object_file_set(o, buf, "modules/tclock/main"); evas_object_show(o); gcc = e_gadcon_client_new(gc, name, id, style, o); gcc->data = inst; inst->gcc = gcc; inst->tclock = o; evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _tclock_cb_mouse_down, inst); evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_IN, _tclock_cb_mouse_in, inst); evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_OUT, _tclock_cb_mouse_out, inst); tclock_config->instances = eina_list_append(tclock_config->instances, inst); _tclock_cb_check(inst); if (!check_timer) check_timer = ecore_timer_add(1.0, _tclock_cb_check, NULL); return gcc; }
static E_Gadcon_Client * _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) { Instance *inst; inst = E_NEW(Instance, 1); inst->o_toggle = edje_object_add(gc->evas); e_theme_edje_object_set(inst->o_toggle, "base/theme/modules/conf", "e/modules/conf/main"); inst->gcc = e_gadcon_client_new(gc, name, id, style, inst->o_toggle); inst->gcc->data = inst; edje_object_signal_callback_add(inst->o_toggle, "e,action,conf", "", _cb_action_conf, inst); instances = eina_list_append(instances, inst); e_gadcon_client_util_menu_attach(inst->gcc); return inst->gcc; }
static E_Gadcon_Client * _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) { Instance *inst; E_Gadcon_Client *gcc; char buf[PATH_MAX]; snprintf(buf, sizeof(buf), "%s/net.edj", e_module_dir_get(net_cfg->mod)); inst = E_NEW(Instance, 1); inst->ci = _net_config_item_get(id); inst->o_net = edje_object_add(gc->evas); if (!e_theme_edje_object_set(inst->o_net, "base/theme/modules/net", "modules/net/main")) edje_object_file_set(inst->o_net, buf, "modules/net/main"); edje_object_signal_callback_add(inst->o_net, "e,action,mouse,in", "", _net_cb_mouse_in, inst); edje_object_signal_callback_add(inst->o_net, "e,action,mouse,out", "", _net_cb_mouse_out, inst); evas_object_show(inst->o_net); if (!inst->ci->show_text) edje_object_signal_emit(inst->o_net, "e,state,text,hide", "e"); else edje_object_signal_emit(inst->o_net, "e,state,text,show", "e"); gcc = e_gadcon_client_new(gc, name, id, style, inst->o_net); gcc->data = inst; inst->gcc = gcc; inst->timer = ecore_timer_add(0.5, _net_cb_poll, inst); evas_object_event_callback_add(inst->o_net, EVAS_CALLBACK_MOUSE_DOWN, _net_cb_mouse_down, inst); net_cfg->instances = eina_list_append(net_cfg->instances, inst); return gcc; }
/* 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; }
/* externally accessible functions */ EAPI Evas_Object * e_widget_preview_add(Evas *evas, int minw, int minh) { Evas_Object *obj; E_Widget_Data *wd; Evas_Coord mw, mh; obj = e_widget_add(evas); e_widget_del_hook_set(obj, _e_wid_del_hook); wd = E_NEW(E_Widget_Data, 1); if (!wd) return NULL; wd->obj = obj; wd->o_frame = edje_object_add(evas); e_theme_edje_object_set(wd->o_frame, "base/theme/widgets", "e/widgets/preview"); evas_object_show(wd->o_frame); e_widget_sub_object_add(obj, wd->o_frame); e_widget_resize_object_set(obj, wd->o_frame); wd->img = e_livethumb_add(evas); e_livethumb_vsize_set(wd->img, minw * 2, minh * 2); edje_extern_object_min_size_set(wd->img, minw, minh); /* Why do we set max size? This prevents from being nicely resized. */ /* edje_extern_object_max_size_set(o, minw, minh); */ // evas_object_show(wd->img); edje_object_part_swallow(wd->o_frame, "e.swallow.content", wd->img); e_widget_sub_object_add(obj, wd->img); e_widget_data_set(obj, wd); e_widget_can_focus_set(obj, 0); edje_object_size_min_calc(wd->o_frame, &mw, &mh); e_widget_size_min_set(obj, mw, mh); return obj; }