Update to yahoo new xml format and add option to allow popup on mouse click
SVN revision: 33192
This commit is contained in:
parent
d91348748c
commit
8deda34e2a
|
@ -8,6 +8,7 @@ struct _E_Config_Dialog_Data
|
||||||
int degrees;
|
int degrees;
|
||||||
char *code;
|
char *code;
|
||||||
int show_text;
|
int show_text;
|
||||||
|
int popup_on_hover;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void *_create_data(E_Config_Dialog * cfd);
|
static void *_create_data(E_Config_Dialog * cfd);
|
||||||
|
@ -50,6 +51,7 @@ _fill_data(Config_Item * ci, E_Config_Dialog_Data * cfdata)
|
||||||
if (ci->code)
|
if (ci->code)
|
||||||
cfdata->code = strdup(ci->code);
|
cfdata->code = strdup(ci->code);
|
||||||
cfdata->show_text = ci->show_text;
|
cfdata->show_text = ci->show_text;
|
||||||
|
cfdata->popup_on_hover = ci->popup_on_hover;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
|
@ -94,6 +96,8 @@ _basic_create_widgets(E_Config_Dialog * cfd, Evas * evas,
|
||||||
e_widget_framelist_object_append(of, ob);
|
e_widget_framelist_object_append(of, ob);
|
||||||
ob = e_widget_check_add(evas, D_("Show Description"), &(cfdata->show_text));
|
ob = e_widget_check_add(evas, D_("Show Description"), &(cfdata->show_text));
|
||||||
e_widget_framelist_object_append(of, ob);
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
ob = e_widget_check_add(evas, _("Popup on mouse over"), &(cfdata->popup_on_hover));
|
||||||
|
e_widget_framelist_object_append(of, ob);
|
||||||
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||||
|
|
||||||
of = e_widget_framelist_add(evas, D_("Unit Settings"), 0);
|
of = e_widget_framelist_add(evas, D_("Unit Settings"), 0);
|
||||||
|
@ -142,6 +146,7 @@ _basic_apply_data(E_Config_Dialog * cfd, E_Config_Dialog_Data * cfdata)
|
||||||
*t = toupper(*t);
|
*t = toupper(*t);
|
||||||
ci->code = evas_stringshare_add(t);
|
ci->code = evas_stringshare_add(t);
|
||||||
ci->show_text = cfdata->show_text;
|
ci->show_text = cfdata->show_text;
|
||||||
|
ci->popup_on_hover = cfdata->popup_on_hover;
|
||||||
|
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
_forecasts_config_updated(ci);
|
_forecasts_config_updated(ci);
|
||||||
|
|
33
e_mod_main.c
33
e_mod_main.c
|
@ -362,7 +362,8 @@ _forecasts_config_item_get(const char *id)
|
||||||
ci->host = evas_stringshare_add("xml.weather.yahoo.com");
|
ci->host = evas_stringshare_add("xml.weather.yahoo.com");
|
||||||
ci->code = evas_stringshare_add("BUXX0005");
|
ci->code = evas_stringshare_add("BUXX0005");
|
||||||
ci->show_text = 1;
|
ci->show_text = 1;
|
||||||
|
ci->popup_on_hover = 1;
|
||||||
|
|
||||||
forecasts_config->items = evas_list_append(forecasts_config->items, ci);
|
forecasts_config->items = evas_list_append(forecasts_config->items, ci);
|
||||||
return ci;
|
return ci;
|
||||||
}
|
}
|
||||||
|
@ -393,6 +394,7 @@ e_modapi_init(E_Module * m)
|
||||||
E_CONFIG_VAL(D, T, host, STR);
|
E_CONFIG_VAL(D, T, host, STR);
|
||||||
E_CONFIG_VAL(D, T, code, STR);
|
E_CONFIG_VAL(D, T, code, STR);
|
||||||
E_CONFIG_VAL(D, T, show_text, INT);
|
E_CONFIG_VAL(D, T, show_text, INT);
|
||||||
|
E_CONFIG_VAL(D, T, popup_on_hover, INT);
|
||||||
|
|
||||||
conf_edd = E_CONFIG_DD_NEW("Forecasts_Config", Config);
|
conf_edd = E_CONFIG_DD_NEW("Forecasts_Config", Config);
|
||||||
#undef T
|
#undef T
|
||||||
|
@ -415,6 +417,7 @@ e_modapi_init(E_Module * m)
|
||||||
ci->code = evas_stringshare_add("BUXX0005");
|
ci->code = evas_stringshare_add("BUXX0005");
|
||||||
ci->id = evas_stringshare_add("0");
|
ci->id = evas_stringshare_add("0");
|
||||||
ci->show_text = 1;
|
ci->show_text = 1;
|
||||||
|
ci->popup_on_hover = 1;
|
||||||
|
|
||||||
forecasts_config->items = evas_list_append(forecasts_config->items, ci);
|
forecasts_config->items = evas_list_append(forecasts_config->items, ci);
|
||||||
}
|
}
|
||||||
|
@ -646,7 +649,7 @@ _forecasts_parse(void *data)
|
||||||
char city[256];
|
char city[256];
|
||||||
char region[256];
|
char region[256];
|
||||||
char location[512];
|
char location[512];
|
||||||
int visibility;
|
float visibility;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
inst = data;
|
inst = data;
|
||||||
|
@ -694,7 +697,7 @@ _forecasts_parse(void *data)
|
||||||
sscanf(needle, "\"%3[^\"]\"", inst->units.speed);
|
sscanf(needle, "\"%3[^\"]\"", inst->units.speed);
|
||||||
|
|
||||||
/* Current conditions */
|
/* Current conditions */
|
||||||
needle = strstr(inst->buffer, "<yweather:condition text=");
|
needle = strstr(inst->buffer, "<yweather:condition text=");
|
||||||
if (!needle) goto error;
|
if (!needle) goto error;
|
||||||
needle = strstr(needle, "\"");
|
needle = strstr(needle, "\"");
|
||||||
sscanf(needle, "\"%255[^\"]\"", inst->condition.desc);
|
sscanf(needle, "\"%255[^\"]\"", inst->condition.desc);
|
||||||
|
@ -734,8 +737,8 @@ _forecasts_parse(void *data)
|
||||||
needle = strstr(needle, "visibility=\"");
|
needle = strstr(needle, "visibility=\"");
|
||||||
if (!needle) goto error;
|
if (!needle) goto error;
|
||||||
needle = strstr(needle, "\"");
|
needle = strstr(needle, "\"");
|
||||||
sscanf(needle, "\"%d\"", &visibility);
|
sscanf(needle, "\"%f\"", &visibility);
|
||||||
inst->details.atmosphere.visibility = (float) visibility / 100;
|
inst->details.atmosphere.visibility = visibility;
|
||||||
needle = strstr(needle, "pressure=\"");
|
needle = strstr(needle, "pressure=\"");
|
||||||
if (!needle) goto error;
|
if (!needle) goto error;
|
||||||
needle = strstr(needle, "\"");
|
needle = strstr(needle, "\"");
|
||||||
|
@ -1068,13 +1071,19 @@ _forecasts_popup_destroy(Instance *inst)
|
||||||
e_object_del(E_OBJECT(inst->popup));
|
e_object_del(E_OBJECT(inst->popup));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
{
|
{
|
||||||
Instance *inst;
|
Instance *inst;
|
||||||
Evas_Event_Mouse_Down *ev;
|
Evas_Event_Mouse_Down *ev;
|
||||||
|
|
||||||
inst = data;
|
if (!(inst = data)) return;
|
||||||
|
if (!inst->ci->popup_on_hover)
|
||||||
|
{
|
||||||
|
e_gadcon_popup_show(inst->popup);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ev = event_info;
|
ev = event_info;
|
||||||
if (ev->button == 1)
|
if (ev->button == 1)
|
||||||
{
|
{
|
||||||
|
@ -1086,17 +1095,21 @@ static void
|
||||||
_cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
_cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
{
|
{
|
||||||
Instance *inst;
|
Instance *inst;
|
||||||
|
|
||||||
if (!(inst = data)) return;
|
if (!(inst = data)) return;
|
||||||
|
if (!inst->ci->popup_on_hover) return;
|
||||||
|
|
||||||
e_gadcon_popup_show(inst->popup);
|
e_gadcon_popup_show(inst->popup);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
_cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
{
|
{
|
||||||
Instance *inst;
|
Instance *inst;
|
||||||
|
|
||||||
if (!(inst = data)) return;
|
if (!(inst = data)) return;
|
||||||
|
|
||||||
|
if (inst->popup->pinned) return;
|
||||||
e_gadcon_popup_hide(inst->popup);
|
e_gadcon_popup_hide(inst->popup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ struct _Config_Item
|
||||||
int degrees;
|
int degrees;
|
||||||
const char *host, *code;
|
const char *host, *code;
|
||||||
int show_text;
|
int show_text;
|
||||||
|
int popup_on_hover;
|
||||||
};
|
};
|
||||||
|
|
||||||
EAPI extern E_Module_Api e_modapi;
|
EAPI extern E_Module_Api e_modapi;
|
||||||
|
|
Loading…
Reference in New Issue