tv-service
ecore-wayland
ui-gadget-1
+ bundle
capi-web-history
capi-appfw-application)
#include <Eina.h>
#include <stdbool.h>
+#include <bundle.h>
enum datamgr_item_select_action {
ITEM_SELECT_ACTION_LAUNCH,
char *icon;
char *focus_icon;
char *parameter;
- char *key;
- char *value;
bool noti;
enum datamgr_item_select_action action;
int type;
time_t time;
struct thumbnail_data *thumbnail;
+ bundle *b;
};
struct data_class {
#define FORMAT_PNG "png"
+#define BUNDLE_APP_KEY "app_key"
+#define BUNDLE_APP_VALUE "app_value"
+#define BUNDLE_URI "uri"
+
#endif /* __AIR_HOME_DEFS_H__ */
#include <stdbool.h>
#include <Evas.h>
+#include <bundle.h>
struct icon_info {
const char *icon_file;
Evas_Object *utils_add_popup(Evas_Object *base, char *title, char *message);
Evas_Object *utils_add_rectangle(Evas_Object *base, int r, int g, int b, int a);
Evas_Object *utils_add_toast(Evas_Object *base, char *message);
-bool utils_launch_app(const char *pkg, const char *key, const char *value);
+bundle *utils_add_bundle(char *key, char *value, char *uri);
+bool utils_launch_app(const char *pkg, bundle *b);
int utils_get_notification_count(void);
#endif /* __AIR_HOME_UTILS_H__ */
BuildRequires: pkgconfig(ecore-wayland)
BuildRequires: pkgconfig(ui-gadget-1)
BuildRequires: pkgconfig(capi-web-history)
+BuildRequires: pkgconfig(bundle)
BuildRequires: edje-bin
BuildRequires: gettext-devel
r = ITEM_SELECT_ERROR_INVALID_OPERATION;
switch (di->action) {
case ITEM_SELECT_ACTION_LAUNCH:
- if (utils_launch_app(di->parameter, NULL, NULL))
+ if (utils_launch_app(di->parameter, NULL))
r = ITEM_SELECT_ERROR_NONE;
break;
case ITEM_SELECT_ACTION_PUSH:
#include <web/web_history.h>
#include <time.h>
#include <ctype.h>
+#include <bundle.h>
#include "data_recent.h"
#include "datamgr.h"
#define MAX_BUF 64
static struct datamgr_item *_new_datamgr_item(char *title, char *subtitle,
- char *parameter, char *key, char *value, char *icon, int type,
- time_t time)
+ char *parameter, char *key, char *value, char *uri, char *icon,
+ int type, time_t time)
{
struct datamgr_item *di;
if (subtitle)
di->subtitle = strdup(subtitle);
- if (key && value) {
- di->key = strdup(key);
- di->value = strdup(value);
- }
+
+ if ((key && value) || uri)
+ di->b = utils_add_bundle(key, value, uri);
return di;
}
if (!thumb || !strcmp(thumb, ""))
thumb = IMAGE_RECENT_THUMB_APP;
- di = _new_datamgr_item(label, NULL, rdata->id, NULL, NULL,
+ di = _new_datamgr_item(label, NULL, rdata->id, NULL, NULL, NULL,
IMAGE_RECENT_ICON_APP, 0, rdata->time);
if (di) {
thumbnail = calloc(1, sizeof(*thumbnail));
_get_program(atoi(rdata->id), &program);
di = _new_datamgr_item(buf, program, APP_ID_LIVETV, PARAM_SERVICE_ID,
- rdata->id, IMAGE_RECENT_ICON_CHANNEL, 1, rdata->time);
+ rdata->id, NULL, IMAGE_RECENT_ICON_CHANNEL, 1, rdata->time);
if (di) {
thumbnail = calloc(1, sizeof(*thumbnail));
if (thumbnail) {
snprintf(buf, sizeof(buf), "%s, %s", day, date);
di = _new_datamgr_item(buf, NULL, APP_ID_MEDIAHUB, PARAM_MEDIA_ID,
- rdata->id, IMAGE_RECENT_ICON_GALLERY, 1, rdata->time);
+ rdata->id, NULL, IMAGE_RECENT_ICON_GALLERY, 1, rdata->time);
if (di) {
thumbnail = calloc(1, sizeof(*thumbnail));
if (thumbnail) {
_get_duration(aminfo->video->duration, dur, sizeof(dur));
di = _new_datamgr_item(aminfo->title, dur, APP_ID_MEDIAHUB,
- PARAM_MEDIA_ID, rdata->id, IMAGE_RECENT_ICON_MOVIE, 1,
+ PARAM_MEDIA_ID, rdata->id, NULL, IMAGE_RECENT_ICON_MOVIE, 1,
rdata->time);
if (di) {
thumbnail = calloc(1, sizeof(*thumbnail));
}
di = _new_datamgr_item(aminfo->title, aminfo->audio->artist,
- APP_ID_MEDIAHUB, PARAM_MEDIA_ID, rdata->id,
+ APP_ID_MEDIAHUB, PARAM_MEDIA_ID, rdata->id, NULL,
IMAGE_RECENT_ICON_MUSIC, 1, rdata->time);
if (di) {
thumbnail = calloc(1, sizeof(*thumbnail));
goto err;
}
- di = _new_datamgr_item(title, url, APP_ID_BROWSER, NULL, NULL,
+ di = _new_datamgr_item(title, url, APP_ID_BROWSER, NULL, NULL, url,
IMAGE_RECENT_ICON_WEB, 1, time);
if (!di)
goto err;
free(di->icon);
free(di->focus_icon);
free(di->parameter);
- free(di->key);
- free(di->value);
_unload_thumbnail(di->thumbnail);
+ if (di->b)
+ bundle_free(di->b);
+
free(di);
}
}
di = _new_datamgr_item(MESSAGE_NOTIFICATION, buf, APP_ID_INFOSQUARE,
- NULL, NULL, IMAGE_RECENT_ICON_APP, 0, time);
+ NULL, NULL, NULL, IMAGE_RECENT_ICON_APP, 0, time);
if (di) {
thumbnail = calloc(1, sizeof(*thumbnail));
if (thumbnail) {
r = ITEM_SELECT_ERROR_INVALID_OPERATION;
switch (di->action) {
case ITEM_SELECT_ACTION_LAUNCH:
- if (utils_launch_app(di->parameter, di->key, di->value))
+ if (utils_launch_app(di->parameter, di->b))
r = ITEM_SELECT_ERROR_NONE;
break;
default:
#include <app_define.h>
#include <Ecore_Wayland.h>
#include <ui-gadget.h>
+#include <bundle.h>
#include "defs.h"
#include "view.h"
{
struct _appdata *ad;
Evas_Event_Key_Down *ev;
+ bundle *b;
if (!data || !ei) {
_ERR("Invalid argument");
ad = data;
if (!strcmp(ev->keyname, KEY_POWER)) {
- utils_launch_app(APP_ID_INFOSQUARE, PARAM_LAUNCH_TYPE,
- VALUE_INFOSQUARE);
+ b = utils_add_bundle(PARAM_LAUNCH_TYPE, VALUE_INFOSQUARE, NULL);
+ if (b) {
+ utils_launch_app(APP_ID_INFOSQUARE, b);
+ bundle_free(b);
+ }
} else if (!strcmp(ev->keyname, KEY_TV)) {
- utils_launch_app(APP_ID_LIVETV, NULL, NULL);
+ utils_launch_app(APP_ID_LIVETV, NULL);
} else if (!strcmp(ev->keyname, KEY_HOME) ||
!strcmp(ev->keyname, KEY_HOMEPAGE)) {
if (!ad->activated)
#include <notification.h>
#include <notification_internal.h>
#include <app_contents.h>
+#include <bundle.h>
#include "utils.h"
#include "defs.h"
return notify;
}
-bool utils_launch_app(const char *pkg, const char *key, const char *value)
+bundle *utils_add_bundle(char *key, char *value, char *uri)
+{
+ bundle *b;
+
+ b = bundle_create();
+ if (!b) {
+ _ERR("failed create bundle");
+ return NULL;
+ }
+
+ if (key)
+ bundle_add(b, BUNDLE_APP_KEY, key);
+ if (value)
+ bundle_add(b, BUNDLE_APP_VALUE, value);
+ if (uri)
+ bundle_add(b, BUNDLE_URI, uri);
+
+ return b;
+}
+
+bool utils_launch_app(const char *pkg, bundle *b)
{
app_control_h app_control;
int r;
+ const char *key, *value, *uri, *operation;
if (!pkg) {
_ERR("Invalid argument");
}
app_control_create(&app_control);
- app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
- if (key && value)
- app_control_add_extra_data(app_control, key, value);
+
+ operation = APP_CONTROL_OPERATION_DEFAULT;
+ if (b) {
+ key = bundle_get_val(b, BUNDLE_APP_KEY);
+ value = bundle_get_val(b, BUNDLE_APP_VALUE);
+ uri = bundle_get_val(b, BUNDLE_URI);
+
+ if (key && value) {
+ app_control_add_extra_data(app_control, key, value);
+ } else if (uri) {
+ operation = APP_CONTROL_OPERATION_VIEW;
+ app_control_set_uri(app_control, uri);
+ }
+ }
+
+ app_control_set_operation(app_control, operation);
app_control_set_app_id(app_control, pkg);
r = app_control_send_launch_request(app_control, NULL, NULL);
viewmgr_hide_view(VIEW_ACTION_MENU);
viewmgr_hide_view(VIEW_USER_EDIT);
- utils_launch_app(APP_ID_LIVETV, NULL, NULL);
+ utils_launch_app(APP_ID_LIVETV, NULL);
break;
case INPUT_HANDLER_TYPE_MENU_RESET:
_add_popup(priv, MESSAGE_RESET, MESSAGE_RESET_CONTENTS,
viewmgr_hide_view(VIEW_USER_EDIT);
_delete_popup(priv);
- utils_launch_app(APP_ID_LIVETV, NULL, NULL);
+ utils_launch_app(APP_ID_LIVETV, NULL);
break;
case INPUT_HANDLER_TYPE_POPUP_RESET:
viewmgr_update_view(VIEW_USER_EDIT, UPDATE_TYPE_RESET, NULL);