Exemplo n.º 1
0
void _show_hs(void *data, Evas_Object *obj, void *event_info)
{
	elm_genlist_clear(highscores_genlist);
	if(!_itc)
	{
		_itc = elm_genlist_item_class_new();
        _itc->item_style = "default";
        _itc->func.text_get = _item_label_get;
        _itc->func.content_get = NULL;
        _itc->func.state_get = NULL;
        _itc->func.del = NULL;
	}

	Eet_File *eef = eet_open(RESULTS_FILE, EET_FILE_MODE_READ);
	int game_type = (int)(uintptr_t)(data);
	int j = 0;
	for(; j < 10; ++j)
	{
		char buf[50];
		int *res;
		sprintf(buf, "%d%d", game_type, j);
			
		res = eet_read(eef, buf, NULL);
		if(res && res[0] != -1)
		{
			elm_genlist_item_append(highscores_genlist, _itc, res, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
		}
	}
		//free(res); //MEMORY LEAK?
	
	eet_close(eef);
}
Exemplo n.º 2
0
void ActivityScenariosView::reloadCalendar()
{
    elm_genlist_clear(schedule_list);

    string weekday;
    switch (currDate.tm_wday)
    {
    case 0: weekday = _("Sunday"); break;
    case 1: weekday = _("Monday"); break;
    case 2: weekday = _("Tuesday"); break;
    case 3: weekday = _("Wednesday"); break;
    case 4: weekday = _("Thursday"); break;
    case 5: weekday = _("Friday"); break;
    case 6: weekday = _("Saturday"); break;
    default: break;
    }

    string month;
    switch (currDate.tm_mon)
    {
    case 0: month = _("January"); break;
    case 1: month = _("February"); break;
    case 2: month = _("Mars"); break;
    case 3: month = _("April"); break;
    case 4: month = _("May"); break;
    case 5: month = _("June"); break;
    case 6: month = _("July"); break;
    case 7: month = _("August"); break;
    case 8: month = _("September"); break;
    case 9: month = _("October"); break;
    case 10: month = _("November"); break;
    case 11: month = _("December"); break;
    default: break;
    }

    string label = _("On <blue>%1, %2 %3, %4</blue>");
    Utils::replace_str(label, "%1", weekday);
    Utils::replace_str(label, "%2", month);
    Utils::replace_str(label, "%3", Utils::to_string(currDate.tm_mday));
    Utils::replace_str(label, "%4", Utils::to_string(currDate.tm_year + 1900));
    setPartText("schedule.date", label);

    list<ScenarioSchedule> lst = CalaosModel::Instance().getScenario()->getScenarioForDate(currDate);
    for (auto i = lst.begin();i != lst.end();i++)
    {
        ScenarioSchedule sc = *i;
        GenlistItemScenarioSchedule *item = new GenlistItemScenarioSchedule(evas, parent, true, sc.scenario);
        item->setScheduleRange(sc.day, sc.timeRangeNum, currDate);
        item->schedule_add_click.connect(sigc::mem_fun(schedule_add_click, &sigc::signal<void, Scenario *>::emit));
        item->schedule_modify_click.connect(sigc::mem_fun(schedule_modify_click, &sigc::signal<void, Scenario *>::emit));
        item->schedule_del_click.connect(sigc::mem_fun(schedule_del_click, &sigc::signal<void, Scenario *>::emit));
        item->Append(schedule_list);
    }
}
Exemplo n.º 3
0
static void view_main_scan_ui_clear(void)
{
	__COMMON_FUNC_ENTER__;

	if (list == NULL) {
		return;
	}
	elm_genlist_clear(list);

	__COMMON_FUNC_EXIT__;
}
Exemplo n.º 4
0
ActivityAudioListView::~ActivityAudioListView()
{
    for (unsigned int i = 0;i < players.size();i++)
    {
        players[i].unsetPlayer();
        DELETE_NULL(players[i].object);
    }

    elm_genlist_clear(gplaylist);
    DELETE_NULL_FUNC(evas_object_del, gplaylist);

    DELETE_NULL_FUNC(evas_object_del, pager_browser);

    for_each(browser_root_buttons.begin(), browser_root_buttons.end(), Delete());
}
Exemplo n.º 5
0
void create_new_task(void *data, Evas_Object *obj, void *event_info)
{
	int i = total_tasks;
	total_tasks ++;

	if(strcmp(sel_category, "Deleted") == 0) {
		purge_tasks();
		elm_genlist_clear(list);
		return;
	}
	time_t curtime;
	struct tm *loctime;
	char dt[6];
	
	//get the time
	curtime = time (NULL);
	loctime = localtime (&curtime);
	strftime(dt, 6, "%d-%m", loctime);
	
	//get selected task if any
	Evas_Object *li = data;
	Elm_Object_Item *item = (Elm_Object_Item *)elm_genlist_selected_item_get(li);
	if (!item) item = elm_genlist_last_item_get(list);	//insert new line at end of list

	Task[i].no = i;
	Task[i].cb = 0;
	Task[i].pr = 1;
	strcpy(Task[i].text, "Task");
	strcpy(Task[i].date, dt);
	if(strcmp(sel_category, " All Tasks ")==0) strcpy(Task[i].cat, "Personal");
	else strcpy(Task[i].cat, sel_category);
	if(item) { 
		task_list[i] = elm_genlist_item_insert_after(list, &itc1, &Task[i], NULL, item, ELM_GENLIST_ITEM_NONE,
								  NULL, NULL);
	}
	//cater for no items in list
	else task_list[i] = elm_genlist_item_append(list, &itc1, &Task[i], NULL, ELM_GENLIST_ITEM_NONE,
								  NULL, NULL);
	last_rec = -1;
	WRITE = 0;
	//insert record
	//printf("total %d\n", i);
	insert_record(i);
	elm_genlist_item_selected_set(task_list[i], 1);
}
void Browser_Settings_Website_Setting::_refresh_details_list(website_setting_item *item_info)
{
	elm_genlist_clear(m_details_genlist);

	if (item_info->geolocation) {
		m_location_item_callback_data.type = BR_MENU_LOCATION;
		m_location_item_callback_data.cp = this;
		m_location_item_callback_data.user_data = item_info;
		m_location_item_callback_data.it = elm_genlist_item_append(m_details_genlist,
			&m_1_text_1_icon_item_class, &m_location_item_callback_data, NULL, ELM_GENLIST_ITEM_NONE,
			__details_item_selected_cb, &m_location_item_callback_data);
	}

	if (item_info->storage) {
		m_web_storage_item_callback_data.type = BR_MENU_WEB_STORAGE;
		m_web_storage_item_callback_data.cp = this;
		m_web_storage_item_callback_data.user_data = item_info;
		m_web_storage_item_callback_data.it = elm_genlist_item_append(m_details_genlist,
				&m_1_text_1_icon_item_class, &m_web_storage_item_callback_data, NULL, ELM_GENLIST_ITEM_NONE,
				__details_item_selected_cb, &m_web_storage_item_callback_data);
	}
}
Exemplo n.º 7
0
void select_category(void *data, Evas_Object *obj, void *event_info)
{
	char *ca = (char *)data, *cat;
	cat = strdup(ca);

	evas_object_hide(hs1);
	if(strcmp(cat, "Edit Categories")==0) {
		edit_cat();
		return;
	}
	if(strcmp(cat, "Deleted") ==0) {
		elm_object_text_set(new_button, "Purge");
	}
	else  elm_object_text_set(new_button, "Add");

	elm_object_text_set(sel_cat_bt, cat);
	strcpy(sel_category, cat);
	elm_genlist_clear(list);
	last_rec = -1;
	//show only those tasks that meet this category
	show_cat_tasks(cat);
}
Exemplo n.º 8
0
void slides_list_update()
{
    int i;
    List_Item *item;
    Eina_List *l;

    EINA_LIST_FREE(l_slides, item)
        free(item);

    for(i=0;i<eyelight_object_size_get(pres);i++)
        l_slides = eina_list_append(l_slides, calloc(1, sizeof(List_Item)));


    elm_genlist_clear(slides_list);

    EINA_LIST_FOREACH(l_slides, l, item)
    {
        item->item = elm_genlist_item_append(slides_list, &itc_slides,
                item,
                NULL,
                ELM_GENLIST_ITEM_NONE,
                _slides_list_sel,
                item);
    }
static void _genlist_renew(Evas_Object *obj, const char *style)
{
    Elm_Genlist_Item_Class *ic;
    int i;

    if (!obj) return;

    elm_genlist_clear(obj);

    ic = elm_genlist_item_class_new();
    ic->item_style = style;
    ic->func.text_get = _item_label_get;
    if (!strcmp(style, "progress"))
        ic->func.content_get = _item_content_get_progress;
    else
        ic->func.content_get = _item_content_get_default;
    ic->func.state_get = NULL;
    ic->func.del = NULL;

    for (i = 0; i < N_ITEMS; i++)
        elm_genlist_item_append(obj, ic, (void *)i, NULL, ELM_GENLIST_ITEM_NONE, _item_sel_cb, NULL);

    elm_genlist_item_class_free(ic);
}
/**
 * @brief Negative test case of ug_init elm_genlist_clear()
 */
static void utc_UIFW_elm_genlist_clear_func_02(void)
{
	elm_genlist_clear(NULL);
	tet_result(TET_PASS);
}
Exemplo n.º 11
0
void Gen::clear ()
{
  elm_genlist_clear (o);
}
Exemplo n.º 12
0
void ActivityScenariosView::loadScenarioList()
{
    elm_genlist_clear(scenario_list);
    GenlistItemScenarioHeader *headerLight = NULL, *headerShutter = NULL, *headerOther = NULL;

    if (view_mode == VIEW_MODE_ALL ||
        view_mode == VIEW_MODE_SCHEDULE)
    {
        headerLight = new GenlistItemScenarioHeader(evas, parent, _("Lights scenarios"));
        headerLight->Append(scenario_list);
        headerShutter = new GenlistItemScenarioHeader(evas, parent, _("Shutters scenarios"));
        headerShutter->Append(scenario_list);
        headerOther = new GenlistItemScenarioHeader(evas, parent, _("Other Scenarios"));
        headerOther->Append(scenario_list);
    }
    else if (view_mode == VIEW_MODE_LIGHT)
    {
        headerLight = new GenlistItemScenarioHeader(evas, parent, _("Lights scenarios"));
        headerLight->Append(scenario_list);
    }
    else if (view_mode == VIEW_MODE_SHUTTER)
    {
        headerShutter = new GenlistItemScenarioHeader(evas, parent, _("Shutters scenarios"));
        headerShutter->Append(scenario_list);
    }

    //populate the scenario list
    list<Scenario *>::iterator it = CalaosModel::Instance().getScenario()->scenarios.begin();
    for (;it != CalaosModel::Instance().getScenario()->scenarios.end();it++)
    {
        Scenario *sc = *it;
        bool cont = true;

        if (sc->getFirstCategory() == "light" &&
            (view_mode == VIEW_MODE_ALL || view_mode == VIEW_MODE_LIGHT || view_mode == VIEW_MODE_SCHEDULE))
        {
            if (view_mode == VIEW_MODE_SCHEDULE)
            {
                if (sc->isScheduled())
                    cont = false;
            }
            else
                cont = false;
        }

        if (sc->getFirstCategory() == "shutter" &&
            (view_mode == VIEW_MODE_ALL || view_mode == VIEW_MODE_SHUTTER || view_mode == VIEW_MODE_SCHEDULE))
        {
            if (view_mode == VIEW_MODE_SCHEDULE)
            {
                if (sc->isScheduled())
                    cont = false;
            }
            else
                cont = false;
        }

        if (sc->getFirstCategory() == "other" &&
            (view_mode == VIEW_MODE_ALL || view_mode == VIEW_MODE_SCHEDULE))
        {
            if (view_mode == VIEW_MODE_SCHEDULE)
            {
                if (sc->isScheduled())
                    cont = false;
            }
            else
                cont = false;
        }

        if (cont)
            continue;

        GenlistItemScenarioSchedule *item = new GenlistItemScenarioSchedule(evas, parent, false, sc);
        item->schedule_add_click.connect(sigc::mem_fun(schedule_add_click, &sigc::signal<void, Scenario *>::emit));
        item->schedule_modify_click.connect(sigc::mem_fun(schedule_modify_click, &sigc::signal<void, Scenario *>::emit));
        item->schedule_del_click.connect(sigc::mem_fun(schedule_del_click, &sigc::signal<void, Scenario *>::emit));
        if (sc->getFirstCategory() == "light")
            item->InsertAfter(scenario_list, headerLight);
        else if (sc->getFirstCategory() == "shutter")
            item->InsertAfter(scenario_list, headerShutter);
        else
            item->InsertAfter(scenario_list, headerOther);
    }
}
void ActivityScheduleScenarioView::reloadTimeRanges()
{
    elm_genlist_clear(schedule_list);

    vector<TimeRange> trange_sorted;
    auto sortTimeRange = [&trange_sorted](vector<TimeRange> &range, int day)
    {
        for (TimeRange &t: range)
        {
            auto it = std::find(trange_sorted.begin(), trange_sorted.end(), t);
            if (it != trange_sorted.end())
            {
                //timerange already in trange_sorted, add the day of week flag
                it->dayOfWeek.set(day);
            }
            else
            {
                TimeRange newtr = t;
                newtr.dayOfWeek.reset();
                newtr.dayOfWeek.set(day);
                trange_sorted.push_back(newtr);
            }
        }
    };

    sortTimeRange(range_infos.range_monday, 0);
    sortTimeRange(range_infos.range_tuesday, 1);
    sortTimeRange(range_infos.range_wednesday, 2);
    sortTimeRange(range_infos.range_thursday, 3);
    sortTimeRange(range_infos.range_friday, 4);
    sortTimeRange(range_infos.range_saturday, 5);
    sortTimeRange(range_infos.range_sunday, 6);

    for (TimeRange &t: trange_sorted)
    {
        GenlistItemScenarioScheduleTime *item = new GenlistItemScenarioScheduleTime(evas, parent, t);
        item->Append(schedule_list);
        item->edit_click.connect([=]()
        {
            is_edit = true;
            old_range = t;
            edit_range = t;
            editState = EDIT_START_TYPE;
            showTimeRangePopup();
        });
        item->del_click.connect([=]()
        {
            Evas_Object *table = createPaddingTable(evas, parent, 280, 260);

            Evas_Object *glist = elm_genlist_add(table);
            elm_object_style_set(glist, "calaos");
            elm_genlist_select_mode_set(glist, ELM_OBJECT_SELECT_MODE_ALWAYS);
            evas_object_size_hint_fill_set(glist, EVAS_HINT_FILL, EVAS_HINT_FILL);
            evas_object_size_hint_weight_set(glist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
            evas_object_show(glist);

            string title_label = _("Confirmation");
            title_label += "<br><small><light_blue>";
            title_label += _("Are you sure to delete this schedule?");
            title_label +=  "</light_blue></small>";
            GenlistItemBase *header = new GenlistItemSimpleHeader(evas, glist, title_label);
            header->Append(glist);

            Evas_Object *popup_del = elm_ctxpopup_add(parent);

            GenlistItemSimple *_item = new GenlistItemSimple(evas, parent, _("Yes, delete this schedule"), true);
            _item->Append(glist, header);
            _item->item_selected.connect([=](void *)
            {
                deleteTimeRange(t);
                elm_ctxpopup_dismiss(popup_del);
                reloadTimeRanges();
            });

            _item = new GenlistItemSimple(evas, parent, "Non", true);
            _item->Append(glist, header);
            _item->item_selected.connect([=](void *)
            {
                elm_ctxpopup_dismiss(popup_del);
            });

            elm_table_pack(table, glist, 1, 1, 1, 1);

            elm_object_content_set(popup_del, table);
            elm_object_style_set(popup_del, "calaos");
            elm_ctxpopup_direction_priority_set(popup_del,
                                                ELM_CTXPOPUP_DIRECTION_DOWN,
                                                ELM_CTXPOPUP_DIRECTION_UP,
                                                ELM_CTXPOPUP_DIRECTION_LEFT,
                                                ELM_CTXPOPUP_DIRECTION_RIGHT);

            Evas_Coord x,y;
            evas_pointer_canvas_xy_get(evas, &x, &y);
            evas_object_move(popup_del, x, y);
            evas_object_show(popup_del);
        });
    }

    //reload months
    if (range_infos.range_months.all())
    {
        //all months are selected

        item_all->setSelected(true);
        for (uint i = 0;i < items_months.size();i++)
            items_months[i]->setSelected(false);
    }
    else
    {
        item_all->setSelected(false);
        for (uint i = 0;i < items_months.size();i++)
            items_months[i]->setSelected(range_infos.range_months.test(i));
    }
}