all repos — fluxbox @ fc4e008f3c3c0a4d07a929617214bd6c5ac3b233

custom fork of the fluxbox windowmanager

fixed minor bug in menu item and saving resources when changing value
fluxgen fluxgen
commit

fc4e008f3c3c0a4d07a929617214bd6c5ac3b233

parent

0d6c463145b9c656586e6dc6d68dd9b72400268e

1 files changed, 14 insertions(+), 5 deletions(-)

jump to
M src/ClockTool.ccsrc/ClockTool.cc

@@ -20,12 +20,13 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: ClockTool.cc,v 1.6 2003/12/04 23:02:23 fluxgen Exp $ +// $Id: ClockTool.cc,v 1.7 2003/12/06 16:49:06 fluxgen Exp $ #include "ClockTool.hh" #include "ToolTheme.hh" #include "Screen.hh" +#include "CommandParser.hh" #include "FbTk/SimpleCommand.hh" #include "FbTk/ImageControl.hh"

@@ -40,7 +41,7 @@ #include <ctime>

class ClockMenuItem: public FbTk::MenuItem { public: - ClockMenuItem::ClockMenuItem(ClockTool &tool): + explicit ClockMenuItem::ClockMenuItem(ClockTool &tool): FbTk::MenuItem(""), m_tool(tool) { // determine 12/24 hour format if (m_tool.timeFormat().find("%k") != std::string::npos ||

@@ -85,12 +86,17 @@ newformat.erase(pos, 2);

else if ((pos = newformat.find("%P")) != std::string::npos) newformat.erase(pos, 2); } - if (clock24hour) + + + m_tool.setTimeFormat(newformat); + + if (m_tool.timeFormat().find("%k") != std::string::npos || + m_tool.timeFormat().find("%H") != std::string::npos || + m_tool.timeFormat().find("%T") != std::string::npos) setLabel("Clock: 24h"); else setLabel("Clock: 12h"); - m_tool.setTimeFormat(newformat); } // else some other strange format...so we don't do anything FbTk::MenuItem::click(button, time); }

@@ -121,7 +127,10 @@ m_timer.setCommand(update_graphic);

m_timer.start(); m_button.setGC(m_theme.textGC()); - menu.insert(new ClockMenuItem(*this)); + FbTk::RefCount<FbTk::Command> saverc(CommandParser::instance().parseLine("saverc")); + FbTk::MenuItem *item = new ClockMenuItem(*this); + item->setCommand(saverc); + menu.insert(item); update(0); }