summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-12-06 16:49:06 (GMT)
committerfluxgen <fluxgen>2003-12-06 16:49:06 (GMT)
commitfc4e008f3c3c0a4d07a929617214bd6c5ac3b233 (patch)
tree697c6c443786eabcd7788088ff2107c2f56d5d33
parent0d6c463145b9c656586e6dc6d68dd9b72400268e (diff)
downloadfluxbox_lack-fc4e008f3c3c0a4d07a929617214bd6c5ac3b233.zip
fluxbox_lack-fc4e008f3c3c0a4d07a929617214bd6c5ac3b233.tar.bz2
fixed minor bug in menu item and saving resources when changing value
-rw-r--r--src/ClockTool.cc19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/ClockTool.cc b/src/ClockTool.cc
index 4120749..c23028f 100644
--- a/src/ClockTool.cc
+++ b/src/ClockTool.cc
@@ -20,12 +20,13 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 21// DEALINGS IN THE SOFTWARE.
22 22
23// $Id: ClockTool.cc,v 1.6 2003/12/04 23:02:23 fluxgen Exp $ 23// $Id: ClockTool.cc,v 1.7 2003/12/06 16:49:06 fluxgen Exp $
24 24
25#include "ClockTool.hh" 25#include "ClockTool.hh"
26 26
27#include "ToolTheme.hh" 27#include "ToolTheme.hh"
28#include "Screen.hh" 28#include "Screen.hh"
29#include "CommandParser.hh"
29 30
30#include "FbTk/SimpleCommand.hh" 31#include "FbTk/SimpleCommand.hh"
31#include "FbTk/ImageControl.hh" 32#include "FbTk/ImageControl.hh"
@@ -40,7 +41,7 @@
40 41
41class ClockMenuItem: public FbTk::MenuItem { 42class ClockMenuItem: public FbTk::MenuItem {
42public: 43public:
43 ClockMenuItem::ClockMenuItem(ClockTool &tool): 44 explicit ClockMenuItem::ClockMenuItem(ClockTool &tool):
44 FbTk::MenuItem(""), m_tool(tool) { 45 FbTk::MenuItem(""), m_tool(tool) {
45 // determine 12/24 hour format 46 // determine 12/24 hour format
46 if (m_tool.timeFormat().find("%k") != std::string::npos || 47 if (m_tool.timeFormat().find("%k") != std::string::npos ||
@@ -85,12 +86,17 @@ public:
85 else if ((pos = newformat.find("%P")) != std::string::npos) 86 else if ((pos = newformat.find("%P")) != std::string::npos)
86 newformat.erase(pos, 2); 87 newformat.erase(pos, 2);
87 } 88 }
88 if (clock24hour) 89
90
91 m_tool.setTimeFormat(newformat);
92
93 if (m_tool.timeFormat().find("%k") != std::string::npos ||
94 m_tool.timeFormat().find("%H") != std::string::npos ||
95 m_tool.timeFormat().find("%T") != std::string::npos)
89 setLabel("Clock: 24h"); 96 setLabel("Clock: 24h");
90 else 97 else
91 setLabel("Clock: 12h"); 98 setLabel("Clock: 12h");
92 99
93 m_tool.setTimeFormat(newformat);
94 } // else some other strange format...so we don't do anything 100 } // else some other strange format...so we don't do anything
95 FbTk::MenuItem::click(button, time); 101 FbTk::MenuItem::click(button, time);
96 } 102 }
@@ -121,7 +127,10 @@ ClockTool::ClockTool(const FbTk::FbWindow &parent,
121 m_timer.start(); 127 m_timer.start();
122 128
123 m_button.setGC(m_theme.textGC()); 129 m_button.setGC(m_theme.textGC());
124 menu.insert(new ClockMenuItem(*this)); 130 FbTk::RefCount<FbTk::Command> saverc(CommandParser::instance().parseLine("saverc"));
131 FbTk::MenuItem *item = new ClockMenuItem(*this);
132 item->setCommand(saverc);
133 menu.insert(item);
125 update(0); 134 update(0);
126} 135}
127 136