forked from enlightenment/enlightenment
parent
e80438d801
commit
9b861c788b
|
@ -420,6 +420,7 @@ EAPI Evas_Object *evry_icon_theme_get(const char *icon, Evas *e);
|
||||||
EAPI int evry_fuzzy_match(const char *str, const char *match);
|
EAPI int evry_fuzzy_match(const char *str, const char *match);
|
||||||
EAPI Eina_List *evry_fuzzy_match_sort(Eina_List *items);
|
EAPI Eina_List *evry_fuzzy_match_sort(Eina_List *items);
|
||||||
EAPI int evry_util_exec_app(const Evry_Item *it_app, const Evry_Item *it_file);
|
EAPI int evry_util_exec_app(const Evry_Item *it_app, const Evry_Item *it_file);
|
||||||
|
EAPI char *evry_util_url_escape(const char *string, int inlength);
|
||||||
EAPI char *evry_util_unescape(const char *string, int length);
|
EAPI char *evry_util_unescape(const char *string, int length);
|
||||||
EAPI void evry_util_file_detail_set(Evry_Item_File *file);
|
EAPI void evry_util_file_detail_set(Evry_Item_File *file);
|
||||||
EAPI Eina_Bool evry_util_module_config_check(const char *module_name, int conf, int epoch, int version);
|
EAPI Eina_Bool evry_util_module_config_check(const char *module_name, int conf, int epoch, int version);
|
||||||
|
|
|
@ -447,6 +447,61 @@ evry_util_exec_app(const Evry_Item *it_app, const Evry_Item *it_file)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_conf_timer(void *data)
|
||||||
|
{
|
||||||
|
/* e_util_dialog_internal(title, */
|
||||||
|
e_util_dialog_internal(_("Configuration Updated"), data);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI Eina_Bool
|
||||||
|
evry_util_module_config_check(const char *module_name, int conf, int epoch, int version)
|
||||||
|
{
|
||||||
|
if ((conf >> 16) < epoch)
|
||||||
|
{
|
||||||
|
char *too_old =
|
||||||
|
_("%s Configuration data needed "
|
||||||
|
"upgrading. Your old configuration<br> has been"
|
||||||
|
" wiped and a new set of defaults initialized. "
|
||||||
|
"This<br>will happen regularly during "
|
||||||
|
"development, so don't report a<br>bug. "
|
||||||
|
"This simply means the module needs "
|
||||||
|
"new configuration<br>data by default for "
|
||||||
|
"usable functionality that your old<br>"
|
||||||
|
"configuration simply lacks. This new set of "
|
||||||
|
"defaults will fix<br>that by adding it in. "
|
||||||
|
"You can re-configure things now to your<br>"
|
||||||
|
"liking. Sorry for the inconvenience.<br>");
|
||||||
|
|
||||||
|
char buf[4096];
|
||||||
|
snprintf(buf, sizeof(buf), too_old, module_name);
|
||||||
|
ecore_timer_add(1.0, _conf_timer, buf);
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
else if (conf > version)
|
||||||
|
{
|
||||||
|
char *too_new =
|
||||||
|
_("Your %s Module configuration is NEWER "
|
||||||
|
"than the module version. This is "
|
||||||
|
"very<br>strange. This should not happen unless"
|
||||||
|
" you downgraded<br>the module or "
|
||||||
|
"copied the configuration from a place where"
|
||||||
|
"<br>a newer version of the module "
|
||||||
|
"was running. This is bad and<br>as a "
|
||||||
|
"precaution your configuration has been now "
|
||||||
|
"restored to<br>defaults. Sorry for the "
|
||||||
|
"inconvenience.<br>");
|
||||||
|
|
||||||
|
char buf[4096];
|
||||||
|
snprintf(buf, sizeof(buf), too_new, module_name);
|
||||||
|
ecore_timer_add(1.0, _conf_timer, buf);
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* taken from curl:
|
/* taken from curl:
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et
|
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et
|
||||||
|
@ -499,59 +554,74 @@ evry_util_unescape(const char *string, int length)
|
||||||
|
|
||||||
#undef ISXDIGIT
|
#undef ISXDIGIT
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_isalnum(unsigned char in)
|
||||||
static int
|
|
||||||
_conf_timer(void *data)
|
|
||||||
{
|
{
|
||||||
/* e_util_dialog_internal(title, */
|
switch (in) {
|
||||||
e_util_dialog_internal(_("Configuration Updated"), data);
|
case '0': case '1': case '2': case '3': case '4':
|
||||||
return 0;
|
case '5': case '6': case '7': case '8': case '9':
|
||||||
|
case 'a': case 'b': case 'c': case 'd': case 'e':
|
||||||
|
case 'f': case 'g': case 'h': case 'i': case 'j':
|
||||||
|
case 'k': case 'l': case 'm': case 'n': case 'o':
|
||||||
|
case 'p': case 'q': case 'r': case 's': case 't':
|
||||||
|
case 'u': case 'v': case 'w': case 'x': case 'y': case 'z':
|
||||||
|
case 'A': case 'B': case 'C': case 'D': case 'E':
|
||||||
|
case 'F': case 'G': case 'H': case 'I': case 'J':
|
||||||
|
case 'K': case 'L': case 'M': case 'N': case 'O':
|
||||||
|
case 'P': case 'Q': case 'R': case 'S': case 'T':
|
||||||
|
case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z':
|
||||||
|
return EINA_TRUE;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
EAPI char *
|
||||||
|
evry_util_url_escape(const char *string, int inlength)
|
||||||
|
{
|
||||||
|
size_t alloc = (inlength?(size_t)inlength:strlen(string))+1;
|
||||||
|
char *ns;
|
||||||
|
char *testing_ptr = NULL;
|
||||||
|
unsigned char in; /* we need to treat the characters unsigned */
|
||||||
|
size_t newlen = alloc;
|
||||||
|
int strindex=0;
|
||||||
|
size_t length;
|
||||||
|
|
||||||
|
ns = malloc(alloc);
|
||||||
|
if(!ns)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
length = alloc-1;
|
||||||
|
while(length--) {
|
||||||
|
in = *string;
|
||||||
|
|
||||||
|
if (_isalnum(in)) {
|
||||||
|
/* just copy this */
|
||||||
|
ns[strindex++]=in;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* encode it */
|
||||||
|
newlen += 2; /* the size grows with two, since this'll become a %XX */
|
||||||
|
if(newlen > alloc) {
|
||||||
|
alloc *= 2;
|
||||||
|
testing_ptr = realloc(ns, alloc);
|
||||||
|
if(!testing_ptr) {
|
||||||
|
free( ns );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ns = testing_ptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
snprintf(&ns[strindex], 4, "%%%02X", in);
|
||||||
|
|
||||||
|
strindex+=3;
|
||||||
|
}
|
||||||
|
string++;
|
||||||
|
}
|
||||||
|
ns[strindex]=0; /* terminate it */
|
||||||
|
return ns;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
|
||||||
evry_util_module_config_check(const char *module_name, int conf, int epoch, int version)
|
|
||||||
{
|
|
||||||
if ((conf >> 16) < epoch)
|
|
||||||
{
|
|
||||||
char *too_old =
|
|
||||||
_("%s Configuration data needed "
|
|
||||||
"upgrading. Your old configuration<br> has been"
|
|
||||||
" wiped and a new set of defaults initialized. "
|
|
||||||
"This<br>will happen regularly during "
|
|
||||||
"development, so don't report a<br>bug. "
|
|
||||||
"This simply means the module needs "
|
|
||||||
"new configuration<br>data by default for "
|
|
||||||
"usable functionality that your old<br>"
|
|
||||||
"configuration simply lacks. This new set of "
|
|
||||||
"defaults will fix<br>that by adding it in. "
|
|
||||||
"You can re-configure things now to your<br>"
|
|
||||||
"liking. Sorry for the inconvenience.<br>");
|
|
||||||
|
|
||||||
char buf[4096];
|
|
||||||
snprintf(buf, sizeof(buf), too_old, module_name);
|
|
||||||
ecore_timer_add(1.0, _conf_timer, buf);
|
|
||||||
return EINA_FALSE;
|
|
||||||
}
|
|
||||||
else if (conf > version)
|
|
||||||
{
|
|
||||||
char *too_new =
|
|
||||||
_("Your %s Module configuration is NEWER "
|
|
||||||
"than the module version. This is "
|
|
||||||
"very<br>strange. This should not happen unless"
|
|
||||||
" you downgraded<br>the module or "
|
|
||||||
"copied the configuration from a place where"
|
|
||||||
"<br>a newer version of the module "
|
|
||||||
"was running. This is bad and<br>as a "
|
|
||||||
"precaution your configuration has been now "
|
|
||||||
"restored to<br>defaults. Sorry for the "
|
|
||||||
"inconvenience.<br>");
|
|
||||||
|
|
||||||
char buf[4096];
|
|
||||||
snprintf(buf, sizeof(buf), too_new, module_name);
|
|
||||||
ecore_timer_add(1.0, _conf_timer, buf);
|
|
||||||
return EINA_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return EINA_TRUE;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue