static void _populate(app_t *app) { FILE *fp; if (app->infile) { fp = fopen(app->infile, "r"); if (fp == NULL) { fprintf(stderr, "Could not open file for reading \"%s\": %s\n", app->infile, strerror(errno)); return; } } else { fprintf(stderr, "No input file provided, reading from stdin.\n"); fp = stdin; } while (!feof(fp)) { Evas_Object *obj; Evas_Coord w, h; char *line; unsigned n; int i; n = 0; line = NULL; i = getline(&line, &n, fp); if (i < 0) break; if (i == 0) { free(line); continue; } line[i - 1] = '\0'; obj = _new_list_item(app, line); e_box_pack_end(app->e_box, obj); edje_object_size_min_calc(obj, &w, &h); e_box_pack_options_set(obj, 1, 1, 1, 0, 0.0, 0.5, w, h, 9999, h); evas_object_show(obj); free(line); } if (fp != stdin) fclose(fp); e_box_align_set(app->e_box, 0.0, 1.0); app->current = 0; }
static void _item_refresh_mode_feed(News_Item *ni, int important_only, int unread_only, int changed_order, int changed_content, int changed_state) { Evas_Object *box; Evas_Object *obj; if (!eina_list_count(ni->config->feed_refs)) return; box = ni->view.box; NEWS_ITEM_FEEDS_FOREACH_BEG_LIST(ni->config->feed_refs); { obj = _feed->obj; if (important_only && (!_feed->important)) continue; if (unread_only && (!_feed->doc || !_feed->doc->unread_count)) continue; DITEM(("refresh : feed %s", _feed->name)); if (!_feed->obj || changed_content || changed_state) { news_feed_obj_refresh(_feed, changed_content, changed_state); obj = _feed->obj; } if (!_feed->obj || changed_order) { /* insert in the box */ e_box_pack_end(box, obj); e_box_pack_options_set(obj, 1, 1, /* fill */ 1, 1, /* expand */ 0, 0, /* align */ 0, 0, -1, -1 ); evas_object_show(obj); } _feed->obj = obj; } NEWS_ITEM_FEEDS_FOREACH_END(); }
static void _item_refresh_mode_one(News_Item *ni, int changed_order, int changed_state) { Evas_Object *box; Evas_Object *obj; box = ni->view.box; obj = ni->view.obj_mode_one; /* create obj */ if (!obj) { obj = edje_object_add(ni->gcc->gadcon->evas); news_theme_edje_set(obj, NEWS_THEME_FEEDONE); edje_object_signal_callback_add(obj, "e,action,open", "e", _cb_item_open, ni); } if (!ni->view.obj_mode_one || changed_order) { e_box_pack_end(box, obj); e_box_pack_options_set(obj, 1, 1, /* fill */ 1, 1, /* expand */ 0, 0, /* align */ 0, 0, -1, -1 ); evas_object_show(obj); } /* state */ if (!ni->view.obj_mode_one || changed_state) { if (ni->unread_count) edje_object_signal_emit(obj, "e,state,new,set", "e"); else edje_object_signal_emit(obj, "e,state,new,unset", "e"); } ni->view.obj_mode_one = obj; }
static void setup_gui_list(app_t *app) { Evas_Object *obj; int item_w, item_h, box_w, box_h, i, n_items; destroy_gui_list(app); obj = _new_list_item(app, NULL); edje_object_size_min_calc(obj, &item_w, &item_h); evas_object_del(obj); app->item_height = item_h; e_box_freeze(app->e_box); evas_object_geometry_get(app->e_box, &app->box_x, &app->box_y, &box_w, &box_h); app->box_y -= item_h; evas_object_move(app->e_box, app->box_x, app->box_y); n_items = box_h / item_h + 3; app->n_evas_items = n_items; app->evas_items = malloc(n_items * sizeof(Evas_Object *)); for (i = 0; i < n_items; i++) { Evas_Object *obj; obj = _new_list_item(app, ""); app->evas_items[i] = obj; e_box_pack_end(app->e_box, obj); edje_object_size_min_calc(obj, &item_w, &item_h); e_box_pack_options_set(obj, 1, 1, 1, 0, 0.0, 0.5, item_w, item_h, 9999, item_h); evas_object_show(obj); } e_box_align_set(app->e_box, 0.0, 1.0); app->arrow_down = edje_object_part_object_get(app->edje_main, "arrow_down"); app->arrow_up = edje_object_part_object_get(app->edje_main, "arrow_up"); evas_object_event_callback_add(app->arrow_up, EVAS_CALLBACK_MOUSE_DOWN, mouse_down_arrow_up, app); evas_object_event_callback_add(app->arrow_up, EVAS_CALLBACK_MOUSE_UP, mouse_up_arrow_up, app); evas_object_event_callback_add(app->arrow_down, EVAS_CALLBACK_MOUSE_DOWN, mouse_down_arrow_down, app); evas_object_event_callback_add(app->arrow_down, EVAS_CALLBACK_MOUSE_UP, mouse_up_arrow_down, app); fill_gui_list(app); e_box_thaw(app->e_box); }