and now add custom access info for items too and clean up nicely.
[framework/uifw/elementary.git] / src / lib / elm_main.c
1 #ifdef HAVE_CONFIG_H
2 # include "elementary_config.h"
3 #endif
4
5 #ifdef HAVE_FORK
6 #include <dlfcn.h> /* dlopen,dlclose,etc */
7 #endif
8
9 #ifdef HAVE_CRT_EXTERNS_H
10 # include <crt_externs.h>
11 #endif
12
13 #ifdef HAVE_EVIL
14 # include <Evil.h>
15 #endif
16
17 #include <Elementary.h>
18 #include "elm_priv.h"
19
20 #define SEMI_BROKEN_QUICKLAUNCH 1
21
22 static Elm_Version _version = { VMAJ, VMIN, VMIC, VREV };
23 EAPI Elm_Version *elm_version = &_version;
24
25 Eina_Bool
26 _elm_dangerous_call_check(const char *call)
27 {
28    char buf[256];
29    const char *eval;
30
31    snprintf(buf, sizeof(buf), "%i.%i.%i.%i", VMAJ, VMIN, VMIC, VREV);
32    eval = getenv("ELM_NO_FINGER_WAGGLING");
33    if ((eval) && (!strcmp(eval, buf)))
34      return 0;
35    printf("ELEMENTARY FINGER WAGGLE!!!!!!!!!!\n"
36           "\n"
37           "  %s() used.\n"
38           "PLEASE see the API documentation for this function. This call\n"
39           "should almost never be used. Only in very special cases.\n"
40           "\n"
41           "To remove this warning please set the environment variable:\n"
42           "  ELM_NO_FINGER_WAGGLING\n"
43           "To the value of the Elementary version + revision number. e.g.:\n"
44           "  1.2.5.40295\n"
45           "\n"
46           ,
47           call);
48    return 1;
49 }
50
51 static Eina_Bool _elm_signal_exit(void *data,
52                                   int   ev_type,
53                                   void *ev);
54
55 static Eina_Prefix *pfx = NULL;
56 char *_elm_appname = NULL;
57 const char *_elm_data_dir = NULL;
58 const char *_elm_lib_dir = NULL;
59 int _elm_log_dom = -1;
60
61 EAPI int ELM_EVENT_POLICY_CHANGED = 0;
62
63 static int _elm_init_count = 0;
64 static int _elm_sub_init_count = 0;
65 static int _elm_ql_init_count = 0;
66 static int _elm_policies[ELM_POLICY_LAST];
67 static Ecore_Event_Handler *_elm_exit_handler = NULL;
68 static Eina_Bool quicklaunch_on = 0;
69
70 static Eina_Bool
71 _elm_signal_exit(void *data  __UNUSED__,
72                  int ev_type __UNUSED__,
73                  void *ev    __UNUSED__)
74 {
75    elm_exit();
76    return ECORE_CALLBACK_PASS_ON;
77 }
78
79 void
80 _elm_rescale(void)
81 {
82    edje_scale_set(_elm_config->scale);
83    _elm_win_rescale(NULL, EINA_FALSE);
84 }
85
86 static void *app_mainfunc = NULL;
87 static const char *app_domain = NULL;
88 static const char *app_checkfile = NULL;
89
90 static const char *app_compile_bin_dir = NULL;
91 static const char *app_compile_lib_dir = NULL;
92 static const char *app_compile_data_dir = NULL;
93 static const char *app_compile_locale_dir = NULL;
94 static const char *app_prefix_dir = NULL;
95 static const char *app_bin_dir = NULL;
96 static const char *app_lib_dir = NULL;
97 static const char *app_data_dir = NULL;
98 static const char *app_locale_dir = NULL;
99
100 static Eina_Prefix *app_pfx = NULL;
101
102 static void
103 _prefix_check(void)
104 {
105    int argc = 0;
106    char **argv = NULL;
107    const char *dirs[4] = { NULL, NULL, NULL, NULL };
108    char *caps = NULL, *p1, *p2;
109
110    if (app_pfx) return;
111    if (!app_domain) return;
112
113    ecore_app_args_get(&argc, &argv);
114    if (argc < 1) return;
115
116    dirs[0] = app_compile_bin_dir;
117    dirs[1] = app_compile_lib_dir;
118    dirs[2] = app_compile_data_dir;
119    dirs[3] = app_compile_locale_dir;
120
121    if (!dirs[1]) dirs[1] = dirs[0];
122    if (!dirs[0]) dirs[0] = dirs[1];
123    if (!dirs[3]) dirs[3] = dirs[2];
124    if (!dirs[2]) dirs[2] = dirs[3];
125
126    if (app_domain)
127      {
128         caps = alloca(strlen(app_domain) + 1);
129         for (p1 = (char *)app_domain, p2 = caps; *p1; p1++, p2++)
130            *p2 = toupper(*p1);
131         *p2 = 0;
132      }
133    app_pfx = eina_prefix_new(argv[0], app_mainfunc, caps, app_domain,
134                              app_checkfile, dirs[0], dirs[1], dirs[2], dirs[3]);
135 }
136
137 static void
138 _prefix_shutdown(void)
139 {
140    if (app_pfx) eina_prefix_free(app_pfx);
141    if (app_domain) eina_stringshare_del(app_domain);
142    if (app_checkfile) eina_stringshare_del(app_checkfile);
143    if (app_compile_bin_dir) eina_stringshare_del(app_compile_bin_dir);
144    if (app_compile_lib_dir) eina_stringshare_del(app_compile_lib_dir);
145    if (app_compile_data_dir) eina_stringshare_del(app_compile_data_dir);
146    if (app_compile_locale_dir) eina_stringshare_del(app_compile_locale_dir);
147    if (app_prefix_dir) eina_stringshare_del(app_prefix_dir);
148    if (app_bin_dir) eina_stringshare_del(app_bin_dir);
149    if (app_lib_dir) eina_stringshare_del(app_lib_dir);
150    if (app_data_dir) eina_stringshare_del(app_data_dir);
151    if (app_locale_dir) eina_stringshare_del(app_locale_dir);
152    app_mainfunc = NULL;
153    app_domain = NULL;
154    app_checkfile = NULL;
155    app_compile_bin_dir = NULL;
156    app_compile_lib_dir = NULL;
157    app_compile_data_dir = NULL;
158    app_compile_locale_dir = NULL;
159    app_prefix_dir = NULL;
160    app_bin_dir = NULL;
161    app_lib_dir = NULL;
162    app_data_dir = NULL;
163    app_locale_dir = NULL;
164    app_pfx = NULL;
165 }
166
167 EAPI int
168 elm_init(int    argc,
169          char **argv)
170 {
171    _elm_init_count++;
172    if (_elm_init_count > 1) return _elm_init_count;
173    elm_quicklaunch_init(argc, argv);
174    elm_quicklaunch_sub_init(argc, argv);
175    _prefix_shutdown();
176    return _elm_init_count;
177 }
178
179 EAPI int
180 elm_shutdown(void)
181 {
182    _elm_init_count--;
183    if (_elm_init_count > 0) return _elm_init_count;
184    _elm_win_shutdown();
185    while (_elm_win_deferred_free) ecore_main_loop_iterate();
186 // wrningz :(
187 //   _prefix_shutdown();
188    elm_quicklaunch_sub_shutdown();
189    elm_quicklaunch_shutdown();
190    return _elm_init_count;
191 }
192
193 EAPI void
194 elm_app_info_set(void *mainfunc, const char *dom, const char *checkfile)
195 {
196    app_mainfunc = mainfunc;
197    eina_stringshare_replace(&app_domain, dom);
198    eina_stringshare_replace(&app_checkfile, checkfile);
199 }
200
201 EAPI void
202 elm_app_compile_bin_dir_set(const char *dir)
203 {
204    eina_stringshare_replace(&app_compile_bin_dir, dir);
205 }
206
207 EAPI void
208 elm_app_compile_lib_dir_set(const char *dir)
209 {
210    eina_stringshare_replace(&app_compile_lib_dir, dir);
211 }
212
213 EAPI void
214 elm_app_compile_data_dir_set(const char *dir)
215 {
216    eina_stringshare_replace(&app_compile_data_dir, dir);
217 }
218
219 EAPI void
220 elm_app_compile_locale_set(const char *dir)
221 {
222    eina_stringshare_replace(&app_compile_locale_dir, dir);
223 }
224
225 EAPI const char *
226 elm_app_prefix_dir_get(void)
227 {
228    if (app_prefix_dir) return app_prefix_dir;
229    _prefix_check();
230   if (!app_pfx) return "";
231    app_prefix_dir = eina_prefix_get(app_pfx);
232    return app_prefix_dir;
233 }
234
235 EAPI const char *
236 elm_app_bin_dir_get(void)
237 {
238    if (app_bin_dir) return app_bin_dir;
239    _prefix_check();
240    if (!app_pfx) return "";
241    app_bin_dir = eina_prefix_bin_get(app_pfx);
242    return app_bin_dir;
243 }
244
245 EAPI const char *
246 elm_app_lib_dir_get(void)
247 {
248    if (app_lib_dir) return app_lib_dir;
249    _prefix_check();
250    if (!app_pfx) return "";
251    app_lib_dir = eina_prefix_lib_get(app_pfx);
252    return app_lib_dir;
253 }
254
255 EAPI const char *
256 elm_app_data_dir_get(void)
257 {
258    if (app_data_dir) return app_data_dir;
259    _prefix_check();
260    if (!app_pfx) return "";
261    app_data_dir = eina_prefix_data_get(app_pfx);
262    return app_data_dir;
263 }
264
265 EAPI const char *
266 elm_app_locale_dir_get(void)
267 {
268    if (app_locale_dir) return app_locale_dir;
269    _prefix_check();
270    if (!app_pfx) return "";
271    app_locale_dir = eina_prefix_locale_get(app_pfx);
272    return app_locale_dir;
273 }
274
275 #ifdef ELM_EDBUS
276 static int _elm_need_e_dbus = 0;
277 #endif
278 EAPI Eina_Bool
279 elm_need_e_dbus(void)
280 {
281 #ifdef ELM_EDBUS
282    if (_elm_need_e_dbus++) return EINA_TRUE;
283    e_dbus_init();
284    return EINA_TRUE;
285 #else
286    return EINA_FALSE;
287 #endif
288 }
289
290 static void
291 _elm_unneed_e_dbus(void)
292 {
293 #ifdef ELM_EDBUS
294    if (--_elm_need_e_dbus) return;
295
296    _elm_need_e_dbus = 0;
297    e_dbus_shutdown();
298 #endif
299 }
300
301 #ifdef ELM_EFREET
302 static int _elm_need_efreet = 0;
303 #endif
304 EAPI Eina_Bool
305 elm_need_efreet(void)
306 {
307 #ifdef ELM_EFREET
308    if (_elm_need_efreet++) return EINA_TRUE;
309    efreet_init();
310    efreet_mime_init();
311    efreet_trash_init();
312     /*
313      {
314         Eina_List **list;
315
316         list = efreet_icon_extra_list_get();
317         if (list)
318           {
319              e_user_dir_concat_static(buf, "icons");
320              *list = eina_list_prepend(*list, (void *)eina_stringshare_add(buf));
321              e_prefix_data_concat_static(buf, "data/icons");
322              *list = eina_list_prepend(*list, (void *)eina_stringshare_add(buf));
323           }
324      }
325    */
326    return EINA_TRUE;
327 #else
328    return EINA_FALSE;
329 #endif
330 }
331
332 static void
333 _elm_unneed_efreet(void)
334 {
335 #ifdef ELM_EFREET
336    if (--_elm_need_efreet) return;
337
338    _elm_need_efreet = 0;
339    efreet_trash_shutdown();
340    efreet_mime_shutdown();
341    efreet_shutdown();
342 #endif
343 }
344
345 EAPI void
346 elm_quicklaunch_mode_set(Eina_Bool ql_on)
347 {
348    quicklaunch_on = ql_on;
349 }
350
351 EAPI Eina_Bool
352 elm_quicklaunch_mode_get(void)
353 {
354    return quicklaunch_on;
355 }
356
357 EAPI int
358 elm_quicklaunch_init(int    argc,
359                      char **argv)
360 {
361    _elm_ql_init_count++;
362    if (_elm_ql_init_count > 1) return _elm_ql_init_count;
363    eina_init();
364    _elm_log_dom = eina_log_domain_register("elementary", EINA_COLOR_LIGHTBLUE);
365    if (!_elm_log_dom)
366      {
367         EINA_LOG_ERR("could not register elementary log domain.");
368         _elm_log_dom = EINA_LOG_DOMAIN_GLOBAL;
369      }
370
371    eet_init();
372    ecore_init();
373
374 #ifdef HAVE_ELEMENTARY_EMAP
375    emap_init();
376 #endif
377    ecore_app_args_set(argc, (const char **)argv);
378
379    memset(_elm_policies, 0, sizeof(_elm_policies));
380    if (!ELM_EVENT_POLICY_CHANGED)
381      ELM_EVENT_POLICY_CHANGED = ecore_event_type_new();
382
383    ecore_file_init();
384
385    _elm_exit_handler = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, _elm_signal_exit, NULL);
386
387    if (argv) _elm_appname = strdup(ecore_file_file_get(argv[0]));
388
389    pfx = eina_prefix_new(NULL, elm_quicklaunch_init,
390                          "ELM", "elementary", "config/profile.cfg",
391                          PACKAGE_LIB_DIR, /* don't have a bin dir currently */
392                          PACKAGE_LIB_DIR,
393                          PACKAGE_DATA_DIR,
394                          LOCALE_DIR);
395    if (pfx)
396      {
397         _elm_data_dir = eina_stringshare_add(eina_prefix_data_get(pfx));
398         _elm_lib_dir = eina_stringshare_add(eina_prefix_lib_get(pfx));
399      }
400    if (!_elm_data_dir) _elm_data_dir = eina_stringshare_add("/");
401    if (!_elm_lib_dir) _elm_lib_dir = eina_stringshare_add("/");
402
403    _elm_config_init();
404    return _elm_ql_init_count;
405 }
406
407 EAPI int
408 elm_quicklaunch_sub_init(int    argc,
409                          char **argv)
410 {
411    _elm_sub_init_count++;
412    if (_elm_sub_init_count > 1) return _elm_sub_init_count;
413    if (quicklaunch_on)
414      {
415 #ifdef SEMI_BROKEN_QUICKLAUNCH
416         return _elm_sub_init_count;
417 #endif
418      }
419    if (!quicklaunch_on)
420      {
421         ecore_app_args_set(argc, (const char **)argv);
422         evas_init();
423         edje_init();
424         _elm_module_init();
425         _elm_config_sub_init();
426 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
427         if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
428             ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
429             ENGINE_COMPARE(ELM_XRENDER_X11) ||
430             ENGINE_COMPARE(ELM_OPENGL_X11))
431 #undef ENGINE_COMPARE
432           {
433 #ifdef HAVE_ELEMENTARY_X
434              ecore_x_init(NULL);
435 #endif
436           }
437         ecore_evas_init(); // FIXME: check errors
438         ecore_imf_init();
439         ecore_con_init();
440         ecore_con_url_init();
441      }
442    return _elm_sub_init_count;
443 }
444
445 EAPI int
446 elm_quicklaunch_sub_shutdown(void)
447 {
448    _elm_sub_init_count--;
449    if (_elm_sub_init_count > 0) return _elm_sub_init_count;
450    if (quicklaunch_on)
451      {
452 #ifdef SEMI_BROKEN_QUICKLAUNCH
453         return _elm_sub_init_count;
454 #endif
455      }
456    if (!quicklaunch_on)
457      {
458         _elm_win_shutdown();
459         _elm_module_shutdown();
460         ecore_imf_shutdown();
461         ecore_evas_shutdown();
462 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
463         if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
464             ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
465             ENGINE_COMPARE(ELM_XRENDER_X11) ||
466             ENGINE_COMPARE(ELM_OPENGL_X11))
467 #undef ENGINE_COMPARE
468           {
469 #ifdef HAVE_ELEMENTARY_X
470              ecore_x_disconnect();
471 #endif
472           }
473 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
474         if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
475             ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
476             ENGINE_COMPARE(ELM_XRENDER_X11) ||
477             ENGINE_COMPARE(ELM_OPENGL_X11) ||
478             ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
479             ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
480             ENGINE_COMPARE(ELM_OPENGL_SDL) ||
481             ENGINE_COMPARE(ELM_SOFTWARE_WIN32) ||
482             ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
483 #undef ENGINE_COMPARE
484           evas_cserve_disconnect();
485         edje_shutdown();
486         evas_shutdown();
487      }
488    return _elm_sub_init_count;
489 }
490
491 EAPI int
492 elm_quicklaunch_shutdown(void)
493 {
494    _elm_ql_init_count--;
495    if (_elm_ql_init_count > 0) return _elm_ql_init_count;
496    if (pfx) eina_prefix_free(pfx);
497    pfx = NULL;
498    eina_stringshare_del(_elm_data_dir);
499    _elm_data_dir = NULL;
500    eina_stringshare_del(_elm_lib_dir);
501    _elm_lib_dir = NULL;
502
503    free(_elm_appname);
504    _elm_appname = NULL;
505
506    _elm_config_shutdown();
507
508    ecore_event_handler_del(_elm_exit_handler);
509    _elm_exit_handler = NULL;
510
511    _elm_theme_shutdown();
512    _elm_unneed_efreet();
513    _elm_unneed_e_dbus();
514    _elm_unneed_ethumb();
515    _elm_unneed_web();
516    ecore_file_shutdown();
517
518 #ifdef HAVE_ELEMENTARY_EMAP
519    emap_shutdown();
520 #endif
521
522    ecore_shutdown();
523    eet_shutdown();
524
525    if ((_elm_log_dom > -1) && (_elm_log_dom != EINA_LOG_DOMAIN_GLOBAL))
526      {
527         eina_log_domain_unregister(_elm_log_dom);
528         _elm_log_dom = -1;
529      }
530
531    _elm_widget_type_clear();
532
533    eina_shutdown();
534    return _elm_ql_init_count;
535 }
536
537 EAPI void
538 elm_quicklaunch_seed(void)
539 {
540 #ifndef SEMI_BROKEN_QUICKLAUNCH
541    if (quicklaunch_on)
542      {
543         Evas_Object *win, *bg, *bt;
544
545         win = elm_win_add(NULL, "seed", ELM_WIN_BASIC);
546         bg = elm_bg_add(win);
547         elm_win_resize_object_add(win, bg);
548         evas_object_show(bg);
549         bt = elm_button_add(win);
550         elm_button_label_set(bt, " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~-_=+\\|]}[{;:'\",<.>/?");
551         elm_win_resize_object_add(win, bt);
552         ecore_main_loop_iterate();
553         evas_object_del(win);
554         ecore_main_loop_iterate();
555 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
556         if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
557             ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
558             ENGINE_COMPARE(ELM_XRENDER_X11) ||
559             ENGINE_COMPARE(ELM_OPENGL_X11))
560 #undef ENGINE_COMPARE
561           {
562 # ifdef HAVE_ELEMENTARY_X
563              ecore_x_sync();
564 # endif
565           }
566         ecore_main_loop_iterate();
567      }
568 #endif
569 }
570
571 static void *qr_handle = NULL;
572 static int (*qr_main)(int    argc,
573                       char **argv) = NULL;
574
575 EAPI Eina_Bool
576 elm_quicklaunch_prepare(int argc __UNUSED__,
577                         char   **argv)
578 {
579 #ifdef HAVE_FORK
580    char *exe = elm_quicklaunch_exe_path_get(argv[0]);
581    if (!exe)
582      {
583         ERR("requested quicklaunch binary '%s' does not exist\n", argv[0]);
584         return EINA_FALSE;
585      }
586    else
587      {
588         char *exe2, *p;
589         char *exename;
590
591         exe2 = malloc(strlen(exe) + 1 + 10);
592         strcpy(exe2, exe);
593         p = strrchr(exe2, '/');
594         if (p) p++;
595         else p = exe2;
596         exename = alloca(strlen(p) + 1);
597         strcpy(exename, p);
598         *p = 0;
599         strcat(p, "../lib/");
600         strcat(p, exename);
601         strcat(p, ".so");
602         if (!access(exe2, R_OK | X_OK))
603           {
604              free(exe);
605              exe = exe2;
606           }
607         else
608           free(exe2);
609      }
610    qr_handle = dlopen(exe, RTLD_NOW | RTLD_GLOBAL);
611    if (!qr_handle)
612      {
613         fprintf(stderr, "dlerr: %s\n", dlerror());
614         WRN("dlopen('%s') failed: %s", exe, dlerror());
615         free(exe);
616         return EINA_FALSE;
617      }
618    INF("dlopen('%s') = %p", exe, qr_handle);
619    qr_main = dlsym(qr_handle, "elm_main");
620    INF("dlsym(%p, 'elm_main') = %p", qr_handle, qr_main);
621    if (!qr_main)
622      {
623         WRN("not quicklauncher capable: no elm_main in '%s'", exe);
624         dlclose(qr_handle);
625         qr_handle = NULL;
626         free(exe);
627         return EINA_FALSE;
628      }
629    free(exe);
630    return EINA_TRUE;
631 #else
632    return EINA_FALSE;
633    (void)argv;
634 #endif
635 }
636
637 #ifdef HAVE_FORK
638 static void
639 save_env(void)
640 {
641    int i, size;
642    extern char **environ;
643    char **oldenv, **p;
644
645    oldenv = environ;
646
647    for (i = 0, size = 0; environ[i]; i++)
648      size += strlen(environ[i]) + 1;
649
650    p = malloc((i + 1) * sizeof(char *));
651    if (!p) return;
652
653    environ = p;
654
655    for (i = 0; oldenv[i]; i++)
656      environ[i] = strdup(oldenv[i]);
657    environ[i] = NULL;
658 }
659
660 #endif
661
662 EAPI Eina_Bool
663 elm_quicklaunch_fork(int    argc,
664                      char **argv,
665                      char  *cwd,
666                      void (postfork_func) (void *data),
667                      void  *postfork_data)
668 {
669 #ifdef HAVE_FORK
670    pid_t child;
671    int ret;
672    int real_argc;
673    char **real_argv;
674
675    // FIXME:
676    // need to accept current environment from elementary_run
677    if (!qr_main)
678      {
679         int i;
680         char **args;
681
682         child = fork();
683         if (child > 0) return EINA_TRUE;
684         else if (child < 0)
685           {
686              perror("could not fork");
687              return EINA_FALSE;
688           }
689         setsid();
690         if (chdir(cwd) != 0)
691           perror("could not chdir");
692         args = alloca((argc + 1) * sizeof(char *));
693         for (i = 0; i < argc; i++) args[i] = argv[i];
694         args[argc] = NULL;
695         WRN("%s not quicklaunch capable, fallback...", argv[0]);
696         execvp(argv[0], args);
697         ERR("failed to execute '%s': %s", argv[0], strerror(errno));
698         exit(-1);
699      }
700    child = fork();
701    if (child > 0) return EINA_TRUE;
702    else if (child < 0)
703      {
704         perror("could not fork");
705         return EINA_FALSE;
706      }
707    if (postfork_func) postfork_func(postfork_data);
708
709    if (quicklaunch_on)
710      {
711 #ifdef SEMI_BROKEN_QUICKLAUNCH
712         ecore_app_args_set(argc, (const char **)argv);
713         evas_init();
714         edje_init();
715         _elm_config_sub_init();
716 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
717         if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
718             ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
719             ENGINE_COMPARE(ELM_XRENDER_X11) ||
720             ENGINE_COMPARE(ELM_OPENGL_X11))
721 #undef ENGINE_COMPARE
722           {
723 # ifdef HAVE_ELEMENTARY_X
724              ecore_x_init(NULL);
725 # endif
726           }
727         ecore_evas_init(); // FIXME: check errors
728         ecore_imf_init();
729         _elm_module_init();
730 #endif
731      }
732
733    setsid();
734    if (chdir(cwd) != 0)
735      perror("could not chdir");
736    // FIXME: this is very linux specific. it changes argv[0] of the process
737    // so ps etc. report what you'd expect. for other unixes and os's this
738    // may just not work
739    save_env();
740    if (argv)
741      {
742         char *lastarg, *p;
743
744         ecore_app_args_get(&real_argc, &real_argv);
745         lastarg = real_argv[real_argc - 1] + strlen(real_argv[real_argc - 1]);
746         for (p = real_argv[0]; p < lastarg; p++) *p = 0;
747         strcpy(real_argv[0], argv[0]);
748      }
749    ecore_app_args_set(argc, (const char **)argv);
750    ret = qr_main(argc, argv);
751    exit(ret);
752    return EINA_TRUE;
753 #else
754    return EINA_FALSE;
755    (void)argc;
756    (void)argv;
757    (void)cwd;
758    (void)postfork_func;
759    (void)postfork_data;
760 #endif
761 }
762
763 EAPI void
764 elm_quicklaunch_cleanup(void)
765 {
766 #ifdef HAVE_FORK
767    if (qr_handle)
768      {
769         dlclose(qr_handle);
770         qr_handle = NULL;
771         qr_main = NULL;
772      }
773 #endif
774 }
775
776 EAPI int
777 elm_quicklaunch_fallback(int    argc,
778                          char **argv)
779 {
780    int ret;
781    elm_quicklaunch_init(argc, argv);
782    elm_quicklaunch_sub_init(argc, argv);
783    elm_quicklaunch_prepare(argc, argv);
784    ret = qr_main(argc, argv);
785    exit(ret);
786    return ret;
787 }
788
789 EAPI char *
790 elm_quicklaunch_exe_path_get(const char *exe)
791 {
792    static char *path = NULL;
793    static Eina_List *pathlist = NULL;
794    const char *pathitr;
795    const Eina_List *l;
796    char buf[PATH_MAX];
797    if (exe[0] == '/') return strdup(exe);
798    if ((exe[0] == '.') && (exe[1] == '/')) return strdup(exe);
799    if ((exe[0] == '.') && (exe[1] == '.') && (exe[2] == '/')) return strdup(exe);
800    if (!path)
801      {
802         const char *p, *pp;
803         char *buf2;
804         path = getenv("PATH");
805         buf2 = alloca(strlen(path) + 1);
806         p = path;
807         pp = p;
808         for (;; )
809           {
810              if ((*p == ':') || (!*p))
811                {
812                   int len;
813
814                   len = p - pp;
815                   strncpy(buf2, pp, len);
816                   buf2[len] = 0;
817                   pathlist = eina_list_append(pathlist, eina_stringshare_add(buf2));
818                   if (!*p) break;
819                   p++;
820                   pp = p;
821                }
822              else
823                {
824                   if (!*p) break;
825                   p++;
826                }
827           }
828      }
829    EINA_LIST_FOREACH(pathlist, l, pathitr)
830      {
831         snprintf(buf, sizeof(buf), "%s/%s", pathitr, exe);
832         if (!access(buf, R_OK | X_OK)) return strdup(buf);
833      }
834    return NULL;
835 }
836
837 EAPI void
838 elm_run(void)
839 {
840    ecore_main_loop_begin();
841 }
842
843 EAPI void
844 elm_exit(void)
845 {
846    ecore_main_loop_quit();
847 }
848
849 EAPI Eina_Bool
850 elm_policy_set(unsigned int policy,
851                int          value)
852 {
853    Elm_Event_Policy_Changed *ev;
854
855    if (policy >= ELM_POLICY_LAST)
856      return EINA_FALSE;
857
858    if (value == _elm_policies[policy])
859      return EINA_TRUE;
860
861    /* TODO: validade policy? */
862
863    ev = malloc(sizeof(*ev));
864    ev->policy = policy;
865    ev->new_value = value;
866    ev->old_value = _elm_policies[policy];
867
868    _elm_policies[policy] = value;
869
870    ecore_event_add(ELM_EVENT_POLICY_CHANGED, ev, NULL, NULL);
871
872    return EINA_TRUE;
873 }
874
875 EAPI int
876 elm_policy_get(unsigned int policy)
877 {
878    if (policy >= ELM_POLICY_LAST)
879      return 0;
880    return _elm_policies[policy];
881 }
882
883 EAPI void
884 elm_language_set(const char *lang)
885 {
886    setlocale(LC_ALL, lang);
887    _elm_win_translate();
888 }
889
890 EAPI Eina_Bool
891 elm_object_mirrored_get(const Evas_Object *obj)
892 {
893    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
894    return elm_widget_mirrored_get(obj);
895 }
896
897 EAPI void
898 elm_object_mirrored_set(Evas_Object *obj, Eina_Bool mirrored)
899 {
900    EINA_SAFETY_ON_NULL_RETURN(obj);
901    elm_widget_mirrored_set(obj, mirrored);
902 }
903
904 EAPI Eina_Bool
905 elm_object_mirrored_automatic_get(const Evas_Object *obj)
906 {
907    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
908    return elm_widget_mirrored_automatic_get(obj);
909 }
910
911 EAPI void
912 elm_object_mirrored_automatic_set(Evas_Object *obj, Eina_Bool automatic)
913 {
914    EINA_SAFETY_ON_NULL_RETURN(obj);
915    elm_widget_mirrored_automatic_set(obj, automatic);
916 }
917
918 EAPI void
919 elm_object_scale_set(Evas_Object *obj,
920                      double       scale)
921 {
922    EINA_SAFETY_ON_NULL_RETURN(obj);
923    elm_widget_scale_set(obj, scale);
924 }
925
926 EAPI double
927 elm_object_scale_get(const Evas_Object *obj)
928 {
929    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, 0.0);
930    return elm_widget_scale_get(obj);
931 }
932
933 EAPI void
934 elm_object_text_part_set(Evas_Object *obj, const char *part, const char *label)
935 {
936    EINA_SAFETY_ON_NULL_RETURN(obj);
937    elm_widget_text_part_set(obj, part, label);
938 }
939
940 EAPI const char *
941 elm_object_text_part_get(const Evas_Object *obj, const char *part)
942 {
943    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
944    return elm_widget_text_part_get(obj, part);
945 }
946
947 EAPI void
948 elm_object_domain_translatable_text_part_set(Evas_Object *obj, const char *part, const char *domain, const char *text)
949 {
950    EINA_SAFETY_ON_NULL_RETURN(obj);
951    elm_widget_domain_translatable_text_part_set(obj, part, domain, text);
952 }
953
954 EAPI const char *
955 elm_object_translatable_text_part_get(const Evas_Object *obj, const char *part)
956 {
957    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
958    return elm_widget_translatable_text_part_get(obj, part);
959 }
960
961 EAPI void
962 elm_object_content_part_set(Evas_Object *obj, const char *part, Evas_Object *content)
963 {
964    EINA_SAFETY_ON_NULL_RETURN(obj);
965    elm_widget_content_part_set(obj, part, content);
966 }
967
968 EAPI Evas_Object *
969 elm_object_content_part_get(const Evas_Object *obj, const char *part)
970 {
971    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
972    return elm_widget_content_part_get(obj, part);
973 }
974
975 EAPI Evas_Object *
976 elm_object_content_part_unset(Evas_Object *obj, const char *part)
977 {
978    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
979    return elm_widget_content_part_unset(obj, part);
980 }
981
982 EAPI double
983 elm_scale_get(void)
984 {
985    return _elm_config->scale;
986 }
987
988 EAPI void
989 elm_scale_set(double scale)
990 {
991    if (_elm_config->scale == scale) return;
992    _elm_config->scale = scale;
993    _elm_rescale();
994 }
995
996 EAPI void
997 elm_scale_all_set(double scale)
998 {
999 #ifdef HAVE_ELEMENTARY_X
1000    static Ecore_X_Atom atom = 0;
1001    unsigned int scale_i = (unsigned int)(scale * 1000.0);
1002
1003    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_SCALE");
1004    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1005                                   atom, &scale_i, 1);
1006 #endif
1007 }
1008
1009 EAPI Eina_Bool
1010 elm_password_show_last_get(void)
1011 {
1012    return _elm_config->password_show_last;
1013 }
1014
1015 EAPI void
1016 elm_password_show_last_set(Eina_Bool password_show_last)
1017 {
1018    if (_elm_config->password_show_last == password_show_last) return;
1019    _elm_config->password_show_last = password_show_last;
1020    edje_password_show_last_set(_elm_config->password_show_last);
1021 }
1022
1023 EAPI double
1024 elm_password_show_last_timeout_get(void)
1025 {
1026    return _elm_config->password_show_last_timeout;
1027 }
1028
1029 EAPI void
1030 elm_password_show_last_timeout_set(double password_show_last_timeout)
1031 {
1032    if (_elm_config->password_show_last_timeout == password_show_last_timeout) return;
1033    _elm_config->password_show_last_timeout = password_show_last_timeout;
1034    edje_password_show_last_timeout_set(_elm_config->password_show_last_timeout);
1035 }
1036
1037 EAPI void
1038 elm_object_style_set(Evas_Object *obj,
1039                      const char  *style)
1040 {
1041    EINA_SAFETY_ON_NULL_RETURN(obj);
1042    elm_widget_style_set(obj, style);
1043 }
1044
1045 EAPI const char *
1046 elm_object_style_get(const Evas_Object *obj)
1047 {
1048    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
1049    return elm_widget_style_get(obj);
1050 }
1051
1052 EAPI void
1053 elm_object_disabled_set(Evas_Object *obj,
1054                         Eina_Bool    disabled)
1055 {
1056    EINA_SAFETY_ON_NULL_RETURN(obj);
1057    elm_widget_disabled_set(obj, disabled);
1058 }
1059
1060 EAPI Eina_Bool
1061 elm_object_disabled_get(const Evas_Object *obj)
1062 {
1063    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1064    return elm_widget_disabled_get(obj);
1065 }
1066
1067 EAPI Eina_Bool
1068 elm_config_save(void)
1069 {
1070    return _elm_config_save();
1071 }
1072
1073 EAPI void
1074 elm_config_reload(void)
1075 {
1076    _elm_config_reload();
1077 }
1078
1079 EAPI const char *
1080 elm_profile_current_get(void)
1081 {
1082    return _elm_config_current_profile_get();
1083 }
1084
1085 EAPI const char *
1086 elm_profile_dir_get(const char *profile,
1087                     Eina_Bool   is_user)
1088 {
1089    return _elm_config_profile_dir_get(profile, is_user);
1090 }
1091
1092 EAPI void
1093 elm_profile_dir_free(const char *p_dir)
1094 {
1095    free((void *)p_dir);
1096 }
1097
1098 EAPI Eina_List *
1099 elm_profile_list_get(void)
1100 {
1101    return _elm_config_profiles_list();
1102 }
1103
1104 EAPI void
1105 elm_profile_list_free(Eina_List *l)
1106 {
1107    const char *dir;
1108
1109    EINA_LIST_FREE(l, dir)
1110      eina_stringshare_del(dir);
1111 }
1112
1113 EAPI void
1114 elm_profile_set(const char *profile)
1115 {
1116    EINA_SAFETY_ON_NULL_RETURN(profile);
1117    _elm_config_profile_set(profile);
1118 }
1119
1120 EAPI void
1121 elm_profile_all_set(const char *profile)
1122 {
1123 #ifdef HAVE_ELEMENTARY_X
1124    static Ecore_X_Atom atom = 0;
1125
1126    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_PROFILE");
1127    ecore_x_window_prop_string_set(ecore_x_window_root_first_get(),
1128                                   atom, profile);
1129 #endif
1130 }
1131
1132 EAPI const char *
1133 elm_engine_current_get(void)
1134 {
1135    return _elm_config->engine;
1136 }
1137
1138 EAPI void
1139 elm_engine_set(const char *engine)
1140 {
1141    EINA_SAFETY_ON_NULL_RETURN(engine);
1142
1143    _elm_config_engine_set(engine);
1144 }
1145
1146 EAPI const Eina_List *
1147 elm_text_classes_list_get(void)
1148 {
1149    return _elm_config_text_classes_get();
1150 }
1151
1152 EAPI void
1153 elm_text_classes_list_free(const Eina_List *list)
1154 {
1155    _elm_config_text_classes_free((Eina_List *)list);
1156 }
1157
1158 EAPI const Eina_List *
1159 elm_font_overlay_list_get(void)
1160 {
1161    return _elm_config_font_overlays_list();
1162 }
1163
1164 EAPI void
1165 elm_font_overlay_set(const char    *text_class,
1166                      const char    *font,
1167                      Evas_Font_Size size)
1168 {
1169    _elm_config_font_overlay_set(text_class, font, size);
1170 }
1171
1172 EAPI void
1173 elm_font_overlay_unset(const char *text_class)
1174 {
1175    _elm_config_font_overlay_remove(text_class);
1176 }
1177
1178 EAPI void
1179 elm_font_overlay_apply(void)
1180 {
1181    _elm_config_font_overlay_apply();
1182 }
1183
1184 EAPI void
1185 elm_font_overlay_all_apply(void)
1186 {
1187 #ifdef HAVE_ELEMENTARY_X
1188    static Ecore_X_Atom atom = 0;
1189    unsigned int dummy = (unsigned int)(1 * 1000.0);
1190
1191    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_FONT_OVERLAY");
1192    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(), atom, &dummy,
1193                                   1);
1194 #endif
1195 }
1196
1197 EAPI Elm_Font_Properties *
1198 elm_font_properties_get(const char *font)
1199 {
1200    EINA_SAFETY_ON_NULL_RETURN_VAL(font, NULL);
1201    return _elm_font_properties_get(NULL, font);
1202 }
1203
1204 EAPI void
1205 elm_font_properties_free(Elm_Font_Properties *efp)
1206 {
1207    const char *str;
1208
1209    EINA_SAFETY_ON_NULL_RETURN(efp);
1210    EINA_LIST_FREE(efp->styles, str)
1211      if (str) eina_stringshare_del(str);
1212    if (efp->name) eina_stringshare_del(efp->name);
1213    free(efp);
1214 }
1215
1216 EAPI const char *
1217 elm_font_fontconfig_name_get(const char *name,
1218                              const char *style)
1219 {
1220    char buf[256];
1221
1222    EINA_SAFETY_ON_NULL_RETURN_VAL(name, NULL);
1223    if (!style || style[0] == 0) return eina_stringshare_add(name);
1224    snprintf(buf, 256, "%s" ELM_FONT_TOKEN_STYLE "%s", name, style);
1225    return eina_stringshare_add(buf);
1226 }
1227
1228 EAPI void
1229 elm_font_fontconfig_name_free(const char *name)
1230 {
1231    eina_stringshare_del(name);
1232 }
1233
1234 EAPI Eina_Hash *
1235 elm_font_available_hash_add(Eina_List *list)
1236 {
1237    Eina_Hash *font_hash;
1238    Eina_List *l;
1239    void *key;
1240
1241    font_hash = NULL;
1242
1243    /* populate with default font families */
1244    font_hash = _elm_font_available_hash_add(font_hash, "Sans:style=Regular");
1245    font_hash = _elm_font_available_hash_add(font_hash, "Sans:style=Bold");
1246    font_hash = _elm_font_available_hash_add(font_hash, "Sans:style=Oblique");
1247    font_hash = _elm_font_available_hash_add(font_hash,
1248                                             "Sans:style=Bold Oblique");
1249
1250    font_hash = _elm_font_available_hash_add(font_hash, "Serif:style=Regular");
1251    font_hash = _elm_font_available_hash_add(font_hash, "Serif:style=Bold");
1252    font_hash = _elm_font_available_hash_add(font_hash, "Serif:style=Oblique");
1253    font_hash = _elm_font_available_hash_add(font_hash,
1254                                             "Serif:style=Bold Oblique");
1255
1256    font_hash = _elm_font_available_hash_add(font_hash,
1257                                             "Monospace:style=Regular");
1258    font_hash = _elm_font_available_hash_add(font_hash,
1259                                             "Monospace:style=Bold");
1260    font_hash = _elm_font_available_hash_add(font_hash,
1261                                             "Monospace:style=Oblique");
1262    font_hash = _elm_font_available_hash_add(font_hash,
1263                                             "Monospace:style=Bold Oblique");
1264
1265    EINA_LIST_FOREACH(list, l, key)
1266      font_hash = _elm_font_available_hash_add(font_hash, key);
1267
1268    return font_hash;
1269 }
1270
1271 EAPI void
1272 elm_font_available_hash_del(Eina_Hash *hash)
1273 {
1274    _elm_font_available_hash_del(hash);
1275 }
1276
1277 EAPI Evas_Coord
1278 elm_finger_size_get(void)
1279 {
1280    return _elm_config->finger_size;
1281 }
1282
1283 EAPI void
1284 elm_finger_size_set(Evas_Coord size)
1285 {
1286    if (_elm_config->finger_size == size) return;
1287    _elm_config->finger_size = size;
1288    _elm_rescale();
1289 }
1290
1291 EAPI void
1292 elm_finger_size_all_set(Evas_Coord size)
1293 {
1294 #ifdef HAVE_ELEMENTARY_X
1295    static Ecore_X_Atom atom = 0;
1296    unsigned int size_i = (unsigned int)size;
1297
1298    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_FINGER_SIZE");
1299    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1300                                   atom, &size_i, 1);
1301 #endif
1302 }
1303
1304 EAPI void
1305 elm_autocapitalization_allow_all_set(Eina_Bool on)
1306 {
1307 #ifdef HAVE_ELEMENTARY_X
1308    static Ecore_X_Atom atom = 0;
1309    unsigned int on_i = (unsigned int)on;
1310
1311    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_AUTOCAPITAL_ALLOW");
1312    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1313                                   atom, &on_i, 1);
1314 #endif
1315 }
1316
1317 EAPI void
1318 elm_autoperiod_allow_all_set(Eina_Bool on)
1319 {
1320 #ifdef HAVE_ELEMENTARY_X
1321    static Ecore_X_Atom atom = 0;
1322    unsigned int on_i = (unsigned int)on;
1323
1324    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_AUTOPERIOD_ALLOW");
1325    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1326                                   atom, &on_i, 1);
1327 #endif
1328 }
1329
1330 EAPI void
1331 elm_coords_finger_size_adjust(int         times_w,
1332                               Evas_Coord *w,
1333                               int         times_h,
1334                               Evas_Coord *h)
1335 {
1336    if ((w) && (*w < (_elm_config->finger_size * times_w)))
1337      *w = _elm_config->finger_size * times_w;
1338    if ((h) && (*h < (_elm_config->finger_size * times_h)))
1339      *h = _elm_config->finger_size * times_h;
1340 }
1341
1342 EAPI void
1343 elm_all_flush(void)
1344 {
1345    const Eina_List *l;
1346    Evas_Object *obj;
1347
1348    edje_file_cache_flush();
1349    edje_collection_cache_flush();
1350    eet_clearcache();
1351    EINA_LIST_FOREACH(_elm_win_list, l, obj)
1352      {
1353         Evas *e = evas_object_evas_get(obj);
1354         evas_image_cache_flush(e);
1355         evas_font_cache_flush(e);
1356         evas_render_dump(e);
1357      }
1358 }
1359
1360 EAPI int
1361 elm_cache_flush_interval_get(void)
1362 {
1363    return _elm_config->cache_flush_poll_interval;
1364 }
1365
1366 EAPI void
1367 elm_cache_flush_interval_set(int size)
1368 {
1369    if (_elm_config->cache_flush_poll_interval == size) return;
1370    _elm_config->cache_flush_poll_interval = size;
1371
1372    _elm_recache();
1373 }
1374
1375 EAPI void
1376 elm_cache_flush_interval_all_set(int size)
1377 {
1378 #ifdef HAVE_ELEMENTARY_X
1379    static Ecore_X_Atom atom = 0;
1380    unsigned int size_i = (unsigned int)size;
1381
1382    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_CACHE_FLUSH_INTERVAL");
1383    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1384                                   atom, &size_i, 1);
1385 #endif
1386 }
1387
1388 EAPI Eina_Bool
1389 elm_cache_flush_enabled_get(void)
1390 {
1391    return _elm_config->cache_flush_enable;
1392 }
1393
1394 EAPI void
1395 elm_cache_flush_enabled_set(Eina_Bool enabled)
1396 {
1397    enabled = !!enabled;
1398    if (_elm_config->cache_flush_enable == enabled) return;
1399    _elm_config->cache_flush_enable = enabled;
1400
1401    _elm_recache();
1402 }
1403
1404 EAPI void
1405 elm_cache_flush_enabled_all_set(Eina_Bool enabled)
1406 {
1407 #ifdef HAVE_ELEMENTARY_X
1408    static Ecore_X_Atom atom = 0;
1409    unsigned int enabled_i = (unsigned int)enabled;
1410
1411    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_CACHE_FLUSH_ENABLE");
1412    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1413                                   atom, &enabled_i, 1);
1414 #endif
1415 }
1416
1417 EAPI int
1418 elm_font_cache_get(void)
1419 {
1420    return _elm_config->font_cache;
1421 }
1422
1423 EAPI void
1424 elm_font_cache_set(int size)
1425 {
1426    if (_elm_config->font_cache == size) return;
1427    _elm_config->font_cache = size;
1428
1429    _elm_recache();
1430 }
1431
1432 EAPI void
1433 elm_font_cache_all_set(int size)
1434 {
1435 #ifdef HAVE_ELEMENTARY_X
1436    static Ecore_X_Atom atom = 0;
1437    unsigned int size_i = (unsigned int)size;
1438
1439    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_FONT_CACHE");
1440    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1441                                   atom, &size_i, 1);
1442 #endif
1443 }
1444
1445 EAPI int
1446 elm_image_cache_get(void)
1447 {
1448    return _elm_config->image_cache;
1449 }
1450
1451 EAPI void
1452 elm_image_cache_set(int size)
1453 {
1454    if (_elm_config->image_cache == size) return;
1455    _elm_config->image_cache = size;
1456
1457    _elm_recache();
1458 }
1459
1460 EAPI void
1461 elm_image_cache_all_set(int size)
1462 {
1463 #ifdef HAVE_ELEMENTARY_X
1464    static Ecore_X_Atom atom = 0;
1465    unsigned int size_i = (unsigned int)size;
1466
1467    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_IMAGE_CACHE");
1468    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1469                                   atom, &size_i, 1);
1470 #endif
1471 }
1472
1473 EAPI int
1474 elm_edje_file_cache_get(void)
1475 {
1476    return _elm_config->edje_cache;
1477 }
1478
1479 EAPI void
1480 elm_edje_file_cache_set(int size)
1481 {
1482    if (_elm_config->edje_cache == size) return;
1483    _elm_config->edje_cache = size;
1484
1485    _elm_recache();
1486 }
1487
1488 EAPI void
1489 elm_edje_file_cache_all_set(int size)
1490 {
1491 #ifdef HAVE_ELEMENTARY_X
1492    static Ecore_X_Atom atom = 0;
1493    unsigned int size_i = (unsigned int)size;
1494
1495    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_EDJE_FILE_CACHE");
1496    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1497                                   atom, &size_i, 1);
1498 #endif
1499 }
1500
1501 EAPI int
1502 elm_edje_collection_cache_get(void)
1503 {
1504    return _elm_config->edje_collection_cache;
1505 }
1506
1507 EAPI void
1508 elm_edje_collection_cache_set(int size)
1509 {
1510    if (_elm_config->edje_collection_cache == size) return;
1511    _elm_config->edje_collection_cache = size;
1512
1513    _elm_recache();
1514 }
1515
1516 EAPI void
1517 elm_edje_collection_cache_all_set(int size)
1518 {
1519 #ifdef HAVE_ELEMENTARY_X
1520    static Ecore_X_Atom atom = 0;
1521    unsigned int size_i = (unsigned int)size;
1522
1523    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_EDJE_COLLECTION_CACHE");
1524    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1525                                   atom, &size_i, 1);
1526 #endif
1527 }
1528
1529 EAPI Eina_Bool
1530 elm_object_focus_get(const Evas_Object *obj)
1531 {
1532    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1533    return elm_widget_focus_get(obj);
1534 }
1535
1536 EAPI void
1537 elm_object_focus_set(Evas_Object *obj,
1538                      Eina_Bool    focus)
1539 {
1540    EINA_SAFETY_ON_NULL_RETURN(obj);
1541    if (focus)
1542      {
1543         if (elm_widget_focus_get(obj)) return;
1544         elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
1545      }
1546    else
1547      {
1548         if (!elm_widget_can_focus_get(obj)) return;
1549         elm_widget_focused_object_clear(obj);
1550      }
1551 }
1552
1553 EAPI void
1554 elm_object_focus(Evas_Object *obj)
1555 {
1556    EINA_SAFETY_ON_NULL_RETURN(obj);
1557    elm_object_focus_set(obj, EINA_TRUE);
1558 }
1559
1560 EAPI void
1561 elm_object_unfocus(Evas_Object *obj)
1562 {
1563    EINA_SAFETY_ON_NULL_RETURN(obj);
1564    elm_object_focus_set(obj, EINA_FALSE);
1565 }
1566
1567 EAPI void
1568 elm_object_focus_allow_set(Evas_Object *obj,
1569                            Eina_Bool    enable)
1570 {
1571    EINA_SAFETY_ON_NULL_RETURN(obj);
1572    elm_widget_can_focus_set(obj, enable);
1573 }
1574
1575 EAPI Eina_Bool
1576 elm_object_focus_allow_get(const Evas_Object *obj)
1577 {
1578    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1579    return (elm_widget_can_focus_get(obj)) || (elm_widget_child_can_focus_get(obj));
1580 }
1581
1582 EAPI void
1583 elm_object_focus_custom_chain_set(Evas_Object *obj,
1584                                   Eina_List   *objs)
1585 {
1586    EINA_SAFETY_ON_NULL_RETURN(obj);
1587    elm_widget_focus_custom_chain_set(obj, objs);
1588 }
1589
1590 EAPI void
1591 elm_object_focus_custom_chain_unset(Evas_Object *obj)
1592 {
1593    EINA_SAFETY_ON_NULL_RETURN(obj);
1594    elm_widget_focus_custom_chain_unset(obj);
1595 }
1596
1597 EAPI const Eina_List *
1598 elm_object_focus_custom_chain_get(const Evas_Object *obj)
1599 {
1600    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
1601    return elm_widget_focus_custom_chain_get(obj);
1602 }
1603
1604 EAPI void
1605 elm_object_focus_custom_chain_append(Evas_Object *obj,
1606                                      Evas_Object *child,
1607                                      Evas_Object *relative_child)
1608 {
1609    EINA_SAFETY_ON_NULL_RETURN(obj);
1610    EINA_SAFETY_ON_NULL_RETURN(child);
1611    elm_widget_focus_custom_chain_append(obj, child, relative_child);
1612 }
1613
1614 EAPI void
1615 elm_object_focus_custom_chain_prepend(Evas_Object *obj,
1616                                       Evas_Object *child,
1617                                       Evas_Object *relative_child)
1618 {
1619    EINA_SAFETY_ON_NULL_RETURN(obj);
1620    EINA_SAFETY_ON_NULL_RETURN(child);
1621    elm_widget_focus_custom_chain_prepend(obj, child, relative_child);
1622 }
1623
1624 EAPI void
1625 elm_object_focus_cycle(Evas_Object        *obj,
1626                        Elm_Focus_Direction dir)
1627 {
1628    EINA_SAFETY_ON_NULL_RETURN(obj);
1629    elm_widget_focus_cycle(obj, dir);
1630 }
1631
1632 EAPI void
1633 elm_object_focus_direction_go(Evas_Object *obj,
1634                               int          x,
1635                               int          y)
1636 {
1637    EINA_SAFETY_ON_NULL_RETURN(obj);
1638    elm_widget_focus_direction_go(obj, x, y);
1639 }
1640
1641 EAPI void
1642 elm_object_tree_unfocusable_set(Evas_Object *obj,
1643                                 Eina_Bool    tree_unfocusable)
1644 {
1645    EINA_SAFETY_ON_NULL_RETURN(obj);
1646    elm_widget_tree_unfocusable_set(obj, tree_unfocusable);
1647 }
1648
1649 EAPI Eina_Bool
1650 elm_object_tree_unfocusable_get(const Evas_Object *obj)
1651 {
1652    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1653    return elm_widget_tree_unfocusable_get(obj);
1654 }
1655
1656 EAPI Eina_Bool
1657 elm_focus_highlight_enabled_get(void)
1658 {
1659    return _elm_config->focus_highlight_enable;
1660 }
1661
1662 EAPI void
1663 elm_focus_highlight_enabled_set(Eina_Bool enable)
1664 {
1665    _elm_config->focus_highlight_enable = !!enable;
1666 }
1667
1668 EAPI Eina_Bool
1669 elm_focus_highlight_animate_get(void)
1670 {
1671    return _elm_config->focus_highlight_animate;
1672 }
1673
1674 EAPI void
1675 elm_focus_highlight_animate_set(Eina_Bool animate)
1676 {
1677    _elm_config->focus_highlight_animate = !!animate;
1678 }
1679
1680 EAPI Eina_Bool
1681 elm_scroll_bounce_enabled_get(void)
1682 {
1683    return _elm_config->thumbscroll_bounce_enable;
1684 }
1685
1686 EAPI void
1687 elm_scroll_bounce_enabled_set(Eina_Bool enabled)
1688 {
1689    _elm_config->thumbscroll_bounce_enable = enabled;
1690 }
1691
1692 EAPI void
1693 elm_scroll_bounce_enabled_all_set(Eina_Bool enabled)
1694 {
1695 #ifdef HAVE_ELEMENTARY_X
1696    static Ecore_X_Atom atom = 0;
1697    unsigned int bounce_enable_i = (unsigned int)enabled;
1698
1699    if (!atom)
1700      atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_BOUNCE_ENABLE");
1701    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1702                                   atom, &bounce_enable_i, 1);
1703 #endif
1704 }
1705
1706 EAPI double
1707 elm_scroll_bounce_friction_get(void)
1708 {
1709    return _elm_config->thumbscroll_bounce_friction;
1710 }
1711
1712 EAPI void
1713 elm_scroll_bounce_friction_set(double friction)
1714 {
1715    _elm_config->thumbscroll_bounce_friction = friction;
1716 }
1717
1718 EAPI void
1719 elm_scroll_bounce_friction_all_set(double friction)
1720 {
1721 #ifdef HAVE_ELEMENTARY_X
1722    static Ecore_X_Atom atom = 0;
1723    unsigned int bounce_friction_i = (unsigned int)(friction * 1000.0);
1724
1725    if (!atom)
1726      atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_BOUNCE_FRICTION");
1727    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1728                                   atom, &bounce_friction_i, 1);
1729 #endif
1730 }
1731
1732 EAPI double
1733 elm_scroll_page_scroll_friction_get(void)
1734 {
1735    return _elm_config->page_scroll_friction;
1736 }
1737
1738 EAPI void
1739 elm_scroll_page_scroll_friction_set(double friction)
1740 {
1741    _elm_config->page_scroll_friction = friction;
1742 }
1743
1744 EAPI void
1745 elm_scroll_page_scroll_friction_all_set(double friction)
1746 {
1747 #ifdef HAVE_ELEMENTARY_X
1748    static Ecore_X_Atom atom = 0;
1749    unsigned int page_scroll_friction_i = (unsigned int)(friction * 1000.0);
1750
1751    if (!atom)
1752      atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_PAGE_SCROLL_FRICTION");
1753    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1754                                   atom, &page_scroll_friction_i, 1);
1755 #endif
1756 }
1757
1758 EAPI double
1759 elm_scroll_bring_in_scroll_friction_get(void)
1760 {
1761    return _elm_config->bring_in_scroll_friction;
1762 }
1763
1764 EAPI void
1765 elm_scroll_bring_in_scroll_friction_set(double friction)
1766 {
1767    _elm_config->bring_in_scroll_friction = friction;
1768 }
1769
1770 EAPI void
1771 elm_scroll_bring_in_scroll_friction_all_set(double friction)
1772 {
1773 #ifdef HAVE_ELEMENTARY_X
1774    static Ecore_X_Atom atom = 0;
1775    unsigned int bring_in_scroll_friction_i = (unsigned int)(friction * 1000.0);
1776
1777    if (!atom)
1778      atom =
1779        ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_BRING_IN_SCROLL_FRICTION");
1780    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1781                                   atom, &bring_in_scroll_friction_i, 1);
1782 #endif
1783 }
1784
1785 EAPI double
1786 elm_scroll_zoom_friction_get(void)
1787 {
1788    return _elm_config->zoom_friction;
1789 }
1790
1791 EAPI void
1792 elm_scroll_zoom_friction_set(double friction)
1793 {
1794    _elm_config->zoom_friction = friction;
1795 }
1796
1797 EAPI void
1798 elm_scroll_zoom_friction_all_set(double friction)
1799 {
1800 #ifdef HAVE_ELEMENTARY_X
1801    static Ecore_X_Atom atom = 0;
1802    unsigned int zoom_friction_i = (unsigned int)(friction * 1000.0);
1803
1804    if (!atom)
1805      atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_ZOOM_FRICTION");
1806    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1807                                   atom, &zoom_friction_i, 1);
1808 #endif
1809 }
1810
1811 EAPI Eina_Bool
1812 elm_scroll_thumbscroll_enabled_get(void)
1813 {
1814    return _elm_config->thumbscroll_enable;
1815 }
1816
1817 EAPI void
1818 elm_scroll_thumbscroll_enabled_set(Eina_Bool enabled)
1819 {
1820    _elm_config->thumbscroll_enable = enabled;
1821 }
1822
1823 EAPI void
1824 elm_scroll_thumbscroll_enabled_all_set(Eina_Bool enabled)
1825 {
1826 #ifdef HAVE_ELEMENTARY_X
1827    static Ecore_X_Atom atom = 0;
1828    unsigned int ts_enable_i = (unsigned int)enabled;
1829
1830    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_ENABLE");
1831    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1832                                   atom, &ts_enable_i, 1);
1833 #endif
1834 }
1835
1836 EAPI unsigned int
1837 elm_scroll_thumbscroll_threshold_get(void)
1838 {
1839    return _elm_config->thumbscroll_threshold;
1840 }
1841
1842 EAPI void
1843 elm_scroll_thumbscroll_threshold_set(unsigned int threshold)
1844 {
1845    _elm_config->thumbscroll_threshold = threshold;
1846 }
1847
1848 EAPI void
1849 elm_scroll_thumbscroll_threshold_all_set(unsigned int threshold)
1850 {
1851 #ifdef HAVE_ELEMENTARY_X
1852    static Ecore_X_Atom atom = 0;
1853    unsigned int ts_threshold_i = (unsigned int)threshold;
1854
1855    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_THRESHOLD");
1856    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1857                                   atom, &ts_threshold_i, 1);
1858 #endif
1859 }
1860
1861 EAPI double
1862 elm_scroll_thumbscroll_momentum_threshold_get(void)
1863 {
1864    return _elm_config->thumbscroll_momentum_threshold;
1865 }
1866
1867 EAPI void
1868 elm_scroll_thumbscroll_momentum_threshold_set(double threshold)
1869 {
1870    _elm_config->thumbscroll_momentum_threshold = threshold;
1871 }
1872
1873 EAPI void
1874 elm_scroll_thumbscroll_momentum_threshold_all_set(double threshold)
1875 {
1876 #ifdef HAVE_ELEMENTARY_X
1877    static Ecore_X_Atom atom = 0;
1878    unsigned int ts_momentum_threshold_i = (unsigned int)(threshold * 1000.0);
1879
1880    if (!atom)
1881      atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_MOMENTUM_THRESHOLD");
1882    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1883                                   atom, &ts_momentum_threshold_i, 1);
1884 #endif
1885 }
1886
1887 EAPI double
1888 elm_scroll_thumbscroll_friction_get(void)
1889 {
1890    return _elm_config->thumbscroll_friction;
1891 }
1892
1893 EAPI void
1894 elm_scroll_thumbscroll_friction_set(double friction)
1895 {
1896    _elm_config->thumbscroll_friction = friction;
1897 }
1898
1899 EAPI void
1900 elm_scroll_thumbscroll_friction_all_set(double friction)
1901 {
1902 #ifdef HAVE_ELEMENTARY_X
1903    static Ecore_X_Atom atom = 0;
1904    unsigned int ts_friction_i = (unsigned int)(friction * 1000.0);
1905
1906    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_FRICTION");
1907    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1908                                   atom, &ts_friction_i, 1);
1909 #endif
1910 }
1911
1912 EAPI double
1913 elm_scroll_thumbscroll_border_friction_get(void)
1914 {
1915    return _elm_config->thumbscroll_border_friction;
1916 }
1917
1918 EAPI void
1919 elm_scroll_thumbscroll_border_friction_set(double friction)
1920 {
1921    if (friction < 0.0)
1922      friction = 0.0;
1923
1924    if (friction > 1.0)
1925      friction = 1.0;
1926
1927    _elm_config->thumbscroll_friction = friction;
1928 }
1929
1930 EAPI void
1931 elm_scroll_thumbscroll_border_friction_all_set(double friction)
1932 {
1933    if (friction < 0.0)
1934      friction = 0.0;
1935
1936    if (friction > 1.0)
1937      friction = 1.0;
1938
1939 #ifdef HAVE_ELEMENTARY_X
1940    static Ecore_X_Atom atom = 0;
1941    unsigned int border_friction_i = (unsigned int)(friction * 1000.0);
1942
1943    if (!atom)
1944      atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_BORDER_FRICTION");
1945    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1946                                   atom, &border_friction_i, 1);
1947 #endif
1948 }
1949
1950 EAPI double
1951 elm_scroll_thumbscroll_sensitivity_friction_get(void)
1952 {
1953    return _elm_config->thumbscroll_sensitivity_friction;
1954 }
1955
1956 EAPI void
1957 elm_scroll_thumbscroll_sensitivity_friction_set(double friction)
1958 {
1959    if (friction < 0.1)
1960      friction = 0.1;
1961
1962    if (friction > 1.0)
1963      friction = 1.0;
1964
1965    _elm_config->thumbscroll_friction = friction;
1966 }
1967
1968 EAPI void
1969 elm_scroll_thumbscroll_sensitivity_friction_all_set(double friction)
1970 {
1971    if (friction < 0.1)
1972      friction = 0.1;
1973
1974    if (friction > 1.0)
1975      friction = 1.0;
1976
1977 #ifdef HAVE_ELEMENTARY_X
1978    static Ecore_X_Atom atom = 0;
1979    unsigned int sensitivity_friction_i = (unsigned int)(friction * 1000.0);
1980
1981    if (!atom)
1982      atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_SENSITIVITY_FRICTION");
1983    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1984                                   atom, &sensitivity_friction_i, 1);
1985 #endif
1986 }
1987
1988 EAPI void
1989 elm_object_scroll_hold_push(Evas_Object *obj)
1990 {
1991    EINA_SAFETY_ON_NULL_RETURN(obj);
1992    elm_widget_scroll_hold_push(obj);
1993 }
1994
1995 EAPI void
1996 elm_object_scroll_hold_pop(Evas_Object *obj)
1997 {
1998    EINA_SAFETY_ON_NULL_RETURN(obj);
1999    elm_widget_scroll_hold_pop(obj);
2000 }
2001
2002 EAPI void
2003 elm_object_scroll_freeze_push(Evas_Object *obj)
2004 {
2005    EINA_SAFETY_ON_NULL_RETURN(obj);
2006    elm_widget_scroll_freeze_push(obj);
2007 }
2008
2009 EAPI void
2010 elm_object_scroll_lock_x_set(Evas_Object *obj,
2011                              Eina_Bool    lock)
2012 {
2013    EINA_SAFETY_ON_NULL_RETURN(obj);
2014    elm_widget_drag_lock_x_set(obj, lock);
2015 }
2016
2017 EAPI void
2018 elm_object_scroll_lock_y_set(Evas_Object *obj,
2019                              Eina_Bool    lock)
2020 {
2021    EINA_SAFETY_ON_NULL_RETURN(obj);
2022    elm_widget_drag_lock_y_set(obj, lock);
2023 }
2024
2025 EAPI Eina_Bool
2026 elm_object_scroll_lock_x_get(const Evas_Object *obj)
2027 {
2028    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
2029    return elm_widget_drag_lock_x_get(obj);
2030 }
2031
2032 EAPI Eina_Bool
2033 elm_object_scroll_lock_y_get(const Evas_Object *obj)
2034 {
2035    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
2036    return elm_widget_drag_lock_y_get(obj);
2037 }
2038
2039 EAPI void
2040 elm_object_scroll_freeze_pop(Evas_Object *obj)
2041 {
2042    EINA_SAFETY_ON_NULL_RETURN(obj);
2043    elm_widget_scroll_freeze_pop(obj);
2044 }
2045
2046 EAPI Eina_Bool
2047 elm_object_widget_check(const Evas_Object *obj)
2048 {
2049    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
2050    return elm_widget_is(obj);
2051 }
2052
2053 EAPI Evas_Object *
2054 elm_object_parent_widget_get(const Evas_Object *obj)
2055 {
2056    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
2057    return elm_widget_parent_widget_get(obj);
2058 }
2059
2060 EAPI Evas_Object *
2061 elm_object_top_widget_get(const Evas_Object *obj)
2062 {
2063    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
2064    return elm_widget_top_get(obj);
2065 }
2066
2067 EAPI const char *
2068 elm_object_widget_type_get(const Evas_Object *obj)
2069 {
2070    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
2071    return elm_widget_type_get(obj);
2072 }
2073
2074 EAPI void
2075 elm_object_signal_emit(Evas_Object *obj,
2076                        const char  *emission,
2077                        const char  *source)
2078 {
2079    EINA_SAFETY_ON_NULL_RETURN(obj);
2080    elm_widget_signal_emit(obj, emission, source);
2081 }
2082
2083 EAPI void
2084 elm_object_signal_callback_add(Evas_Object *obj, const char *emission, const char *source, void (*func) (void *data, Evas_Object *o, const char *emission, const char *source), void *data)
2085 {
2086     EINA_SAFETY_ON_NULL_RETURN(obj);
2087     EINA_SAFETY_ON_NULL_RETURN(func);
2088     elm_widget_signal_callback_add(obj, emission, source, func, data);
2089 }
2090
2091 EAPI void *
2092 elm_object_signal_callback_del(Evas_Object *obj, const char *emission, const char *source, void (*func) (void *data, Evas_Object *o, const char *emission, const char *source))
2093 {
2094     EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
2095     EINA_SAFETY_ON_NULL_RETURN_VAL(func, NULL);
2096     return elm_widget_signal_callback_del(obj, emission, source, func);
2097 }
2098
2099 EAPI void
2100 elm_object_event_callback_add(Evas_Object *obj, Elm_Event_Cb func, const void *data)
2101 {
2102    EINA_SAFETY_ON_NULL_RETURN(obj);
2103    EINA_SAFETY_ON_NULL_RETURN(func);
2104    elm_widget_event_callback_add(obj, func, data);
2105 }
2106
2107 EAPI void *
2108 elm_object_event_callback_del(Evas_Object *obj, Elm_Event_Cb func, const void *data)
2109 {
2110    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
2111    EINA_SAFETY_ON_NULL_RETURN_VAL(func, NULL);
2112    return elm_widget_event_callback_del(obj, func, data);
2113 }
2114
2115 EAPI void
2116 elm_object_tree_dump(const Evas_Object *top)
2117 {
2118 #ifdef ELM_DEBUG
2119    elm_widget_tree_dump(top);
2120 #else
2121    return;
2122    (void)top;
2123 #endif
2124 }
2125
2126 EAPI void
2127 elm_object_tree_dot_dump(const Evas_Object *top,
2128                          const char        *file)
2129 {
2130 #ifdef ELM_DEBUG
2131    FILE *f = fopen(file, "wb");
2132    elm_widget_tree_dot_dump(top, f);
2133    fclose(f);
2134 #else
2135    return;
2136    (void)top;
2137    (void)file;
2138 #endif
2139 }
2140
2141 EAPI void
2142 elm_longpress_timeout_set(double longpress_timeout)
2143 {
2144    _elm_config->longpress_timeout = longpress_timeout;
2145 }
2146
2147 EAPI double
2148 elm_longpress_timeout_get(void)
2149 {
2150    return _elm_config->longpress_timeout;
2151 }
2152
2153 EAPI Evas_Object *
2154 elm_object_item_object_get(const Elm_Object_Item *it)
2155 {
2156    return ((Elm_Widget_Item *) it)->widget;
2157 }
2158
2159 EAPI void
2160 elm_object_item_content_part_set(Elm_Object_Item *it,
2161                                  const char *part,
2162                                  Evas_Object *content)
2163 {
2164    elm_widget_item_content_part_set(it, part, content);
2165 }
2166
2167 EAPI Evas_Object *
2168 elm_object_item_content_part_get(const Elm_Object_Item *it,
2169                                  const char *part)
2170 {
2171    return elm_widget_item_content_part_get(it, part);
2172 }
2173
2174 EAPI Evas_Object *
2175 elm_object_item_content_part_unset(Elm_Object_Item *it, const char *part)
2176 {
2177    return elm_widget_item_content_part_unset(it, part);
2178 }
2179
2180 EAPI void
2181 elm_object_item_text_part_set(Elm_Object_Item *it,
2182                               const char *part,
2183                               const char *label)
2184 {
2185    elm_widget_item_text_part_set(it, part, label);
2186 }
2187
2188 EAPI const char *
2189 elm_object_item_text_part_get(const Elm_Object_Item *it, const char *part)
2190 {
2191    return elm_widget_item_text_part_get(it, part);
2192 }
2193
2194 EAPI void *
2195 elm_object_item_data_get(const Elm_Object_Item *it)
2196 {
2197    return elm_widget_item_data_get(it);
2198 }
2199
2200 EAPI void
2201 elm_object_item_data_set(Elm_Object_Item *it, void *data)
2202 {
2203    elm_widget_item_data_set(it, data);
2204 }
2205
2206 EAPI void
2207 elm_object_item_signal_emit(Elm_Object_Item *it, const char *emission, const char *source)
2208 {
2209    elm_widget_item_signal_emit(it, emission, source);
2210 }
2211
2212 EAPI void
2213 elm_object_access_info_set(Evas_Object *obj, const char *txt)
2214 {
2215    elm_widget_access_info_set(obj, txt);
2216 }
2217
2218 EAPI void
2219 elm_object_item_access_info_set(Elm_Object_Item *it, const char *txt)
2220 {
2221    _elm_widget_item_access_info_set((Elm_Widget_Item *)it, txt);
2222 }
2223