Enlightenment CVS committal
Author : devilhorns
Project : e_modules
Module : weather
Dir : e_modules/weather
Modified Files:
e_mod_config.c e_mod_main.c
Log Message:
Indent
===================================================================
RCS file: /cvs/e/e_modules/weather/e_mod_config.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- e_mod_config.c 17 Jul 2006 23:35:09 -0000 1.15
+++ e_mod_config.c 18 Jul 2006 00:02:47 -0000 1.16
@@ -3,142 +3,150 @@
struct _E_Config_Dialog_Data
{
- double poll_time;
- int display;
- int degrees;
- char *code;
+ double poll_time;
+ int display;
+ int degrees;
+ char *code;
};
-static void *_create_data(E_Config_Dialog *cfd);
-static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
-static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas,
E_Config_Dialog_Data *cfdata);
-static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data
*cfdata);
-static void _fill_data(Config_Item *ci, E_Config_Dialog_Data *cfdata);
+static void *_create_data (E_Config_Dialog * cfd);
+static void _free_data (E_Config_Dialog * cfd, E_Config_Dialog_Data * cfdata);
+static Evas_Object *_basic_create_widgets (E_Config_Dialog * cfd, Evas * evas,
+ E_Config_Dialog_Data * cfdata);
+static int _basic_apply_data (E_Config_Dialog * cfd,
+ E_Config_Dialog_Data * cfdata);
+static void _fill_data (Config_Item * ci, E_Config_Dialog_Data * cfdata);
void
-_config_weather_module(Config_Item *ci)
+_config_weather_module (Config_Item * ci)
{
- E_Config_Dialog *cfd;
- E_Config_Dialog_View *v;
- E_Container *con;
- char buf[4096];
-
- v = E_NEW(E_Config_Dialog_View, 1);
-
- v->create_cfdata = _create_data;
- v->free_cfdata = _free_data;
- v->basic.apply_cfdata = _basic_apply_data;
- v->basic.create_widgets = _basic_create_widgets;
- v->override_auto_apply = 1;
-
- snprintf(buf, sizeof(buf), "%s/module.eap",
e_module_dir_get(weather_config->module));
- con = e_container_current_get(e_manager_current_get());
- cfd = e_config_dialog_new(con, D_("Weather Configuration"), buf, 0, v, ci);
- weather_config->config_dialog = cfd;
+ E_Config_Dialog *cfd;
+ E_Config_Dialog_View *v;
+ E_Container *con;
+ char buf[4096];
+
+ v = E_NEW (E_Config_Dialog_View, 1);
+
+ v->create_cfdata = _create_data;
+ v->free_cfdata = _free_data;
+ v->basic.apply_cfdata = _basic_apply_data;
+ v->basic.create_widgets = _basic_create_widgets;
+ v->override_auto_apply = 1;
+
+ snprintf (buf, sizeof (buf), "%s/module.eap",
+ e_module_dir_get (weather_config->module));
+ con = e_container_current_get (e_manager_current_get ());
+ cfd =
+ e_config_dialog_new (con, D_ ("Weather Configuration"), buf, 0, v, ci);
+ weather_config->config_dialog = cfd;
}
static void
-_fill_data(Config_Item *ci, E_Config_Dialog_Data *cfdata)
+_fill_data (Config_Item * ci, E_Config_Dialog_Data * cfdata)
{
- cfdata->poll_time = (ci->poll_time / 60.0);
- cfdata->display = ci->display;
- cfdata->degrees = ci->degrees;
- if (ci->code)
- cfdata->code = strdup(ci->code);
+ cfdata->poll_time = (ci->poll_time / 60.0);
+ cfdata->display = ci->display;
+ cfdata->degrees = ci->degrees;
+ if (ci->code)
+ cfdata->code = strdup (ci->code);
}
static void *
-_create_data(E_Config_Dialog *cfd)
+_create_data (E_Config_Dialog * cfd)
{
- E_Config_Dialog_Data *cfdata;
- Config_Item *ci;
+ E_Config_Dialog_Data *cfdata;
+ Config_Item *ci;
- ci = cfd->data;
- cfdata = E_NEW(E_Config_Dialog_Data, 1);
+ ci = cfd->data;
+ cfdata = E_NEW (E_Config_Dialog_Data, 1);
- _fill_data(ci, cfdata);
- return cfdata;
+ _fill_data (ci, cfdata);
+ return cfdata;
}
static void
-_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
+_free_data (E_Config_Dialog * cfd, E_Config_Dialog_Data * cfdata)
{
- if (!weather_config)
- return;
+ if (!weather_config)
+ return;
- weather_config->config_dialog = NULL;
- free(cfdata);
- cfdata = NULL;
+ weather_config->config_dialog = NULL;
+ free (cfdata);
+ cfdata = NULL;
}
static Evas_Object *
-_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
*cfdata)
+_basic_create_widgets (E_Config_Dialog * cfd, Evas * evas,
+ E_Config_Dialog_Data * cfdata)
{
- Evas_Object *o, *of, *ob;
- E_Radio_Group *rg, *dg;
+ Evas_Object *o, *of, *ob;
+ E_Radio_Group *rg, *dg;
- o = e_widget_list_add(evas, 0, 0);
- of = e_widget_framelist_add(evas, D_("Display Settings"), 0);
- rg = e_widget_radio_group_new(&(cfdata->display));
- ob = e_widget_radio_add(evas, D_("Simple"), 0, rg);
- e_widget_framelist_object_append(of, ob);
- ob = e_widget_radio_add(evas, D_("Detailed"), 1, rg);
- e_widget_framelist_object_append(of, ob);
- ob = e_widget_label_add(evas, D_("Poll Time"));
- e_widget_framelist_object_append(of, ob);
- ob = e_widget_slider_add(evas, 1, 0, D_("%2.0f minutes"), 15.0, 60.0, 1.0,
0, &(cfdata->poll_time), NULL, 40);
- e_widget_framelist_object_append(of, ob);
- e_widget_list_object_append(o, of, 1, 1, 0.5);
-
- of = e_widget_framelist_add(evas, D_("Degree Settings"), 0);
- dg = e_widget_radio_group_new(&(cfdata->degrees));
- ob = e_widget_radio_add(evas, D_("Celsius"), DEGREES_C, dg);
- e_widget_framelist_object_append(of, ob);
- ob = e_widget_radio_add(evas, D_("Farenheit"), DEGREES_F, dg);
- e_widget_framelist_object_append(of, ob);
- e_widget_list_object_append(o, of, 1, 1, 0.5);
-
- of = e_widget_frametable_add(evas, D_("ICAO Code"), 0);
- ob = e_widget_label_add(evas, D_("ICAO Code"));
- e_widget_frametable_object_append(of, ob, 0, 0, 1, 1, 1, 0, 1, 0);
- ob = e_widget_entry_add(evas, &cfdata->code);
- e_widget_min_size_set(ob, 100, 1);
- e_widget_frametable_object_append(of, ob, 1, 0, 1, 1, 1, 0, 1, 0);
- ob = e_widget_label_add(evas, D_("Get your ICAO code at:"));
- e_widget_frametable_object_append(of, ob, 0, 1, 1, 1, 1, 0, 1, 0);
- ob = e_widget_label_add(evas,
D_("http://www.weather.gov/tg/siteloc.shtml"));
- e_widget_frametable_object_append(of, ob, 0, 2, 2, 1, 1, 0, 1, 0);
- e_widget_list_object_append(o, of, 1, 1, 0.5);
+ o = e_widget_list_add (evas, 0, 0);
+ of = e_widget_framelist_add (evas, D_ ("Display Settings"), 0);
+ rg = e_widget_radio_group_new (&(cfdata->display));
+ ob = e_widget_radio_add (evas, D_ ("Simple"), 0, rg);
+ e_widget_framelist_object_append (of, ob);
+ ob = e_widget_radio_add (evas, D_ ("Detailed"), 1, rg);
+ e_widget_framelist_object_append (of, ob);
+ ob = e_widget_label_add (evas, D_ ("Poll Time"));
+ e_widget_framelist_object_append (of, ob);
+ ob =
+ e_widget_slider_add (evas, 1, 0, D_ ("%2.0f minutes"), 15.0, 60.0, 1.0, 0,
+ &(cfdata->poll_time), NULL, 40);
+ e_widget_framelist_object_append (of, ob);
+ e_widget_list_object_append (o, of, 1, 1, 0.5);
+
+ of = e_widget_framelist_add (evas, D_ ("Degree Settings"), 0);
+ dg = e_widget_radio_group_new (&(cfdata->degrees));
+ ob = e_widget_radio_add (evas, D_ ("Celsius"), DEGREES_C, dg);
+ e_widget_framelist_object_append (of, ob);
+ ob = e_widget_radio_add (evas, D_ ("Farenheit"), DEGREES_F, dg);
+ e_widget_framelist_object_append (of, ob);
+ e_widget_list_object_append (o, of, 1, 1, 0.5);
+
+ of = e_widget_frametable_add (evas, D_ ("ICAO Code"), 0);
+ ob = e_widget_label_add (evas, D_ ("ICAO Code"));
+ e_widget_frametable_object_append (of, ob, 0, 0, 1, 1, 1, 0, 1, 0);
+ ob = e_widget_entry_add (evas, &cfdata->code);
+ e_widget_min_size_set (ob, 100, 1);
+ e_widget_frametable_object_append (of, ob, 1, 0, 1, 1, 1, 0, 1, 0);
+ ob = e_widget_label_add (evas, D_ ("Get your ICAO code at:"));
+ e_widget_frametable_object_append (of, ob, 0, 1, 1, 1, 1, 0, 1, 0);
+ ob =
+ e_widget_label_add (evas, D_ ("http://www.weather.gov/tg/siteloc.shtml"));
+ e_widget_frametable_object_append (of, ob, 0, 2, 2, 1, 1, 0, 1, 0);
+ e_widget_list_object_append (o, of, 1, 1, 0.5);
- return o;
+ return o;
}
static int
-_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
+_basic_apply_data (E_Config_Dialog * cfd, E_Config_Dialog_Data * cfdata)
{
- Config_Item *ci;
- int len;
+ Config_Item *ci;
+ int len;
- ci = cfd->data;
- if (!cfdata->code)
- return 0;
-
- len = strlen(cfdata->code);
- if (len < 4 || len > 4)
- return 0;
-
- ci->display = cfdata->display;
- ci->degrees = cfdata->degrees;
- ci->poll_time = (cfdata->poll_time * 60.0);
- if (ci->code)
- evas_stringshare_del(ci->code);
-
- char *t;
- t = strdup(cfdata->code);
- *t = toupper(*t);
- ci->code = evas_stringshare_add(t);
-
- e_config_save_queue();
- _weather_config_updated(ci->id);
- return 1;
+ ci = cfd->data;
+ if (!cfdata->code)
+ return 0;
+
+ len = strlen (cfdata->code);
+ if (len < 4 || len > 4)
+ return 0;
+
+ ci->display = cfdata->display;
+ ci->degrees = cfdata->degrees;
+ ci->poll_time = (cfdata->poll_time * 60.0);
+ if (ci->code)
+ evas_stringshare_del (ci->code);
+
+ char *t;
+ t = strdup (cfdata->code);
+ *t = toupper (*t);
+ ci->code = evas_stringshare_add (t);
+
+ e_config_save_queue ();
+ _weather_config_updated (ci->id);
+ return 1;
}
===================================================================
RCS file: /cvs/e/e_modules/weather/e_mod_main.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -3 -r1.41 -r1.42
--- e_mod_main.c 17 Jul 2006 23:35:09 -0000 1.41
+++ e_mod_main.c 18 Jul 2006 00:02:47 -0000 1.42
@@ -2,11 +2,12 @@
#include "e_mod_main.h"
/* Gadcon Function Protos */
-static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char
*id, const char *style);
-static void _gc_shutdown(E_Gadcon_Client *gcc);
-static void _gc_orient(E_Gadcon_Client *gcc);
-static char *_gc_label(void);
-static Evas_Object *_gc_icon(Evas *evas);
+static E_Gadcon_Client *_gc_init (E_Gadcon * gc, const char *name,
+ const char *id, const char *style);
+static void _gc_shutdown (E_Gadcon_Client * gcc);
+static void _gc_orient (E_Gadcon_Client * gcc);
+static char *_gc_label (void);
+static Evas_Object *_gc_icon (Evas * evas);
static E_Config_DD *conf_edd = NULL;
static E_Config_DD *conf_item_edd = NULL;
@@ -15,8 +16,8 @@
/* Define Gadcon Class */
static const E_Gadcon_Client_Class _gadcon_class = {
- GADCON_CLIENT_CLASS_VERSION,
- "weather", {_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon}
+ GADCON_CLIENT_CLASS_VERSION,
+ "weather", {_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon}
};
/* Module specifics */
@@ -25,632 +26,705 @@
struct _Instance
{
- E_Gadcon_Client *gcc;
- Evas_Object *weather_obj;
- Weather *weather;
- Ecore_Timer *check_timer;
- Ecore_Con_Server *server;
- Ecore_Event_Handler *add_handler;
- Ecore_Event_Handler *del_handler;
- Ecore_Event_Handler *data_handler;
-
- char *buffer, *location;
- int bufsize, cursize;
- int temp, loc_set;
- char degrees;
- char conditions[256];
- char icon[256];
+ E_Gadcon_Client *gcc;
+ Evas_Object *weather_obj;
+ Weather *weather;
+ Ecore_Timer *check_timer;
+ Ecore_Con_Server *server;
+ Ecore_Event_Handler *add_handler;
+ Ecore_Event_Handler *del_handler;
+ Ecore_Event_Handler *data_handler;
+
+ char *buffer, *location;
+ int bufsize, cursize;
+ int temp, loc_set;
+ char degrees;
+ char conditions[256];
+ char icon[256];
};
struct _Weather
{
- Instance *inst;
- Evas_Object *weather_obj;
- Evas_Object *icon_obj;
+ Instance *inst;
+ Evas_Object *weather_obj;
+ Evas_Object *icon_obj;
};
/* Module Function Protos */
-static void _weather_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void
*event_info);
-static void _weather_menu_cb_configure(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _weather_menu_cb_post(void *data, E_Menu *m);
-static int _weather_cb_check(void *data);
-static Config_Item *_weather_config_item_get(const char *id);
-static Weather *_weather_new(Evas *evas);
-static void _weather_free(Weather *w);
-static void _weather_get_proxy(Config_Item *ci);
-static int _weather_server_add(void *data, int type, void *event);
-static int _weather_server_del(void *data, int type, void *event);
-static int _weather_server_data(void *data, int type, void *event);
-static int _weather_parse(void *data);
-static void _weather_display_set(Instance *inst, int ok);
+static void _weather_cb_mouse_down (void *data, Evas * e, Evas_Object * obj,
+ void *event_info);
+static void _weather_menu_cb_configure (void *data, E_Menu * m,
+ E_Menu_Item * mi);
+static void _weather_menu_cb_post (void *data, E_Menu * m);
+static int _weather_cb_check (void *data);
+static Config_Item *_weather_config_item_get (const char *id);
+static Weather *_weather_new (Evas * evas);
+static void _weather_free (Weather * w);
+static void _weather_get_proxy (Config_Item * ci);
+static int _weather_server_add (void *data, int type, void *event);
+static int _weather_server_del (void *data, int type, void *event);
+static int _weather_server_data (void *data, int type, void *event);
+static int _weather_parse (void *data);
+static void _weather_display_set (Instance * inst, int ok);
/* Gadcon Functions */
static E_Gadcon_Client *
-_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
+_gc_init (E_Gadcon * gc, const char *name, const char *id, const char *style)
{
- Evas_Object *o;
- E_Gadcon_Client *gcc;
- Weather *w;
- Instance *inst;
- Config_Item *ci;
-
- inst = E_NEW(Instance, 1);
-
- ci = _weather_config_item_get(id);
-
- w = _weather_new(gc->evas);
- w->inst = inst;
- inst->weather = w;
-
- o = w->weather_obj;
- gcc = e_gadcon_client_new(gc, name, id, style, o);
- gcc->data = inst;
- inst->gcc = gcc;
- inst->weather_obj = o;
-
- if (!inst->add_handler)
- inst->add_handler = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD,
_weather_server_add, inst);
- if (!inst->del_handler)
- inst->del_handler = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL,
_weather_server_del, inst);
- if (!inst->data_handler)
- inst->data_handler =
ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA, _weather_server_data,
inst);
-
- evas_object_event_callback_add(w->weather_obj, EVAS_CALLBACK_MOUSE_DOWN,
_weather_cb_mouse_down, inst);
- weather_config->instances = evas_list_append(weather_config->instances,
inst);
-
- if (ci->display == 0)
- edje_object_signal_emit(inst->weather->weather_obj, "set_style",
"simple");
- else
- edje_object_signal_emit(inst->weather->weather_obj, "set_style",
"detailed");
-
- _weather_cb_check(inst);
- inst->check_timer = ecore_timer_add((double)ci->poll_time,
_weather_cb_check, inst);
- return gcc;
+ Evas_Object *o;
+ E_Gadcon_Client *gcc;
+ Weather *w;
+ Instance *inst;
+ Config_Item *ci;
+
+ inst = E_NEW (Instance, 1);
+
+ ci = _weather_config_item_get (id);
+
+ w = _weather_new (gc->evas);
+ w->inst = inst;
+ inst->weather = w;
+
+ o = w->weather_obj;
+ gcc = e_gadcon_client_new (gc, name, id, style, o);
+ gcc->data = inst;
+ inst->gcc = gcc;
+ inst->weather_obj = o;
+
+ if (!inst->add_handler)
+ inst->add_handler =
+ ecore_event_handler_add (ECORE_CON_EVENT_SERVER_ADD,
+ _weather_server_add, inst);
+ if (!inst->del_handler)
+ inst->del_handler =
+ ecore_event_handler_add (ECORE_CON_EVENT_SERVER_DEL,
+ _weather_server_del, inst);
+ if (!inst->data_handler)
+ inst->data_handler =
+ ecore_event_handler_add (ECORE_CON_EVENT_SERVER_DATA,
+ _weather_server_data, inst);
+
+ evas_object_event_callback_add (w->weather_obj, EVAS_CALLBACK_MOUSE_DOWN,
+ _weather_cb_mouse_down, inst);
+ weather_config->instances =
+ evas_list_append (weather_config->instances, inst);
+
+ if (ci->display == 0)
+ edje_object_signal_emit (inst->weather->weather_obj, "set_style",
+ "simple");
+ else
+ edje_object_signal_emit (inst->weather->weather_obj, "set_style",
+ "detailed");
+
+ _weather_cb_check (inst);
+ inst->check_timer =
+ ecore_timer_add ((double) ci->poll_time, _weather_cb_check, inst);
+ return gcc;
}
static void
-_gc_shutdown(E_Gadcon_Client *gcc)
+_gc_shutdown (E_Gadcon_Client * gcc)
{
- Instance *inst;
- Weather *w;
-
- inst = gcc->data;
- w = inst->weather;
-
- if (inst->check_timer) ecore_timer_del(inst->check_timer);
- if (inst->add_handler) ecore_event_handler_del(inst->add_handler);
- if (inst->data_handler) ecore_event_handler_del(inst->data_handler);
- if (inst->del_handler) ecore_event_handler_del(inst->del_handler);
- if (inst->server) ecore_con_server_del(inst->server);
-
- inst->server = NULL;
- weather_config->instances = evas_list_remove(weather_config->instances,
inst);
-
- evas_object_event_callback_del(w->weather_obj, EVAS_CALLBACK_MOUSE_DOWN,
_weather_cb_mouse_down);
-
- _weather_free(w);
- free(inst);
- inst = NULL;
+ Instance *inst;
+ Weather *w;
+
+ inst = gcc->data;
+ w = inst->weather;
+
+ if (inst->check_timer)
+ ecore_timer_del (inst->check_timer);
+ if (inst->add_handler)
+ ecore_event_handler_del (inst->add_handler);
+ if (inst->data_handler)
+ ecore_event_handler_del (inst->data_handler);
+ if (inst->del_handler)
+ ecore_event_handler_del (inst->del_handler);
+ if (inst->server)
+ ecore_con_server_del (inst->server);
+
+ inst->server = NULL;
+ weather_config->instances =
+ evas_list_remove (weather_config->instances, inst);
+
+ evas_object_event_callback_del (w->weather_obj, EVAS_CALLBACK_MOUSE_DOWN,
+ _weather_cb_mouse_down);
+
+ _weather_free (w);
+ free (inst);
+ inst = NULL;
}
static void
-_gc_orient(E_Gadcon_Client *gcc)
+_gc_orient (E_Gadcon_Client * gcc)
{
- Instance *inst;
+ Instance *inst;
- inst = gcc->data;
- e_gadcon_client_aspect_set(gcc, 16, 16);
- e_gadcon_client_min_size_set(gcc, 16, 16);
+ inst = gcc->data;
+ e_gadcon_client_aspect_set (gcc, 16, 16);
+ e_gadcon_client_min_size_set (gcc, 16, 16);
}
static char *
-_gc_label(void)
+_gc_label (void)
{
- return D_("Weather");
+ return D_ ("Weather");
}
static Evas_Object *
-_gc_icon(Evas *evas)
+_gc_icon (Evas * evas)
{
- Evas_Object *o;
- char buf[4096];
+ Evas_Object *o;
+ char buf[4096];
- o = edje_object_add(evas);
- snprintf(buf, sizeof(buf), "%s/module.eap",
e_module_dir_get(weather_config->module));
- edje_object_file_set(o, buf, "icon");
- return o;
+ o = edje_object_add (evas);
+ snprintf (buf, sizeof (buf), "%s/module.eap",
+ e_module_dir_get (weather_config->module));
+ edje_object_file_set (o, buf, "icon");
+ return o;
}
static void
-_weather_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
+_weather_cb_mouse_down (void *data, Evas * e, Evas_Object * obj,
+ void *event_info)
{
- Instance *inst;
- Evas_Event_Mouse_Down *ev;
+ Instance *inst;
+ Evas_Event_Mouse_Down *ev;
- inst = data;
- ev = event_info;
- if ((ev->button == 3) && (!weather_config->menu))
- {
- E_Menu *mn;
- E_Menu_Item *mi;
- int x, y, w, h;
-
- mn = e_menu_new();
- e_menu_post_deactivate_callback_set(mn, _weather_menu_cb_post, inst);
- weather_config->menu = mn;
-
- mi = e_menu_item_new(mn);
- e_menu_item_label_set(mi, D_("Configuration"));
- e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration");
- e_menu_item_callback_set(mi, _weather_menu_cb_configure, inst);
-
- mi = e_menu_item_new(mn);
- e_menu_item_separator_set(mi, 1);
-
- e_gadcon_client_util_menu_items_append(inst->gcc, mn, 0);
- e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &x, &y, &w, &h);
- e_menu_activate_mouse(mn,
e_util_zone_current_get(e_manager_current_get()),
- x + ev->output.x, y + ev->output.y, 1, 1,
E_MENU_POP_DIRECTION_DOWN, ev->timestamp);
- evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button,
EVAS_BUTTON_NONE, ev->timestamp, NULL);
- }
+ inst = data;
+ ev = event_info;
+ if ((ev->button == 3) && (!weather_config->menu))
+ {
+ E_Menu *mn;
+ E_Menu_Item *mi;
+ int x, y, w, h;
+
+ mn = e_menu_new ();
+ e_menu_post_deactivate_callback_set (mn, _weather_menu_cb_post, inst);
+ weather_config->menu = mn;
+
+ mi = e_menu_item_new (mn);
+ e_menu_item_label_set (mi, D_ ("Configuration"));
+ e_util_menu_item_edje_icon_set (mi, "enlightenment/configuration");
+ e_menu_item_callback_set (mi, _weather_menu_cb_configure, inst);
+
+ mi = e_menu_item_new (mn);
+ e_menu_item_separator_set (mi, 1);
+
+ e_gadcon_client_util_menu_items_append (inst->gcc, mn, 0);
+ e_gadcon_canvas_zone_geometry_get (inst->gcc->gadcon, &x, &y, &w, &h);
+ e_menu_activate_mouse (mn,
+ e_util_zone_current_get (e_manager_current_get
+ ()), x + ev->output.x,
+ y + ev->output.y, 1, 1,
+ E_MENU_POP_DIRECTION_DOWN, ev->timestamp);
+ evas_event_feed_mouse_up (inst->gcc->gadcon->evas, ev->button,
+ EVAS_BUTTON_NONE, ev->timestamp, NULL);
+ }
}
static void
-_weather_menu_cb_post(void *data, E_Menu *m)
+_weather_menu_cb_post (void *data, E_Menu * m)
{
- if (!weather_config->menu) return;
- e_object_del(E_OBJECT(weather_config->menu));
- weather_config->menu = NULL;
+ if (!weather_config->menu)
+ return;
+ e_object_del (E_OBJECT (weather_config->menu));
+ weather_config->menu = NULL;
}
static void
-_weather_menu_cb_configure(void *data, E_Menu *m, E_Menu_Item *mi)
+_weather_menu_cb_configure (void *data, E_Menu * m, E_Menu_Item * mi)
{
- Instance *inst;
- Config_Item *ci;
+ Instance *inst;
+ Config_Item *ci;
- inst = data;
- ci = _weather_config_item_get(inst->gcc->id);
- _config_weather_module(ci);
+ inst = data;
+ ci = _weather_config_item_get (inst->gcc->id);
+ _config_weather_module (ci);
}
static Config_Item *
-_weather_config_item_get(const char *id)
+_weather_config_item_get (const char *id)
{
- Evas_List *l;
- Config_Item *ci;
+ Evas_List *l;
+ Config_Item *ci;
- for (l = weather_config->items; l; l = l->next)
- {
- ci = l->data;
- if (!ci->id) continue;
- if (!strcmp(ci->id, id)) return ci;
- }
-
- ci = E_NEW(Config_Item, 1);
- ci->id = evas_stringshare_add(id);
- ci->poll_time = 900.0;
- ci->display = 0;
- ci->degrees = DEGREES_F;
- ci->host = evas_stringshare_add("www.rssweather.com");
- ci->code = evas_stringshare_add("KJFK");
+ for (l = weather_config->items; l; l = l->next)
+ {
+ ci = l->data;
+ if (!ci->id)
+ continue;
+ if (!strcmp (ci->id, id))
+ return ci;
+ }
+
+ ci = E_NEW (Config_Item, 1);
+ ci->id = evas_stringshare_add (id);
+ ci->poll_time = 900.0;
+ ci->display = 0;
+ ci->degrees = DEGREES_F;
+ ci->host = evas_stringshare_add ("www.rssweather.com");
+ ci->code = evas_stringshare_add ("KJFK");
- _weather_get_proxy(ci);
+ _weather_get_proxy (ci);
- weather_config->items = evas_list_append(weather_config->items, ci);
- return ci;
+ weather_config->items = evas_list_append (weather_config->items, ci);
+ return ci;
}
/* Gadman Module Setup */
EAPI E_Module_Api e_modapi = {
- E_MODULE_API_VERSION,
- "Weather"
+ E_MODULE_API_VERSION,
+ "Weather"
};
EAPI void *
-e_modapi_init(E_Module *m)
+e_modapi_init (E_Module * m)
{
- bindtextdomain(PACKAGE, LOCALEDIR);
- bind_textdomain_codeset(PACKAGE, "UTF-8");
+ bindtextdomain (PACKAGE, LOCALEDIR);
+ bind_textdomain_codeset (PACKAGE, "UTF-8");
- conf_item_edd = E_CONFIG_DD_NEW("Weather_Config_Item", Config_Item);
+ conf_item_edd = E_CONFIG_DD_NEW ("Weather_Config_Item", Config_Item);
#undef T
#undef D
#define T Config_Item
#define D conf_item_edd
- E_CONFIG_VAL(D, T, id, STR);
- E_CONFIG_VAL(D, T, poll_time, DOUBLE);
- E_CONFIG_VAL(D, T, display, INT);
- E_CONFIG_VAL(D, T, degrees, INT);
- E_CONFIG_VAL(D, T, host, STR);
- E_CONFIG_VAL(D, T, code, STR);
+ E_CONFIG_VAL (D, T, id, STR);
+ E_CONFIG_VAL (D, T, poll_time, DOUBLE);
+ E_CONFIG_VAL (D, T, display, INT);
+ E_CONFIG_VAL (D, T, degrees, INT);
+ E_CONFIG_VAL (D, T, host, STR);
+ E_CONFIG_VAL (D, T, code, STR);
- conf_edd = E_CONFIG_DD_NEW("Weather_Config", Config);
+ conf_edd = E_CONFIG_DD_NEW ("Weather_Config", Config);
#undef T
#undef D
#define T Config
#define D conf_edd
- E_CONFIG_LIST(D, T, items, conf_item_edd);
+ E_CONFIG_LIST (D, T, items, conf_item_edd);
- weather_config = e_config_domain_load("module.weather", conf_edd);
- if (!weather_config)
- {
- Config_Item *ci;
-
- weather_config = E_NEW(Config, 1);
-
- ci = E_NEW(Config_Item, 1);
- ci->poll_time = 900.0;
- ci->display = 0;
- ci->degrees = DEGREES_F;
- ci->host = evas_stringshare_add("www.rssweather.com");
- ci->code = evas_stringshare_add("KJFK");
- ci->id = evas_stringshare_add("0");
- _weather_get_proxy(ci);
-
- weather_config->items = evas_list_append(weather_config->items, ci);
- }
-
- weather_config->module = m;
- e_gadcon_provider_register(&_gadcon_class);
- return m;
+ weather_config = e_config_domain_load ("module.weather", conf_edd);
+ if (!weather_config)
+ {
+ Config_Item *ci;
+
+ weather_config = E_NEW (Config, 1);
+
+ ci = E_NEW (Config_Item, 1);
+ ci->poll_time = 900.0;
+ ci->display = 0;
+ ci->degrees = DEGREES_F;
+ ci->host = evas_stringshare_add ("www.rssweather.com");
+ ci->code = evas_stringshare_add ("KJFK");
+ ci->id = evas_stringshare_add ("0");
+ _weather_get_proxy (ci);
+
+ weather_config->items = evas_list_append (weather_config->items, ci);
+ }
+
+ weather_config->module = m;
+ e_gadcon_provider_register (&_gadcon_class);
+ return m;
}
EAPI int
-e_modapi_shutdown(E_Module *m)
+e_modapi_shutdown (E_Module * m)
{
- weather_config->module = NULL;
- e_gadcon_provider_unregister(&_gadcon_class);
+ weather_config->module = NULL;
+ e_gadcon_provider_unregister (&_gadcon_class);
- if (weather_config->config_dialog)
- e_object_del(E_OBJECT(weather_config->config_dialog));
- if (weather_config->menu)
- {
- e_menu_post_deactivate_callback_set(weather_config->menu, NULL, NULL);
- e_object_del(E_OBJECT(weather_config->menu));
- weather_config->menu = NULL;
- }
-
- while (weather_config->items)
- {
- Config_Item *ci;
-
- ci = weather_config->items->data;
- if (ci->id) evas_stringshare_del(ci->id);
- if (ci->host) evas_stringshare_del(ci->host);
- if (ci->code) evas_stringshare_del(ci->code);
- if (ci->proxy.host) evas_stringshare_del(ci->proxy.host);
- weather_config->items = evas_list_remove_list(weather_config->items,
weather_config->items);
- free(ci);
- ci = NULL;
- }
-
- free(weather_config);
- weather_config = NULL;
- E_CONFIG_DD_FREE(conf_item_edd);
- E_CONFIG_DD_FREE(conf_edd);
- return 1;
+ if (weather_config->config_dialog)
+ e_object_del (E_OBJECT (weather_config->config_dialog));
+ if (weather_config->menu)
+ {
+ e_menu_post_deactivate_callback_set (weather_config->menu, NULL, NULL);
+ e_object_del (E_OBJECT (weather_config->menu));
+ weather_config->menu = NULL;
+ }
+
+ while (weather_config->items)
+ {
+ Config_Item *ci;
+
+ ci = weather_config->items->data;
+ if (ci->id)
+ evas_stringshare_del (ci->id);
+ if (ci->host)
+ evas_stringshare_del (ci->host);
+ if (ci->code)
+ evas_stringshare_del (ci->code);
+ if (ci->proxy.host)
+ evas_stringshare_del (ci->proxy.host);
+ weather_config->items =
+ evas_list_remove_list (weather_config->items, weather_config->items);
+ free (ci);
+ ci = NULL;
+ }
+
+ free (weather_config);
+ weather_config = NULL;
+ E_CONFIG_DD_FREE (conf_item_edd);
+ E_CONFIG_DD_FREE (conf_edd);
+ return 1;
}
EAPI int
-e_modapi_save(E_Module *m)
+e_modapi_save (E_Module * m)
{
- Evas_List *l;
+ Evas_List *l;
- for (l = weather_config->instances; l; l = l->next)
- {
- Instance *inst;
- Config_Item *ci;
+ for (l = weather_config->instances; l; l = l->next)
+ {
+ Instance *inst;
+ Config_Item *ci;
- inst = l->data;
- ci = _weather_config_item_get(inst->gcc->id);
+ inst = l->data;
+ ci = _weather_config_item_get (inst->gcc->id);
- if (ci->id) evas_stringshare_del(ci->id);
- ci->id = evas_stringshare_add(inst->gcc->id);
- }
+ if (ci->id)
+ evas_stringshare_del (ci->id);
+ ci->id = evas_stringshare_add (inst->gcc->id);
+ }
- e_config_domain_save("module.weather", conf_edd, weather_config);
- return 1;
+ e_config_domain_save ("module.weather", conf_edd, weather_config);
+ return 1;
}
EAPI int
-e_modapi_about(E_Module *m)
+e_modapi_about (E_Module * m)
{
- e_module_dialog_show(m, D_("Enlightenment Weather Module"), D_("A weather
forecast module for Enlightenment"));
- return 1;
+ e_module_dialog_show (m, D_ ("Enlightenment Weather Module"),
+ D_ ("A weather forecast module for Enlightenment"));
+ return 1;
}
static Weather *
-_weather_new(Evas *evas)
+_weather_new (Evas * evas)
{
- Weather *w;
- char buf[4096];
+ Weather *w;
+ char buf[4096];
- w = E_NEW(Weather, 1);
+ w = E_NEW (Weather, 1);
- w->weather_obj = edje_object_add(evas);
+ w->weather_obj = edje_object_add (evas);
- snprintf(buf, sizeof(buf), "%s/weather.edj",
e_module_dir_get(weather_config->module));
- if (!e_theme_edje_object_set(w->weather_obj, "base/theme/modules/weather",
"modules/weather/main"))
- edje_object_file_set(w->weather_obj, buf, "modules/weather/main");
- evas_object_show(w->weather_obj);
- edje_object_part_text_set(w->weather_obj, "location", "");
+ snprintf (buf, sizeof (buf), "%s/weather.edj",
+ e_module_dir_get (weather_config->module));
+ if (!e_theme_edje_object_set
+ (w->weather_obj, "base/theme/modules/weather", "modules/weather/main"))
+ edje_object_file_set (w->weather_obj, buf, "modules/weather/main");
+ evas_object_show (w->weather_obj);
+ edje_object_part_text_set (w->weather_obj, "location", "");
+
+ w->icon_obj = e_icon_add (evas);
+ snprintf (buf, sizeof (buf), "%s/images/unknown.png",
+ e_module_dir_get (weather_config->module));
+ e_icon_file_set (w->icon_obj, buf);
+ edje_object_part_swallow (w->weather_obj, "icon", w->icon_obj);
- w->icon_obj = e_icon_add(evas);
- snprintf(buf, sizeof(buf), "%s/images/unknown.png",
e_module_dir_get(weather_config->module));
- e_icon_file_set(w->icon_obj, buf);
- edje_object_part_swallow(w->weather_obj, "icon", w->icon_obj);
-
- return w;
+ return w;
}
static void
-_weather_free(Weather *w)
+_weather_free (Weather * w)
{
- evas_object_del(w->weather_obj);
- evas_object_del(w->icon_obj);
- free(w);
- w = NULL;
+ evas_object_del (w->weather_obj);
+ evas_object_del (w->icon_obj);
+ free (w);
+ w = NULL;
}
static void
-_weather_get_proxy(Config_Item *ci)
+_weather_get_proxy (Config_Item * ci)
{
- char *env;
+ char *env;
- if (!ci) return;
+ if (!ci)
+ return;
- env = getenv("http_proxy");
- if (!env) env = getenv("HTTP_PROXY");
- if ((env) && (!strncmp(env, "http://", 7)))
- {
- char *host = NULL;
- char *p;
- int port = 0;
-
- host = strchr(env, ':');
- host += 3;
- p = strchr(host, ':');
- if (p)
- {
- *p = 0;
- p++;
- if (sscanf(p, "%d", &port) != 1) port = 0;
- }
- if ((host) && (port))
- {
- ci->proxy.host = evas_stringshare_add(host);
- ci->proxy.port = port;
- }
- }
+ env = getenv ("http_proxy");
+ if (!env)
+ env = getenv ("HTTP_PROXY");
+ if ((env) && (!strncmp (env, "http://", 7)))
+ {
+ char *host = NULL;
+ char *p;
+ int port = 0;
+
+ host = strchr (env, ':');
+ host += 3;
+ p = strchr (host, ':');
+ if (p)
+ {
+ *p = 0;
+ p++;
+ if (sscanf (p, "%d", &port) != 1)
+ port = 0;
+ }
+ if ((host) && (port))
+ {
+ ci->proxy.host = evas_stringshare_add (host);
+ ci->proxy.port = port;
+ }
+ }
}
static int
-_weather_cb_check(void *data)
+_weather_cb_check (void *data)
{
- Instance *inst;
- Config_Item *ci;
+ Instance *inst;
+ Config_Item *ci;
- inst = data;
- ci = _weather_config_item_get(inst->gcc->id);
+ inst = data;
+ ci = _weather_config_item_get (inst->gcc->id);
- if (inst->server)
- {
- ecore_con_server_del(inst->server);
- inst->server = NULL;
- }
-
- if (ci->proxy.port != 0)
- inst->server = ecore_con_server_connect(ECORE_CON_REMOTE_SYSTEM,
ci->proxy.host, ci->proxy.port, inst);
- else
- inst->server = ecore_con_server_connect(ECORE_CON_REMOTE_SYSTEM,
ci->host, 80, inst);
+ if (inst->server)
+ {
+ ecore_con_server_del (inst->server);
+ inst->server = NULL;
+ }
+
+ if (ci->proxy.port != 0)
+ inst->server =
+ ecore_con_server_connect (ECORE_CON_REMOTE_SYSTEM, ci->proxy.host,
+ ci->proxy.port, inst);
+ else
+ inst->server =
+ ecore_con_server_connect (ECORE_CON_REMOTE_SYSTEM, ci->host, 80, inst);
- return 1;
+ return 1;
}
static int
-_weather_server_add(void *data, int type, void *event)
+_weather_server_add (void *data, int type, void *event)
{
- Instance *inst;
- Config_Item *ci;
- Ecore_Con_Event_Server_Add *ev;
- char buf[1024];
- char icao[1024];
-
- inst = data;
- if (!inst) return 1;
-
- ci = _weather_config_item_get(inst->gcc->id);
- ev = event;
- if ((!inst->server) || (inst->server != ev->server)) return 1;
-
- snprintf(icao, sizeof(icao), "/icao/%s/rss.php", ci->code);
- snprintf(buf, sizeof(buf), "GET http://%s%s HTTP/1.1\r\nHost: %s\r\n\r\n",
ci->host, icao, ci->host);
- ecore_con_server_send(inst->server, buf, strlen(buf));
- return 0;
+ Instance *inst;
+ Config_Item *ci;
+ Ecore_Con_Event_Server_Add *ev;
+ char buf[1024];
+ char icao[1024];
+
+ inst = data;
+ if (!inst)
+ return 1;
+
+ ci = _weather_config_item_get (inst->gcc->id);
+ ev = event;
+ if ((!inst->server) || (inst->server != ev->server))
+ return 1;
+
+ snprintf (icao, sizeof (icao), "/icao/%s/rss.php", ci->code);
+ snprintf (buf, sizeof (buf), "GET http://%s%s HTTP/1.1\r\nHost: %s\r\n\r\n",
+ ci->host, icao, ci->host);
+ ecore_con_server_send (inst->server, buf, strlen (buf));
+ return 0;
}
static int
-_weather_server_del(void *data, int type, void *event)
+_weather_server_del (void *data, int type, void *event)
{
- Instance *inst;
- Ecore_Con_Event_Server_Del *ev;
- int ret;
-
- inst = data;
- ev = event;
- if ((!inst->server) || (inst->server != ev->server)) return 1;
+ Instance *inst;
+ Ecore_Con_Event_Server_Del *ev;
+ int ret;
+
+ inst = data;
+ ev = event;
+ if ((!inst->server) || (inst->server != ev->server))
+ return 1;
+
+ ecore_con_server_del (inst->server);
+ inst->server = NULL;
+
+ ret = _weather_parse (inst);
+ _weather_convert_degrees (inst);
+ _weather_display_set (inst, ret);
+
+ inst->bufsize = 0;
+ inst->cursize = 0;
+ free (inst->buffer);
+ inst->buffer = NULL;
- ecore_con_server_del(inst->server);
- inst->server = NULL;
-
- ret = _weather_parse(inst);
- _weather_convert_degrees(inst);
- _weather_display_set(inst, ret);
-
- inst->bufsize = 0;
- inst->cursize = 0;
- free(inst->buffer);
- inst->buffer = NULL;
-
- return 0;
+ return 0;
}
static int
-_weather_server_data(void *data, int type, void *event)
+_weather_server_data (void *data, int type, void *event)
{
- Instance *inst;
- Ecore_Con_Event_Server_Data *ev;
+ Instance *inst;
+ Ecore_Con_Event_Server_Data *ev;
- inst = data;
- ev = event;
+ inst = data;
+ ev = event;
- if ((!inst->server) || (inst->server != ev->server)) return 1;
- while ((inst->cursize + ev->size) >= inst->bufsize)
- {
- inst->bufsize += 4096;
- inst->buffer = realloc(inst->buffer, inst->bufsize);
- }
-
- memcpy(inst->buffer + inst->cursize, ev->data, ev->size);
- inst->cursize += ev->size;
- inst->buffer[inst->cursize] = 0;
- return 0;
+ if ((!inst->server) || (inst->server != ev->server))
+ return 1;
+ while ((inst->cursize + ev->size) >= inst->bufsize)
+ {
+ inst->bufsize += 4096;
+ inst->buffer = realloc (inst->buffer, inst->bufsize);
+ }
+
+ memcpy (inst->buffer + inst->cursize, ev->data, ev->size);
+ inst->cursize += ev->size;
+ inst->buffer[inst->cursize] = 0;
+ return 0;
}
static int
-_weather_parse(void *data)
+_weather_parse (void *data)
{
- Instance *inst;
- char *needle, *ext;
- char location[256];
-
- inst = data;
- if (!inst) return 0;
- if (inst->buffer == NULL) return 0;
-
- needle = strstr(inst->buffer, "<title");
- if (!needle) goto error;
-
- needle = strstr(needle, ">");
- sscanf(needle, ">%[^<]<", location);
- if (location)
- {
- char *tmp = strdup(location);
-
- if (strstr(tmp, ","))
- {
- tmp = strtok(tmp, ",");
- inst->location = strdup(tmp);
- }
- }
-
- needle = strstr(inst->buffer, "<content:encoded>");
- if (!needle) goto error;
-
- needle = strstr(needle, "<img");
- if (!needle) goto error;
- needle = strstr(needle, "id=");
- if (!needle) goto error;
- sscanf(needle, "id=\"%[^\"]\"", inst->icon);
- ext = strstr(inst->icon, ".");
- if (!strcmp(ext, ".gif")) strcpy(ext, ".png");
-
- needle = strstr(needle, "class=\"sky\"");
- if (!needle) goto error;
- needle = strstr(needle, ">");
- if (!needle) goto error;
- sscanf(needle, ">%[^<]<", inst->conditions);
-
- needle = strstr(needle, "class=\"temp\"");
- if (!needle) goto error;
- needle = strstr(needle, ">");
- if (!needle) goto error;
- sscanf(needle, ">%d", &inst->temp);
- needle = strstr(needle, "<");
- if (!needle) goto error;
- needle--;
- inst->degrees = needle[0];
-
- return 1;
- error:
- printf("ERROR: Couldn't parse info from rssweather.com\n");
- return 0;
+ Instance *inst;
+ char *needle, *ext;
+ char location[256];
+
+ inst = data;
+ if (!inst)
+ return 0;
+ if (inst->buffer == NULL)
+ return 0;
+
+ needle = strstr (inst->buffer, "<title");
+ if (!needle)
+ goto error;
+
+ needle = strstr (needle, ">");
+ sscanf (needle, ">%[^<]<", location);
+ if (location)
+ {
+ char *tmp = strdup (location);
+
+ if (strstr (tmp, ","))
+ {
+ tmp = strtok (tmp, ",");
+ inst->location = strdup (tmp);
+ }
+ }
+
+ needle = strstr (inst->buffer, "<content:encoded>");
+ if (!needle)
+ goto error;
+
+ needle = strstr (needle, "<img");
+ if (!needle)
+ goto error;
+ needle = strstr (needle, "id=");
+ if (!needle)
+ goto error;
+ sscanf (needle, "id=\"%[^\"]\"", inst->icon);
+ ext = strstr (inst->icon, ".");
+ if (!strcmp (ext, ".gif"))
+ strcpy (ext, ".png");
+
+ needle = strstr (needle, "class=\"sky\"");
+ if (!needle)
+ goto error;
+ needle = strstr (needle, ">");
+ if (!needle)
+ goto error;
+ sscanf (needle, ">%[^<]<", inst->conditions);
+
+ needle = strstr (needle, "class=\"temp\"");
+ if (!needle)
+ goto error;
+ needle = strstr (needle, ">");
+ if (!needle)
+ goto error;
+ sscanf (needle, ">%d", &inst->temp);
+ needle = strstr (needle, "<");
+ if (!needle)
+ goto error;
+ needle--;
+ inst->degrees = needle[0];
+
+ return 1;
+error:
+ printf ("ERROR: Couldn't parse info from rssweather.com\n");
+ return 0;
}
void
-_weather_convert_degrees(void *data)
+_weather_convert_degrees (void *data)
{
- Instance *inst;
- Config_Item *ci;
+ Instance *inst;
+ Config_Item *ci;
- inst = data;
- ci = _weather_config_item_get(inst->gcc->id);
+ inst = data;
+ ci = _weather_config_item_get (inst->gcc->id);
- if ((inst->degrees == 'F') && (ci->degrees == DEGREES_C))
- {
- inst->temp = (inst->temp - 32) * 5.0 / 9.0;
- inst->degrees = 'C';
- }
- if ((inst->degrees == 'C') && (ci->degrees == DEGREES_F))
- {
- inst->temp = (inst->temp * 9.0 / 5.0) + 32;
- inst->degrees = 'F';
- }
+ if ((inst->degrees == 'F') && (ci->degrees == DEGREES_C))
+ {
+ inst->temp = (inst->temp - 32) * 5.0 / 9.0;
+ inst->degrees = 'C';
+ }
+ if ((inst->degrees == 'C') && (ci->degrees == DEGREES_F))
+ {
+ inst->temp = (inst->temp * 9.0 / 5.0) + 32;
+ inst->degrees = 'F';
+ }
}
static void
-_weather_display_set(Instance *inst, int ok)
+_weather_display_set (Instance * inst, int ok)
{
- char buf[4096];
- char m[4096];
+ char buf[4096];
+ char m[4096];
- if (!inst) return;
- snprintf(m, sizeof(m), "%s", e_module_dir_get(weather_config->module));
+ if (!inst)
+ return;
+ snprintf (m, sizeof (m), "%s", e_module_dir_get (weather_config->module));
// if (!ok) return;
-
- snprintf(buf, sizeof(buf), "%s/images/%s", m, inst->icon);
- e_icon_file_set(inst->weather->icon_obj, buf);
- edje_object_part_swallow(inst->weather->weather_obj, "icon",
inst->weather->icon_obj);
- edje_object_part_text_set(inst->weather->weather_obj, "location",
inst->location);
- snprintf(buf, sizeof(buf), "%d°%c", inst->temp, inst->degrees);
- edje_object_part_text_set(inst->weather->weather_obj, "temp", buf);
- edje_object_part_text_set(inst->weather->weather_obj, "conditions",
inst->conditions);
+
+ snprintf (buf, sizeof (buf), "%s/images/%s", m, inst->icon);
+ e_icon_file_set (inst->weather->icon_obj, buf);
+ edje_object_part_swallow (inst->weather->weather_obj, "icon",
+ inst->weather->icon_obj);
+ edje_object_part_text_set (inst->weather->weather_obj, "location",
+ inst->location);
+ snprintf (buf, sizeof (buf), "%d°%c", inst->temp, inst->degrees);
+ edje_object_part_text_set (inst->weather->weather_obj, "temp", buf);
+ edje_object_part_text_set (inst->weather->weather_obj, "conditions",
+ inst->conditions);
}
void
-_weather_config_updated(const char *id)
+_weather_config_updated (const char *id)
{
- Evas_List *l;
- Config_Item *ci;
- char buf[4096];
-
- if (!weather_config) return;
- ci = _weather_config_item_get(id);
- for (l = weather_config->instances; l; l = l->next)
- {
- Instance *inst;
-
- inst = l->data;
- if (!inst->gcc->id) continue;
- if (!strcmp(inst->gcc->id, ci->id))
- {
- if (ci->display == 0)
- edje_object_signal_emit(inst->weather->weather_obj,
"set_style", "simple");
- else if (ci->display == 1)
- edje_object_signal_emit(inst->weather->weather_obj,
"set_style", "detailed");
-
- _weather_convert_degrees(inst);
-
- snprintf(buf, sizeof(buf), "%d°%c", inst->temp, inst->degrees);
- edje_object_part_text_set(inst->weather->weather_obj, "temp",
buf);
-
- if (!inst->check_timer)
- inst->check_timer = ecore_timer_add((double)ci->poll_time,
_weather_cb_check, inst);
- else
- ecore_timer_interval_set(inst->check_timer,
(double)ci->poll_time);
-
- break;
- }
- }
+ Evas_List *l;
+ Config_Item *ci;
+ char buf[4096];
+
+ if (!weather_config)
+ return;
+ ci = _weather_config_item_get (id);
+ for (l = weather_config->instances; l; l = l->next)
+ {
+ Instance *inst;
+
+ inst = l->data;
+ if (!inst->gcc->id)
+ continue;
+ if (!strcmp (inst->gcc->id, ci->id))
+ {
+ if (ci->display == 0)
+ edje_object_signal_emit (inst->weather->weather_obj, "set_style",
+ "simple");
+ else if (ci->display == 1)
+ edje_object_signal_emit (inst->weather->weather_obj, "set_style",
+ "detailed");
+
+ _weather_convert_degrees (inst);
+
+ snprintf (buf, sizeof (buf), "%d°%c", inst->temp, inst->degrees);
+ edje_object_part_text_set (inst->weather->weather_obj, "temp", buf);
+
+ if (!inst->check_timer)
+ inst->check_timer =
+ ecore_timer_add ((double) ci->poll_time, _weather_cb_check,
+ inst);
+ else
+ ecore_timer_interval_set (inst->check_timer,
+ (double) ci->poll_time);
+
+ break;
+ }
+ }
}
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs