EAPI void * ecore_animator_del(Ecore_Animator *animator) { void *data = NULL; EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL); _ecore_lock(); if (!ECORE_MAGIC_CHECK(animator, ECORE_MAGIC_ANIMATOR)) { ECORE_MAGIC_FAIL(animator, ECORE_MAGIC_ANIMATOR, "ecore_animator_del"); goto unlock; } if (animator->delete_me) { data = animator->data; goto unlock; } animator->delete_me = EINA_TRUE; animators_delete_me++; if (animator->run_func) data = animator->run_data; else data = animator->data; unlock: _ecore_unlock(); return data; }
/** * Get the pending time regarding a timer. * * @param timer The timer to learn from. * @ingroup Ecore_Time_Group */ EAPI double ecore_timer_pending_get(Ecore_Timer *timer) { double now; double ret = 0.0; _ecore_lock(); if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER)) { ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER, "ecore_timer_pending_get"); goto unlock; } now = ecore_time_get(); if (timer->frozen) ret = timer->pending; else ret = timer->at - now; unlock: _ecore_unlock(); return ret; }
/** * Resumes a frozen (paused) timer. * * @param timer The timer to be resumed. * * The timer will be resumed from its previous relative position in time. That * means, if it had X seconds remaining until expire when it was paused, it will * be started now with those same X seconds remaining to expire again. But * notice that the interval time won't be touched by this call or by * ecore_timer_freeze(). * * @see ecore_timer_freeze() */ EAPI void ecore_timer_thaw(Ecore_Timer *timer) { double now; _ecore_lock(); if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER)) { ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER, "ecore_timer_thaw"); goto unlock; } /* Timer not frozen */ if (!timer->frozen) goto unlock; suspended = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer)); now = ecore_time_get(); _ecore_timer_set(timer, timer->pending + now, timer->in, timer->func, timer->data); unlock: _ecore_unlock(); }
/** * Send a Curl httppost * @return 1 on success, 0 on error. * @ingroup Ecore_Con_Url_Group */ EAPI int ecore_con_url_http_post_send(Ecore_Con_Url *url_con, void *httppost) { #ifdef HAVE_CURL if (url_con->post) curl_formfree(url_con->post); url_con->post = NULL; if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) { ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_http_post_send"); return 0; } url_con->post = httppost; if (url_con->active) return 0; if (!url_con->url) return 0; curl_easy_setopt(url_con->curl_easy, CURLOPT_HTTPPOST, httppost); return ecore_con_url_send(url_con, NULL, 0, NULL); #else return 0; url_con = NULL; #endif }
/** * Sets the URL to send the request to. * * @param url_con Connection object through which the request will be sent. * @param url URL that will receive the request * * @return 1 on success, 0 on error. * * @ingroup Ecore_Con_Url_Group */ EAPI int ecore_con_url_url_set(Ecore_Con_Url *url_con, const char *url) { #ifdef HAVE_CURL if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) { ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_url_set"); return 0; } if (url_con->active) return 0; if (url_con->url) free(url_con->url); url_con->url = NULL; if (url) url_con->url = strdup(url); if (url_con->url) curl_easy_setopt(url_con->curl_easy, CURLOPT_URL, url_con->url); else curl_easy_setopt(url_con->curl_easy, CURLOPT_URL, ""); return 1; #else return 0; url_con = NULL; url = NULL; #endif }
/** * Sets url_con to use http auth, with given username and password, "safely" or not. * * @param url_con Connection object to perform a request on, previously created * with ecore_con_url_new() or ecore_con_url_custom_new(). * @param username Username to use in authentication * @param password Password to use in authentication * @param safe Whether to use "safer" methods (eg, NOT http basic auth) * * @return 1 on success, 0 on error. * * @ingroup Ecore_Con_Url_Group */ EAPI int ecore_con_url_httpauth_set(Ecore_Con_Url *url_con, const char *username, const char *password, Eina_Bool safe) { #ifdef HAVE_CURL if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) { ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_httpauth_set"); return 0; } # ifdef CURLOPT_USERNAME # ifdef CURLOPT_PASSWORD if ((username != NULL) && (password != NULL)) { if (safe) curl_easy_setopt(url_con->curl_easy, CURLOPT_HTTPAUTH, CURLAUTH_ANYSAFE); else curl_easy_setopt(url_con->curl_easy, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_easy_setopt(url_con->curl_easy, CURLOPT_USERNAME, username); curl_easy_setopt(url_con->curl_easy, CURLOPT_PASSWORD, password); return 1; } # endif # endif #endif return 0; }
/** * Delete the specified timer from the timer list. * @param timer The timer to delete. * @return The data pointer set for the timer when @ref ecore_timer_add was * called. @c NULL is returned if the function is unsuccessful. * * Note: @p timer must be a valid handle. If the timer function has already * returned 0, the handle is no longer valid (and does not need to be delete). */ EAPI void * ecore_timer_del(Ecore_Timer *timer) { if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER)) { ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER, "ecore_timer_del"); return NULL; } if (timer->frozen && !timer->references) { void *data = timer->data; suspended = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer)); if (timer->delete_me) timers_delete_me--; free(timer); return data; } EINA_SAFETY_ON_TRUE_RETURN_VAL(timer->delete_me, NULL); timer->delete_me = 1; timers_delete_me++; return timer->data; }
EAPI void ecore_timer_freeze(Ecore_Timer *timer) { double now; if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER)) { ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER, "ecore_timer_freeze"); return ; } /* Timer already frozen */ if (timer->frozen) return ; timers = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer)); suspended = (Ecore_Timer *) eina_inlist_prepend(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer)); now = ecore_time_get(); timer->pending = timer->at - now; timer->at = 0.0; timer->frozen = 1; }
EAPI void ecore_imf_context_del(Ecore_IMF_Context *ctx) { Ecore_IMF_Func_Node *fn; if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) { ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, "ecore_imf_context_del"); return; } if (show_req_ctx == ctx) show_req_ctx = NULL; if (ctx->klass->del) ctx->klass->del(ctx); if (ctx->callbacks) { EINA_LIST_FREE(ctx->callbacks, fn) free(fn); } if (ctx->input_panel_callbacks) { EINA_LIST_FREE(ctx->input_panel_callbacks, fn) free(fn); } ECORE_MAGIC_SET(ctx, ECORE_MAGIC_NONE); free(ctx); }
EAPI void * ecore_exe_free(Ecore_Exe *exe) { void *data; if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) { ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_free"); return NULL; } data = exe->data; if (exe->pre_free_cb) exe->pre_free_cb(data, exe); CloseHandle(exe->process2); CloseHandle(exe->process_thread); CloseHandle(exe->process); free(exe->cmd); _ecore_exe_win32_pipes_close(exe); exes = (Ecore_Exe *)eina_inlist_remove(EINA_INLIST_GET(exes), EINA_INLIST_GET(exe)); ECORE_MAGIC_SET(exe, ECORE_MAGIC_NONE); if (exe->tag) free(exe->tag); free(exe); return data; }
/** * Change the interval the timer ticks of. If set during * a timer call, this will affect the next interval. * * @param timer The timer to change. * @param in The interval in seconds. * @ingroup Ecore_Time_Group */ EAPI void ecore_timer_interval_set(Ecore_Timer * timer, double in) { if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER)) { ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER, "ecore_timer_interval_set"); return; } timer->in = in; }
/** * Get the interval the timer ticks on. * * @param timer The timer to retrieve the interval from * @return The interval on success. -1 on failure. * @ingroup Ecore_Time_Group */ EAPI double ecore_timer_interval_get(Ecore_Timer * timer) { if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER)) { ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER, "ecore_timer_interval_get"); return -1.0; } return timer->in; }
/** * Get the Input Method Context specific data. * * See @ref ecore_imf_context_data_set for more details. * * @param ctx An #Ecore_IMF_Context. * @return The Input Method Context specific data. * @ingroup Ecore_IMF_Context_Module_Group */ EAPI void *ecore_imf_context_data_get(Ecore_IMF_Context *ctx) { if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) { ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, "ecore_imf_context_data_get"); return NULL; } return ctx->data; }
EAPI Ecore_Exe_Flags ecore_exe_flags_get(const Ecore_Exe *exe) { if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) { ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_data_get"); return 0; } return exe->flags; }
EAPI void * ecore_exe_data_get(const Ecore_Exe *exe) { if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) { ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_data_get"); return NULL; } return exe->data; }
EAPI const char * ecore_exe_cmd_get(const Ecore_Exe *exe) { if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) { ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_cmd_get"); return NULL; } return exe->cmd; }
EAPI pid_t ecore_exe_pid_get(const Ecore_Exe *exe) { if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) { ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_pid_get"); return -1; } return exe->process_id; }
EAPI void ecore_exe_close_stdin(Ecore_Exe *exe) { if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) { ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_close_stdin"); return; } exe->close_stdin = 1; }
/** * Close the write end of an Ecore_Pipe object created with ecore_pipe_add(). * * @param p The Ecore_Pipe object. * @ingroup Ecore_Pipe_Group */ EAPI void ecore_pipe_write_close(Ecore_Pipe * p) { if (!ECORE_MAGIC_CHECK(p, ECORE_MAGIC_PIPE)) { ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE, "ecore_pipe_write_close"); return; } pipe_close(p->fd_write); p->fd_write = PIPE_FD_INVALID; }
/** * @brief Enable certificate verification on a server object * * Call this function on a server object before main loop has started * to enable verification of certificates against loaded certificates. * @param svr The server object */ EAPI void ecore_con_ssl_server_verify(Ecore_Con_Server *svr) { if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) { ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_ssl_server_verify"); return; } svr->verify = EINA_TRUE; }
/** * Makes a FTP upload * @return FIXME: To be more documented. * @ingroup Ecore_Con_Url_Group */ EAPI int ecore_con_url_ftp_upload(Ecore_Con_Url *url_con, const char *filename, const char *user, const char *pass, const char *upload_dir) { #ifdef HAVE_CURL char url[4096]; char userpwd[4096]; FILE *fd; struct stat file_info; if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) { ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_ftp_upload"); return 0; } if (url_con->active) return 0; if (!url_con->url) return 0; if (filename) { char tmp[PATH_MAX]; snprintf(tmp, PATH_MAX, "%s", filename); if (stat(filename, &file_info)) return 0; fd = fopen(filename, "rb"); if (upload_dir) snprintf(url, sizeof(url), "ftp://%s/%s/%s", url_con->url, upload_dir, basename(tmp)); else snprintf(url, sizeof(url), "ftp://%s/%s", url_con->url, basename(tmp)); snprintf(userpwd, sizeof(userpwd), "%s:%s", user, pass); curl_easy_setopt(url_con->curl_easy, CURLOPT_INFILESIZE_LARGE, (curl_off_t)file_info.st_size); curl_easy_setopt(url_con->curl_easy, CURLOPT_USERPWD, userpwd); curl_easy_setopt(url_con->curl_easy, CURLOPT_UPLOAD, 1); curl_easy_setopt(url_con->curl_easy, CURLOPT_READFUNCTION, _ecore_con_url_read_cb); curl_easy_setopt(url_con->curl_easy, CURLOPT_READDATA, fd); ecore_con_url_url_set(url_con, url); return _ecore_con_url_perform(url_con); } else return 0; #else return 0; url_con = NULL; filename = NULL; user = NULL; pass = NULL; upload_dir = NULL; #endif }
EAPI const Ecore_IMF_Context_Info * ecore_imf_context_info_get(Ecore_IMF_Context *ctx) { if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) { ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, "ecore_imf_context_info_get"); return NULL; } return ctx->module->info; }
EAPI void ecore_imf_context_data_set(Ecore_IMF_Context *ctx, void *data) { if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) { ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, "ecore_imf_context_data_set"); return; } ctx->data = data; }
EAPI void ecore_imf_context_use_preedit_set(Ecore_IMF_Context *ctx, Eina_Bool use_preedit) { if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) { ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, "ecore_imf_context_use_preedit_set"); return; } if (ctx->klass->use_preedit_set) ctx->klass->use_preedit_set(ctx, use_preedit); }
EAPI Ecore_IMF_Input_Mode ecore_imf_context_input_mode_get(Ecore_IMF_Context *ctx) { if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) { ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, "ecore_imf_context_input_mode_set"); return 0; } return ctx->input_mode; }
EAPI void ecore_imf_context_cursor_location_set(Ecore_IMF_Context *ctx, int x, int y, int w, int h) { if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) { ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, "ecore_imf_context_cursor_location_set"); return; } if (ctx->klass->cursor_location_set) ctx->klass->cursor_location_set(ctx, x, y, w, h); }
EAPI void ecore_imf_context_cursor_position_set(Ecore_IMF_Context *ctx, int cursor_pos) { if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) { ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, "ecore_imf_context_cursor_position_set"); return; } if (ctx->klass->cursor_position_set) ctx->klass->cursor_position_set(ctx, cursor_pos); }
EAPI void ecore_imf_context_reset(Ecore_IMF_Context *ctx) { if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) { ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, "ecore_imf_context_reset"); return; } if (ctx->klass->reset) ctx->klass->reset(ctx); }
EAPI void ecore_imf_context_focus_in(Ecore_IMF_Context *ctx) { if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) { ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, "ecore_imf_context_focus_in"); return; } if (ctx->klass->focus_in) ctx->klass->focus_in(ctx); }
EAPI void * ecore_imf_context_client_window_get(Ecore_IMF_Context *ctx) { if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) { ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, "ecore_imf_context_client_window_get"); return NULL; } return ctx->window; }