Enlightenment CVS committal Author : ningerso Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_embed.c ewl_embed.h Log Message: Allow for overriding the engine to be used for a particular embed. =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_embed.c,v retrieving revision 1.88 retrieving revision 1.89 diff -u -3 -r1.88 -r1.89 --- ewl_embed.c 13 Oct 2006 01:53:05 -0000 1.88 +++ ewl_embed.c 13 Oct 2006 22:02:53 -0000 1.89 @@ -80,14 +80,6 @@ DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET("w", w, FALSE); - w->engine = ewl_engine_new(ewl_config_string_get(ewl_config, - EWL_CONFIG_ENGINE_NAME)); - if (!w->engine) - { - DERROR("Error creating engine ...\n"); - exit(-1); - } - /* * Initialize the fields of the inherited container class */ @@ -96,6 +88,10 @@ ewl_widget_appearance_set(EWL_WIDGET(w), EWL_EMBED_TYPE); ewl_widget_inherit(EWL_WIDGET(w), EWL_EMBED_TYPE); + if (!ewl_embed_engine_name_set(w, ewl_config_string_get(ewl_config, + EWL_CONFIG_ENGINE_NAME))) + exit(-1); + ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE); ewl_object_toplevel_set(EWL_OBJECT(w), EWL_FLAG_PROPERTY_TOPLEVEL); @@ -118,6 +114,59 @@ w->obj_cache = ecore_hash_new(ecore_str_hash, ecore_str_compare); DRETURN_INT(TRUE, DLEVEL_STABLE); +} + +/** + * @param embed: Embed to change engines + * @param engine: Name of the new engine to use for the embed. + * @return Returns TRUE on success, FALSE on failure. + * @brief Changes the current engine on an embed to the specified engine. + */ +int +ewl_embed_engine_name_set(Ewl_Embed *embed, const char *engine) +{ + int realize = FALSE; + + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR_RET("embed", embed, FALSE); + DCHECK_PARAM_PTR_RET("engine", engine, FALSE); + DCHECK_TYPE_RET("embed", embed, EWL_EMBED_TYPE, FALSE); + + if (REALIZED(embed)) { + ewl_widget_unrealize(EWL_WIDGET(embed)); + realize = TRUE; + } + + if (embed->engine_name) + ecore_string_release(embed->engine_name); + embed->engine_name = ecore_string_instance(engine); + + embed->engine = ewl_engine_new(engine); + if (!embed->engine) + { + DERROR("Error creating engine ...\n"); + DRETURN_INT(FALSE, DLEVEL_STABLE); + } + + if (realize) + ewl_widget_realize(EWL_WIDGET(embed)); + + DRETURN_INT(TRUE, DLEVEL_STABLE); +} + +/** + * @param embed: Embed to get engine name + * @return Returns the name of the engine to use for the embed. + * @brief Get the current engine on an embed. + */ +const char * +ewl_embed_engine_name_get(Ewl_Embed *embed) +{ + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR_RET("embed", embed, NULL); + DCHECK_TYPE_RET("embed", embed, EWL_EMBED_TYPE, NULL); + + DRETURN_PTR(embed->engine_name, DLEVEL_STABLE); } /** =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_embed.h,v retrieving revision 1.29 retrieving revision 1.30 diff -u -3 -r1.29 -r1.30 --- ewl_embed.h 30 Sep 2006 18:41:01 -0000 1.29 +++ ewl_embed.h 13 Oct 2006 22:02:53 -0000 1.30 @@ -51,6 +51,7 @@ { Ewl_Overlay overlay; /**< Inherits from the Ewl_Overlay class */ + const char *engine_name; /**< Name of current engine used */ void *engine; /**< The display engine */ Evas *evas; /**< Evas where drawing takes place. */ @@ -83,6 +84,8 @@ Ewl_Widget *ewl_embed_new(void); int ewl_embed_init(Ewl_Embed *emb); +int ewl_embed_engine_name_set(Ewl_Embed *embed, const char *engine); +const char *ewl_embed_engine_name_get(Ewl_Embed *embed); void ewl_embed_shutdown(void); Evas_Object *ewl_embed_evas_set(Ewl_Embed *emb, Evas *evas, Ewl_Embed_Evas_Window *evas_window); ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs