itemData->item = hi;
itemData->historyUI = std::shared_ptr<tizen_browser::base_ui::HistoryUI>(this);
_history_item_data.push_back(itemData);
- setEmptyGengrid(false);
}
void HistoryUI::addHistoryItems(std::shared_ptr<services::HistoryItemVector> items)
Elm_Object_Item* historyView = m_map_history_views.at(uri);
elm_object_item_del(historyView);
m_map_history_views.erase(uri);
-
- setEmptyGengrid(0 == m_map_history_views.size());
-}
-
-Evas_Object* HistoryUI::createNoHistoryLabel()
-{
- BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
- Evas_Object *label = elm_label_add(m_parent);
- elm_object_text_set(label, "No favorite websites.");
- evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
- return label;
-}
-
-void HistoryUI::setEmptyGengrid(bool setEmpty)
-{
- BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
- Evas_Object *obj = (setEmpty ? createNoHistoryLabel() : nullptr);
- elm_object_part_content_set(m_gengrid, "elm.swallow.empty", obj);
}
void HistoryUI::hide()
{
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
- evas_object_hide(elm_layout_content_get(m_history_layout, "m_genListToday"));
- evas_object_hide(elm_layout_content_get(m_history_layout, "m_gengrid"));
- evas_object_hide(elm_layout_content_get(m_history_layout, "m_ActionBar"));
+ evas_object_hide(elm_layout_content_get(m_history_layout, "action_bar_history"));
evas_object_hide(m_history_layout);
}
elm_gengrid_clear(m_gengrid);
m_map_history_views.clear();
_history_item_data.clear();
- setEmptyGengrid(true);
}
void HistoryUI::_history_item_clicked_cb(void *data, Evas_Object *obj, void *event_info)
static void _close_clicked_cb(void *data, Evas_Object *obj, void *event_info);
static void _history_item_clicked_cb(void *data, Evas_Object *obj, void *event_info);
- void setEmptyGengrid(bool setEmpty);
-
Evas_Object *m_history_layout;
Evas_Object *m_actionBar;
Evas_Object *m_genListToday;
Elm_Gengrid_Item_Class * m_item_class;
std::map<std::string,Elm_Object_Item*> m_map_history_views;
std::string m_edjFilePath;
- Evas_Object *createNoHistoryLabel();
};
}
m_mainUI->mostVisitedClicked.connect(boost::bind(&SimpleUI::onMostVisitedClicked, this,_1));
m_mainUI->bookmarkClicked.connect(boost::bind(&SimpleUI::onBookmarkButtonClicked, this,_1));
m_mainUI->bookmarkManagerClicked.connect(boost::bind(&SimpleUI::onBookmarkManagerButtonClicked, this,_1));
-
}
if (url.empty()) {
{
BROWSER_LOGD("%s:%d %s", __FILE__, __LINE__, __func__);
m_historyService->clearAllHistory();
- m_mainUI->clearHistoryGenlist();
- m_mainUI->showHistory();
+ m_historyUI.reset();
}
void SimpleUI::onMostVisitedClicked(const std::string&)
void SimpleUI::showHistoryUI(const std::string& str)
{
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
- m_historyUI =
- std::dynamic_pointer_cast<tizen_browser::base_ui::HistoryUI,tizen_browser::core::AbstractService>
- (tizen_browser::core::ServiceManager::getInstance().getService("org.tizen.browser.historyui"));
- M_ASSERT(m_historyUI);
- m_historyUI->clearHistoryClicked.connect(boost::bind(&SimpleUI::onClearHistoryClicked, this,_1));
- m_historyUI->closeHistoryUIClicked.connect(boost::bind(&SimpleUI::closeHistoryUI, this,_1));
- m_historyUI->historyItemClicked.connect(boost::bind(&SimpleUI::onOpenURLInNewTab, this,_1));
- m_historyUI->addHistoryItems(getHistory());
- m_historyUI->show(m_window.get());
+ if(!m_historyUI)
+ {
+ m_historyUI =
+ std::dynamic_pointer_cast<tizen_browser::base_ui::HistoryUI,tizen_browser::core::AbstractService>
+ (tizen_browser::core::ServiceManager::getInstance().getService("org.tizen.browser.historyui"));
+ M_ASSERT(m_historyUI);
+ m_historyUI->clearHistoryClicked.connect(boost::bind(&SimpleUI::onClearHistoryClicked, this,_1));
+ m_historyUI->closeHistoryUIClicked.connect(boost::bind(&SimpleUI::closeHistoryUI, this,_1));
+ m_historyUI->historyItemClicked.connect(boost::bind(&SimpleUI::onOpenURLInNewTab, this,_1));
+ m_historyUI->addHistoryItems(getHistory());
+ m_historyUI->show(m_window.get());
+ }
}
void SimpleUI::closeHistoryUI(const std::string& str)
{
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
- m_historyUI = nullptr;
+ m_historyUI.reset();
}
void SimpleUI::showSettingsUI(const std::string& str)