Enlightenment CVS committal Author : kiwi Project : e_modules Module : devian
Dir : e_modules/devian/src/module Modified Files: e_mod_config_dialog_devian.c e_mod_container.c e_mod_container.h e_mod_container_box.c e_mod_container_box.h e_mod_data_rss.c e_mod_data_rss_parse.c e_mod_devian.h e_mod_popup_warn.c e_mod_popup_warn.h e_mod_source_picture.c Log Message: Work on Rss and some cleaning * There is now a warning indicator to tell the user what dEvian got news / has problems * Fix a leak in Rss * dEvian now parse Rss feeds with metas that close themselves (like <description/>, thanks to Florian Leitner for bug repport * Better indent * Remove executable bit on almost all files =================================================================== RCS file: /cvs/e/e_modules/devian/src/module/e_mod_config_dialog_devian.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- e_mod_config_dialog_devian.c 6 Apr 2006 22:40:08 -0000 1.3 +++ e_mod_config_dialog_devian.c 11 Apr 2006 11:18:44 -0000 1.4 @@ -456,7 +456,6 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) { Evas_Object *o, *of, *ob; - E_Radio_Group *rg; o = e_widget_table_add(evas, 0); =================================================================== RCS file: /cvs/e/e_modules/devian/src/module/e_mod_container.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- e_mod_container.c 5 Apr 2006 17:48:48 -0000 1.2 +++ e_mod_container.c 11 Apr 2006 11:18:44 -0000 1.3 @@ -146,6 +146,21 @@ } } +void DEVIANF(container_warning_indicator_change) (DEVIANN *devian, int state) +{ + if (!devian->container) + return; + + switch (devian->conf->container_type) + { + case CONTAINER_BOX: + DEVIANF(container_box_warning_indicator_change) (devian->container, state); + return; + case CONTAINER_BAR: + return; + } +} + int DEVIANF(container_update_id_devian) (DEVIANN *devian) { if (!devian->conf || !devian->container) =================================================================== RCS file: /cvs/e/e_modules/devian/src/module/e_mod_container.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- e_mod_container.h 5 Apr 2006 17:48:48 -0000 1.2 +++ e_mod_container.h 11 Apr 2006 11:18:44 -0000 1.3 @@ -22,6 +22,7 @@ int DEVIANF(container_infos_edje_part_is_visible) (DEVIANN *devian); void DEVIANF(container_loading_state_change) (DEVIANN *devian, int state); +void DEVIANF(container_warning_indicator_change) (DEVIANN *devian, int state); int DEVIANF(container_update_id_devian) (DEVIANN *devian); int DEVIANF(container_devian_dying) (DEVIANN *devian); =================================================================== RCS file: /cvs/e/e_modules/devian/src/module/e_mod_container_box.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- e_mod_container_box.c 5 Apr 2006 17:48:48 -0000 1.2 +++ e_mod_container_box.c 11 Apr 2006 11:18:44 -0000 1.3 @@ -99,6 +99,9 @@ /* Show edje */ evas_object_show(box->edje); + /* Disable warning indicator */ + DEVIANF(container_box_warning_indicator_change) (box, 0); + /* Show we are waiting for a source */ DEVIANF(container_box_loading_state_change) (box, 1); @@ -639,6 +642,11 @@ void DEVIANF(container_box_loading_state_change) (Container_Box *box, int state) { edje_object_message_send(box->edje, EDJE_MESSAGE_INT, DEVIAN_CONTAINER_BOX_TO_EDJE_MSG_LOADING_STATE, &state); +} + +void DEVIANF(container_box_warning_indicator_change) (Container_Box *box, int state) +{ + edje_object_message_send(box->edje, EDJE_MESSAGE_INT, DEVIAN_CONTAINER_BOX_TO_EDJE_MSG_WARNING_INDICATOR, &state); } int DEVIANF(container_box_devian_dying) (Container_Box *box) =================================================================== RCS file: /cvs/e/e_modules/devian/src/module/e_mod_container_box.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- e_mod_container_box.h 5 Apr 2006 17:48:48 -0000 1.2 +++ e_mod_container_box.h 11 Apr 2006 11:18:44 -0000 1.3 @@ -43,6 +43,7 @@ #define DEVIAN_CONTAINER_BOX_TO_EDJE_MSG_LOADING_STATE 3 #define DEVIAN_CONTAINER_BOX_TO_EDJE_MSG_SHOW_SET_BG 4 #define DEVIAN_CONTAINER_BOX_TO_EDJE_MSG_SHOW_PREVIOUS 5 +#define DEVIAN_CONTAINER_BOX_TO_EDJE_MSG_WARNING_INDICATOR 6 #define DEVIAN_CONTAINER_BOX_FROM_EDJE_MSG_INFOS_W 0 #define DEVIAN_CONTAINER_BOX_FROM_EDJE_MSG_INFOS_VISIBLE 1 @@ -113,6 +114,7 @@ void DEVIANF(container_box_infos_pos_set) (Container_Box *box); void DEVIANF(container_box_loading_state_change) (Container_Box *box, int state); +void DEVIANF(container_box_warning_indicator_change) (Container_Box *box, int state); int DEVIANF(container_box_devian_dying) (Container_Box *box); int DEVIANF(container_box_update_id_devian) (Container_Box *box); =================================================================== RCS file: /cvs/e/e_modules/devian/src/module/e_mod_data_rss.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- e_mod_data_rss.c 6 Apr 2006 18:04:53 -0000 1.3 +++ e_mod_data_rss.c 11 Apr 2006 11:18:44 -0000 1.4 @@ -438,6 +438,8 @@ evas_stringshare_del(article->description); if (article->date) evas_stringshare_del(article->date); + if (article->date_simple) + evas_stringshare_del(article->date_simple); if (article->obj) { edje_object_signal_callback_del(article->obj, "infos_set", "item", _cb_infos_set); =================================================================== RCS file: /cvs/e/e_modules/devian/src/module/e_mod_data_rss_parse.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- e_mod_data_rss_parse.c 5 Apr 2006 17:48:48 -0000 1.2 +++ e_mod_data_rss_parse.c 11 Apr 2006 11:18:44 -0000 1.3 @@ -30,6 +30,10 @@ evas_stringshare_del(article->url); \ if (article->description) \ evas_stringshare_del(article->description); \ +if (article->date) \ + evas_stringshare_del(article->date); \ +if (article->date_simple) \ + evas_stringshare_del(article->date_simple); \ return NULL; \ } while (0) @@ -46,6 +50,7 @@ static char *_parse_item_clean(char *buf, int size, int type); static char *_parse_item_date_10(char *buf); static char *_parse_item_date_20(char *buf); +static char *_parse_go_begin_meta(char *buf); static char *_parse_go_end_meta(char *buf); /* PUBLIC FUNCTIONS */ @@ -206,26 +211,26 @@ { tmp = NULL; /* Compare for * rss versions */ - if (!strncmp(buf, "<title>", 7)) + if (!strncmp(buf, "<title", 6)) { DDATARSSP(("detected title")); - if (!(tmp = _parse_item(buf + 7, &article->title, PARSE_ITEM_TITLE))) + if (!(tmp = _parse_item(buf, &article->title, PARSE_ITEM_TITLE))) PARSE_ARTICLE_FAILS(); } else { - if (!strncmp(buf, "<link>", 6)) + if (!strncmp(buf, "<link", 5)) { DDATARSSP(("detected link")); - if (!(tmp = _parse_item(buf + 6, &article->url, PARSE_ITEM_URL))) + if (!(tmp = _parse_item(buf, &article->url, PARSE_ITEM_URL))) PARSE_ARTICLE_FAILS(); } else { - if (!strncmp(buf, "<description>", 13)) + if (!strncmp(buf, "<description", 12)) { DDATARSSP(("detected description")); - if (!(tmp = _parse_item(buf + 13, &article->description, PARSE_ITEM_DESC))) + if (!(tmp = _parse_item(buf, &article->description, PARSE_ITEM_DESC))) PARSE_ARTICLE_FAILS(); } else @@ -234,35 +239,35 @@ switch ((int)ver) { case 1: - if (!strncmp(buf, "<dc:date>", 9)) + if (!strncmp(buf, "<dc:date", 8)) { char *buf_sav = buf; /* Parse it one time ->date and one time ->date_simple */ DDATARSSP(("detected pubdate")); - if (!(tmp = _parse_item(buf + 9, &article->date, PARSE_ITEM_TITLE))) + if (!(tmp = _parse_item(buf, &article->date, PARSE_ITEM_TITLE))) PARSE_ARTICLE_FAILS(); else { buf = buf_sav; - if (!(tmp = _parse_item(buf + 9, &article->date_simple, PARSE_ITEM_DATE_10))) + if (!(tmp = _parse_item(buf, &article->date_simple, PARSE_ITEM_DATE_10))) PARSE_ARTICLE_FAILS(); } } break; case 2: - if (!strncmp(buf, "<pubDate>", 9)) + if (!strncmp(buf, "<pubDate", 8)) { char *buf_sav = buf; /* Parse it one time ->date and one time ->date_simple */ DDATARSSP(("detected pubdate")); - if (!(tmp = _parse_item(buf + 9, &article->date, PARSE_ITEM_TITLE))) + if (!(tmp = _parse_item(buf, &article->date, PARSE_ITEM_TITLE))) PARSE_ARTICLE_FAILS(); else { buf = buf_sav; - if (!(tmp = _parse_item(buf + 9, &article->date_simple, PARSE_ITEM_DATE_20))) + if (!(tmp = _parse_item(buf, &article->date_simple, PARSE_ITEM_DATE_20))) PARSE_ARTICLE_FAILS(); } } @@ -276,7 +281,6 @@ * -> Test html meta wich dont work in pair with a close meta */ //... DDATARSSP(("unknow meta (%8.8s), skip", buf)); - buf++; if (!(tmp = _parse_go_end_meta(buf))) PARSE_ARTICLE_FAILS(); } @@ -352,32 +356,31 @@ do { - if (!strncmp(buf, "<title>", 7)) + if (!strncmp(buf, "<title", 6)) { DDATARSSP(("Infos: detected title")); - if (!(tmp = _parse_item(buf + 7, &name, PARSE_ITEM_TITLE))) + if (!(tmp = _parse_item(buf, &name, PARSE_ITEM_TITLE))) PARSE_INFOS_FAILS(); } else { - if (!strncmp(buf, "<link>", 6)) + if (!strncmp(buf, "<link", 5)) { DDATARSSP(("Infos: detected link")); - if (!(tmp = _parse_item(buf + 6, &link, PARSE_ITEM_URL))) + if (!(tmp = _parse_item(buf, &link, PARSE_ITEM_URL))) PARSE_INFOS_FAILS(); } else { - if (!strncmp(buf, "<description>", 13)) + if (!strncmp(buf, "<description", 12)) { DDATARSSP(("Infos: detected description")); - if (!(tmp = _parse_item(buf + 13, &description, PARSE_ITEM_DESC))) + if (!(tmp = _parse_item(buf, &description, PARSE_ITEM_DESC))) PARSE_INFOS_FAILS(); } else { DDATARSSP(("Infos: unknow meta (%8.8s), skip", buf)); - buf++; if (!(tmp = _parse_go_end_meta(buf))) PARSE_INFOS_FAILS(); } @@ -439,13 +442,22 @@ int tmp_l; /* Get content in tmp */ + + /* Get the begining position of the content */ + if (!(tmp = _parse_go_begin_meta(buf))) + return NULL; + + /* Get the end position of the content */ if (!(p = _parse_go_end_meta(buf))) return NULL; + + /* Get the content */ + buf = tmp; tmp_l = p - buf; DDATARSSP(("Item size: %d", tmp_l)); if (!tmp_l) /* Nothing in item, skip it */ { - *text = NULL; + *text = evas_stringshare_add("No"); return p; } tmp = E_NEW(char, tmp_l + 1); @@ -454,7 +466,7 @@ memcpy(tmp, buf, tmp_l); *(tmp + tmp_l) = '\0'; - /* Clean content of the item */ + /* Clean the content of the item */ switch (type) { case PARSE_ITEM_DATE_10: @@ -773,10 +785,37 @@ } /** - * Go at the end of the meta (of same layer) + * Go at the first char of content in the meta pointed by buf + * + * @param buf text buffer + * @return pointer at on the first char of the text + */ +static char * +_parse_go_begin_meta(char *buf) +{ + char *p; + + p = buf; + + /* Looking for autoclosing meta */ + while (*p && (*p != '>')) + p++; + if (!(*p)) + return NULL; + if (*(p-1) == '/') + { + DDATARSSP(("Searching end of an autoclosing meta !")); + return buf; + } + return p+1; +} + +/** + * Go at the last char of the content of the meta pointed by buf + * (Find a meta of the same layer, or autoclosing meta, like in xhtml, <br/>) * * @param buf text buffer - * @return pointer at the end of the meta + * @return pointer at the last char of the meta */ static char * _parse_go_end_meta(char *buf) @@ -789,6 +828,15 @@ DDATARSSP(("Looking for end meta (%20.20s)", p)); + /* Looking for autoclosing meta */ + while (*p && (*p != '>')) + p++; + if (*(p-1) == '/') + { + DDATARSSP(("Searching end of an autoclosing meta !")); + return p+1; + } + while (*p) { /* Look for meta */ @@ -800,7 +848,7 @@ if (*(p + 1) == '/') { if (!layer) - goto done; + goto done; layer--; } else @@ -818,7 +866,15 @@ } } else - layer++; /* Opening meta */ + { + /* Looking for autoclosing meta */ + while (*p && (*p != '>')) + p++; + if (*(p-1) == '/') + ; /* Skip meta */ + else + layer++; /* Opening meta */ + } } } /* Next char */ =================================================================== RCS file: /cvs/e/e_modules/devian/src/module/e_mod_devian.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- e_mod_devian.h 5 Apr 2006 17:48:48 -0000 1.2 +++ e_mod_devian.h 11 Apr 2006 11:18:44 -0000 1.3 @@ -44,7 +44,6 @@ /* Name of the global main dEvian is strcat(DEVIAN_NAME,"M") */ -/* #ifdef HAVE_ALL #define DEVIANM dEvianM #define DEVIANN dEvian @@ -62,7 +61,6 @@ #endif #endif #endif -*/ DEVIAN_MAIN *DEVIANM; =================================================================== RCS file: /cvs/e/e_modules/devian/src/module/e_mod_popup_warn.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- e_mod_popup_warn.c 5 Apr 2006 17:48:48 -0000 1.2 +++ e_mod_popup_warn.c 11 Apr 2006 11:18:44 -0000 1.3 @@ -95,8 +95,12 @@ case POPUP_WARN_TYPE_DEVIAN: devian = (DEVIANN *)data; + /* Warning indicator */ + DEVIANF(container_warning_indicator_change) (devian, 1); + /* Text */ popw->name = evas_stringshare_add(DEVIANF(source_name_get) (devian, -1)); edje_object_part_text_set(popw->face, "name", popw->name); + /* Pos */ px = DEVIANM->canvas_w - (fw + 20); py = DEVIANM->canvas_h - (fh + 20); /* Log */ @@ -110,12 +114,28 @@ break; case POPUP_WARN_TYPE_INFO: + /* Text */ popw->name = evas_stringshare_add(MODULE_NAME); edje_object_part_text_set(popw->face, "name", popw->name); + /* Pos */ px = (DEVIANM->canvas_w - fw) / 2; py = (DEVIANM->canvas_h - fh) / 2; break; + case POPUP_WARN_TYPE_INFO_DEVIAN: + devian = (DEVIANN *)data; + /* Warning indicator */ + DEVIANF(container_warning_indicator_change) (devian, 1); + /* Text */ + popw->name = evas_stringshare_add(MODULE_NAME); + edje_object_part_text_set(popw->face, "name", popw->name); + /* Pos */ + px = (DEVIANM->canvas_w - fw) / 2; + py = (DEVIANM->canvas_h - fh) / 2; + /* Log */ + popw->log = evas_list_append(popw->log, evas_stringshare_add(text)); + break; + case POPUP_WARN_TYPE_INFO_TIMER: time = data; popw->name = evas_stringshare_add(MODULE_NAME); @@ -180,6 +200,21 @@ case POPUP_WARN_TYPE_DEVIAN: devian = (DEVIANN *)popw->data; devian->popup_warn = NULL; + /* Warning indicator */ + DEVIANF(container_warning_indicator_change) (devian, 0); + /* Timer */ + if (popw->timer) + ecore_timer_del(popw->timer); + /* Log */ + for (l = popw->log; l; l = evas_list_next(l)) + evas_stringshare_del(l->data); + evas_list_free(popw->log); + break; + + case POPUP_WARN_TYPE_INFO_DEVIAN: + devian = (DEVIANN *)popw->data; + /* Warning indicator */ + DEVIANF(container_warning_indicator_change) (devian, 0); /* Timer */ if (popw->timer) ecore_timer_del(popw->timer); @@ -294,6 +329,22 @@ #endif break; + case POPUP_WARN_TYPE_INFO_DEVIAN: + devian = (DEVIANN *)popw->data; + tmp = DEVIANF(source_name_get) (devian, -1); + if (strcmp(popw->name, tmp)) + { + evas_stringshare_del(popw->name); + popw->name = evas_stringshare_add(tmp); + edje_object_part_text_set(popw->face, "name", popw->name); + } + /* Log */ + popw->log = evas_list_append(popw->log, evas_stringshare_add(text)); + times = evas_list_count(popw->log); + snprintf(buf, sizeof(buf), "%d", times); + edje_object_part_text_set(popw->face, "times", buf); + break; + case POPUP_WARN_TYPE_INFO_TIMER: /* Timer */ ecore_timer_del(popw->timer); @@ -406,6 +457,27 @@ if (DEVIANM->conf->sources_rss_popup_news_timer) popw->timer = ecore_timer_add(DEVIANM->conf->sources_rss_popup_news_timer, _cb_timer, popw); #endif + break; + + case POPUP_WARN_TYPE_INFO_DEVIAN: + times = evas_list_count(popw->log); + if (times == 1) + { + DEVIANF(popup_warn_del) (popw); + return; + } + /* Log */ + l = evas_list_last(popw->log); + tmp = evas_list_data(l); + edje_object_part_text_set(popw->face, "text", tmp); + evas_stringshare_del(tmp); + popw->log = evas_list_remove_list(popw->log, l); + times--; + if (times > 1) + snprintf(buf, sizeof(buf), "%d", times); + else + strcpy(buf, ""); + edje_object_part_text_set(popw->face, "times", buf); break; } } =================================================================== RCS file: /cvs/e/e_modules/devian/src/module/e_mod_popup_warn.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- e_mod_popup_warn.h 5 Apr 2006 17:48:48 -0000 1.2 +++ e_mod_popup_warn.h 11 Apr 2006 11:18:44 -0000 1.3 @@ -11,7 +11,8 @@ #define POPUP_WARN_TYPE_DEVIAN 0 #define POPUP_WARN_TYPE_INFO 1 -#define POPUP_WARN_TYPE_INFO_TIMER 2 +#define POPUP_WARN_TYPE_INFO_DEVIAN 2 +#define POPUP_WARN_TYPE_INFO_TIMER 3 #define POPUP_WARN_EDJE_MESSAGE_SHOW_DESACTIVATE 0 =================================================================== RCS file: /cvs/e/e_modules/devian/src/module/e_mod_source_picture.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- e_mod_source_picture.c 5 Apr 2006 17:48:48 -0000 1.2 +++ e_mod_source_picture.c 11 Apr 2006 11:18:44 -0000 1.3 @@ -201,14 +201,17 @@ { DSOURCE(("Set edje background %s", file)); - if ((zone->container->num == 0) && (zone->num == 0) && (zone->desk_x_current == 0) && (zone->desk_y_current == 0)) + if ((zone->container->num == 0) && (zone->num == 0) && + (zone->desk_x_current == 0) && (zone->desk_y_current == 0)) { e_lib_background_set(strdup(file)); } else { - e_lib_desktop_background_del(zone->container->num, zone->num, zone->desk_x_current, zone->desk_y_current); - e_lib_desktop_background_add(zone->container->num, zone->num, zone->desk_x_current, zone->desk_y_current, + e_lib_desktop_background_del(zone->container->num, zone->num, + zone->desk_x_current, zone->desk_y_current); + e_lib_desktop_background_add(zone->container->num, zone->num, + zone->desk_x_current, zone->desk_y_current, strdup(file)); } } @@ -358,7 +361,8 @@ "<underline=on underline_color=#000>Picture path :</> %s<br>" "<br>" "<underline=on underline_color=#000>Total pictures in local list :</> %d", - DEVIANF(source_picture_name_get) (source, edje_part), path, evas_list_count(DEVIANM->picture_list_local->pictures)); + DEVIANF(source_picture_name_get) (source, edje_part), path, + evas_list_count(DEVIANM->picture_list_local->pictures)); e_dialog_title_set(dia, MODULE_NAME " Module - Picture Informations"); e_dialog_icon_set(dia, "enlightenment/e", 64); e_dialog_text_set(dia, buf); @@ -427,7 +431,8 @@ path = picture->path; snprintf(buf, sizeof(buf), "<underline=on underline_color=#000>%s</><br><br>" - "<underline=on underline_color=#000>Path :</> %s<br><br>" "%s", picture->picture_description->name, path, buf_ext); + "<underline=on underline_color=#000>Path :</> %s<br><br>" "%s", + picture->picture_description->name, path, buf_ext); //E_FREE(path); return strdup(buf); ------------------------------------------------------- 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