summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorSemun Lee <sm79.lee@samsung.com>2014-02-25 20:06:26 +0900
committerSemun Lee <sm79.lee@samsung.com>2014-02-25 20:06:26 +0900
commit92210284ef62357b7a08fbd973d291ee1afe04ec (patch)
treee219cc5a2c18ba8914b427df1f0660cfc264f36e /client
parentf0e0a08562a88cac22640384e1f8cadbec9f4ce1 (diff)
parentc7bb89ae628988e1555a950c8b478c9de85ef2c6 (diff)
downloadui-gadget-1-92210284ef62357b7a08fbd973d291ee1afe04ec.tar.gz
ui-gadget-1-92210284ef62357b7a08fbd973d291ee1afe04ec.tar.bz2
ui-gadget-1-92210284ef62357b7a08fbd973d291ee1afe04ec.zip
Merge branches 'HEAD' and 'tizen_2.2' into tizen
Conflicts: CMakeLists.txt client/CMakeLists.txt client/ug-client.c include/ui-gadget.h packaging/ui-gadget-1.spec src/manager.c ui-gadget-1.manifest
Diffstat (limited to 'client')
-rw-r--r--client/CMakeLists.txt2
-rw-r--r--client/ug-client.c108
-rwxr-xr-xclient/ug-client.h2
3 files changed, 97 insertions, 15 deletions
diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt
index 875d87f..3bb2d21 100644
--- a/client/CMakeLists.txt
+++ b/client/CMakeLists.txt
@@ -7,7 +7,7 @@ SET(CLIENT_LOCALEDIR /usr/share/locale)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE(FindPkgConfig)
-SET(CLIENT_PKGS_CHECK_MODULES "capi-appfw-application capi-system-runtime-info appcore-efl appsvc bundle edje dlog elementary evas")
+SET(CLIENT_PKGS_CHECK_MODULES "capi-appfw-application capi-system-runtime-info appcore-efl appsvc bundle edje dlog elementary evas vconf")
IF (with_x)
PKG_CHECK_MODULES(CLIENT_PKGS REQUIRED ${CLIENT_PKGS_CHECK_MODULES} ecore-x x11)
diff --git a/client/ug-client.c b/client/ug-client.c
index ecaf16b..0c79d1e 100644
--- a/client/ug-client.c
+++ b/client/ug-client.c
@@ -29,9 +29,8 @@
#include <dlog.h>
#include <aul.h>
-#include <appsvc.h>
#include <app.h>
-#include <runtime_info.h>
+#include <vconf.h>
#include "ug-client.h"
@@ -151,26 +150,61 @@ void _ug_client_layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv)
}
}
-void _ug_client_result_cb(ui_gadget_h ug, service_h result, void *priv)
+void _ug_client_result_cb(ui_gadget_h ug, service_h reply, void *priv)
{
- struct appdata *ad;
+ struct appdata *ad = NULL;
int ret;
+ char* value = NULL;
+ int result;
if (!ug || !priv)
return;
+
+ ret = service_get_extra_data (reply, UG_SERVICE_DATA_RESULT, &value);
+ if((ret == SERVICE_ERROR_NONE) && (value)) {
+ result = atoi(value);
+ LOGD("reply result is %d", result);
+ } else {
+ LOGW("get reply result error(%d) . result will be SERVICE_RESULT_SUCCEEDED", ret);
+ result = SERVICE_RESULT_SUCCEEDED;
+ }
+
ad = priv;
+ if (!ad) {
+ LOGE("appdata is null");
+ return;
+ }
- ret = service_reply_to_launch_request(result, ad->request, SERVICE_RESULT_SUCCEEDED);
+ ret = service_reply_to_launch_request(reply, ad->request, (service_result_e)result);
if (ret != SERVICE_ERROR_NONE)
LOGE("service_reply_to_launch_request failed, %d", ret);
}
void _ug_client_destroy_cb(ui_gadget_h ug, void *priv)
{
+ struct appdata *ad = NULL;
+
if (!ug)
return;
- ug_destroy(ug);
+ ad = priv;
+ if (!ad) {
+ LOGE("appdata is null. win lower is fail");
+ } else {
+ LOGD("window lower");
+ elm_win_lower(ad->win);
+ }
+
+ elm_exit();
+}
+
+void _ug_client_end_cb(ui_gadget_h ug, void *priv)
+{
+ if (!ug)
+ return;
+
+ LOGD("_ug_client_end_cb invoked");
+
elm_exit();
}
@@ -181,7 +215,7 @@ static void profile_changed_cb(void *data, Evas_Object * obj, void *event)
LOGE("!!! profile_changed_cb(%s) !!!", profile);
if (strcmp(profile, "desktop") == 0)
- elm_win_indicator_mode_set (obj, ELM_WIN_INDICATOR_HIDE);
+ elm_win_indicator_mode_set(obj, ELM_WIN_INDICATOR_HIDE);
}
static Evas_Object *create_win(const char *name)
@@ -201,6 +235,8 @@ static Evas_Object *create_win(const char *name)
ee = ecore_evas_ecore_evas_get(evas_object_evas_get(eo));
evas_output_size_get(ee, &w, &h);
evas_object_resize(eo, w, h);
+
+ elm_win_indicator_mode_set(eo,ELM_WIN_INDICATOR_SHOW);
}
return eo;
@@ -237,13 +273,43 @@ static int low_battery(void *data)
static int lang_changed(void *data)
{
+ char* lang = NULL;
+
+ lang = vconf_get_str(VCONFKEY_LANGSET);
+ if(lang) {
+ LOGD("lang : %s", lang);
+ elm_language_set((const char*)lang);
+ free(lang);
+ } else {
+ LOGW("language get error");
+ }
+
return ug_send_event(UG_EVENT_LANG_CHANGE);
}
+static int region_changed(void *data)
+{
+ return ug_send_event(UG_EVENT_REGION_CHANGE);
+}
+
+static void _home_screen_top_cb(keynode_t* node, void *data)
+{
+ struct appdata *ad = data;
+
+ if (!node) {
+ LOGE("home screen top cb node value is null");
+ return;
+ }
+
+ if ((node->value.i == VCONFKEY_IDLE_SCREEN_TOP_TRUE) && (!ad->is_transient)) {
+ LOGW("home key pressed. window is not transient. ug client will be terminated");
+ elm_exit();
+ }
+}
+
static int app_create(void *data)
{
struct appdata *ad = data;
- enum appcore_rm rm;
Evas_Object *win;
Evas_Object *ly;
Evas_Object *conform;
@@ -279,7 +345,6 @@ static int app_create(void *data)
edje_object_signal_callback_add(elm_layout_edje_get(ly),
"EXIT", "*", main_quit_cb, NULL);
ad->ly_main = ly;
- elm_win_indicator_mode_set(win, ELM_WIN_INDICATOR_SHOW);
lang_changed(ad);
/* rotate notice */
@@ -305,6 +370,7 @@ static int app_create(void *data)
appcore_set_event_callback(APPCORE_EVENT_LOW_MEMORY, low_memory, ad);
appcore_set_event_callback(APPCORE_EVENT_LOW_BATTERY, low_battery, ad);
appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE, lang_changed, ad);
+ appcore_set_event_callback(APPCORE_EVENT_REGION_CHANGE, region_changed, ad);
return 0;
}
@@ -329,6 +395,14 @@ static int app_terminate(void *data)
ad->win = NULL;
}
+ service_destroy(ad->request);
+
+ if (ad->name) {
+ free(ad->name);
+ }
+
+ LOGD("app_terminate end");
+
return 0;
}
@@ -339,10 +413,14 @@ static int app_pause(void *data)
LOGD("app_pause called");
ug_pause();
+
+#if ENABLE_TRANSIENT_SUB_MODE
if (!ad->is_transient) {
LOGD("app_pause received. close ug service");
elm_exit();
}
+#endif
+
return 0;
}
@@ -369,10 +447,15 @@ static int app_reset(bundle *b, void *data)
ret = appsvc_request_transient_app(b, id2, svc_cb, "svc test");
- if (ret)
+ if (ret) {
LOGD("fail to request transient app: return value(%d)", ret);
- else
+ if(vconf_notify_key_changed(VCONFKEY_IDLE_SCREEN_TOP, _home_screen_top_cb, ad) != 0) {
+ LOGW("home screen vconf key changed cb error");
+ }
+ } else {
+ /* check home screen raise */
ad->is_transient = 1;
+ }
if (ad->win) {
elm_win_activate(ad->win);
@@ -392,6 +475,7 @@ static int app_reset(bundle *b, void *data)
cbs.layout_cb = _ug_client_layout_cb;
cbs.destroy_cb = _ug_client_destroy_cb;
cbs.result_cb = _ug_client_result_cb;
+ cbs.end_cb = _ug_client_end_cb;
cbs.priv = ad;
mode = ad->is_frameview ? UG_MODE_FRAMEVIEW : UG_MODE_FULLVIEW;
@@ -414,8 +498,6 @@ static int update_argument(const char *optarg, struct appdata *ad)
return -1;
val = optarg + strlen(key) + 1;
- if (!val)
- return -1;
if (!ad->data)
ad->data = bundle_create();
diff --git a/client/ug-client.h b/client/ug-client.h
index af62743..ab6ee0c 100755
--- a/client/ug-client.h
+++ b/client/ug-client.h
@@ -48,7 +48,7 @@ struct appdata {
Evas_Object *conform;
ui_gadget_h ug;
- const char *name;
+ char *name;
int is_frameview;
int is_transient;