summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRadoslaw Czerski <r.czerski@samsung.com>2016-04-08 16:44:28 +0200
committerRadoslaw Czerski <r.czerski@samsung.com>2016-04-08 16:44:28 +0200
commita654132fb3a96511dfa4f5501f0f0550a5f279f0 (patch)
tree3cca54ec0c8d0379398232e4d24a1030e0670493
parent86a96d732fda8b3f5d41ef1124c8a78da1159b49 (diff)
downloadshare-panel-a654132fb3a96511dfa4f5501f0f0550a5f279f0.tar.gz
share-panel-a654132fb3a96511dfa4f5501f0f0550a5f279f0.tar.bz2
share-panel-a654132fb3a96511dfa4f5501f0f0550a5f279f0.zip
'*/*' set as mime when no mime set.
Fix for TSAM-1712 Change-Id: I40eab4a9e041b513e8ccc8896a680e94f492c07f Signed-off-by: Radoslaw Czerski <r.czerski@samsung.com>
-rw-r--r--inc/log.h10
-rw-r--r--src/list.c21
2 files changed, 31 insertions, 0 deletions
diff --git a/inc/log.h b/inc/log.h
index 8adf903..45c231a 100644
--- a/inc/log.h
+++ b/inc/log.h
@@ -19,6 +19,9 @@
#include <dlog.h>
+#define OK (0)
+#define FAIL (-1)
+
#undef LOG_TAG
#define LOG_TAG "SHARE_PANEL"
@@ -39,6 +42,13 @@
#define _E(fmt, arg...) dlog_print(DLOG_ERROR, LOG_TAG, fmt"\n", ##arg)
#endif
+#define retvm_if(expr, val, fmt, arg...) do { \
+ if(expr) { \
+ _E(fmt, ##arg); \
+ _E("(%s) -> %s() return", #expr, __FUNCTION__); \
+ return val; \
+ } \
+} while (0)
#define retv_if(expr, val) do { \
if(expr) { \
diff --git a/src/list.c b/src/list.c
index d9d5deb..863f4eb 100644
--- a/src/list.c
+++ b/src/list.c
@@ -340,6 +340,25 @@ static void __make_applist(share_panel_h share_panel, Eina_List *matchlist, Eina
}
}
+static int check_mime(app_control_h control, char* operation_type)
+{
+ if (!strcmp(operation_type, APP_CONTROL_OPERATION_SHARE)
+ || !strcmp(operation_type, APP_CONTROL_OPERATION_MULTI_SHARE)) {
+ char *mime;
+ int ret = app_control_get_mime(control, &mime);
+ retvm_if(ret != APP_CONTROL_ERROR_NONE, FAIL, "app_control_get_mime failed[%d]", ret);
+ if (mime == NULL) {
+ ret = app_control_set_mime(control, "*/*");
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ _E("app_control_set_mime failed[%d]", ret);
+ free(mime);
+ return FAIL;
+ }
+ }
+ free(mime);
+ }
+ return OK;
+}
Eina_List *_list_create(share_panel_h share_panel)
{
@@ -354,6 +373,8 @@ Eina_List *_list_create(share_panel_h share_panel)
app_control_get_operation(share_panel->control, &operation_type);
retv_if(!operation_type, NULL);
+ retv_if(check_mime(share_panel->control, operation_type) == FAIL, NULL);
+
__trim_uri(share_panel->control);
if (!strcmp(operation_type, APP_CONTROL_OPERATION_SHARE)