image : "apps_widget_edit_badge_shadow.png" COMP;
image : "apps_widget_edit_icon_plus.png" COMP;
image : "apps_widget_edit_stroke.png" COMP;
-
-// image : "apps_widget_preview_bg_dark.png" COMP;
-// image : "apps_widget_preview_bg_light.png" COMP;
-
+
image : "apps_edit_icon_bg_ef.png" COMP;
image : "apps_edit_icon_normal_ef.png" COMP;
image : "apps_edit_icon_select_ef.png" COMP;
name: "bg";
type: RECT;
mouse_events: 1;
-// clip_to: "bg,clip";
description {
state: "default" 0.0;
rel1 { relative: 0.0 0.0; offset: 0 0; }
rel2 { relative: 1.0 1.0; offset: 0 0; }
- //image { normal: "apps_widget_preview_bg_dark.png"; }
visible: 0;
}
- description {
- state: "dark_theme" 0.0;
- rel1 { relative: 0.0 0.0; offset: 0 0; }
- rel2 { relative: 1.0 1.0; offset: 0 0; }
- //image { normal: "apps_widget_preview_bg_dark.png"; }
- color: 0 0 0 255;
- visible: 1;
- }/*
- description {
- state: "light_theme" 0.0;
- rel1 { relative: 0.0 0.0; offset: 0 0; }
- rel2 { relative: 1.0 1.0; offset: 0 0; }
- image { normal: "apps_widget_preview_bg_light.png"; }
- visible: 1;
- }*/
}
part {
name: "scroller";
action : STATE_SET "default" 0.0;
target : "name";
}
- program {
- signal: "dark_theme";
- source: "bg";
- action: STATE_SET "dark_theme" 0.0;
- target: "bg";
- }
- /*
- program {
- signal: "light_theme";
- source: "bg";
- action: STATE_SET "light_theme" 0.0;
- target: "bg";
- }
- */
}
} /* end of layout group */
group {
name: "bg";
type: RECT;
mouse_events: 1;
-// clip_to: "bg,clip";
description {
state: "default" 0.0;
rel1 { relative: 0.0 0.0; offset: 0 0; }
//image { normal: "apps_widget_preview_bg_dark.png"; }
visible: 0;
}
- description {
- state: "dark_theme" 0.0;
- rel1 { relative: 0.0 0.0; offset: 0 0; }
- rel2 { relative: 1.0 1.0; offset: 0 0; }
- //image { normal: "apps_widget_preview_bg_dark.png"; }
- color : 0 0 0 255;
- visible: 1;
- }
- /*
- description {
- state: "light_theme" 0.0;
- rel1 { relative: 0.0 0.0; offset: 0 0; }
- rel2 { relative: 1.0 1.0; offset: 0 0; }
- image { normal: "apps_widget_preview_bg_light.png"; }
- visible: 1;
- }
- */
}
part {
name: "index1";
}
}
} /*end of parts */
- programs {
- program {
- signal: "dark_theme";
- source: "bg";
- action: STATE_SET "dark_theme" 0.0;
- target: "bg";
- }
- /*
- program {
- signal: "light_theme";
- source: "bg";
- action: STATE_SET "light_theme" 0.0;
- target: "bg";
- }
- */
- }
} /* end of layout group */
group {
name: "empty_slot";
}
info->edit_layout = layout;
- elm_object_signal_emit(info->edit_layout, "dark_theme", "bg");
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_resize(layout, 360, 360);
evas_object_show(layout);
}
info->select_layout = layout;
- elm_object_signal_emit(info->select_layout, "dark_theme", "bg");
-
-
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_resize(layout, 360, 360);
evas_object_show(layout);
int reset = 0;
int ret = 0;
-
-
- char *instance_id = NULL;
- ret = app_control_get_extra_data(service, "instance_id", &instance_id);
- if(!ret)
- {
- _E("widget id is null check");
- }
widget_id = strdup(APP_WIDGET_CONTENT_KEY);
bool prefkey_exist = false;
ret = preference_is_existing(widget_id, &prefkey_exist);
PROJECT(apptray-widget C)
SET(SRCS
- src/app-widget.c
+ src/apptray_widget.c
)
SET(VENDOR "tizen")
#edc compile
-ADD_CUSTOM_TARGET(app_shortcut.edj
+ADD_CUSTOM_TARGET(apptray_widget.edj
COMMAND edje_cc -id
- ${CMAKE_CURRENT_SOURCE_DIR}/res/images ${EDJE_CFLAGS}
- ${CMAKE_CURRENT_SOURCE_DIR}/res/edje/app_shortcut.edc ${CMAKE_BINARY_DIR}/app_shortcut.edj
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/res/edje/app_shortcut.edc
+ ${CMAKE_CURRENT_SOURCE_DIR}/edc/images ${EDJE_CFLAGS}
+ ${CMAKE_CURRENT_SOURCE_DIR}/res/edje/apptray_widget.edc ${CMAKE_BINARY_DIR}/apptray_widget.edj
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/res/edje/apptray_widget.edc
+ ${CMAKE_CURRENT_SOURCE_DIR}/edc/apptray_widget_color_class.edc
+ ${CMAKE_CURRENT_SOURCE_DIR}/edc/apptray_widget_common_defines.edc
+ ${CMAKE_CURRENT_SOURCE_DIR}/edc/apptray_widget_main_ly.edc
+ ${CMAKE_CURRENT_SOURCE_DIR}/edc/apptray_widget_slot_ly.edc
)
-ADD_DEPENDENCIES(${PROJECT_NAME} app_shortcut.edj)
+ADD_DEPENDENCIES(${PROJECT_NAME} apptray_widget.edj)
ADD_DEPENDENCIES(${PROJECT_NAME} edj_build)
-
# install files
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR})
-INSTALL(FILES ${CMAKE_BINARY_DIR}/app_shortcut.edj DESTINATION ${EDJDIR})
+INSTALL(FILES ${CMAKE_BINARY_DIR}/apptray_widget.edj DESTINATION ${EDJDIR})
# install application HOME directory
INSTALL(DIRECTORY DESTINATION ${RESDIR})
--- /dev/null
+/*
+ * Samsung API
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+color_classes {
+ color_class {
+ name: "AO0115";
+ color: 0 0 0 200;
+ }
+ color_class {
+ name: "AT0315";
+ color: 255 255 255 200;
+ }
+ color_class {
+ name: "AO0342";
+ color: 0 0 0 40;
+ }
+ color_class {
+ name: "AO044L1";
+ color: 255 255 255 200;
+ }
+ color_class {
+ name: "AO044L1P";
+ color: 255 255 255 50;
+ }
+ color_class {
+ name: "AO044L3";
+ color: 184 45 45 200;
+ }
+ color_class {
+ name: "AO044L3P";
+ color: 184 45 45 200;
+ }
+ color_class {
+ name: "AO044L4";
+ color: 0 0 0 35;
+ }
+ color_class {
+ name: "AO071";
+ color: 255 255 255 200;
+ }
+ color_class {
+ name: "AO071P";
+ color: 255 255 255 50;
+ }
+ color_class {
+ name: "AT039";
+ color: 255 255 255 200;
+ }
+ color_class {
+ name: "AO013L1";
+ color: 255 106 0 200;
+ }
+ color_class {
+ name: "AO013L2";
+ color: 255 255 255 200;
+ }
+ color_class {
+ name: "AO013L3";
+ color: 0 0 0 40;
+ }
+ color_class {
+ name: "AT03151";
+ color: 255 255 255 200;
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Samsung API
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+#define WIDGET_W 360
+#define WIDGET_H 360
+
+#define SHORTCUT_W 110
+#define SHORTCUT_H 132
+
+#define SHORTCUT_APP_ICON_DIMENTION 100 100
+
+#define REL_W(value) (value/WIDGET_W)
+#define REL_H(value) (value/WIDGET_H)
\ No newline at end of file
--- /dev/null
+/*
+ * Samsung API
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+#define MAIN_LY_SLOT_4_1_X1 125
+#define MAIN_LY_SLOT_4_1_Y1 20
+
+#define MAIN_LY_SLOT_4_2_X1 15
+#define MAIN_LY_SLOT_4_2_Y1 117
+
+#define MAIN_LY_SLOT_4_3_X1 235
+#define MAIN_LY_SLOT_4_3_Y1 117
+
+#define MAIN_LY_SLOT_4_4_X1 125
+#define MAIN_LY_SLOT_4_4_Y1 217
+
+#define MAIN_LY_SLOT_4_1_REL1 REL_W(MAIN_LY_SLOT_4_1_X1) REL_H(MAIN_LY_SLOT_4_1_Y1)
+#define MAIN_LY_SLOT_4_1_REL2 REL_W((MAIN_LY_SLOT_4_1_X1+SHORTCUT_W)) REL_H((MAIN_LY_SLOT_4_1_Y1+SHORTCUT_H))
+
+#define MAIN_LY_SLOT_4_2_REL1 REL_W(MAIN_LY_SLOT_4_2_X1) REL_H(MAIN_LY_SLOT_4_2_Y1)
+#define MAIN_LY_SLOT_4_2_REL2 REL_W((MAIN_LY_SLOT_4_2_X1+SHORTCUT_W)) REL_H((MAIN_LY_SLOT_4_2_Y1+SHORTCUT_H))
+
+#define MAIN_LY_SLOT_4_3_REL1 REL_W(MAIN_LY_SLOT_4_3_X1) REL_H(MAIN_LY_SLOT_4_3_Y1)
+#define MAIN_LY_SLOT_4_3_REL2 REL_W((MAIN_LY_SLOT_4_3_X1+SHORTCUT_W)) REL_H((MAIN_LY_SLOT_4_3_Y1+SHORTCUT_H))
+
+#define MAIN_LY_SLOT_4_4_REL1 REL_W(MAIN_LY_SLOT_4_4_X1) REL_H(MAIN_LY_SLOT_4_4_Y1)
+#define MAIN_LY_SLOT_4_4_REL2 REL_W((MAIN_LY_SLOT_4_4_X1+SHORTCUT_W)) REL_H((MAIN_LY_SLOT_4_4_Y1+SHORTCUT_H))
+
+#define MAIN_LY_SLOT_3_1_X1 125
+#define MAIN_LY_SLOT_3_1_Y1 30
+
+#define MAIN_LY_SLOT_3_2_X1 45
+#define MAIN_LY_SLOT_3_2_Y1 163
+
+#define MAIN_LY_SLOT_3_3_X1 205
+#define MAIN_LY_SLOT_3_3_Y1 163
+
+#define MAIN_LY_SLOT_3_1_REL1 REL_W(MAIN_LY_SLOT_3_1_X1) REL_H(MAIN_LY_SLOT_3_1_Y1)
+#define MAIN_LY_SLOT_3_1_REL2 REL_W((MAIN_LY_SLOT_3_1_X1+SHORTCUT_W)) REL_H((MAIN_LY_SLOT_3_1_Y1+SHORTCUT_H))
+
+#define MAIN_LY_SLOT_3_2_REL1 REL_W(MAIN_LY_SLOT_3_2_X1) REL_H(MAIN_LY_SLOT_3_2_Y1)
+#define MAIN_LY_SLOT_3_2_REL2 REL_W((MAIN_LY_SLOT_3_2_X1+SHORTCUT_W)) REL_H((MAIN_LY_SLOT_3_2_Y1+SHORTCUT_H))
+
+#define MAIN_LY_SLOT_3_3_REL1 REL_W(MAIN_LY_SLOT_3_3_X1) REL_H(MAIN_LY_SLOT_3_3_Y1)
+#define MAIN_LY_SLOT_3_3_REL2 REL_W((MAIN_LY_SLOT_3_3_X1+SHORTCUT_W)) REL_H((MAIN_LY_SLOT_3_3_Y1+SHORTCUT_H))
+
+#define MAIN_LY_SLOT_2_1_X1 45
+#define MAIN_LY_SLOT_2_1_Y1 117
+
+#define MAIN_LY_SLOT_2_2_X1 205
+#define MAIN_LY_SLOT_2_2_Y1 117
+
+#define MAIN_LY_SLOT_2_1_REL1 REL_W(MAIN_LY_SLOT_2_1_X1) REL_H(MAIN_LY_SLOT_2_1_Y1)
+#define MAIN_LY_SLOT_2_1_REL2 REL_W((MAIN_LY_SLOT_2_1_X1+SHORTCUT_W)) REL_H((MAIN_LY_SLOT_2_1_Y1+SHORTCUT_H))
+
+#define MAIN_LY_SLOT_2_2_REL1 REL_W(MAIN_LY_SLOT_2_2_X1) REL_H(MAIN_LY_SLOT_2_2_Y1)
+#define MAIN_LY_SLOT_2_2_REL2 REL_W((MAIN_LY_SLOT_2_2_X1+SHORTCUT_W)) REL_H((MAIN_LY_SLOT_2_2_Y1+SHORTCUT_H))
+
+#define MAIN_LY_SLOT_1_1_X1 125
+#define MAIN_LY_SLOT_1_1_Y1 117
+
+#define MAIN_LY_SLOT_1_1_REL1 REL_W(MAIN_LY_SLOT_1_1_X1) REL_H(MAIN_LY_SLOT_1_1_Y1)
+#define MAIN_LY_SLOT_1_1_REL2 REL_W((MAIN_LY_SLOT_1_1_X1+SHORTCUT_W)) REL_H((MAIN_LY_SLOT_1_1_Y1+SHORTCUT_H))
+
+#define MAIN_LY_NO_SHORCUTS_TXT_TOP_PAD_MIN 0 18
+#define MAIN_LY_NO_SHORCUTS_TXT_DIMENTION 303 40
+
+#define MAIN_LY_ADD_APP_TOP_PAD 0 112
+
+styles {
+ style {
+ name: "add_shortcut_norm";
+ base: "font=Tizen font_weight=Regular font_width=Condensed font_size=30 align=center valign=center color=#ffffffff ellipsis=1.0";
+ tag: "br" "\n";
+ tag: "hilight" "+ color=#ffff";
+ tag: "b" "+ color=#ffff";
+ tag: "tab" "\t";
+ }
+ style {
+ name: "add_shortcut_pressed";
+ base: "font=Tizen font_weight=Regular font_width=Condensed font_size=30 align=center valign=center color=#ffffff7f ellipsis=1.0";
+ tag: "br" "\n";
+ tag: "hilight" "+ color=#ffff";
+ tag: "b" "+ color=#ffff";
+ tag: "tab" "\t";
+ }
+}
+
+group { name: "dbox_bg";
+ images {
+ image: "apps_widget_bg.png" COMP;
+ }
+ parts {
+ part { name: "bg";
+ type: IMAGE;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 255;
+ image { normal: "apps_widget_bg.png"; }
+ min: WIDGET_W WIDGET_H;
+ max: WIDGET_W WIDGET_H;
+ fixed: 1 1;
+ }
+ }
+ part {
+ name: "bg_swallow";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; to: "bg"; }
+ rel2 { relative: 1.0 1.0; to: "bg"; }
+ }
+ }
+ }
+}
+
+group { name: "main_layout";
+ parts {
+ part {
+ name: "bg";
+ type: SPACER;
+ mouse_events: 1;
+ description {
+ state: "default" 0.0;
+ }
+ }
+ part {
+ name: "add_apps.top.padding";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: MAIN_LY_ADD_APP_TOP_PAD;
+ fixed: 0 1;
+ rel2.relative: 1.0 0.0;
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "add_apps";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.5 0.0;
+ rel1 { relative: 0.0 1.0; to_y: "add_apps.top.padding"; }
+ rel2 { relative: 1.0 1.0; }
+ visible: 1;
+ }
+ description {
+ state: "visible" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ description {
+ state: "invisible" 0.0;
+ inherit: "default" 0.0;
+ }
+ }
+ part {
+ name: "slot_1";
+ type: SWALLOW;
+ mouse_events: 1;
+ description { state: "default" 0.0;
+ rel1 { relative: MAIN_LY_SLOT_4_1_REL1; to: "bg"; }
+ rel2 { relative: MAIN_LY_SLOT_4_1_REL2; to: "bg"; }
+ }
+ description { state: "4slots" 0.0;
+ inherit: "default" 0.0;
+ }
+ description { state: "3slots" 0.0;
+ inherit: "default" 0.0;
+ rel1 { relative: MAIN_LY_SLOT_3_1_REL1; to: "bg"; }
+ rel2 { relative: MAIN_LY_SLOT_3_1_REL2; to: "bg"; }
+ }
+ description { state: "2slots" 0.0;
+ inherit: "default" 0.0;
+ rel1 { relative: MAIN_LY_SLOT_2_1_REL1; to: "bg"; }
+ rel2 { relative: MAIN_LY_SLOT_2_1_REL2; to: "bg"; }
+ }
+ description { state: "1slot" 0.0;
+ inherit: "default" 0.0;
+ rel1 { relative: MAIN_LY_SLOT_1_1_REL1; to: "bg"; }
+ rel2 { relative: MAIN_LY_SLOT_1_1_REL2; to: "bg"; }
+ }
+ description { state: "no_apps" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "slot_1.touch_rect";
+ type: RECT;
+ mouse_events: 1;
+ repeat_events: 1;
+ ignore_flags: ON_HOLD;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; to: "slot_1"; }
+ rel2 { relative: 1.0 1.0; to: "slot_1"; }
+ color: 0 0 0 0;
+ visible: 1;
+ }
+ description {
+ state: "visible" 0.0;
+ inherit: "default" 0.0;
+ }
+ description {
+ state: "invisible" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "slot_2";
+ type: SWALLOW;
+ mouse_events: 1;
+ description { state: "default" 0.0;
+ rel1 { relative: MAIN_LY_SLOT_4_2_REL1; to: "bg"; }
+ rel2 { relative: MAIN_LY_SLOT_4_2_REL2; to: "bg"; }
+ }
+ description { state: "4slots" 0.0;
+ inherit: "default" 0.0;
+ }
+ description { state: "3slots" 0.0;
+ inherit: "default" 0.0;
+ rel1 { relative: MAIN_LY_SLOT_3_2_REL1; to: "bg"; }
+ rel2 { relative: MAIN_LY_SLOT_3_2_REL2; to: "bg"; }
+ }
+ description { state: "2slots" 0.0;
+ inherit: "default" 0.0;
+ rel1 { relative: MAIN_LY_SLOT_2_2_REL1; to: "bg"; }
+ rel2 { relative: MAIN_LY_SLOT_2_2_REL2; to: "bg"; }
+ }
+ description { state: "1slot" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ description { state: "no_apps" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "slot_2.touch_rect";
+ type: RECT;
+ mouse_events: 1;
+ repeat_events: 1;
+ ignore_flags: ON_HOLD;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; to: "slot_2"; }
+ rel2 { relative: 1.0 1.0; to: "slot_2"; }
+ color: 0 0 0 0;
+ visible: 1;
+ }
+ description {
+ state: "visible" 0.0;
+ inherit: "default" 0.0;
+ }
+ description {
+ state: "invisible" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "slot_3";
+ type: SWALLOW;
+ mouse_events: 1;
+ description { state: "default" 0.0;
+ rel1 { relative: MAIN_LY_SLOT_4_3_REL1; to: "bg"; }
+ rel2 { relative: MAIN_LY_SLOT_4_3_REL2; to: "bg"; }
+ }
+ description { state: "4slots" 0.0;
+ inherit: "default" 0.0;
+ }
+ description { state: "3slots" 0.0;
+ inherit: "default" 0.0;
+ rel1 { relative: MAIN_LY_SLOT_3_3_REL1; to: "bg"; }
+ rel2 { relative: MAIN_LY_SLOT_3_3_REL2; to: "bg"; }
+ }
+ description { state: "2slots" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ description { state: "1slot" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ description { state: "no_apps" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "slot_3.touch_rect";
+ type: RECT;
+ mouse_events: 1;
+ repeat_events: 1;
+ ignore_flags: ON_HOLD;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; to: "slot_3"; }
+ rel2 { relative: 1.0 1.0; to: "slot_3"; }
+ color: 0 0 0 0;
+ visible: 1;
+ }
+ description {
+ state: "visible" 0.0;
+ inherit: "default" 0.0;
+ }
+ description {
+ state: "invisible" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "slot_4";
+ type: SWALLOW;
+ mouse_events: 1;
+ description { state: "default" 0.0;
+ rel1 { relative: MAIN_LY_SLOT_4_4_REL1; to: "bg"; }
+ rel2 { relative: MAIN_LY_SLOT_4_4_REL2; to: "bg"; }
+ }
+ description { state: "4slots" 0.0;
+ inherit: "default" 0.0;
+ }
+ description { state: "3slots" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ description { state: "2slots" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ description { state: "1slot" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ description { state: "no_apps" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "slot_4.touch_rect";
+ type: RECT;
+ mouse_events: 1;
+ repeat_events: 1;
+ ignore_flags: ON_HOLD;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; to: "slot_4"; }
+ rel2 { relative: 1.0 1.0; to: "slot_4"; }
+ color: 0 0 0 0;
+ visible: 1;
+ }
+ description {
+ state: "visible" 0.0;
+ inherit: "default" 0.0;
+ }
+ description {
+ state: "invisible" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "mouse_clicked_1";
+ signal: "mouse,clicked,*";
+ source: "slot_1.touch_rect";
+ action: SIGNAL_EMIT "mouse_clicked" "slot_1";
+ }
+ program {
+ name: "mouse_clicked_2";
+ signal: "mouse,clicked,*";
+ source: "slot_2.touch_rect";
+ action: SIGNAL_EMIT "mouse_clicked" "slot_2";
+ }
+ program {
+ name: "mouse_clicked_3";
+ signal: "mouse,clicked,*";
+ source: "slot_3.touch_rect";
+ action: SIGNAL_EMIT "mouse_clicked" "slot_3";
+ }
+ program {
+ name: "mouse_clicked_4";
+ signal: "mouse,clicked,*";
+ source: "slot_4.touch_rect";
+ action: SIGNAL_EMIT "mouse_clicked" "slot_4";
+ }
+ program {
+ name: "set_layout_4_slots";
+ signal: "4_slots";
+ source: "*";
+ action: STATE_SET "4slots" 0.0;
+ target: "slot_1";
+ target: "slot_2";
+ target: "slot_3";
+ target: "slot_4";
+ after: "set_slot_1_ta_visible";
+ after: "set_slot_2_ta_visible";
+ after: "set_slot_3_ta_visible";
+ after: "set_slot_4_ta_visible";
+ after: "hide_add_apps";
+ }
+ program {
+ name: "hide_add_apps";
+ action: STATE_SET "invisible" 0.0;
+ target: "add_apps";
+ }
+ program {
+ name: "show_add_apps";
+ action: STATE_SET "visible" 0.0;
+ target: "add_apps";
+ }
+ program {
+ name: "set_layout_3_slots";
+ signal: "3_slots";
+ source: "*";
+ action: STATE_SET "3slots" 0.0;
+ target: "slot_1";
+ target: "slot_2";
+ target: "slot_3";
+ target: "slot_4";
+ after: "set_slot_1_ta_visible";
+ after: "set_slot_2_ta_visible";
+ after: "set_slot_3_ta_visible";
+ after: "set_slot_4_ta_invisible";
+ after: "hide_add_apps";
+ }
+ program {
+ name: "set_layout_2_slots";
+ signal: "2_slots";
+ source: "*";
+ action: STATE_SET "2slots" 0.0;
+ target: "slot_1";
+ target: "slot_2";
+ target: "slot_3";
+ target: "slot_4";
+ after: "set_slot_1_ta_visible";
+ after: "set_slot_2_ta_visible";
+ after: "set_slot_3_ta_invisible";
+ after: "set_slot_4_ta_invisible";
+ after: "hide_add_apps";
+ }
+ program {
+ name: "set_layout_1_slot";
+ signal: "1_slots";
+ source: "*";
+ action: STATE_SET "1slot" 0.0;
+ target: "slot_1";
+ target: "slot_2";
+ target: "slot_3";
+ target: "slot_4";
+ after: "set_slot_1_ta_visible";
+ after: "set_slot_2_ta_invisible";
+ after: "set_slot_3_ta_invisible";
+ after: "set_slot_4_ta_invisible";
+ after: "hide_add_apps";
+ }
+ program {
+ name: "set_no_apps";
+ signal: "no_apps";
+ source: "*";
+ action: STATE_SET "no_apps" 0.0;
+ target: "slot_1";
+ target: "slot_2";
+ target: "slot_3";
+ target: "slot_4";
+ after: "set_slot_1_ta_invisible";
+ after: "set_slot_2_ta_invisible";
+ after: "set_slot_3_ta_invisible";
+ after: "set_slot_4_ta_invisible";
+ after: "show_add_apps";
+ }
+ program {
+ name: "set_slot_1_ta_visible";
+ action: STATE_SET "visible" 0.0;
+ target: "slot_1.touch_rect";
+ }
+ program {
+ name: "set_slot_1_ta_invisible";
+ action: STATE_SET "invisible" 0.0;
+ target: "slot_1.touch_rect";
+ }
+ program {
+ name: "set_slot_2_ta_visible";
+ action: STATE_SET "visible" 0.0;
+ target: "slot_2.touch_rect";
+ }
+ program {
+ name: "set_slot_2_ta_invisible";
+ action: STATE_SET "invisible" 0.0;
+ target: "slot_2.touch_rect";
+ }
+ program {
+ name: "set_slot_3_ta_visible";
+ action: STATE_SET "visible" 0.0;
+ target: "slot_3.touch_rect";
+ }
+ program {
+ name: "set_slot_3_ta_invisible";
+ action: STATE_SET "invisible" 0.0;
+ target: "slot_3.touch_rect";
+ }
+ program {
+ name: "set_slot_4_ta_visible";
+ action: STATE_SET "visible" 0.0;
+ target: "slot_4.touch_rect";
+ }
+ program {
+ name: "set_slot_4_ta_invisible";
+ action: STATE_SET "invisible" 0.0;
+ target: "slot_4.touch_rect";
+ }
+ }
+}
+
+group {
+ name: "add_app_shorcuts";
+ images {
+ image: "apps_widget_edit_stroke.png" COMP;
+ image: "apps_widget_edit_plus.png" COMP;
+ }
+ parts {
+ part {
+ name: "bg";
+ type: SPACER;
+ description {
+ state: "default" 0.0;
+ }
+ }
+ part {
+ name: "circular_icon";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.5 0.0;
+ fixed: 1 1;
+ rel1 { relative: 0.0 0.0; to: "bg"; }
+ rel2 { relative: 1.0 1.0; to: "bg"; }
+ min: SHORTCUT_APP_ICON_DIMENTION;
+ max: SHORTCUT_APP_ICON_DIMENTION;
+ image { normal: "apps_widget_edit_stroke.png"; }
+ }
+ description {
+ state: "pressed" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 127;
+ }
+ }
+ part {
+ name: "plus_icon";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ rel1 { relative: 0.0 0.0; to: "circular_icon"; }
+ rel2 { relative: 1.0 1.0; to: "circular_icon"; }
+ min: SHORTCUT_APP_ICON_DIMENTION;
+ max: SHORTCUT_APP_ICON_DIMENTION;
+ image { normal: "apps_widget_edit_plus.png"; }
+ }
+ description {
+ state: "pressed" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 127;
+ }
+ }
+ part {
+ name: "txt_padding";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: MAIN_LY_NO_SHORCUTS_TXT_TOP_PAD_MIN;
+ fixed: 0 1;
+ rel1 { relative: 0.0 1.0; to_x: "bg"; to_y: "circular_icon"; }
+ rel2 { relative: 1.0 1.0; to_x: "bg"; to_y: "circular_icon"; }
+ align: 0.5 0.0;
+ }
+ }
+ part {
+ name: "txt";
+ type: TEXTBLOCK;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.5 0.0;
+ fixed: 0 1;
+ rel1 { relative: 0.0 1.0; to_x: "bg"; to_y: "txt_padding";}
+ min: MAIN_LY_NO_SHORCUTS_TXT_DIMENTION;
+ max: MAIN_LY_NO_SHORCUTS_TXT_DIMENTION;
+ text.style: "add_shortcut_norm";
+ }
+ description {
+ state: "pressed" 0.0;
+ inherit: "default" 0.0;
+ text.style: "add_shortcut_pressed";
+ }
+ }
+ part {
+ name: "touch_rect";
+ type: RECT;
+ mouse_events: 1;
+ repeat_events: 1;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; to: "bg"; }
+ rel2 { relative: 1.0 1.0; to: "txt"; }
+ color: 0 0 0 0;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "set_pressed";
+ action: STATE_SET "pressed" 0.0;
+ target: "circular_icon";
+ target: "plus_icon";
+ target: "txt";
+ }
+ program {
+ name: "set_unpressed";
+ action: STATE_SET "default" 0.0;
+ target: "circular_icon";
+ target: "plus_icon";
+ target: "txt";
+ }
+ program {
+ name: "mouse_down";
+ signal: "mouse,down,*";
+ source: "touch_rect";
+ after: "set_pressed";
+ script {
+ run_program(PROGRAM:"set_pressed");
+ }
+ }
+ program {
+ name: "mouse_up";
+ signal: "mouse,up,*";
+ source: "touch_rect";
+ script {
+ run_program(PROGRAM:"set_unpressed");
+ }
+ }
+ program {
+ name: "mouse_clicked";
+ signal: "mouse,clicked,*";
+ source: "touch_rect";
+ action: SIGNAL_EMIT "mouse_clicked" "touch_rect";
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Samsung API
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+#define SHORTCUT_APP_TXT_DIMENTION SHORTCUT_W 32
+
+styles {
+ style {
+ name: "app_name";
+ base: "font=Tizen font_weight=Regular font_width=Condensed font_size=24 align=center valign=center color=#ffffffff ellipsis=1.0";
+ tag: "br" "\n";
+ tag: "hilight" "+ color=#ffff";
+ tag: "b" "+ color=#ffff";
+ tag: "tab" "\t";
+ }
+}
+
+group {
+ name: "icon_slot";
+ images {
+ image: "apps_widget_badge_bg.#.png" COMP;
+ image: "apps_widget_badge_shadow.#.png" COMP;
+ image: "apps_widget_badge_stroke.#.png" COMP;
+ }
+ parts {
+ part {
+ name: "bg";
+ type: SPACER;
+ description {
+ state: "default" 0.0;
+ }
+ }
+ part {
+ name: "icon";
+ type: SWALLOW;
+ clip_to: "clipper";
+ scale: 1;
+ mouse_events: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.5 0.0;
+ fixed: 1 1;
+ rel1 { relative: 0.0 0.0; to: "bg"; }
+ rel2 { relative: 1.0 1.0; to: "bg"; }
+ min : SHORTCUT_APP_ICON_DIMENTION;
+ max : SHORTCUT_APP_ICON_DIMENTION;
+ }
+ }
+ part{
+ name: "name";
+ type: TEXTBLOCK;
+ mouse_events : 0;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 1.0; to : "icon"; }
+ rel2 { relative: 1.0 1.0; to : "icon"; }
+ align: 0.5 0.0;
+ fixed : 1 1;
+ min : SHORTCUT_APP_TXT_DIMENTION;
+ max : SHORTCUT_APP_TXT_DIMENTION;
+ text.style: "app_name";
+ }
+ }
+ part {
+ name: "badge_bg";
+ type: IMAGE;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1 { relative: 1.0 0.0; to: "icon"; offset: -12 10; }
+ rel2 { relative: 1.0 0.0; to: "icon"; offset: -12 10; }
+ image { normal: "apps_widget_badge_bg.#.png"; }
+ fixed: 1 1;
+ color_class: "AO013L1";
+ min : 54 54;
+ visible: 0;
+ }
+ description { state: "1" 0.0;
+ rel1 { relative: 1.0 0.0; to: "icon"; offset: -12 10; }
+ rel2 { relative: 1.0 0.0; to: "icon"; offset: -12 10; }
+ image { normal: "apps_widget_badge_bg.#.png"; }
+ fixed: 1 1;
+ color_class: "AO013L1";
+ min : 54 54;
+ visible: 1;
+ }
+ description { state: "2" 0.0;
+ rel1 { relative: 1.0 0.0; to: "icon"; offset: -20 10; }
+ rel2 { relative: 1.0 0.0; to: "icon"; offset: -20 10; }
+ image { normal: "apps_widget_badge_bg.#.png"; }
+ fixed: 1 1;
+ color_class: "AO013L1";
+ min : 70 54;
+ visible: 1;
+ }
+ description { state: "3" 0.0;
+ rel1 { relative: 1.0 0.0; to: "icon"; offset: -26 10; }
+ rel2 { relative: 1.0 0.0; to: "icon"; offset: -26 10; }
+ image { normal: "apps_widget_badge_bg.#.png"; }
+ fixed: 1 1;
+ color_class: "AO013L1";
+ min : 82 54;
+ visible: 1;
+ }
+ description { state: "3r" 0.0;
+ rel1 { relative: 1.0 0.0; to: "icon"; offset: -26 10; }
+ rel2 { relative: 1.0 0.0; to: "icon"; offset: -26 10; }
+ image { normal: "apps_widget_badge_bg.#.png"; }
+ fixed: 1 1;
+ color_class: "AO013L1";
+ min : 82 54;
+ visible: 1;
+ }
+ }
+ part { name: "badge_stroke";
+ type: IMAGE;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1 { relative: 1.0 0.0; to: "icon"; offset: -12 10; }
+ rel2 { relative: 1.0 0.0; to: "icon"; offset: -12 10; }
+ image { normal: "apps_widget_badge_stroke.#.png"; }
+ fixed: 1 1;
+ color_class: "AO013L2";
+ min : 54 54;
+ visible: 0;
+ }
+ description { state: "1" 0.0;
+ rel1 { relative: 1.0 0.0; to: "icon"; offset: -12 10; }
+ rel2 { relative: 1.0 0.0; to: "icon"; offset: -12 10; }
+ image { normal: "apps_widget_badge_stroke.#.png"; }
+ fixed: 1 1;
+ color_class: "AO013L2";
+ min : 54 54;
+ visible: 1;
+ }
+ description { state: "2" 0.0;
+ rel1 { relative: 1.0 0.0; to: "icon"; offset: -20 10; }
+ rel2 { relative: 1.0 0.0; to: "icon"; offset: -20 10; }
+ image { normal: "apps_widget_badge_stroke.#.png"; }
+ fixed: 1 1;
+ color_class: "AO013L2";
+ min : 70 54;
+ visible: 1;
+ }
+ description { state: "3" 0.0;
+ rel1 { relative: 1.0 0.0; to: "icon"; offset: -26 10; }
+ rel2 { relative: 1.0 0.0; to: "icon"; offset: -26 10; }
+ image { normal: "apps_widget_badge_stroke.#.png"; }
+ fixed: 1 1;
+ color_class: "AO013L2";
+ min : 82 54;
+ visible: 1;
+ }
+ description { state: "3r" 0.0;
+ rel1 { relative: 1.0 0.0; to: "icon"; offset: -26 10; }
+ rel2 { relative: 1.0 0.0; to: "icon"; offset: -26 10; }
+ image { normal: "apps_widget_badge_stroke.#.png"; }
+ fixed: 1 1;
+ color_class: "AO013L2";
+ min : 82 54;
+ visible: 1;
+ }
+ }
+ part {
+ name: "badge_shadow";
+ type: IMAGE;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1 { relative: 1.0 0.0; to: "icon"; offset: -12 10; }
+ rel2 { relative: 1.0 0.0; to: "icon"; offset: -12 10; }
+ image { normal: "apps_widget_badge_shadow.#.png"; }
+ fixed: 1 1;
+ color_class: "AO013L3";
+ min : 54 54;
+ visible: 0;
+ }
+ description { state: "1" 0.0;
+ rel1 { relative: 1.0 0.0; to: "icon"; offset: -12 10; }
+ rel2 { relative: 1.0 0.0; to: "icon"; offset: -12 10; }
+ image { normal: "apps_widget_badge_shadow.#.png"; }
+ fixed: 1 1;
+ color_class: "AO013L3";
+ min : 54 54;
+ visible: 1;
+ }
+ description { state: "2" 0.0;
+ rel1 { relative: 1.0 0.0; to: "icon"; offset: -20 10; }
+ rel2 { relative: 1.0 0.0; to: "icon"; offset: -20 10; }
+ image { normal: "apps_widget_badge_shadow.#.png"; }
+ fixed: 1 1;
+ color_class: "AO013L3";
+ min : 70 54;
+ visible: 1;
+ }
+ description { state: "3" 0.0;
+ rel1 { relative: 1.0 0.0; to: "icon"; offset: -26 10; }
+ rel2 { relative: 1.0 0.0; to: "icon"; offset: -26 10; }
+ image { normal: "apps_widget_badge_shadow.#.png"; }
+ fixed: 1 1;
+ color_class: "AO013L3";
+ min : 82 54;
+ visible: 1;
+ }
+ description { state: "3r" 0.0;
+ rel1 { relative: 1.0 0.0; to: "icon"; offset: -26 10; }
+ rel2 { relative: 1.0 0.0; to: "icon"; offset: -26 10; }
+ image { normal: "apps_widget_badge_shadow.#.png"; }
+ fixed: 1 1;
+ color_class: "AO013L3";
+ min : 82 54;
+ visible: 1;
+ }
+ }
+ part { name: "badge_txt";
+ type: TEXT;
+ scale: 1;
+ mouse_events: 0;
+ description { state: "default" 0.0;
+ rel1 { relative: 0.5 0.5; to, "badge_bg"; offset: 0 -2; }
+ rel2 { relative: 0.5 0.5; to, "badge_bg"; offset: 0 -2; }
+ align: 0.5 0.5;
+ color_class: "AT039";
+ text {
+ text_class: "AT039";
+ align: 0.5 0.5;
+ min: 1 1;
+ }
+ fixed: 1 1;
+ visible: 0;
+ }
+ description { state: "1" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ description { state: "2" 0.0;
+ inherit: "1" 0.0;
+ }
+ description { state: "3" 0.0;
+ inherit: "1" 0.0;
+ }
+ description { state: "3r" 0.0;
+ inherit: "1" 0.0;
+ }
+ }
+ part { name: "clipper";
+ type: RECT;
+ scale: 1;
+ mouse_events: 1;
+ description { state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; to: "icon"; }
+ rel2 { relative: 1.0 1.0; to: "icon"; }
+ color : 255 255 255 255;
+ }
+ description { state: "glow" 0.0;
+ rel1 { relative: 0.0 0.0; to: "icon"; }
+ rel2 { relative: 1.0 1.0; to: "icon"; }
+ color : 255 255 255 127;
+ }
+ }
+ part { name: "touch_rect_on_hold";
+ type: RECT;
+ mouse_events: 1;
+ repeat_events: 1;
+ ignore_flags: ON_HOLD;
+ description { state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; to: "bg"; }
+ rel2 { relative: 1.0 1.0; to_x: "bg"; to_y: "name"; }
+ color: 0 0 0 0;
+ }
+ }
+ part { name: "touch_rect";
+ type: RECT;
+ mouse_events: 1;
+ repeat_events: 1;
+ description { state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; to: "bg"; }
+ rel2 { relative: 1.0 1.0; to_x: "bg"; to_y: "name"; }
+ color: 0 0 0 0;
+ }
+ }
+ }
+ programs {
+ program {
+ name : "set_pressed";
+ action: STATE_SET "glow" 0.0;
+ target: "clipper";
+ }
+ program {
+ name : "set_unpressed";
+ action: STATE_SET "default" 0.0;
+ target: "clipper";
+ }
+ program {
+ name: "mouse_down";
+ signal: "mouse,down,*";
+ source: "touch_rect";
+ script {
+ run_program(PROGRAM:"set_pressed");
+ }
+ }
+ program {
+ name: "mouse_up";
+ signal: "mouse,up,*";
+ source: "touch_rect";
+ script {
+ run_program(PROGRAM:"set_unpressed");
+ }
+ }
+ program {
+ name: "mouse_clicked";
+ signal: "mouse,clicked,*";
+ source: "touch_rect_on_hold";
+ action: SIGNAL_EMIT "mouse_clicked" "*";
+ }
+ program {
+ signal: "badge,on,1";
+ source: "slot";
+ action: STATE_SET "1" 0.0;
+ target: "badge_shadow";
+ target: "badge_stroke";
+ target: "badge_txt";
+ target: "badge_bg";
+ }
+ program {
+ signal: "badge,on,2";
+ source: "slot";
+ action: STATE_SET "2" 0.0;
+ target: "badge_shadow";
+ target: "badge_stroke";
+ target: "badge_txt";
+ target: "badge_bg";
+ }
+ program {
+ signal: "badge,on,3";
+ source: "slot";
+ action: STATE_SET "3" 0.0;
+ target: "badge_shadow";
+ target: "badge_stroke";
+ target: "badge_txt";
+ target: "badge_bg";
+ }
+ program {
+ signal: "badge,on,3r";
+ source: "slot";
+ action: STATE_SET "3r" 0.0;
+ target: "badge_shadow";
+ target: "badge_stroke";
+ target: "badge_txt";
+ target: "badge_bg";
+ }
+ program {
+ signal: "badge,off";
+ source: "slot";
+ action: STATE_SET "default" 0.0;
+ target: "badge_shadow";
+ target: "badge_stroke";
+ target: "badge_txt";
+ target: "badge_bg";
+ }
+ }
+}
\ No newline at end of file
+++ /dev/null
-/*
- * Samsung API
- * Copyright (c) 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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.
- */
-
-#ifndef __APP_WIDGET_H__
-#define __APP_WIDGET_H__
-
-#include <widget_app.h>
-#include <widget_app_efl.h>
-#include <Elementary.h>
-#include <dlog.h>
-#include "app-widget_log.h"
-
-void app_shortcut_remove_package(const char *package);
-
-#endif /* __APP_WIDGET_H__ */
+++ /dev/null
-/*
- * Samsung API
- * Copyright (c) 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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.
- */
-
-#ifndef __APP_WIDGET_LOG_H__
-#define __APP_WIDGET_LOG_H__
-
-#include <unistd.h>
-#include <dlog.h>
-#include <string.h>
-#include <assert.h>
-
-#define WCOLOR_RED "\033[0;31m"
-#define WCOLOR_GREEN "\033[0;32m"
-#define WCOLOR_BROWN "\033[0;33m"
-#define WCOLOR_BLUE "\033[0;34m"
-#define WCOLOR_PURPLE "\033[0;35m"
-#define WCOLOR_CYAN "\033[0;36m"
-#define WCOLOR_LIGHTBLUE "\033[0;37m"
-#define WCOLOR_END "\033[0;m"
-#define MODULE_INFO (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "app-widget"
-
-
-#if !defined(PACKAGE)
-#define PACKAGE "org.example.app-widget"
-#endif
-
-#if !defined(LOGE)
-
-#define LOGE(fmt, arg...) dlog_print(DLOG_DEBUG, \
- LOG_TAG, "%s: %s(%d) > " WCOLOR_GREEN fmt WCOLOR_END, MODULE_INFO, \
- __func__, __LINE__, ##arg)
-#endif
-#if !defined(_D)
-
-#define _D(fmt, arg...) dlog_print(DLOG_DEBUG, \
- LOG_TAG, "%s: %s(%d) > " WCOLOR_GREEN fmt WCOLOR_END, MODULE_INFO, \
- __func__, __LINE__, ##arg)
-
-#endif
-
-#if !defined(_W)
-#define _W(fmt, arg...) dlog_print(DLOG_WARN, \
- LOG_TAG, "%s: %s(%d) > " fmt, MODULE_INFO, \
- __func__, __LINE__, ##arg)
-#endif
-
-#if !defined(_E)
-#define _E(fmt, arg...) dlog_print(DLOG_ERROR, \
- LOG_TAG, "%s: %s(%d) > " WCOLOR_RED fmt WCOLOR_END, MODULE_INFO, \
- __func__, __LINE__, ##arg)
-#endif
-
-#define _ENTER \
- _D("%s - Entry", __func__)
-#define _EXIT \
- _D("%s - Exit", __func__)
-
-#if !defined(_SD)
-#define _SD(fmt, arg...) dlog_print(DLOG_DEBUG, \
- LOG_TAG, "%s: %s(%d) > " WCOLOR_GREEN fmt WCOLOR_END, MODULE_INFO, \
- __func__, __LINE__, ##arg)
-#endif
-
-#if !defined(_SW)
-#define _SW(fmt, arg...) dlog_print(DLOG_WARN, \
- LOG_TAG, "%s: %s(%d) > " fmt, MODULE_INFO, \
- __func__, __LINE__, ##arg)
-#endif
-
-#if !defined(_SE)
-#define _SE(fmt, arg...) dlog_print(DLOG_ERROR, \
- LOG_TAG, "%s: %s(%d) > " WCOLOR_RED fmt WCOLOR_END, MODULE_INFO, \
- __func__, __LINE__, ##arg)
-#endif
-
-#define retvm_if_timer(timer, expr, val, fmt, arg...) do { \
- if (expr) { \
- _E(fmt, ##arg); \
- _E("(%s) -> %s() return", #expr, __FUNCTION__); \
- timer = NULL; \
- return (val); \
- } \
-} while (0)
-
-#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) { \
- _E("(%s) -> %s() return", #expr, __FUNCTION__); \
- return (val); \
- } \
-} while (0)
-
-#define retm_if(expr, fmt, arg...) do { \
- if(expr) { \
- _E(fmt, ##arg); \
- _E("(%s) -> %s() return", #expr, __FUNCTION__); \
- return; \
- } \
-} while (0)
-
-#define ret_if(expr) do { \
- if(expr) { \
- _E("(%s) -> %s() return", #expr, __FUNCTION__); \
- return; \
- } \
-} while (0)
-
-#define goto_if(expr, val) do { \
- if(expr) { \
- _E("(%s) -> goto", #expr); \
- goto val; \
- } \
-} while (0)
-
-#define break_if(expr) { \
- if(expr) { \
- _E("(%s) -> break", #expr); \
- break; \
- } \
-}
-
-#define continue_if(expr) { \
- if(expr) { \
- _E("(%s) -> continue", #expr); \
- continue; \
- } \
-}
-
-#endif
--- /dev/null
+/*
+ * Samsung API
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+#ifndef __APP_WIDGET_COMMON_DEFINES_H__
+#define __APP_WIDGET_COMMON_DEFINES_H__
+
+#define PATH_MAX 4096 /* # chars in a path name including nul */
+
+#define PUBLIC __attribute__((visibility("default")))
+#define EDJE_FILE "edje/apptray_widget.edj"
+#define DEFAULT_ICON "images/unknown.png"
+#define LANGUAGE_ARABIC "ar"
+
+#define MESSAGE_PKG "org.tizen.message"
+#define WHOME_PKG "org.tizen.w-home"
+#define APPS_PKG "org.tizen.apptray-widget-app"
+#define APPS_WIDGET "org.tizen.apptray-widget"
+#define VCONFKEY_WMS_HOST_STATUS_VENDOR "db/wms/host_status/vendor"
+#define APP_TYPE_WGT "wgt"
+#define APP_WIDGET_CONTENT_KEY "org.tizen.apptray-widget"
+#define APP_LAUNCH_KEY "launch_apps"
+#define WHOME_APP_CONTROL "home_op"
+
+#define DEFAULT_APP_ORDER "org.tizen.apptray-widget-app empty org.tizen.watch-setting empty"
+#define BADGE_SIGNAL_LEN 16
+#define MAX_BADGE_COUNT 999
+#define SHORTCUT_W 123
+#define SHORTCUT_H 123
+#define WIDGET_SLOTS_MAX_COUNT 4
+
+#define BUFF_SMALL_SIZE 128
+
+#define ARRAY_ITEMS_COUNT(x) sizeof(x)/sizeof(x[0])
+
+#undef IS_STRING_EMPTY
+#define IS_STRING_EMPTY(x) !(x && x[0] != '\0')
+
+#undef FREE
+#define FREE(ptr) \
+ do { \
+ free(ptr); \
+ ptr = NULL; \
+ } while (0)
+
+#undef DEL_EVAS_OBJECT
+#define DEL_EVAS_OBJECT(ptr) \
+ do { \
+ if (ptr) { \
+ evas_object_del(ptr); \
+ ptr = NULL; \
+ } \
+ } while (0)
+
+
+#endif /* __APP_WIDGET_COMMON_DEFINES_H__ */
--- /dev/null
+/*
+ * Samsung API
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+#ifndef __APP_WIDGET_LOG_H__
+#define __APP_WIDGET_LOG_H__
+
+#include <unistd.h>
+#include <dlog.h>
+#include <string.h>
+#include <assert.h>
+
+#define WCOLOR_RED "\033[0;31m"
+#define WCOLOR_GREEN "\033[0;32m"
+#define WCOLOR_BROWN "\033[0;33m"
+#define WCOLOR_BLUE "\033[0;34m"
+#define WCOLOR_PURPLE "\033[0;35m"
+#define WCOLOR_CYAN "\033[0;36m"
+#define WCOLOR_LIGHTBLUE "\033[0;37m"
+#define WCOLOR_END "\033[0;m"
+#define MODULE_INFO (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "APPTRAY_WIDGET"
+
+
+#if !defined(PACKAGE)
+#define PACKAGE "org.example.app-widget"
+#endif
+
+#if !defined(LOGE)
+
+#define LOGE(fmt, arg...) dlog_print(DLOG_DEBUG, \
+ LOG_TAG, "%s: %s(%d) > " WCOLOR_GREEN fmt WCOLOR_END, MODULE_INFO, \
+ __func__, __LINE__, ##arg)
+#endif
+#if !defined(_D)
+
+#define _D(fmt, arg...) dlog_print(DLOG_DEBUG, \
+ LOG_TAG, "%s: %s(%d) > " WCOLOR_GREEN fmt WCOLOR_END, MODULE_INFO, \
+ __func__, __LINE__, ##arg)
+
+#endif
+
+#if !defined(_W)
+#define _W(fmt, arg...) dlog_print(DLOG_WARN, \
+ LOG_TAG, "%s: %s(%d) > " fmt, MODULE_INFO, \
+ __func__, __LINE__, ##arg)
+#endif
+
+#if !defined(_E)
+#define _E(fmt, arg...) dlog_print(DLOG_ERROR, \
+ LOG_TAG, "%s: %s(%d) > " WCOLOR_RED fmt WCOLOR_END, MODULE_INFO, \
+ __func__, __LINE__, ##arg)
+#endif
+
+#define _ENTER \
+ _D("%s - Entry", __func__)
+#define _EXIT \
+ _D("%s - Exit", __func__)
+
+#if !defined(_SD)
+#define _SD(fmt, arg...) dlog_print(DLOG_DEBUG, \
+ LOG_TAG, "%s: %s(%d) > " WCOLOR_GREEN fmt WCOLOR_END, MODULE_INFO, \
+ __func__, __LINE__, ##arg)
+#endif
+
+#if !defined(_SW)
+#define _SW(fmt, arg...) dlog_print(DLOG_WARN, \
+ LOG_TAG, "%s: %s(%d) > " fmt, MODULE_INFO, \
+ __func__, __LINE__, ##arg)
+#endif
+
+#if !defined(_SE)
+#define _SE(fmt, arg...) dlog_print(DLOG_ERROR, \
+ LOG_TAG, "%s: %s(%d) > " WCOLOR_RED fmt WCOLOR_END, MODULE_INFO, \
+ __func__, __LINE__, ##arg)
+#endif
+
+#define retvm_if_timer(timer, expr, val, fmt, arg...) do { \
+ if (expr) { \
+ _E(fmt, ##arg); \
+ _E("(%s) -> %s() return", #expr, __FUNCTION__); \
+ timer = NULL; \
+ return (val); \
+ } \
+} while (0)
+
+#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) { \
+ _E("(%s) -> %s() return", #expr, __FUNCTION__); \
+ return (val); \
+ } \
+} while (0)
+
+#define retm_if(expr, fmt, arg...) do { \
+ if(expr) { \
+ _E(fmt, ##arg); \
+ _E("(%s) -> %s() return", #expr, __FUNCTION__); \
+ return; \
+ } \
+} while (0)
+
+#define ret_if(expr) do { \
+ if(expr) { \
+ _E("(%s) -> %s() return", #expr, __FUNCTION__); \
+ return; \
+ } \
+} while (0)
+
+#define goto_if(expr, val) do { \
+ if(expr) { \
+ _E("(%s) -> goto", #expr); \
+ goto val; \
+ } \
+} while (0)
+
+#define break_if(expr) { \
+ if(expr) { \
+ _E("(%s) -> break", #expr); \
+ break; \
+ } \
+}
+
+#define continue_if(expr) { \
+ if(expr) { \
+ _E("(%s) -> continue", #expr); \
+ continue; \
+ } \
+}
+
+#endif
+++ /dev/null
-/*
- * Samsung API
- * Copyright (c) 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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.
- */
-
-color_classes {
- color_class {
- name: "AO0115";
- color: 0 0 0 200;
- }
- color_class {
- name: "AT0315";
- color: 255 255 255 200;
- }
- color_class {
- name: "AO0342";
- color: 0 0 0 40;
- }
- color_class {
- name: "AO044L1";
- color: 255 255 255 200;
- }
- color_class {
- name: "AO044L1P";
- color: 255 255 255 50;
- }
- color_class {
- name: "AO044L3";
- color: 184 45 45 200;
- }
- color_class {
- name: "AO044L3P";
- color: 184 45 45 200;
- }
- color_class {
- name: "AO044L4";
- color: 0 0 0 35;
- }
- color_class {
- name: "AO071";
- color: 255 255 255 200;
- }
- color_class {
- name: "AO071P";
- color: 255 255 255 50;
- }
- color_class {
- name: "AT039";
- color: 255 255 255 200;
- }
- color_class {
- name: "AO013L1";
- color: 255 106 0 200;
- }
- color_class {
- name: "AO013L2";
- color: 255 255 255 200;
- }
- color_class {
- name: "AO013L3";
- color: 0 0 0 40;
- }
- color_class {
- name: "AT03151";
- color: 255 255 255 200;
- }
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Samsung API
- * Copyright (c) 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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-widget-colorclass.in"
-
-#define WIDGET_W 360
-#define WIDGET_H 360
-#define SHORTCUT_W 100
-#define SHORTCUT_H 100
-
-images {
- image : "widget_shortcut_circle_bg_stroke.png" COMP;
- image : "widget_shortcut_circle_bg.png" COMP;
- image : "widget_shortcut_circle_plus.png" COMP;
-
-// image : "apps_widget_preview_bg_dark.png" COMP;
-// image : "apps_widget_preview_bg_light.png" COMP;
-
- image : "apps_widget_badge_bg.#.png" COMP;
- image : "apps_widget_badge_shadow.#.png" COMP;
- image : "apps_widget_badge_stroke.#.png" COMP;
-}
-
-styles {
- style {
- name: "name_style";
- base: "font=TIZEN:style=Light text_class=AT0315 font_size="24" align=middle color=#FFFFFF color_class=AT0315 ellipsis=1 wrap=mixed";
- }
-}
-
-collections {
- base_scale: 1.3;
- group {
- name: "dbox_bg";
- parts {
- part {
- name: "bg";
- type: RECT;
- mouse_events: 1;
-// clip_to: "bg,clip";
- description {
- state: "default" 0.0;
- rel1 { relative: 0.0 0.0; offset: 0 0; }
- rel2 { relative: 1.0 1.0; offset: 0 0; }
- //image { normal: "apps_widget_preview_bg_dark.png"; }
- color: 0 0 0 255;
- visible: 1;
- }
- description {
- state: "dark_theme" 0.0;
- rel1 { relative: 0.0 0.0; offset: 0 0; }
- rel2 { relative: 1.0 1.0; offset: 0 0; }
- //image { normal: "apps_widget_preview_bg_dark.png"; }
- color: 0 0 0 255;
- visible: 1;
- }
-
- }
- part {
- name: "bg_swallow";
- type: SWALLOW;
- mouse_events: 1;
-// clip_to: "bg,clip";
- description {
- state: "default" 0.0;
- rel1 { relative: 0.5 0.5; to : "bg"; }
- rel2 { relative: 0.5 0.5; to : "bg"; }
- align: 0.5 0.5;
- min : 360 360;
- max : 360 360;
- visible: 1;
- }
- }
- }
- programs{
- program {
- signal: "dark_theme";
- source: "bg";
- action: STATE_SET "dark_theme" 0.0;
- target: "bg";
- }
- }
- }
- group {
- name: "layout";
- parts {
- part {
- name: "bg";
- type: RECT;
- mouse_events: 1;
- description {
- state: "default" 0.0;
- rel1 { relative: 0.0 0.0; offset: 0 0; }
- rel2 { relative: 1.0 1.0; offset: 0 0; }
- color : 0 0 0 0;
- visible: 1;
- }
- }
- part {
- name: "index1";
- type: SWALLOW;
- mouse_events: 1;
- description {
- state: "default" 0.0;
- rel1 {
- relative: 130/WIDGET_W 21/WIDGET_H;
- to : "bg";
- }
- rel2 {
- relative: (130+SHORTCUT_W)/WIDGET_W (21+SHORTCUT_H)/WIDGET_H;
- to : "bg";
- }
- color : 0 0 0 0;
- visible: 1;
- }
- }
- part {
- name: "touch_rect_small_l_on_hold_1";
- type: RECT;
- mouse_events: 1;
- repeat_events: 1;
- ignore_flags: ON_HOLD;
- description {
- state: "default" 0.0;
- rel1 { relative: (90)/WIDGET_W 0.0; to: "bg"; }
- rel2 { relative: (125)/WIDGET_W 100/WIDGET_H; to: "bg";}
- color: 0 0 0 0;
- visible: 1;
- }
- }
- part {
- name: "touch_rect_on_hold_1";
- type: RECT;
- mouse_events: 1;
- repeat_events: 1;
- ignore_flags: ON_HOLD;
- description {
- state: "default" 0.0;
- rel1 { relative: 125/WIDGET_W 0.0; to: "bg"; }
- rel2 { relative: (125+SHORTCUT_W+10)/WIDGET_W 180/WIDGET_H; to: "bg";}
- color: 0 0 0 0;
- visible: 1;
- }
- }
- part {
- name: "touch_rect_small_r_on_hold_1";
- type: RECT;
- mouse_events: 1;
- repeat_events: 1;
- ignore_flags: ON_HOLD;
- description {
- state: "default" 0.0;
- rel1 { relative: (125+SHORTCUT_W+10)/WIDGET_W 0.0; to: "bg"; }
- rel2 { relative: (125+SHORTCUT_W+10+35)/WIDGET_W 100/WIDGET_H; to: "bg";}
- color: 0 0 0 0;
- visible: 1;
- }
- }
- part {
- name: "index2";
- type: SWALLOW;
- mouse_events: 1;
- description {
- state: "default" 0.0;
- rel1 {
- relative: (130+SHORTCUT_W+9)/WIDGET_W (130)/WIDGET_H;
- to : "bg";
- }
- rel2 {
- relative: (130+SHORTCUT_W+9+SHORTCUT_W)/WIDGET_W (130+SHORTCUT_H)/WIDGET_H;
- to : "bg";
- }
- color : 0 0 0 0;
- visible: 1;
- }
- }
- part {
- name: "touch_rect_on_hold_2";
- type: RECT;
- mouse_events: 1;
- repeat_events: 1;
- ignore_flags: ON_HOLD;
- description {
- state: "default" 0.0;
- rel1 { relative: (125+SHORTCUT_W+10)/WIDGET_W 100/WIDGET_H; to: "bg"; }
- rel2 { relative: 1.0 (100+180)/WIDGET_H; to: "bg";}
- color: 0 0 0 0;
- visible: 1;
- }
- }
- part {
- name: "index3";
- type: SWALLOW;
- mouse_events: 1;
- description {
- state: "default" 0.0;
- rel1 {
- relative: (130)/WIDGET_W (219)/WIDGET_H;
- to : "bg";
- }
- rel2 {
- relative: (130+SHORTCUT_W)/WIDGET_W (219+SHORTCUT_H)/WIDGET_H;
- to : "bg";
- }
- color : 0 0 0 0;
- visible: 1;
- }
- }
- part {
- name: "touch_rect_small_l_on_hold_3";
- type: RECT;
- mouse_events: 1;
- repeat_events: 1;
- ignore_flags: ON_HOLD;
- description {
- state: "default" 0.0;
- rel1 { relative: (90)/WIDGET_W 280/WIDGET_H; to: "bg"; }
- rel2 { relative: (125)/WIDGET_W 1.0; to: "bg";}
- color: 0 0 0 0;
- visible: 1;
- }
- }
- part {
- name: "touch_rect_on_hold_3";
- type: RECT;
- mouse_events: 1;
- repeat_events: 1;
- ignore_flags: ON_HOLD;
- description {
- state: "default" 0.0;
- rel1 { relative: 125/WIDGET_W 180/WIDGET_H; to: "bg"; }
- rel2 { relative: (125+SHORTCUT_W+10)/WIDGET_W 1.0; to: "bg";}
- color: 0 0 0 0;
- visible: 1;
- }
- }
- part {
- name: "touch_rect_small_r_on_hold_3";
- type: RECT;
- mouse_events: 1;
- repeat_events: 1;
- ignore_flags: ON_HOLD;
- description {
- state: "default" 0.0;
- rel1 { relative: (125+SHORTCUT_W+10)/WIDGET_W 280/WIDGET_H; to: "bg"; }
- rel2 { relative: (125+SHORTCUT_W+10+35)/WIDGET_W 1.0; to: "bg";}
- color: 0 0 0 0;
- visible: 1;
- }
- }
- part {
- name: "index4";
- type: SWALLOW;
- mouse_events: 1;
- description {
- state: "default" 0.0;
- rel1 {
- relative: (21)/WIDGET_W (130)/WIDGET_H;
- to : "bg";
- }
- rel2 {
- relative: (21+SHORTCUT_W)/WIDGET_W (130+SHORTCUT_H)/WIDGET_H;
- to : "bg";
- }
- color : 0 0 0 0;
- visible: 1;
- }
- }
- part {
- name: "touch_rect_on_hold_4";
- type: RECT;
- mouse_events: 1;
- repeat_events: 1;
- ignore_flags: ON_HOLD;
- description {
- state: "default" 0.0;
- rel1 { relative: 0.0 100/WIDGET_H; to: "bg"; }
- rel2 { relative: (125)/WIDGET_W (100+180)/WIDGET_H; to: "bg";}
- color: 0 0 0 0;
- visible: 1;
- }
- }
- } /*end of parts */
- programs {
- program{
- name: "mouse_clicked_1";
- signal: "mouse,clicked,*";
- source: "touch_rect_on_hold_1";
- action: SIGNAL_EMIT "mouse_clicked_1" "*";
- }
- program{
- name: "mouse_clicked_l_1";
- signal: "mouse,clicked,*";
- source: "touch_rect_small_l_on_hold_1";
- action: SIGNAL_EMIT "mouse_clicked_l_1" "*";
- }
- program{
- name: "mouse_clicked_r_1";
- signal: "mouse,clicked,*";
- source: "touch_rect_small_r_on_hold_1";
- action: SIGNAL_EMIT "mouse_clicked_r_1" "*";
- }
- program{
- name: "mouse_clicked_2";
- signal: "mouse,clicked,*";
- source: "touch_rect_on_hold_2";
- action: SIGNAL_EMIT "mouse_clicked_2" "*";
- }
- program{
- name: "mouse_clicked_3";
- signal: "mouse,clicked,*";
- source: "touch_rect_on_hold_3";
- action: SIGNAL_EMIT "mouse_clicked_3" "*";
- }
- program{
- name: "mouse_clicked_l_3";
- signal: "mouse,clicked,*";
- source: "touch_rect_small_l_on_hold_3";
- action: SIGNAL_EMIT "mouse_clicked_l_3" "*";
- }
- program{
- name: "mouse_clicked_r_3";
- signal: "mouse,clicked,*";
- source: "touch_rect_small_r_on_hold_3";
- action: SIGNAL_EMIT "mouse_clicked_r_3" "*";
- }
- program{
- name: "mouse_clicked_4";
- signal: "mouse,clicked,*";
- source: "touch_rect_on_hold_4";
- action: SIGNAL_EMIT "mouse_clicked_4" "*";
- }
- program{
- name: "mouse_clicked_l_4";
- signal: "mouse,clicked,*";
- source: "touch_rect_small_l_on_hold_4";
- action: SIGNAL_EMIT "mouse_clicked_l_4" "*";
- }
- program{
- name: "mouse_clicked_r_4";
- signal: "mouse,clicked,*";
- source: "touch_rect_small_r_on_hold_4";
- action: SIGNAL_EMIT "mouse_clicked_r_4" "*";
- }
- }
- } /* end of layout group */
- group {
- name: "empty_slot";
- parts {
- part {
- name: "bg";
- type: RECT;
- mouse_events: 1;
- description {
- state: "default" 0.0;
- rel1 { relative: 0.0 0.0; offset: 0 0; }
- rel2 { relative: 1.0 1.0; offset: 0 0; }
- color : 0 0 0 0;
- visible: 1;
- }
- }
- }
- }/* end of slot group */
- group {
- name: "icon_slot";
- parts {
- part {
- name: "bg";
- type: RECT;
- mouse_events: 1;
- description {
- state: "default" 0.0;
- rel1 { relative: 0.0 0.0; offset: 0 0; }
- rel2 { relative: 1.0 1.0; offset: 0 0; }
- color : 0 0 0 0;
- visible: 1;
- }
- }
- part{
- name: "default";
- type: RECT;
- description {
- state: "default" 0.0;
- color: 0 0 0 0;
- perspective.zplane:0;
- }
- }
- part{
- name: "zoom_1/2";
- type: RECT;
- description {
- state: "default" 0.0;
- color: 0 0 0 0;
- perspective.zplane:-500;
- }
- }
- part {
- name: "icon";
- type: SWALLOW;
- clip_to: "clipper";
- scale: 1;
- mouse_events: 1;
- description {
- state: "default" 0.0;
- rel1 { relative: 0.0 0.0; to: "bg"; }
- rel2 { relative: 1.0 1.0; to: "bg"; }
- min : 100 100;
- max : 100 100;
-// color : 255 255 255 255;
- visible: 1;
- /*map{
- on:1;
- perspective: "default";
- }*/
- }
- description{
- state: "glow" 0.0;
- inherit: "default";
-// color: 255 255 255 50;
- /* map{
- perspective: "zoom_1/2";
- }*/
- }
- }
- part{
- name: "name";
- type: TEXTBLOCK;
- mouse_events : 0;
- description {
- state: "default" 0.0;
- rel1 {
- relative: 0.0 1.0;
- to : "icon";
- offset: 0 18;
- }
- rel2 {
- relative: 1.0 1.0;
- to : "icon";
- offset: 0 18;
- }
- fixed : 0 1;
- color_class: "AT0315";
- align: 0.5 0.5;
- min : 100 32;
- max : 100 32;
- text {
- style: "name_style";
- align: 0.5 0.5;
- }
- visible : 1;
- }
- }
- part {
- name: "badge_bg";
- type: IMAGE;
- scale: 1;
- description {
- state: "default" 0.0;
- rel1 { relative: 1.0 0.0; to: "icon"; offset: -12 10; }
- rel2 { relative: 1.0 0.0; to: "icon"; offset: -12 10; }
- image { normal: "apps_widget_badge_bg.#.png"; }
- fixed: 1 1;
- color_class: "AO013L1";
- min : 54 54;
- visible: 0;
- }
- description {
- state: "1" 0.0;
- rel1 { relative: 1.0 0.0; to: "icon"; offset: -12 10; }
- rel2 { relative: 1.0 0.0; to: "icon"; offset: -12 10; }
- image { normal: "apps_widget_badge_bg.#.png"; }
- fixed: 1 1;
- color_class: "AO013L1";
- min : 54 54;
- visible: 1;
- }
- description {
- state: "2" 0.0;
- rel1 { relative: 1.0 0.0; to: "icon"; offset: -20 10; }
- rel2 { relative: 1.0 0.0; to: "icon"; offset: -20 10; }
- image { normal: "apps_widget_badge_bg.#.png"; }
- fixed: 1 1;
- color_class: "AO013L1";
- min : 70 54;
- visible: 1;
- }
- description {
- state: "3" 0.0;
- rel1 { relative: 1.0 0.0; to: "icon"; offset: -26 10; }
- rel2 { relative: 1.0 0.0; to: "icon"; offset: -26 10; }
- image { normal: "apps_widget_badge_bg.#.png"; }
- fixed: 1 1;
- color_class: "AO013L1";
- min : 82 54;
- visible: 1;
- }
- description {
- state: "3r" 0.0;
- rel1 { relative: 1.0 0.0; to: "icon"; offset: -26 10; }
- rel2 { relative: 1.0 0.0; to: "icon"; offset: -26 10; }
- image { normal: "apps_widget_badge_bg.#.png"; }
- fixed: 1 1;
- color_class: "AO013L1";
- min : 82 54;
- visible: 1;
- }
- }
- part {
- name: "badge_stroke";
- type: IMAGE;
- scale: 1;
- description {
- state: "default" 0.0;
- rel1 { relative: 1.0 0.0; to: "icon"; offset: -12 10; }
- rel2 { relative: 1.0 0.0; to: "icon"; offset: -12 10; }
- image { normal: "apps_widget_badge_stroke.#.png"; }
- fixed: 1 1;
- color_class: "AO013L2";
- min : 54 54;
- visible: 0;
- }
- description {
- state: "1" 0.0;
- rel1 { relative: 1.0 0.0; to: "icon"; offset: -12 10; }
- rel2 { relative: 1.0 0.0; to: "icon"; offset: -12 10; }
- image { normal: "apps_widget_badge_stroke.#.png"; }
- fixed: 1 1;
- color_class: "AO013L2";
- min : 54 54;
- visible: 1;
- }
- description {
- state: "2" 0.0;
- rel1 { relative: 1.0 0.0; to: "icon"; offset: -20 10; }
- rel2 { relative: 1.0 0.0; to: "icon"; offset: -20 10; }
- image { normal: "apps_widget_badge_stroke.#.png"; }
- fixed: 1 1;
- color_class: "AO013L2";
- min : 70 54;
- visible: 1;
- }
- description {
- state: "3" 0.0;
- rel1 { relative: 1.0 0.0; to: "icon"; offset: -26 10; }
- rel2 { relative: 1.0 0.0; to: "icon"; offset: -26 10; }
- image { normal: "apps_widget_badge_stroke.#.png"; }
- fixed: 1 1;
- color_class: "AO013L2";
- min : 82 54;
- visible: 1;
- }
- description {
- state: "3r" 0.0;
- rel1 { relative: 1.0 0.0; to: "icon"; offset: -26 10; }
- rel2 { relative: 1.0 0.0; to: "icon"; offset: -26 10; }
- image { normal: "apps_widget_badge_stroke.#.png"; }
- fixed: 1 1;
- color_class: "AO013L2";
- min : 82 54;
- visible: 1;
- }
- }
- part {
- name: "badge_shadow";
- type: IMAGE;
- scale: 1;
- description {
- state: "default" 0.0;
- rel1 { relative: 1.0 0.0; to: "icon"; offset: -12 10; }
- rel2 { relative: 1.0 0.0; to: "icon"; offset: -12 10; }
- image { normal: "apps_widget_badge_shadow.#.png"; }
- fixed: 1 1;
- color_class: "AO013L3";
- min : 54 54;
- visible: 0;
- }
- description {
- state: "1" 0.0;
- rel1 { relative: 1.0 0.0; to: "icon"; offset: -12 10; }
- rel2 { relative: 1.0 0.0; to: "icon"; offset: -12 10; }
- image { normal: "apps_widget_badge_shadow.#.png"; }
- fixed: 1 1;
- color_class: "AO013L3";
- min : 54 54;
- visible: 1;
- }
- description {
- state: "2" 0.0;
- rel1 { relative: 1.0 0.0; to: "icon"; offset: -20 10; }
- rel2 { relative: 1.0 0.0; to: "icon"; offset: -20 10; }
- image { normal: "apps_widget_badge_shadow.#.png"; }
- fixed: 1 1;
- color_class: "AO013L3";
- min : 70 54;
- visible: 1;
- }
- description {
- state: "3" 0.0;
- rel1 { relative: 1.0 0.0; to: "icon"; offset: -26 10; }
- rel2 { relative: 1.0 0.0; to: "icon"; offset: -26 10; }
- image { normal: "apps_widget_badge_shadow.#.png"; }
- fixed: 1 1;
- color_class: "AO013L3";
- min : 82 54;
- visible: 1;
- }
- description {
- state: "3r" 0.0;
- rel1 { relative: 1.0 0.0; to: "icon"; offset: -26 10; }
- rel2 { relative: 1.0 0.0; to: "icon"; offset: -26 10; }
- image { normal: "apps_widget_badge_shadow.#.png"; }
- fixed: 1 1;
- color_class: "AO013L3";
- min : 82 54;
- visible: 1;
- }
- }
- part {
- name: "badge_txt";
- type: TEXT;
- scale: 1;
- mouse_events: 0;
- description {
- state: "default" 0.0;
- rel1 { relative: 0.5 0.5; to, "badge_bg"; offset: 0 -2; }
- rel2 { relative: 0.5 0.5; to, "badge_bg"; offset: 0 -2; }
- align: 0.5 0.5;
- color_class: "AT039";
- text {
- text_class: "AT039";
- align: 0.5 0.5;
- min: 1 1;
- }
- fixed: 1 1;
- visible: 0;
- }
- description {
- state: "1" 0.0;
- inherit: "default" 0.0;
- visible: 1;
- }
- description {
- state: "2" 0.0;
- inherit: "1" 0.0;
- }
- description {
- state: "3" 0.0;
- inherit: "1" 0.0;
- }
- description {
- state: "3r" 0.0;
- inherit: "1" 0.0;
- }
- }
- part {
- name: "clipper";
- type: RECT;
- scale: 1;
- mouse_events: 1;
- description {
- state: "default" 0.0;
- rel1 { relative: 0.0 0.0; to: "icon"; }
- rel2 { relative: 1.0 1.0; to: "icon"; }
- color : 255 255 255 255;
- visible: 1;
- }
- description {
- state: "glow" 0.0;
- rel1 { relative: 0.0 0.0; to: "icon"; }
- rel2 { relative: 1.0 1.0; to: "icon"; }
- color : 255 255 255 50;
- visible: 1;
- }
- }
- part {
- name: "touch_rect_on_hold";
- type: RECT;
- mouse_events: 1;
- repeat_events: 1;
- ignore_flags: ON_HOLD;
- description {
- state: "default" 0.0;
- rel1 { relative: 0.0 0.0; to: "bg"; }
- rel2 { relative: 1.0 1.0; to: "bg"; offset: 0 35;}
- color: 0 0 0 0;
- visible: 1;
- }
- }
- part {
- name: "touch_rect";
- type: RECT;
- mouse_events: 1;
- repeat_events: 1;
- description {
- state: "default" 0.0;
- rel1 { relative: 0.0 0.0; to: "bg"; }
- rel2 { relative: 1.0 1.0; to: "bg"; offset: 0 35;}
- color: 0 0 0 0;
- visible: 1;
- }
- }
- }
- programs {
- program{
- name : "launch_effect";
- signal : "launch_effect";
- source : "widget";
- action : STATE_SET "glow" 0.0;
- //target : "icon";
- target : "clipper";
- //transition : DECEL_FAC 0.7 0.8;
- //transition : ACCEL 0.1;
- transition : ACCEL 0.3;
- after: "complete,launch_effect";
- }
- program{
- name : "complete_effect";
- signal : "complete_effect";
- source : "widget";
- action : STATE_SET "default" 0.0;
- //target : "icon";
- target : "clipper";
- //transition : SPRING 0.3 1 1;
- //transition : BOUNCE 0.4 0.0 2;
- //transition : LINEAR 0.5;
- transition : DECEL 0.5;
- }
- program{
- name: "complete,launch_effect";
- signal: "complete,launch_effect";
- source: "widget";
- action: SIGNAL_EMIT "complete,launch_effect" "event";
- }
- program{
- name: "mouse_down";
- signal: "mouse,down,*";
- source: "touch_rect";
- action: SIGNAL_EMIT "mouse_down" "*";
- }
- program{
- name: "mouse_up";
- signal: "mouse,up,*";
- source: "touch_rect";
- action: SIGNAL_EMIT "mouse_up" "*";
- }
- program{
- name: "mouse_clicked";
- signal: "mouse,clicked,*";
- source: "touch_rect_on_hold";
- action: SIGNAL_EMIT "mouse_clicked" "*";
- }
- // Badge
- program {
- signal: "badge,on,1";
- source: "slot";
- action: STATE_SET "1" 0.0;
- target: "badge_shadow";
- target: "badge_stroke";
- target: "badge_txt";
- target: "badge_bg";
- }
- program {
- signal: "badge,on,2";
- source: "slot";
- action: STATE_SET "2" 0.0;
- target: "badge_shadow";
- target: "badge_stroke";
- target: "badge_txt";
- target: "badge_bg";
- }
- program {
- signal: "badge,on,3";
- source: "slot";
- action: STATE_SET "3" 0.0;
- target: "badge_shadow";
- target: "badge_stroke";
- target: "badge_txt";
- target: "badge_bg";
- }
- program {
- signal: "badge,on,3r";
- source: "slot";
- action: STATE_SET "3r" 0.0;
- target: "badge_shadow";
- target: "badge_stroke";
- target: "badge_txt";
- target: "badge_bg";
- }
- program {
- signal: "badge,off";
- source: "slot";
- action: STATE_SET "default" 0.0;
- target: "badge_shadow";
- target: "badge_stroke";
- target: "badge_txt";
- target: "badge_bg";
- }
- }
- }/* end of slot group */
- group {
- name: "icon_slot_apps";
- parts {
- part {
- name: "bg";
- type: RECT;
- mouse_events: 1;
- description {
- state: "default" 0.0;
- rel1 { relative: 0.0 0.0; offset: 0 0; }
- rel2 { relative: 1.0 1.0; offset: 0 0; }
- color : 0 0 0 0;
- visible: 1;
- }
- }
- part{
- name: "default";
- type: RECT;
- description {
- state: "default" 0.0;
- color: 0 0 0 0;
- perspective.zplane:0;
- }
- }
- part{
- name: "zoom_1/2";
- type: RECT;
- description {
- state: "default" 0.0;
- color: 0 0 0 0;
- perspective.zplane:-500;
- }
- }
- part {
- name: "icon";
- type: SWALLOW;
- clip_to: "clipper";
- scale: 1;
- mouse_events: 1;
- description {
- state: "default" 0.0;
- rel1 { relative: 0.0 0.0; to: "bg"; }
- rel2 { relative: 1.0 1.0; to: "bg"; }
- min : 100 100;
- max : 100 100;
-// color : 255 255 255 255;
- visible: 1;
- /*map{
- on:1;
- perspective: "default";
- }*/
- }
- description{
- state: "glow" 0.0;
- inherit: "default";
-// color: 255 255 255 50;
- /* map{
- perspective: "zoom_1/2";
- }*/
- }
- }
- part {
- name: "clipper";
- type: RECT;
- scale: 1;
- mouse_events: 1;
- description {
- state: "default" 0.0;
- rel1 { relative: 0.0 0.0; to: "icon"; }
- rel2 { relative: 1.0 1.0; to: "icon"; }
- color : 255 255 255 255;
- visible: 1;
- }
- description {
- state: "glow" 0.0;
- rel1 { relative: 0.0 0.0; to: "icon"; }
- rel2 { relative: 1.0 1.0; to: "icon"; }
- color : 255 255 255 50;
- visible: 1;
- }
- }
- part {
- name: "touch_rect";
- type: RECT;
- mouse_events: 1;
- repeat_events: 1;
- description {
- state: "default" 0.0;
- rel1 { relative: 0.0 0.0; to: "bg"; }
- rel2 { relative: 1.0 1.0; to: "bg"; }
- color: 0 255 0 255;
- visible: 1;
- }
- }
- }
- programs {
- program{
- name : "launch_effect";
- signal : "launch_effect";
- source : "widget";
- action : STATE_SET "glow" 0.0;
- //target : "icon";
- target : "clipper";
- //transition : DECEL_FAC 0.7 0.8;
- //transition : ACCEL 0.1;
- transition : ACCEL 0.3;
- after: "complete,launch_effect";
- }
- program{
- name : "complete_effect";
- signal : "complete_effect";
- source : "widget";
- action : STATE_SET "default" 0.0;
- //target : "icon";
- target : "clipper";
- //transition : SPRING 0.3 1 1;
- //transition : BOUNCE 0.4 0.0 2;
- //transition : LINEAR 0.5;
- transition : DECEL 0.5;
- }
- program{
- name: "complete,launch_effect";
- signal: "complete,launch_effect";
- source: "widget";
- action: SIGNAL_EMIT "complete,launch_effect" "event";
- }
- program{
- name: "mouse_down";
- signal: "mouse,down,*";
- source: "touch_rect";
- action: SIGNAL_EMIT "mouse_down" "*";
- }
- program{
- name: "mouse_up";
- signal: "mouse,up,*";
- source: "touch_rect";
- action: SIGNAL_EMIT "mouse_up" "*";
- }
- program{
- name: "mouse_clicked";
- signal: "mouse,clicked,*";
- source: "touch_rect";
- action: SIGNAL_EMIT "mouse_clicked" "*";
- }
- }
- }/* end of slot group */
-}/* end of collections */
--- /dev/null
+/*
+ * Samsung API
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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 "../../edc/apptray_widget_color_class.edc"
+#include "../../edc/apptray_widget_common_defines.edc"
+
+collections {
+ base_scale: 1.3;
+ #include "../../edc/apptray_widget_main_ly.edc"
+ #include "../../edc/apptray_widget_slot_ly.edc"
+}
+++ /dev/null
-/*
- * Samsung API
- * Copyright (c) 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 <Evas.h>
-#include <Elementary.h>
-#include <dlog.h>
-#include <widget_service.h>
-#include <widget_errno.h>
-#include <app_control.h>
-
-#include <pkgmgr-info.h>
-#include <package-manager.h>
-#include <aul.h>
-
-
-#include <badge.h>
-#include "app-widget_log.h"
-
-#ifndef TELEPHONY_DISABLE
-#include <feedback.h>
-#endif
-
-#include <unicode/unum.h>
-#include <unicode/ustring.h>
-
-#include "app-widget.h"
-#include <app_preference.h>
-
-#define PATH_MAX 4096 /* # chars in a path name including nul */
-
-#define PUBLIC __attribute__((visibility("default")))
-#define EDJE_FILE "edje/app_shortcut.edj"
-#define DEFAULT_ICON "images/unknown.png"
-#define SCHEDULE_ICON "res/schedule_%s.png"
-#define SCHEDULE_ICON_ARABIC "res/schedule_arabic_%s.png"
-#define LANGUAGE_ARABIC "ar"
-
-#define MESSAGE_PKG "org.tizen.message"
-#define WHOME_PKG "org.tizen.w-home"
-#define APPS_PKG "org.tizen.apptray-widget-app"
-#define APPS_WIDGET "org.tizen.apptray-widget"
-#define VCONFKEY_WMS_HOST_STATUS_VENDOR "db/wms/host_status/vendor"
-#define APP_TYPE_WGT "wgt"
-#define APP_WIDGET_CONTENT_KEY "org.tizen.apptray-widget"
-#define APP_LAUNCH_KEY "launch_apps"
- #define WHOME_APP_CONTROL "home_op"
-
-#define DEFAULT_APP_ORDER "org.tizen.apptray-widget-app empty org.tizen.watch-setting empty"
-#define BADGE_SIGNAL_LEN 16
-#define MAX_BADGE_COUNT 999
-#define SHORTCUT_W 123
-#define SHORTCUT_H 123
-
-
-static Eina_List *s_list;
-Eina_List *font_theme;
-Elm_Theme *theme;
-char *icon_path;
-struct info {
- char* id;
- char *content;
- int size_type;
- int w;
- int h;
- Evas_Object *dbox_win;
- Evas_Object *bg;
- Evas_Object *layout;
- struct object_info *obj[5];
- int need_to_delete;
- int first_loaded;
-};
-
-struct object_info {
- char *appid;
- char *icon;
- char *label;
- char *pkgid;
- char* dbox_id;
- int open_app;
- int index;
- Evas_Object *obj;
-};
-
-
-
-
-
-
-
-void item_badge_unregister_changed_cb(void);
-static void _set_app_slot(struct info *item, const char *appid, int pos);
-
-
-static void _get_resource(const char *file_in, char *file_path_out, int file_path_max)
-{
- _ENTER;
- char *res_path = app_get_resource_path();
- if (res_path) {
- snprintf(file_path_out, file_path_max, "%s%s", res_path, file_in);
- free(res_path);
- }
-}
-
-
-static inline struct info *find_item(char* id)
-{
- _ENTER;
- struct info *item=NULL;
-
- Eina_List *l;
-
- EINA_LIST_FOREACH(s_list, l, item) {
- _D("item->id:%s,id:%s",item->id,id);
- if (!strncmp(item->id, id, strlen(id))) {
- return item;
- }
- }
- return item;
-}
-
-PUBLIC int widget_update_content(const char* id);
-
-
-void preference_changed_cb_impl(const char *key, void *user_data)
-{
- _ENTER;
- char *id= *((char**)user_data);
- _D("id:%s, key:%s",id,key);
- struct info *item;
- if(!id)
- {
- _E("id is null");
- return;
- }
- item = find_item((char*)id);
- if (!item) {
- _E("id is invalid");
- _E("item is not found");
- return;
- }
- _D("before content: %s",item->content);
- preference_get_string(APP_WIDGET_CONTENT_KEY, &item->content);
-
- _D("after content: %s",item->content);
-
- widget_update_content((const char *)id);
-
- _EXIT;
-}
-
-
-bool _is_arabic(const char *lang){
- _ENTER;
- char lang_tmp[10] = { 0, };
- char ar[3] = { 0, };
- int i = 0;
- strncpy(lang_tmp, lang,sizeof(lang_tmp));
-
- for(i = 0 ; i < 2; i++){
- ar[i] = lang_tmp[i];
- }
- ar[2] = '\0';
-
- if (!strncmp(ar, LANGUAGE_ARABIC, strlen(LANGUAGE_ARABIC))) {
- return true;
- }else{
- return false;
- }
-}
-
-static void _init_theme(void)
-{
- _ENTER;
- theme = elm_theme_new();
-
-}
-
-
-
-static void _fini_theme(void)
-{
- _ENTER;
- elm_theme_free(theme);
- theme = NULL;
-
-}
-
-#define LOCALE_LEN 32
-char *util_get_count_str_from_icu(int count)
-{
- _ENTER;
- char *p = NULL;
- char *locale_tmp = NULL;
- char *ret_str = NULL;
- char locale[LOCALE_LEN] = { 0, };
- char res[LOCALE_LEN] = { 0, };
-
-
- strncpy(locale, locale_tmp,sizeof(locale));
- free(locale_tmp);
-
- if(locale[0] != '\0') {
- p = strstr(locale, ".UTF-8");
- if (p) *p = 0;
- }
-
- ret_str = strdup(res);
- return ret_str;
-}
-PUBLIC int widget_initialize(const char *pkgname)
-{
- _ENTER;
- _D("dbox initialized");
-
- return 0;
-}
-
-PUBLIC int widget_finalize(void)
-{
- _ENTER;
- _D("dbox finalized");
-
- _fini_theme();
- return 0;
-}
-
-
-// NOTE: This function is going to be invoked for release all resources
-static int widget_destroy(char* id, widget_app_destroy_type_e reason, bundle *content, void *user_data)
-{
- _ENTER;
- struct info *item;
- _D("[%s:%d]\n", __func__, __LINE__);
-
- item = find_item((char *)id);
- if (!item) {
- /*!
- * \NOTE
- * EXCEPTIONAL CASES
- */
- _E("id is invalid");
- return WIDGET_ERROR_NOT_EXIST;
- }
- if(!item->need_to_delete){
- _E("dbox didn't receive the DELETE event");
- if (item->dbox_win) {
- evas_object_del(item->dbox_win);
- }
- return WIDGET_ERROR_NONE;
- }
-
- s_list = eina_list_remove(s_list, item);
-
- /* NOTE: You have to clear all resource which are related with
- * current instance. If you didn't clear it correctly,
- * the live data provider will get suffer from the memory
- * pressure. therefore, keep trace on your resources.
- */
- if (item->dbox_win) {
- evas_object_del(item->dbox_win);
- }
- item->first_loaded = 0;
- item->w= item->h=0;
- free(item->content);
- free(item->id);
- free(item);
- preference_unset_changed_cb(APP_WIDGET_CONTENT_KEY);
- return WIDGET_ERROR_NONE;
-}
-
-PUBLIC int widget_need_to_update(const char* id)
-{
- _ENTER;
- struct info *item;
-
- _D("[%s]\n", id);
-
- item = find_item((char *)id);
- if (!item) {
-
- _E("id is invalid");
- return WIDGET_ERROR_NOT_EXIST;
- }
-
- return 0;
-}
-
-static void _glow_effect_done(void *data, Evas_Object *o, const char *emission, const char *source)
-{
- _ENTER;
-
- elm_object_signal_emit((Evas_Object *)data, "complete_effect", "widget");
-}
-
-void app_shortcut_remove_package(const char *package){
- _ENTER;
- _D("remove %s", package);
- Eina_List *l;
- struct info *item;
- int update = 0;
- char content[255] = {0};
- int i = 0;
-
- EINA_LIST_FOREACH(s_list, l, item) {
- for(i = 0 ; i < 4 ; i++){
- if(strcmp(item->obj[i]->appid, "empty")){
- if(!strcmp(item->obj[i]->pkgid, package)){
- update = 1;
- _set_app_slot(item, "empty", i);
- }
- }
- }
- if(update){
- snprintf(content, sizeof(content)-1, "%s %s %s %s", item->obj[0]->appid, item->obj[1]->appid, item->obj[2]->appid, item->obj[3]->appid);
- free(item->content);
- item->content = NULL;
- item->content = strdup(content);
- update = 0;
- }
- }
-}
-
-int item_badge_count(struct object_info *item)
-{
- _ENTER;
- unsigned int is_display = 0;
- unsigned int count = 0;
- badge_error_e err = BADGE_ERROR_NONE;
-
- retv_if(!item, 0);
-
- err = badge_get_display(item->appid, &is_display);
- _D("badge_get_display err:%d",err);
- if (BADGE_ERROR_NONE != err) _E("cannot get badge display");
-
- if (!is_display) return 0;
-
- err = badge_get_count(item->appid, &count);
- if (BADGE_ERROR_NONE != err) _E("cannot get badge count");
-
- _D("Badge for app %s : %u", item->appid, count);
- _EXIT;
- return (int) count;
-}
-
-void item_badge_show(struct object_info *item, int count)
-{
- _ENTER;
- char *str = NULL;
- char badge_signal[16];
-
- ret_if(!item);
-
- if (count > MAX_BADGE_COUNT) count = MAX_BADGE_COUNT;
-
- str = util_get_count_str_from_icu(count);
- elm_object_part_text_set(item->obj, "badge_txt", str);
-
- if (count <= 0) {
- snprintf(badge_signal, sizeof(badge_signal), "badge,off");
- } else if (count < 10) {
- snprintf(badge_signal, sizeof(badge_signal), "badge,on,1");
- } else if (count < 100) {
- snprintf(badge_signal, sizeof(badge_signal), "badge,on,2");
- } else {
- int nRightPos = ((item->index) == 2);
- _D("nRightPos : %d", nRightPos);
- if(nRightPos) {
- snprintf(badge_signal, sizeof(badge_signal), "badge,on,3r");
- }
- else {
- snprintf(badge_signal, sizeof(badge_signal), "badge,on,3");
- }
- }
- elm_object_signal_emit(item->obj, badge_signal, "slot");
-
- free(str);
-}
-
-void item_badge_hide(struct object_info *item)
-{
- _ENTER;
- ret_if(!item);
-
- elm_object_signal_emit(item->obj, "badge,off", "slot");
-}
-
-
-static void _badge_change_cb(unsigned int action, const char *appid, unsigned int count, void *data)
-{
- _ENTER;
- unsigned int is_display = 0;
- badge_error_e err = BADGE_ERROR_NONE;
- int i = 0;
-
- _D("Badge changed, action : %u, appid : %s, count : %u", action, appid, count);
-
- ret_if(!appid);
-
- if (BADGE_ACTION_REMOVE == action) {
- count = 0;
- is_display = 0;
- } else {
- err = badge_get_display(appid, &is_display);
- if (BADGE_ERROR_NONE != err) _E("cannot get badge display");
- if (!is_display) count = 0;
- }
-
- Eina_List *l;
- struct info *item;
-
- EINA_LIST_FOREACH(s_list, l, item) {
- for(i = 0 ; i < 4 ; i++){
- if(!strcmp(item->obj[i]->appid, appid)){
- if (count) item_badge_show(item->obj[i], count);
- else item_badge_hide(item->obj[i]);
- }
- }
- }
-}
-
-
-void item_badge_register_changed_cb(void)
-{
- _ENTER;
- badge_error_e err;
-
- err = badge_register_changed_cb(_badge_change_cb, NULL);
- ret_if(BADGE_ERROR_NONE != err);
-}
-
-void item_badge_unregister_changed_cb(void)
-{
- _ENTER;
- badge_error_e err;
-
- err = badge_unregister_changed_cb(_badge_change_cb);
- ret_if(BADGE_ERROR_NONE != err);
-}
-
-
-static void _slot_l_mouse_clicked_cb(void *data, Evas_Object *o, const char *emission, const char *source){
- _D("icon clicked");
- _ENTER;
-}
-
-static void _slot_r_mouse_clicked_cb(void *data, Evas_Object *o, const char *emission, const char *source){
- _D("icon clicked");
- _ENTER;
-}
-
-static void _slot_mouse_clicked_cb(void *data, Evas_Object *o, const char *emission, const char *source){
- _D("icon clicked");
- _ENTER;
-
- struct object_info *info = NULL;
- info = data;
- if(!strcmp(info->appid, APPS_PKG)){
- app_control_h service = NULL;
- char *type = APP_LAUNCH_KEY;
-
- ret_if(APP_CONTROL_ERROR_NONE != app_control_create(&service));
- ret_if(NULL == service);
-
- app_control_set_operation(service, APP_CONTROL_OPERATION_DEFAULT);
- app_control_set_app_id(service, WHOME_PKG);
- app_control_add_extra_data(service, WHOME_APP_CONTROL, type);
-
- int ret = app_control_send_launch_request(service, NULL, NULL);
- _D("Send Launch Request = %d", ret);
- if (APP_CONTROL_ERROR_NONE != ret) {
- LOGE("error");
- app_control_destroy(service);
- return;
- }
-
- app_control_destroy(service);
- }
- else{
- _D("launch %s", info->appid);
- if(info->open_app){
- _D("launch wgt");
- int ret_aul = aul_open_app(info->appid);
- if (ret_aul < AUL_R_OK) {
- _E("wgt launch failed");
- return;
- }
- }
- else{
- _D("launch normal");
- app_control_h service = NULL;
-
- ret_if(APP_CONTROL_ERROR_NONE != app_control_create(&service));
- ret_if(NULL == service);
-
- app_control_set_operation(service, APP_CONTROL_OPERATION_MAIN);
-
- app_control_set_app_id(service, info->appid);
-
-
- int ret = app_control_send_launch_request(service, NULL, NULL);
- if (APP_CONTROL_ERROR_NONE != ret) {
- LOGE("error");
- app_control_destroy(service);
- return;
- }
-
- app_control_destroy(service);
- }
- }
-
-}
-
-char *_get_date(void)
-{
- _ENTER;
- struct tm st;
- time_t tt = time(NULL);
- localtime_r(&tt, &st);
-
- char str_date[5] = {0,};
- char *date = NULL;
-
- snprintf(str_date, sizeof(str_date), "%d", st.tm_mday);
-
- date = strdup(str_date);
-
- return date;
-}
-
-static void _slot_mouse_down_cb(void *data, Evas_Object *o, const char *emission, const char *source){
- _D("icon mouse down");
- _ENTER;
- evas_object_color_set((Evas_Object *)data, 255, 255, 255, 127);
-}
-
-static void _slot_mouse_up_cb(void *data, Evas_Object *o, const char *emission, const char *source){
- _D("icon mouse up");
- _ENTER;
- evas_object_color_set((Evas_Object *)data, 255, 255, 255, 255);
-}
-
-
-
-static void _set_app_slot(struct info *item, const char *appid, int pos){
- _ENTER;
- _D("%s %s", appid, item->obj[pos]->appid);
-
- if(!appid){
- _E("appid is null");
- return;
- }
- if(!strcmp(appid, item->obj[pos]->appid)){
- _D("appid is same, no need to update");
- return;
- }else{
- _D("need to update slot%d", pos+1);
- int ret = 0;
- int badge_count = 0;
- Evas_Object *slot = NULL;
- Evas_Object *icon = NULL;
- pkgmgrinfo_appinfo_h appinfo_h = NULL;
- pkgmgrinfo_pkginfo_h pkghandle = NULL;
- char *pkgid = NULL;
-
- /*unset pre slot item */
- char index[10] = {0};
- snprintf(index, sizeof(index)-1, "index%d", pos+1);
- char signal[20] = {0,};
- snprintf(signal, sizeof(signal), "mouse_clicked_%d", pos+1);
- char signal_l[30] = {0,};
- snprintf(signal_l, sizeof(signal_l), "mouse_clicked_l_%d", pos+1);
- char signal_r[30] = {0,};
- snprintf(signal_r, sizeof(signal_r), "mouse_clicked_r_%d", pos+1);
- elm_object_part_content_unset(item->layout, index);
- if(item->obj[pos]->obj)
- evas_object_del(item->obj[pos]->obj);
- item->obj[pos]->obj = NULL;
-
- /*set new slot */
- item->obj[pos]->appid = strdup(appid);
-
- if(!strcmp(appid, "empty")){
- _W("let it empty slot");
- elm_object_signal_callback_del(item->layout, signal, "*", _slot_mouse_clicked_cb);
- elm_object_signal_callback_del(item->layout, signal_l, "*", _slot_l_mouse_clicked_cb);
- elm_object_signal_callback_del(item->layout, signal_r, "*", _slot_r_mouse_clicked_cb);
- return;
- }
- slot = elm_layout_add(item->layout);
- item->obj[pos]->obj = slot;
- char full_path[PATH_MAX] = { 0, };
- _get_resource(EDJE_FILE, full_path, sizeof(full_path));
- _D("full_path:%s",full_path);
- ret = elm_layout_file_set(slot, full_path, "icon_slot");
- if(ret == EINA_FALSE){
- _E("failed to set empty slot");
- elm_object_signal_callback_del(item->layout, signal, "*", _slot_mouse_clicked_cb);
- elm_object_signal_callback_del(item->layout, signal_l, "*", _slot_l_mouse_clicked_cb);
- elm_object_signal_callback_del(item->layout, signal_r, "*", _slot_r_mouse_clicked_cb);
- return;
- }
-
- evas_object_size_hint_weight_set(slot, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_resize(slot, SHORTCUT_W, SHORTCUT_H);
- elm_object_part_content_set(item->layout, index, slot);
- evas_object_show(slot);
-
- char *label = NULL;
- ret = pkgmgrinfo_appinfo_get_appinfo(appid, &appinfo_h);
- if(ret != PMINFO_R_OK){
- _E("get appinfo failed. let it empty slot, %d", ret);
- elm_object_signal_callback_del(item->layout, signal, "*", _slot_mouse_clicked_cb);
- elm_object_signal_callback_del(item->layout, signal_l, "*", _slot_l_mouse_clicked_cb);
- elm_object_signal_callback_del(item->layout, signal_r, "*", _slot_r_mouse_clicked_cb);
- item->obj[pos]->appid = strdup("empty");
- return;
- }
-
- if(PMINFO_R_OK != pkgmgrinfo_appinfo_get_pkgid(appinfo_h, &pkgid)){
- _E("get pkgid failed. let it empty slot");
- elm_object_signal_callback_del(item->layout, signal, "*", _slot_mouse_clicked_cb);
- elm_object_signal_callback_del(item->layout, signal_l, "*", _slot_l_mouse_clicked_cb);
- elm_object_signal_callback_del(item->layout, signal_r, "*", _slot_r_mouse_clicked_cb);
- item->obj[pos]->appid = strdup("empty");
- return;
- }
- item->obj[pos]->pkgid = strdup(pkgid);
-
- if(0 > pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &pkghandle)){
- _E("get pkghandle faile.");
- elm_object_signal_callback_del(item->layout, signal, "*", _slot_mouse_clicked_cb);
- elm_object_signal_callback_del(item->layout, signal_l, "*", _slot_l_mouse_clicked_cb);
- elm_object_signal_callback_del(item->layout, signal_r, "*", _slot_r_mouse_clicked_cb);
- item->obj[pos]->appid = strdup("empty");
- return;
- }
- if(PMINFO_R_OK != pkgmgrinfo_appinfo_get_label(appinfo_h, &label)){
- _E("get label failed");
- item->obj[pos]->label = strdup("");
- }
- else{
- item->obj[pos]->label = strdup(label);
- }
- elm_object_part_text_set(slot, "name", label);
-
- char *type = NULL;
- if(PMINFO_R_OK != pkgmgrinfo_pkginfo_get_type(pkghandle, &type)){
- _E("get app type failed");
- }
- if (type) {
- if (!strncmp(type, APP_TYPE_WGT, strlen(APP_TYPE_WGT))) {
- item->obj[pos]->open_app = 1;
- } else {
- item->obj[pos]->open_app = 0;
- }
- }
-
- _W("%s", appid);
- char *icon_path_tmp = NULL;
- if(PMINFO_R_OK != pkgmgrinfo_appinfo_get_icon(appinfo_h, &icon_path_tmp)){
- _E("get icon path failed");
- }
- if (icon_path_tmp) {
- if (strlen(icon_path_tmp) > 0) {
- icon_path = strdup(icon_path_tmp);
- } else {
- icon_path = strdup(DEFAULT_ICON);
- }
- } else {
- icon_path = strdup(DEFAULT_ICON);
- }
- item->obj[pos]->icon = strdup(icon_path);
- _W("icon path in object info %s, label %s", item->obj[pos]->icon, item->obj[pos]->label);
- icon = evas_object_image_add(evas_object_evas_get(slot));
- evas_object_repeat_events_set(icon, EINA_TRUE);
- evas_object_image_file_set(icon, icon_path, NULL);
- evas_object_image_filled_set(icon, EINA_TRUE);
- evas_object_show(icon);
- if(icon_path){
- free(icon_path);
- icon_path = NULL;
- }
-
- badge_count = item_badge_count(item->obj[pos]);
- if (badge_count) item_badge_show(item->obj[pos], badge_count);
- else item_badge_hide(item->obj[pos]);
-
- elm_object_part_content_set(slot, "icon", icon);
-
- elm_object_signal_callback_del(item->layout, signal, "*", _slot_mouse_clicked_cb);
- elm_object_signal_callback_del(item->layout, signal_l, "*", _slot_l_mouse_clicked_cb);
- elm_object_signal_callback_del(item->layout, signal_r, "*", _slot_r_mouse_clicked_cb);
-
- elm_object_signal_callback_add(item->layout, signal, "*", _slot_mouse_clicked_cb, item->obj[pos]);
- elm_object_signal_callback_add(item->layout, signal_l, "*", _slot_l_mouse_clicked_cb, item->obj[pos]);
- elm_object_signal_callback_add(item->layout, signal_r, "*", _slot_r_mouse_clicked_cb, item->obj[pos]);
-
- elm_object_signal_callback_add(slot, "mouse_down", "*", _slot_mouse_down_cb, icon);
- elm_object_signal_callback_add(slot, "mouse_up", "*", _slot_mouse_up_cb, icon);
- elm_object_signal_callback_add(slot, "complete,launch_effect", "event", _glow_effect_done, slot);
-
- if (appinfo_h) pkgmgrinfo_appinfo_destroy_appinfo(appinfo_h);
- if (pkghandle) pkgmgrinfo_pkginfo_destroy_pkginfo(pkghandle);
-
- char log[10] = {0};
- snprintf(log, sizeof(log)-1, "ASS%d", pos+1);
-
- _D("slot is added %d",pos+1);
-
- }
- _EXIT;
- return;
-
-}
-
-PUBLIC int widget_update_content(const char* id)
-{
- _ENTER;
- struct info *item;
- item = find_item((char*)id);
- int i = 0;
- char *tmp = NULL;
- char *first = NULL;
- char* save = NULL;
- int ret = 0;
- if (!item) {
- _E("id is invalid");
- return WIDGET_ERROR_NOT_EXIST;
- }
-
- _W("content : %s", item->content);
-
- tmp = strdup(item->content);
- if(ret != WIDGET_ERROR_NONE){
- _E("set content error %x", ret);
- }
-
- for(i = 0 ; i < 4 ; i++){
- if(i == 0){
- first = strtok_r(tmp, " ",&save);
- _set_app_slot(item, first, i);
- }
- else{
- _set_app_slot(item, strtok_r(NULL, " ",&save), i);
- }
- }
-
- /**
- * @NOTE
- * This function have to generate a new content.
- * If you don't want to generate new content,
- * return negative values.
- * or you have to generate the new content. in timeout msec.
- */
-
- return WIDGET_ERROR_DISABLED;
-}
-
-
-PUBLIC int widget_set_content_info(const char* id, bundle *b)
-{
- _ENTER;
- _D("ID:%s",id);
- struct info *item;
- int ret = 0;
- char uri[256] = {0};
-
- _E("[%s]\n", id);
-
- item = find_item((char*)id);
- if (!item) {
- _E("id is invalid");
- return WIDGET_ERROR_NOT_EXIST;
- }
- const char *content = NULL;
- bundle_get_str(b,"test",(char**)&content);
- if(content){
- if(!strcmp(content, "delete")){
- _D("for test");
- _D("[%s], [%s]", id, item->id);
- snprintf(uri, sizeof(uri) - 1, "file://%s", item->id);
- //ret = widget_provider_send_deleted(APPS_WIDGET, uri);
- if(ret != WIDGET_ERROR_NONE){
- _E("widget_provider_send_deleted error %x", ret);
- }
- }else{
- _W("content : %s", content);
- _E("ex-content info : %s", item->content);
- free(item->content);
- item->content = NULL;
- item->content = strdup(content);
-
- _E("new-content info : %s", item->content);
- }
- }
-
- /**
- * @NOTE
- * This function have to generate a new content.
- * If you don't want to generate new content,
- * return negative values.
- * or you have to generate the new content. in timeout msec.
- */
- return WIDGET_ERROR_NONE;
-}
-
-PUBLIC int widget_clicked(const char* id, const char *event, double timestamp, double x, double y)
-{
- _ENTER;
- _D("ID:%s",id);
- _D("dbox clicked");
- struct info *item;
- item = find_item((char*)id);
- if (!item) {
- _E("id is invalid");
- return WIDGET_ERROR_NOT_EXIST;
- }
-
- return WIDGET_ERROR_NONE; /* No chages */
-}
-
-static void _mouse_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info){
- _ENTER;
- struct object_info *info = NULL;
- info = data;
- elm_object_signal_emit(info->obj, "pressed", "widget_plus");
-}
-
-static void _mouse_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info){
- _ENTER;
- struct object_info *info = NULL;
- info = data;
- elm_object_signal_emit(info->obj, "released", "widget_plus");
-}
-
-static void _mouse_clicked_cb(void *data, Evas_Object *o, const char *emission, const char *source){
- _ENTER;
- _D("slot clicked");
-#if 1
- struct object_info *info = NULL;
- info = data;
-
- app_control_h service = NULL;
- char *type = "app_shortcut";
- char index[3] = {0};
- snprintf(index, sizeof(index)-1, "%d", info->index);
-
- ret_if(APP_CONTROL_ERROR_NONE != app_control_create(&service));
- ret_if(NULL == service);
-
- _D("%s", info->dbox_id);
-
- app_control_set_operation(service, APP_CONTROL_OPERATION_DEFAULT);
- app_control_set_app_id(service, WHOME_PKG);
- app_control_add_extra_data(service, "home_op", type);
- app_control_add_extra_data(service, "widget_name", info->dbox_id);
- app_control_add_extra_data(service, "index", index);
-
- int ret = app_control_send_launch_request(service, NULL, NULL);
- if (APP_CONTROL_ERROR_NONE != ret) {
- _E("error");
- app_control_destroy(service);
- return;
- }
-
- app_control_destroy(service);
-#endif
-}
-
-
-static struct object_info *_add_empty_slot(Evas_Object *parent, int pos, struct info *item)
-{
- _ENTER;
- _D("add empty slot %d", pos);
- int ret = 0;
- Evas_Object *slot = NULL;
- char index[10] = {0};
- snprintf(index, sizeof(index)-1, "index%d", pos);
-
- struct object_info *info;
-
- info = malloc(sizeof(struct object_info));
- if (!info) {
- LOGE("failed to alloc memory");
- return NULL;
- }
-
- slot = elm_layout_add(parent);
-
- info->appid = strdup("empty");
- info->dbox_id = item->id;
- info->index = pos;
- info->obj = slot;
- info->icon = NULL;
- info->label = strdup("empty");
- char full_path[PATH_MAX] = { 0, };
- _get_resource(EDJE_FILE, full_path, sizeof(full_path));
- _D("full_path:%s",full_path);
- ret = elm_layout_file_set(slot, full_path, "empty_slot");
- if(ret == EINA_FALSE){
- LOGE("failed to set empty slot");
- free(info);
- return NULL;
- }
- evas_object_size_hint_weight_set(slot, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_resize(slot, SHORTCUT_W, SHORTCUT_H);
-
- evas_object_event_callback_add(slot, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down_cb, info);
- evas_object_event_callback_add(slot, EVAS_CALLBACK_MOUSE_UP, _mouse_up_cb, info);
- elm_object_signal_callback_add(slot, "mouse_clicked", "*", _mouse_clicked_cb, info);
- elm_object_signal_callback_add(slot, "complete,launch_effect", "event", _glow_effect_done, slot);
-
- elm_object_part_content_set(parent, index, slot);
- evas_object_show(slot);
-
- _D("success");
-
- return info;
-}
-
-static Evas_Object *_create_win(char* id, int w, int h)
-{
- _ENTER;
- _D("ID:%s",id);
- Evas_Object *win = NULL;
- int ret;
-
- if (id == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to get context.");
- return NULL;
- }
-
- ret = widget_app_get_elm_win((widget_context_h)id, &win);
- if (ret != WIDGET_ERROR_NONE) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to get window. err = %d", ret);
- return NULL;
- }
- evas_object_resize(win, w, h);
- evas_object_show(win);
-
- return win;
-}
-
-static int widget_resize(char* id, int w, int h, void *user_data)
-{
- _ENTER;
- _D("ID:%s",id);
- struct info *item;
- int ret;
- Evas_Object *layout = NULL;
- Evas_Object *bg = NULL;
- char *tmp = NULL;
- item = find_item((char*)id);
- if (!item) {
- _E("id is invalid");
- return WIDGET_ERROR_NOT_EXIST;
- }
-
- if( item->first_loaded && w == item->w && h == item->h)
- {
- _E("no need to update");
- return WIDGET_ERROR_NONE;
- }
- item->first_loaded = 1;
-
-
- _D("WIDGET is resized\n");
- item->dbox_win = _create_win(id,w,h);
- if (!item->dbox_win) {
- _E("item dbox win is not found");
- return WIDGET_ERROR_FAULT;
- }
-
- _init_theme();
-
-
- bg = elm_layout_add(item->dbox_win);
- char full_path[PATH_MAX] = { 0, };
- _get_resource(EDJE_FILE, full_path, sizeof(full_path));
- _D("full_path:%s",full_path);
- ret = elm_layout_file_set(bg, full_path, "dbox_bg");
-
- if(ret == EINA_FALSE){
- LOGE("failed to set layout");
- return WIDGET_ERROR_FAULT;
- }
- _D("bg set");
- evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_resize(bg, w, h);
- evas_object_show(bg);
- item->bg = bg;
-
- layout = elm_layout_add(bg);
- item->layout = layout;
- _D("full_path:%s",full_path);
- ret = elm_layout_file_set(layout, full_path, "layout");
- _D("layout added");
- if(ret == EINA_FALSE){
- LOGE("failed to set layout");
- return WIDGET_ERROR_FAULT;
- }
-
-
- evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_resize(layout, w, h);
- evas_object_show(layout);
-
- elm_object_part_content_set(bg, "bg_swallow", layout);
-
- evas_object_resize(item->dbox_win, w, h);
- evas_object_show(item->dbox_win);
- _D("win show");
-
- _D("empty dbox created");
- /* load index layout */
- item->obj[0] = _add_empty_slot(layout, 1, item);
- item->obj[1] = _add_empty_slot(layout, 2, item);
- item->obj[2] = _add_empty_slot(layout, 3, item);
- item->obj[3] = _add_empty_slot(layout, 4, item);
- _D("four slots added");
-
- bool prefkey_exist = false;
- //read from preference key, if not exist then load default app order string else, load the existing app order string
- ret = preference_is_existing(APP_WIDGET_CONTENT_KEY, &prefkey_exist);
-
- if(ret !=PREFERENCE_ERROR_NONE)
- {
- _E("preference_is_existing api failed ret:%d ",ret);
- item->content = strdup(DEFAULT_APP_ORDER);
- ret = preference_set_string(APP_WIDGET_CONTENT_KEY, DEFAULT_APP_ORDER);
- if(ret != PREFERENCE_ERROR_NONE)
- {
- _E("preference_set_string api failed ret:%d",ret);
- }
- }
- else
- {
- _D("preference_is_existing api success");
- if(prefkey_exist)
- {
- _D("preference key is already exist");
- ret = preference_get_string(APP_WIDGET_CONTENT_KEY, &item->content);
-
- if(ret != PREFERENCE_ERROR_NONE)
- {
- _E("preference_get_string api failed, so load default app order ret:%d",ret);
- item->content = strdup(DEFAULT_APP_ORDER);
- }
- }
- else
- {
- _E("preference_key is not exist. might be first boot so load default app order and store in preference key");
- ret = preference_set_string(APP_WIDGET_CONTENT_KEY, DEFAULT_APP_ORDER);
-
- if(ret != PREFERENCE_ERROR_NONE)
- {
- _E("preference_set_string api failed ret:%d",ret);
- }
- item->content = strdup(DEFAULT_APP_ORDER);
- }
- }
- _D("item->content :%s",item->content);
- preference_unset_changed_cb(APP_WIDGET_CONTENT_KEY);
- preference_set_changed_cb(APP_WIDGET_CONTENT_KEY,preference_changed_cb_impl,&item->id);
- tmp = strdup(item->content);
- char *first = NULL;
- char* save = NULL;
- int i = 0;
-
- for(i = 0 ; i < 4 ; i++){
- if(i == 0){
- first = strtok_r(tmp, " ",&save);
- _set_app_slot(item, first, i);
- }
- else{
- _set_app_slot(item, strtok_r(NULL, " ",&save), i);
- }
- }
-
- _D("widget resized to %dx%d\n", w, h);
- item->w =w;
- item->h = h;
- return WIDGET_ERROR_NONE;
-}
-
-// NOTE: This function is going to be invoked for initializing all resources
-static int widget_create(char* id, bundle *content, int w, int h, void *user_data)
-{
- _ENTER;
- _D("WIDGET is created with id:%s\n",id);
- struct info *info;
-
- info = malloc(sizeof(*info));
- if (!info) {
- return WIDGET_ERROR_OUT_OF_MEMORY;
- }
-
- info->id = strdup(id);
- _D("ID:%s",id);
- if (!info->id) {
- free(info);
- return WIDGET_ERROR_OUT_OF_MEMORY;
- }
-
- /**
- * @NOTE
- * cluster == 'user,created'
- * category == 'default'
- *
- * You don't need to care these two values if you don't know what are them
- */
-
- info->size_type = WIDGET_SIZE_TYPE_UNKNOWN;
- s_list = eina_list_append(s_list, info);
- info->need_to_delete = 0;
- info->first_loaded = 0;
-
- /**
- * @NOTE
- * You can returns WIDGET_OUTPUT_UPDATED or WIDGET_NEED_TO_SCHEDULE or WIDGET_DONE
- * You also can use them at same time using '|'
- *
- * If your content is updated, from this function, you have to
- * return WIDGET_OUTPUT_UPDATED;
- *
- * If you want to the provider call your widget_update_content function ASAP
- * return WIDGET_NEED_TO_SCHEDULE;
- *
- * If your content is updated and need to call the update_content function ASAP,
- * return WIDGET_OUTPUT_UPDATED | WIDGET_NEED_TO_SCHEDULE
- *
- * Don't have any changes, just
- * return WIDGET_DONE
- */
-
- /**
- * @NOTE
- * You create the default output image from here now.
- * So you HAVE TO return WIDGET_OUTPUT_UPDATED
- */
- widget_resize(id,w, h, user_data);
- return WIDGET_ERROR_NONE;
-}
-PUBLIC int widget_need_to_create(const char *cluster, const char *category)
-{
- _ENTER;
- /**
- * @NOTE
- * You don't need implement this, if don't know what this is.
- * return 0 or 1
- */
- return 0;
-}
-
-PUBLIC int widget_change_group(const char* id, const char *cluster, const char *category)
-{
- _ENTER;
- struct info *item;
-
- item = find_item((char*)id);
- //widget_app_context_get_tag(id, (void**) &item);
- if (!item) {
- _E("id is invalid");
- return WIDGET_ERROR_NOT_EXIST;
- }
-
- /**
- * @NOTE
- * If you can generate new content in this function,
- * Generate a new content.
- * and return WIDGET_OUTPUT_UPDATED
- *
- * In case of you cannot create the updated image in this function directly,
- * return WIDGET_NEED_TO_SCHEDULE
- * The provider will call your widget_need_to_update & widget_update_content function.
- *
- * I recommend that if you are able to generate new content in this function,
- * generate it directly. and just returns WIDGET_OUTPUT_UPDATED
- *
- * Because if you return WIDGET_NEED_TO_SCHEDULE, the provider will try to update your livebox
- * But it can be interrupted by other events.
- * Then you livebox content updating will be delayed
- */
- return WIDGET_ERROR_NONE;
-}
-
-PUBLIC int widget_need_to_destroy(const char* id)
-{
- _ENTER;
- /**
- * @NOTE
- * You don't need implement this, if don't know what this is.
- * This will be called after call the widget_need_to_update function.
- * If the widget_need_to_update function returns 0,
- * The provider will call this.
- *
- * If you return 1, the provider will delete your box.
- */
- return 0;
-}
-
-PUBLIC char *widget_pinup(const char* id, int pinup)
-{
- _ENTER;
- struct info *item;
-
- item = find_item((char*)id);
- if (!item) {
- _E("id is invalid");
- return NULL;
- }
-
- return strdup(item->content);
-}
-
-PUBLIC int widget_is_pinned_up(const char* id)
-{
- _ENTER;
- _D("ID:%s",id);
- struct info *item;
-
- item = find_item((char*)id);
- if (!item) {
- return WIDGET_ERROR_NOT_EXIST;
- }
-
- /**
- * @NOTE
- * If you can generate new content in this function,
- * Generate a new content.
- * and return WIDGET_OUTPUT_UPDATED
- *
- * In case of you cannot create the updated image in this function directly,
- * return WIDGET_NEED_TO_SCHEDULE
- * The provider will call your widget_need_to_update & widget_update_content function.
- *
- * I recommend that if you are able to generate new content in this function,
- * generate it directly. and just returns WIDGET_OUTPUT_UPDATED
- *
- * Because if you return WIDGET_NEED_TO_SCHEDULE, the provider will try to update your livebox
- * But it can be interrupted by other events.
- * Then you livebox content updating will be delayed
- */
- return WIDGET_ERROR_NONE;
-}
-
-void _set_app_label(struct object_info *obj)
-{
- _ENTER;
-}
-
-
-static void
-widget_app_lang_changed(app_event_info_h event_info, void *user_data)
-{
- _ENTER;
- /* APP_EVENT_LANGUAGE_CHANGED */
- char *locale = NULL;
- app_event_get_language(event_info, &locale);
- elm_language_set(locale);
- free(locale);
-}
-
-static void
-widget_app_region_changed(app_event_info_h event_info, void *user_data)
-{
- _ENTER;
- /* APP_EVENT_REGION_FORMAT_CHANGED */
-}
-
-static int
-widget_pause(char* id, void *user_data)
-{
- _ENTER;
- _D("ID:%s",id);
- /* Take necessary actions when widget instance becomes invisible. */
- return WIDGET_ERROR_NONE;
-
-}
-
-static int
-widget_resume(char* id, void *user_data)
-{
- /* Take necessary actions when widget instance becomes visible. */
- _ENTER;
- _D("ID:%s",id);
- return WIDGET_ERROR_NONE;
-}
-
-static int
-widget_update(char* id, bundle *content,
- int force, void *user_data)
-{
- _ENTER;
- _D("ID:%s",id);
- /* Take necessary actions when widget instance should be updated. */
- return WIDGET_ERROR_NONE;
-}
-static widget_class_h
-widget_app_create(void *user_data)
-{
- _ENTER;
- /* Hook to take necessary actions before main event loop starts.
- Initialize UI resources.
- Make a class for widget instance.
- */
- app_event_handler_h handlers[5] = {NULL, };
-
- widget_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED],
- APP_EVENT_LANGUAGE_CHANGED, widget_app_lang_changed, user_data);
- widget_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED],
- APP_EVENT_REGION_FORMAT_CHANGED, widget_app_region_changed, user_data);
-
- widget_instance_lifecycle_callback_s ops = {
- .create = (void *)widget_create,
- .destroy = (void *)widget_destroy,
- .pause = (void *)widget_pause,
- .resume = (void *)widget_resume,
- .update = (void *)widget_update,
- .resize = (void *)widget_resize,
- };
-
- return widget_app_class_create(ops, user_data);
-}
-
-static void
-widget_app_terminate(void *user_data)
-{
-
- /* Release all resources. */
- _ENTER;
-
-}
-
-int
-main(int argc, char *argv[])
-{
- _ENTER;
- widget_app_lifecycle_callback_s ops = {0,};
- int ret;
-
- ops.create = widget_app_create;
- ops.terminate = widget_app_terminate;
-
- ret = widget_app_main(argc, argv, &ops, NULL);
- if (ret != WIDGET_ERROR_NONE) {
- dlog_print(DLOG_ERROR, LOG_TAG, "widget_app_main() is failed. err = %d", ret);
- }
-
- return ret;
-}
-
-/*
- * @brief: This function handle click event.
- */
-
--- /dev/null
+/*
+ * Samsung API
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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 <Elementary.h>
+#include <widget_service.h>
+#include <widget_app_efl.h>
+#include <widget_errno.h>
+#include <app_control.h>
+#include <pkgmgr-info.h>
+#include <package-manager.h>
+#include <aul.h>
+#include <badge.h>
+#include <unicode/unum.h>
+#include <unicode/ustring.h>
+#include <app_preference.h>
+
+#ifndef TELEPHONY_DISABLE
+#include <feedback.h>
+#endif
+
+#include <apptray_widget_log.h>
+#include <apptray_widget_common_defines.h>
+
+#define LOCALE_LEN 32
+
+static Eina_List *s_list;
+
+struct object_info {
+ char *appid;
+ char *icon;
+ char *label;
+ char *pkgid;
+ char* dbox_id;
+ int open_app;
+ int index;
+ Evas_Object *eo;
+};
+
+struct info {
+ char* id;
+ int size_type;
+ int w;
+ int h;
+ Evas_Object *dbox_win;
+ Evas_Object *bg;
+ Evas_Object *layout;
+ struct object_info obj[WIDGET_SLOTS_MAX_COUNT];
+ int first_loaded;
+ char *content_app_list[WIDGET_SLOTS_MAX_COUNT];
+};
+
+static void _get_resource(const char *file_in, char *file_path_out, int file_path_max);
+static struct info *_find_item(const char* id);
+static void _preference_changed_cb(const char *key, void *user_data);
+static char *_util_get_count_str_from_icu(int count);
+
+static void _check_slots_on_package_remove_callback(const char *package);
+
+static void _show_slot_item_badge(struct object_info *item, int count);
+static void _hide_slot_item_badge(struct object_info *item);
+static int _get_slot_item_badge_count(struct object_info *item);
+
+static void _register_badge_changed_callback(void);
+static void _unregister_badge_changed_callback(void);
+static void _badge_changed_cb(unsigned int action, const char *appid, unsigned int count, void *data);
+
+static void _slot_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source);
+
+static int _update_all_slots(struct info *item);
+static bool _set_slot(struct info *item, const char *appid, int pos);
+static void _reset_slot_info(struct info *item, int index);
+static void _reset_all_slots_info(struct info *item);
+static void _log_content_list(struct info *item);
+static void _free_content_list(struct info *item);
+static void _update_content_list(struct info *item, const char *content);
+static void _add_application_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source);
+
+static void _create_add_app_layout(struct info *item);
+static void _destroy_add_app_layout(struct info *item);
+
+static Evas_Object *_create_win(widget_context_h context, int w, int h);
+
+static widget_class_h _widget_app_create(void *user_data);
+static void _widget_app_terminate(void *user_data);
+static void _widget_app_lang_changed(app_event_info_h event_info, void *user_data);
+static void _widget_app_region_changed(app_event_info_h event_info, void *user_data);
+
+static int _widget_instance_create(widget_context_h context, bundle *content, int w, int h, void *user_data);
+static int _widget_instance_destroy(widget_context_h context, widget_app_destroy_type_e reason, bundle *content, void *user_data);
+static int _widget_instance_pause(widget_context_h context, void *user_data);
+static int _widget_instance_resume(widget_context_h context, void *user_data);
+static int _widget_instance_update(widget_context_h context, bundle *content, int force, void *user_data);
+static int _widget_instance_resize(widget_context_h context, int w, int h, void *user_data);
+
+static void _get_resource(const char *file_in, char *file_path_out, int file_path_max)
+{
+ _ENTER;
+ char *res_path = app_get_resource_path();
+ if (res_path) {
+ snprintf(file_path_out, file_path_max, "%s%s", res_path, file_in);
+ free(res_path);
+ }
+}
+
+static inline struct info *_find_item(const char* id)
+{
+ _ENTER;
+ struct info *item=NULL;
+
+ Eina_List *l = NULL;
+
+ _D("Need to find [%s]", id);
+ EINA_LIST_FOREACH(s_list, l, item) {
+ _D("item->id:%s,id:%s",item->id, id);
+ if (!strncmp(item->id, id, strlen(id))) {
+ _D("Item found");
+ return item;
+ }
+ }
+
+ _D("Item not found");
+ return item;
+}
+
+static void _preference_changed_cb(const char *key, void *user_data)
+{
+ _ENTER;
+
+ char *id= *((char**)user_data);
+ _D("id:%s, key:%s",id,key);
+ struct info *item;
+ char *content = NULL;
+
+ if(!id)
+ {
+ _E("id is null");
+ return;
+ }
+ item = _find_item((char*)id);
+ if (!item) {
+ _E("item is not found");
+ return;
+ }
+
+ _log_content_list(item);
+ preference_get_string(APP_WIDGET_CONTENT_KEY, &content);
+ _update_content_list(item, content);
+ free(content);
+
+ _update_all_slots(item);
+
+ _EXIT;
+}
+
+static char *_util_get_count_str_from_icu(int count)
+{
+ _ENTER;
+ char *p = NULL;
+ char *locale_tmp = NULL;
+ char locale[LOCALE_LEN] = { 0, };
+ char res[LOCALE_LEN] = { 0, };
+
+
+ strncpy(locale, locale_tmp, sizeof(locale));
+ free(locale_tmp);
+
+ if(locale[0] != '\0') {
+ p = strstr(locale, ".UTF-8");
+ if (p) *p = 0;
+ }
+
+ return strdup(res);
+}
+
+static int _widget_instance_destroy(widget_context_h context, widget_app_destroy_type_e reason, bundle *content, void *user_data)
+{
+ _ENTER;
+
+ struct info *item;
+ const char *id = widget_app_get_id(context);
+
+ item = _find_item((char *)id);
+ if (!item) {
+ _E("id is invalid");
+ return WIDGET_ERROR_NOT_EXIST;
+ }
+
+ s_list = eina_list_remove(s_list, item);
+
+ if (item->dbox_win) {
+ evas_object_del(item->dbox_win);
+ }
+
+ _free_content_list(item);
+ free(item->id);
+ free(item);
+
+ preference_unset_changed_cb(APP_WIDGET_CONTENT_KEY);
+
+ return WIDGET_ERROR_NONE;
+}
+
+static void _check_slots_on_package_remove_callback(const char *package)
+{
+ _ENTER;
+ _D("remove %s", package);
+ Eina_List *l;
+ struct info *item;
+ bool update = false;
+ int i = 0;
+
+ EINA_LIST_FOREACH(s_list, l, item) {
+ for (i = 0 ; i < WIDGET_SLOTS_MAX_COUNT ; i++) {
+ if (strcmp(item->obj[i].appid, "empty")) {
+
+ pkgmgrinfo_appinfo_h appinfo_h = NULL;
+ char *pkgid = NULL;
+
+ int ret = pkgmgrinfo_appinfo_get_appinfo(item->content_app_list[i], &appinfo_h);
+ if (ret != PMINFO_R_OK) {
+ _E("get appinfo failed. ret[%d]", ret);
+ return;
+ }
+
+ ret = pkgmgrinfo_appinfo_get_pkgid(appinfo_h, &pkgid);
+ if (ret != PMINFO_R_OK) {
+ _E("get pkgid failed. ret[%d]", ret);
+ pkgmgrinfo_appinfo_destroy_appinfo(appinfo_h);
+ return;
+ }
+
+ if (!strcmp(pkgid, package)) {
+ free(item->content_app_list[i]);
+ item->content_app_list[i] = strdup("empty");
+ update = true;
+ }
+ free(pkgid);
+ pkgmgrinfo_appinfo_destroy_appinfo(appinfo_h);
+ }
+ }
+ if (update) {
+ update = 0;
+ _update_all_slots(item);
+ }
+ }
+}
+
+static int _get_slot_item_badge_count(struct object_info *item)
+{
+ _ENTER;
+ unsigned int is_display = 0;
+ unsigned int count = 0;
+ badge_error_e err = BADGE_ERROR_NONE;
+
+ retv_if(!item, 0);
+
+ err = badge_get_display(item->appid, &is_display);
+ _D("badge_get_display err:%d",err);
+ if (BADGE_ERROR_NONE != err) _E("cannot get badge display");
+
+ if (!is_display)
+ return 0;
+
+ err = badge_get_count(item->appid, &count);
+ if (BADGE_ERROR_NONE != err) _E("cannot get badge count");
+
+ _D("Badge for app %s : %u", item->appid, count);
+ _EXIT;
+
+ return (int)count;
+}
+
+static void _show_slot_item_badge(struct object_info *item, int count)
+{
+ _ENTER;
+ char *str = NULL;
+ char badge_signal[16];
+
+ ret_if(!item);
+
+ if (count > MAX_BADGE_COUNT) {
+ count = MAX_BADGE_COUNT;
+ }
+
+ str = _util_get_count_str_from_icu(count);
+ elm_object_part_text_set(item->eo, "badge_txt", str);
+
+ if (count <= 0) {
+ snprintf(badge_signal, sizeof(badge_signal), "badge,off");
+ } else if (count < 10) {
+ snprintf(badge_signal, sizeof(badge_signal), "badge,on,1");
+ } else if (count < 100) {
+ snprintf(badge_signal, sizeof(badge_signal), "badge,on,2");
+ } else {
+ bool nRightPos = ((item->index) == 2);
+ _D("nRightPos : %d", nRightPos);
+ if(nRightPos) {
+ snprintf(badge_signal, sizeof(badge_signal), "badge,on,3r");
+ } else {
+ snprintf(badge_signal, sizeof(badge_signal), "badge,on,3");
+ }
+ }
+ elm_object_signal_emit(item->eo, badge_signal, "slot");
+
+ free(str);
+}
+
+static void _hide_slot_item_badge(struct object_info *item)
+{
+ _ENTER;
+ ret_if(!item);
+
+ elm_object_signal_emit(item->eo, "badge,off", "slot");
+}
+
+static void _badge_changed_cb(unsigned int action, const char *appid, unsigned int count, void *data)
+{
+ _ENTER;
+ unsigned int is_display = 0;
+ badge_error_e err = BADGE_ERROR_NONE;
+ int i = 0;
+
+ _D("Badge changed, action : %u, appid : %s, count : %u", action, appid, count);
+
+ ret_if(!appid);
+
+ if (BADGE_ACTION_REMOVE == action) {
+ count = 0;
+ is_display = 0;
+ } else {
+ err = badge_get_display(appid, &is_display);
+ if (BADGE_ERROR_NONE != err)
+ _E("cannot get badge display");
+ if (!is_display)
+ count = 0;
+ }
+
+ Eina_List *l;
+ struct info *item;
+
+ EINA_LIST_FOREACH(s_list, l, item) {
+ for(i = 0 ; i < WIDGET_SLOTS_MAX_COUNT ; i++){
+ if(!strcmp(item->obj[i].appid, appid)){
+ if (count)
+ _show_slot_item_badge(&item->obj[i], count);
+ else
+ _hide_slot_item_badge(&item->obj[i]);
+ }
+ }
+ }
+}
+
+static void _register_badge_changed_callback(void)
+{
+ _ENTER;
+ badge_error_e err = badge_register_changed_cb(_badge_changed_cb, NULL);
+ ret_if(BADGE_ERROR_NONE != err);
+ _EXIT;
+}
+
+static void _unregister_badge_changed_callback(void)
+{
+ _ENTER;
+ badge_error_e err;
+
+ err = badge_unregister_changed_cb(_badge_changed_cb);
+ ret_if(BADGE_ERROR_NONE != err);
+}
+
+static void _slot_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ _D("icon clicked");
+ _ENTER;
+
+ struct info *item = (struct info *)data;
+ struct object_info *info = NULL;
+
+ int index = -1;
+ sscanf(source, "slot_%d", &index);
+ ret_if(index <= 0);
+
+ info = &item->obj[index - 1];
+ if(!strcmp(info->appid, APPS_PKG)){
+ app_control_h service = NULL;
+ char *type = APP_LAUNCH_KEY;
+
+ ret_if(APP_CONTROL_ERROR_NONE != app_control_create(&service));
+ ret_if(NULL == service);
+
+ app_control_set_operation(service, APP_CONTROL_OPERATION_DEFAULT);
+ app_control_set_app_id(service, WHOME_PKG);
+ app_control_add_extra_data(service, WHOME_APP_CONTROL, type);
+
+ int ret = app_control_send_launch_request(service, NULL, NULL);
+ _D("Send Launch Request = %d", ret);
+ if (APP_CONTROL_ERROR_NONE != ret) {
+ LOGE("error");
+ app_control_destroy(service);
+ return;
+ }
+
+ app_control_destroy(service);
+ }
+ else{
+ _D("launch %s", info->appid);
+ if(info->open_app){
+ _D("launch wgt");
+ int ret_aul = aul_open_app(info->appid);
+ if (ret_aul < AUL_R_OK) {
+ _E("wgt launch failed");
+ return;
+ }
+ }
+ else{
+ _D("launch normal");
+ app_control_h service = NULL;
+
+ ret_if(APP_CONTROL_ERROR_NONE != app_control_create(&service));
+ ret_if(NULL == service);
+
+ app_control_set_operation(service, APP_CONTROL_OPERATION_MAIN);
+
+ app_control_set_app_id(service, info->appid);
+
+
+ int ret = app_control_send_launch_request(service, NULL, NULL);
+ if (APP_CONTROL_ERROR_NONE != ret) {
+ LOGE("error");
+ app_control_destroy(service);
+ return;
+ }
+
+ app_control_destroy(service);
+ }
+ }
+
+}
+
+static bool _set_slot(struct info *item, const char *appid, int pos)
+{
+ _ENTER;
+
+ int ret = 0;
+ int badge_count = 0;
+ Evas_Object *slot = NULL;
+ Evas_Object *icon = NULL;
+ pkgmgrinfo_appinfo_h appinfo_h = NULL;
+ pkgmgrinfo_pkginfo_h pkghandle = NULL;
+ char *pkgid = NULL;
+ char full_path[PATH_MAX] = { NULL };
+ char *label = NULL;
+ char index[10] = { NULL };
+ char *type = NULL;
+ char *icon_path_tmp = NULL;
+
+ _D("Try update slot [%d]", pos + 1);
+
+ if(!appid || !strcmp(appid, "empty")){
+ _D("appid to set is empty");
+ return false;
+ }
+
+ snprintf(index, sizeof(index), "slot_%d", pos+1);
+
+ item->obj[pos].appid = strdup(appid);
+
+ slot = elm_layout_add(item->layout);
+ item->obj[pos].eo = slot;
+ _get_resource(EDJE_FILE, full_path, sizeof(full_path));
+ if(!elm_layout_file_set(slot, full_path, "icon_slot")){
+ goto fail_return;
+ }
+ evas_object_size_hint_weight_set(slot, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_resize(slot, SHORTCUT_W, SHORTCUT_H);
+ elm_object_part_content_set(item->layout, index, slot);
+ evas_object_show(slot);
+
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &appinfo_h);
+ if (ret != PMINFO_R_OK) {
+ _E("get appinfo failed. ret[%d]", ret);
+ goto fail_return;
+ }
+
+ ret = pkgmgrinfo_appinfo_get_pkgid(appinfo_h, &pkgid);
+ if (ret != PMINFO_R_OK) {
+ _E("get pkgid failed. ret[%d]", ret);
+ goto fail_return;
+ }
+
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &pkghandle);
+ if (ret < 0 ) {
+ _E("get pkghandle failed. ret[%d]", ret);
+ goto fail_return;
+ }
+
+ item->obj[pos].pkgid = strdup(pkgid);
+
+ ret = pkgmgrinfo_appinfo_get_label(appinfo_h, &label);
+ if (ret != PMINFO_R_OK) {
+ _E("get label failed. ret[%d]", ret);
+ item->obj[pos].label = strdup("");
+ } else {
+ item->obj[pos].label = strdup(label);
+ }
+
+ elm_object_part_text_set(slot, "name", item->obj[pos].label);
+
+ ret = pkgmgrinfo_pkginfo_get_type(pkghandle, &type);
+ if (ret != PMINFO_R_OK) {
+ _E("get app type failed. ret[%d]", ret);
+ }
+ if (type) {
+ if (!strncmp(type, APP_TYPE_WGT, strlen(APP_TYPE_WGT))) {
+ item->obj[pos].open_app = 1;
+ } else {
+ item->obj[pos].open_app = 0;
+ }
+ }
+
+ ret = pkgmgrinfo_appinfo_get_icon(appinfo_h, &icon_path_tmp);
+ if(ret != PMINFO_R_OK){
+ _E("get icon path failed. ret[%d]", ret);
+ }
+ if (icon_path_tmp) {
+ if (strlen(icon_path_tmp) > 0) {
+ item->obj[pos].icon = strdup(icon_path_tmp);
+ } else {
+ item->obj[pos].icon = strdup(DEFAULT_ICON);
+ }
+ } else {
+ item->obj[pos].icon = strdup(DEFAULT_ICON);
+ }
+
+ icon = evas_object_image_add(evas_object_evas_get(slot));
+ evas_object_repeat_events_set(icon, EINA_TRUE);
+ evas_object_image_file_set(icon, item->obj[pos].icon, NULL);
+ evas_object_image_filled_set(icon, EINA_TRUE);
+ elm_object_part_content_set(slot, "icon", icon);
+ evas_object_show(icon);
+
+ badge_count = _get_slot_item_badge_count(&item->obj[pos]);
+ if (badge_count) {
+ _show_slot_item_badge(&item->obj[pos], badge_count);
+ } else {
+ _hide_slot_item_badge(&item->obj[pos]);
+ }
+
+ if (appinfo_h)
+ pkgmgrinfo_appinfo_destroy_appinfo(appinfo_h);
+
+ if (pkghandle)
+ pkgmgrinfo_pkginfo_destroy_pkginfo(pkghandle);
+
+ _D("slot is added %d", pos+1);
+
+ return true;
+
+fail_return:
+
+ if (appinfo_h)
+ pkgmgrinfo_appinfo_destroy_appinfo(appinfo_h);
+
+ if (pkghandle)
+ pkgmgrinfo_pkginfo_destroy_pkginfo(pkghandle);
+
+ _reset_slot_info(item, pos);
+
+ return false;
+}
+
+static void _reset_slot_info(struct info *item, int index)
+{
+ _ENTER;
+
+ FREE(item->obj[index].appid);
+ FREE(item->obj[index].icon);
+ FREE(item->obj[index].label);
+ FREE(item->obj[index].pkgid);
+ FREE(item->obj[index].dbox_id);
+ item->obj[index].open_app = 0;
+
+ char index_str[10] = { 0 };
+ snprintf(index_str, sizeof(index_str), "slot_%d", index + 1);
+ elm_object_part_content_unset(item->layout, index_str);
+ if(item->obj[index].eo) {
+ evas_object_del(item->obj[index].eo);
+ }
+ item->obj[index].eo = NULL;
+
+ _EXIT;
+}
+
+static void _reset_all_slots_info(struct info *item)
+{
+ _ENTER;
+
+ int i = 0;
+ for (; i < WIDGET_SLOTS_MAX_COUNT; i++) {
+ _reset_slot_info(item, i);
+ }
+
+ _EXIT;
+}
+
+static void _log_content_list(struct info *item)
+{
+ _D("%s %s %s %s", item->content_app_list[0], item->content_app_list[1], item->content_app_list[2], item->content_app_list[3]);
+}
+
+static void _free_content_list(struct info *item)
+{
+ int i = 0;
+ for (; i < WIDGET_SLOTS_MAX_COUNT; i++) {
+ FREE(item->content_app_list[i]);
+ }
+}
+
+static void _update_content_list(struct info *item, const char *content)
+{
+ _ENTER;
+
+ char *tmp = NULL;
+ char *save = NULL;
+ char *tmp_app_id = NULL;
+ int i = 0;
+
+ ret_if(!content);
+ ret_if(!item);
+
+ _D("content to set [%s]", content);
+
+ tmp = strdup(content);
+ ret_if(!tmp);
+
+ for (; i < WIDGET_SLOTS_MAX_COUNT; i++) {
+ tmp_app_id = NULL;
+ if (i == 0) {
+ tmp_app_id = strtok_r(tmp, " ", &save);
+ } else {
+ tmp_app_id = strtok_r(NULL, " ", &save);
+ }
+
+ FREE(item->content_app_list[i]);
+ if (tmp_app_id) {
+ item->content_app_list[i] = strdup(tmp_app_id);
+ }
+ }
+ _log_content_list(item);
+
+ _EXIT;
+}
+
+static void _add_application_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ // TODO: send correct launch request
+
+ app_control_h service = NULL;
+
+ ret_if(APP_CONTROL_ERROR_NONE != app_control_create(&service));
+ ret_if(NULL == service);
+
+ app_control_set_operation(service, APP_CONTROL_OPERATION_MAIN);
+ app_control_add_extra_data(service, "instance_id", APPS_WIDGET);
+ app_control_set_app_id(service, APPS_PKG);
+
+ int ret = app_control_send_launch_request(service, NULL, NULL);
+ if (APP_CONTROL_ERROR_NONE != ret) {
+ _E("error");
+ }
+ app_control_destroy(service);
+}
+
+static void _create_add_app_layout(struct info *item)
+{
+ Evas_Object *eo = elm_layout_add(item->layout);
+ char full_path[PATH_MAX] = { 0 };
+ _get_resource(EDJE_FILE, full_path, sizeof(full_path));
+ elm_layout_file_set(eo, full_path, "add_app_shorcuts");
+ // TODO: need translation
+ elm_object_translatable_part_text_set(eo, "txt", "Add app shortcuts");
+ evas_object_size_hint_weight_set(eo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_signal_callback_add(eo, "mouse_clicked", "touch_rect", _add_application_clicked_cb, item);
+ elm_object_part_content_set(item->layout, "add_apps", eo);
+ evas_object_show(eo);
+}
+
+static void _destroy_add_app_layout(struct info *item)
+{
+ Evas_Object *eo = elm_object_part_content_unset(item->layout, "add_apps");
+ DEL_EVAS_OBJECT(eo);
+}
+
+static int _update_all_slots(struct info *item)
+{
+ _ENTER;
+
+ int app_list_index = 0;
+ int cur_slot_index = 0;
+
+ retv_if(!item, WIDGET_ERROR_NOT_EXIST);
+ _reset_all_slots_info(item);
+
+ for (app_list_index = 0, cur_slot_index = 0 ; app_list_index < WIDGET_SLOTS_MAX_COUNT; app_list_index++) {
+ if (_set_slot(item, item->content_app_list[app_list_index], cur_slot_index))
+ ++cur_slot_index;
+ }
+
+ if (cur_slot_index > 0) {
+ _destroy_add_app_layout(item);
+ char tmp[BUFF_SMALL_SIZE] = { 0 };
+ snprintf(tmp, sizeof(tmp), "%d_slots", cur_slot_index);
+ elm_object_signal_emit(item->layout, tmp, "*");
+ } else {
+ elm_object_signal_emit(item->layout, "no_apps", "*");
+ _create_add_app_layout(item);
+ }
+ _EXIT;
+ return WIDGET_ERROR_DISABLED;
+}
+
+static Evas_Object *_create_win(widget_context_h context, int w, int h)
+{
+ _ENTER;
+ Evas_Object *win = NULL;
+
+ int ret = widget_app_get_elm_win(context, &win);
+ if (ret != WIDGET_ERROR_NONE) {
+ _E("failed to get window. err = %d", ret);
+ return NULL;
+ }
+ evas_object_resize(win, w, h);
+ evas_object_show(win);
+
+ return win;
+}
+
+static int _widget_instance_resize(widget_context_h context, int w, int h, void *user_data)
+{
+ _ENTER;
+
+ const char *id = widget_app_get_id(context);
+ _D("ID:%s",id);
+
+ struct info *item;
+ int ret;
+ Evas_Object *layout = NULL;
+ Evas_Object *bg = NULL;
+
+ item = _find_item((char*)id);
+ if (!item) {
+ _E("item was not found");
+ return WIDGET_ERROR_NOT_EXIST;
+ }
+
+ if( item->first_loaded && w == item->w && h == item->h)
+ {
+ _E("no need to update");
+ return WIDGET_ERROR_NONE;
+ }
+ item->first_loaded = 1;
+
+ _D("WIDGET is resized\n");
+ item->dbox_win = _create_win(context ,w ,h);
+ if (!item->dbox_win) {
+ _E("item dbox win is not found");
+ return WIDGET_ERROR_FAULT;
+ }
+
+ _D("Layout set");
+
+ bg = elm_layout_add(item->dbox_win);
+ char full_path[PATH_MAX] = { 0 };
+ _get_resource(EDJE_FILE, full_path, sizeof(full_path));
+ _D("full_path:%s",full_path);
+ ret = elm_layout_file_set(bg, full_path, "dbox_bg");
+ if(ret == EINA_FALSE){
+ LOGE("failed to set layout");
+ return WIDGET_ERROR_FAULT;
+ }
+
+ _D("BG set");
+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_resize(bg, w, h);
+ evas_object_show(bg);
+ item->bg = bg;
+
+ layout = elm_layout_add(bg);
+ item->layout = layout;
+ _D("full_path:%s",full_path);
+ ret = elm_layout_file_set(layout, full_path, "main_layout");
+ _D("layout added");
+ if(ret == EINA_FALSE){
+ LOGE("failed to set layout");
+ return WIDGET_ERROR_FAULT;
+ }
+
+ elm_object_signal_callback_add(layout, "mouse_clicked", "slot_1", _slot_clicked_cb, item);
+ elm_object_signal_callback_add(layout, "mouse_clicked", "slot_2", _slot_clicked_cb, item);
+ elm_object_signal_callback_add(layout, "mouse_clicked", "slot_3", _slot_clicked_cb, item);
+ elm_object_signal_callback_add(layout, "mouse_clicked", "slot_4", _slot_clicked_cb, item);
+
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_resize(layout, w, h);
+ evas_object_show(layout);
+
+ elm_object_part_content_set(bg, "bg_swallow", layout);
+
+ evas_object_resize(item->dbox_win, w, h);
+ evas_object_show(item->dbox_win);
+
+ bool prefkey_exist = false;
+ ret = preference_is_existing(APP_WIDGET_CONTENT_KEY, &prefkey_exist);
+
+ if(ret !=PREFERENCE_ERROR_NONE) {
+ _E("preference_is_existing api failed ret:%d ",ret);
+
+ _update_content_list(item, DEFAULT_APP_ORDER);
+ ret = preference_set_string(APP_WIDGET_CONTENT_KEY, DEFAULT_APP_ORDER);
+ if(ret != PREFERENCE_ERROR_NONE)
+ {
+ _E("preference_set_string api failed ret:%d",ret);
+ }
+ } else {
+ _D("preference_is_existing api success");
+ if(prefkey_exist)
+ {
+ char *content = NULL;
+ _D("preference key is already exist");
+ ret = preference_get_string(APP_WIDGET_CONTENT_KEY, &content);
+
+ if(ret != PREFERENCE_ERROR_NONE) {
+ _E("preference_get_string api failed, so load default app order ret:%d",ret);
+ _update_content_list(item, DEFAULT_APP_ORDER);
+ } else {
+ _update_content_list(item, content);
+ }
+ free(content);
+ }
+ else
+ {
+ _E("preference_key is not exist. might be first boot so load default app order and store in preference key");
+ ret = preference_set_string(APP_WIDGET_CONTENT_KEY, DEFAULT_APP_ORDER);
+
+ if(ret != PREFERENCE_ERROR_NONE)
+ {
+ _E("preference_set_string api failed ret:%d",ret);
+ }
+ _update_content_list(item, DEFAULT_APP_ORDER);
+ }
+ }
+
+ preference_unset_changed_cb(APP_WIDGET_CONTENT_KEY);
+ preference_set_changed_cb(APP_WIDGET_CONTENT_KEY, _preference_changed_cb, &item->id);
+
+ _update_all_slots(item);
+
+ _D("widget resized to %dx%d\n", w, h);
+ item->w =w;
+ item->h = h;
+
+ _EXIT;
+
+ return WIDGET_ERROR_NONE;
+}
+
+static int _widget_instance_create(widget_context_h context, bundle *content, int w, int h, void *user_data)
+{
+ _ENTER;
+
+ struct info *info = NULL;
+ const char *id = NULL;
+
+ info = calloc(1, sizeof(struct info));
+ if (!info) {
+ return WIDGET_ERROR_OUT_OF_MEMORY;
+ }
+
+ id = widget_app_get_id(context);
+ if (!id) {
+ _E("Get widget instance id failed");
+ free(info);
+ return WIDGET_ERROR_OUT_OF_MEMORY;
+ }
+ _D("Widget instance is created with id [%s]", info->id);
+
+ info->id = strdup(id);
+ info->size_type = WIDGET_SIZE_TYPE_UNKNOWN;
+ info->first_loaded = 0;
+
+ s_list = eina_list_append(s_list, info);
+
+ _widget_instance_resize(context, w, h, user_data);
+
+ _EXIT;
+
+ return WIDGET_ERROR_NONE;
+}
+
+static void _widget_app_lang_changed(app_event_info_h event_info, void *user_data)
+{
+ _ENTER;
+
+ char *locale = NULL;
+ app_event_get_language(event_info, &locale);
+ elm_language_set(locale);
+ free(locale);
+}
+
+static void _widget_app_region_changed(app_event_info_h event_info, void *user_data)
+{
+ _ENTER;
+}
+
+static int _widget_instance_pause(widget_context_h context, void *user_data)
+{
+ _ENTER;
+
+ const char *id = widget_app_get_id(context);
+ _D("ID:%s",id);
+
+ return WIDGET_ERROR_NONE;
+}
+
+static int _widget_instance_resume(widget_context_h context, void *user_data)
+{
+ _ENTER;
+
+ const char *id = widget_app_get_id(context);
+ _D("ID:%s",id);
+
+ return WIDGET_ERROR_NONE;
+}
+
+static int _widget_instance_update(widget_context_h context, bundle *content, int force, void *user_data)
+{
+ _ENTER;
+
+ const char *id = widget_app_get_id(context);
+ _D("ID:%s",id);
+
+ return WIDGET_ERROR_NONE;
+}
+static widget_class_h _widget_app_create(void *user_data)
+{
+ _ENTER;
+
+ app_event_handler_h handlers[5] = { NULL };
+
+ _register_badge_changed_callback();
+
+ widget_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED],
+ APP_EVENT_LANGUAGE_CHANGED, _widget_app_lang_changed, user_data);
+ widget_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED],
+ APP_EVENT_REGION_FORMAT_CHANGED, _widget_app_region_changed, user_data);
+
+ widget_instance_lifecycle_callback_s ops = {
+ .create = _widget_instance_create,
+ .destroy = _widget_instance_destroy,
+ .pause = _widget_instance_pause,
+ .resume = _widget_instance_resume,
+ .update = _widget_instance_update,
+ .resize = _widget_instance_resize,
+ };
+
+ widget_class_h w_class = widget_app_class_create(ops, user_data);
+ if (w_class == NULL) {
+ _E("widget_app_class_create() failed. res[%d]", get_last_result());
+ }
+
+ return w_class;
+}
+
+static void _widget_app_terminate(void *user_data)
+{
+ _ENTER;
+
+ _unregister_badge_changed_callback();
+}
+
+int main(int argc, char *argv[])
+{
+ _ENTER;
+
+ widget_app_lifecycle_callback_s ops = {0,};
+ int ret;
+
+ ops.create = _widget_app_create;
+ ops.terminate = _widget_app_terminate;
+
+ ret = widget_app_main(argc, argv, &ops, NULL);
+ if (ret != WIDGET_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "widget_app_main() is failed. err = %d", ret);
+ }
+
+ return ret;
+}