diff options
Diffstat (limited to 'src/Resources.cc')
-rw-r--r-- | src/Resources.cc | 40 |
1 files changed, 4 insertions, 36 deletions
diff --git a/src/Resources.cc b/src/Resources.cc index fde08d7..d8660eb 100644 --- a/src/Resources.cc +++ b/src/Resources.cc | |||
@@ -202,23 +202,10 @@ getString() const { | |||
202 | template<> | 202 | template<> |
203 | void FbTk::Resource<Layer>:: | 203 | void FbTk::Resource<Layer>:: |
204 | setFromString(const char *strval) { | 204 | setFromString(const char *strval) { |
205 | int tempnum = 0; | 205 | string str(strval); |
206 | if (sscanf(strval, "%d", &tempnum) == 1) | 206 | int tempnum = ::Layer::getNumFromString(str); |
207 | if (tempnum >= 0 && tempnum < ::Layer::NUM_LAYERS) | ||
207 | m_value = tempnum; | 208 | m_value = tempnum; |
208 | else if (strcasecmp(strval, "Menu") == 0) | ||
209 | m_value = ::Layer::MENU; | ||
210 | else if (strcasecmp(strval, "AboveDock") == 0) | ||
211 | m_value = ::Layer::ABOVE_DOCK; | ||
212 | else if (strcasecmp(strval, "Dock") == 0) | ||
213 | m_value = ::Layer::DOCK; | ||
214 | else if (strcasecmp(strval, "Top") == 0) | ||
215 | m_value = ::Layer::TOP; | ||
216 | else if (strcasecmp(strval, "Normal") == 0) | ||
217 | m_value = ::Layer::NORMAL; | ||
218 | else if (strcasecmp(strval, "Bottom") == 0) | ||
219 | m_value = ::Layer::BOTTOM; | ||
220 | else if (strcasecmp(strval, "Desktop") == 0) | ||
221 | m_value = ::Layer::DESKTOP; | ||
222 | else | 209 | else |
223 | setDefaultValue(); | 210 | setDefaultValue(); |
224 | } | 211 | } |
@@ -227,26 +214,7 @@ setFromString(const char *strval) { | |||
227 | template<> | 214 | template<> |
228 | string FbTk::Resource<Layer>:: | 215 | string FbTk::Resource<Layer>:: |
229 | getString() const { | 216 | getString() const { |
230 | switch (m_value.getNum()) { | 217 | return ::Layer::getString(m_value.getNum()); |
231 | case Layer::MENU: | ||
232 | return string("Menu"); | ||
233 | case Layer::ABOVE_DOCK: | ||
234 | return string("AboveDock"); | ||
235 | case Layer::DOCK: | ||
236 | return string("Dock"); | ||
237 | case Layer::TOP: | ||
238 | return string("Top"); | ||
239 | case Layer::NORMAL: | ||
240 | return string("Normal"); | ||
241 | case Layer::BOTTOM: | ||
242 | return string("Bottom"); | ||
243 | case Layer::DESKTOP: | ||
244 | return string("Desktop"); | ||
245 | default: | ||
246 | char tmpstr[128]; | ||
247 | sprintf(tmpstr, "%d", m_value.getNum()); | ||
248 | return string(tmpstr); | ||
249 | } | ||
250 | } | 218 | } |
251 | 219 | ||
252 | template<> | 220 | template<> |