Exemplo n.º 1
0
int
ef_cb_efreet_config_home(void)
{
   const char *tmp;
   int ret = 1;

   efreet_shutdown();
   setenv("XDG_CONFIG_HOME", "/var/tmp", 1);
   efreet_init();

   tmp = efreet_config_home_get();
   if (strcmp(tmp, "/var/tmp"))
     {
        printf("efreet_config_home_get() returned incorrect "
               "value (%s) on XDG_CONFIG_HOME=/var/tmp\n", tmp);
        ret = 0;
     }

   /* reset efreet here so we can set a new home dir */
   efreet_shutdown();
   unsetenv("XDG_CONFIG_HOME");
   setenv("HOME", "/home/tmp", 1);
   efreet_init();

   tmp = efreet_config_home_get();
   if (strcmp(tmp, "/home/tmp/.config"))
     {
        printf("efreet_config_home_get() returned incorrect "
               "value (%s) on blank XDG_CONFIG_HOME\n", tmp);
        ret = 0;
     }

   /* reset efreet here so we can set a new home dir */
   efreet_shutdown();
   unsetenv("XDG_CONFIG_HOME");
   unsetenv("HOME");
#ifdef _WIN32
   unsetenv("USERPROFILE");
#endif
   efreet_init();

   tmp = efreet_config_home_get();
   if (strcmp(tmp, "/tmp/.config"))
     {
        printf("efreet_config_home_get() returned incorrect "
               "value (%s) on blank XDG_CONFIG_HOME and blank HOME\n", tmp);
        ret = 0;
     }

   return ret;
}
Exemplo n.º 2
0
EAPI int
efreet_mime_shutdown(void)
{
    if (--_efreet_mime_init_count != 0)
        return _efreet_mime_init_count;

    efreet_mime_icons_debug();

    IF_RELEASE(_mime_inode_symlink);
    IF_RELEASE(_mime_inode_fifo);
    IF_RELEASE(_mime_inode_chardevice);
    IF_RELEASE(_mime_inode_blockdevice);
    IF_RELEASE(_mime_inode_socket);
    IF_RELEASE(_mime_inode_mountpoint);
    IF_RELEASE(_mime_inode_directory);
    IF_RELEASE(_mime_application_x_executable);
    IF_RELEASE(_mime_application_octet_stream);
    IF_RELEASE(_mime_text_plain);

    IF_FREE_LIST(globs, efreet_mime_glob_free);
    IF_FREE_LIST(magics, efreet_mime_magic_free);
    IF_FREE_HASH(monitors);
    IF_FREE_HASH(wild);
    IF_FREE_HASH(mime_icons);
    eina_log_domain_unregister(_efreet_mime_log_dom);
    _efreet_mime_log_dom = -1;
    efreet_shutdown();
    ecore_file_shutdown();
    ecore_shutdown();

    return _efreet_mime_init_count;
}
Exemplo n.º 3
0
int
main(int argc, char *argv[])
{
   if (!efreet_init())
     {
        fputs("ERROR: Could not initialize efreet!\n", stderr);
        return EXIT_FAILURE;
     }

   if (argc < 2)
     _print_all();
   else
     {
        int i;

        for (i = 1; i < argc; i++)
          if ((strcmp(argv[i], "-h") == 0) ||
              (strcmp(argv[i], "--help") == 0))
            {
               _help(argv[0]);
               goto end;
            }

        for (i = 1; i < argc; i++)
          _print(argv[i]);
     }

 end:
   efreet_shutdown();
   return EXIT_SUCCESS;
}
Exemplo n.º 4
0
int
wkb_ibus_init(void)
{
   if (wkb_ibus && wkb_ibus->refcount)
      goto end;

   if (!eldbus_init())
     {
        ERR("Error initializing Eldbus");
        goto eldbus_err;
     }

   if (!efreet_init())
     {
        ERR("Error initializing Efreet");
        goto efreet_err;
     }

   if (!wkb_ibus_config_eet_init())
     {
        ERR("Error initializing wkb_config_eet");
        goto eet_err;
     }

   if (!wkb_ibus && !(wkb_ibus = calloc(1, sizeof(*wkb_ibus))))
     {
        ERR("Error calloc");
        goto calloc_err;
     }

   WKB_IBUS_CONNECTED = ecore_event_type_new();
   WKB_IBUS_DISCONNECTED = ecore_event_type_new();
   WKB_IBUS_CONFIG_VALUE_CHANGED = ecore_event_type_new();
   WKB_THEME_CHANGED = ecore_event_type_new();

   wkb_ibus->add_handle = ecore_event_handler_add(ECORE_EXE_EVENT_ADD, _wkb_ibus_exe_add_cb, NULL);
   wkb_ibus->data_handle = ecore_event_handler_add(ECORE_EXE_EVENT_DATA, _wkb_ibus_exe_data_cb, NULL);

end:
   return ++wkb_ibus->refcount;

calloc_err:
   wkb_ibus_config_eet_shutdown();

eet_err:
   efreet_shutdown();

efreet_err:
   eldbus_shutdown();

eldbus_err:
   return 0;
}
Exemplo n.º 5
0
int
ef_cb_efreet_icon_theme(void)
{
    int ret = 1;
    const char *tmp;

    unsetenv("XDG_DATA_HOME");
    efreet_shutdown();
    putenv("HOME=/var/tmp");
    efreet_init();

    tmp = efreet_icon_user_dir_get();
    if (strcmp(tmp, "/var/tmp/.local/share/icons"))
    {
        printf("efreet_icon_user_dir_get() returned incorrect "
                "value (%s) on HOME=/var/tmp\n", tmp);
        ret = 0;
    }

    efreet_shutdown();
    unsetenv("HOME");
#ifdef _WIN32
    unsetenv("USERPROFILE");
#endif
    efreet_init();

    tmp = efreet_icon_user_dir_get();
    if (strcmp(tmp, "/tmp/.local/share/icons"))
    {
        printf("efreet_icon_user_dir_get() returned incorrect "
                "value (%s) on HOME=\n", tmp);
        ret = 0;
    }

    return ret;
}
Exemplo n.º 6
0
EAPI int
efreet_mime_init(void)
{
    if (++_efreet_mime_init_count != 1)
        return _efreet_mime_init_count;

    if (!ecore_init())
        return --_efreet_mime_init_count;

    if (!ecore_file_init())
        goto shutdown_ecore;

    if (!efreet_init())
        goto shutdown_ecore_file;

    _efreet_mime_log_dom = eina_log_domain_register
      ("efreet_mime", EFREET_DEFAULT_LOG_COLOR);

    if (_efreet_mime_log_dom < 0)
    {
        EINA_LOG_ERR("Efreet: Could not create a log domain for efreet_mime.");
        goto shutdown_efreet;
    }

    efreet_mime_endianess = efreet_mime_endian_check();

    monitors = eina_hash_string_superfast_new(EINA_FREE_CB(ecore_file_monitor_del));

    efreet_mime_type_cache_clear();

    if (!efreet_mime_init_files())
        goto unregister_log_domain;

    return _efreet_mime_init_count;

unregister_log_domain:
    eina_log_domain_unregister(_efreet_mime_log_dom);
    _efreet_mime_log_dom = -1;
shutdown_efreet:
    efreet_shutdown();
shutdown_ecore_file:
    ecore_file_shutdown();
shutdown_ecore:
    ecore_shutdown();

    return --_efreet_mime_init_count;
}
Exemplo n.º 7
0
static void
_wkb_ibus_shutdown_finish(void)
{
   DBG("Finish");

   ecore_event_handler_del(wkb_ibus->add_handle);
   ecore_event_handler_del(wkb_ibus->data_handle);

   free(wkb_ibus);
   wkb_ibus = NULL;

   ecore_main_loop_quit();

   wkb_ibus_config_eet_shutdown();
   efreet_shutdown();
   eldbus_shutdown();
}
Exemplo n.º 8
0
int ewk_shutdown(void)
{
    if (--_ewkInitCount)
        return _ewkInitCount;

    edje_shutdown();
#ifdef HAVE_ECORE_X
    ecore_x_shutdown();
#endif
    efreet_shutdown();
    ecore_imf_shutdown();
    ecore_evas_shutdown();
    ecore_shutdown();
    evas_shutdown();
    eina_log_domain_unregister(_ewk_log_dom);
    _ewk_log_dom = -1;
    eina_shutdown();

    return 0;
}
Exemplo n.º 9
0
int EwkMain::finalize()
{
    if (--m_initCount)
        return m_initCount;

    edje_shutdown();
#ifdef HAVE_ECORE_X
    ecore_x_shutdown();
#endif
    efreet_shutdown();
    ecore_imf_shutdown();
    ecore_evas_shutdown();
    ecore_shutdown();
    evas_shutdown();
    eina_log_domain_unregister(m_logDomainId);
    m_logDomainId = -1;
    eina_shutdown();

    return 0;
}
Exemplo n.º 10
0
void EwkMain::shutdownInitializedEFLModules(EFLModuleInitFailure module)
{
    switch (module) {
    case EFLModuleInitFailure::Edje:
#ifdef HAVE_ECORE_X
        ecore_x_shutdown();
#endif
    case EFLModuleInitFailure::EcoreX:
        efreet_shutdown();
    case EFLModuleInitFailure::Efreet:
        ecore_imf_shutdown();
    case EFLModuleInitFailure::EcoreImf:
        ecore_evas_shutdown();
    case EFLModuleInitFailure::EcoreEvas:
        ecore_shutdown();
    case EFLModuleInitFailure::Ecore:
        evas_shutdown();
    case EFLModuleInitFailure::Evas:
        eina_log_domain_unregister(m_logDomainId);
        m_logDomainId = -1;
    case EFLModuleInitFailure::EinaLog:
        eina_shutdown();
    }
}
Exemplo n.º 11
0
int ewk_init(void)
{
    if (_ewkInitCount)
        return ++_ewkInitCount;

    if (!eina_init())
        goto error_eina;

    _ewk_log_dom = eina_log_domain_register("ewebkit2", EINA_COLOR_ORANGE);
    if (_ewk_log_dom < 0) {
        EINA_LOG_CRIT("could not register log domain 'ewebkit2'");
        goto error_log_domain;
    }

    if (!evas_init()) {
        CRITICAL("could not init evas.");
        goto error_evas;
    }

    if (!ecore_init()) {
        CRITICAL("could not init ecore.");
        goto error_ecore;
    }

    if (!ecore_evas_init()) {
        CRITICAL("could not init ecore_evas.");
        goto error_ecore_evas;
    }

    if (!ecore_imf_init()) {
        CRITICAL("could not init ecore_imf.");
        goto error_ecore_imf;
    }

    if (!efreet_init()) {
        CRITICAL("could not init efreet.");
        goto error_efreet;
    }

#ifdef HAVE_ECORE_X
    if (!ecore_x_init(0)) {
        CRITICAL("could not init ecore_x.");
        goto error_ecore_x;
    }
#endif

    if (!edje_init()) {
        CRITICAL("Could not init edje.");
        goto error_edje;
    }

    if (!ecore_main_loop_glib_integrate()) {
        WARN("Ecore was not compiled with GLib support, some plugins will not "
            "work (ie: Adobe Flash)");
    }

    return ++_ewkInitCount;

error_edje:
#ifdef HAVE_ECORE_X
    ecore_x_shutdown();
error_ecore_x:
#else
    efreet_shutdown();
#endif
error_efreet:
    ecore_imf_shutdown();
error_ecore_imf:
    ecore_evas_shutdown();
error_ecore_evas:
    ecore_shutdown();
error_ecore:
    evas_shutdown();
error_evas:
    eina_log_domain_unregister(_ewk_log_dom);
    _ewk_log_dom = -1;
error_log_domain:
    eina_shutdown();
error_eina:
    return 0;
}
Exemplo n.º 12
0
Arquivo: main.c Projeto: Limsik/e17
int
main(int argc, char ** argv)
{
    int i, passed = 0, num_tests = 0;
    Eina_List *run = NULL;
    double total;
    char *env;

    eina_init();
    ecore_init();

    total = ecore_time_get();
    if (argc > 1)
    {
        for (i = 1; i < argc; i++)
        {
            if ((!strcmp(argv[i], "-h")) ||
                (!strcmp(argv[i], "--help")))
            {
                for (i = 0; tests[i].name; i++)
                {
                    printf("%s\n", tests[i].name);
                }
                return 1;
            }
            run = eina_list_append(run, argv[i]);
        }
    }

    environment_store();
    for (i = 0; tests[i].name; i++)
    {
        int ret;
        double start;

        /* we've been given specific tests and it isn't in the list */
        if (run && !eina_list_search_unsorted(run, EINA_COMPARE_CB(strcasecmp),
                                                        tests[i].name))
            continue;

        if (!efreet_init())
        {
            printf("Error initializing Efreet\n");
            continue;
        }

        num_tests ++;

        printf("%s:\t\t", tests[i].name);
        fflush(stdout);
        start = ecore_time_get();
        ret = tests[i].cb();
        printf("%s in %.3f seconds\n", (ret ? "PASSED" : "FAILED"),
                                            ecore_time_get() - start);
        passed += ret;

        efreet_shutdown();
        environment_restore();
    }

    printf("\n-----------------\n");
    clearenv();
    EINA_LIST_FREE(environment, env)
        free(env);
    printf("Passed %d of %d tests.\n", passed, num_tests);

    while (run)
        run = eina_list_remove_list(run, run);

    printf("Total run: %.3f seconds\n", ecore_time_get() - total);

    ecore_shutdown();
    eina_shutdown();
    return 0;
}
Exemplo n.º 13
0
int
ef_cb_efreet_config_dirs(void)
{
   Eina_List *tmp, *l;
   int ret = 1;
   unsigned int i;
   unsigned int ok;
   char dirs[128], *val;
   char *vals[] = {"/var/tmp/a", "/tmp/b", "/usr/local/share", "/etc", NULL};
   char *def_vals[] = {"/etc/xdg", NULL};

   dirs[0] = '\0';

   for (i = 0; vals[i]; i++)
     {
        if (i > 0) strcat(dirs, ":");
        strcat(dirs, vals[i]);
     }

   efreet_shutdown();
   setenv("XDG_CONFIG_DIRS", dirs, 1);
   efreet_init();

   ok = 0;
   tmp = efreet_config_dirs_get();
   for (i = 0; vals[i]; i++)
     {
        char *found;

        found = eina_list_search_unsorted(tmp, EINA_COMPARE_CB(strcmp), vals[i]);
        if (!ecore_file_exists(vals[i]) && found)
          {
             printf("efreet_data_dirs_get() includes non-existing dir (%s) when "
                    "%s set\n", vals[i], dirs);
             ret = 0;
             continue;
          }
        if (ecore_file_exists(vals[i]) && !found)
          {
             printf("efreet_data_dirs_get() is missing dir (%s) when "
                    "%s set\n", vals[i], dirs);
             ret = 0;
             continue;
          }
        if (ecore_file_exists(vals[i]) && found)
          ok++;
     }
   if (eina_list_count(tmp) != ok)
     {
        printf("efreet_data_dirs_get() returned more values then it "
               "should have given %s as input\n", dirs);
        ret = 0;
     }

   efreet_shutdown();
   unsetenv("XDG_CONFIG_DIRS");
   efreet_init();

   i = 0;
   tmp = efreet_config_dirs_get();
   EINA_LIST_FOREACH(tmp, l, val)
     {
        if (!def_vals[i])
          {
             printf("efreet_config_dirs_get() returned more values then it "
                    "should have given %s as input\n", dirs);
             ret = 0;
             break;
          }

        if (strcmp(val, def_vals[i]))
          {
             printf("efreet_config_dirs_get() returned incorrect value (%s) when "
                    "XDG_CONFIG_DIRS= is set\n", val);
             ret = 0;
          }

        i++;
     }
   return ret;
}
Exemplo n.º 14
0
int
ef_cb_locale(void)
{
   int ret = 1, i;
   struct
     {
        char *lc_message;
        char *lang;
        char *country;
        char *modifier;
     } langs[] = {
          /* these are ordered such that when we move from LANG to LC_MESSAGES
           * the LANG env will still be effect. Same with moving from
           * LC_MESSAGES to LANG */
            {"LANG=", NULL, NULL, NULL},
            {"LANG=en", "en", NULL, NULL},
            {"LANG=en@Latn", "en", NULL, "Latn"},
            {"LANG=en_US", "en", "US", NULL},
            {"LANG=en_US@Latn", "en", "US", "Latn"},
            {"LANG=en_US.blah@Latn", "en", "US", "Latn"},
            {"LC_MESSAGES=", "en", "US", "Latn"}, /* This will fallback to LANG */
            {"LC_MESSAGES=fr", "fr", NULL, NULL},
            {"LC_MESSAGES=fr@Blah", "fr", NULL, "Blah"},
            {"LC_MESSAGES=fr_FR", "fr", "FR", NULL},
            {"LC_MESSAGES=fr_FR@Blah", "fr", "FR", "Blah"},
            {"LC_MESSAGES=fr_FR.Foo@Blah", "fr", "FR", "Blah"},
            {"LC_ALL=", "fr", "FR", "Blah"}, /* this will fallback to LC_MESSAGES */
            {"LC_ALL=sr", "sr", NULL, NULL},
            {"LC_ALL=sr@Ret", "sr", NULL, "Ret"},
            {"LC_ALL=sr_YU", "sr", "YU", NULL},
            {"LC_ALL=sr_YU@Ret", "sr", "YU", "Ret"},
            {"LC_ALL=sr_YU.ssh@Ret", "sr", "YU", "Ret"},
            {NULL, NULL, NULL, NULL}
     };

   /* reset everything to blank */
   putenv("LC_ALL=");
   putenv("LC_MESSAGES=");
   putenv("LANG=");

   for (i = 0; langs[i].lc_message; i++)
     {
        const char *tmp;

        putenv(langs[i].lc_message);

        tmp = efreet_lang_get();
        if ((langs[i].lang && (!tmp || strcmp(tmp, langs[i].lang)))
            || (!langs[i].lang && tmp))
          {
             printf("efreet_lang_get() is wrong (%s) with %s\n",
                    tmp, langs[i].lang);
             ret = 0;
          }

        tmp = efreet_lang_country_get();
        if ((langs[i].country && (!tmp || strcmp(tmp, langs[i].country)))
            || (!langs[i].country && tmp))
          {
             printf("efreet_lang_country_get() is wrong (%s) with %s\n",
                    tmp, langs[i].lang);
             ret = 0;
          }

        tmp = efreet_lang_modifier_get();
        if ((langs[i].modifier && (!tmp || strcmp(tmp, langs[i].modifier)))
            || (!langs[i].modifier && tmp))
          {
             printf("efreet_lang_modifier_get() is wrong with %s with %s\n",
                    tmp, langs[i].lang);
             ret = 0;
          }

        efreet_shutdown();
        efreet_init();
     }

   return ret;
}
Exemplo n.º 15
0
void bks_model_shutdown(void) {

   eina_lock_free(&mdl.lock);
   efreet_shutdown();
   ecore_file_shutdown();
}