better check for http_proxy env

don't create popup when missing location


SVN revision: 35452
This commit is contained in:
Sebastian Dransfeld 2008-08-13 05:34:00 +00:00
parent 58c003a7fa
commit a751dd9373
1 changed files with 13 additions and 6 deletions

View File

@ -102,7 +102,9 @@ struct
{ {
const char *host; const char *host;
int port; int port;
} proxy; } proxy = {
NULL, 0
};
/* Module Function Protos */ /* Module Function Protos */
static void _forecasts_cb_mouse_down(void *data, Evas * e, Evas_Object * obj, static void _forecasts_cb_mouse_down(void *data, Evas * e, Evas_Object * obj,
@ -512,16 +514,17 @@ _forecasts_free(Forecasts * w)
static void static void
_forecasts_get_proxy(void) _forecasts_get_proxy(void)
{ {
char env[128]; char *env;
char *host = NULL; char *host = NULL;
char *p; char *p;
int port = 0; int port = 0;
snprintf(env, sizeof(env), "%s", getenv("http_proxy")); env = getenv ("http_proxy");
if (!env[0]) if ((!env) || (!*env)) env = getenv ("HTTP_PROXY");
snprintf(env, sizeof(env), "%s", getenv("HTTP_PROXY")); if ((!env) || (!*env)) return;
if (strncmp(env, "http://", 7)) return; if (strncmp (env, "http://", 7)) return;
env = strdup(env);
host = strchr(env, ':'); host = strchr(env, ':');
host += 3; host += 3;
p = strchr(host, ':'); p = strchr(host, ':');
@ -534,9 +537,11 @@ _forecasts_get_proxy(void)
} }
if ((host) && (port)) if ((host) && (port))
{ {
if (proxy.host) evas_stringshare_del(proxy.host);
proxy.host = evas_stringshare_add(host); proxy.host = evas_stringshare_add(host);
proxy.port = port; proxy.port = port;
} }
free(env);
} }
static int static int
@ -949,6 +954,8 @@ _forecasts_popup_content_create(Instance *inst)
int row = 0, i; int row = 0, i;
int w, h; int w, h;
if (!inst->location) return;
inst->popup = e_gadcon_popup_new(inst->gcc, _forecasts_popup_resize); inst->popup = e_gadcon_popup_new(inst->gcc, _forecasts_popup_resize);
evas = inst->popup->win->evas; evas = inst->popup->win->evas;