diff --git a/source/gui/gui.h b/source/gui/gui.h index f076431..bcab200 100644 --- a/source/gui/gui.h +++ b/source/gui/gui.h @@ -480,6 +480,10 @@ class GuiWindow : public GuiElement void Remove(GuiElement* e); //!Removes all GuiElements void RemoveAll(); + //!Looks for the specified GuiElement + //!\param e The GuiElement to find + //!\return true if found, false otherwise + bool Find(GuiElement* e); //!Returns the GuiElement at the specified index //!\param index The index of the element //!\return A pointer to the element at the index, NULL on error (eg: out of bounds) diff --git a/source/gui/gui_window.cpp b/source/gui/gui_window.cpp index 92981c2..fd5e785 100644 --- a/source/gui/gui_window.cpp +++ b/source/gui/gui_window.cpp @@ -69,6 +69,18 @@ void GuiWindow::RemoveAll() _elements.clear(); } +bool GuiWindow::Find(GuiElement* e) +{ + if (e == NULL) + return false; + + u32 elemSize = _elements.size(); + for (u32 i = 0; i < elemSize; ++i) + if(e == _elements.at(i)) + return true; + return false; +} + GuiElement* GuiWindow::GetGuiElementAt(u32 index) const { if (index >= _elements.size()) @@ -104,7 +116,8 @@ void GuiWindow::DrawTooltip() if(_elements.size() == 0 || !this->IsVisible()) return; - for (u8 i = 0; i < _elements.size(); i++) + u32 elemSize = _elements.size(); + for (u32 i = 0; i < elemSize; i++) { try { _elements.at(i)->DrawTooltip(); } catch (const std::exception& e) { } @@ -398,7 +411,8 @@ void GuiWindow::MoveSelectionVert(int dir) void GuiWindow::ResetText() { - for (u8 i = 0; i < _elements.size(); i++) + u32 elemSize = _elements.size(); + for (u32 i = 0; i < elemSize; i++) { try { _elements.at(i)->ResetText(); } catch (const std::exception& e) { } diff --git a/source/networkop.cpp b/source/networkop.cpp index 077dde4..4254bfe 100644 --- a/source/networkop.cpp +++ b/source/networkop.cpp @@ -247,6 +247,9 @@ ConnectShare (bool silent) return false; #endif + if(networkShareInit) + return true; + int retry = 1; int chkS = (strlen(GCSettings.smbshare) > 0) ? 0:1; int chkI = (strlen(GCSettings.smbip) > 0) ? 0:1;