summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2004-01-02 21:59:52 (GMT)
committerfluxgen <fluxgen>2004-01-02 21:59:52 (GMT)
commitbaa6a4a42ffead3ed8db11fd84d69706e98b2df7 (patch)
treeda509c157145ce302888b116fd60f5a6ebc4046f
parent7c11f8b5931e87d11b177bee7b0e10f3fad33f72 (diff)
downloadfluxbox_lack-baa6a4a42ffead3ed8db11fd84d69706e98b2df7.zip
fluxbox_lack-baa6a4a42ffead3ed8db11fd84d69706e98b2df7.tar.bz2
fixed checking in ThemeItem int
-rw-r--r--src/FbTk/ThemeItems.hh19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/FbTk/ThemeItems.hh b/src/FbTk/ThemeItems.hh
index d652c52..4d4d081 100644
--- a/src/FbTk/ThemeItems.hh
+++ b/src/FbTk/ThemeItems.hh
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: ThemeItems.hh,v 1.3 2003/11/28 23:02:05 fluxgen Exp $ 22// $Id: ThemeItems.hh,v 1.4 2004/01/02 21:59:52 fluxgen Exp $
23 23
24/// @file implements common theme items 24/// @file implements common theme items
25 25
@@ -64,9 +64,13 @@ void FbTk::ThemeItem<int>::setDefaultValue() {
64 64
65template <> 65template <>
66void FbTk::ThemeItem<int>::setFromString(const char *str) { 66void FbTk::ThemeItem<int>::setFromString(const char *str) {
67 if (str == 0) 67 if (str == 0) {
68 setDefaultValue();
68 return; 69 return;
69 sscanf(str, "%d", &m_value); 70 }
71
72 if (sscanf(str, "%d", &m_value) < 1)
73 setDefaultValue();
70} 74}
71 75
72template <> 76template <>
@@ -124,16 +128,21 @@ void ThemeItem<FbTk::Texture>::load() {
124 128
125 StringUtil::removeFirstWhitespace(pixmap_name); 129 StringUtil::removeFirstWhitespace(pixmap_name);
126 StringUtil::removeTrailingWhitespace(pixmap_name); 130 StringUtil::removeTrailingWhitespace(pixmap_name);
127 131 if (pixmap_name.empty()) {
132 m_value.pixmap() = 0;
133 return;
134 }
128 std::auto_ptr<PixmapWithMask> pm(Image::load(pixmap_name, 135 std::auto_ptr<PixmapWithMask> pm(Image::load(pixmap_name,
129 m_tm.screenNum())); 136 m_tm.screenNum()));
130 if (pm.get() == 0) { 137 if (pm.get() == 0) {
131 if (FbTk::ThemeManager::instance().verbose()) 138 if (FbTk::ThemeManager::instance().verbose()) {
132 cerr<<"Resource("<<name()+".pixmap" 139 cerr<<"Resource("<<name()+".pixmap"
133 <<"): Failed to load image: "<<pixmap_name<<endl; 140 <<"): Failed to load image: "<<pixmap_name<<endl;
141 }
134 m_value.pixmap() = 0; 142 m_value.pixmap() = 0;
135 } else 143 } else
136 m_value.pixmap() = pm->pixmap().release(); 144 m_value.pixmap() = pm->pixmap().release();
145
137} 146}
138 147
139template <> 148template <>