summaryrefslogtreecommitdiff
path: root/src/bin/e_bg.c
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2012-07-09 11:50:08 +0000
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>2012-07-09 11:50:08 +0000
commit5546f4109d01cd2c79643e6d9801df3824b9b0eb (patch)
tree1ef31c99d4b5611330cc9553edaca7c36a4b929f /src/bin/e_bg.c
parent0410c64a873fd159421e818e134b8fd476a5b453 (diff)
formatting
SVN revision: 73502
Diffstat (limited to 'src/bin/e_bg.c')
-rw-r--r--src/bin/e_bg.c366
1 files changed, 187 insertions, 179 deletions
diff --git a/src/bin/e_bg.c b/src/bin/e_bg.c
index f6f4e81..f6509b6 100644
--- a/src/bin/e_bg.c
+++ b/src/bin/e_bg.c
@@ -14,13 +14,14 @@ static E_Fm2_Mime_Handler *bg_hdl = NULL;
14 14
15struct _E_Bg_Image_Import_Handle 15struct _E_Bg_Image_Import_Handle
16{ 16{
17 struct { 17 struct
18 void (*func)(void *data, const char *edje_file); 18 {
19 void (*func)(void *data, const char *edje_file);
19 void *data; 20 void *data;
20 } cb; 21 } cb;
21 E_Dialog *dia; 22 E_Dialog *dia;
22 E_Util_Image_Import_Handle *importer; 23 E_Util_Image_Import_Handle *importer;
23 Eina_Bool canceled:1; 24 Eina_Bool canceled : 1;
24}; 25};
25 26
26/* externally accessible functions */ 27/* externally accessible functions */
@@ -32,14 +33,14 @@ e_bg_init(void)
32 33
33 /* Register mime handler */ 34 /* Register mime handler */
34 bg_hdl = e_fm2_mime_handler_new(_("Set As Background"), 35 bg_hdl = e_fm2_mime_handler_new(_("Set As Background"),
35 "preferences-desktop-wallpaper", 36 "preferences-desktop-wallpaper",
36 e_bg_handler_set, NULL, 37 e_bg_handler_set, NULL,
37 e_bg_handler_test, NULL); 38 e_bg_handler_test, NULL);
38 if (bg_hdl) 39 if (bg_hdl)
39 { 40 {
40 e_fm2_mime_handler_glob_add(bg_hdl, "*.edj"); 41 e_fm2_mime_handler_glob_add(bg_hdl, "*.edj");
41 e_fm2_mime_handler_mime_add(bg_hdl, "image/png"); 42 e_fm2_mime_handler_mime_add(bg_hdl, "image/png");
42 e_fm2_mime_handler_mime_add(bg_hdl, "image/jpeg"); 43 e_fm2_mime_handler_mime_add(bg_hdl, "image/jpeg");
43 } 44 }
44 45
45 /* Register files in use */ 46 /* Register files in use */
@@ -48,8 +49,8 @@ e_bg_init(void)
48 49
49 EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg) 50 EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
50 { 51 {
51 if (!cfbg) continue; 52 if (!cfbg) continue;
52 e_filereg_register(cfbg->file); 53 e_filereg_register(cfbg->file);
53 } 54 }
54 55
55 E_EVENT_BG_UPDATE = ecore_event_type_new(); 56 E_EVENT_BG_UPDATE = ecore_event_type_new();
@@ -65,8 +66,8 @@ e_bg_shutdown(void)
65 /* Deregister mime handler */ 66 /* Deregister mime handler */
66 if (bg_hdl) 67 if (bg_hdl)
67 { 68 {
68 e_fm2_mime_handler_glob_del(bg_hdl, "*.edj"); 69 e_fm2_mime_handler_glob_del(bg_hdl, "*.edj");
69 e_fm2_mime_handler_free(bg_hdl); 70 e_fm2_mime_handler_free(bg_hdl);
70 } 71 }
71 72
72 /* Deregister files in use */ 73 /* Deregister files in use */
@@ -75,8 +76,8 @@ e_bg_shutdown(void)
75 76
76 EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg) 77 EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
77 { 78 {
78 if (!cfbg) continue; 79 if (!cfbg) continue;
79 e_filereg_deregister(cfbg->file); 80 e_filereg_deregister(cfbg->file);
80 } 81 }
81 82
82 return 1; 83 return 1;
@@ -99,33 +100,37 @@ e_bg_config_get(int container_num, int zone_num, int desk_x, int desk_y)
99 /* look for desk specific background. */ 100 /* look for desk specific background. */
100 if (container_num >= 0 || zone_num >= 0 || desk_x >= 0 || desk_y >= 0) 101 if (container_num >= 0 || zone_num >= 0 || desk_x >= 0 || desk_y >= 0)
101 { 102 {
102 EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg) 103 EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
103 { 104 {
104 int spec; 105 int spec;
105 106
106 if (!cfbg) continue; 107 if (!cfbg) continue;
107 spec = 0; 108 spec = 0;
108 if (cfbg->container == container_num) spec++; 109 if (cfbg->container == container_num) spec++;
109 else if (cfbg->container >= 0) continue; 110 else if (cfbg->container >= 0)
110 if (cfbg->zone == zone_num) spec++; 111 continue;
111 else if (cfbg->zone >= 0) continue; 112 if (cfbg->zone == zone_num) spec++;
112 if (cfbg->desk_x == desk_x) spec++; 113 else if (cfbg->zone >= 0)
113 else if (cfbg->desk_x >= 0) continue; 114 continue;
114 if (cfbg->desk_y == desk_y) spec++; 115 if (cfbg->desk_x == desk_x) spec++;
115 else if (cfbg->desk_y >= 0) continue; 116 else if (cfbg->desk_x >= 0)
116 117 continue;
117 if (spec <= current_spec) continue; 118 if (cfbg->desk_y == desk_y) spec++;
118 bgfile = cfbg->file; 119 else if (cfbg->desk_y >= 0)
119 if (bgfile) 120 continue;
120 { 121
121 if (bgfile[0] != '/') 122 if (spec <= current_spec) continue;
122 { 123 bgfile = cfbg->file;
123 const char *bf; 124 if (bgfile)
124 125 {
125 bf = e_path_find(path_backgrounds, bgfile); 126 if (bgfile[0] != '/')
126 if (bf) bgfile = bf; 127 {
127 } 128 const char *bf;
128 } 129
130 bf = e_path_find(path_backgrounds, bgfile);
131 if (bf) bgfile = bf;
132 }
133 }
129 if (eina_str_has_extension(bgfile, ".edj")) 134 if (eina_str_has_extension(bgfile, ".edj"))
130 { 135 {
131 entries = edje_file_collection_list(bgfile); 136 entries = edje_file_collection_list(bgfile);
@@ -147,7 +152,7 @@ e_bg_config_get(int container_num, int zone_num, int desk_x, int desk_y)
147 bg = cfbg; 152 bg = cfbg;
148 current_spec = spec; 153 current_spec = spec;
149 } 154 }
150 } 155 }
151 } 156 }
152 return bg; 157 return bg;
153} 158}
@@ -166,31 +171,31 @@ e_bg_file_get(int container_num, int zone_num, int desk_x, int desk_y)
166 /* fall back to default */ 171 /* fall back to default */
167 if (cfbg) 172 if (cfbg)
168 { 173 {
169 bgfile = cfbg->file; 174 bgfile = cfbg->file;
170 if (bgfile) 175 if (bgfile)
171 { 176 {
172 if (bgfile[0] != '/') 177 if (bgfile[0] != '/')
173 { 178 {
174 const char *bf; 179 const char *bf;
175 180
176 bf = e_path_find(path_backgrounds, bgfile); 181 bf = e_path_find(path_backgrounds, bgfile);
177 if (bf) bgfile = bf; 182 if (bf) bgfile = bf;
178 } 183 }
179 } 184 }
180 } 185 }
181 else 186 else
182 { 187 {
183 bgfile = e_config->desktop_default_background; 188 bgfile = e_config->desktop_default_background;
184 if (bgfile) 189 if (bgfile)
185 { 190 {
186 if (bgfile[0] != '/') 191 if (bgfile[0] != '/')
187 { 192 {
188 const char *bf; 193 const char *bf;
189 194
190 bf = e_path_find(path_backgrounds, bgfile); 195 bf = e_path_find(path_backgrounds, bgfile);
191 if (bf) bgfile = bf; 196 if (bf) bgfile = bf;
192 } 197 }
193 } 198 }
194 if (bgfile && eina_str_has_extension(bgfile, ".edj")) 199 if (bgfile && eina_str_has_extension(bgfile, ".edj"))
195 { 200 {
196 entries = edje_file_collection_list(bgfile); 201 entries = edje_file_collection_list(bgfile);
@@ -207,10 +212,11 @@ e_bg_file_get(int container_num, int zone_num, int desk_x, int desk_y)
207 edje_file_collection_list_free(entries); 212 edje_file_collection_list_free(entries);
208 } 213 }
209 } 214 }
210 else if ((bgfile) && (bgfile[0])) ok = 1; 215 else if ((bgfile) && (bgfile[0]))
211 if (!ok) 216 ok = 1;
212 bgfile = e_theme_edje_file_get("base/theme/background", 217 if (!ok)
213 "e/desktop/background"); 218 bgfile = e_theme_edje_file_get("base/theme/background",
219 "e/desktop/background");
214 } 220 }
215 221
216 return bgfile; 222 return bgfile;
@@ -225,8 +231,10 @@ e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition)
225 E_Desk *desk; 231 E_Desk *desk;
226 232
227 if (transition == E_BG_TRANSITION_START) trans = e_config->transition_start; 233 if (transition == E_BG_TRANSITION_START) trans = e_config->transition_start;
228 else if (transition == E_BG_TRANSITION_DESK) trans = e_config->transition_desk; 234 else if (transition == E_BG_TRANSITION_DESK)
229 else if (transition == E_BG_TRANSITION_CHANGE) trans = e_config->transition_change; 235 trans = e_config->transition_desk;
236 else if (transition == E_BG_TRANSITION_CHANGE)
237 trans = e_config->transition_change;
230 if ((!trans) || (!trans[0])) transition = E_BG_TRANSITION_NONE; 238 if ((!trans) || (!trans[0])) transition = E_BG_TRANSITION_NONE;
231 239
232 desk = e_desk_current_get(zone); 240 desk = e_desk_current_get(zone);
@@ -237,46 +245,46 @@ e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition)
237 245
238 if (zone->bg_object) 246 if (zone->bg_object)
239 { 247 {
240 const char *pfile = ""; 248 const char *pfile = "";
241 249
242 edje_object_file_get(zone->bg_object, &pfile, NULL); 250 edje_object_file_get(zone->bg_object, &pfile, NULL);
243 if (!e_util_strcmp(pfile, bgfile)) return; 251 if (!e_util_strcmp(pfile, bgfile)) return;
244 } 252 }
245 253
246 if (transition == E_BG_TRANSITION_NONE) 254 if (transition == E_BG_TRANSITION_NONE)
247 { 255 {
248 if (zone->bg_object) 256 if (zone->bg_object)
249 { 257 {
250 evas_object_del(zone->bg_object); 258 evas_object_del(zone->bg_object);
251 zone->bg_object = NULL; 259 zone->bg_object = NULL;
252 } 260 }
253 } 261 }
254 else 262 else
255 { 263 {
256 char buf[4096]; 264 char buf[4096];
257 265
258 if (zone->bg_object) 266 if (zone->bg_object)
259 { 267 {
260 if (zone->prev_bg_object) 268 if (zone->prev_bg_object)
261 evas_object_del(zone->prev_bg_object); 269 evas_object_del(zone->prev_bg_object);
262 zone->prev_bg_object = zone->bg_object; 270 zone->prev_bg_object = zone->bg_object;
263 if (zone->transition_object) 271 if (zone->transition_object)
264 evas_object_del(zone->transition_object); 272 evas_object_del(zone->transition_object);
265 zone->transition_object = NULL; 273 zone->transition_object = NULL;
266 zone->bg_object = NULL; 274 zone->bg_object = NULL;
267 } 275 }
268 o = edje_object_add(zone->container->bg_evas); 276 o = edje_object_add(zone->container->bg_evas);
269 zone->transition_object = o; 277 zone->transition_object = o;
270 /* FIXME: segv if zone is deleted while up??? */ 278 /* FIXME: segv if zone is deleted while up??? */
271 evas_object_data_set(o, "e_zone", zone); 279 evas_object_data_set(o, "e_zone", zone);
272 snprintf(buf, sizeof(buf), "e/transitions/%s", trans); 280 snprintf(buf, sizeof(buf), "e/transitions/%s", trans);
273 e_theme_edje_object_set(o, "base/theme/transitions", buf); 281 e_theme_edje_object_set(o, "base/theme/transitions", buf);
274 edje_object_signal_callback_add(o, "e,state,done", "*", _e_bg_signal, zone); 282 edje_object_signal_callback_add(o, "e,state,done", "*", _e_bg_signal, zone);
275 evas_object_move(o, zone->x, zone->y); 283 evas_object_move(o, zone->x, zone->y);
276 evas_object_resize(o, zone->w, zone->h); 284 evas_object_resize(o, zone->w, zone->h);
277 evas_object_layer_set(o, -1); 285 evas_object_layer_set(o, -1);
278 evas_object_clip_set(o, zone->bg_clip_object); 286 evas_object_clip_set(o, zone->bg_clip_object);
279 evas_object_show(o); 287 evas_object_show(o);
280 } 288 }
281 if (eina_str_has_extension(bgfile, ".edj")) 289 if (eina_str_has_extension(bgfile, ".edj"))
282 { 290 {
@@ -294,24 +302,24 @@ e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition)
294 zone->bg_object = o; 302 zone->bg_object = o;
295 if (transition == E_BG_TRANSITION_NONE) 303 if (transition == E_BG_TRANSITION_NONE)
296 { 304 {
297 evas_object_move(o, zone->x, zone->y); 305 evas_object_move(o, zone->x, zone->y);
298 evas_object_resize(o, zone->w, zone->h); 306 evas_object_resize(o, zone->w, zone->h);
299 evas_object_layer_set(o, -1); 307 evas_object_layer_set(o, -1);
300 } 308 }
301 evas_object_clip_set(o, zone->bg_clip_object); 309 evas_object_clip_set(o, zone->bg_clip_object);
302 evas_object_show(o); 310 evas_object_show(o);
303 311
304 if (transition != E_BG_TRANSITION_NONE) 312 if (transition != E_BG_TRANSITION_NONE)
305 { 313 {
306 edje_extern_object_max_size_set(zone->prev_bg_object, 65536, 65536); 314 edje_extern_object_max_size_set(zone->prev_bg_object, 65536, 65536);
307 edje_extern_object_min_size_set(zone->prev_bg_object, 0, 0); 315 edje_extern_object_min_size_set(zone->prev_bg_object, 0, 0);
308 edje_object_part_swallow(zone->transition_object, "e.swallow.bg.old", 316 edje_object_part_swallow(zone->transition_object, "e.swallow.bg.old",
309 zone->prev_bg_object); 317 zone->prev_bg_object);
310 edje_extern_object_max_size_set(zone->bg_object, 65536, 65536); 318 edje_extern_object_max_size_set(zone->bg_object, 65536, 65536);
311 edje_extern_object_min_size_set(zone->bg_object, 0, 0); 319 edje_extern_object_min_size_set(zone->bg_object, 0, 0);
312 edje_object_part_swallow(zone->transition_object, "e.swallow.bg.new", 320 edje_object_part_swallow(zone->transition_object, "e.swallow.bg.new",
313 zone->bg_object); 321 zone->bg_object);
314 edje_object_signal_emit(zone->transition_object, "e,action,start", "e"); 322 edje_object_signal_emit(zone->transition_object, "e,action,start", "e");
315 } 323 }
316} 324}
317 325
@@ -326,20 +334,20 @@ e_bg_default_set(const char *file)
326 334
327 if (!changed) 335 if (!changed)
328 { 336 {
329 eina_stringshare_del(file); 337 eina_stringshare_del(file);
330 return; 338 return;
331 } 339 }
332 340
333 if (e_config->desktop_default_background) 341 if (e_config->desktop_default_background)
334 { 342 {
335 e_filereg_deregister(e_config->desktop_default_background); 343 e_filereg_deregister(e_config->desktop_default_background);
336 eina_stringshare_del(e_config->desktop_default_background); 344 eina_stringshare_del(e_config->desktop_default_background);
337 } 345 }
338 346
339 if (file) 347 if (file)
340 { 348 {
341 e_filereg_register(file); 349 e_filereg_register(file);
342 e_config->desktop_default_background = file; 350 e_config->desktop_default_background = file;
343 } 351 }
344 else 352 else
345 e_config->desktop_default_background = NULL; 353 e_config->desktop_default_background = NULL;
@@ -363,16 +371,16 @@ e_bg_add(int container, int zone, int desk_x, int desk_y, const char *file)
363 371
364 EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg) 372 EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
365 { 373 {
366 if ((cfbg) && 374 if ((cfbg) &&
367 (cfbg->container == container) && 375 (cfbg->container == container) &&
368 (cfbg->zone == zone) && 376 (cfbg->zone == zone) &&
369 (cfbg->desk_x == desk_x) && 377 (cfbg->desk_x == desk_x) &&
370 (cfbg->desk_y == desk_y) && 378 (cfbg->desk_y == desk_y) &&
371 (cfbg->file == file)) 379 (cfbg->file == file))
372 { 380 {
373 eina_stringshare_del(file); 381 eina_stringshare_del(file);
374 return; 382 return;
375 } 383 }
376 } 384 }
377 385
378 e_bg_del(container, zone, desk_x, desk_y); 386 e_bg_del(container, zone, desk_x, desk_y);
@@ -403,16 +411,16 @@ e_bg_del(int container, int zone, int desk_x, int desk_y)
403 411
404 EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg) 412 EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
405 { 413 {
406 if (!cfbg) continue; 414 if (!cfbg) continue;
407 if ((cfbg->container == container) && (cfbg->zone == zone) && 415 if ((cfbg->container == container) && (cfbg->zone == zone) &&
408 (cfbg->desk_x == desk_x) && (cfbg->desk_y == desk_y)) 416 (cfbg->desk_x == desk_x) && (cfbg->desk_y == desk_y))
409 { 417 {
410 e_config->desktop_backgrounds = eina_list_remove_list(e_config->desktop_backgrounds, l); 418 e_config->desktop_backgrounds = eina_list_remove_list(e_config->desktop_backgrounds, l);
411 e_filereg_deregister(cfbg->file); 419 e_filereg_deregister(cfbg->file);
412 if (cfbg->file) eina_stringshare_del(cfbg->file); 420 if (cfbg->file) eina_stringshare_del(cfbg->file);
413 free(cfbg); 421 free(cfbg);
414 break; 422 break;
415 } 423 }
416 } 424 }
417 425
418 ev = E_NEW(E_Event_Bg_Update, 1); 426 ev = E_NEW(E_Event_Bg_Update, 1);
@@ -433,13 +441,13 @@ e_bg_update(void)
433 441
434 EINA_LIST_FOREACH(e_manager_list(), l, man) 442 EINA_LIST_FOREACH(e_manager_list(), l, man)
435 { 443 {
436 EINA_LIST_FOREACH(man->containers, ll, con) 444 EINA_LIST_FOREACH(man->containers, ll, con)
437 { 445 {
438 EINA_LIST_FOREACH(con->zones, lll, zone) 446 EINA_LIST_FOREACH(con->zones, lll, zone)
439 { 447 {
440 e_zone_bg_reconfigure(zone); 448 e_zone_bg_reconfigure(zone);
441 } 449 }
442 } 450 }
443 } 451 }
444} 452}
445 453
@@ -501,11 +509,11 @@ e_bg_image_import(const char *image_file, void (*cb)(void *data, const char *edj
501 handle->cb.data = (void *)data; 509 handle->cb.data = (void *)data;
502 510
503 handle->dia = e_util_image_import_settings_new 511 handle->dia = e_util_image_import_settings_new
504 (image_file, _e_bg_image_import_dialog_done, handle); 512 (image_file, _e_bg_image_import_dialog_done, handle);
505 if (!handle->dia) 513 if (!handle->dia)
506 { 514 {
507 free(handle); 515 free(handle);
508 return NULL; 516 return NULL;
509 } 517 }
510 e_dialog_show(handle->dia); 518 e_dialog_show(handle->dia);
511 519
@@ -527,18 +535,18 @@ e_bg_image_import_cancel(E_Bg_Image_Import_Handle *handle)
527 535
528 if (handle->cb.func) 536 if (handle->cb.func)
529 { 537 {
530 handle->cb.func(handle->cb.data, NULL); 538 handle->cb.func(handle->cb.data, NULL);
531 handle->cb.func = NULL; 539 handle->cb.func = NULL;
532 } 540 }
533 if (handle->dia) 541 if (handle->dia)
534 { 542 {
535 e_object_del(E_OBJECT(handle->dia)); 543 e_object_del(E_OBJECT(handle->dia));
536 handle->dia = NULL; 544 handle->dia = NULL;
537 } 545 }
538 else if (handle->importer) 546 else if (handle->importer)
539 { 547 {
540 e_util_image_import_cancel(handle->importer); 548 e_util_image_import_cancel(handle->importer);
541 handle->importer = NULL; 549 handle->importer = NULL;
542 } 550 }
543 E_FREE(handle); 551 E_FREE(handle);
544} 552}
@@ -556,19 +564,19 @@ e_bg_handler_set(Evas_Object *obj __UNUSED__, const char *path, void *data __UNU
556 char buf[PATH_MAX]; 564 char buf[PATH_MAX];
557 int copy = 1; 565 int copy = 1;
558 566
559 E_Container *con = e_container_current_get(e_manager_current_get()); 567 E_Container *con = e_container_current_get(e_manager_current_get());
560 E_Zone *zone = e_zone_current_get(con); 568 E_Zone *zone = e_zone_current_get(con);
561 E_Desk *desk = e_desk_current_get(zone); 569 E_Desk *desk = e_desk_current_get(zone);
562 570
563 /* if not in system dir or user dir, copy to user dir */ 571 /* if not in system dir or user dir, copy to user dir */
564 e_prefix_data_concat_static(buf, "data/backgrounds"); 572 e_prefix_data_concat_static(buf, "data/backgrounds");
565 if (!strncmp(buf, path, strlen(buf))) 573 if (!strncmp(buf, path, strlen(buf)))
566 copy = 0; 574 copy = 0;
567 if (copy) 575 if (copy)
568 { 576 {
569 e_user_dir_concat_static(buf, "backgrounds"); 577 e_user_dir_concat_static(buf, "backgrounds");
570 if (!strncmp(buf, path, strlen(buf))) 578 if (!strncmp(buf, path, strlen(buf)))
571 copy = 0; 579 copy = 0;
572 } 580 }
573 if (copy) 581 if (copy)
574 { 582 {
@@ -587,10 +595,10 @@ e_bg_handler_set(Evas_Object *obj __UNUSED__, const char *path, void *data __UNU
587 e_bg_add(con->num, zone->num, desk->x, desk->y, buf); 595 e_bg_add(con->num, zone->num, desk->x, desk->y, buf);
588 } 596 }
589 else 597 else
590 e_bg_add(con->num, zone->num, desk->x, desk->y, path); 598 e_bg_add(con->num, zone->num, desk->x, desk->y, path);
591 } 599 }
592 else 600 else
593 e_bg_add(con->num, zone->num, desk->x, desk->y, path); 601 e_bg_add(con->num, zone->num, desk->x, desk->y, path);
594 602
595 e_bg_update(); 603 e_bg_update();
596 e_config_save_queue(); 604 e_config_save_queue();
@@ -615,13 +623,12 @@ e_bg_handler_set(Evas_Object *obj __UNUSED__, const char *path, void *data __UNU
615EAPI int 623EAPI int
616e_bg_handler_test(Evas_Object *obj __UNUSED__, const char *path, void *data __UNUSED__) 624e_bg_handler_test(Evas_Object *obj __UNUSED__, const char *path, void *data __UNUSED__)
617{ 625{
618
619 if (!path) return 0; 626 if (!path) return 0;
620 627
621 if (_e_bg_file_edje_check(path)) 628 if (_e_bg_file_edje_check(path))
622 { 629 {
623 if (edje_file_group_exists(path, "e/desktop/background")) return 1; 630 if (edje_file_group_exists(path, "e/desktop/background")) return 1;
624 return 0; 631 return 0;
625 } 632 }
626 633
627 /* it's image/png or image/jpeg, we'll import it. */ 634 /* it's image/png or image/jpeg, we'll import it. */
@@ -636,13 +643,13 @@ _e_bg_signal(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNU
636 643
637 if (zone->prev_bg_object) 644 if (zone->prev_bg_object)
638 { 645 {
639 evas_object_del(zone->prev_bg_object); 646 evas_object_del(zone->prev_bg_object);
640 zone->prev_bg_object = NULL; 647 zone->prev_bg_object = NULL;
641 } 648 }
642 if (zone->transition_object) 649 if (zone->transition_object)
643 { 650 {
644 evas_object_del(zone->transition_object); 651 evas_object_del(zone->transition_object);
645 zone->transition_object = NULL; 652 zone->transition_object = NULL;
646 } 653 }
647 evas_object_move(zone->bg_object, zone->x, zone->y); 654 evas_object_move(zone->bg_object, zone->x, zone->y);
648 evas_object_resize(zone->bg_object, zone->w, zone->h); 655 evas_object_resize(zone->bg_object, zone->w, zone->h);
@@ -684,17 +691,17 @@ _e_bg_image_import_dialog_done(void *data, const char *path, Eina_Bool ok, Eina_
684 snprintf(buf + off, sizeof(buf) - off, "-%u.edj", num); 691 snprintf(buf + off, sizeof(buf) - off, "-%u.edj", num);
685 692
686 handle->importer = e_util_image_import 693 handle->importer = e_util_image_import
687 (path, buf, "e/desktop/background", external, quality, mode, 694 (path, buf, "e/desktop/background", external, quality, mode,
688 _e_bg_image_import_done, handle); 695 _e_bg_image_import_done, handle);
689 if (!handle->importer) goto aborted; 696 if (!handle->importer) goto aborted;
690 697
691 return; 698 return;
692 699
693 aborted: 700aborted:
694 if (handle->cb.func) 701 if (handle->cb.func)
695 { 702 {
696 handle->cb.func(handle->cb.data, NULL); 703 handle->cb.func(handle->cb.data, NULL);
697 handle->cb.func = NULL; 704 handle->cb.func = NULL;
698 } 705 }
699 if (!handle->canceled) E_FREE(handle); 706 if (!handle->canceled) E_FREE(handle);
700} 707}
@@ -708,8 +715,8 @@ _e_bg_image_import_done(void *data, Eina_Bool ok, const char *image_path __UNUSE
708 715
709 if (handle->cb.func) 716 if (handle->cb.func)
710 { 717 {
711 handle->cb.func(handle->cb.data, edje_path); 718 handle->cb.func(handle->cb.data, edje_path);
712 handle->cb.func = NULL; 719 handle->cb.func = NULL;
713 } 720 }
714 721
715 if (!handle->canceled) E_FREE(handle); 722 if (!handle->canceled) E_FREE(handle);
@@ -728,3 +735,4 @@ _e_bg_handler_image_imported(void *data __UNUSED__, const char *image_path)
728 e_bg_update(); 735 e_bg_update();
729 e_config_save_queue(); 736 e_config_save_queue();
730} 737}
738