summaryrefslogtreecommitdiff
path: root/tests/ugmyfiletestapp/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ugmyfiletestapp/src/main.c')
-rw-r--r--tests/ugmyfiletestapp/src/main.c170
1 files changed, 76 insertions, 94 deletions
diff --git a/tests/ugmyfiletestapp/src/main.c b/tests/ugmyfiletestapp/src/main.c
index 7067b02..2b6d9bb 100644
--- a/tests/ugmyfiletestapp/src/main.c
+++ b/tests/ugmyfiletestapp/src/main.c
@@ -1,24 +1,24 @@
/*
- * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
#include <app.h>
#include <Elementary.h>
#include <assert.h>
#include <ui-gadget.h>
-#include <utilX.h>
#ifdef UNIT_TESTS
#include "run-tests.h"
@@ -39,30 +39,29 @@ struct _appdata {
static void ug_layout_callback(ui_gadget_h ug, enum ug_mode mode, void *priv)
{
- printf("%s\n",__FUNCTION__);
+ printf("%s\n", __FUNCTION__);
struct _appdata *ad = priv;
Evas_Object *base = (Evas_Object *)ug_get_layout(ug);
Evas_Object *win = ug_get_window();
if (!base) {
- printf("!base -> Call ug_destroy\n");
- ug_destroy(ug);
- return;
+ printf("!base -> Call ug_destroy\n");
+ ug_destroy(ug);
+ return;
}
- switch (mode)
- {
+ switch (mode) {
case UG_MODE_FULLVIEW:
- evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_win_resize_object_add(win, base);
+ evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, base);
evas_object_show(base);
break;
case UG_MODE_FRAMEVIEW:
- evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_object_part_content_set(ad->layout, "custom", base);
+ evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(ad->layout, "custom", base);
break;
default:
- break;
+ break;
}
}
@@ -87,9 +86,8 @@ static void on_click(void *data, Evas_Object *obj, void *event_info)
service_h service;
int ret = service_create(&service);
- if(ret != SERVICE_ERROR_NONE)
- {
- printf("service create failed\n");
+ if (ret != SERVICE_ERROR_NONE) {
+ printf("service create failed\n");
}
service_add_extra_data(service, "path", "/");
@@ -109,14 +107,14 @@ static Evas_Object *_add_win(const char *name)
win = elm_win_util_standard_add(name, "ugmyfiletestapp");
if (!win)
- return NULL;
+ return NULL;
evas_object_show(win);
return win;
}
-static void _add_button(const char* name, Evas_Object* box, struct _appdata *ad)
+static void _add_button(const char *name, Evas_Object *box, struct _appdata *ad)
{
Evas_Object *btn;
btn = elm_button_add(box);
@@ -129,54 +127,43 @@ static void _add_button(const char* name, Evas_Object* box, struct _appdata *ad)
}
-static Eina_Bool callback_hw_key_down( void *data, int type __attribute__((unused)), void *event )
+static Eina_Bool callback_hw_key_down(void *data, int type __attribute__((unused)), void *event)
{
assert(data != NULL);
assert(event != NULL);
- if(data == NULL)
- {
- return ECORE_CALLBACK_DONE;
+ if (data == NULL) {
+ return ECORE_CALLBACK_DONE;
}
- if(event == NULL)
- {
- return ECORE_CALLBACK_DONE;
+ if (event == NULL) {
+ return ECORE_CALLBACK_DONE;
}
struct _appdata *ad = data;
Ecore_Event_Key *key_event = event;
- if (strcmp(key_event->keyname, KEY_BACK) == 0)
- {
- if (ad->ug)
- {
- return ECORE_CALLBACK_PASS_ON;
- }
- else
- {
- elm_exit();
+ if (strcmp(key_event->keyname, "XF86Back") == 0) {
+ if (ad->ug) {
+ return ECORE_CALLBACK_PASS_ON;
+ } else {
+ elm_exit();
}
}
- else if (strcmp(key_event->keyname, KEY_MENU) == 0)
- {
- return ECORE_CALLBACK_DONE;
- }
return ECORE_CALLBACK_DONE;
}
-
static bool _create(void *user_data)
{
char *btn_name[] = { "MULTI_ALL",
- "SINGLE_ALL",
- "MULTI_FILE",
- "SINGLE_FILE",
- "IMPORT",
- "EXPORT",
- "SHORTCUT",
- "SAVE"
- };
+ "SINGLE_ALL",
+ "MULTI_FILE",
+ "SINGLE_FILE",
+ "IMPORT",
+ "EXPORT",
+ "SHORTCUT",
+ "SAVE"
+ };
struct _appdata *ad;
Evas_Object *win;
@@ -185,13 +172,13 @@ static bool _create(void *user_data)
Evas_Object *layout;
if (!user_data)
- return false;
+ return false;
ad = user_data;
win = _add_win(ad->name);
if (!win)
- return false;
+ return false;
layout = elm_layout_add(win);
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, layout);
@@ -199,16 +186,15 @@ static bool _create(void *user_data)
evas_object_show(layout);
const char *title = elm_layout_data_get(layout, "title");
- if (title)
- {
- elm_win_title_set(win, title);
- elm_object_part_text_set(layout, "title", title);
+ if (title) {
+ elm_win_title_set(win, title);
+ elm_object_part_text_set(layout, "title", title);
}
bx = elm_box_add(win);
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
- //elm_win_resize_object_add(win, bx);
+ /*elm_win_resize_object_add(win, bx);*/
elm_box_horizontal_set(bx, EINA_FALSE);
elm_object_part_content_set(layout, "custom", bx);
evas_object_show(bx);
@@ -218,15 +204,14 @@ static bool _create(void *user_data)
int i = 0;
int len = sizeof(btn_name)/sizeof(btn_name[0]);
- for ( ;i < len; ++i)
- {
- /* code */
- _add_button(btn_name[i], bx, ad);
+ for ( ; i < len; ++i) {
+ /* code */
+ _add_button(btn_name[i], bx, ad);
}
elm_object_part_content_set(layout, "custom", bx);
- ad->key_event_handler = ecore_event_handler_add( ECORE_EVENT_KEY_DOWN, callback_hw_key_down, ad );
+ ad->key_event_handler = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, callback_hw_key_down, ad);
UG_INIT_EFL(win, UG_OPT_INDICATOR_ENABLE);
ad->win = win;
@@ -239,22 +224,21 @@ static void _terminate(void *user_data)
struct _appdata *ad;
if (!user_data)
- return;
+ return;
ad = user_data;
if (ad->win)
- evas_object_del(ad->win);
- if (ad->key_event_handler)
- {
- ecore_event_handler_del(ad->key_event_handler);
+ evas_object_del(ad->win);
+ if (ad->key_event_handler) {
+ ecore_event_handler_del(ad->key_event_handler);
}
}
static void _pause(void *user_data)
{
- if (!user_data)
- return;
+ if (!user_data)
+ return;
}
static void _resume(void *user_data)
@@ -274,7 +258,7 @@ static void _low_battery(void *user_data)
}
static void _dev_orientation_changed(app_device_orientation_e orientation,
- void *user_data)
+ void *user_data)
{
}
@@ -290,30 +274,28 @@ void _init_and_run(int argc, char **argv)
{
struct _appdata ad;
app_event_callback_s cbs = {
- .create = _create,
- .terminate = _terminate,
- .pause = _pause,
- .resume = _resume,
- .service = _service,
- .low_memory = _low_memory,
- .low_battery = _low_battery,
- .device_orientation = _dev_orientation_changed,
- .language_changed = _lang_changed,
- .region_format_changed = _region_fmt_changed,
+ .create = _create,
+ .terminate = _terminate,
+ .pause = _pause,
+ .resume = _resume,
+ .service = _service,
+ .low_memory = _low_memory,
+ .low_battery = _low_battery,
+ .device_orientation = _dev_orientation_changed,
+ .language_changed = _lang_changed,
+ .region_format_changed = _region_fmt_changed,
};
memset(&ad, 0x00, sizeof(ad));
- ad.name= "testug";
+ ad.name = "testug";
app_efl_main(&argc, &argv, &cbs, &ad);
-
}
int main(int argc, char **argv)
{
-
#ifdef UNIT_TESTS
- return run_tests( argc, argv );
+ return run_tests(argc, argv);
#endif /* UNIT_TESTS */
_init_and_run(argc, argv);