summaryrefslogtreecommitdiff
path: root/src/bin/e_widget_toolbar.c
diff options
context:
space:
mode:
authorChristopher Michael <cpmichael1@comcast.net>2011-01-01 15:51:09 +0000
committerChristopher Michael <cpmichael1@comcast.net>2011-01-01 15:51:09 +0000
commit645ad54f555c395ff3fcf792b27718e0f24a9db6 (patch)
treea4180c8dc23b292298f9231aaf60d65b0dc6908e /src/bin/e_widget_toolbar.c
parent71d8f97aff67ad52c9483addcee9ad39faadfe0c (diff)
Add traps in toolbar widget to make sure obj & wd are valid.
Add traps in e_fwin to make sure we have a toolbar before trying to operate on it. SVN revision: 55792
Diffstat (limited to 'src/bin/e_widget_toolbar.c')
-rw-r--r--src/bin/e_widget_toolbar.c39
1 files changed, 25 insertions, 14 deletions
diff --git a/src/bin/e_widget_toolbar.c b/src/bin/e_widget_toolbar.c
index 7218e8e..2ce49df 100644
--- a/src/bin/e_widget_toolbar.c
+++ b/src/bin/e_widget_toolbar.c
@@ -103,7 +103,8 @@ e_widget_toolbar_item_append(Evas_Object *obj, Evas_Object *icon, const char *la
103 Item *it; 103 Item *it;
104 Evas_Coord mw = 0, mh = 0, vw = 0, vh = 0; 104 Evas_Coord mw = 0, mh = 0, vw = 0, vh = 0;
105 105
106 wd = e_widget_data_get(obj); 106 if (!obj) return;
107 if (!(wd = e_widget_data_get(obj))) return;
107 o = edje_object_add(evas_object_evas_get(obj)); 108 o = edje_object_add(evas_object_evas_get(obj));
108 e_theme_edje_object_set(o, "base/theme/widgets", 109 e_theme_edje_object_set(o, "base/theme/widgets",
109 "e/widgets/toolbar/item"); 110 "e/widgets/toolbar/item");
@@ -150,7 +151,8 @@ e_widget_toolbar_item_remove(Evas_Object *obj, int num)
150 E_Widget_Data *wd; 151 E_Widget_Data *wd;
151 Item *it; 152 Item *it;
152 153
153 wd = e_widget_data_get(obj); 154 if (!obj) return;
155 if (!(wd = e_widget_data_get(obj))) return;
154 it = eina_list_nth(wd->items, num); 156 it = eina_list_nth(wd->items, num);
155 if (it) 157 if (it)
156 { 158 {
@@ -169,7 +171,8 @@ e_widget_toolbar_item_select(Evas_Object *obj, int num)
169 Item *it = NULL; 171 Item *it = NULL;
170 int i = 0; 172 int i = 0;
171 173
172 wd = e_widget_data_get(obj); 174 if (!obj) return;
175 if (!(wd = e_widget_data_get(obj))) return;
173 EINA_LIST_FOREACH(wd->items, l, it) 176 EINA_LIST_FOREACH(wd->items, l, it)
174 { 177 {
175 if (i == num) 178 if (i == num)
@@ -190,7 +193,8 @@ e_widget_toolbar_item_label_set(Evas_Object *obj, int num, const char *label)
190 E_Widget_Data *wd = NULL; 193 E_Widget_Data *wd = NULL;
191 Item *it = NULL; 194 Item *it = NULL;
192 195
193 wd = e_widget_data_get(obj); 196 if (!obj) return;
197 if (!(wd = e_widget_data_get(obj))) return;
194 it = eina_list_nth(wd->items, num); 198 it = eina_list_nth(wd->items, num);
195 if (it) 199 if (it)
196 { 200 {
@@ -214,7 +218,8 @@ e_widget_toolbar_scrollable_set(Evas_Object *obj, Eina_Bool scrollable)
214 E_Widget_Data *wd; 218 E_Widget_Data *wd;
215 Evas_Coord mw = 0, mh = 0, vw = 0, vh = 0; 219 Evas_Coord mw = 0, mh = 0, vw = 0, vh = 0;
216 220
217 wd = e_widget_data_get(obj); 221 if (!obj) return;
222 if (!(wd = e_widget_data_get(obj))) return;
218 wd->scrollable = scrollable; 223 wd->scrollable = scrollable;
219 e_box_size_min_get(wd->o_box, &mw, &mh); 224 e_box_size_min_get(wd->o_box, &mw, &mh);
220 evas_object_resize(wd->o_box, mw, mh); 225 evas_object_resize(wd->o_box, mw, mh);
@@ -232,7 +237,8 @@ e_widget_toolbar_focus_steal_set(Evas_Object *obj, Eina_Bool steal)
232{ 237{
233 E_Widget_Data *wd; 238 E_Widget_Data *wd;
234 239
235 wd = e_widget_data_get(obj); 240 if (!obj) return;
241 if (!(wd = e_widget_data_get(obj))) return;
236 if (wd->focus_steal == steal) return; 242 if (wd->focus_steal == steal) return;
237 if (steal) 243 if (steal)
238 { 244 {
@@ -256,7 +262,8 @@ e_widget_toolbar_clear(Evas_Object *obj)
256 E_Widget_Data *wd = NULL; 262 E_Widget_Data *wd = NULL;
257 Item *it = NULL; 263 Item *it = NULL;
258 264
259 wd = e_widget_data_get(obj); 265 if (!obj) return;
266 if (!(wd = e_widget_data_get(obj))) return;
260 EINA_LIST_FREE(wd->items, it) 267 EINA_LIST_FREE(wd->items, it)
261 { 268 {
262 evas_object_del(it->o_base); 269 evas_object_del(it->o_base);
@@ -273,7 +280,8 @@ e_widget_toolbar_item_selected_get(Evas_Object *obj)
273 Item *it = NULL; 280 Item *it = NULL;
274 int i = 0; 281 int i = 0;
275 282
276 wd = e_widget_data_get(obj); 283 if (!obj) return 0;
284 if (!(wd = e_widget_data_get(obj))) return 0;
277 EINA_LIST_FOREACH(wd->items, l, it) 285 EINA_LIST_FOREACH(wd->items, l, it)
278 { 286 {
279 if (it->selected) return i; 287 if (it->selected) return i;
@@ -289,7 +297,8 @@ _e_wid_del_hook(Evas_Object *obj)
289 E_Widget_Data *wd; 297 E_Widget_Data *wd;
290 Item *it; 298 Item *it;
291 299
292 wd = e_widget_data_get(obj); 300 if (!obj) return;
301 if (!(wd = e_widget_data_get(obj))) return;
293 EINA_LIST_FREE(wd->items, it) 302 EINA_LIST_FREE(wd->items, it)
294 { 303 {
295 evas_object_del(it->o_base); 304 evas_object_del(it->o_base);
@@ -304,7 +313,8 @@ _e_wid_disable_hook(Evas_Object *obj)
304{ 313{
305 E_Widget_Data *wd; 314 E_Widget_Data *wd;
306 315
307 wd = e_widget_data_get(obj); 316 if (!obj) return;
317 if (!(wd = e_widget_data_get(obj))) return;
308 if (e_widget_disabled_get(obj)) 318 if (e_widget_disabled_get(obj))
309 edje_object_signal_emit(e_scrollframe_edje_object_get(wd->o_base), 319 edje_object_signal_emit(e_scrollframe_edje_object_get(wd->o_base),
310 "e,state,disabled", "e"); 320 "e,state,disabled", "e");
@@ -341,7 +351,7 @@ _e_wid_signal_prev(void *data, Evas_Object *obj __UNUSED__, const char *emission
341 Eina_List *l, *l2; 351 Eina_List *l, *l2;
342 Item *it = NULL, *it2 = NULL; 352 Item *it = NULL, *it2 = NULL;
343 353
344 wd = e_widget_data_get(data); 354 if (!(wd = e_widget_data_get(data))) return;
345 if ((!wd->o_base) || (!wd->o_box)) return; 355 if ((!wd->o_base) || (!wd->o_box)) return;
346 EINA_LIST_FOREACH(wd->items, l, it) 356 EINA_LIST_FOREACH(wd->items, l, it)
347 { 357 {
@@ -366,7 +376,7 @@ _e_wid_signal_next(void *data, Evas_Object *obj __UNUSED__, const char *emission
366 Eina_List *l, *l2; 376 Eina_List *l, *l2;
367 Item *it = NULL, *it2 = NULL; 377 Item *it = NULL, *it2 = NULL;
368 378
369 wd = e_widget_data_get(data); 379 if (!(wd = e_widget_data_get(data))) return;
370 if ((!wd->o_base) || (!wd->o_box)) return; 380 if ((!wd->o_base) || (!wd->o_box)) return;
371 EINA_LIST_FOREACH(wd->items, l, it) 381 EINA_LIST_FOREACH(wd->items, l, it)
372 { 382 {
@@ -392,7 +402,7 @@ _e_wid_cb_scrollframe_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __
392 Eina_List *l; 402 Eina_List *l;
393 Item *it; 403 Item *it;
394 404
395 wd = e_widget_data_get(data); 405 if (!(wd = e_widget_data_get(data))) return;
396 if ((!wd->o_base) || (!wd->o_box)) return; 406 if ((!wd->o_base) || (!wd->o_box)) return;
397 407
398 e_scrollframe_child_viewport_size_get(wd->o_base, &vw, &vh); 408 e_scrollframe_child_viewport_size_get(wd->o_base, &vw, &vh);
@@ -486,7 +496,8 @@ _e_wid_focus_hook(Evas_Object *obj)
486{ 496{
487 E_Widget_Data *wd; 497 E_Widget_Data *wd;
488 498
489 wd = e_widget_data_get(obj); 499 if (!obj) return;
500 if (!(wd = e_widget_data_get(obj))) return;
490 if (e_widget_focus_get(obj)) 501 if (e_widget_focus_get(obj))
491 { 502 {
492 edje_object_signal_emit(wd->o_base, "e,state,focused", "e"); 503 edje_object_signal_emit(wd->o_base, "e,state,focused", "e");