Hello,

Some short while ago the forecasts module ceased to function properly.
Seems yahoo has changed their xml output ever so slightly.  Either of
the patches attached will fix this.

The difference between the two patches is as follows:

new_xml_format.diff: simply takes into account the new format, and gets
the module back up on its feet.

new_xml_format_plus.diff: handles the new format AND adds a new option
which allows a person to choose if the forecast popup is realized on a
mouse over, or a mouse click.  (I prefer a mouse click)

I'm hoping the new_xml_format_plus.diff is allowed to go in.  I think
others will benefit as well.  Though admittedly my motivation is selfish
here, as I get tired of applying the patch to my own copy. :)

-- 
Regards,
Ravenlock

Index: e_mod_main.c
===================================================================
RCS file: /cvs/e/e_modules/forecasts/e_mod_main.c,v
retrieving revision 1.14
diff -u -r1.14 e_mod_main.c
--- e_mod_main.c	12 Nov 2007 04:15:51 -0000	1.14
+++ e_mod_main.c	21 Dec 2007 05:43:16 -0000
@@ -646,7 +646,7 @@
    char city[256];
    char region[256];
    char location[512];
-   int  visibility;
+   float  visibility;
    int  i;
 
    inst = data;
@@ -694,7 +694,7 @@
    sscanf(needle, "\"%3[^\"]\"", inst->units.speed);
 
    /* Current conditions */
-   needle = strstr(inst->buffer, "<yweather:condition text=");
+   needle = strstr(inst->buffer, "<yweather:condition  text=");
    if (!needle) goto error;
    needle = strstr(needle, "\"");
    sscanf(needle, "\"%255[^\"]\"", inst->condition.desc);
@@ -734,8 +734,8 @@
    needle = strstr(needle, "visibility=\"");
    if (!needle) goto error;
    needle = strstr(needle, "\"");
-   sscanf(needle, "\"%d\"", &visibility);
-   inst->details.atmosphere.visibility = (float) visibility / 100;
+   sscanf(needle, "\"%f\"", &visibility);
+   inst->details.atmosphere.visibility = visibility;
    needle = strstr(needle, "pressure=\"");
    if (!needle) goto error;
    needle = strstr(needle, "\"");
@@ -754,7 +754,7 @@
    if (!needle) goto error;
    needle = strstr(needle, "\"");
    sscanf(needle, "\"%8[^\"]\"", inst->details.astronomy.sunset);
-
+   
    /* Forecasts */
    for (i = 0; i < FORECASTS; i++) 
      {
Index: e_mod_main.c
===================================================================
RCS file: /cvs/e/e_modules/forecasts/e_mod_main.c,v
retrieving revision 1.14
diff -u -r1.14 e_mod_main.c
--- e_mod_main.c	12 Nov 2007 04:15:51 -0000	1.14
+++ e_mod_main.c	21 Dec 2007 05:50:19 -0000
@@ -362,7 +362,8 @@
    ci->host = evas_stringshare_add("xml.weather.yahoo.com");
    ci->code = evas_stringshare_add("BUXX0005");
    ci->show_text = 1;
-
+   ci->popup_on_hover = 1;
+   
    forecasts_config->items = evas_list_append(forecasts_config->items, ci);
    return ci;
 }
@@ -393,6 +394,7 @@
    E_CONFIG_VAL(D, T, host, STR);
    E_CONFIG_VAL(D, T, code, STR);
    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);
 #undef T
@@ -415,6 +417,7 @@
 	ci->code = evas_stringshare_add("BUXX0005");
 	ci->id = evas_stringshare_add("0");
 	ci->show_text = 1;
+	ci->popup_on_hover = 1;
 
 	forecasts_config->items = evas_list_append(forecasts_config->items, ci);
      }
@@ -646,7 +649,7 @@
    char city[256];
    char region[256];
    char location[512];
-   int  visibility;
+   float visibility;
    int  i;
 
    inst = data;
@@ -694,7 +697,7 @@
    sscanf(needle, "\"%3[^\"]\"", inst->units.speed);
 
    /* Current conditions */
-   needle = strstr(inst->buffer, "<yweather:condition text=");
+   needle = strstr(inst->buffer, "<yweather:condition  text=");
    if (!needle) goto error;
    needle = strstr(needle, "\"");
    sscanf(needle, "\"%255[^\"]\"", inst->condition.desc);
@@ -734,8 +737,8 @@
    needle = strstr(needle, "visibility=\"");
    if (!needle) goto error;
    needle = strstr(needle, "\"");
-   sscanf(needle, "\"%d\"", &visibility);
-   inst->details.atmosphere.visibility = (float) visibility / 100;
+   sscanf(needle, "\"%f\"", &visibility);
+   inst->details.atmosphere.visibility = visibility;
    needle = strstr(needle, "pressure=\"");
    if (!needle) goto error;
    needle = strstr(needle, "\"");
@@ -1068,13 +1071,19 @@
    e_object_del(E_OBJECT(inst->popup));
 }
 
-static void 
+static void
 _cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
 {
    Instance *inst;
    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;
    if (ev->button == 1)
      {
@@ -1086,17 +1095,21 @@
 _cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info)
 {
    Instance *inst;
- 
+
    if (!(inst = data)) return;
+   if (!inst->ci->popup_on_hover) return;
+
    e_gadcon_popup_show(inst->popup);
 }
 
-static void 
+static void
 _cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info)
 {
    Instance *inst;
-   
+
    if (!(inst = data)) return;
+
+   if (inst->popup->pinned) return;
    e_gadcon_popup_hide(inst->popup);
 }
 

Attachment: signature.asc
Description: OpenPGP digital signature

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to