Exemplo n.º 1
0
/**
 * @return Returns no value
 * @brief Called when the icon theme is changed so we can clean up any
 * caching we have in place
 */
void
ewl_icon_theme_theme_change(void)
{
        const char *icon_theme;

        DENTER_FUNCTION(DLEVEL_STABLE);

        icon_theme = ewl_config_string_get(ewl_config, EWL_CONFIG_THEME_ICON_THEME);

        /* check if this is an edje theme */
        if (icon_theme && (!strncasecmp(icon_theme + (strlen(icon_theme) - 4),
                                              ".edj", 4)))
                ewl_icon_theme_is_edje = 1;
        else
                ewl_icon_theme_is_edje = 0;

        /* destroy the cache and re-create it */
        IF_FREE_HASH(ewl_icon_theme_cache);

        ewl_icon_theme_cache = ecore_hash_new(ecore_str_hash, ecore_str_compare);
        ecore_hash_free_key_cb_set(ewl_icon_theme_cache, ewl_icon_theme_cb_free);
        ecore_hash_free_value_cb_set(ewl_icon_theme_cache, free);

        DLEAVE_FUNCTION(DLEVEL_STABLE);
}
Exemplo n.º 2
0
/**
 * Initialize an xml document structure to some sane starting values.
 * @param   xml The xml to initialize.
 * @return  @c TRUE if successful, @c FALSE if an error occurs.
 * @ingroup EXML_Creation_Group
 */
int exml_init(EXML *xml)
{
	CHECK_PARAM_POINTER_RETURN("xml", xml, FALSE);

	xml->buffers = ecore_hash_new(ecore_direct_hash, ecore_direct_compare);
	ecore_hash_free_value_cb_set(xml->buffers, ECORE_FREE_CB(xmlBufferFree));

	return TRUE;
}
Exemplo n.º 3
0
/**
 * @return Returns TRUE on success or FALSE on failure
 * @brief Initializes the icon theme system
 */
int
ewl_icon_theme_init(void)
{
        DENTER_FUNCTION(DLEVEL_STABLE);

        if (!ewl_icon_theme_cache)
        {
                ewl_icon_theme_cache = ecore_hash_new(ecore_str_hash, ecore_str_compare);
                ecore_hash_free_key_cb_set(ewl_icon_theme_cache, ewl_icon_theme_cb_free);
                ecore_hash_free_value_cb_set(ewl_icon_theme_cache, free);

                ewl_icon_fallback_theme_cache = ecore_hash_new(
                                                ecore_str_hash, ecore_str_compare);
                ecore_hash_free_key_cb_set(ewl_icon_fallback_theme_cache,
                                                ewl_icon_theme_cb_free);
                ecore_hash_free_value_cb_set(ewl_icon_fallback_theme_cache,
                                                free);
        }

        DRETURN_INT(TRUE, DLEVEL_STABLE);
}
Exemplo n.º 4
0
/**
 * Initialize an XML_Node to starting values
 * @param   node The node to initialize
 * @return  @c TRUE if successful, @c FALSE if an error occurs.
 * @ingroup EXML_Creation_Group
 */
int exml_node_init(EXML_Node *node)
{
	CHECK_PARAM_POINTER_RETURN("node", node, FALSE);

	node->attributes = ecore_hash_new( ecore_str_hash, ecore_str_compare );
	ecore_hash_free_value_cb_set( node->attributes, free );
	ecore_hash_free_key_cb_set( node->attributes, free );
	node->children = ecore_list_new();
	ecore_list_free_cb_set( node->children, _exml_node_destroy );

	return TRUE;
}
Exemplo n.º 5
0
/**
 * @internal
 * @return Returns TRUE on success or FALSE on failure
 * @brief Initializes the context system
 */
int
ewl_text_context_init(void)
{
        DENTER_FUNCTION(DLEVEL_STABLE);

        if (!context_hash)
        {
                context_hash = ecore_hash_new(ewl_text_context_hash_key,
                                ewl_text_context_hash_cmp);
                ecore_hash_free_value_cb_set(context_hash,
                                                ewl_text_context_cb_free);
        }

        DRETURN_INT(TRUE, DLEVEL_STABLE);
}
Exemplo n.º 6
0
void eli_highscore_shutdown(void)
{
    /* free the data */
    ecore_hash_free_value_cb_set(hiscore_hash, 
		                      ECORE_FREE_CB(_eli_highscore_list_free));
    ecore_hash_destroy(hiscore_hash);
    eet_data_descriptor_free(edd_hiscore);
    eet_data_descriptor_free(edd_entry);
    free(eet_file_name);

    /* and the set the pointer to null */
    hiscore_hash = NULL;
    edd_hiscore = NULL;
    edd_entry = NULL;
    eet_file_name = NULL;

    eet_shutdown();
}
Exemplo n.º 7
0
/**
 * Initialize the ecore string internal structure.
 * @return  Zero on failure, non-zero on successful initialization.
 */
EAPI int
ecore_string_init()
{
   /*
    * No strings have been loaded at this point, so create the hash
    * table for storing string info for later.
    */
   if (!ecore_string_init_count)
     {
        ecore_strings = ecore_hash_new(ecore_str_hash, ecore_str_compare);
        if (!ecore_strings)
           return 0;

        ecore_hash_free_value_cb_set(ecore_strings, ecore_string_free_cb);
     }

   ecore_string_init_count++;

   return 1;
}
Exemplo n.º 8
0
static void
eina_bench_lookup_ecore(int request)
{
   Ecore_Hash *hash = NULL;
   Eina_Bench_Ecore *elm;
   unsigned int i;
   unsigned int j;

   hash = ecore_hash_new(ecore_str_hash, ecore_str_compare);

   ecore_hash_free_key_cb_set(hash, NULL);
   ecore_hash_free_value_cb_set(hash, free);

   for (i = 0; i < (unsigned int)request; ++i)
     {
        elm = malloc(sizeof (Eina_Bench_Ecore) + 10);
        if (!elm)
           continue;

        elm->key = (char *)(elm + 1);
        eina_convert_itoa(i, elm->key);
        elm->value = i;

        ecore_hash_set(hash, elm->key, elm);
     }

   srand(time(NULL));

   for (j = 0; j < 200; ++j)
      for (i = 0; i < (unsigned int)request; ++i)
        {
           char tmp_key[10];

           eina_convert_itoa(rand() % request, tmp_key);

           elm = ecore_hash_get(hash, tmp_key);
        }

   ecore_hash_destroy(hash);
}
Exemplo n.º 9
0
/**
 * @return Returns TRUE on successful initialization, FALSE otherwise
 * @brief Initializes the IO manager system.
 */
int
ewl_io_manager_init(void)
{
        DENTER_FUNCTION(DLEVEL_STABLE);

        if (!ewl_io_manager_ext_icon_map)
        {
                /* XXX this is a dumb way to do this.... */
                ewl_io_manager_ext_icon_map = ecore_hash_new(ecore_str_hash,
                                                ewl_io_manager_strcasecompare);
                /* Images */
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".png",
                                                EWL_ICON_IMAGE_X_GENERIC);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".jpg",
                                                EWL_ICON_IMAGE_X_GENERIC);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".gif",
                                                EWL_ICON_IMAGE_X_GENERIC);

                /* Videos */
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".wmv",
                                                EWL_ICON_VIDEO_X_GENERIC);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".mpg",
                                                EWL_ICON_VIDEO_X_GENERIC);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".mpeg",
                                                EWL_ICON_VIDEO_X_GENERIC);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".avi",
                                                EWL_ICON_VIDEO_X_GENERIC);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".mov",
                                                EWL_ICON_VIDEO_X_GENERIC);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".asf",
                                                EWL_ICON_VIDEO_X_GENERIC);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".mp4",
                                                EWL_ICON_VIDEO_X_GENERIC);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".mkv",
                                                EWL_ICON_VIDEO_X_GENERIC);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".ogm",
                                                EWL_ICON_VIDEO_X_GENERIC);

                /* Audio */
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".mp3",
                                                EWL_ICON_AUDIO_X_GENERIC);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".mka",
                                                EWL_ICON_AUDIO_X_GENERIC);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".ogg",
                                                EWL_ICON_AUDIO_X_GENERIC);

                /* HTML */
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".html",
                                                EWL_ICON_TEXT_HTML);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".htm",
                                                EWL_ICON_TEXT_HTML);

                /* Scirpts */
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".pl",
                                                EWL_ICON_TEXT_X_SCRIPT);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".sh",
                                                EWL_ICON_TEXT_X_SCRIPT);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".ksh",
                                                EWL_ICON_TEXT_X_SCRIPT);

                ewl_io_manager_plugins = ecore_hash_new(ecore_str_hash,
                                                        ecore_str_compare);
                ecore_hash_free_key_cb_set(ewl_io_manager_plugins, free);
                ecore_hash_free_value_cb_set(ewl_io_manager_plugins,
                                                ewl_io_manager_cb_free_plugin);
        }

        DRETURN_INT(TRUE, DLEVEL_STABLE);
}
Exemplo n.º 10
0
/**
 * initialize this project manager.  called from main
 */
int
projects_init( char *filename )
{
	Ewl_Widget *vbox, *menu, *project_menu, *settings_menu, *windows_menu, *item;

	/* ui phase... kick on some phat window action */
	project_win = ewl_window_new();
	ewl_window_title_set(EWL_WINDOW(project_win), "Ewler");
	ewl_object_size_request(EWL_OBJECT(project_win), 200, 320);
	ewl_callback_append(project_win, EWL_CALLBACK_DELETE_WINDOW,
											project_exit, NULL);
	ewl_callback_append(project_win, EWL_CALLBACK_KEY_DOWN,
											project_key_down, NULL);

	vbox = ewl_vbox_new();
	ewl_container_child_append(EWL_CONTAINER(project_win), vbox);

	menu = ewl_hmenubar_new();
	ewl_container_child_append(EWL_CONTAINER(vbox), menu);

	project_menu = ewl_menubar_menu_add(EWL_MENUBAR(menu), NULL, "Project");

	item = ewl_menu_item_new(NULL, "New");
	ewl_container_child_append(EWL_CONTAINER(project_menu), item);
	ewl_widget_show(item);

	item = ewl_menu_item_new(NULL, "New Form");
	ewl_container_child_append(EWL_CONTAINER(project_menu), item);
	ewl_callback_append(item, EWL_CALLBACK_CLICKED, form_new, NULL);
	ewl_widget_show(item);

	item = ewl_menu_item_new(NULL, "Open...");
	ewl_container_child_append(EWL_CONTAINER(project_menu), item);
	ewl_callback_append(item, EWL_CALLBACK_CLICKED, open, NULL);
	ewl_widget_show(item);

	item = ewl_menu_separator_new();
	ewl_container_child_append(EWL_CONTAINER(project_menu), item);
	ewl_widget_show(item);

	item = ewl_menu_item_new(NULL, "Save");
	ewl_callback_append(item, EWL_CALLBACK_CLICKED, save, NULL);
	ewl_container_child_append(EWL_CONTAINER(project_menu), item);
	ewl_widget_show(item);

	item = ewl_menu_separator_new();
	ewl_container_child_append(EWL_CONTAINER(project_menu), item);
	ewl_widget_show(item);

	item = ewl_menu_item_new(NULL, "Exit");
	ewl_callback_append(item, EWL_CALLBACK_CLICKED,
											project_exit, NULL);
	ewl_container_child_append(EWL_CONTAINER(project_menu), item);
	ewl_widget_show(item);

	ewl_widget_show(project_menu);

	settings_menu = ewl_menubar_menu_add(EWL_MENUBAR(menu), NULL, "Settings");

	item = ewl_menu_item_new(NULL, "Options...");
	ewl_container_child_append(EWL_CONTAINER(settings_menu), item);
	ewl_callback_append(item, EWL_CALLBACK_CLICKED,
											options, NULL);
	ewl_widget_show(item);

	ewl_widget_show(settings_menu);

	windows_menu = ewl_menubar_menu_add(EWL_MENUBAR(menu), NULL, "Windows");

	item = ewl_menu_item_new(NULL, "Toolbar");
	ewl_container_child_append(EWL_CONTAINER(windows_menu), item);
	ewl_callback_append(item, EWL_CALLBACK_CLICKED, tools_toggle, NULL);
	ewl_widget_show(item);

	item = ewl_menu_item_new(NULL, "Inspector");
	ewl_container_child_append(EWL_CONTAINER(windows_menu), item);
	ewl_callback_append(item, EWL_CALLBACK_CLICKED, inspector_toggle, NULL);
	ewl_widget_show(item);

	item = ewl_menu_item_new(NULL, "Callbacks");
	ewl_container_child_append(EWL_CONTAINER(windows_menu), item);
	ewl_callback_append(item, EWL_CALLBACK_CLICKED, callbacks_toggle, NULL);
	ewl_widget_show(item);

	ewl_widget_show(windows_menu);

	ewl_widget_show(menu);

	file_tree = ewl_tree_new(1);
	ewl_tree_mode_set(EWL_TREE(file_tree), EWL_TREE_MODE_SINGLE);
	ewl_container_child_append(EWL_CONTAINER(vbox), file_tree);
	ewl_widget_show(file_tree);

	ewl_widget_show(vbox);
	ewl_widget_show(project_win);
	/* end ui phase */

	/* project phase */
	active_project = NEW(Ewler_Project);
	if( !active_project ) {
		ewler_error("projects_init: out of memory!");
		return -1;
	}
	active_project->files = ecore_hash_new(ecore_str_hash, ecore_str_compare);
	ecore_hash_free_key_cb_set(active_project->files, free);
	ecore_hash_free_value_cb_set(active_project->files, free);

	if( !filename || project_open(filename) < 0 ) {
		project_new();
	}
	/* end project phase */

	return 0;
}