EINTERN int e_deskenv_init(void) { char buf[PATH_MAX], buf2[4096]; // run xdrb -load .Xdefaults & .Xresources // NOTE: one day we should replace this with an e based config + service if (e_config->deskenv.load_xrdb) { e_user_homedir_concat(buf, sizeof(buf), ".Xdefaults"); if (ecore_file_exists(buf)) { snprintf(buf2, sizeof(buf2), "xrdb -load %s", buf); ecore_exe_run(buf2, NULL); } e_user_homedir_concat(buf, sizeof(buf), ".Xresources"); if (ecore_file_exists(buf)) { snprintf(buf2, sizeof(buf2), "xrdb -load %s", buf); ecore_exe_run(buf2, NULL); } } // load ~/.Xmodmap // NOTE: one day we should replace this with an e based config + service if (e_config->deskenv.load_xmodmap) { e_user_homedir_concat(buf, sizeof(buf), ".Xmodmap"); if (ecore_file_exists(buf)) { snprintf(buf2, sizeof(buf2), "xmodmap %s", buf); ecore_exe_run(buf2, NULL); } } // make gnome apps happy // NOTE: one day we should replace this with an e based config + service if (e_config->deskenv.load_gnome) { ecore_exe_run("gnome-settings-daemon", NULL); } // make kde apps happy // NOTE: one day we should replace this with an e based config + service ?? if (e_config->deskenv.load_kde) { ecore_exe_run("kdeinit", NULL); } return 1; }
void JsonApiHandlerHttp::processGetCameraPic() { int pid; Utils::from_string(jsonParam["camera_id"], pid); if (pid < 0 || pid >= CamManager::Instance().get_size()) { json_t *jret = json_object(); json_object_set_new(jret, "success", json_string("false")); json_object_set_new(jret, "error_str", json_string("camera_id not set")); sendJson(jret); return; } IPCam *camera = CamManager::Instance().get_camera(pid); string w, h; if (jsonParam.Exists("width")) w = jsonParam["width"]; if (jsonParam.Exists("height")) h = jsonParam["height"]; string cmd = "calaos_thumb \"" + camera->getPictureUrl() + "\" \"" + tempfname + "\""; if (w.empty() || h.empty()) cmd += " " + w + "x" + h; exe_thumb = ecore_exe_run(cmd.c_str(), nullptr); }
/** * @brief: Edje signal callback for the clicking or selecting of the settings option. * This calls up the settings window. */ void cc_settings(void *data, Evas_Object * obj, const char *emission, const char *source) { if (!ecore_exe_run("examine enotes", NULL)) msgbox("No Examine", "Please Install Examine for Settings!"); return; }
static void alarm_sound(void) { char buf[4096]; if (!child_exit_handler) child_exit_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL, child_exit, NULL); snprintf(buf, sizeof(buf), "aplay %s/sounds/phone.wav", PACKAGE_DATA_DIR); audio_exe = ecore_exe_run(buf, NULL); }
static void _wkb_ibus_launch_daemon(void) { DBG("Launching IBus daemon as: '%s'", IBUS_DAEMON_CMD); wkb_ibus->ibus_daemon = ecore_exe_run(IBUS_DAEMON_CMD, NULL); if (!wkb_ibus->ibus_daemon) { ERR("Error launching '%s' process", IBUS_DAEMON_CMD); return; } }
void _mail_start_exe (void *data) { Config_Box *cb; cb = data; if (!cb) return; exit_handler = ecore_event_handler_add (ECORE_EXE_EVENT_DEL, _mail_cb_exe_exit, cb); cb->exe = ecore_exe_run (cb->exec, cb); }
static void _mail_menu_cb_exec (void *data, E_Menu * m, E_Menu_Item * mi) { Config_Box *cb; cb = data; if (!cb) return; exit_handler = ecore_event_handler_add (ECORE_EXE_EVENT_DEL, _mail_cb_exe_exit, cb); cb->exe = ecore_exe_run (cb->exec, cb); }
void NTPClock::updateClock() { if (exe) return; if (Utils::get_config_option("use_ntp") == "true") { handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _NTPHandle1, this); cInfo() << "NTPClock::updateClock() Updating clock..."; std::string cmd = "/usr/sbin/ntpdate calaos.fr"; exe = ecore_exe_run(cmd.c_str(), NULL); } }
void ActionMail::sendMail() { std::string tmpFile; int cpt = 0; //Get a temporary filename do { tmpFile = "/tmp/calaos_mail_body_"; tmpFile += Utils::to_string(cpt); cpt++; } while (ecore_file_exists(tmpFile.c_str())); //Write body message to a temp file std::ofstream ofs; ofs.open(tmpFile.c_str(), std::ofstream::trunc); ofs << mail_message; ofs.close(); std::stringstream cmd; cmd << Prefix::Instance().binDirectoryGet(); cmd << "/calaos_mail"; if (ecore_file_exists(cmd.str().c_str())) { cmd << " "; cmd << "--delete "; //force temp file deletion after mail is sent if (Utils::get_config_option("smtp_debug") == "true") cmd << "--verbose "; cmd << "--from \"" << mail_sender << "\" "; cmd << "--to \"" << mail_recipients << "\" "; cmd << "--subject \"" << mail_subject << "\" "; cmd << "--body " << tmpFile << " "; if (!mail_attachment_tfile.empty()) cmd << "--attach " << mail_attachment_tfile; cInfo() << "Executing command : " << cmd.str(); ecore_exe_run(cmd.str().c_str(), NULL); } else { cError() << "Command " << cmd.str() << " not found"; } }
void AudioPlayer::getDBAlbumCoverItem(Params &item, PlayerInfo_cb callback, int size) { if (!item.Exists("cover_url")) return; string fname = Utils::getCacheFile(".cover_cache/album_") + item["cover_id"]; string cmdsize; switch (size) { default: case AUDIO_COVER_SIZE_SMALL: cmdsize = "40x40"; fname += "_small.jpg"; break; case AUDIO_COVER_SIZE_MEDIUM: cmdsize = "100x100"; fname += "_medium.jpg"; break; case AUDIO_COVER_SIZE_BIG: cmdsize = "250x250"; fname += "_big.jpg"; break; } if (ecore_file_exists(fname.c_str())) { PlayerInfo_signal sig; sig.connect(callback); Params p; p.Add("filename", fname); sig.emit(p); return; } PlayerInfoData *data = new PlayerInfoData(); data->cover_fname = fname; data->callback = callback; data->item = item; string cmd; cmd = Prefix::Instance().binDirectoryGet(); cmd += "calaos_thumb " + item["cover_url"] + " " + fname + " " + cmdsize; data->thumb_exe = ecore_exe_run(cmd.c_str(), data); if (!data->thumb_exe) { PlayerInfo_signal sig; sig.connect(callback); Params p; sig.emit(p); delete data; } }
static int _elsa_main(const char *dname) { if (!elsa_config->autologin) { char buf[PATH_MAX]; ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _elsa_client_del, NULL); fprintf(stderr, PACKAGE": Run client\n"); snprintf(buf, sizeof(buf), PACKAGE_BIN_DIR"/elsa_client -d %s -t %s", dname, elsa_config->theme); _elsa_client = ecore_exe_run(buf, NULL); } else ecore_main_loop_quit(); return 0; }
void chat_link_open(Contact_List *cl, const char *url) { char *cmd; size_t size; if (!cl->settings->browser) { DBG("BROWSER set to NULL; not opening link"); return; } size = sizeof(char) * (strlen(url) + strlen(cl->settings->browser) + 3) + 1; if (size > 32000) cmd = malloc(size); else cmd = alloca(size); snprintf(cmd, size, "%s '%s'", cl->settings->browser, url); DBG("Running BROWSER command: %s", cmd); ecore_exe_run(cmd, NULL); if (size > 32000) free(cmd); }
void JsonApiHandlerHttp::processGetCover() { int pid; Utils::from_string(jsonParam["player_id"], pid); if (pid < 0 || pid >= AudioManager::Instance().get_size()) { json_t *jret = json_object(); json_object_set_new(jret, "success", json_string("false")); json_object_set_new(jret, "error_str", json_string("player_id not set")); sendJson(jret); return; } AudioPlayer *player = AudioManager::Instance().get_player(pid); string w, h; if (jsonParam.Exists("width")) w = jsonParam["width"]; if (jsonParam.Exists("height")) h = jsonParam["height"]; player->get_album_cover([=](AudioPlayerData data) { //do not start another exe if one is running already if (data.svalue == "" || exe_thumb) { json_t *jret = json_object(); json_object_set_new(jret, "success", json_string("false")); json_object_set_new(jret, "error_str", json_string("unable to get url")); sendJson(jret); return; } string cmd = "calaos_thumb \"" + data.svalue + "\" \"" + tempfname + "\""; if (w.empty() || h.empty()) cmd += " " + w + "x" + h; exe_thumb = ecore_exe_run(cmd.c_str(), nullptr); }); }
void ActivityMediaController::menuIconClick(string icon) { if (icon == "eskiss") { ecore_exe_run("eskiss -c=FALSE", NULL); } else if (icon == "camera") { ActivityCameraListController *controller = new ActivityCameraListController(evas, parent, this); addSubController(controller); setButtonMode("mode,back"); } else if (icon == "music") { ActivityAudioListController *controller = new ActivityAudioListController(evas, parent, this); addSubController(controller); setButtonMode("mode,back"); } else if (icon == "web") { ApplicationMain::Instance().ShowWebBrowser(); } }
void ScreenSuspendView::edjeCallback(void *data, Evas_Object *obj, string emission, string source) { if (!is_during_wakeup) ScreenManager::instance().updateTimer(); if (emission == "event,repeat,deactivate" || emission == "start,suspend" || emission == "event,repeat,activate" || emission == "start,wakeup" || emission == "start,suspend,stop" || emission == "now,wakeup" || (is_during_suspend && emission == "mouse,in")) { return ; } if (is_during_suspend && source == "object" && emission == "end,suspend") { ScreenManager::instance().suspendNow(); is_during_suspend = false; ecore_exe_run("killall -9 eskiss", NULL); } else if (is_during_wakeup && source == "object" && emission == "end,wakeup") { ScreenManager::instance().wakeUpNowWhenScreenOn(); } else if (is_during_suspend) { EmitSignal("event,repeat,activate", "calaos"); EmitSignal("start,suspend,stop", "calaos"); EmitSignal("now,wakeup", "calaos"); is_during_suspend = false; ScreenManager::instance().wakeUpNowWhenScreenOn(); } }
EAPI void e_init_show(void) { char buf[8192], *theme, *tit, *ver; const char *s = NULL; /* exec init */ if (!e_config->init_default_theme) s = e_path_find(path_themes, "default.edj"); else if (e_config->init_default_theme[0] == '/') s = eina_stringshare_add(e_config->init_default_theme); else s = e_path_find(path_themes, e_config->init_default_theme); if (s) theme = strdup(e_util_filename_escape(s)); else theme = strdup("XdX"); if (s) eina_stringshare_del(s); if (title) tit = strdup(e_util_filename_escape(title)); else tit = strdup("XtX"); if (version) ver = strdup(e_util_filename_escape(version)); else ver = strdup("XvX"); snprintf(buf, sizeof(buf), "%s/enform/utils/enform_init \'%s\' \'%i\' \'%s\' \'%s\'", e_prefix_lib_get(), theme, e_config->font_hinting, tit, ver); printf("RUN INIT: %s\n", buf); free(theme); free(tit); free(ver); /* FIXME: add font path to cmd-line */ init_exe = ecore_exe_run(buf, NULL); }
/** * @internal * @return Returns > 0 on success or 0 on failure * @brief Initialize the Desktop parser subsystem */ int efreet_desktop_init(void) { char buf[PATH_MAX]; _efreet_desktop_log_dom = eina_log_domain_register("Efreet_desktop", EFREET_DEFAULT_LOG_COLOR); if (_efreet_desktop_log_dom < 0) { ERROR("Efreet: Could not create a log domain for Efreet_desktop"); return 0; } if (!ecore_file_init()) goto ecore_error; desktop_edd = efreet_desktop_edd_init(); if (!desktop_edd) goto edd_error; efreet_desktop_cache = eina_hash_string_superfast_new(NULL); efreet_desktop_types = NULL; EFREET_DESKTOP_TYPE_APPLICATION = efreet_desktop_type_add("Application", efreet_desktop_application_fields_parse, efreet_desktop_application_fields_save, NULL); EFREET_DESKTOP_TYPE_LINK = efreet_desktop_type_add("Link", efreet_desktop_link_fields_parse, efreet_desktop_link_fields_save, NULL); EFREET_DESKTOP_TYPE_DIRECTORY = efreet_desktop_type_add("Directory", NULL, NULL, NULL); EFREET_EVENT_DESKTOP_CACHE_UPDATE = ecore_event_type_new(); snprintf(buf, sizeof(buf), "%s/.efreet", efreet_home_dir_get()); if (!ecore_file_mkpath(buf)) goto cache_error; if (efreet_cache_update) { efreet_desktop_exe_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL, efreet_desktop_exe_cb, NULL); if (!efreet_desktop_exe_handler) goto cache_error; cache_monitor = ecore_file_monitor_add(buf, efreet_desktop_cache_update_cb, NULL); if (!cache_monitor) goto handler_error; efreet_desktop_changes_listen(); ecore_exe_run(PACKAGE_LIB_DIR "/efreet/efreet_desktop_cache_create", NULL); } /* TODO: Defer eet open until we actually need it open. */ cache = eet_open(efreet_desktop_cache_file(), EET_FILE_MODE_READ); return 1; handler_error: if (efreet_desktop_exe_handler) ecore_event_handler_del(efreet_desktop_exe_handler); cache_error: if (efreet_desktop_cache) eina_hash_free(efreet_desktop_cache); edd_error: ecore_file_shutdown(); ecore_error: eina_log_domain_unregister(_efreet_desktop_log_dom); return 0; }
static void usr_click_ok(void *data, Evas_Object *obj, void *event_info) { evas_object_del(e->win); FILE *f; int fd,sw,sh; char enc[128]; char *path, *bs_name, cmd[1024],bg_file[1024],set_bg[1024], *home; const char *image_file; home = getenv("HOME"); path = ecore_file_dir_get(e->image_file); image_file = ecore_file_file_get(e->image_file); bs_name = ecore_file_strip_ext(image_file); get_correct_size(900,e->w,e->h,&sw,&sh,BY_WIDTH); if ( e->quality > 99.5 ) snprintf(enc, sizeof(enc), "COMP"); else snprintf(enc, sizeof(enc), "LOSSY %1.0f", e->quality); //printf ("ENC:%s \n",enc); strcpy(e->tmpn, "/tmp/e_bgdlg_new.edc-tmp-XXXXXX"); fd = mkstemp(e->tmpn); close(fd); f = fopen(e->tmpn, "w"); switch (e->sel) { case IMPORT_STRETCH: fprintf(f,"//Created by PrinceAMD\n" "images { image: \"%s\" %s; }\n" "collections {\n" "group { name: \"e/desktop/background\";\n" "data { item: \"style\" \"0\"; }\n" "max: %i %i;\n" "parts {\n" "part { name: \"bg\"; mouse_events: 0;\n" "description { state: \"default\" 0.0;\n" "image { normal: \"%s\"; }\n" "} } } } }\n",image_file,enc,e->w,e->h,image_file); break; case IMPORT_TILE: fprintf(f,"//Created by PrinceAMD\n" "images { image: \"%s\" %s; }\n" "collections {\n" "group { name: \"e/desktop/background\";\n" "data { item: \"style\" \"1\"; }\n" "max: %i %i;\n" "parts {\n" "part { name: \"bg\"; mouse_events: 0;\n" "description { state: \"default\" 0.0;\n" "image { normal: \"%s\"; }\n" "fill { size {\n" "relative: 0.0 0.0;\n" "offset: %i %i;\n" "} } } } } } }\n",image_file,enc,e->w,e->h,image_file,e->w,e->h); break; case IMPORT_CENTER: fprintf(f,"//Created by PrinceAMD\n" "images { image: \"%s\" %s; }\n" "collections {\n" "group { name: \"e/desktop/background\";\n" "data { item: \"style\" \"2\"; }\n" "max: %i %i;\n" "parts {\n" "part { name: \"bg\"; mouse_events: 0;\n" "description { state: \"default\" 0.0;\n" "min: %i %i; max: %i %i;\n" "image { normal: \"%s\"; }\n" "} } } } }\n",image_file,enc,e->w,e->h,e->w,e->h,e->w,e->h,image_file); break; case IMPORT_SCALE_ASPECT_IN: fprintf(f,"//Created by PrinceAMD\n" "images { image: \"%s\" %s; }\n" "collections {\n" "group { name: \"e/desktop/background\";\n" "data { item: \"style\" \"3\"; }\n" "max: %i %i;\n" "parts {\n" "part { name: \"bg\"; mouse_events: 0;\n" "description { state: \"default\" 0.0;\n" "aspect: %1.9f %1.9f; aspect_preference: BOTH;\n" "image { normal: \"%s\"; }\n" "} } } } }\n",image_file,enc,e->w,e->h,(double)e->w / (double)e->h,(double)e->w / (double)e->h,image_file); break; case IMPORT_SCALE_ASPECT_OUT: fprintf(f,"//Created by PrinceAMD\n" "images { image: \"%s\" %s; }\n" "collections {\n" "group { name: \"e/desktop/background\";\n" "data { item: \"style\" \"4\"; }\n" "max: %i %i;\n" "parts {\n" "part { name: \"bg\"; mouse_events: 0;\n" "description { state: \"default\" 0.0;\n" "image { normal: \"%s\"; }\n" "aspect: %1.9f %1.9f; aspect_preference: NONE;\n" "} } } } }\n",image_file,enc,e->w,e->h,image_file,(double)e->w / (double)e->h,(double)e->w / (double)e->h); break; case IMPORT_SCALE_ASPECT_IN_TILE: fprintf(f,"//Created by PrinceAMD\n" "images { image: \"%s\" %s; }\n" "collections {\n" "group { name: \"e/desktop/background\";\n" "data { item: \"style\" \"1\"; }\n" "max: %i %i;\n" "parts {\n" "part { name: \"bg\"; mouse_events: 0;\n" "description { state: \"default\" 0.0;\n" "image { normal: \"%s\"; }\n" "fill { size {\n" "relative: 0.0 0.0;\n" "offset: %i %i;\n" "} } } } } } }\n",image_file,enc,e->w,e->h,image_file,sw,sh); break; default: /*seriously ?*/ break; } fclose(f); if (strcmp(path, image_file)) { snprintf(cmd, sizeof(cmd), "cd \"%s\" && edje_cc %s $HOME/.e/e/backgrounds/\"%s\".edj",path,e->tmpn,bs_name); } else { snprintf(cmd, sizeof(cmd), "edje_cc %s $HOME/.e/e/backgrounds/\"%s\".edj",e->tmpn,bs_name); } snprintf(set_bg, sizeof(set_bg), "%s/.e/e/backgrounds/%s.edj",home,bs_name); e->edj = eina_stringshare_add(set_bg); Ecore_Exe *exe; exe = ecore_exe_run(cmd, NULL); ecore_timer_add(0.1,set_bg_timer,NULL); //need code here to end the window session. }
} static void version_draw(void *data, Evas_Object *item) { char *version = (char *) data; edje_object_part_text_set(item, "title", gettext("Version")); edje_object_part_text_set(item, "value", version); edje_object_signal_emit(item, "set-icon-version", ""); } static void version_set(void *data __attribute__((unused)), Evas_Object *item __attribute__((unused))) { Ecore_Exe *exe = ecore_exe_run("/usr/bin/eabout", NULL); if(exe) ecore_exe_free(exe); } static void version_unload(void *data) { free(data); } const configlet_plugin_t * configlet_version(void) { static const configlet_plugin_t configlet = { .load = version_load,