Languages

Menu
Sites
Language
opposite functional of elm_layout_file_set
I am writing a Tizen naitive app, I've set a layout group by call elm_layout_file_set, as below code: ... app_get_resource(EDJ_FILE, edj_path, (int)PATH_MAX); layout = elm_layout_add(ad->conform); elm_layout_file_set(layout, edj_path, GRP_LOADING_PAGE); evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(layout); elm_object_content_set(ad->conform, layout); At the same time, I want to new a thread, and in the thread callback function I want to remove the previous added layout group and then add a new layout group. I am go though of the header file elm_layout.h, try to find a reverse function(function name possible like elm_layout_file_unset), but failed, there's no such function. Anyone know is there such function in EFL?

Responses

6 Replies
Sanjeev BA

A few things that could help you.

1. EFL is not thread safe. It is based on the concept of mainloops and event handlers. Avoid threads in your design.

2. If you must use threads, use Ecore_Thread API, which gives you all the features of threads but handles all the tasks needed to synchronize threads and marshalling results back to main loop without contention, so you can focus on application logic.

3. Reading the description, are you trying to change the layout file and/or group? Calling elm_layout_file_set() with the new parameters ? Why do you need a thread to do it? With more details about what you are trying to do, I can help.

 


 

colin Rao

Hi,

I want to write a demo app. When tap on it from the home screen, the first page showing text "loading..." and on the background I start a new thread to do some logic checking, example checking whether a user login, if no then redirect to the login page.  As below code:

static void
is_login_end_func(void *data, Ecore_Thread *thread)
{
    appdata_s *ad = data;
    dlog_print(DLOG_INFO, LOG_TAG, "Is login? %s", ad->isLogin?"Yes":"No");

	elm_object_content_unset(ad->layout);
    evas_object_show(ad->layout);
    evas_object_show(ad->win);

	if(ad->isLogin) {
		/* go to message page */
        dlog_print(DLOG_INFO, LOG_TAG, "Redirect to message page");

	} else {
		/* go to login page */
        dlog_print(DLOG_INFO, LOG_TAG, "Redirect to login page");
	}
}

 In the thread callbacke function, I am trying to unset the "Loading..." page conent by call elm_object_content_unset(ad->layout), seems it's not working. Did you know what's the problem? Thanks!

 

 

colin Rao

Hi,

I can remove the previous layout by add a new blank layout to its parent. As the code:

    ad->layout = elm_layout_add(ad->conform);
	evas_object_show(ad->layout);
	elm_object_content_set(ad->conform, ad->layout);

Is there a memory leak for this manner? Because of I am not explicit to destroy the previous layout widget.

Sanjeev BA

No, there won't be a leak.

Refer to elm_shutdown() API.

This should be called at the end of your application, just before it ceases to do any more processing. This cleans up any permanent resources that your application may have allocated via Elementary that would otherwise persist.

colin Rao

Hi, 

Many thanks!

Is it right? If I call the function elm_shutdown() in the terminate callback function.

static void
app_terminate(void *data)
{
    /* Release all resources. */
	dlog_print(DLOG_INFO, LOG_TAG, "app terminated!");
	elm_shutdown();
}

Or, call it at the end of the main function.

Sanjeev BA

It is called as part of app framework API for UI apps, i.e. before ui_app_main() returns. No need to call it explicitly.