GengridItemBase * GengridItemBase::getNextItem() { Elm_Object_Item *it = elm_gengrid_item_next_get(item); if (!it) return NULL; GengridItemBase *next = reinterpret_cast<GengridItemBase *>(elm_object_item_data_get(it)); return next; }
Eina_Bool Add_To_Most_Visited_Sites_View::_save_button_clicked(void) { BROWSER_LOGD("[%s]", __func__); Evas_Object *entry = br_elm_editfield_entry_get(m_url_edit_field); char* url = _trim(elm_entry_markup_to_utf8(elm_entry_entry_get(entry))); if (!url || !strlen(url)) { show_msg_popup(BR_STRING_EMPTY); return EINA_FALSE; } std::string full_url = std::string(url); if (_has_url_sheme(url)) { char *token = strstr(url, BROWSER_URL_SCHEME_CHECK); if (token && strlen(token) == 3) { /* If input url has only sheme such as 'http://', 'https://' */ show_msg_popup(BR_STRING_EMPTY); return EINA_FALSE; } } else full_url = std::string(BROWSER_HTTP_SCHEME) + std::string(url); if (m_most_visited_sites->m_selected_item->url && strlen(m_most_visited_sites->m_selected_item->url)) { if (!strcmp(full_url.c_str(), m_most_visited_sites->m_selected_item->url)) { /* If the url is not changed in case of modify speed dial item. */ if (elm_naviframe_bottom_item_get(m_navi_bar) != elm_naviframe_top_item_get(m_navi_bar)) elm_naviframe_item_pop(m_navi_bar); return EINA_FALSE; } } std::string history_id; history_id = m_most_visited_sites->m_most_visited_sites_db->get_history_id_by_url(full_url.c_str()); char *screen_shot_path = NULL; if (history_id.empty()) screen_shot_path = strdup("default_noscreenshot"); else screen_shot_path = strdup(history_id.c_str()); if (!screen_shot_path) { BROWSER_LOGE("strdup failed"); return EINA_FALSE; } int index = 0; Elm_Object_Item *it = elm_gengrid_first_item_get(m_most_visited_sites->m_gengrid); do { if (it == m_most_visited_sites->m_selected_item->item) break; index++; } while (it = elm_gengrid_item_next_get(it)); if (!m_most_visited_sites->m_most_visited_sites_db->save_most_visited_sites_item(index, full_url.c_str(), full_url.c_str(), screen_shot_path)) { BROWSER_LOGE("save_most_visited_sites_item failed"); return EINA_FALSE; } free(screen_shot_path); if (!m_most_visited_sites->_reload_items()) { BROWSER_LOGE("m_most_visited_sites->_reload_items failed"); return EINA_FALSE; } return EINA_TRUE; }