add e_util_open(), unify all callers of enlightenment_open

ref adbba1042b
This commit is contained in:
Mike Blumenkrantz 2016-09-27 11:18:38 -04:00
parent bb53d4606f
commit 90fcc55f1e
5 changed files with 25 additions and 29 deletions

View File

@ -1441,3 +1441,20 @@ e_util_memclear(void *s, size_t n)
{
memset_ptr(s, 0, n);
}
E_API Ecore_Exe *
e_util_open(const char *exe, void *data)
{
char *sb;
size_t size = 65536, len;
Ecore_Exe *ret;
sb = malloc(size);
snprintf(sb, size, "%s/enlightenment_open ", e_prefix_bin_get());
len = strlen(sb);
sb = e_util_string_append_quoted(sb, &size, &len, exe);
ret = ecore_exe_run(sb, data);
free(sb);
return ret;
}

View File

@ -65,6 +65,8 @@ E_API void e_util_string_list_free(Eina_List *l);
E_API void e_util_memclear(void *s, size_t n);
E_API Ecore_Exe *e_util_open(const char *exe, void *data);
static inline void
e_util_pointer_center(const E_Client *ec)
{

View File

@ -519,15 +519,8 @@ tw_link_hide(E_Client *ec, const char *uri)
EINTERN void
tw_link_open(E_Client *ec, const char *uri)
{
char *sb;
size_t size = 4096, len = sizeof(E_BINDIR "/enlightenment_open ") - 1;
if (!ec->focused) return;
sb = malloc(size);
memcpy(sb, E_BINDIR "/enlightenment_open ", len);
sb = e_util_string_append_quoted(sb, &size, &len, uri);
ecore_exe_run(sb, NULL);
free(sb);
if (ec->focused)
e_util_open(uri, NULL);
}
static Eet_Data_Descriptor *

View File

@ -14,15 +14,7 @@ struct _E_Widget_Smart_Data
static void
_open_browser_help_cb(void *data EINA_UNUSED, void *obj EINA_UNUSED)
{
const char *url = "https://phab.enlightenment.org/w/emodules/tiling2/";
char *sb;
size_t size = 4096, len = sizeof(E_BINDIR "/enlightenment_open ") - 1;
sb = malloc(size);
memcpy(sb, E_BINDIR "/enlightenment_open ", len);
sb = e_util_string_append_quoted(sb, &size, &len, url);
ecore_exe_run(sb, NULL);
free(sb);
e_util_open("https://phab.enlightenment.org/w/emodules/tiling2/", NULL);
}
/* Some defines to make coding with the e_widget_* easier for configuration

View File

@ -1442,18 +1442,10 @@ _wireless_auth_external_deny(void *data, Evas_Object *obj EINA_UNUSED, void *eve
static void
_wireless_auth_external_allow(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
char *sb, *uri = data;
const char *bindir;
size_t size = PATH_MAX, len;
char *uri = data;
bindir = e_prefix_bin_get();
len = strlen(bindir);
sb = malloc(size);
snprintf(sb, size, "%s/enlightenment_open", bindir);
sb = e_util_string_append_quoted(sb, &size, &len, uri);
DBG("launched command: %s", sb);
ecore_exe_run(sb, NULL);
free(sb);
e_util_open(uri, NULL);
DBG("launched uri: %s", uri);
free(uri);
auth_popup = 0;
}