Enlightenment CVS committal

Author  : devilhorns
Project : e_modules
Module  : weather

Dir     : e_modules/weather


Modified Files:
        e_mod_main.c 


Log Message:
Short text string.
Fix segv onefang "found", sorry :(
Code cleanup in display_set

===================================================================
RCS file: /cvsroot/enlightenment/e_modules/weather/e_mod_main.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- e_mod_main.c        20 Mar 2006 00:54:07 -0000      1.8
+++ e_mod_main.c        20 Mar 2006 03:16:49 -0000      1.9
@@ -226,9 +226,9 @@
        char *p;
        int port = 0;
        
-       host = strchr(env, ',');
+       host = strchr(env, ':');
        host += 3;
-       p = strchr(host, '.');
+       p = strchr(host, ':');
        if (p) 
          {
             *p = 0;
@@ -603,8 +603,17 @@
      {
        needle = strstr(needle, ">");
        sscanf(needle, ">%[^<]<", wf->location);
+       if (wf->location) 
+         {
+            char *tmp = strdup(wf->location);
+            if (strstr(tmp, ",")) 
+              {
+                 tmp = strtok(tmp, ",");
+                 snprintf(wf->location, sizeof(wf->location), "%s", tmp);
+              }  
+         }
      }
-   
+      
    needle = strstr(wf->buffer, "<content:encoded>");
    if (!needle)
      goto error;
@@ -675,39 +684,22 @@
    if (!wf)
      return;
 
-   /* If _get_weather fails, blank out text and set icon to unknown */
+   e_icon_file_set(wf->icon_obj, PACKAGE_DATA_DIR "/images/na.png");
+   edje_object_part_swallow(wf->weather_obj, "icon", wf->icon_obj);
+   edje_object_part_text_set(wf->weather_obj, "location", wf->location);
+   
+   if (wf->conf->display == DETAILED_DISPLAY)
+     edje_object_signal_emit(wf->weather_obj, "set_style", "detailed");
+   else
+     edje_object_signal_emit(wf->weather_obj, "set_style", "simple");
+   
    if (!ok)
      {
-        e_icon_file_set(wf->icon_obj, PACKAGE_DATA_DIR "/images/na.png");
-        edje_object_part_swallow(wf->weather_obj, "icon", wf->icon_obj);
-        edje_object_part_text_set(wf->weather_obj, "location", wf->location);
         edje_object_part_text_set(wf->weather_obj, "temp", "");
         edje_object_part_text_set(wf->weather_obj, "conditions", "");
-        if (wf->conf->display == DETAILED_DISPLAY)
-         edje_object_signal_emit(wf->weather_obj, "set_style", "detailed");
-        else
-         edje_object_signal_emit(wf->weather_obj, "set_style", "simple");
-     }
-   else if (wf->conf->display == DETAILED_DISPLAY)
-     {
-        /* Detailed display */
-        edje_object_signal_emit(wf->weather_obj, "set_style", "detailed");
-        snprintf(buf, sizeof(buf), PACKAGE_DATA_DIR "/images/%s", wf->icon);
-        e_icon_file_set(wf->icon_obj, buf);
-        edje_object_part_swallow(wf->weather_obj, "icon", wf->icon_obj);
-        edje_object_part_text_set(wf->weather_obj, "location", wf->location);
-        snprintf(buf, sizeof(buf), "%d°%c", wf->temp, wf->degrees);
-        edje_object_part_text_set(wf->weather_obj, "temp", buf);
-        edje_object_part_text_set(wf->weather_obj, "conditions", 
wf->conditions);
      }
-   else
+   else 
      {
-        /* Simple display */
-        edje_object_signal_emit(wf->weather_obj, "set_style", "simple");
-        snprintf(buf, sizeof(buf), PACKAGE_DATA_DIR "/images/%s", wf->icon);
-        e_icon_file_set(wf->icon_obj, buf);
-        edje_object_part_swallow(wf->weather_obj, "icon", wf->icon_obj);
-        edje_object_part_text_set(wf->weather_obj, "location", wf->location);
         snprintf(buf, sizeof(buf), "%d°%c",wf->temp, wf->degrees);
         edje_object_part_text_set(wf->weather_obj, "temp", buf);
         edje_object_part_text_set(wf->weather_obj, "conditions", 
wf->conditions);




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to