Example #1
0
/**
 * @brief Does the same thing as etk_init() except you can specify custom arguments that could be then retrieved with
 * etk_argument_* functions. For example, etk_init_full(argc, argv, "--option1 value --toggle1")
 * @param argc the location of the "argc" parameter passed to main(). It is used to parse the arguments specific to Etk.
 * It can be set to NULL.
 * @param argv the location of the "argv" parameter passed to main(). It is used to parse the arguments specific to Etk.
 * It can be set to NULL.
 * @param custom_opts a string corresponding to the custom arguments to add to argv. It can be set to NULL
 * @return Returns the number of times Etk has been initialized, or 0 on failure
 * @note It initializes Evas, Ecore and Edje so you don't need to initialize them after an etk_init()
 * @see etk_init()
 * @see etk_shutdown()
 */
int etk_init_full(int argc, char **argv, const char *custom_opts)
{
   char *engine_name = NULL;

   if (_etk_main_init_count > 0)
   {
      _etk_main_init_count++;
      return _etk_main_init_count;
   }
   else
   {
      /* Parse the arguments */
      etk_argument_init(argc, argv, custom_opts);
      etk_argument_value_get("etk-engine", 0, ETK_TRUE, &engine_name);

      /* Initialize the EFL */
      if (!evas_init())
      {
         ETK_WARNING("Evas initialization failed!");
         return 0;
      }
      if (!ecore_init())
      {
         ETK_WARNING("Ecore initialization failed!");
         return 0;
      }
      if (!ecore_imf_init())
      {
         ETK_WARNING("Ecore_IMF initialization failed!");
      }
      if (!edje_init())
      {
         ETK_WARNING("Edje initialization failed!");
         return 0;
      }

      /* TODO: maybe we should do this in etk_main().
       * Problem: if we do this, a program that uses directly ecore_main_loop_begin() and not etk_main() won't work */
      _etk_main_idle_enterer = ecore_idle_enterer_add(_etk_main_idle_enterer_cb, NULL);

      /* Initialize the subsystems of Etk */
      if (!etk_config_init())
      {
         ETK_WARNING("Etk_Config initialization failed!");
         return 0;
      }
      etk_config_load();
      etk_theme_init();
      if (!etk_engine_init())
      {
         ETK_WARNING("Etk_Engine initialization failed!");
         return 0;
      }
      if (!etk_engine_load(engine_name ? engine_name : "ecore_evas_software_x11"))
      {
         ETK_WARNING("Etk can not load the requested engine!");
         return 0;
      }
      etk_event_init();
      etk_tooltips_init();

      /* Initialize Gettext */
      setlocale(LC_ALL, "");
      bindtextdomain(PACKAGE, LOCALEDIR);
      textdomain(PACKAGE);

      free(engine_name);
      _etk_main_init_count++;
      return _etk_main_init_count;
   }
}
Example #2
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;
}
Example #3
0
int EwkMain::initialize()
{
    if (m_initCount)
        return ++m_initCount;

    if (!eina_init()) {
        EINA_LOG_CRIT("could not init eina.");
        return 0;
    }

    m_logDomainId = eina_log_domain_register("ewebkit2", EINA_COLOR_ORANGE);
    if (m_logDomainId < 0) {
        EINA_LOG_CRIT("could not register log domain 'ewebkit2'");
        shutdownInitializedEFLModules(EFLModuleInitFailure::EinaLog);
        return 0;
    }

    if (!evas_init()) {
        CRITICAL("could not init evas.");
        shutdownInitializedEFLModules(EFLModuleInitFailure::Evas);
        return 0;
    }

    if (!ecore_init()) {
        CRITICAL("could not init ecore.");
        shutdownInitializedEFLModules(EFLModuleInitFailure::Ecore);
        return 0;
    }

    if (!ecore_evas_init()) {
        CRITICAL("could not init ecore_evas.");
        shutdownInitializedEFLModules(EFLModuleInitFailure::EcoreEvas);
        return 0;
    }

    if (!ecore_imf_init()) {
        CRITICAL("could not init ecore_imf.");
        shutdownInitializedEFLModules(EFLModuleInitFailure::EcoreImf);
        return 0;
    }

    if (!efreet_init()) {
        CRITICAL("could not init efreet.");
        shutdownInitializedEFLModules(EFLModuleInitFailure::Efreet);
        return 0;
    }

#ifdef HAVE_ECORE_X
    if (!ecore_x_init(0)) {
        CRITICAL("could not init ecore_x.");
        shutdownInitializedEFLModules(EFLModuleInitFailure::EcoreX);
        return 0;
    }
#endif

    if (!edje_init()) {
        CRITICAL("Could not init edje.");
        shutdownInitializedEFLModules(EFLModuleInitFailure::Edje);
        return 0;
    }

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

    return ++m_initCount;
}