Exemplo n.º 1
0
int main(int argc, char *argv[])
{
   Ecore_Evas *window;
   Evas *canvas;
   Evas_Object *edje;
   const char *text;

   ecore_evas_init();
   edje_init();

   window = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);
   if (!window)
     {
        EINA_LOG_CRIT("could not create window.");
        return -1;
     }
   canvas = ecore_evas_get(window);

   text = (argc > 1) ? argv[1] : NULL;

   edje = create_my_group(canvas, text);
   if (!edje)
     return -2;

   ecore_evas_show(window);
   ecore_main_loop_begin();

   evas_object_del(edje);
   ecore_evas_free(window);

   edje_shutdown();
   ecore_evas_shutdown();

   return 0;
}
Exemplo n.º 2
0
/**
 * @brief Shuts down Etk. It decrements the init-counter. If the counter reaches 0, it frees all the resources used by Etk
 * @return Returns the new value of the init-counter. If 0 is returned, it means that the resources has effectively
 * been freed.
 */
int etk_shutdown(void)
{
   if (_etk_main_init_count <= 0)
      return 0;

   _etk_main_init_count--;
   if (_etk_main_init_count == 0)
   {
      ecore_idle_enterer_del(_etk_main_idle_enterer);
      _etk_main_idle_enterer = NULL;

      /* Shutdown the subsystems of Etk */
      etk_object_shutdown();
      etk_type_shutdown();
      etk_signal_shutdown();

      etk_tooltips_shutdown();
      etk_event_shutdown();
      etk_engine_shutdown();
      etk_config_shutdown();
      etk_theme_shutdown();
      etk_argument_shutdown();

      /* Shutdown the EFL*/
      edje_shutdown();
      ecore_imf_shutdown();
      ecore_shutdown();
      evas_shutdown();
   }

   return _etk_main_init_count;
}
Exemplo n.º 3
0
/* externally accessible functions */
int
main(int    argc,
     char **argv)
{
   int i;

   for (i = 1; i < argc; i++)
     {
        if ((!strcmp(argv[i], "-h")) ||
            (!strcmp(argv[i], "-help")) ||
            (!strcmp(argv[i], "--help")))
          {
             printf(
               "This is an internal tool for Enlightenment.\n"
               "do not use it.\n"
               );
             exit(0);
          }
        else if (!strncmp(argv[i], "--nice=", 7))
          {
             const char *val;
             int ret = 0;

             val = argv[i] + 7;
             if (*val)
               ret = nice(atoi(val));
          }
     }

   ecore_init();
   ecore_app_args_set(argc, (const char **)argv);
   eet_init();
   evas_init();
   ecore_evas_init();
   edje_init();
   ecore_file_init();
   ecore_ipc_init();

   e_user_dir_concat_static(_thumbdir, "fileman/thumbnails");
   ecore_file_mkpath(_thumbdir);

   if (_e_ipc_init()) ecore_main_loop_begin();

   if (_e_ipc_server)
     {
        ecore_ipc_server_del(_e_ipc_server);
        _e_ipc_server = NULL;
     }

   ecore_ipc_shutdown();
   ecore_file_shutdown();
   ecore_evas_shutdown();
   edje_shutdown();
   evas_shutdown();
   eet_shutdown();
   ecore_shutdown();

   return 0;
}
Exemplo n.º 4
0
/**
 * Shutdown libraries
 */
void
elicit_libs_shutdown()
{
  edje_shutdown();
  ecore_file_shutdown();
  ecore_evas_shutdown();
  ecore_shutdown();
  eina_shutdown();
}
Exemplo n.º 5
0
RunLoop::~RunLoop()
{
    if (m_initEfl) {
        edje_shutdown();
        ecore_file_shutdown();
        ecore_evas_shutdown();
        ecore_shutdown();
    }
}
Exemplo n.º 6
0
void ui_shutdown(ePlayer *player) {
	assert(player);

	ui_shutdown_edje(player);

	ewl_shutdown();
	edje_shutdown();
	ecore_evas_shutdown();
	ecore_shutdown();
}
Exemplo n.º 7
0
ApplicationMain::~ApplicationMain()
{
    DELETE_NULL(controller)

            elm_shutdown();
    edje_shutdown();
    ecore_evas_shutdown();
    evas_shutdown();
    ecore_con_url_shutdown();
    ecore_con_shutdown();
    ecore_shutdown();
    eina_shutdown();
}
    void platformFinalize() override
    {
        if (SoupCache* soupCache = SoupNetworkSession::defaultSession().cache()) {
            soup_cache_flush(soupCache);
            soup_cache_dump(soupCache);
        }

        edje_shutdown();
        ecore_evas_shutdown();
#ifdef HAVE_ECORE_X
        ecore_x_shutdown();
#endif
        ecore_shutdown();
        eina_shutdown();
    }
Exemplo n.º 9
0
int main(int argc, char *argv[])
{
   Eclair eclair;

   if (!eclair_init(&eclair, &argc, &argv))
      return 1;
   
   ecore_main_loop_begin();

   edje_shutdown();
   ecore_file_shutdown();
   ecore_evas_shutdown();
   ecore_shutdown();

   return 0;
}
Exemplo n.º 10
0
int ewk_shutdown(void)
{
    _ewkInitCount--;
    if (_ewkInitCount)
        return _ewkInitCount;

#ifdef HAVE_ECORE_X
    ecore_x_shutdown();
#endif
    edje_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.º 11
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.º 12
0
int main(int argv)
{
  Ecore_Evas *ee;
  Evas *canvas;
  Evas_Object *edje;
  ecore_evas_init();
  edje_init();
  ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);

  canvas = ecore_evas_get(ee);
  edje = teste(canvas);

  if (!edje)
    return -2;
  ecore_evas_show(ee);
  ecore_main_loop_begin();
  evas_object_del(edje);
  ecore_evas_free(ee);
  edje_shutdown();
  ecore_evas_shutdown();
  return 0;
}
Exemplo n.º 13
0
void shutdown_efl() {
	edje_shutdown();
	ecore_evas_shutdown();
	ecore_x_shutdown();
	ecore_shutdown();
}
Exemplo n.º 14
0
int ewk_init(void)
{
    if (_ewkInitCount)
        return ++_ewkInitCount;

    if (!eina_init())
        goto error_eina;

    _ewk_log_dom = eina_log_domain_register("ewebkit", EINA_COLOR_ORANGE);
    if (_ewk_log_dom < 0) {
        EINA_LOG_CRIT("could not register log domain 'ewebkit'");
        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 (!edje_init()) {
        CRITICAL("could not init edje.");
        goto error_edje;
    }

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

    if (!_ewk_init_body()) {
        CRITICAL("could not init body");
        goto error_edje;
    }

    return ++_ewkInitCount;

#ifdef HAVE_ECORE_X
error_ecore_x:
    edje_shutdown();
#endif
error_edje:
    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.º 15
0
int main(int argc, char **argv) {

	ecore_init();
	ecore_evas_init();
	edje_init();
	 
	char * display = getenv("DISPLAY");
	if (! display) 
		display = (char *)strdup(":0.0");
	
	if (!e_lib_init(display)) {
		fprintf(stderr, "Cannot connect to a running e17\n");
		edje_shutdown();
		ecore_shutdown();
		return 1;
	}       

	ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, WIDTH, HEIGHT);
	ecore_evas_title_set(ee, "eThemes (connecting...)");
	ecore_evas_name_class_set(ee, "eThemes", "eThemes");
	ecore_evas_show(ee);

	evas = ecore_evas_get(ee);

	background = edje_object_add(evas);
	evas_object_move(background, 0,0);
	evas_object_resize(background, barwidth, HEIGHT);
	evas_object_show(background);

	e_preview_thumb_init();

	preview = e_preview_new(evas);
	
	preview_clip = evas_object_rectangle_add(evas);
	evas_object_move(preview_clip, barwidth, 0);
	evas_object_resize(preview_clip, WIDTH - barwidth, HEIGHT);
	evas_object_show(preview_clip);
	evas_object_clip_set (preview, preview_clip);

	last_button = NULL;

	ecore_evas_callback_resize_set(ee, _resize_cb);
	        
	ecore_event_handler_add(E_RESPONSE_THEME_GET, ethemes_init, NULL);
	e_lib_theme_get("theme");
			
	ecore_main_loop_begin();

	/* free ethemes */
	int n = eina_list_count(themes);
	for ( n -= 1; n>=0; n--) {
		Etheme_Object * o;
		o = eina_list_nth(themes, n);
		etheme_free(o);
	}
	eina_list_free(themes);

	/* free canvas objects */
	evas_object_del(container);
	evas_object_del(container_outer);
	evas_object_del(b_apply);
	evas_object_del(b_default);
	evas_object_del(b_exit);
	evas_object_del(background);
	evas_object_del(preview);
	evas_object_del(preview_clip);
	
	if (selected_theme) free(selected_theme);
	if (default_theme) free(default_theme);
	
	edje_shutdown();
	ecore_shutdown();

	return 0;
}
Exemplo n.º 16
0
WK_EXPORT int WebProcessMainEfl(int argc, char* argv[])
{
    // WebProcess should be launched with an option.
    if (argc != 2)
        return 1;

    if (!eina_init())
        return 1;

    if (!ecore_init()) {
        // Could not init ecore.
        eina_shutdown();
        return 1;
    }

#ifdef HAVE_ECORE_X
    XSetExtensionErrorHandler(dummyExtensionErrorHandler);

    if (!ecore_x_init(0)) {
        // Could not init ecore_x.
        // PlatformScreenEfl and systemBeep() functions
        // depend on ecore_x functionality.
        ecore_shutdown();
        eina_shutdown();
        return 1;
    }
#endif

    if (!ecore_evas_init()) {
#ifdef HAVE_ECORE_X
        ecore_x_shutdown();
#endif
        ecore_shutdown();
        eina_shutdown();
        return 1;
    }

    if (!edje_init()) {
        ecore_evas_shutdown();
#ifdef HAVE_ECORE_X
        ecore_x_shutdown();
#endif
        ecore_shutdown();
        eina_shutdown();
        return 1;
    }

#if !GLIB_CHECK_VERSION(2, 35, 0)
    g_type_init();
#endif

    if (!ecore_main_loop_glib_integrate())
        return 1;

    InitializeWebKit2();

    SoupSession* session = WebCore::ResourceHandle::defaultSession();
    const char* httpProxy = getenv("http_proxy");
    if (httpProxy) {
        const char* noProxy = getenv("no_proxy");
        SoupProxyURIResolver* resolverEfl = soupProxyResolverWkNew(httpProxy, noProxy);
        soup_session_add_feature(session, SOUP_SESSION_FEATURE(resolverEfl));
        g_object_unref(resolverEfl);
    }

    int socket = atoi(argv[1]);

    ChildProcessInitializationParameters parameters;
    parameters.connectionIdentifier = socket;

    WebProcess::shared().initialize(parameters);

    RunLoop::run();

    if (SoupSessionFeature* soupCache = soup_session_get_feature(session, SOUP_TYPE_CACHE)) {
        soup_cache_flush(SOUP_CACHE(soupCache));
        soup_cache_dump(SOUP_CACHE(soupCache));
    }

    edje_shutdown();
    ecore_evas_shutdown();
#ifdef HAVE_ECORE_X
    ecore_x_shutdown();
#endif
    ecore_shutdown();
    eina_shutdown();

    return 0;

}
Exemplo n.º 17
0
/**
 * @param argc: Number of command line arguments supplied.
 * @param argv: Char* array containing the command line arguments supplied.
 * @return: To the system, normally 0.
 * @brief: The first function once enotes is called.
 */
int
main(int argc, char *argv[])
{
	int             note_count;

	/* IPC Check */
	ecore_ipc_init();
	dml("IPC Initiated Successfully", 1);

	/* loading will increment this if there are notes if not we may need to
	 * create a blank one */
	note_count = 0;

	if ((ecore_config_init("enotes")) == ECORE_CONFIG_ERR_FAIL) {
		ecore_ipc_shutdown();
		return (-1);
	}
	ecore_app_args_set(argc, (const char **) argv);

	ecore_config_app_describe("E-Notes - Sticky Notes for Enlightenment\n\
Copyright (c) Thomas Fletcher\n\
Usage: enotes [options]");

	/* Read the Usage and Configurations */
	main_config = mainconfig_new();
	if (read_configuration(main_config) != ECORE_CONFIG_PARSE_CONTINUE) {
		ecore_config_shutdown();
		ecore_ipc_shutdown();
		ecore_shutdown();
		mainconfig_free(main_config);
		return (-1);
	}

	dml("Successfully Read Configurations and Usage", 1);

	process_note_storage_locations();

	if (find_server() != 0) {
		if (remotecmd != NULL)
			send_to_server(remotecmd);
		else
			send_to_server("DEFNOTE");
	} else {
		dml("Server wasn't found.. Creating one", 1);
		/* Setup Server */
		setup_server();

		/* Initialise the E-Libs */
		ecore_init();
		ecore_x_init(NULL);
		ecore_app_args_set(argc, (const char **) argv);
		if (!ecore_evas_init()) {
			mainconfig_free(main_config);
			return -1;
		}
		ewl_init(&argc, argv);
		edje_init();

		dml("Efl Successfully Initiated", 1);

		autoload();
		/* create autosave timer */
		update_autosave();

		if (remotecmd != NULL)
			handle_ipc_message(remotecmd);

		/* Begin the Control Centre */
		if (main_config->controlcentre == 1) {
			setup_cc();
			dml("Control Centre Setup", 1);
		} else {
			dml("No Control Centre - Displaying Notice", 1);
			if (get_note_count() == 0)
				new_note();
		}

		if (main_config->welcome == 1) {
			open_welcome();
		}

		/* Begin the main loop */
		dml("Starting Main Loop", 1);
		ecore_main_loop_begin();

		dml("Main Loop Ended", 1);

		/* Save Controlcentre Settings */
		set_cc_pos();

		autosave();
		if (autosave_timer)
			ecore_timer_del(autosave_timer);

		/* Save and Free the Configuration */
		ecore_config_save();
		dml("Configuration Saved", 1);
		mainconfig_free(main_config);
		dml("Configuration Structure Free'd", 1);

		/* Shutdown the E-Libs */
		edje_shutdown();
		ecore_evas_shutdown();
		ecore_x_shutdown();
		ecore_shutdown();
		dml("Efl Shutdown", 1);
	}

	/* End IPC */
	ecore_ipc_shutdown();
	dml("IPC Shutdown", 1);

	dml("Leaving.", 1);
	return (0);
}
Exemplo n.º 18
0
int main(int argc, char ** argv)
{
    Eli_App * eap;
    
    eap = NULL;

    /* Initialize NLS */
#ifdef ENABLE_NLS
    setlocale(LC_MESSAGES, "");
    setlocale(LC_MONETARY, "");
    setlocale(LC_CTYPE, "");
    bindtextdomain(PACKAGE, PACKAGE_LOCALE_DIR);
    bind_textdomain_codeset(PACKAGE, "UTF-8");
    textdomain(PACKAGE);
#endif
    /* Initialize Ecore */
    if (!ecore_init()) {
        fprintf(stderr, _("Elitaire Error: Cannot init Ecore\n"));
        return 1;
    }
    if (!ecore_file_init()) {
        fprintf(stderr, _("Elitaire Error: Cannot init Ecore File\n"));
        return 1;
    }
    /* Initialize Edje */
    if (!edje_init()) {
        fprintf(stderr, _("Elitaire Error: Cannot init Edje\n"));
        return 1;
    }
    /* Initialize Ecore_Config */
    if (ecore_config_init("elitaire") != ECORE_CONFIG_ERR_SUCC) {
        fprintf(stderr, _("Elitaire Error: Cannot init Ecore Config\n"));
        return 1;
    }
    /* Initialize Ewl */
    if (!ewl_init(&argc, argv)) {
        fprintf(stderr, _("Elitaire Error: Cannot init Ewl\n"));
        return 1;
    }
    /* Init Highscore and Statistics */
    eli_highscore_init("elitaire");
    eli_statistics_init("elitaire");
    help_reader_init(PACKAGE_DATA_DIR"/doc/");

    /* Init the main app */
    eap = eli_app_new();
    eli_app_init(eap, "edje");
    eli_app_gui_make(eap);

    ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, sig_exit_cb, eap);
    /* ***Main Loop*** */
    ecore_main_loop_begin();

    eli_app_del(eap);
    /* shutdown all */
    help_reader_shutdown();
    eli_statistics_shutdown();
    eli_highscore_shutdown();
    ewl_shutdown();
    //eli_app_gui_del(eap);
    ecore_config_shutdown();
    ecore_file_shutdown();
    edje_shutdown();

    ecore_evas_shutdown();

    ecore_shutdown();
    return 0;
}
Exemplo n.º 19
0
int
main(int argc, char **argv)
{
   int i;
   struct stat st;
#ifdef HAVE_REALPATH
   char rpath[PATH_MAX], rpath2[PATH_MAX];
#endif

   setlocale(LC_NUMERIC, "C");

   ecore_app_no_system_modules();

   if (!eina_init())
     return -1;

   _edje_cc_log_dom = eina_log_domain_register
     ("edje_cc", EDJE_CC_DEFAULT_LOG_COLOR);
   if (_edje_cc_log_dom < 0)
     {
       EINA_LOG_ERR("Enable to create a log domain.");
       exit(-1);
     }
   if (!eina_log_domain_level_check(_edje_cc_log_dom, EINA_LOG_LEVEL_WARN))
     eina_log_domain_level_set("edje_cc", EINA_LOG_LEVEL_WARN);

   progname = ecore_file_file_get(argv[0]);
   eina_log_print_cb_set(_edje_cc_log_cb, NULL);

   tmp_dir = getenv("TMPDIR");

   img_dirs = eina_list_append(img_dirs, ".");
   
   /* add defines to epp so edc files can detect edje_cc version */
   defines = eina_list_append(defines, mem_strdup("-DEDJE_VERSION_12=12"));

   for (i = 1; i < argc; i++)
     {
	if (!strcmp(argv[i], "-h"))
	  {
	     main_help();
	     exit(0);
	  }
	else if ((!strcmp(argv[i], "-V")) || (!strcmp(argv[i], "--version")))
	  {
	     printf("Version: %s\n", PACKAGE_VERSION);
	     exit(0);
	  }
	else if (!strcmp(argv[i], "-v"))
	  {
	     eina_log_domain_level_set("edje_cc", EINA_LOG_LEVEL_INFO);
	  }
	else if (!strcmp(argv[i], "-no-lossy"))
	  {
	     no_lossy = 1;
	  }
	else if (!strcmp(argv[i], "-no-comp"))
	  {
	     no_comp = 1;
          }
        else if (!strcmp(argv[i], "-no-raw"))
          {
             no_raw = 1;
          }
        else if (!strcmp(argv[i], "-no-etc1"))
          {
             no_etc1 = 1;
          }
        else if (!strcmp(argv[i], "-no-etc2"))
          {
             no_etc2 = 1;
          }
	else if (!strcmp(argv[i], "-no-save"))
	  {
	     no_save = 1;
	  }
	else if ((!strcmp(argv[i], "-id") || !strcmp(argv[i], "--image_dir")) && (i < (argc - 1)))
	  {
	     i++;
	     img_dirs = eina_list_append(img_dirs, argv[i]);
	  }
	else if ((!strcmp(argv[i], "-fd") || !strcmp(argv[i], "--font_dir")) && (i < (argc - 1)))
	  {
	     i++;
	     fnt_dirs = eina_list_append(fnt_dirs, argv[i]);
	  }
        else if ((!strcmp(argv[i], "-sd") || !strcmp(argv[i], "--sound_dir")) && (i < (argc - 1)))
          {
             i++;
             snd_dirs = eina_list_append(snd_dirs, argv[i]);
          }
        else if ((!strcmp(argv[i], "-md") || !strcmp(argv[i], "--mo_dir")) && (i < (argc - 1)))
          {
             i++;
             mo_dirs = eina_list_append(mo_dirs, argv[i]);
          }
        else if ((!strcmp(argv[i], "-vd") || !strcmp(argv[i], "--vibration_dir")) && (i < (argc - 1)))
          {
             i++;
             vibration_dirs = eina_list_append(vibration_dirs, argv[i]);
          }
        else if ((!strcmp(argv[i], "-dd") || !strcmp(argv[i], "--data_dir")) && (i < (argc - 1)))
          {
             i++;
             data_dirs = eina_list_append(data_dirs, argv[i]);
          }
	else if ((!strcmp(argv[i], "-td") || !strcmp(argv[i], "--tmp_dir")) && (i < (argc - 1)))
	  {
	     i++;
             if (!tmp_dir)
               tmp_dir = argv[i];
	  }
        else if ((!strcmp(argv[i], "-l") || !strcmp(argv[i], "--license")) && (i < (argc - 1)))
          {
             i++;
             if (!license)
               license = argv[i];
             else
               licenses = eina_list_append(licenses, argv[i]);
          }
        else if ((!strcmp(argv[i], "-a") || !strcmp(argv[i], "--authors")) && (i < (argc - 1)))
          {
             i++;
             if (!authors)
               authors = argv[i];
          }
	else if ((!strcmp(argv[i], "-min-quality")) && (i < (argc - 1)))
	  {
	     i++;
	     min_quality = atoi(argv[i]);
	     if (min_quality < 0) min_quality = 0;
	     if (min_quality > 100) min_quality = 100;
	  }
	else if ((!strcmp(argv[i], "-max-quality")) && (i < (argc - 1)))
	  {
	     i++;
	     max_quality = atoi(argv[i]);
	     if (max_quality < 0) max_quality = 0;
	     if (max_quality > 100) max_quality = 100;
	  }
	else if (!strcmp(argv[i], "-fastcomp"))
	  {
             compress_mode = EET_COMPRESSION_SUPERFAST;
	  }
	else if (!strcmp(argv[i], "-fastdecomp"))
	  {
             compress_mode = EET_COMPRESSION_VERYFAST;
	  }
	else if (!strcmp(argv[i], "-threads"))
	  {
             threads = 1;
	  }
	else if (!strcmp(argv[i], "-nothreads"))
	  {
             threads = 0;
	  }
	else if (!strncmp(argv[i], "-D", 2))
	  {
	     defines = eina_list_append(defines, mem_strdup(argv[i]));
	  }
	else if ((!strcmp(argv[i], "-o")) && (i < (argc - 1)))
	  {
	     i++;
	     file_out = argv[i];
	  }
	else if ((!strcmp(argv[i], "-w")) && (i < (argc - 1)))
	  {
             i++;
             watchfile = argv[i];
             unlink(watchfile);
	  }
	else if (!strcmp(argv[i], "-annotate"))
	  {
             annotate = 1;
          }
	else if ((!strcmp(argv[i], "-deps")) && (i < (argc - 1)))
	  {
	     i++;
	     depfile = argv[i];
	     unlink(depfile);
	  }
	else if (!file_in)
	  file_in = argv[i];
	else if (!file_out)
	  file_out = argv[i];
     }

   if (!file_in)
     {
	ERR("no input file specified.");
	main_help();
	exit(-1);
     }

   pfx = eina_prefix_new(argv[0],            /* argv[0] value (optional) */
                         main,               /* an optional symbol to check path of */
                         "EDJE",             /* env var prefix to use (XXX_PREFIX, XXX_BIN_DIR etc. */
                         "edje",             /* dir to add after "share" (PREFIX/share/DIRNAME) */
                         "include/edje.inc", /* a magic file to check for in PREFIX/share/DIRNAME for success */
                         PACKAGE_BIN_DIR,    /* package bin dir @ compile time */
                         PACKAGE_LIB_DIR,    /* package lib dir @ compile time */
                         PACKAGE_DATA_DIR,   /* package data dir @ compile time */
                         PACKAGE_DATA_DIR    /* if locale needed  use LOCALE_DIR */
                        );

   /* check whether file_in exists */
#ifdef HAVE_REALPATH
   if (!realpath(file_in, rpath) || stat(rpath, &st) || !S_ISREG(st.st_mode))
#else
   if (stat(file_in, &st) || !S_ISREG(st.st_mode))
#endif
     {
	ERR("file not found: %s.", file_in);
	main_help();
	exit(-1);
     }

   if (!file_out)
      {
         char *suffix;

         if ((suffix = strstr(file_in,".edc")) && (suffix[4] == 0))
            {
               file_out = strdup(file_in);
               if (file_out)
                  {
                     suffix = strstr(file_out,".edc");
                     strcpy(suffix,".edj");
                  }
            }
      }
   if (!file_out)
     {
	ERR("no output file specified.");
	main_help();
	exit(-1);
     }

#ifdef HAVE_REALPATH
   if (realpath(file_out, rpath2) && !strcmp (rpath, rpath2))
#else
   if (!strcmp (file_in, file_out))
#endif
     {
	ERR("input file equals output file.");
	main_help();
	exit(-1);
     }

   using_file(file_in, 'E');
   if (annotate) using_file(file_out, 'O');

   if (!edje_init())
     exit(-1);

   edje_file = mem_alloc(SZ(Edje_File));
   edje_file->compiler = strdup("edje_cc");
   edje_file->version = EDJE_FILE_VERSION;
   edje_file->minor = EDJE_FILE_MINOR;
   edje_file->feature_ver = 1; /* increment this every time we add a field
				* or feature to the edje file format that
				* does not load nicely as a NULL or 0 value
				* and needs a special fallback initialization
				*/
   edje_file->base_scale = FROM_INT(1);

   source_edd();
   source_fetch();

   data_setup();
   compile();
   reorder_parts();
   data_process_scripts();
   data_process_lookups();
   data_process_script_lookups();
   data_write();

   eina_prefix_free(pfx);
   pfx = NULL;
   
   edje_shutdown();
   eina_log_domain_unregister(_edje_cc_log_dom);
   eina_shutdown();

   return 0;
}
Exemplo n.º 20
0
int
main(int argc, char *argv[])
{
   Eina_Bool quit_option = EINA_FALSE;
   char *source = NULL, *header = NULL;
   int arg_index, ret = 0;
   Ecore_Getopt_Value values[] = {
     ECORE_GETOPT_VALUE_STR(prefix),
     ECORE_GETOPT_VALUE_BOOL(quit_option),
     ECORE_GETOPT_VALUE_BOOL(quit_option),
     ECORE_GETOPT_VALUE_BOOL(quit_option),
     ECORE_GETOPT_VALUE_BOOL(quit_option),
     ECORE_GETOPT_VALUE_NONE
   };

   setlocale(LC_NUMERIC, "C");

   eina_init();
   ecore_init();
   ecore_evas_init();
   edje_init();

   if (argc < 2)
     {
        fprintf(stderr, "Missing action. See '--help or -h'.\n");
        ret = 1;
	goto error_log;
     }

   _log_dom = eina_log_domain_register("elementary_codegen", EINA_COLOR_YELLOW);
   if (_log_dom < 0)
     {
        EINA_LOG_CRIT("could not register log domain 'elementary_codegen'");
        ret = 1;
        goto error_log;
     }

   arg_index = ecore_getopt_parse(&optdesc, values, argc, argv);
   if (arg_index < 0)
     {
        ERR("could not parse arguments.");
        ret = 1;
        goto error_getopt;
     }
   else if (quit_option) goto error_getopt;
   else if (arg_index != argc - 4)
     {
        fprintf(stderr, "Incorrect number of parameters. Requires "	\
		"fours arguments, an edje, the group, "			\
		"the source output (foo.c) and the header(foo.h).\n"    \
		"See %s --help\n", argv[0]);
        ret = 1;
        goto error_getopt;
     }

   file = argv[arg_index++];

   // check if the file is accessible
   if (access(file, R_OK) == -1)
     {
        ERR("File '%s' not accessible, error %d (%s).\n",
            file, errno, strerror(errno));
        ret = 1;
        goto error_getopt;
     }

   group = argv[arg_index++];
   source = argv[arg_index++];
   header = argv[arg_index++];

   if (!edje_file_group_exists(file, group))
     {
	ERR("The group %s not exists", group);
	ret = 2;
	goto error_getopt;
     }

   ee = ecore_evas_buffer_new(1, 1);
   if (!ee)
     {
	ERR("could not create ecore_evas_buffer");
	ret = 3;
	goto error_getopt;
     }

   if (!_file_descriptors_open(source, header))
     {
	ERR("Could not create the source files, error %d (%s)",
	    errno, strerror(errno));
	ret = 4;
	goto error_getopt;
     }

   if (!_headers_write(header))
     {
	ERR("Could not write the header, error %d (%s)",
	    errno, strerror(errno));
	ret = 5;
	goto error_getopt;
     }

   if (!_theme_set_write())
     WRN("Theme set getter/setter not created. Group name: %s invalid.", group);

   if (!_parse())
     {
	ERR("Could not parsing the EDJE");
	ret = 6;
	goto error_getopt;
     }

   if (!_footer_write(header))
     {
	ERR("Could not write the footer, error %d (%s)",
	    errno, strerror(errno));
	ret = 7;
	goto error_getopt;
     }

   if (!_file_descriptors_close())
     {
	ERR("Could not close the source files, error %d (%s)",
	    errno, strerror(errno));
	ret = 8;
     }

 error_getopt:
   if (ee)
     ecore_evas_free(ee);

 error_log:
   edje_shutdown();
   ecore_evas_shutdown();
   ecore_shutdown();
   eina_log_domain_unregister(_log_dom);
   eina_shutdown();

   if (ret > 4)
     {
	unlink(header);
	unlink(source);
     }

   return ret;
}
Exemplo n.º 21
0
int
main(int argc, char *argv[])
{
   char         edje_file_path[PATH_MAX];
   const char  *edje_file = "codegen.edj";
   Ecore_Evas  *ee;
   Evas        *evas;
   Evas_Object *bg;
   Evas_Object *edje_obj;
   Evas_Object *red_rect;
   Eina_Prefix *pfx;

   if (!ecore_evas_init())
     return EXIT_FAILURE;

   if (!edje_init())
     goto shutdown_ecore_evas;

   pfx = eina_prefix_new(argv[0], main,
                         "EDJE_EXAMPLES",
                         "edje/examples",
                         edje_file,
                         PACKAGE_BIN_DIR,
                         PACKAGE_LIB_DIR,
                         PACKAGE_DATA_DIR,
                         PACKAGE_DATA_DIR);
   if (!pfx)
     goto shutdown_edje;

   /* this will give you a window with an Evas canvas under the first
    * engine available */
   ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);
   if (!ee)
     goto free_prefix;

   ecore_evas_callback_delete_request_set(ee, _on_delete);
   ecore_evas_title_set(ee, "Edje text Example");

   evas = ecore_evas_get(ee);

   bg = evas_object_rectangle_add(evas);
   evas_object_color_set(bg, 255, 255, 255, 255); /* white bg */
   evas_object_move(bg, 0, 0); /* at canvas' origin */
   evas_object_resize(bg, WIDTH, HEIGHT); /* covers full canvas */
   evas_object_show(bg);
   ecore_evas_object_associate(ee, bg, ECORE_EVAS_OBJECT_ASSOCIATE_BASE);

   edje_obj = codegen_example_object_add(evas, NULL);
   evas_object_move(edje_obj, 20, 20);
   evas_object_resize(edje_obj, WIDTH - 40, HEIGHT - 40);
   evas_object_show(edje_obj);

   codegen_example_part_one_set(edje_obj, "CODEGEN_EXAMPLE");
   codegen_example_part_below_over_callback_add(edje_obj, _on_mouse_over, NULL);

   red_rect = evas_object_rectangle_add(evas);
   evas_object_color_set(red_rect, 255, 0, 0, 255); /* white bg */
   codegen_example_part_two_set(edje_obj, red_rect);
   evas_object_show(red_rect);

   ecore_evas_show(ee);

   ecore_main_loop_begin();

   eina_prefix_free(pfx);
   ecore_evas_free(ee);
   ecore_evas_shutdown();
   edje_shutdown();

   return EXIT_SUCCESS;

 free_prefix:
   eina_prefix_free(pfx);
 shutdown_edje:
   edje_shutdown();
 shutdown_ecore_evas:
   ecore_evas_shutdown();

   return EXIT_FAILURE;
}
Exemplo n.º 22
0
int
main(int argc, char ** argv)
{
    char *display = NULL;
    char *theme = NULL;
    int ret = 1;
    int i;

    if (!ecore_init())
    {
        fprintf(stderr, "Error initing Ecore.\n");
        goto SHUTDOWN;
    }
    ecore_app_args_set(argc, (const char **)argv);
    ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, entangle_cb_exit, NULL);

    for (i = 1; i < argc; i++)
    {
        if ((!strcmp(argv[i], "-display")) || (!strcmp(argv[i], "-d")))
        {
            if (++i < argc)
            {
                IF_FREE(display);
                display = strdup(argv[i]);
            }
            else
            {
                fprintf(stderr, "ERROR: Missing argument to -display\n");
                goto ECORE_SHUTDOWN;
            }
        }
        else if ((!strcmp(argv[i], "-theme")) || (!strcmp(argv[i], "-t")))
        {
            if (++i < argc)
            {
                IF_FREE(theme);
                theme = strdup(argv[i]);
            }
            else
            {
                fprintf(stderr, "ERROR: Missing argument to -theme\n");
                goto ECORE_SHUTDOWN;
            }
        }
        else if ((!strcmp(argv[i], "-help")) || (!strcmp(argv[i], "-h")))
        {
            entangle_usage(argv);
            return 0;
        }
    }

    /* make sure the theme is valid */
    if (theme)
    {
        char *p;
        p = strstr(theme, ".edj");

        if (p && (strlen(theme) - (p - theme) == strlen(".edj")))
        {
            if (!ecore_file_exists(theme))
            {
                char tmp[PATH_MAX];
                snprintf(tmp, PATH_MAX, PACKAGE_DATA_DIR"/data/entangle/%s", theme);
                FREE(theme);

                if (ecore_file_exists(tmp)) theme = strdup(tmp);
            }
        }
        else
        {
            char tmp[PATH_MAX];
            snprintf(tmp, PATH_MAX, PACKAGE_DATA_DIR"/data/entangle/%s.edj", theme);
            FREE(theme);

            if (ecore_file_exists(tmp)) theme = strdup(tmp);
        }
    }
    if (!theme) theme = strdup(PACKAGE_DATA_DIR"/data/entangle/default.edj");

    /* make sure the display is valid */
    if (!display) 
    {
        char *tmp = getenv("DISPLAY");
        if (tmp) display = strdup(tmp);
    }
    if (display)
    {
        char *p;
        char buf[1024];

        p = strrchr(display, ':');
        if (!p)
        {
            snprintf(buf, sizeof(buf), "%s:0.0", display);
            FREE(display);
            display = strdup(buf);
        }
        else
        {
            p = strrchr(p, '.');
            if (!p)
            {
                snprintf(buf, sizeof(buf), "%s.0", display);
                FREE(display);
                display = strdup(buf);
            }
        }
    }
    else
        display = strdup(":0.0");

    if (!ecore_file_init())
    {
        fprintf(stderr, "Error initing Ecore_File.\n");
        goto ECORE_SHUTDOWN;
    }

    if (!ecore_evas_init())
    {
        fprintf(stderr, "Error initing Ecore_Evas.\n");
        goto ECORE_FILE_SHUTDOWN;
    }

    if (!edje_init())
    {
        fprintf(stderr, "Error initing Edje.\n");
        goto ECORE_EVAS_SHUTDOWN;
    }

    if (!eet_init())
    {
        fprintf(stderr, "Error initing Eet.\n");
        goto EDJE_SHUTDOWN;
    }

    if (!entangle_eapps_init())
    {
        fprintf(stderr, "Error initing Entangle_Eapps.\n");
        goto EET_SHUTDOWN;
    }

    if (!entangle_apps_init())
    {
        fprintf(stderr, "Error initing Entangle_Apps.\n");
        goto ENTANGLE_EAPPS_SHUTDOWN;
    }

    if (!entangle_ui_init(display, theme))
    {
        fprintf(stderr, "Error initing Entangle_Ui.\n");
        goto ENTANGLE_APPS_SHUTDOWN;
    }

    ecore_main_loop_begin();
    ret = 0;

    entangle_ui_shutdown();
ENTANGLE_APPS_SHUTDOWN:
    entangle_apps_shutdown();
ENTANGLE_EAPPS_SHUTDOWN:
    entangle_eapps_shutdown();
EET_SHUTDOWN:
    eet_shutdown();
EDJE_SHUTDOWN:
    edje_shutdown();
ECORE_EVAS_SHUTDOWN:
    ecore_evas_shutdown();
ECORE_FILE_SHUTDOWN:
    ecore_file_shutdown();
ECORE_SHUTDOWN:
    ecore_shutdown();
SHUTDOWN:

    IF_FREE(display);
    IF_FREE(theme);
    return ret;
}