diff options
author | Radoslaw Czerski <r.czerski@samsung.com> | 2016-02-03 10:17:03 +0100 |
---|---|---|
committer | Radoslaw Czerski <r.czerski@samsung.com> | 2016-02-03 10:17:03 +0100 |
commit | 7f30b34f396d0ef4886a22db79f5fc1fc38a9160 (patch) | |
tree | 260cf7dddf838efe235fa79be1504dbcdee488f7 | |
parent | 9cf64236c78ecc8dbaeb83c61ec730a75b311ba2 (diff) | |
download | share-panel-7f30b34f396d0ef4886a22db79f5fc1fc38a9160.tar.gz share-panel-7f30b34f396d0ef4886a22db79f5fc1fc38a9160.tar.bz2 share-panel-7f30b34f396d0ef4886a22db79f5fc1fc38a9160.zip |
Caller app control data passed without bundle.
Internal headers and APIs removed.
Change-Id: If4dc8e72a86d6e217fa26dbd431067cbcf93c798
Signed-off-by: Radoslaw Czerski <r.czerski@samsung.com>
-rw-r--r-- | inc/share_panel_internal.h | 3 | ||||
-rw-r--r-- | src/grid.c | 124 | ||||
-rw-r--r-- | src/list.c | 29 | ||||
-rw-r--r-- | src/share_panel.c | 8 | ||||
-rw-r--r-- | src/ui_manager.c | 3 |
5 files changed, 30 insertions, 137 deletions
diff --git a/inc/share_panel_internal.h b/inc/share_panel_internal.h index 2cd4753..d0fe176 100644 --- a/inc/share_panel_internal.h +++ b/inc/share_panel_internal.h @@ -50,7 +50,6 @@ struct _share_panel { Ecore_Idler *append_idler; Elm_Transit *transit; app_control_h control; - bundle *b; int root_width; int root_height; @@ -65,7 +64,7 @@ typedef struct _share_panel share_panel_s; struct _item { - bundle *b; + app_control_h caller_control; share_panel_s *share_panel; char *appid; @@ -18,7 +18,6 @@ #include <app.h> #include <app_manager.h> #include <app_control.h> -#include <bundle.h> #include "share_panel_internal.h" #include "conf.h" @@ -28,17 +27,6 @@ #define PRIVATE_DATA_KEY_ITEM_INFO "pdkii" -struct _launch_data { - app_control_h app_control; - app_control_h caller_control; - char *uri; - char *operation; - char **data_array; - int data_array_size; -}; - -typedef struct _launch_data launch_data_t; - static struct { Elm_Gengrid_Item_Class *gic; char *default_icon; @@ -136,130 +124,33 @@ static void __del(void *data, Evas_Object *obj) evas_object_data_del(obj, PRIVATE_DATA_KEY_ITEM_INFO); } -static void _app_control_launch_release(launch_data_t launch_data) -{ - int i; - - if(launch_data.app_control) - app_control_destroy(launch_data.app_control); - - if(launch_data.caller_control) - app_control_destroy(launch_data.caller_control); - - free(launch_data.operation); - free(launch_data.uri); - - if (!launch_data.data_array) - return; - - for (i = 0; i < launch_data.data_array_size; i++) - free(launch_data.data_array[i]); -} - -static bool _app_control_error_handle(launch_data_t launch_data, int ret_value, const char *func_name) -{ - if (ret_value != APP_CONTROL_ERROR_NONE) { - _app_control_launch_release(launch_data); - _E("(ret != APP_CONTROL_ERROR_NONE) -> %s() return", func_name); - return true; - } - - return false; -} - -static void __bundle_data_foreach_cb(const char *key, const int type, const bundle_keyval_t *kv, void *user_data) -{ - app_control_h app_control = (app_control_h)user_data; - int ret; - void *val = NULL; - size_t size = 0; - void **array_val = NULL; - unsigned int array_len = 0; - size_t *array_elem_size = NULL; - - if (bundle_keyval_type_is_array((bundle_keyval_t *)kv)) { - ret = bundle_keyval_get_array_val((bundle_keyval_t *)kv, &array_val, &array_len, &array_elem_size); - ret_if(ret != BUNDLE_ERROR_NONE); - - ret = app_control_add_extra_data_array(app_control, key, (const char **)array_val, array_len); - ret_if(ret != APP_CONTROL_ERROR_NONE); - } else { - ret = bundle_keyval_get_basic_val((bundle_keyval_t *)kv, &val, &size); - ret_if(ret != BUNDLE_ERROR_NONE); - - app_control_add_extra_data(app_control, key, (const char *)val); - ret_if(ret != APP_CONTROL_ERROR_NONE); - } -} - int _app_control_launch(item_s *item) { + retv_if(!item->caller_control, APP_CONTROL_ERROR_INVALID_PARAMETER); + int ret = APP_CONTROL_ERROR_NONE; - launch_data_t launch_data = {0,}; - ret = app_control_create(&launch_data.app_control); + ret = app_control_set_app_id(item->caller_control, item->appid); retv_if(ret != APP_CONTROL_ERROR_NONE, ret); - ret = app_control_create(&launch_data.caller_control); - if (_app_control_error_handle(launch_data, ret, "app_control_create")) - return ret; - - bundle_foreach(item->b, __bundle_data_foreach_cb, (void *)launch_data.caller_control); - - ret = app_control_get_operation(launch_data.caller_control, &launch_data.operation); - if (_app_control_error_handle(launch_data, ret, "app_control_get_operation")) - return ret; - - ret = app_control_get_uri(launch_data.caller_control, &launch_data.uri); - if (_app_control_error_handle(launch_data, ret, "app_control_get_uri")) - return ret; - - ret = app_control_get_extra_data_array(launch_data.caller_control, TIZEN_DATA_PATH, &launch_data.data_array, &launch_data.data_array_size); - if (_app_control_error_handle(launch_data, ret, "app_control_get_extra_data_array")) - return ret; - - _D("Operation: %s", launch_data.operation); - - ret = app_control_set_operation(launch_data.app_control, launch_data.operation); - if (_app_control_error_handle(launch_data, ret, "app_control_set_operation")) - return ret; - - ret = app_control_set_uri(launch_data.app_control, launch_data.uri); - if (_app_control_error_handle(launch_data, ret, "app_control_set_uri")) - return ret; - - ret = app_control_add_extra_data_array(launch_data.app_control, TIZEN_DATA_PATH, (const char **)launch_data.data_array, launch_data.data_array_size); - if (_app_control_error_handle(launch_data, ret, "app_control_add_extra_data_array")) - return ret; - - ret = app_control_set_app_id(launch_data.app_control, item->appid); - if (_app_control_error_handle(launch_data, ret, "app_control_set_app_id")) - return ret; - - ret = app_control_set_launch_mode(launch_data.app_control, APP_CONTROL_LAUNCH_MODE_GROUP); - if (_app_control_error_handle(launch_data, ret, "app_control_set_launch_mode")) - return ret; - - ret = app_control_send_launch_request(launch_data.app_control, NULL, NULL); - if (_app_control_error_handle(launch_data, ret, "app_control_send_launch_request")) - return ret; + ret = app_control_send_launch_request(item->caller_control, NULL, NULL); + retv_if(ret != APP_CONTROL_ERROR_NONE, ret); _D("app launched"); - _app_control_launch_release(launch_data); return ret; } static void __item_selected(void *data, Evas_Object *obj, void *event_info) { - item_s *item_info = data; + _D("__item_selected"); + item_s *item_info = (item_s *) data; Elm_Object_Item *selected_item = NULL; int ret = 0; ret_if(!item_info); ret_if(!item_info->appid); - ret_if(!item_info->b); ret_if(!item_info->share_panel); _D("item clicked, launch app : %s", item_info->appid); @@ -267,6 +158,7 @@ static void __item_selected(void *data, Evas_Object *obj, void *event_info) ret_if(!selected_item); elm_gengrid_item_selected_set(selected_item, EINA_FALSE); + ret = _app_control_launch(item_info); if (ret < 0) _E("Fail to launch app(%d)", ret); @@ -17,13 +17,12 @@ #include <Elementary.h> #include <app_control.h> #include <app_manager.h> -#include <glib.h> #include <mime_type.h> -#include <bundle.h> #include "share_panel.h" #include "share_panel_internal.h" #include "log.h" +#include "grid.h" static bool __app_control_matched_cb(app_control_h service, const char *appid, void *user_data) @@ -280,7 +279,7 @@ static void __make_applist(share_panel_h share_panel, Eina_List *matchlist, Eina int ret = 0; ret_if(!share_panel); - ret_if(!share_panel->b); + ret_if(!share_panel->control); EINA_LIST_FOREACH(matchlist, l, data) { item_s *app_s = NULL; @@ -295,8 +294,13 @@ static void __make_applist(share_panel_h share_panel, Eina_List *matchlist, Eina free(app_s); continue; } - app_s->b = share_panel->b; - app_s->share_panel = share_panel; + ret = app_control_clone(&(app_s->caller_control), share_panel->control); + if (ret != APP_CONTROL_ERROR_NONE) { + _E("fail to clone the share_panel->control"); + free(app_s->appid); + free(app_s); + continue; + } ret = app_info_create(data, &app_info); if (ret != APP_MANAGER_ERROR_NONE || !app_info) { @@ -339,14 +343,13 @@ static void __make_applist(share_panel_h share_panel, Eina_List *matchlist, Eina Eina_List *_list_create(share_panel_h share_panel) { - Eina_List *matchlist = NULL; - Eina_List *applist = NULL; + Eina_List *matchlist = NULL; // List of ID's of matched apps + Eina_List *applist = NULL; // List of item_s's of matched apps char *operation_type = NULL; char *data = NULL; retv_if(!share_panel, NULL); retv_if(!share_panel->control, NULL); - retv_if(!share_panel->b, NULL); app_control_get_operation(share_panel->control, &operation_type); retv_if(!operation_type, NULL); @@ -377,7 +380,17 @@ Eina_List *_list_create(share_panel_h share_panel) void _list_destroy(Eina_List *list) { + item_s * item = NULL; ret_if(!list); + EINA_LIST_FREE(list, item) { + ret_if(!item); + _grid_remove_item(NULL, item); + app_control_destroy(item->caller_control); + free(item->appid); + free(item->name); + free(item->icon); + free(item); + } eina_list_free(list); } diff --git a/src/share_panel.c b/src/share_panel.c index 2f8ef93..ac7aa12 100644 --- a/src/share_panel.c +++ b/src/share_panel.c @@ -16,9 +16,6 @@ #include <app.h> #include <app_control.h> -#include <app_control_internal.h> -#include <bundle.h> -#include <bundle_internal.h> #include <Elementary.h> #include <efl_util.h> #include <system_settings.h> @@ -166,8 +163,6 @@ EAPI int share_panel_create(app_control_h control, share_panel_h *share_panel) return SHARE_PANEL_ERROR_NOT_INITIALIZED; } - app_control_export_as_bundle(control, &(panel->b)); - goto_if(!__create_win(panel), ERROR); if (panel->root_width > panel->root_height) { @@ -207,9 +202,6 @@ EAPI int share_panel_destroy(share_panel_h share_panel) { retv_if(!share_panel, SHARE_PANEL_ERROR_INVALID_PARAMETER); - if (share_panel->b) { - bundle_free(share_panel->b); - } _ui_manager_destroy(share_panel->ui_manager); if (share_panel->win) { diff --git a/src/ui_manager.c b/src/ui_manager.c index 993463d..d5b16af 100644 --- a/src/ui_manager.c +++ b/src/ui_manager.c @@ -15,9 +15,6 @@ */ #include <app.h> -#include <app_control_internal.h> -#include <bundle.h> -#include <bundle_internal.h> #include <Elementary.h> #include <notification.h> |