int alarm_alarm_ring(Alarm *al, int test) { char buf[4096]; int ret = 1; alarm_config->alarms_state = ALARM_STATE_RINGING; if (!test) al->state = ALARM_STATE_RINGING; alarm_config->alarms_ringing_nb++; alarm_edje_signal_emit(EDJE_SIG_SEND_ALARM_RING_START); // TODO: real popups if (al->open_popup) { snprintf(buf, sizeof(buf), D_("<hilight>Alarm : %s</hilight><br><br>" "%s"), al->name, (al->description) ? al->description : "" ); e_module_dialog_show(alarm_config->module, D_("Alarm Module Popup"), buf); } if (al->run_program != ALARM_RUN_PROGRAM_NO) { Ecore_Exe *exe; if (al->run_program == ALARM_RUN_PROGRAM_PARENT) { exe = ecore_exe_pipe_run(alarm_config->alarms_program_default, ECORE_EXE_USE_SH, NULL); } else { exe = ecore_exe_pipe_run(al->program, ECORE_EXE_USE_SH, NULL); } if (exe > 0) ecore_exe_free(exe); else { snprintf(buf, sizeof(buf), D_("<hilight>Failed !</hilight><br><br>" "Alarm couln't launch the program you specified")); e_module_dialog_show(alarm_config->module, D_("Alarm Module Error"), buf); ret = 0; } } _alarm_check_date(al, 0); if (alarm_config->alarms_details) alarm_edje_refresh_details(); e_config_save_queue(); return ret; }
/** * 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; }
EAPI void * e_modapi_init(E_Module *m) { char buf[4096]; Eina_List *l; snprintf(buf, sizeof(buf), "%s/locale", e_module_dir_get(m)); bindtextdomain(PACKAGE, buf); bind_textdomain_codeset(PACKAGE, "UTF-8"); _alarms_edd = E_CONFIG_DD_NEW("Alarm_Alarm", Alarm); #undef T #undef D #define T Alarm #define D _alarms_edd E_CONFIG_VAL(D, T, name, STR); E_CONFIG_VAL(D, T, state, SHORT); E_CONFIG_VAL(D, T, description, STR); E_CONFIG_VAL(D, T, autoremove, SHORT); E_CONFIG_VAL(D, T, open_popup, SHORT); E_CONFIG_VAL(D, T, run_program, SHORT); E_CONFIG_VAL(D, T, program, STR); E_CONFIG_VAL(D, T, sched.type, SHORT); E_CONFIG_VAL(D, T, sched.date_epoch, DOUBLE); E_CONFIG_VAL(D, T, sched.day_monday, SHORT); E_CONFIG_VAL(D, T, sched.day_tuesday, SHORT); E_CONFIG_VAL(D, T, sched.day_wenesday, SHORT); E_CONFIG_VAL(D, T, sched.day_thursday, SHORT); E_CONFIG_VAL(D, T, sched.day_friday, SHORT); E_CONFIG_VAL(D, T, sched.day_saturday, SHORT); E_CONFIG_VAL(D, T, sched.day_sunday, SHORT); E_CONFIG_VAL(D, T, sched.hour, SHORT); E_CONFIG_VAL(D, T, sched.minute, SHORT); E_CONFIG_VAL(D, T, snooze.hour, SHORT); E_CONFIG_VAL(D, T, snooze.minute, SHORT); E_CONFIG_VAL(D, T, snooze.remember, SHORT); _conf_edd = E_CONFIG_DD_NEW("Alarm_Config", Config); #undef T #undef D #define T Config #define D _conf_edd E_CONFIG_VAL(D, T, time_format, SHORT); E_CONFIG_VAL(D, T, alarms_state, SHORT); E_CONFIG_LIST(D, T, alarms, _alarms_edd); E_CONFIG_VAL(D, T, alarms_details, SHORT); E_CONFIG_VAL(D, T, alarms_autoremove_default, SHORT); E_CONFIG_VAL(D, T, alarms_open_popup_default, SHORT); E_CONFIG_VAL(D, T, alarms_run_program_default, SHORT); E_CONFIG_VAL(D, T, alarms_program_default, STR); E_CONFIG_VAL(D, T, config_version, SHORT); alarm_config = e_config_domain_load("module.alarm", _conf_edd); if (alarm_config) { if (alarm_config->config_version < CONFIG_VERSION) { snprintf(buf, sizeof(buf), D_("<hilight>Alarm module : Configuration Upgraded</hilight><br><br>" "Your configuration of alarm module<br>" "has been upgraded<br>" "Your settings and alarms were removed<br>" "Sorry for the inconvenience<br><br>" "(%d -> %d)"), alarm_config->config_version, CONFIG_VERSION); e_module_dialog_show(alarm_config->module, D_("Alarm Module version " MODULE_VERSION), buf); alarm_config = NULL; } else { if (alarm_config->config_version > CONFIG_VERSION) { snprintf(buf, sizeof(buf), D_("<hilight>Alarm module : Configuration Downgraded</hilight><br><br>" "Your configuration of Alarm module<br>" "has been downgraded<br>" "Your settings and alarms were removed<br>" "Sorry for the inconvenience<br><br>" "(%d ->%d)"), alarm_config->config_version, CONFIG_VERSION); e_module_dialog_show(alarm_config->module, D_("Alarm Module version " MODULE_VERSION), buf); alarm_config = NULL; } } } if (!alarm_config) { alarm_config = E_NEW(Config, 1); alarm_config->time_format = TIME_FORMAT_DEFAULT; alarm_config->alarms_state = ALARM_STATE_OFF; alarm_config->alarms_details = ALARMS_DETAILS_DEFAULT; alarm_config->alarms_autoremove_default = ALARMS_AUTOREMOVE_DEFAULT; alarm_config->alarms_open_popup_default = ALARMS_OPEN_POPUP_DEFAULT; alarm_config->alarms_run_program_default = ALARMS_RUN_PROGRAM_DEFAULT; alarm_config->config_version = CONFIG_VERSION; } E_CONFIG_LIMIT(alarm_config->time_format, TIME_FORMAT_12, TIME_FORMAT_24); E_CONFIG_LIMIT(alarm_config->alarms_details, 0, 1); E_CONFIG_LIMIT(alarm_config->alarms_autoremove_default, 0, 1); E_CONFIG_LIMIT(alarm_config->alarms_open_popup_default, 0, 1); /* set the number of ringing alarms */ for (l=alarm_config->alarms; l; l=eina_list_next(l)) { Alarm *al; al = eina_list_data_get(l); if (al->state == ALARM_STATE_RINGING) alarm_config->alarms_ringing_nb++; } /* set alarms state and check dates */ if (alarm_config->alarms) { for (l=alarm_config->alarms; l; l=eina_list_next(l)) { Alarm *al; al = eina_list_data_get(l); _alarm_check_date(al, 0); } alarm_config->alarms_ring_etimer = ecore_timer_add(ALARMS_CHECK_TIMER, _cb_alarms_ring_etimer, NULL); } //FIXME not sure about that, maybe must use edje directly to find the part if (!e_theme_category_find(THEME_IN_E)) { char buf[512]; snprintf(buf, sizeof(buf), "%s/alarm.edj", e_module_dir_get(m)); alarm_config->theme = strdup(buf); } alarm_config->module = m; e_gadcon_provider_register((const E_Gadcon_Client_Class *)&_gadcon_class); return alarm_config; }