From 6b17507b76e3ac1efd8aa5dc12684a233d52046b Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Fri, 24 Feb 2012 22:20:50 +0100 Subject: GUI: Fix "clear" buttons after theme switch (bug #3482459) Because the "clear" buttons are very different between themes (in the Modern theme they have a graphical symbol, while in the Classic theme they have a letter), they have to be removed and re-added when reflowing the layout. This is patterned after how the LauncherDialog class handles the larger changes in layout. Removing widgets from a tab turned out to be trickier than I first thought, so I had to move the removeWidget() method from Dialog to GuiObject. --- gui/object.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'gui/object.cpp') diff --git a/gui/object.cpp b/gui/object.cpp index 2ec42df9d7..73c4f74d6c 100644 --- a/gui/object.cpp +++ b/gui/object.cpp @@ -59,4 +59,24 @@ void GuiObject::reflowLayout() { } } +void GuiObject::removeWidget(Widget *del) { + if (del == _firstWidget) { + Widget *del_next = del->next(); + del->setNext(0); + _firstWidget = del_next; + return; + } + + Widget *w = _firstWidget; + while (w) { + if (w->next() == del) { + Widget *del_next = del->next(); + del->setNext(0); + w->setNext(del_next); + return; + } + w = w->next(); + } +} + } // End of namespace GUI -- cgit v1.2.3