--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(source-list-tv-ref CXX C)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(HOMEPANEL_PKGS REQUIRED
+ application-common
+ capi-appfw-application
+# capi-system-usbdevice
+ dlog
+ edje
+ elementary
+ evas
+ utilX
+ eina
+ aul
+)
+
+IF(NOT DEFINED PACKAGE_NAME)
+ SET(PACKAGE_NAME "org.tizen.${PROJECT_NAME}")
+ENDIF(NOT DEFINED PACKAGE_NAME)
+
+SET (LIBDIR "/usr/lib")
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+IF(NOT DEFINED BINDIR)
+ SET(BINDIR "${PREFIX}/bin")
+ENDIF(NOT DEFINED BINDIR)
+IF(NOT DEFINED IMAGEDIR)
+ SET(IMAGEDIR "${PREFIX}/res/images")
+ENDIF(NOT DEFINED IMAGEDIR)
+IF(NOT DEFINED EDJEDIR)
+ SET(EDJEDIR "${PREFIX}/res/edje")
+ENDIF(NOT DEFINED EDJEDIR)
+IF(NOT DEFINED LOCALEDIR)
+ SET(LOCALEDIR "${PREFIX}/res/locale")
+ENDIF(NOT DEFINED LOCALEDIR)
+IF(NOT DEFINED MANIFESTDIR)
+ SET(MANIFESTDIR "${PREFIX}/share/packages")
+ENDIF(NOT DEFINED MANIFESTDIR)
+IF(NOT DEFINED DESKTOP_ICONDIR)
+ SET(DESKTOP_ICONDIR "/usr/share/icons/default/small")
+ENDIF(NOT DEFINED DESKTOP_ICONDIR)
+IF(NOT DEFINED DESKTOP_ICON)
+ SET(DESKTOP_ICON ${PACKAGE_NAME}.png)
+ENDIF(NOT DEFINED DESKTOP_ICON)
+SET(EDJ_FILE "${PACKAGE_NAME}.edj")
+SET(EDJ_THEME "${PACKAGE_NAME}-theme.edj")
+
+ADD_DEFINITIONS("-DLOG_TAG=\"${PROJECT_NAME}\"")
+ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE_NAME}\"")
+ADD_DEFINITIONS("-DIMAGEDIR=\"${IMAGEDIR}\"")
+ADD_DEFINITIONS("-DEDJEDIR=\"${EDJEDIR}\"")
+ADD_DEFINITIONS("-DLOCALEDIR=\"${LOCALEDIR}\"")
+ADD_DEFINITIONS("-DEDJ_FILE=\"${EDJEDIR}/${EDJ_FILE}\"")
+ADD_DEFINITIONS("-DEDJ_THEME=\"${EDJEDIR}/${EDJ_THEME}\"")
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include/common)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include/mgr)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include/util)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include/view)
+
+ADD_EXECUTABLE(${PROJECT_NAME}
+ src/main.cpp
+ src/util/util.cpp
+ src/mgr/layout_mgr.cpp
+ src/mgr/source_mgr.cpp
+ src/mgr/SourceInfo.cpp
+# src/mgr/usb.cpp
+ src/mgr/external.cpp
+ src/view/allsource_view.cpp
+ src/view/plugged_layout.cpp
+ src/view/nearby_layout.cpp
+ src/view/menu_view.cpp
+)
+
+FOREACH (flag ${HOMEPANEL_PKGS_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror")
+SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -finstrument-functions")
+SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -finstrument-functions -Wall -Werror")
+
+FOREACH (flag ${HOMEPANEL_PKGS_CFLAGS})
+ SET(EXTRA_CXXFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS}")
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${HOMEPANEL_PKGS_LDFLAGS})
+
+CONFIGURE_FILE(${PACKAGE_NAME}.xml.in ${PACKAGE_NAME}.xml)
+
+# Install
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR})
+INSTALL(FILES ${PACKAGE_NAME}.xml DESTINATION ${MANIFESTDIR})
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/${DESKTOP_ICON} DESTINATION ${DESKTOP_ICONDIR})
+INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/images/ DESTINATION ${IMAGEDIR})
+ADD_SUBDIRECTORY(data)
+#ADD_SUBDIRECTORY(po)
+
--- /dev/null
+ADD_CUSTOM_TARGET(${PACKAGE_NAME}.edj
+ COMMAND edje_cc -id ${CMAKE_CURRENT_SOURCE_DIR}/images
+ ${CMAKE_CURRENT_SOURCE_DIR}/${PACKAGE_NAME}.edc ${CMAKE_BINARY_DIR}/${PACKAGE_NAME}.edj
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${PACKAGE_NAME}.edc
+)
+ADD_DEPENDENCIES(${PROJECT_NAME} ${PACKAGE_NAME}.edj)
+
+
+INSTALL(FILES ${CMAKE_BINARY_DIR}/${PACKAGE_NAME}.edj DESTINATION ${EDJEDIR})
+
+ADD_CUSTOM_TARGET(${PACKAGE_NAME}-theme.edj
+ COMMAND edje_cc -id ${CMAKE_CURRENT_SOURCE_DIR}/images -sd ${CMAKE_CURRENT_SOURCE_DIR}/sounds
+ ${CMAKE_CURRENT_SOURCE_DIR}/${PACKAGE_NAME}-theme.edc ${CMAKE_BINARY_DIR}/${PACKAGE_NAME}-theme.edj
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${PACKAGE_NAME}-theme.edc
+)
+ADD_DEPENDENCIES(${PROJECT_NAME} ${PACKAGE_NAME}-theme.edj)
+
+INSTALL(FILES ${CMAKE_BINARY_DIR}/${PACKAGE_NAME}-theme.edj DESTINATION ${EDJEDIR})
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 "../include/common/def.h"
+
+collections {
+#include "./widget/common.h"
+#include "./widget/button.edc"
+#include "./widget/gengrid.edc"
+#include "./widget/label.edc"
+#include "./widget/progressbar.edc"
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 "../include/common/def.h"
+
+collections {
+#include "./view/background.edc"
+#include "./view/allsource_view.edc"
+#include "./view/menu_view.edc"
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 SZ_ALLSRC_TITLE 1469 232
+#define SZ_ALLSRC_UTILITY 391 232
+#define SZ_ALLSRC_MENU 406 848
+#define SZ_ALLSRC_MENU_PLUGGED 406 87
+#define SZ_ALLSRC_MENU_NEARBY 406 87
+#define SZ_ALLSRC_CONTENT 1395 676
+#define SZ_ALLSRC_UTILITY_BUTTON 250 72
+#define SZ_ALLSRC_UTILITY_BUTTON_P 0 83
+#define SZ_ALLSRC_UTILITY_LOADING_P 270 93
+#define SZ_ALLSRC_UTILITY_LOADING 50 50
+
+#define SZ_ALLSRC_TITLE_ICO_P 63 78
+#define SZ_ALLSRC_TITLE_ICO 84 84
+#define SZ_ALLSRC_TITLE_ICO_STR_P 22 80
+#define SZ_ALLSRC_TITLE_STR 70
+#define RGBA_ALLSRC_TITLE_STR 255 255 255 255
+#define FONT_ALLSRC_TITLE_STR "TizenSans:style=Medium"
+
+#define RGBA_NO_PLUG_BG 0 0 0 (255*0.15)
+#define SZ_NO_PLUG_SRC_TEXT_P 0 294
+#define SZ_NO_PLUG_SRC_TEXT_LINE1 1139 54
+#define SZ_NO_PLUG_SRC_TEXT_LINE2 1139 34
+
+#define SZ_NO_NEAR_SRC_TEXT_P 0 209
+#define SZ_NO_NEAR_SRC_TEXT_LINE1 1139 60
+#define SZ_NO_NEAR_SRC_TEXT_LINE2 1139 30
+#define SZ_NO_NEAR_SRC_TEXT_LINE3 1 30
+#define SZ_NO_NEAR_SRC_BUTTON_P 0 68
+#define SZ_NO_NEAR_SRC_BUTTON 273 70
+#define SZ_NO_NEAR_SRC_SEPARATOR 2 15
+
+group {
+ name: GRP_ALLSRC;
+ images {
+ image: IMAGE_ICO_SOURCE COMP;
+ }
+ parts {
+ part {
+ name: "title";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_ALLSRC_TITLE;
+ max: SZ_ALLSRC_TITLE;
+ fixed: 1 1;
+ align: 0 0;
+ rel1 {
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ relative: 0.0 0.0;
+ }
+ }
+ }
+ part {
+ name: "utility";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_ALLSRC_UTILITY;
+ max: SZ_ALLSRC_UTILITY;
+ fixed: 1 1;
+ align: 0.0 0;
+ rel1 {
+ to: "title";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "title";
+ relative: 1.0 0.0;
+ }
+ }
+ }
+ part {
+ name: "menu";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_ALLSRC_MENU;
+ max: SZ_ALLSRC_MENU;
+ fixed: 1 1;
+ align: 0 0;
+ rel1{
+ to: "title";
+ relative: 0.0 1.0;
+ }
+ rel2{
+ to: "title";
+ relative: 0.0 1.0;
+ }
+ }
+ }
+ part {
+ name: PART_CONTENT;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_ALLSRC_CONTENT;
+ max: SZ_ALLSRC_CONTENT;
+ fixed: 1 1;
+ align: 0 0;
+ rel1 {
+ to: "menu";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "menu";
+ relative: 1.0 0.0;
+ }
+ }
+ }
+ /*for title area*/
+ part {
+ name: "title_ico_p";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_ALLSRC_TITLE_ICO_P;
+ fixed: 1 1;
+ align: 0 0;
+ rel1 {
+ to: "title";
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ to: "title";
+ relative: 0.0 0.0;
+ }
+ }
+ }
+ part {
+ name: "title_ico";
+ type: IMAGE;
+ description {
+ state: "default" 0.0;
+ image.normal: IMAGE_ICO_SOURCE;
+ min: SZ_ALLSRC_TITLE_ICO;
+ fixed: 1 1;
+ color: 255 255 255 255;
+ align: 0 0;
+ rel1 {
+ to: "title_ico_p";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "title_ico_p";
+ relative: 1.0 1.0;
+ }
+ }
+ }
+ part {
+ name: "ico_str_p";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_ALLSRC_TITLE_ICO_STR_P;
+ fixed: 1 1;
+ align: 0 0;
+ rel1 {
+ to: "title_ico";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "title_ico";
+ relative: 1.0 0.0;
+ }
+ }
+ }
+ part {
+ name: PART_TITLE_STR;
+ type: TEXT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: RGBA_ALLSRC_TITLE_STR;
+ text {
+ font: FONT_ALLSRC_TITLE_STR;
+ size: SZ_ALLSRC_TITLE_STR;
+ min: 1 1 ;
+ align: 0.0 0.5;
+ }
+ fixed: 1 1;
+ align: 0 0.5;
+ rel1 {
+ to: "ico_str_p";
+ relative: 1.0 0.5;
+ }
+ rel2 {
+ to: "ico_str_p";
+ relative: 1.0 0.5;
+ }
+ }
+ }
+ /*for menu area*/
+ part {
+ name: PART_MENU_PLUGGED;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_ALLSRC_MENU_PLUGGED;
+ fixed: 1 1;
+ align: 0 0;
+ rel1 {
+ to: "menu";
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ to: "menu";
+ relative: 0.0 0.0;
+ }
+ }
+ }
+ part {
+ name: PART_MENU_NEARBY;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_ALLSRC_MENU_NEARBY;
+ fixed: 1 1;
+ align: 0 0;
+ rel1 {
+ to: PART_MENU_PLUGGED;
+ relative: 0.0 1.0;
+ }
+ rel2 {
+ to: PART_MENU_PLUGGED;
+ relative: 0.0 1.0;
+ }
+ }
+ }/*part*/
+ /*for utility area*/
+ part {
+ name: "utility_button_p";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_ALLSRC_UTILITY_BUTTON_P;
+ fixed: 1 1;
+ align: 1.0 0;
+ rel1 {
+ to: "utility";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "utility";
+ relative: 1.0 0.0;
+ }
+ }
+ }
+ part {
+ name: "utility_loading_p";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_ALLSRC_UTILITY_LOADING_P;
+ fixed: 1 1;
+ align: 1.0 0;
+ rel1 {
+ to: "utility";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "utility";
+ relative: 1.0 0.0;
+ }
+ }
+ }
+ part {
+ name: PART_UTILITY_BUTTON;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_ALLSRC_UTILITY_BUTTON;
+ fixed: 1 1;
+ align: 1.0 0;
+ rel1 {
+ to: "utility_button_p";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "utility_button_p";
+ relative: 1.0 1.0;
+ }
+ }
+ }/*part*/
+ part {
+ name: PART_UTILITY_LOADING;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_ALLSRC_UTILITY_LOADING;
+ fixed: 1 1;
+ align: 1.0 0;
+ rel1 {
+ to: "utility_loading_p";
+ relative: 0.0 1.0;
+ }
+ rel2 {
+ to: "utility_loading_p";
+ relative: 0.0 1.0;
+ }
+ }
+ }/*part*/
+ }/*parts*/
+}/*group*/
+
+group {
+ name: GRP_CONTENT;
+ parts {
+ part {
+ name: PART_CONTENT_CONTENT;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ }
+ }
+ }/*part*/
+ }/*parts*/
+}/*group*/
+
+group {
+ name: GRP_NO_PLUG_SRC_LABEL;
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: RGBA_NO_PLUG_BG;
+ }
+ }
+ part {
+ name: "no_src_text_p";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_NO_PLUG_SRC_TEXT_P;
+ fixed: 1 1;
+ align:0.5 0.0;
+ rel1 {
+ to: "bg";
+ relative: 0.5 0.0;
+ }
+ rel2 {
+ to: "bg";
+ relative: 0.5 0.0;
+ }
+ }
+ }
+ part {
+ name: PART_NO_SRC_TEXT_LINE1;
+ type: TEXT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 211 211 211 255;
+ min: SZ_NO_PLUG_SRC_TEXT_LINE1;
+ fixed: 1 1;
+ text {
+ text: "No plugged source";
+ font: "TizenSans:style=Medium";
+ size: 35;
+ min: 1 1;
+ align: 0.5 0.5;
+ }
+ align: 0.5 0.0;
+ rel1 {
+ to: "no_src_text_p";
+ relative: 0.5 1.0;
+ }
+ rel2 {
+ to: "no_src_text_p";
+ relative: 0.5 1.0;
+ }
+ }
+ }/*part*/
+ part {
+ name: PART_NO_SRC_TEXT_LINE2;
+ type: TEXT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 134 134 134 255;
+ min: SZ_NO_PLUG_SRC_TEXT_LINE2;
+ fixed: 1 1;
+ text {
+ text: "Check connection status or install any cloud service.";
+ font: "TizenSans:style=Regular";
+ size: 24;
+ min: 1 1;
+ align: 0.5 0.5;
+ }
+ align: 0.0 0.0;
+ rel1 {
+ to: PART_NO_SRC_TEXT_LINE1;
+ relative: 0.0 1.0;
+ }
+ rel2 {
+ to: PART_NO_SRC_TEXT_LINE1;
+ relative: 0.0 1.0;
+ }
+ }
+ }/*part*/
+ }/*parts*/
+}/*group*/
+
+group {
+ name: GRP_NO_NEAR_SRC_LABEL;
+ inherit: GRP_NO_PLUG_SRC_LABEL;
+ parts {
+ part {
+ name: "no_src_text_p";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_NO_NEAR_SRC_TEXT_P;
+ fixed: 1 1;
+ align:0.5 0.0;
+ rel1 {
+ to: "bg";
+ relative: 0.5 0.0;
+ }
+ rel2 {
+ to: "bg";
+ relative: 0.5 0.0;
+ }
+ }
+ }
+ part {
+ name: PART_NO_SRC_TEXT_LINE1;
+ type: TEXT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 211 211 211 255;
+ min: SZ_NO_NEAR_SRC_TEXT_LINE1;
+ fixed: 1 1;
+ text {
+ font: "TizenSans:style=Medium";
+ size: 35;
+ min: 1 1;
+ align: 0.5 0.5;
+ }
+ align: 0.5 0.0;
+ rel1 {
+ to: "no_src_text_p";
+ relative: 0.5 1.0;
+ }
+ rel2 {
+ to: "no_src_text_p";
+ relative: 0.5 1.0;
+ }
+ }
+ }/*part*/
+ part {
+ name: PART_NO_SRC_TEXT_LINE2;
+ type: TEXT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 134 134 134 255;
+ min: SZ_NO_NEAR_SRC_TEXT_LINE2;
+ fixed: 1 1;
+ text {
+ font: "TizenSans:style=Regular";
+ size: 24;
+ min: 1 1;
+ align: 0.5 0.5;
+ }
+ align: 0.5 0.0;
+ rel1 {
+ to: PART_NO_SRC_TEXT_LINE1;
+ relative: 0.5 1.0;
+ }
+ rel2 {
+ to: PART_NO_SRC_TEXT_LINE1;
+ relative: 0.5 1.0;
+ }
+ }
+ }/*part*/
+ part {
+ name: PART_NO_SRC_TEXT_LINE3;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_NO_NEAR_SRC_TEXT_LINE3;
+ fixed: 1 1;
+ align: 0.5 0.0;
+ rel1 {
+ to: PART_NO_SRC_TEXT_LINE2;
+ relative: 0.5 1.0;
+ }
+ rel2 {
+ to: PART_NO_SRC_TEXT_LINE2;
+ relative: 0.5 1.0;
+ }
+ }
+ }/*part*/
+ part {
+ name: "button_p";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_NO_NEAR_SRC_BUTTON_P;
+ fixed: 1 1;
+ align: 0.5 0.0;
+ rel1 {
+ to: PART_NO_SRC_TEXT_LINE3;
+ relative: 0.5 1.0;
+ }
+ rel2 {
+ to: PART_NO_SRC_TEXT_LINE3;
+ relative: 0.5 1.0;
+ }
+ }
+ }/*part*/
+ part {
+ name: PART_BUTTON;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_NO_NEAR_SRC_BUTTON;
+ fixed: 1 1;
+ align: 0.5 0.0;
+ rel1 {
+ to: "button_p";
+ relative: 0.5 1.0;
+ }
+ rel2 {
+ to: "button_p";
+ relative: 0.5 1.0;
+ }
+ }
+ }/*part*/
+ }/*parts*/
+}/*group*/
+group {
+ name: GRP_NO_NEAR_SRC_SEPARATOR;
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ min: 2 30;
+ max: 2 30;
+ fixed: 1 1;
+ }
+ }
+ part {
+ name: "separator";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 1;
+ color: 255 255 255 (255*0.15);
+ min: SZ_NO_NEAR_SRC_SEPARATOR;
+ max: SZ_NO_NEAR_SRC_SEPARATOR;
+ fixed: 1 1;
+ align: 0.5 0.5;
+ rel1 {
+ to: "bg";
+ relative: 0.5 0.5;
+
+ }
+ rel2 {
+ to: "bg";
+ relative: 0.5 0.5;
+ }
+ }
+ }/*part*/
+
+ }/*parts*/
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 IMAGE_ICO_SOURCE "ico_source.png"
+
+#define RGB_SYSTEM 155 122 255
+#define RGBA_BLACK_BG 0 0 0 (255*0.9)
+#define RGBA_COLOR_BG RGB_SYSTEM (255*0.25)
+
+group {
+ name: GRP_BG;
+ parts {
+ part {
+ name: "black_bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: RGBA_BLACK_BG;
+ }
+ }
+ part {
+ name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: RGBA_COLOR_BG;
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 IMG_MENU_BG contextual_menu_bg.png
+#define COLOR_MENU_BG 0 0 0 (255*0.8)
+#define COLOR_SEPARATOR 255 255 255 (255*0.2)
+#define COLOR_FOCUS_ITEM_BG 28 36 49 (255*0.8)
+#define COLOR_FOCUS_ITEM_TEXT_NAME 255 255 255 255
+#define COLOR_FOCUS_ITEM_TEXT_TYPE 157 157 157 255
+
+#define SZ_DEFAULT_MENU_PADDING 96 1080
+#define SZ_DEFAULT_MENU_AREA 490 1080
+#define SZ_MENU_AREA 490 213
+#define SZ_SEPARATOR_AREA 490 2
+#define SZ_MENU_BTN_P 0 75
+#define SZ_MENU_BTN 103 115
+#define SZ_MENU_BTN_BTN_P 26 0
+
+#define SZ_FOCUS_ITEM_AREA 318 405
+#define SZ_FOCUS_ITEM_BG 318 320
+#define SZ_FOCUS_ITEM_IMG 160 160
+#define SZ_FOCUS_ITEM_TEXT_P 318 19
+#define SZ_FOCUS_ITEM_TEXT_NAME 318 40
+#define SZ_TEXT_NAME 36
+#define SZ_FOCUS_ITEM_TEXT_TYPE 318 26
+#define SZ_TEXT_TYPE 24
+
+group {
+ name: GRP_MENU;
+ images {
+ image: IMG_MENU_BG COMP;
+ }
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: COLOR_MENU_BG;
+ }
+ }/*part*/
+ part {
+ name: "img_bg";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ image.normal: IMG_MENU_BG;
+ rel1 {
+ to: "bg";
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ to: "bg";
+ relative: 1.0 1.0;
+ }
+ }
+ }/*part*/
+ part {
+ name: "default_menu_padding";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_DEFAULT_MENU_PADDING;
+ fixed: 1 1;
+ rel1 {
+ to: "img_bg";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "img_bg";
+ relative: 1.0 1.0;
+ }
+ align: 1.0 1.0;
+ }
+ }/*part*/
+ part {
+ name: "default_menu_area";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+
+ min: SZ_DEFAULT_MENU_AREA;
+ fixed: 1 1;
+ rel1 {
+ to: "default_menu_padding";
+ relative: 0.0 1.0;
+ }
+ rel2 {
+ to: "default_menu_padding";
+ relative: 0.0 1.0;
+ }
+ align: 1.0 1.0;
+ }
+ }/*part*/
+ part {
+ name: "item_area";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "bg";
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ to: "default_menu_area";
+ relative: 0.0 1.0;
+ }
+ align: 0.5 0.5;
+ }
+ }/*part*/
+
+ part {
+ name: "focus_item_area";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_FOCUS_ITEM_AREA;
+ max: SZ_FOCUS_ITEM_AREA;
+ fixed: 1 1;
+ visible: 0;
+ rel1 {
+ to: "item_area";
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ to: "item_area";
+ relative: 1.0 1.0;
+ }
+ align: 0.5 0.5;
+ visible: 0;
+ }
+ }/*part*/
+ part {
+ name: "focus_item_bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_FOCUS_ITEM_BG;
+ max: SZ_FOCUS_ITEM_BG;
+ fixed: 1 1;
+ rel1 {
+ to: "focus_item_area";
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ to: "focus_item_area";
+ relative: 1.0 0.0;
+ }
+ align: 1.0 0.0;
+ color: COLOR_FOCUS_ITEM_BG;
+ visible: 1;
+ }
+ }/*part*/
+ part {
+ name: PART_FOCUS_ITEM_IMG;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_FOCUS_ITEM_IMG;
+ max: SZ_FOCUS_ITEM_IMG;
+ fixed: 1 1;
+ rel1 {
+ to: "focus_item_bg";
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ to: "focus_item_bg";
+ relative: 1.0 1.0;
+ }
+ }
+ }/*part*/
+ part {
+ name: "focus_item_text_p";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_FOCUS_ITEM_TEXT_P;
+ max: SZ_FOCUS_ITEM_TEXT_P;
+ fixed: 1 1;
+ rel1 {
+ to: "focus_item_bg";
+ relative: 0.0 1.0;
+ }
+ rel2 {
+ to: "focus_item_bg";
+ relative: 1.0 1.0;
+ }
+ align: 0.5 0.0;
+ }
+ }/*part*/
+ part {
+ name: PART_FOCUS_ITEM_TEXT_NAME;
+ type: TEXT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_FOCUS_ITEM_TEXT_NAME;
+ max: SZ_FOCUS_ITEM_TEXT_NAME;
+ fixed: 1 1;
+ rel1 {
+ to: "focus_item_text_p";
+ relative: 0.0 1.0;
+ }
+ rel2 {
+ to: "focus_item_text_p";
+ relative: 1.0 1.0;
+ }
+ text {
+ font: FONT_B;
+ size: SZ_TEXT_NAME;
+ min: 1 1;
+ align: 0.0 0.5;
+ }
+ align: 0.5 0.0;
+ color: COLOR_FOCUS_ITEM_TEXT_NAME;
+ }
+ }/*part*/
+ part {
+ name: PART_FOCUS_ITEM_TEXT_TYPE;
+ type: TEXT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_FOCUS_ITEM_TEXT_TYPE;
+ max: SZ_FOCUS_ITEM_TEXT_TYPE;
+ fixed: 1 1;
+ align: 0.5 0.0;
+ rel1 {
+ to: "focus_item_text_name";
+ relative: 0.0 1.0;
+ }
+ rel2 {
+ to: "focus_item_text_name";
+ relative: 1.0 1.0;
+ }
+ text {
+ font: FONT_R;
+ size: SZ_TEXT_TYPE;
+ min: 0 0;
+ align: 0.0 0.5;
+ }
+ color: COLOR_FOCUS_ITEM_TEXT_TYPE;
+ }
+ }/*part*/
+ part {
+ name: "menu_area";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_MENU_AREA;
+ fixed: 1 1;
+ rel1 {
+ to: "default_menu_area";
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ to: "default_menu_area";
+ relative: 0.0 0.0;
+ }
+ align: 0.0 0.0;
+ }
+ }/*part*/
+ part {
+ name: "separator_area";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: COLOR_SEPARATOR;
+ min: SZ_SEPARATOR_AREA;
+ fixed: 1 1;
+ rel1 {
+ to: "menu_area";
+ relative: 0.0 1.0;
+ }
+ rel2 {
+ to: "menu_area";
+ relative: 0.0 1.0;
+ }
+ align: 0.0 0.0;
+ }
+ }/*part*/
+ part {
+ name: "menu_btn_p";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_MENU_BTN_P;
+ fixed: 1 1;
+ rel1 {
+ to: "menu_area";
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ to: "menu_area";
+ relative: 0.0 0.0;
+ }
+ align: 0.0 0.0;
+ }
+ }/*part*/
+ part {
+ name: PART_MENU_BTN_1;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_MENU_BTN;
+ fixed: 1 1;
+ rel1 {
+ to: "menu_btn_p";
+ relative: 0.0 1.0;
+ }
+ rel2 {
+ to: "menu_btn_p";
+ relative: 0.0 1.0;
+ }
+ align: 0.0 0.0;
+ }
+ }/*part*/
+
+ part {
+ name: "menu_btn1_btn2_p";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_MENU_BTN_BTN_P;
+ fixed: 1 1;
+ rel1 {
+ to: PART_MENU_BTN_1;
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: PART_MENU_BTN_1;
+ relative: 1.0 0.0;
+ }
+ align: 0.0 0.0;
+ }
+ }/*part*/
+
+ part {
+ name: PART_MENU_BTN_2;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_MENU_BTN;
+ fixed: 1 1;
+ rel1 {
+ to: "menu_btn1_btn2_p";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "menu_btn1_btn2_p";
+ relative: 1.0 0.0;
+ }
+ align: 0.0 0.0;
+ }
+ }/*part*/
+ part {
+ name: "menu_btn2_btn3_p";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_MENU_BTN_BTN_P;
+ fixed: 1 1;
+ rel1 {
+ to: PART_MENU_BTN_2;
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: PART_MENU_BTN_2;
+ relative: 1.0 0.0;
+ }
+ align: 0.0 0.0;
+ }
+ }/*part*/
+ part {
+ name: PART_MENU_BTN_3;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: SZ_MENU_BTN;
+ fixed: 1 1;
+ rel1 {
+ to: "menu_btn2_btn3_p";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "menu_btn2_btn3_p";
+ relative: 1.0 0.0;
+ }
+ align: 0.0 0.0;
+ }
+ }/*part*/
+ }/*parts*/
+}/*group*/
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 IMG_MENU_BTN_BG "source_menu_bg.png"
+#define IMG_MENU_BTN_ICO_PLUG "ico_source_plugged.png"
+#define IMG_MENU_BTN_ICO_NEAR "ico_source_nearby.png"
+#define IMG_MENU_BTN_ICO_SELECT "ico_select_nor.png"
+#define IMG_MENU_BTN_ICO_REMOVE "ico_remove_nor.png"
+#define IMG_MENU_BTN_ICO_CONN "ico_connect_nor.png"
+#define IMG_MENU_BTN_ICO_DISCONN "ico_disconnect_nor.png"
+#define IMG_MENU_BTN_ICO_LOGOUT "ico_logout_nor.png"
+#define IMG_MENU_BTN_ICO_FUNC_NOR "function_button_nor.png"
+#define IMG_MENU_BTN_ICO_FUNC_FOC "function_button_foc.png"
+
+#define SZ_MENU_BTN_ICO 40 40
+#define SZ_MENU_BTN_ICO_P 85 87
+#define SZ_MENU_BTN_TEXT 30
+#define SZ_MENU_BTN_TEXT_P 155 87
+#define SZ_MENU_BTN_CTX_BG 103 115
+#define SZ_MENU_BTN_CTX_TEXT 21
+#define SZ_MENU_BTN_CTX_ICO 64 64
+#define SZ_MENU_BTN_CTX_TEXT_P 0 72
+
+
+#define SZ_SET_UP_NETWORK_BTN 273 70
+#define SZ_SET_UP_NETWORK_BTN_TEXT 233 70
+#define SZ_SET_UP_NETWORK_TEXT 28
+
+#define SZ_NETWORK_SETTING_TEXT 30
+#define SZ_NETWORK_SETTING_BTN_TEXT 210 72
+#define SZ_NETWORK_SETTING_BTN 250 72
+
+#define RGBA_MENU_BTN_BG_NORMAL 255 255 255 0
+#define RGBA_MENU_BTN_BG_FOCUS R_SYSTEM G_SYSTEM B_SYSTEM 255
+#define RGBA_MENU_BTN_BG_HIGHLIGHT R_SYSTEM G_SYSTEM B_SYSTEM (255 * 0.2)
+
+#define RGBA_MENU_BTN_ICO_NORMAL 255 255 255 (255 * 0.6)
+#define RGBA_MENU_BTN_ICO_FOCUS 255 255 255 255
+#define RGBA_MENU_BTN_ICO_HIGHLIGHT 255 255 255 255
+
+#define RGBA_MENU_BTN_TEXT_NORMAL 255 255 255 (255 * 0.6)
+#define RGBA_MENU_BTN_TEXT_FOCUS 255 255 255 255
+#define RGBA_MENU_BTN_TEXT_HIGHLIGHT 255 255 255 255
+
+#define RGBA_MENU_BTN_CTX_FUNC_NOR 100 109 124 255
+#define RGBA_MENU_BTN_CTX_FUNC_FOC 69 143 255 255
+#define RGBA_MENU_BTN_CTX_FUNC_DIM 100 109 124 (255*0.2)
+
+#define RGBA_MENU_BTN_CTX_ICO_NOR 255 255 255 255
+#define RGBA_MENU_BTN_CTX_ICO_FOC 255 255 255 255
+#define RGBA_MENU_BTN_CTX_ICO_DIM 255 255 255 (255*0.2)
+
+#define RGBA_MENU_BTN_CTX_TEXT_NOR 255 255 255 255
+#define RGBA_MENU_BTN_CTX_TEXT_FOC 255 255 255 255
+#define RGBA_MENU_BTN_CTX_TEXT_DIM 255 255 255 (255*0.2)
+
+#define RGBA_SET_UP_NETWORK_BTN_NORMAL 204 204 204 255
+#define RGBA_SET_UP_NETWORK_BTN_FOCUS R_SYSTEM G_SYSTEM B_SYSTEM 255
+#define RGBA_SET_UP_NETWORK_BTN_TEXT_NORMAL 89 89 89 255
+#define RGBA_SET_UP_NETWORK_BTN_TEXT_FOCUS 255 255 255 255
+
+#define RGBA_NETWORK_SETTING_BTN_TEXT_FOCUS 255 255 255 255
+#define RGBA_NETWORK_SETTING_BTN_TEXT_NORMAL 175 175 175 255
+#define RGBA_NETWORK_SETTING_BTN_FOCUS R_SYSTEM G_SYSTEM B_SYSTEM 255
+#define RGBA_NETWORK_SETTING_BTN_NORMAL 0 0 0 (255 * 0.25)
+
+group {
+ name: "elm/button/base/"BTN_STYLE_PLUG;
+ images {
+ image: IMG_MENU_BTN_BG COMP;
+ image: IMG_MENU_BTN_ICO_PLUG COMP;
+ }
+ parts {
+ part {
+ name: "button_image";
+ description {
+ state: "default" 0.0;
+ color: RGBA_MENU_BTN_BG_NORMAL;
+ image {
+ normal: IMG_MENU_BTN_BG;
+ border: 7 7 7 7;
+ border_scale: 1;
+ }
+ }
+ description {
+ state: "focus" 0.0;
+ inherit: "default" 0.0;
+ color: RGBA_MENU_BTN_BG_FOCUS;
+ }
+ description {
+ state: "highlight" 0.0;
+ inherit: "default" 0.0;
+ color: RGBA_MENU_BTN_BG_HIGHLIGHT;
+ }
+ }
+ part {
+ name: "button_ico";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ image.normal: IMG_MENU_BTN_ICO_PLUG;
+ fixed: 1 1;
+ min: SZ_MENU_BTN_ICO;
+ max: SZ_MENU_BTN_ICO;
+ rel1.to: "button_icon_p";
+ rel1.relative: 1.0 0.5;
+ rel2.to: "button_icon_p";
+ rel2.relative: 1.0 0.5;
+ align: 0.0 0.5;
+ color: RGBA_MENU_BTN_ICO_NORMAL;
+ }
+ description {
+ state: "focus" 0.0;
+ inherit: "default" 0.0;
+ color: RGBA_MENU_BTN_ICO_FOCUS;
+
+ }
+ description {
+ state: "highlight" 0.0;
+ inherit: "default" 0.0;
+ color: RGBA_MENU_BTN_ICO_HIGHLIGHT;
+ }
+ }
+ part {
+ name: "button_icon_p";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.relative: 0.0 0.0;
+ rel2.relative: 0.0 0.0;
+ align: 0.0 0.0;
+ min: SZ_MENU_BTN_ICO_P;
+ max: SZ_MENU_BTN_ICO_P;
+ fixed: 1 1;
+ }
+ }
+ part {
+ name: "button_text_p";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.relative: 0.0 0.0;
+ rel2.relative: 0.0 0.0;
+ align: 0.0 0.0;
+ min: SZ_MENU_BTN_TEXT_P;
+ max: SZ_MENU_BTN_TEXT_P;
+ fixed: 1 1;
+ }
+ }
+ part {
+ name: "button_text";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to: "button_text_p";
+ rel1.relative: 1.0 0.5;
+ rel2.to: "button_text_p";
+ rel2.relative: 1.0 0.5;
+ color: RGBA_MENU_BTN_TEXT_NORMAL;
+ align: 0.0 0.5;
+ fixed: 1 1;
+ text {
+ font: FONT_R;
+ size: SZ_MENU_BTN_TEXT;
+ min: 1 1;
+ align: 0.0 0.5;
+ text_class: "button";
+ }
+ }
+ description {
+ state: "focus" 0.0;
+ inherit: "default" 0.0;
+ color: RGBA_MENU_BTN_TEXT_FOCUS;
+ text.font: FONT_B;
+ }
+ description {
+ state: "highlight" 0.0;
+ inherit: "default" 0.0;
+ color: RGBA_MENU_BTN_TEXT_HIGHLIGHT;
+ text.font: FONT_B;
+ }
+ }
+ part { name: "event";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "button_click";
+ signal: "mouse,down,1"; source: "event";
+ action: SIGNAL_EMIT "elm,action,press" "";
+ }
+ program {
+ name: "button_unclick";
+ signal: "mouse,up,1"; source: "event";
+ action: SIGNAL_EMIT "elm,action,unpress" "";
+ }
+ program{
+ name: "mouse_unclick_after";
+ signal: "mouse,clicked,1"; source: "event";
+ action: SIGNAL_EMIT "elm,action,click" "";
+ }
+ program {
+ name: "button_focus";
+ signal: "elm,action,focus"; source: "elm";
+ action: STATE_SET "focus" 0.0;
+ target: "button_image";
+ target: "button_ico";
+ target: "button_text";
+ }
+ program {
+ name: "button_unfocus";
+ signal: "elm,action,unfocus"; source: "elm";
+ script {
+ new st1[31];
+ new Float:vl;
+ get_state(PART:"button_image", st1, 30, vl);
+ if (!strcmp(st1, "focus")) {
+ set_state(PART:"button_image", "default", 0.0);
+ set_state(PART:"button_ico", "default", 0.0);
+ set_state(PART:"button_text", "default", 0.0);
+ }
+ }
+ }
+ program {
+ name: "button_highlight";
+ signal: "elm,action,highlight"; source: "elm";
+ action: STATE_SET "highlight" 0.0;
+ target: "button_image";
+ target: "button_ico";
+ target: "button_text";
+ }
+ }
+
+}
+
+group {
+ name: "elm/button/base/"BTN_STYLE_NEAR;
+ inherit: "elm/button/base/"BTN_STYLE_PLUG;
+ images {
+ image: IMG_MENU_BTN_ICO_NEAR COMP;
+ }
+ parts {
+ part {
+ name: "button_ico";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ image.normal: IMG_MENU_BTN_ICO_NEAR;
+ fixed: 1 1;
+ min: SZ_MENU_BTN_ICO;
+ max: SZ_MENU_BTN_ICO;
+ rel1.to: "button_icon_p";
+ rel1.relative: 1.0 0.5;
+ rel2.to: "button_icon_p";
+ rel2.relative: 1.0 0.5;
+ align: 0.0 0.5;
+ color: RGBA_MENU_BTN_ICO_NORMAL;
+ }
+ description {
+ state: "focus" 0.0;
+ inherit: "default" 0.0;
+ color: RGBA_MENU_BTN_ICO_FOCUS;
+
+ }
+ description {
+ state: "highlight" 0.0;
+ inherit: "default" 0.0;
+ color: RGBA_MENU_BTN_ICO_HIGHLIGHT;
+ }
+ }
+ }
+}
+
+group {
+ name: "elm/button/base/"BTN_STYLE_SET_UP_NETWORK;
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: SZ_SET_UP_NETWORK_BTN;
+ max: SZ_SET_UP_NETWORK_BTN;
+ color: RGBA_SET_UP_NETWORK_BTN_NORMAL;
+ }
+ description {
+ state: "focus" 0.0;
+ inherit: "default" 0.0;
+ color: RGBA_SET_UP_NETWORK_BTN_FOCUS;
+
+ }
+ }
+ part {
+ name: "elm.text";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to: "bg";
+ rel2.to: "bg";
+ color: RGBA_SET_UP_NETWORK_BTN_TEXT_NORMAL;
+ fixed: 1 1;
+ min: SZ_SET_UP_NETWORK_BTN_TEXT;
+ max: SZ_SET_UP_NETWORK_BTN_TEXT;
+ text {
+ font: FONT_M;
+ size: SZ_SET_UP_NETWORK_TEXT;
+ min: 1 1;
+ align: 0.5 0.5;
+ text_class: "button";
+ }
+ }
+ description {
+ state: "focus" 0.0;
+ inherit: "default" 0.0;
+ color: RGBA_SET_UP_NETWORK_BTN_TEXT_FOCUS;
+ text.font: FONT_B;
+ }
+ }
+ part { name: "event";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "button_click";
+ signal: "mouse,down,1"; source: "event";
+ action: SIGNAL_EMIT "elm,action,press" "";
+ }
+ program {
+ name: "button_unclick";
+ signal: "mouse,up,1"; source: "event";
+ action: SIGNAL_EMIT "elm,action,unpress" "";
+ }
+ program{
+ name: "mouse_unclick_after";
+ signal: "mouse,clicked,1"; source: "event";
+ action: SIGNAL_EMIT "elm,action,click" "";
+ }
+ program {
+ name: "button_focus";
+ signal: "elm,action,focus"; source: "elm";
+ action: STATE_SET "focus" 0.0;
+ target: "bg";
+ target: "elm.text";
+ }
+ program {
+ name: "button_unfocus";
+ signal: "elm,action,unfocus"; source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "bg";
+ target: "elm.text";
+ }
+ }
+}
+
+group {
+ name: "elm/button/base/"BTN_STYLE_NETWORK_SET;
+ inherit: "elm/button/base/"BTN_STYLE_SET_UP_NETWORK;
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: SZ_NETWORK_SETTING_BTN;
+ max: SZ_NETWORK_SETTING_BTN;
+ color: RGBA_NETWORK_SETTING_BTN_NORMAL;
+ }
+ description {
+ state: "focus" 0.0;
+ inherit: "default" 0.0;
+ color: RGBA_NETWORK_SETTING_BTN_FOCUS;
+
+ }
+ }
+ part {
+ name: "elm.text";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to: "bg";
+ rel2.to: "bg";
+ color: RGBA_NETWORK_SETTING_BTN_TEXT_NORMAL;
+ fixed: 1 1;
+ min: SZ_NETWORK_SETTING_BTN_TEXT;
+ max: SZ_NETWORK_SETTING_BTN_TEXT;
+ text {
+ font: FONT_R;
+ size: SZ_NETWORK_SETTING_TEXT;
+ min: 1 1;
+ align: 0.5 0.5;
+ text_class: "button";
+ }
+ }
+ description {
+ state: "focus" 0.0;
+ inherit: "default" 0.0;
+ color: RGBA_NETWORK_SETTING_BTN_TEXT_FOCUS;
+ text.font: FONT_M;
+ }
+ }
+ }
+}
+
+group {
+ name: "elm/button/base/menu_ctx_sel";
+ images {
+ image: IMG_MENU_BTN_ICO_FUNC_NOR COMP;
+ image: IMG_MENU_BTN_ICO_FUNC_FOC COMP;
+ image: IMG_MENU_BTN_ICO_SELECT COMP;
+ }
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: SZ_MENU_BTN_CTX_BG;
+ max: SZ_MENU_BTN_CTX_BG;
+ visible: 0;
+ }
+ }
+ part {
+ name: "button_func";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ image.normal: IMG_MENU_BTN_ICO_FUNC_NOR;
+ fixed: 1 1;
+ min: SZ_MENU_BTN_CTX_ICO;
+ max: SZ_MENU_BTN_CTX_ICO;
+ rel1.to: "bg";
+ rel1.relative: 0 0;
+ rel2.to: "bg";
+ rel2.relative: 1 0;
+ align: 0.5 0.0;
+ color: RGBA_MENU_BTN_CTX_FUNC_NOR;
+ }
+ description {
+ state: "focus" 0.0;
+ inherit: "default" 0.0;
+ image.normal: IMG_MENU_BTN_ICO_FUNC_FOC;
+ color: RGBA_MENU_BTN_CTX_FUNC_FOC;
+ }
+ }
+ part {
+ name: "button_ico";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ image.normal: IMG_MENU_BTN_ICO_SELECT;
+ fixed: 1 1;
+ min: SZ_MENU_BTN_CTX_ICO;
+ max: SZ_MENU_BTN_CTX_ICO;
+ rel1.to: "bg";
+ rel1.relative: 0 0;
+ rel2.to: "bg";
+ rel2.relative: 1 0;
+ align: 0.5 0.0;
+ color: RGBA_MENU_BTN_CTX_ICO_NOR;
+ }
+ description {
+ state: "focus" 0.0;
+ inherit: "default" 0.0;
+ color: RGBA_MENU_BTN_CTX_ICO_FOC;
+
+ }
+ }
+ part {
+ name: "button_text_p";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: SZ_MENU_BTN_CTX_TEXT_P;
+ max: SZ_MENU_BTN_CTX_TEXT_P;
+ rel1.to: "bg";
+ rel1.relative: 0 0;
+ rel2.to: "bg";
+ rel2.relative: 0 0;
+ align: 0 0;
+ }
+ }
+ part {
+ name: PART_MENU_BTN_TEXT;
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to: "button_text_p";
+ rel1.relative: 1.0 1.0;
+ rel2.to: "bg";
+ rel2.relative: 1.0 1.0;
+ color: RGBA_MENU_BTN_CTX_TEXT_NOR;
+ fixed: 1 1;
+ text {
+ font: FONT_R;
+ size: SZ_MENU_BTN_CTX_TEXT;
+ min: 1 1;
+ max: 1 1;
+ text_class: "button";
+ }
+ }
+ description {
+ state: "focus" 0.0;
+ inherit: "default" 0.0;
+ color: RGBA_MENU_BTN_CTX_TEXT_FOC;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "button_focus";
+ signal: "elm,action,focus"; source: "elm";
+ action: STATE_SET "focus" 0.0;
+ target: "button_func";
+ target: "button_ico";
+ target: "button_text";
+ }
+ program {
+ name: "button_unfocus";
+ signal: "elm,action,unfocus"; source: "elm";
+ script {
+ new st1[31];
+ new Float:vl;
+ get_state(PART:"button_func", st1, 30, vl);
+ if (!strcmp(st1, "focus")) {
+ set_state(PART:"button_func", "default", 0.0);
+ set_state(PART:"button_ico", "default", 0.0);
+ set_state(PART:"button_text", "default", 0.0);
+ }
+ }
+ }
+ }
+}
+
+group {
+ name: "elm/button/base/menu_ctx_rm";
+ inherit: "elm/button/base/menu_ctx_sel";
+ images {
+ image: IMG_MENU_BTN_ICO_REMOVE COMP;
+ }
+ parts {
+ part {
+ name: "button_ico";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ image.normal: IMG_MENU_BTN_ICO_REMOVE;
+ fixed: 1 1;
+ min: SZ_MENU_BTN_CTX_ICO;
+ max: SZ_MENU_BTN_CTX_ICO;
+ rel1.to: "bg";
+ rel1.relative: 0 0;
+ rel2.to: "bg";
+ align: 0.5 0.0;
+ color: RGBA_MENU_BTN_CTX_ICO_NOR;
+ }
+ description {
+ state: "focus" 0.0;
+ inherit: "default" 0.0;
+ color: RGBA_MENU_BTN_CTX_ICO_FOC;
+
+ }
+ }
+ }
+}
+
+group {
+ name: "elm/button/base/menu_ctx_conn";
+ inherit: "elm/button/base/menu_ctx_sel";
+ images {
+ image: IMG_MENU_BTN_ICO_CONN COMP;
+ }
+ parts {
+ part {
+ name: "button_ico";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ image.normal: IMG_MENU_BTN_ICO_CONN;
+ fixed: 1 1;
+ min: SZ_MENU_BTN_CTX_ICO;
+ max: SZ_MENU_BTN_CTX_ICO;
+ rel1.to: "bg";
+ rel1.relative: 0 0;
+ rel2.to: "bg";
+ align: 0.5 0.0;
+ color: RGBA_MENU_BTN_CTX_ICO_NOR;
+ }
+ description {
+ state: "focus" 0.0;
+ inherit: "default" 0.0;
+ color: RGBA_MENU_BTN_CTX_ICO_FOC;
+
+ }
+ }
+ }
+}
+
+group {
+ name: "elm/button/base/menu_ctx_disconn";
+ inherit: "elm/button/base/menu_ctx_sel";
+ images {
+ image: IMG_MENU_BTN_ICO_DISCONN COMP;
+ }
+ parts {
+ part {
+ name: "button_ico";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ image.normal: IMG_MENU_BTN_ICO_DISCONN;
+ fixed: 1 1;
+ min: SZ_MENU_BTN_CTX_ICO;
+ max: SZ_MENU_BTN_CTX_ICO;
+ rel1.to: "bg";
+ rel1.relative: 0 0;
+ rel2.to: "bg";
+ align: 0.5 0.0;
+ color: RGBA_MENU_BTN_CTX_ICO_NOR;
+ }
+ description {
+ state: "focus" 0.0;
+ inherit: "default" 0.0;
+ color: RGBA_MENU_BTN_CTX_ICO_FOC;
+
+ }
+ }
+ }
+}
+
+group {
+ name: "elm/button/base/menu_ctx_logout";
+ inherit: "elm/button/base/menu_ctx_sel";
+ images {
+ image: IMG_MENU_BTN_ICO_LOGOUT COMP;
+ }
+ parts {
+ part {
+ name: "button_ico";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ image.normal: IMG_MENU_BTN_ICO_LOGOUT;
+ fixed: 1 1;
+ min: SZ_MENU_BTN_CTX_ICO;
+ max: SZ_MENU_BTN_CTX_ICO;
+ rel1.to: "bg";
+ rel1.relative: 0 0;
+ rel2.to: "bg";
+ align: 0.5 0.0;
+ color: RGBA_MENU_BTN_CTX_ICO_NOR;
+ }
+ description {
+ state: "focus" 0.0;
+ inherit: "default" 0.0;
+ color: RGBA_MENU_BTN_CTX_ICO_FOC;
+
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 __WIDGET_COMMON_H__
+#define __WIDGET_COMMON_H__
+
+#define FONT_R "TizenSans"
+#define FONT_B "TizenSans:style=Bold"
+#define FONT_M "TizenSans:style=Medium"
+#define R_SYSTEM 155
+#define G_SYSTEM 122
+#define B_SYSTEM 255
+
+#endif /* __WIDGET_COMMON_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 RGBA_ITEM_BG_NORMAL 0 0 0 (255*0.3)
+#define RGBA_ITEM_BG_FOCUS R_SYSTEM G_SYSTEM B_SYSTEM 255
+#define RGBA_ITEM_BG_DIM 0 0 0 (255*0.3)
+
+#define RGBA_ITEM_NAME_NORMAL 211 211 211 255
+#define RGBA_ITEM_NAME_FOCUS 255 255 255 255
+#define RGBA_ITEM_NAME_DIM 211 211 211 (255*0.3)
+
+#define RGBA_ITEM_TYPE_NORMAL 134 134 134 255
+#define RGBA_ITEM_TYPE_FOCUS 255 255 255 255
+#define RGBA_ITEM_TYPE_DIM 134 134 134 (255*0.3)
+
+#define RGBA_ITEM_ICO_DIM 255 255 255 (255*0.2)
+
+#define SZ_ITEM_ICO 160 160
+#define SZ_ITEM_P 273 338
+#define SZ_ITEM_BG 263 328
+#define SZ_ITEM_BG_ICO_P 0 52
+#define SZ_ITEM_NAME_FONT 30
+#define SZ_ITEM_TYPE_FONT 22
+
+#define IMG_ICO_ANTENNA "ico_antenna.png"
+#define IMG_ICO_USB "ico_usb.png"
+#define IMG_ICO_SVIDEO "ico_svideo.png"
+#define IMG_ICO_DSUB "ico_dsub.png"
+#define IMG_ICO_HDMI "ico_hdmi.png"
+
+
+#define IMG_ICO_COMP "ico_component.png"
+#define IMG_ICO_CONSOLE "ico_console.png"
+#define IMG_ICO_MOBILE "ico_mobile.png"
+#define IMG_ICO_NAS "ico_nas.png"
+#define IMG_ICO_SETTOP "ico_settop.png"
+
+#define IMG_ICO_WIFI_NOR "ico_wifi_nor.png"
+#define IMG_ICO_WIFI_FOC "ico_wifi_foc.png"
+
+#define IMG_ICO_XBOX_NOR "ico_xbox_nor.png"
+#define IMG_ICO_XBOX_FOC "ico_xbox_foc.png"
+
+/* group for source */
+group {
+ name: "elm/gengrid/item/source/default";
+ data.item: "contents" "item_ico";
+ data.item: "texts" "item_name item_type";
+ images {
+ image: IMG_ICO_USB COMP;
+ }
+ parts {
+ part {
+ name: "item_p";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel2.relative: 0.0 0.0;
+ min: SZ_ITEM_P;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "item_bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to: "item_p";
+ rel1.relative: 0.0 0.0;
+ rel2.to: "item_p";
+ rel2.relative: 0.0 0.0;
+ min: SZ_ITEM_BG;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ color: RGBA_ITEM_BG_NORMAL;
+ }
+ description {
+ state: "focus" 0.0;
+ inherit: "default" 0.0;
+ color: RGBA_ITEM_BG_FOCUS;
+ }
+ description {
+ state: "dim" 0.0;
+ inherit: "default" 0.0;
+ color: RGBA_ITEM_BG_DIM;
+ }
+ }
+ part {
+ name: "item_bg_ico_p";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to: "item_bg";
+ rel1.relative: 0.5 0.0;
+ rel2.to: "item_bg";
+ rel2.relative: 0.5 0.0;
+ min: SZ_ITEM_BG_ICO_P;
+ fixed: 0 1;
+ align: 0.5 0.0;
+ }
+ }
+ part {
+ name: "item_ico";
+ scale: 1;
+ type: SWALLOW;
+ mouse_events: 0;
+ description {
+ state : "default" 0.0;
+ rel1.to: "item_bg_ico_p";
+ rel1.relative: 0.5 1.0;
+ rel2.to: "item_bg_ico_p";
+ rel2.relative: 0.5 1.0;
+ min: SZ_ITEM_ICO;
+ fixed: 1 1;
+ align: 0.5 0.0;
+ visible: 1;
+ }
+ }
+
+ part {
+ name: "item_name";
+ type: TEXT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: RGBA_ITEM_NAME_NORMAL;
+ text {
+ font: FONT_M;
+ size: SZ_ITEM_NAME_FONT;
+ min: 0 0 ;
+ align: 0.5 0.5;
+ text_class: "grid_item";
+ }
+ min: 223 41;
+ rel1.to: "item_ico";
+ rel1.relative: 0.5 1.0;
+ rel2.to: "item_ico";
+ rel2.relative: 0.5 1.0;
+ align: 0.5 0.0;
+ }
+ description {
+ state: "focus" 0.0;
+ inherit: "default" 0.0;
+ text.font: FONT_M;
+ color: RGBA_ITEM_NAME_FOCUS;
+
+ }
+ description {
+ state: "dim" 0.0;
+ inherit: "default" 0.0;
+ color: RGBA_ITEM_NAME_DIM;
+ }
+ }
+ part {
+ name: "item_type";
+ type: TEXT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: RGBA_ITEM_TYPE_NORMAL;
+ text {
+ font: FONT_R;
+ size: SZ_ITEM_TYPE_FONT;
+ min: 0 0 ;
+ align: 0.5 0.5;
+ }
+ min: 223 32;
+ rel1.to: "item_name";
+ rel1.relative: 0.5 1.0;
+ rel2.to: "item_name";
+ rel2.relative: 0.5 1.0;
+ align: 0.5 0.0;
+ }
+ description {
+ state: "focus" 0.0;
+ inherit: "default" 0.0;
+ text.font: FONT_R;
+ color: RGBA_ITEM_TYPE_FOCUS;
+
+ }
+ description {
+ state: "dim" 0.0;
+ inherit: "default" 0.0;
+ color: RGBA_ITEM_TYPE_DIM;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "go_active";
+ signal: "elm,state,focused";
+ source: "elm";
+ action: STATE_SET "focus" 0.0;
+ target: "item_bg";
+ target: "item_name";
+ target: "item_type";
+ }
+ program {
+ name: "go_passive";
+ signal: "elm,state,unfocused";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "item_bg";
+ target: "item_name";
+ target: "item_type";
+ }
+ program {
+ name: "go_disabled";
+ signal: "elm,state,disabled";
+ source: "elm";
+ action: STATE_SET "dim" 0.0;
+ target: "item_bg";
+ target: "item_name";
+ target: "item_type";
+ }
+ program {
+ name: "go_enabled";
+ signal: "elm,state,enabled";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "item_bg";
+ target: "item_name";
+ target: "item_type";
+ }
+ }
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+group {
+ name: "elm/label/base/"LABEL_STYLE_WIFI;
+
+ parts {
+ part {
+ name: "elm.text";
+ type: TEXT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 134 134 134 255;
+ text {
+ font: "TizenSans:style=Regular";
+ size: 24;
+ min: 1 1;
+ max: 1 1;
+ align: 0.0 0.5;
+ }
+ align: 0.0 0.5;
+ rel1 {
+ relative: 0.0 0.5;
+ }
+ rel2 {
+ relative: 0.0 0.5;
+ }
+ }
+ }/*part*/
+
+ }/*parts*/
+}/*group*/
+
+group {
+ name: "elm/label/base/"LABEL_STYLE_WIFI_SWITCH;
+
+ parts {
+ part {
+ name: "elm.text";
+ type: TEXT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 134 134 134 255;
+ text {
+ font: "TizenSans:style=Regular";
+ size: 24;
+ min: 1 1;
+ max: 1 1;
+ align: 0.0 0.5;
+ }
+ align: 0.0 0.5;
+ rel1 {
+ relative: 0.0 0.5;
+ }
+ rel2 {
+ relative: 0.0 0.5;
+ }
+ }
+ description {
+ state: "off" 0.0;
+ inherit: "default" 0.0;
+ color: 155 122 255 255;
+ text {
+ font: "TizenSans:style=Regular";
+ size: 24;
+ min: 1 1;
+ max: 1 1;
+ align: 1.0 0.5;
+ }
+ }
+ }/*part*/
+ }/*parts*/
+ programs {
+ program {
+ name: "wifi_on";
+ signal: "action,wifi_on"; source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "elm.text";
+ }
+ program {
+ name: "wifi_off";
+ signal: "action,wifi_off"; source: "elm";
+ action: STATE_SET "off" 0.0;
+ target: "elm.text";
+ }
+ }
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 RGBA_BG R_SYSTEM G_SYSTEM B_SYSTEM 255
+
+group {
+ name: "elm/progressbar/horizontal/"PB_STYLE_SRC_LOAD;
+ images {
+ image: "progress_wheel.png" COMP;
+ }
+
+ script {
+ public g_frame;
+ public tick_timer;
+
+ public do_rotation(val) {
+ new frame, tim, frame_per_second, frame_per_rotation;
+ frame = get_int(g_frame);
+ frame_per_second = 30;
+ frame_per_rotation = 20;
+ frame = frame + 1;
+ if (frame ==20)
+ frame = 0;
+ set_state_val(PART:"background", STATE_MAP_ROT_Z, frame * (360.0 / frame_per_rotation));
+ set_state(PART:"background", "custom", 0.0);
+ set_int(g_frame, frame);
+ tim = get_int(tick_timer);
+ if (tim) {
+ cancel_timer(tim);
+ }
+ tim = timer(1.0/frame_per_second, "do_rotation", 0);
+ set_int(tick_timer, tim);
+ }
+ public stop_rotation(val){
+ new tim;
+ tim = get_int(tick_timer);
+ if (tim) {
+ cancel_timer(tim);
+ }
+ }
+ }
+
+ parts {
+ part {
+ name: "elm.background.progressbar";
+ type: RECT; mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ }
+ }
+ part {
+ name: "elm.swallow.bar";
+ type: SWALLOW; mouse_events: 0;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: 0 0;
+ max: 0 0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.swallow.content";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 0;
+ max: 0 0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "background";
+ mouse_events: 0;
+ scale: 1;
+ clip_to: "elm.background.progressbar";
+ description {
+ state: "default" 0.0;
+ color: RGBA_BG;
+ min: 50 50;
+ max: 50 50;
+ aspect: 1.0 1.0;
+ aspect_preference: BOTH;
+ image.normal: "progress_wheel.png";
+ }
+ description {
+ state: "pulse" 0.0;
+ inherit: "default" 0.0;
+ image.normal: "progress_wheel.png";
+ map {
+ on: 1;
+ smooth: 1;
+ }
+ }
+ }
+ }
+ programs {
+ program {
+ name: "start_pulse";
+ signal: "elm,state,pulse,start"; source: "elm";
+ action: STATE_SET "pulse" 0.0;
+ target: "background";
+ transition: LINEAR 0.5;
+ script {
+ new tim;
+ tim = get_int(tick_timer);
+ if (tim) {
+ cancel_timer(tim);
+ set_int(tick_timer, 0);
+ }
+ custom_state(PART:"background", "pulse", 0.0);
+ do_rotation(0);
+ }
+ }
+ program {
+ name: "stop_pulse";
+ signal: "elm,state,pulse,stop"; source: "elm";
+ script {
+ stop_rotation(0);
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 __DBG_H__
+#define __DBG_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "source-list"
+
+#include <dlog.h>
+
+#ifndef _ERR
+#define _ERR(fmt, args...) LOGE("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+#ifndef _DBG
+#define _DBG(fmt, args...) LOGD("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+#ifndef _INFO
+#define _INFO(fmt, args...) LOGI("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __DBG_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 __DEF_H__
+#define __DEF_H__
+
+/* for source-list edc */
+#define GRP_BG "bg"
+
+#define GRP_ALLSRC "grp_allsrc"
+#define PART_TITLE_STR "part_title_str"
+#define PART_MENU_PLUGGED "part_menu_plugged"
+#define PART_MENU_NEARBY "part_menu_nearby"
+#define PART_CONTENT "part_content"
+#define PART_UTILITY_BUTTON "part_utility_button"
+#define PART_UTILITY_LOADING "part_utility_loading"
+
+#define GRP_CONTENT "grp_allsrc_content"
+#define PART_CONTENT_CONTENT "part_content_content"
+
+#define GRP_NO_PLUG_SRC_LABEL "grp_no_plug_src_label"
+#define GRP_NO_NEAR_SRC_LABEL "grp_no_near_src_label"
+#define PART_NO_SRC_TEXT_LINE1 "part_no_src_text_line1"
+#define PART_NO_SRC_TEXT_LINE2 "part_no_src_text_line2"
+#define PART_NO_SRC_TEXT_LINE3 "part_no_src_text_line3"
+#define PART_BUTTON "part_no_src_button"
+#define GRP_NO_NEAR_SRC_SEPARATOR "grp_no_near_src_separator"
+
+#define GRP_MENU "grp_contextual_menu"
+#define PART_MENU_BTN_1 "part_menu_btn_1"
+#define PART_MENU_BTN_2 "part_menu_btn_2"
+#define PART_MENU_BTN_3 "part_menu_btn_3"
+#define PART_FOCUS_ITEM_IMG "part_focus_item_img"
+#define PART_FOCUS_ITEM_TEXT_NAME "focus_item_text_name"
+#define PART_FOCUS_ITEM_TEXT_TYPE "focus_item_text_type"
+
+#define PART_ITEM_ICO "item_ico"
+#define PART_ITEM_NAME "item_name"
+#define PART_ITEM_TYPE "item_type"
+
+#define SIG_ELM_ACTION_HIGHLIGHT "elm,action,highlight"
+#define SIG_ELM "elm"
+
+/* for source-list theme edc */
+#define PART_MENU_BTN_TEXT "button_text"
+
+/* for styles */
+#define BTN_STYLE_PLUG "menu_plug"
+#define BTN_STYLE_NEAR "menu_near"
+#define BTN_STYLE_SET_UP_NETWORK "set_up_network"
+#define BTN_STYLE_NETWORK_SET "network_setting"
+#define PB_STYLE_SRC_LOAD "source_loading"
+#define LABEL_STYLE_WIFI "wifi_label"
+#define LABEL_STYLE_WIFI_SWITCH "wifi_switch_label"
+
+/* for delete gengrid item timer */
+#define DEL_IT_TIME 2.0
+#define ITEM_H 273
+#define ITEM_W 338
+#define ITEM_ICO_DIM_R 255
+#define ITEM_ICO_DIM_G 255
+#define ITEM_ICO_DIM_B 255
+#define ITEM_ICO_DIM_A (255 * 0.2)
+#define NO_NAME "No Name"
+#define NO_TYPE "Unknown Type"
+
+/* for key */
+#define KEY_ENTER "Return"
+
+#endif /* __DEF_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 __SOURCE_INFO_H__
+#define __SOURCE_INFO_H__
+
+#include "external.h"
+
+class CSourceInfo {
+private:
+ ext_type m_eConnType;
+ int m_nFlag;
+ char *m_pName;
+ char *m_pType;
+ void *m_pData;
+
+public:
+ CSourceInfo();
+ virtual ~CSourceInfo();
+
+ void SetFlag(int flag);
+ int Flag(void);
+
+ void SetName(const char *name);
+ const char *Name(void);
+
+ void SetType(const char *type);
+ const char *Type(void);
+
+ void SetConnType(ext_type type);
+ ext_type ConnType(void);
+
+ void SetData(void *pData);
+ void* Data(void);
+
+ const char *IconPath(void);
+
+ bool SwitchTo(void);
+};
+
+
+#endif /* __SOURCE_INFO_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 __EXTERNAL_H__
+#define __EXTERNAL_H__
+
+
+/* This enum should be correspondence with TVS ESource */
+enum ext_type {
+ CONN_TYPE_TV = 0,
+ CONN_TYPE_AV1,
+ CONN_TYPE_AV2,
+ CONN_TYPE_AV3,
+ CONN_TYPE_SVIDEO1,
+ CONN_TYPE_SVIDEO2,
+ CONN_TYPE_SVIDEO3,
+ CONN_TYPE_COMP1,
+ CONN_TYPE_COMP2,
+ CONN_TYPE_COMP3,
+ CONN_TYPE_PC1,
+ CONN_TYPE_PC2,
+ CONN_TYPE_PC3,
+ CONN_TYPE_HDMI1,
+ CONN_TYPE_HDMI2,
+ CONN_TYPE_HDMI3,
+ CONN_TYPE_HDMI4,
+ CONN_TYPE_SCART1,
+ CONN_TYPE_SCART2,
+ CONN_TYPE_SCART3,
+ CONN_TYPE_DVI1,
+ CONN_TYPE_DVI2,
+ CONN_TYPE_DVI3,
+
+ CONN_TYPE_USB,
+ CONN_TYPE_WIFI,
+ CONN_TYPE_WIFI_DIRECT,
+ CONN_TYPE_LAN
+};
+
+
+class CExternal {
+public:
+ struct SCallback {
+ void (*proc_cb)(int action, void *cbdata, void *data);
+ void *cbdata;
+ };
+
+private:
+ struct SExternal *m;
+
+public:
+ CExternal() : m(0) {}
+ virtual ~CExternal() {}
+
+ bool Create(const SCallback *cb);
+ virtual void Destroy(void);
+
+ void GetConnected(void);
+
+ static bool SwitchTo(ext_type type);
+ static const char *Name(ext_type type);
+
+ //void external_get_connected(struct external *ext);
+ //bool external_switch_to(enum ext_type ext_type);
+ //const char *external_get_name(enum ext_type ext_type);
+
+};
+
+//struct external;
+//struct external *external_init(struct source_cb *scb);
+//void external_fini(struct external *ext);
+//void external_get_connected(struct external *ext);
+//bool external_switch_to(enum ext_type ext_type);
+//const char *external_get_name(enum ext_type ext_type);
+
+
+#endif /* __EXTERNAL_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 __LAYOUTMGR_H__
+#define __LAYOUTMGR_H__
+
+
+#include "source_mgr.h"
+
+
+typedef void (*sig_event_cb)(Evas_Object *base, int signal);
+
+enum user_signals {
+ E_HIGHLIGHT = 0,
+ E_RETURN
+};
+
+struct layout_class {
+ Evas_Object * (*create)(Evas_Object *base,
+ sig_event_cb ptr);
+ void (*destory)(Evas_Object *layout);
+ void (*pause)(Evas_Object *layout);
+ void (*resume)(Evas_Object *layout);
+ TUpdateUI update;
+};
+
+struct layoutmgr;
+
+struct layoutmgr *layoutmgr_init(Evas_Object *base, sig_event_cb ptr);
+void layoutmgr_fini(struct layoutmgr *lmgr);
+
+Evas_Object *layoutmgr_create_layout(struct layoutmgr *lmgr,
+ struct layout_class *lclass);
+void layoutmgr_destory_layout(struct layout_class *lclass,
+ Evas_Object *layout);
+
+void layoutmgr_pause_layout(struct layout_class *lclass, Evas_Object *layout);
+void layoutmgr_resume_layout(struct layout_class *lclass, Evas_Object *layout);
+
+void layoutmgr_update_layout(struct layout_class *lclass, Evas_Object *layout,
+ enum update_ui update_type, void *data);
+
+#endif /* __LAYOUTMGR_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 __SRC_MGR_H__
+#define __SRC_MGR_H__
+
+
+#include "SourceInfo.h"
+
+
+enum update_ui {
+ SRC_UPDATE_ALL,
+ SRC_PLUG_ADD_ONE,/* add a new source to the source list */
+ SRC_PLUG_DEL_ONE,/* delete a source from source list */
+ SRC_NEAR_ADD_ONE,
+ SRC_NEAR_DEL_ONE,
+};
+
+typedef void (*TUpdateUI)(void *user_data, void *data, enum update_ui update_type);
+
+
+class CSourceMgr {
+private:
+ static CSourceMgr *instance;
+ struct SSourceMgr *m;
+
+private:
+ static void sm_CbPlug(int is_plugged, void *data, void *dev);
+ void m_OnPlug(int is_plugged, void* dev);
+
+ static void sm_CbExternalPlug(int is_plugged, void *cbdata, void *data);
+ void m_OnExternalPlug(int is_plugged, void *data);
+
+ CSourceInfo *m_AllocSI(int type);
+ CSourceInfo *m_AllocUsbSI(void *dev);
+
+protected:
+
+ void t_FreeAllSource(void);
+ void t_Free(CSourceInfo *si);
+ void t_UpdateUI(void *data, enum update_ui update_type);
+
+private:
+ CSourceMgr() : m(0) {}
+ virtual ~CSourceMgr() {}
+
+ bool t_Create(TUpdateUI cb, void *data);
+ void t_Destroy(void);
+
+public:
+ static bool Initialize(TUpdateUI cb, void *data);
+ static void Finalize(void);
+
+ static CSourceMgr *GetInstance(void);
+
+ void Refresh(void);
+
+ Eina_List *PluggedList(void);
+ Eina_List *NearbyConnList(void);
+ Eina_List *NearbyDiscList(void);
+
+ CSourceInfo *SourceInfoByData(void *data);
+};
+
+
+#endif /* __SRC_MGR_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+#if 0
+#ifndef __USB_H__
+#define __USB_H__
+
+
+#include "usb-device.h"
+
+
+class CUsb {
+private:
+ struct SUsb* m;
+
+private:
+
+ static void sm_CbConnected(usb_device_h dev, char *action, void *data);
+
+public:
+ CUsb() : m(0) {}
+ virtual ~CUsb() {}
+
+ bool Create(void(*plug_cb)(int is_plugged, void *data, void *dev), void *data);
+ virtual void Destroy(void);
+
+ bool GetConnected(void);
+
+ static bool SwitchTo(void);
+ static char* DeviceName(usb_device_h dev);
+ static int DeviceAddress(usb_device_h dev);
+};
+
+
+#endif /* __USB_H__ */
+#endif
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 __UTIL_H__
+#define __UTIL_H__
+
+#include <Elementary.h>
+#include "dbg.h"
+
+#define UTIL_CHECK_RETURN_VAL(expr, val) { \
+ if (expr == NULL) { \
+ _ERR("Invalid data, Returning value"); \
+ return val; \
+ } \
+ }
+
+#define UTIL_CHECK_RETURN_NULL(expr) { \
+ if (expr == NULL) { \
+ _ERR("Invalid data, Returning NULL"); \
+ return NULL; \
+ } \
+ }
+
+#define UTIL_FREE(ptr) { \
+ if (ptr != NULL) { \
+ free(ptr); \
+ ptr = NULL; \
+ } \
+ }
+
+Evas_Object *util_add_layout(Evas_Object *parent, const char *group);
+Evas_Object *util_add_grid(Evas_Object *parent, int w, int h);
+Evas_Object *util_add_btn(Evas_Object *parent, const char *group);
+
+/* for nearby and plugged layouts */
+void util_dim_item(Elm_Object_Item *it);
+Eina_Bool util_timer_del_item_cb(void *data);
+void util_add_item(Evas_Object *grid, CSourceInfo *si);
+
+#endif /* __UTIL_H__*/
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 __ALLSRC_VIEW_H__
+#define __ALLSRC_VIEW_H__
+
+
+#define ALLSOURCE_VIEW "ALLSOURCE_VIEW"
+
+
+enum launch_mode {
+ SRC_PLUGGED = 0,
+ SRC_NEARBY,
+};
+
+
+class CAllSourceView : public CBaseView {
+private:
+ struct SAllSourceView* m;
+
+protected:
+ virtual void t_OnShow(void);
+
+public:
+ CAllSourceView(const char *szViewId) : CBaseView(szViewId), m(0) {}
+ virtual ~CAllSourceView() {}
+
+ virtual Evas_Object *Base(void);
+
+ virtual bool Create(void *data);
+ virtual void Destroy(void);
+};
+
+
+#endif /* __ALLSRC_VIEW_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 __MENU_VIEW_H__
+#define __MENU_VIEW_H__
+
+
+#define MENU_VIEW "MENU_VIEW"
+
+
+class CMenuView : public CBaseView {
+private:
+ struct SMenuView* m;
+
+public:
+ CMenuView(const char *szViewId) : CBaseView(szViewId), m(0) {}
+ virtual ~CMenuView() {}
+
+ virtual Evas_Object *Base(void);
+
+ virtual bool Create(void *data);
+ virtual void Destroy(void);
+};
+
+
+#endif /* __MENU_VIEW_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 __NEARBY_LAYOUT_H__
+#define __NEARBY_LAYOUT_H__
+
+struct layout_class *get_nearby_lclass(void);
+
+#endif /* __NEARBY_LAYOUT_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 __PLUGGED_LAYOUT_H__
+#define __PLUGGED_LAYOUT_H__
+
+struct layout_class *get_plugged_lclass(void);
+
+#endif /* __PLUGGED_LAYOUT_H__ */
--- /dev/null
+<manifest>
+ <define>
+ <domain name="org.tizen.source-list-tv-ref" />
+ </define>
+ <request>
+ <domain name="org.tizen.source-list-tv-ref" />
+ </request>
+</manifest>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="@PACKAGE_NAME@" version="@VERSION@" install-location="internal-only">
+ <label>source-list</label>
+ <author email="daihua.hu@samsung.com" href="www.samsung.com">Hu Daihua</author>
+ <description>source-list Application</description>
+ <ui-application appid="@PACKAGE_NAME@" exec="@BINDIR@/@PROJECT_NAME@" nodisplay="false" multiple="false" type="capp" taskmanage="true">
+ <label>Source</label>
+ <icon>org.tizen.source-list-tv-ref.png</icon>
+ </ui-application>
+</manifest>
--- /dev/null
+Name: org.tizen.source-list-tv-ref
+Summary: Source application
+Version: 0.1
+Release: 1
+Group: Applications/Core Applications
+License: Apache-2.0
+Source0: %{name}-%{version}.tar.gz
+BuildRequires: cmake
+BuildRequires: pkgconfig(application-common)
+BuildRequires: gettext-tools
+BuildRequires: edje-bin
+BuildRequires: pkgconfig(capi-appfw-application)
+#BuildRequires: pkgconfig(capi-system-usbdevice)
+BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(ecore)
+BuildRequires: pkgconfig(evas)
+BuildRequires: pkgconfig(eina)
+BuildRequires: pkgconfig(utilX)
+BuildRequires: pkgconfig(x11)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(aul)
+
+%define _packagedir /usr/apps/%{name}
+%define _bindir %{_packagedir}/bin
+%define _imgdir %{_packagedir}/res/images
+%define _edjedir %{_packagedir}/res/edje
+%define _localedir %{_packagedir}/res/locale
+%define _manifestdir /usr/share/packages
+%define _desktop_icondir /usr/share/icons/default/small
+
+%description
+Description: source-list application
+
+%prep
+%setup -q
+
+%build
+cmake . \
+ -DCMAKE_INSTALL_PREFIX=%{_packagedir} \
+ -DPACKAGE_NAME=%{name} \
+ -DBINDIR=%{_bindir} \
+ -DIMAGEDIR=%{_imgdir} \
+ -DEDJEDIR=%{_edjedir} \
+ -DLOCALEDIR=%{_localedir} \
+ -DMANIFESTDIR=%{_manifestdir} \
+ -DVERSION=%{version}
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+%clean
+rm -rf %{buildroot}
+
+%files
+%manifest %{name}.manifest
+%defattr(-,root,root,-)
+%{_bindir}/*
+%{_imgdir}/*.png
+%{_manifestdir}/%{name}.xml
+%{_edjedir}/*
+%{_desktop_icondir}/%{name}.png
+
--- /dev/null
+# for i18n
+
+SET(POFILES de_DE.po
+ el_GR.po
+ en.po
+ es_ES.po
+ fr_FR.po
+ it_IT.po
+ ja_JP.po
+ ko_KR.po
+ nl_NL.po
+ pt_PT.po
+ ru_RU.po
+ tr_TR.po
+ zh_CN.po
+ zh_HK.po
+ zh_TW.po)
+SET(MSGFMT "/usr/bin/msgfmt")
+
+FOREACH(pofile ${POFILES})
+ SET(pofile ${CMAKE_CURRENT_SOURCE_DIR}/${pofile})
+ MESSAGE("PO: ${pofile}")
+ GET_FILENAME_COMPONENT(absPofile ${pofile} ABSOLUTE)
+ GET_FILENAME_COMPONENT(lang ${absPofile} NAME_WE)
+ SET(moFile ${CMAKE_CURRENT_BINARY_DIR}/${lang}.mo)
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${moFile}
+ COMMAND ${MSGFMT} -o ${moFile} ${absPofile}
+ DEPENDS ${absPofile}
+ )
+ INSTALL(FILES ${moFile}
+ DESTINATION ${LOCALEDIR}/${lang}/LC_MESSAGES RENAME ${PROJECT_NAME}.mo)
+ SET(moFiles ${moFiles} ${moFile})
+ENDFOREACH(pofile)
+
+MESSAGE(".mo files: ${moFiles}")
+ADD_CUSTOM_TARGET(po ALL DEPENDS ${moFiles})
--- /dev/null
+# List of source files containing translatable strings.
+src/main.c
+src/viewmgr.c
\ No newline at end of file
--- /dev/null
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-04-09 16:07+0800\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/main.c:80
+msgid "ok"
+msgstr ""
--- /dev/null
+#!/bin/sh
+
+APPNAME=org.tizen.source-list
+SRCROOT=../
+POTFILES=POTFILES.in
+
+ALL_LINGUAS="de_DE el_GR en es_ES fr_FR it_IT ja_JP ko_KR nl_NL pt_PT ru_RU tr_TR zh_CN zh_HK zh_TW"
+
+XGETTEXT=/usr/bin/xgettext
+MSGMERGE=/usr/bin/msgmerge
+
+echo -n "Make ${APPNAME}.pot "
+if [ ! -e $POTFILES ] ; then
+ echo "$POTFILES not found"
+ exit 1
+fi
+
+$XGETTEXT --default-domain=${APPNAME} --directory=${SRCROOT} \
+ --add-comments --keyword=_ --keyword=N_ --files-from=$POTFILES
+if [ $? -ne 0 ]; then
+ echo "xgettext error"
+ exit 1
+fi
+
+if [ ! -f ${APPNAME}.po ]; then
+ echo "No such file: ${APPNAME}.po"
+ exit 1
+fi
+
+rm -f ${APPNAME}.pot && sudo mv ${APPNAME}.po ${APPNAME}.pot
+echo "done"
+
+for LANG in $ALL_LINGUAS; do
+ echo "$LANG : "
+
+ if [ ! -e $LANG.po ] ; then
+ sed 's/CHARSET/UTF-8/g' ${APPNAME}.pot > ${LANG}.po
+ echo "${LANG}.po created"
+ else
+ if $MSGMERGE ${LANG}.po ${APPNAME}.pot -o ${LANG}.new.po ; then
+ if cmp ${LANG}.po ${LANG}.new.po > /dev/null 2>&1; then
+ rm -f ${LANG}.new.po
+ else
+ if mv -f ${LANG}.new.po ${LANG}.po; then
+ echo ""
+ else
+ echo "msgmerge for $LANG.po failed: cannot move $LANG.new.po to $LANG.po" 1>&2
+ rm -f ${LANG}.new.po
+ exit 1
+ fi
+ fi
+ else
+ echo "msgmerge for $LANG failed!"
+ rm -f ${LANG}.new.po
+ fi
+ fi
+ echo ""
+done
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.h>
+#include <Elementary.h>
+#include <Ecore_X.h>
+#include <utilX.h>
+#include <dlog.h>
+#include "dbg.h"
+#include "def.h"
+#include "BaseView.h"
+#include "ViewMgr.h"
+#include "BaseApp.h"
+#include "allsource_view.h"
+#include "menu_view.h"
+
+
+static Evas_Object *_add_win(const char *name)
+{
+ Evas_Object *win;
+
+ win = elm_win_add(NULL, name, ELM_WIN_BASIC);
+ if (!win) {
+ _ERR("failed to create window!");
+ return NULL;
+ }
+
+ elm_win_title_set(win, name);
+ elm_win_focus_highlight_style_set(win, "invisible");
+ elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
+
+ evas_object_show(win);
+
+ return win;
+}
+
+
+static Evas_Object *_add_bg(Evas_Object *win)
+{
+ Evas_Object *bg;
+
+ if (!win)
+ return NULL;
+
+ bg = elm_layout_add(win);
+ if (!bg)
+ return NULL;
+
+ elm_layout_file_set(bg, EDJ_FILE, GRP_BG);
+
+ evas_object_size_hint_weight_set(bg,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ elm_win_resize_object_add(win, bg);
+ evas_object_show(bg);
+
+ return bg;
+}
+
+
+
+class CApp : public CBaseApp {
+private:
+ Evas_Object *m_win;
+ Evas_Object *m_bg;
+
+ CAllSourceView *pAllSourceView;
+ CMenuView *pMenuView;
+
+public:
+ CApp() : m_win(0) {}
+ virtual ~CApp() {}
+
+ virtual bool OnCreate(void)
+ {
+ if (m_win)
+ return false;
+
+ elm_theme_overlay_add(NULL, EDJ_THEME);
+
+ m_win = _add_win(PACKAGE);
+ if (!m_win)
+ return false;
+
+ if (!CViewMgr::Initialize(m_win, NULL)) {
+ evas_object_del(m_win);
+ m_win = NULL;
+ return false;
+ }
+
+ pAllSourceView = new CAllSourceView(ALLSOURCE_VIEW);
+ pMenuView = new CMenuView(MENU_VIEW);
+
+ CViewMgr::GetInstance()->AddView(pAllSourceView);
+ CViewMgr::GetInstance()->AddView(pMenuView);
+
+ m_bg = _add_bg(m_win);
+
+ return true;
+ }
+
+ virtual void OnTerminate(void)
+ {
+ if (!m_win)
+ return;
+
+ evas_object_del(m_bg);
+ CViewMgr::Finalize();
+ evas_object_del(m_win);
+ m_win = NULL;
+ }
+
+ virtual void OnService(service_h service)
+ {
+ if (!m_win)
+ return;
+
+ enum launch_mode lmode;
+ char *mode;
+ int ret;
+
+ mode = NULL;
+ lmode = SRC_PLUGGED;
+
+ ret = service_get_extra_data(service, "mode", &mode);
+ if (ret == SERVICE_ERROR_NONE) {
+ if (!strcmp(mode, "plugged"))
+ lmode = SRC_PLUGGED;
+ else if (!strcmp(mode, "nearby"))
+ lmode = SRC_NEARBY;
+
+ free(mode);
+ }
+
+ if (!CViewMgr::GetInstance()->PushView(ALLSOURCE_VIEW, (void *)lmode)) {
+ _ERR("push view error.");
+ app_efl_exit();
+ }
+ }
+
+ virtual int Run(int argc, char **argv)
+ {
+ m_win = NULL;
+ return CBaseApp::Run(argc, argv);
+ }
+};
+
+int main(int argc, char **argv)
+{
+ CApp app;
+
+ app.Run(argc, argv);
+
+ return 0;
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 <stdio.h>
+#include <string.h>
+
+#include "external.h"
+#include "AppCommon.h"
+#include "SourceInfo.h"
+#include "external.h"
+#if 0
+#include "usb.h"
+#endif
+
+
+#define ICON_PATH_USB IMAGEDIR"/ico_usb.png"
+#define ICON_PATH_TV IMAGEDIR"/ico_antenna.png"
+#define ICON_PATH_SVIDEO IMAGEDIR"/ico_svideo.png"
+#define ICON_PATH_COMP IMAGEDIR"/ico_component.png"
+#define ICON_PATH_HDMI IMAGEDIR"/ico_hdmi.png"
+#define ICON_PATH_DVI IMAGEDIR"/ico_dsub.png"
+#define ICON_PATH_NAS IMAGEDIR"/ico_nas.png"
+#define ICON_PATH_MOBILE IMAGEDIR"/ico_mobile.png"
+#define ICON_PATH_CONSOLE IMAGEDIR"/ico_console.png"
+#define ICON_PATH_SETTOP IMAGEDIR"/ico_settop.png"
+
+
+CSourceInfo::CSourceInfo()
+{
+ m_eConnType = CONN_TYPE_TV;
+ m_nFlag = 0;
+ m_pName = NULL;
+ m_pType = NULL;
+ m_pData = NULL;
+}
+
+
+CSourceInfo::~CSourceInfo()
+{
+ delete[] m_pName;
+ delete[] m_pType;
+}
+
+
+void CSourceInfo::SetFlag(int flag)
+{
+ m_nFlag = flag;
+}
+
+
+int CSourceInfo::Flag(void)
+{
+ return m_nFlag;
+}
+
+
+void CSourceInfo::SetName(const char *name)
+{
+ delete[] m_pName;
+ m_pName = new char[strlen(name) + 1];
+ if (!m_pName)
+ return;
+ strcpy(m_pName, name);
+}
+
+
+const char *CSourceInfo::Name(void)
+{
+ return m_pName;
+}
+
+
+void CSourceInfo::SetType(const char *type)
+{
+ delete[] m_pType;
+ m_pType = new char[strlen(type) + 1];
+ if (!m_pType)
+ return;
+ strcpy(m_pType, type);
+}
+
+
+const char *CSourceInfo::Type(void)
+{
+ return m_pType;
+}
+
+
+void CSourceInfo::SetConnType(ext_type type)
+{
+ m_eConnType = type;
+}
+
+
+ext_type CSourceInfo::ConnType(void)
+{
+ return m_eConnType;
+}
+
+
+void CSourceInfo::SetData(void *pData)
+{
+ m_pData = pData;
+}
+
+
+void* CSourceInfo::Data(void)
+{
+ return m_pData;
+}
+
+
+const char *CSourceInfo::IconPath(void)
+{
+ switch (m_eConnType) {
+ case CONN_TYPE_USB:
+ return ICON_PATH_USB;
+ case CONN_TYPE_TV:
+ return ICON_PATH_TV;
+ case CONN_TYPE_AV1:
+ case CONN_TYPE_AV2:
+ case CONN_TYPE_AV3:
+ case CONN_TYPE_SVIDEO1:
+ case CONN_TYPE_SVIDEO2:
+ case CONN_TYPE_SVIDEO3:
+ return ICON_PATH_SVIDEO;
+ case CONN_TYPE_COMP1:
+ case CONN_TYPE_COMP2:
+ case CONN_TYPE_COMP3:
+ return ICON_PATH_COMP;
+ case CONN_TYPE_HDMI1:
+ case CONN_TYPE_HDMI2:
+ case CONN_TYPE_HDMI3:
+ case CONN_TYPE_HDMI4:
+ return ICON_PATH_HDMI;
+ case CONN_TYPE_DVI1:
+ case CONN_TYPE_DVI2:
+ case CONN_TYPE_DVI3:
+ return ICON_PATH_DVI;
+ case CONN_TYPE_WIFI:
+ case CONN_TYPE_WIFI_DIRECT:
+ case CONN_TYPE_LAN:
+ return ICON_PATH_NAS;
+ default:
+ return NULL;
+ }
+}
+
+
+
+bool CSourceInfo::SwitchTo(void)
+{
+ switch (m_eConnType) {
+#if 0
+ case CONN_TYPE_USB:
+ return CUsb::SwitchTo();
+#endif
+ case CONN_TYPE_TV:
+ return CExternal::SwitchTo(CONN_TYPE_TV);
+ default:
+ return false;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reservext
+ *
+ * Licensext under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless requirext by applicable law or agreext to in writing, software
+ * distributext under the License is distributext on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impliext.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <aul.h>
+#include <stdlib.h>
+#include <string.h>
+#include <app.h>
+#include "dbg.h"
+
+#include "AppCommon.h"
+#include "external.h"
+
+#define EXT_NAME_TV _("TV Antenna")
+#define SWITCH_APP_TV "org.tizen.live-tv-ref"
+
+
+struct SExternal {
+ CExternal::SCallback cb;
+};
+
+
+class CPureExternal {
+public:
+ virtual bool Initialize(struct SExternal *ext) = 0;
+ virtual void Finalize(void) = 0;
+ virtual bool CheckPlug(void) = 0;
+ virtual const char *Name(void) = 0;
+ virtual bool SwitchTo(void) = 0;
+};
+
+
+class CExternalTv : public CPureExternal {
+public:
+ virtual bool Initialize(struct SExternal *ext)
+ {
+ return true;
+ }
+ virtual void Finalize(void)
+ {
+
+ }
+ virtual bool CheckPlug(void)
+ {
+ return true;
+ }
+ virtual const char *Name(void)
+ {
+ return EXT_NAME_TV;
+ }
+ virtual bool SwitchTo(void)
+ {
+ int ret;
+
+ ret = aul_open_app(SWITCH_APP_TV);
+ if (ret < 0) {
+ _ERR("aul_open_app %s failed!", SWITCH_APP_TV);
+ return false;
+ }
+
+ return true;
+ }
+};
+
+
+static CExternalTv extTv;
+static CPureExternal *g_exts[] = { &extTv, };
+#define EXTERNAL_SIZE (sizeof(g_exts) / sizeof(CPureExternal*))
+
+
+bool CExternal::Create(const SCallback *cb)
+{
+ ASSERT(!m);
+ ASSERT(cb);
+
+ unsigned int i, j, size;
+ int ret;
+
+ m = new SExternal;
+ if (!m) {
+ _ERR("calloc failext");
+ return NULL;
+ }
+
+ m->cb = *cb;
+ size = EXTERNAL_SIZE;
+ for (i = 0; i < size; i++) {
+ ret = g_exts[i]->Initialize(m);
+ if (!ret)
+ goto err;
+ }
+
+ return true;
+
+err:
+ for (j = 0; j < i; j++)
+ g_exts[j]->Finalize();
+
+ delete m;
+ m = NULL;
+
+ return false;
+}
+
+
+void CExternal::Destroy(void)
+{
+ ASSERT(m);
+
+ unsigned int i, size = EXTERNAL_SIZE;
+
+ for (i = 0; i < size; i++)
+ g_exts[i]->Finalize();
+
+ delete m;
+ m = NULL;
+}
+
+
+void CExternal::GetConnected(void)
+{
+ ASSERT(m);
+
+ size_t i, size = EXTERNAL_SIZE;
+ int plugged;
+
+ if (!m->cb.proc_cb)
+ return;
+
+ for (i = 0; i < size; i++) {
+ plugged = g_exts[i]->CheckPlug();
+
+ if (plugged)
+ m->cb.proc_cb(plugged, m->cb.cbdata, (void *)i);
+ }
+}
+
+
+bool CExternal::SwitchTo(ext_type type)
+{
+ unsigned int size = EXTERNAL_SIZE;
+
+ if (type >= (signed)size)
+ return false;
+
+ return g_exts[type]->SwitchTo();
+}
+
+
+const char *CExternal::Name(ext_type type)
+{
+ unsigned int size = EXTERNAL_SIZE;
+
+ if (type >= (signed)size)
+ return NULL;
+
+ return g_exts[type]->Name();
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 "dbg.h"
+#include "ViewMgr.h"
+#include "layout_mgr.h"
+
+struct layoutmgr {
+ Evas_Object *parent;
+ sig_event_cb ptr;
+};
+
+struct layoutmgr *layoutmgr_init(Evas_Object *base, sig_event_cb ptr)
+{
+ struct layoutmgr *lmgr;
+
+ if (!base)
+ return NULL;
+
+ lmgr = (layoutmgr*)calloc(1, sizeof(*lmgr));
+ if (!lmgr) {
+ _ERR("create layoutmgr failed.");
+ return NULL;
+ }
+
+ lmgr->parent = base;
+ lmgr->ptr = ptr;
+
+ return lmgr;
+}
+
+void layoutmgr_fini(struct layoutmgr *lmgr)
+{
+ if (!lmgr)
+ return;
+
+ free(lmgr);
+}
+
+Evas_Object *layoutmgr_create_layout(struct layoutmgr *lmgr,
+ struct layout_class *lclass)
+{
+ if (!lmgr || !lclass)
+ return NULL;
+
+ if (!lclass->create)
+ return NULL;
+
+ return lclass->create(lmgr->parent, lmgr->ptr);
+}
+
+void layoutmgr_destory_layout(struct layout_class *lclass,
+ Evas_Object *layout)
+{
+ if (!layout || !lclass)
+ return;
+
+ if (!lclass->destory)
+ return;
+
+ lclass->destory(layout);
+}
+
+void layoutmgr_pause_layout(struct layout_class *lclass,
+ Evas_Object *layout)
+{
+ if (!layout || !lclass)
+ return;
+
+ if (!lclass->pause)
+ return;
+
+ lclass->pause(layout);
+}
+
+void layoutmgr_resume_layout(struct layout_class *lclass,
+ Evas_Object *layout)
+{
+ if (!layout || !lclass)
+ return;
+
+ if (!lclass->resume)
+ return;
+
+ lclass->resume(layout);
+}
+
+void layoutmgr_update_layout(struct layout_class *lclass,
+ Evas_Object *layout,
+ enum update_ui update_type, void *data)
+{
+ if (!layout || !lclass)
+ return;
+
+ if (!lclass->update)
+ return;
+
+ lclass->update(layout, data, update_type);
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 <Eina.h>
+#include <Ecore.h>
+
+#include "AppCommon.h"
+#include "external.h"
+#include "source_mgr.h"
+#include "dbg.h"
+#include "aul.h"
+#include "util.h"
+#if 0
+#include "usb.h"
+#endif
+
+#define DEFAULT_USB_NAME "USB Dev"
+#define DEFAULT_EXT_NAME "External"
+#define USB_CONN_TYPE "USB"
+#define TV_CONN_TYPE "TV ANTENNA"
+
+
+CSourceMgr *CSourceMgr::instance = NULL;
+
+
+struct SSourceMgr {
+ Eina_List *plugged_list;
+ Eina_List *nearby_conn_list;
+ Eina_List *nearby_disc_list;
+
+ struct SCallback {
+ TUpdateUI cbUpdateSourceList;
+ void *data;
+ } cb;
+
+#if 0
+ CUsb u;
+#endif
+ CExternal ext;
+
+ SSourceMgr() {
+ plugged_list = NULL;
+ nearby_conn_list = NULL;
+ nearby_disc_list = NULL;
+ memset(&cb, 0, sizeof(cb));
+ }
+};
+
+
+void CSourceMgr::t_FreeAllSource(void)
+{
+ CSourceInfo *si;
+ void *obj;
+
+ EINA_LIST_FREE(m->plugged_list, obj) {
+ si = (CSourceInfo *)obj;
+ switch (si->ConnType()) {
+ case CONN_TYPE_USB:
+ t_Free(si);
+ break;
+ case CONN_TYPE_TV:
+ t_Free(si);
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+
+void CSourceMgr::t_Free(CSourceInfo *si)
+{
+ delete si;
+}
+
+
+void CSourceMgr::t_UpdateUI(void *data, enum update_ui update_type)
+{
+ if (m->cb.cbUpdateSourceList)
+ m->cb.cbUpdateSourceList(m->cb.data, data, update_type);
+}
+
+#if 0
+CSourceInfo *CSourceMgr::m_AllocUsbSI(void *dev)
+{
+ CSourceInfo *si;
+ const char *name;
+
+ if (!dev) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ si = (CSourceInfo *)calloc(1, sizeof(*si));
+ if (!si) {
+ _ERR("calloc failed");
+ return NULL;
+ }
+
+ name = CUsb::DeviceName((usb_device_h)dev);
+ si->SetName(name ? name : DEFAULT_USB_NAME);
+ si->SetType(USB_CONN_TYPE);
+ si->SetConnType(CONN_TYPE_USB);
+ si->SetFlag(CUsb::DeviceAddress((usb_device_h)dev));
+
+ return si;
+}
+
+
+void CSourceMgr::sm_CbPlug(int is_plugged, void *data, void *dev)
+{
+ CSourceMgr* root = (CSourceMgr*)data;
+ if (root)
+ root->m_OnPlug(is_plugged, dev);
+}
+
+
+void CSourceMgr::m_OnPlug(int is_plugged, void *dev)
+{
+ CSourceInfo *si;
+ void *obj;
+ Eina_List *list, *list_next;
+
+ if (!dev)
+ return;
+
+ if (is_plugged) {
+ si = m_AllocUsbSI(dev);
+ if (!si)
+ return;
+
+ m->plugged_list = eina_list_append(m->plugged_list, si);
+ t_UpdateUI(si, SRC_PLUG_ADD_ONE);
+ } else {
+ EINA_LIST_FOREACH_SAFE(m->plugged_list, list, list_next, obj) {
+ si = (CSourceInfo *)obj;
+ if (si->ConnType() == CONN_TYPE_USB &&
+ si->Flag() == CUsb::DeviceAddress((usb_device_h)dev)) {
+ m->plugged_list = eina_list_remove(
+ m->plugged_list, si);
+
+ t_UpdateUI(si, SRC_PLUG_DEL_ONE);
+ t_Free(si);
+ break;
+ }
+ }
+ }
+}
+#endif
+
+void CSourceMgr::sm_CbExternalPlug(int is_plugged, void *cbdata, void *data)
+{
+ CSourceMgr *root = (CSourceMgr*)cbdata;
+ if (root)
+ root->m_OnExternalPlug(is_plugged, cbdata);
+}
+
+
+void CSourceMgr::m_OnExternalPlug(int is_plugged, void *data)
+{
+ CSourceInfo *si;
+ void *obj;
+ enum ext_type *ext_type;
+ Eina_List *list, *list_next;
+
+ ext_type = (enum ext_type *)data;
+
+ if (is_plugged) {
+ si = m_AllocSI(*ext_type);
+ if (!si)
+ return;
+
+ m->plugged_list = eina_list_append(m->plugged_list, si);
+ t_UpdateUI(si, SRC_PLUG_ADD_ONE);
+ }
+ else {
+ EINA_LIST_FOREACH_SAFE(m->plugged_list, list, list_next, obj) {
+ si = (CSourceInfo *)obj;
+ if (si->ConnType() == *ext_type) {
+ m->plugged_list = eina_list_remove(
+ m->plugged_list, si);
+
+ t_UpdateUI(si, SRC_PLUG_DEL_ONE);
+ t_Free(si);
+ break;
+ }
+ }
+ }
+}
+
+
+CSourceInfo *CSourceMgr::m_AllocSI(int type)
+{
+ CSourceInfo *si;
+ const char *name;
+
+ si = (CSourceInfo *)calloc(1, sizeof(*si));
+ if (!si) {
+ _ERR("calloc failed");
+ return NULL;
+ }
+
+ name = CExternal::Name((ext_type)type);
+ si->SetName(name ? name : DEFAULT_EXT_NAME);
+ if (type == CONN_TYPE_TV)
+ si->SetType(TV_CONN_TYPE);
+
+ si->SetConnType((ext_type)type);
+
+ return si;
+}
+
+
+bool CSourceMgr::t_Create(TUpdateUI cb, void *data)
+{
+ ASSERT(!m);
+
+ CExternal::SCallback scb;
+
+ m = new SSourceMgr;
+ if (!m) {
+ _ERR("Create src_mgr failed.");
+ return NULL;
+ }
+
+#if 0
+ if (!m->u.Create(sm_CbPlug, this)) {
+ _ERR("Initial storage source connection callback failed.");
+ delete m;
+ m = NULL;
+ return false;
+ }
+#endif
+
+ m->cb.cbUpdateSourceList = cb;
+ m->cb.data = data;
+
+ scb.proc_cb = sm_CbExternalPlug;
+ scb.cbdata = m;
+
+ if (!m->ext.Create(&scb)) {
+ _ERR("Init external failed.");
+#if 0
+ m->u.Destroy();
+#endif
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ return true;
+}
+
+
+void CSourceMgr::t_Destroy(void)
+{
+ ASSERT(m);
+
+ t_FreeAllSource();
+#if 0
+ m->u.Destroy();
+#endif
+ m->ext.Destroy();
+
+ delete m;
+ m = NULL;
+}
+
+
+bool CSourceMgr::Initialize(TUpdateUI cb, void *data)
+{
+ ASSERT(!instance);
+
+ instance = new CSourceMgr;
+ if (!instance)
+ return false;
+ if (!instance->t_Create(cb, data)) {
+ delete instance;
+ instance = NULL;
+ return false;
+ }
+ return true;
+}
+
+
+void CSourceMgr::Finalize(void)
+{
+ ASSERT(instance);
+
+ instance->t_Destroy();
+ delete instance;
+ instance = NULL;
+}
+
+
+CSourceMgr *CSourceMgr::GetInstance(void)
+{
+ return instance;
+}
+
+
+void CSourceMgr::Refresh(void)
+{
+ ASSERT(m);
+
+ t_FreeAllSource();
+ t_UpdateUI(NULL, SRC_UPDATE_ALL);
+
+#if 0
+ m->u.GetConnected();
+#endif
+ m->ext.GetConnected();
+}
+
+
+Eina_List *CSourceMgr::PluggedList(void)
+{
+ ASSERT(m);
+
+ return m->plugged_list;
+}
+
+
+Eina_List *CSourceMgr::NearbyConnList(void)
+{
+ ASSERT(m);
+
+ return m->nearby_conn_list;
+}
+
+
+Eina_List *CSourceMgr::NearbyDiscList(void)
+{
+ ASSERT(m);
+
+ return m->nearby_disc_list;
+}
+
+
+CSourceInfo *CSourceMgr::SourceInfoByData(void *data)
+{
+ ASSERT(m);
+
+ Eina_List *list;
+ CSourceInfo *si;
+ void *obj;
+
+ EINA_LIST_FOREACH(m->plugged_list, list, obj) {
+ si = (CSourceInfo *)obj;
+ if (si && si->Data() == data)
+ return si;
+ }
+
+ EINA_LIST_FOREACH(m->nearby_conn_list, list, obj) {
+ si = (CSourceInfo *)obj;
+ if (si && si->Data() == data)
+ return si;
+ }
+
+ EINA_LIST_FOREACH(m->nearby_disc_list, list, obj) {
+ si = (CSourceInfo *)obj;
+ if (si && si->Data() == data)
+ return si;
+ }
+
+ return NULL;
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 <Eina.h>
+#include <Ecore.h>
+
+#include "AppCommon.h"
+#include "usb-device.h"
+#include "dbg.h"
+#include "aul.h"
+#include "usb.h"
+
+#define FILE_BROWSER_APP "org.tizen.file-browser-tv-ref"
+#define FILE_BROWSER_USB_KEY "source"
+#define FILE_BROWSER_USB_VALUE "usb"
+
+struct SUsb {
+ void (*plug_cb)(int is_plugged, void *data, void* dev);
+ void *cbdata;
+};
+
+
+void CUsb::sm_CbConnected(usb_device_h dev, char *action, void *data)
+{
+ SUsb* m = (SUsb*)data;
+ int is_plugged;
+
+ if (!m) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ if (!strcmp(action, "added"))
+ is_plugged = 1;
+ else if (!strcmp(action, "removed"))
+ is_plugged = 0;
+ else
+ return;
+
+ if (m->plug_cb)
+ m->plug_cb(is_plugged, m->cbdata, dev);
+}
+
+
+bool CUsb::Create(void (*plug_cb)(int is_plugged, void *data, void* dev), void *data)
+{
+ ASSERT(!m);
+
+ m = new SUsb;
+ if (!m) {
+ _ERR("calloc failed");
+ return false;
+ }
+
+ int r = usb_device_init();
+ if (r != 0) {
+ _ERR("SUsb device init failed");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ usb_set_connected_cb(sm_CbConnected, m);
+
+ m->plug_cb = plug_cb;
+ m->cbdata = data;
+
+ return true;
+}
+
+
+void CUsb::Destroy(void)
+{
+ ASSERT(m);
+
+ usb_device_fini();
+ delete m;
+ m = NULL;
+}
+
+
+bool CUsb::GetConnected(void)
+{
+ ASSERT(m);
+
+ usb_device_h dev;
+ usb_device_list_h dev_list;
+ int is_plugged;
+ int err;
+
+ is_plugged = 1;
+
+ err = usb_get_connected_device_number(USB_MASS_STORAGE);
+ if (err <= 0) {
+ _INFO("No mass storage device connected currently.");
+ return false;
+ }
+
+ err = usb_device_get_device_list(USB_MASS_STORAGE, &dev_list);
+ if (err != 0) {
+ _ERR("get mass storage device failed;err=%d", err);
+ return false;
+ }
+
+ err = usb_device_list_get_first(dev_list, &dev);
+ if (err != 0) {
+ _ERR("get 1th mass storage device failed;err=%d", err);
+ return false;
+ }
+
+ do {
+ if (m->plug_cb)
+ m->plug_cb(is_plugged, m->cbdata, dev);
+ free_usb_device_h(dev);
+ err = usb_device_list_get_next(dev_list, &dev);
+ } while (!err);
+
+ /*free usb_device_list*/
+ usb_device_free_device_list(dev_list);
+
+ return true;
+}
+
+
+bool CUsb::SwitchTo(void)
+{
+ bundle *b;
+ int err;
+
+ b = bundle_create();
+ if (!b)
+ return false;
+
+ err = bundle_add(b, FILE_BROWSER_USB_KEY, FILE_BROWSER_USB_VALUE);
+ if (err) {
+ _ERR("Add bundle value failed. err:%d", err);
+ bundle_free(b);
+ return false;
+ }
+
+ aul_launch_app(FILE_BROWSER_APP, b);
+ bundle_free(b);
+
+ return true;
+}
+
+
+char *CUsb::DeviceName(usb_device_h dev)
+{
+ if (!dev)
+ return NULL;
+
+ return usb_device_get_partlabel(dev);
+}
+
+
+int CUsb::DeviceAddress(usb_device_h dev)
+{
+ if (!dev)
+ return -1;
+
+ return usb_device_get_address(dev);
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 "def.h"
+
+#include "SourceInfo.h"
+#include "util.h"
+#include "source_mgr.h"
+
+Evas_Object *util_add_btn(Evas_Object *parent, const char *group)
+{
+ Evas_Object *btn;
+
+ UTIL_CHECK_RETURN_NULL(parent);
+ UTIL_CHECK_RETURN_NULL(group);
+
+ btn = elm_button_add(parent);
+ UTIL_CHECK_RETURN_NULL(btn);
+
+ elm_object_style_set(btn, group);
+
+ evas_object_size_hint_weight_set(btn,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(btn);
+ return btn;
+}
+
+Evas_Object *util_add_layout(Evas_Object *parent, const char *group)
+{
+ Evas_Object *layout;
+
+ UTIL_CHECK_RETURN_NULL(parent);
+ UTIL_CHECK_RETURN_NULL(group);
+
+ layout = elm_layout_add(parent);
+ UTIL_CHECK_RETURN_NULL(layout);
+
+ elm_layout_file_set(layout, EDJ_FILE, group);
+
+ evas_object_size_hint_weight_set(layout,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ return layout;
+}
+
+Evas_Object *util_add_grid(Evas_Object *parent, int w, int h)
+{
+ Evas_Object *grid;
+
+ UTIL_CHECK_RETURN_NULL(parent);
+
+ grid = elm_gengrid_add(parent);
+ UTIL_CHECK_RETURN_NULL(grid);
+
+ elm_scroller_bounce_set(grid, EINA_FALSE, EINA_FALSE);
+ elm_gengrid_horizontal_set(grid, EINA_FALSE);
+ elm_gengrid_align_set(grid, 0.0, 0.0);
+ elm_gengrid_select_mode_set(grid, ELM_OBJECT_SELECT_MODE_ALWAYS);
+ elm_gengrid_multi_select_set(grid, EINA_FALSE);
+
+ elm_gengrid_item_size_set(grid, elm_config_scale_get() * h,
+ elm_config_scale_get() * w);
+
+ evas_object_size_hint_weight_set(grid,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(grid,
+ EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ return grid;
+}
+
+void util_dim_item(Elm_Object_Item *it)
+{
+ Evas_Object *img;
+
+ if (!it)
+ return;
+
+ elm_object_item_disabled_set(it, EINA_TRUE);
+
+ img = elm_object_item_part_content_get(it, PART_ITEM_ICO);
+ if (!img)
+ return;
+
+ evas_object_color_set(img, ITEM_ICO_DIM_R,
+ ITEM_ICO_DIM_G, ITEM_ICO_DIM_B, ITEM_ICO_DIM_A);
+}
+
+static Evas_Object *_util_grid_content_get(void *data,
+ Evas_Object *obj, const char *part)
+{
+ const char *path;
+ CSourceInfo *si;
+ Evas_Object *img;
+
+ if (!part || !data || !obj)
+ return NULL;
+
+ si = (CSourceInfo *)data;
+
+ if (!strcmp(part, PART_ITEM_ICO)) {
+ path = si->IconPath();
+ if (!path)
+ return NULL;
+
+ img = elm_image_add(obj);
+ if (!img)
+ return NULL;
+
+ elm_image_file_set(img, path, NULL);
+ evas_object_show(img);
+ return img;
+ }
+
+ return NULL;
+}
+
+static char *_util_grid_text_get(void *data, Evas_Object *obj, const char *part)
+{
+ char *ret;
+ const char *cret;
+ CSourceInfo *si;
+
+ if (!part || !data)
+ return NULL;
+
+ ret = NULL;
+ si = (CSourceInfo *)data;
+
+ if (!strcmp(part, PART_ITEM_NAME)) {
+ cret = si->Name();
+ ret = strdup(cret ? cret : NO_NAME);
+ } else if (!strcmp(part, PART_ITEM_TYPE)) {
+ cret = si->Type();
+ ret = strdup(cret ? cret : NO_TYPE);
+ }
+
+ return ret;
+}
+
+static void _util_grid_item_del(void *data, Evas_Object *obj)
+{
+ Ecore_Timer *timer;
+ Elm_Object_Item *it;
+ CSourceInfo *si;
+
+ if (!data)
+ return;
+
+ si = (CSourceInfo *)data;
+ it = (Elm_Object_Item *)si->Data();
+
+ timer = (Ecore_Timer*)elm_object_item_data_get(it);
+ if (!timer)
+ return;
+
+ ecore_timer_del(timer);
+}
+
+static void _util_grid_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ CSourceInfo *si;
+
+ if (!data)
+ return;
+
+ si = (CSourceInfo *)data;
+
+ if (!si->SwitchTo()) {
+ _ERR("Switch to source failed.");
+ return;
+ }
+ elm_gengrid_item_selected_set((Elm_Object_Item*)event_info, EINA_FALSE);
+}
+
+
+void util_add_item(Evas_Object *grid, CSourceInfo *si)
+{
+ Elm_Object_Item *it;
+ Elm_Gengrid_Item_Class *ic;
+
+ if (!grid || !si) {
+ _ERR("Parameter is NULL.");
+ return;
+ }
+
+ ic = elm_gengrid_item_class_new();
+ if (!ic) {
+ _ERR("Create item class failed.");
+ return;
+ }
+
+ ic->item_style = "source";
+ ic->func.text_get = _util_grid_text_get;
+ ic->func.content_get = _util_grid_content_get;
+ ic->func.state_get = NULL;
+ ic->func.del = _util_grid_item_del;
+
+ it = elm_gengrid_item_append(grid, ic, si, _util_grid_sel, si);
+
+ si->SetData(it);
+
+ elm_gengrid_item_class_free(ic);
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 <app.h>
+#include <aul.h>
+#include <utilX.h>
+
+#include "AppCommon.h"
+#include "BaseView.h"
+#include "ViewMgr.h"
+#include "layout_mgr.h"
+#include "source_mgr.h"
+#include "plugged_layout.h"
+#include "nearby_layout.h"
+#include "util.h"
+#include "def.h"
+#include "dbg.h"
+#include "allsource_view.h"
+
+#define PRIV "priv"
+#define TEXT_PLUGGED "PLUGGED"
+#define TEXT_NEARBY "NEARBY"
+
+struct SAllSourceView {
+ Evas_Object *base;
+ Evas_Object *plug_btn;
+ Evas_Object *near_btn;
+ Evas_Object *focus_btn;
+ Evas_Object *plug_layout;
+ Evas_Object *near_layout;
+ CViewMgr *vmgr;
+ struct layoutmgr *lmgr;
+ enum launch_mode mode;
+ SAllSourceView() {
+ memset(this, 0, sizeof(SAllSourceView));
+ }
+};
+
+static void _key_down_cb(void *data, Evas *e, Evas_Object *obj, void *ev_info)
+{
+ Evas_Event_Key_Down *ev;
+
+ if (!ev_info) {
+ _ERR("Parameter is NULL.");
+ return;
+ }
+
+ ev = (Evas_Event_Key_Down*)ev_info;
+ if (!ev->keyname)
+ return;
+
+ if (!strcmp(ev->keyname, KEY_BACK))
+ app_efl_exit();
+}
+
+static Evas_Object *_add_layout(Evas_Object *win)
+{
+ Evas_Object *base;
+
+ UTIL_CHECK_RETURN_NULL(win);
+
+ base = util_add_layout(win, GRP_ALLSRC);
+ UTIL_CHECK_RETURN_NULL(base);
+
+ elm_object_part_text_set(base, PART_TITLE_STR, _("SOURCE"));
+
+ evas_object_event_callback_add(base,
+ EVAS_CALLBACK_KEY_DOWN, _key_down_cb, NULL);
+
+ evas_object_show(base);
+
+ return base;
+}
+
+static Evas_Object *_add_btn(Evas_Object *parent, const char *style,
+ const char *str)
+{
+ Evas_Object *btn;
+
+ if (!parent) {
+ _ERR("parent is NULL.");
+ return NULL;
+ }
+
+ btn = elm_button_add(parent);
+ if (!btn) {
+ _ERR("add button error.");
+ return NULL;
+ }
+
+ elm_object_style_set(btn, style);
+ elm_object_part_text_set(btn, PART_MENU_BTN_TEXT, str);
+
+ evas_object_size_hint_weight_set(btn,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(btn,
+ EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ evas_object_show(btn);
+
+ return btn;
+}
+
+static void _plug_btn_focus_cb(void *data, Evas_Object *obj, void *ev)
+{
+ struct SAllSourceView *priv;
+
+ if (!data)
+ return;
+
+ priv = (SAllSourceView*)data;
+ priv->focus_btn = obj;
+
+ layoutmgr_pause_layout(get_nearby_lclass(), priv->near_layout);
+ elm_object_part_content_unset(priv->base, PART_CONTENT);
+
+ elm_object_part_content_set(priv->base, PART_CONTENT,
+ priv->plug_layout);
+ layoutmgr_resume_layout(get_plugged_lclass(), priv->plug_layout);
+}
+
+static void _near_btn_focus_cb(void *data, Evas_Object *obj, void *ev)
+{
+ struct SAllSourceView *priv;
+
+ if (!data)
+ return;
+
+ priv = (SAllSourceView*)data;
+ priv->focus_btn = obj;
+
+ layoutmgr_pause_layout(get_plugged_lclass(), priv->plug_layout);
+ elm_object_part_content_unset(priv->base, PART_CONTENT);
+
+ elm_object_part_content_set(priv->base, PART_CONTENT,
+ priv->near_layout);
+ layoutmgr_resume_layout(get_nearby_lclass(), priv->near_layout);
+}
+
+static void _menu_btn_mousemove(void *data, Evas *e, Evas_Object *obj, void *ei)
+{
+ if (!obj)
+ return;
+
+ if (!elm_object_focus_get(obj))
+ elm_object_focus_set(obj, EINA_TRUE);
+}
+
+static bool _add_menu_area(Evas_Object *base, struct SAllSourceView *priv)
+{
+ if (!base || !priv)
+ return false;
+
+ priv->plug_btn = _add_btn(base, BTN_STYLE_PLUG, _(TEXT_PLUGGED));
+ if (!priv->plug_btn) {
+ _ERR("Add plug_button failed.");
+ return false;
+ }
+ evas_object_smart_callback_add(priv->plug_btn,
+ "focused",
+ _plug_btn_focus_cb, priv);
+ evas_object_event_callback_add(priv->plug_btn,
+ EVAS_CALLBACK_MOUSE_MOVE,
+ _menu_btn_mousemove, priv);
+
+ priv->near_btn = _add_btn(base, BTN_STYLE_NEAR, _(TEXT_NEARBY));
+ if (!priv->near_btn) {
+ _ERR("Add nearby button failed");
+ evas_object_del(priv->plug_btn);
+ return false;
+ }
+ evas_object_smart_callback_add(priv->near_btn,
+ "focused",
+ _near_btn_focus_cb, priv);
+ evas_object_event_callback_add(priv->near_btn,
+ EVAS_CALLBACK_MOUSE_MOVE,
+ _menu_btn_mousemove, priv);
+
+ elm_object_part_content_set(base, PART_MENU_NEARBY, priv->near_btn);
+ elm_object_part_content_set(base, PART_MENU_PLUGGED, priv->plug_btn);
+
+ return true;
+}
+
+static void _get_signal_from_layout(Evas_Object *base, int signal)
+{
+ struct SAllSourceView *priv;
+
+ if (!base)
+ return;
+
+ priv = (SAllSourceView *)evas_object_data_get(base, PRIV);
+ if (!priv)
+ return;
+
+ if (signal == E_HIGHLIGHT)
+ elm_object_signal_emit(priv->focus_btn,
+ SIG_ELM_ACTION_HIGHLIGHT, SIG_ELM);
+ else if (signal == E_RETURN)
+ elm_object_focus_set(priv->focus_btn, EINA_TRUE);
+}
+
+static void _del_content_layout(struct SAllSourceView *priv)
+{
+ if (!priv)
+ return;
+
+ layoutmgr_destory_layout(get_plugged_lclass(), priv->plug_layout);
+ priv->plug_layout = NULL;
+
+ layoutmgr_destory_layout(get_nearby_lclass(), priv->near_layout);
+ priv->near_layout = NULL;
+}
+
+static bool _create_content_layout(struct SAllSourceView *priv)
+{
+ if (!priv)
+ return false;
+
+ priv->plug_layout = layoutmgr_create_layout(priv->lmgr,
+ get_plugged_lclass());
+ if (!priv->plug_layout)
+ return false;
+
+ priv->near_layout = layoutmgr_create_layout(priv->lmgr,
+ get_nearby_lclass());
+ if (!priv->near_layout) {
+ layoutmgr_destory_layout(get_plugged_lclass(),
+ priv->plug_layout);
+ priv->plug_layout = NULL;
+ return false;
+ }
+
+ return true;
+}
+
+static void _update_src_list(void *user_data, void *data, enum update_ui type)
+{
+ Evas_Object *base;
+ struct SAllSourceView *priv;
+
+ if (!user_data) {
+ _ERR("Invaild data.");
+ return;
+ }
+
+ base = (Evas_Object*)user_data;
+ priv = (SAllSourceView *)evas_object_data_get(base, PRIV);
+ if (!priv) {
+ _ERR("Invaild data.");
+ return;
+ }
+
+ if (type == SRC_PLUG_ADD_ONE
+ || type == SRC_PLUG_DEL_ONE
+ || type == SRC_UPDATE_ALL)
+ layoutmgr_update_layout(get_plugged_lclass(),
+ priv->plug_layout, type, data);
+
+ if (type == SRC_NEAR_ADD_ONE
+ || type == SRC_NEAR_DEL_ONE
+ || type == SRC_UPDATE_ALL)
+ layoutmgr_update_layout(get_nearby_lclass(),
+ priv->near_layout, type, data);
+}
+
+
+Evas_Object *CAllSourceView::Base(void)
+{
+ ASSERT(m);
+
+ return m->base;
+}
+
+bool CAllSourceView::Create(void *data)
+{
+ ASSERT(!m);
+
+ Evas_Object *win = NULL, *base = NULL;
+ CViewMgr *vmgr;
+
+ vmgr = CViewMgr::GetInstance();
+ ASSERT(vmgr);
+
+ _CREATE_BEGIN
+ {
+ _CHECK(win = vmgr->Window());
+ _CHECK(base = _add_layout(win));
+ _CHECK(m = new SAllSourceView);
+ _CHECK(CSourceMgr::Initialize(_update_src_list, base));
+ _CHECK(m->lmgr = layoutmgr_init(base, _get_signal_from_layout))
+ _CHECK(_add_menu_area(base, m))
+ _CHECK(_create_content_layout(m))
+ _WHEN_SUCCESS{
+ m->vmgr = vmgr;
+ m->base = base;
+ m->mode = (launch_mode)(size_t)data;
+ CBaseView::Create(NULL);
+ }
+ _CHECK_FAIL{}
+ _CHECK_FAIL{}
+ _CHECK_FAIL{ layoutmgr_fini(m->lmgr); }
+ _CHECK_FAIL{ CSourceMgr::Finalize(); }
+ _CHECK_FAIL{ delete m; m = NULL; }
+ _CHECK_FAIL{ evas_object_del(base); }
+ _CHECK_FAIL{}
+ } _CREATE_END_AND_CATCH{ return false; }
+
+ return true;
+}
+
+void CAllSourceView::Destroy(void)
+{
+ ASSERT(m);
+
+ CBaseView::Destroy();
+
+ _del_content_layout(m);
+ layoutmgr_fini(m->lmgr);
+ CSourceMgr::Finalize();
+ delete m;
+ m = NULL;
+}
+
+void CAllSourceView::t_OnShow(void)
+{
+ ASSERT(m);
+
+ Evas_Object *btn;
+
+ btn = m->plug_btn;
+ if (m->mode == SRC_PLUGGED)
+ btn = m->plug_btn;
+ else if (m->mode == SRC_NEARBY)
+ btn = m->near_btn;
+
+ elm_object_focus_set(btn, EINA_TRUE);
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 <app.h>
+#include <aul.h>
+#include <utilX.h>
+
+#include "AppCommon.h"
+#include "BaseView.h"
+#include "ViewMgr.h"
+#include "source_mgr.h"
+#include "util.h"
+#include "def.h"
+#include "dbg.h"
+#include "menu_view.h"
+#include "external.h"
+
+#define PRIV "priv"
+
+#define TEXT_SEL _("SELECT")
+#define TEXT_RM _("REMOVE")
+
+#define STYLE_MENU_SEL "menu_ctx_sel"
+#define STYLE_MENU_RM "menu_ctx_rm"
+
+#define MAX_BTN_NUM 2
+#define USB_ROW 0
+#define EXTERNAL_ROW 1
+#define SEL_COL 0
+#define RM_COL 1
+
+struct bp_property {
+ const char *part;
+ const char *style;
+ char *text;
+ void (*btn_key_down_cb)(void *data, Evas *e, Evas_Object *obj,
+ void *ev);
+};
+
+struct SMenuView {
+ Evas_Object *base;
+ Evas_Object *btn[MAX_BTN_NUM];
+ CSourceInfo *node;
+ CViewMgr *vmgr;
+};
+
+static Evas_Object *_add_layout(Evas_Object *win)
+{
+ Evas_Object *base;
+
+ UTIL_CHECK_RETURN_NULL(win);
+
+ base = util_add_layout(win, GRP_MENU);
+ UTIL_CHECK_RETURN_NULL(base);
+
+ evas_object_show(base);
+
+ return base;
+}
+
+static void _layout_key_down(void *data,
+ Evas *e, Evas_Object *obj, void *ev_info)
+{
+ struct SMenuView *priv;
+ Evas_Event_Key_Down *ev;
+
+ if (!data || !ev_info)
+ return;
+
+ priv = (SMenuView *)data;
+ ev = (Evas_Event_Key_Down *)ev_info;
+
+ if (!ev->keyname)
+ return;
+
+ if (!strcmp(ev->keyname, KEY_BACK))
+ priv->vmgr->PopView();
+}
+
+static void _common_sel_key_down_cb(void *data, Evas *e, Evas_Object *obj,
+ void *ev_info)
+{
+ struct SMenuView *priv;
+ Evas_Event_Key_Down *ev;
+
+ if (!data || !ev_info) {
+ _ERR("null pointer.");
+ return;
+ }
+
+ priv = (struct SMenuView *)data;
+ ev = (Evas_Event_Key_Down *)ev_info;
+
+ if (!ev->keyname)
+ return;
+
+ if (!strcmp(ev->keyname, KEY_ENTER))
+ priv->node->SwitchTo();
+}
+
+static void _usb_rm_key_down_cb(void *data, Evas *e, Evas_Object *obj,
+ void *ev_info)
+{
+ struct SMenuView *priv;
+ Evas_Event_Key_Down *ev;
+
+ if (!data || !ev_info) {
+ _ERR("null pointer.");
+ return;
+ }
+
+ priv = (struct SMenuView *)data;
+ ev = (Evas_Event_Key_Down *)ev_info;
+
+ if (!ev->keyname)
+ return;
+
+ if (!strcmp(ev->keyname, KEY_ENTER)) {
+ /* TODO call usb remove */
+ priv->vmgr->PopView();
+ }
+}
+
+static void _menu_btn_mousemove(void *data, Evas *e, Evas_Object *obj, void *ei)
+{
+ if (!obj)
+ return;
+
+ if (!elm_object_focus_get(obj))
+ elm_object_focus_set(obj, EINA_TRUE);
+}
+
+static Evas_Object *_add_btn(Evas_Object *parent,
+ const char *part,
+ const char *style,
+ const char *str)
+{
+ Evas_Object *btn;
+
+ UTIL_CHECK_RETURN_NULL(parent);
+ UTIL_CHECK_RETURN_NULL(style);
+ UTIL_CHECK_RETURN_NULL(str);
+
+ btn = elm_button_add(parent);
+ if (!btn) {
+ _ERR("add button error.");
+ return NULL;
+ }
+
+ elm_object_style_set(btn, style);
+ elm_object_part_text_set(btn, PART_MENU_BTN_TEXT, str);
+ evas_object_size_hint_weight_set(btn,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(btn,
+ EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ evas_object_show(btn);
+ elm_object_part_content_set(parent, part, btn);
+
+ return btn;
+}
+
+static Evas_Object *_add_btn_by_index(Evas_Object *base, struct SMenuView *priv,
+ unsigned int row, unsigned int col)
+{
+ Evas_Object *btn;
+ unsigned int bp_arr_row;
+ struct bp_property bp_arr[][MAX_BTN_NUM] = {
+ {
+ {
+ PART_MENU_BTN_1,
+ STYLE_MENU_SEL,
+ TEXT_SEL,
+ _common_sel_key_down_cb
+ },
+ {
+ PART_MENU_BTN_2,
+ STYLE_MENU_RM,
+ TEXT_RM,
+ _usb_rm_key_down_cb
+ },
+ },
+ {
+ {
+ PART_MENU_BTN_1,
+ STYLE_MENU_SEL,
+ TEXT_SEL,
+ _common_sel_key_down_cb,
+ },
+ {
+ NULL,
+ NULL,
+ NULL,
+ NULL
+ },
+ },
+ };
+
+ UTIL_CHECK_RETURN_VAL(base, NULL);
+ UTIL_CHECK_RETURN_VAL(priv, NULL);
+
+ bp_arr_row = sizeof(bp_arr) /
+ (sizeof(struct bp_property) * MAX_BTN_NUM);
+
+ if (row >= bp_arr_row || col >= MAX_BTN_NUM)
+ return NULL;
+
+ btn = _add_btn(base, bp_arr[row][col].part,
+ bp_arr[row][col].style,
+ bp_arr[row][col].text);
+ if (!btn)
+ return NULL;
+
+ evas_object_event_callback_add(btn,
+ EVAS_CALLBACK_KEY_DOWN,
+ bp_arr[row][col].btn_key_down_cb, priv);
+ evas_object_event_callback_add(btn,
+ EVAS_CALLBACK_MOUSE_MOVE,
+ _menu_btn_mousemove, priv);
+
+ return btn;
+}
+
+static int _add_usb_menu_btn(Evas_Object *base, struct SMenuView *priv)
+{
+ Evas_Object *sel_btn, *rm_btn;
+
+ UTIL_CHECK_RETURN_VAL(base, -1);
+ UTIL_CHECK_RETURN_VAL(priv, -1);
+
+ sel_btn = _add_btn_by_index(base, priv, USB_ROW, SEL_COL);
+ if (!sel_btn) {
+ _ERR("Add usb select button failed.");
+ return -1;
+ }
+
+ rm_btn = _add_btn_by_index(base, priv, USB_ROW, RM_COL);
+ if (!rm_btn) {
+ _ERR("Add usb remove button failed.");
+ evas_object_del(sel_btn);
+ return -1;
+ }
+
+ return 0;
+}
+
+static int _add_external_menu_btn(Evas_Object *base, struct SMenuView *priv)
+{
+ Evas_Object *sel_btn;
+
+ if (!base || !priv)
+ return -1;
+
+ sel_btn = _add_btn_by_index(base, priv, EXTERNAL_ROW, SEL_COL);
+ if (!sel_btn) {
+ _ERR("Add wifi select button failed.");
+ return -1;
+ }
+
+ return 0;
+}
+
+static int _add_menu_btn(Evas_Object *base, struct SMenuView *priv)
+{
+ UTIL_CHECK_RETURN_VAL(base, -1);
+ UTIL_CHECK_RETURN_VAL(priv, -1);
+
+ switch (priv->node->ConnType()) {
+ case CONN_TYPE_USB:
+ return _add_usb_menu_btn(base, priv);
+ case CONN_TYPE_TV:
+ return _add_external_menu_btn(base, priv);
+ default:
+ break;
+ }
+
+ return -1;
+}
+
+static int _add_focus_item(Evas_Object *base, struct SMenuView *priv)
+{
+ Evas_Object *img;
+ const char *path;
+
+ UTIL_CHECK_RETURN_VAL(base, -1);
+ UTIL_CHECK_RETURN_VAL(priv, -1);
+
+ elm_object_part_text_set(base,
+ PART_FOCUS_ITEM_TEXT_NAME,
+ _(priv->node->Name()));
+ elm_object_part_text_set(base,
+ PART_FOCUS_ITEM_TEXT_TYPE,
+ _(priv->node->Type()));
+
+ path = priv->node->IconPath();
+ if (!path)
+ return -1;
+
+ img = elm_image_add(base);
+ if (!img)
+ return -1;
+
+ elm_image_file_set(img, path, NULL);
+ evas_object_show(img);
+ elm_object_part_content_set(base, PART_FOCUS_ITEM_IMG, img);
+
+ return 0;
+}
+
+
+Evas_Object *CMenuView::Base(void)
+{
+ ASSERT(m);
+
+ return m->base;
+}
+
+
+bool CMenuView::Create(void *data)
+{
+ ASSERT(!m);
+ ASSERT(data);
+
+ Evas_Object *win, *base;
+ CViewMgr *vmgr = CViewMgr::GetInstance();
+ ASSERT(vmgr);
+
+ win = vmgr->Window();
+ if (!win)
+ return false;
+
+ base = _add_layout(win);
+ if (!base)
+ return false;
+
+ m = new SMenuView;
+ if (!m) {
+ _ERR("calloc private data failed.");
+ evas_object_del(base);
+ return NULL;
+ }
+ memset(m, 0, sizeof(SMenuView));
+
+ m->base = base;
+ m->node = (CSourceInfo *)data;
+ m->vmgr = vmgr;
+ evas_object_data_set(base, PRIV, m);
+
+ if (_add_focus_item(base, m) == -1) {
+ _ERR("add focus item failed.");
+ evas_object_del(base);
+ free(m);
+ return NULL;
+ }
+
+ if (_add_menu_btn(base, m) == -1) {
+ _ERR("add menu button failed.");
+ evas_object_del(base);
+ free(m);
+ return NULL;
+ }
+
+ evas_object_event_callback_add(base, EVAS_CALLBACK_KEY_DOWN,
+ _layout_key_down, m);
+
+ CBaseView::Create(NULL);
+
+ return true;
+}
+
+void CMenuView::Destroy(void)
+{
+ ASSERT(m);
+
+ CBaseView::Destroy();
+
+ delete m;
+ m = NULL;
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 <utilX.h>
+#include <app.h>
+#include "aul.h"
+#include "def.h"
+#include "dbg.h"
+
+#include "AppCommon.h"
+#include "BaseView.h"
+#include "ViewMgr.h"
+#include "source_mgr.h"
+#include "layout_mgr.h"
+#include "menu_view.h"
+#include "util.h"
+
+#define PRIV "priv"
+#define SET_UP_NETWORK "Set up network"
+#define NET_WORK_SET "Network Setting"
+#define WI_FI "Wi-Fi"
+#define WI_FI_DIRECT "Wi-Fi Direct"
+#define ON "ON"
+#define NO_SRC_TEXT_LINE1 "No nearby source"
+#define NO_SRC_TEXT_LINE2 "Add any nearby sources, set up network configuration"
+#define PADDING_13 13
+#define PADDING_30 30
+#define SETTING_APP "org.tizen.settings-tv-ref"
+#define SETTING_ITEM "settings-item"
+#define SETTING_NETWORK "network-settings"
+
+struct _priv {
+ Evas_Object *base;
+ Evas_Object *layout;
+ Evas_Object *grid;
+ Evas_Object *text_ly;
+ Evas_Object *utility_pb;
+ Evas_Object *utility_btn;
+ Evas_Object *wifi_switch_label;
+ Evas_Object *wfd_switch_label;
+ Elm_Object_Item *focus_it;
+ Elm_Object_Item *del_it;
+ CSourceMgr *src_mgr;
+ CViewMgr *vmgr;
+ int is_pause;
+ int is_grid;
+
+ sig_event_cb send_sig_back;
+};
+
+static void _grid_mouse_move(void *data,
+ Evas *e, Evas_Object *obj, void *ev_info)
+{
+ struct _priv *priv;
+ Elm_Object_Item *it;
+ Evas_Event_Mouse_Move *ev;
+
+ if (!data || !ev_info)
+ return;
+
+ priv = (struct _priv *)data;
+ ev = (Evas_Event_Mouse_Move *)ev_info;
+ it = elm_gengrid_at_xy_item_get(obj, ev->cur.canvas.x,
+ ev->cur.canvas.y, NULL, NULL);
+ if (!it)
+ return;
+
+ if (elm_object_item_focus_get(it))
+ return;
+
+ elm_object_item_focus_set(it, EINA_TRUE);
+
+ if (priv->send_sig_back)
+ priv->send_sig_back(priv->base, E_HIGHLIGHT);
+}
+
+static void _grid_key_down(void *data, Evas *e, Evas_Object *obj, void *ev_info)
+{
+ struct _priv *priv;
+ CSourceInfo *si;
+ Evas_Event_Key_Down *ev;
+
+ if (!data || !ev_info)
+ return;
+
+ priv = (struct _priv *)data;
+ ev = (Evas_Event_Key_Down *)ev_info;
+ si = priv->src_mgr->SourceInfoByData(priv->focus_it);
+ if (!ev->keyname || !si)
+ return;
+
+ if (!strcmp(ev->keyname, KEY_MENU))
+ priv->vmgr->PushView(MENU_VIEW, si);
+
+}
+
+static void _grid_focused(void *data, Evas_Object *obj, void *ev_info)
+{
+ struct _priv *priv;
+
+ if (!data)
+ return;
+
+ priv = (struct _priv *)data;
+ priv->focus_it = (Elm_Object_Item*)ev_info;
+
+ if (priv->send_sig_back)
+ priv->send_sig_back(priv->base, E_HIGHLIGHT);
+}
+
+static void _launch_setting_app(void)
+{
+ bundle *b;
+ int err;
+
+ b = bundle_create();
+ if (!b) {
+ _ERR("create bundle failed.");
+ return;
+ }
+
+ err = bundle_add(b, SETTING_ITEM, SETTING_NETWORK);
+ if (err) {
+ _ERR("add bundle failed.");
+ bundle_free(b);
+ return;
+ }
+
+ err = aul_launch_app(SETTING_APP, b);
+ if (err) {
+ _ERR("launch settings failed.");
+ bundle_free(b);
+ return;
+ }
+
+ bundle_free(b);
+}
+
+static void _btn_key_down(void *data, Evas *e, Evas_Object *obj, void *ev_info)
+{
+ Evas_Event_Key_Down *ev;
+
+ if (!ev_info)
+ return;
+
+ ev = (Evas_Event_Key_Down *)ev_info;
+ if (!ev->keyname)
+ return;
+
+ if (!strcmp(ev->keyname, KEY_ENTER))
+ _launch_setting_app();
+}
+
+static Evas_Object *_add_label(Evas_Object *base, const char *style)
+{
+ Evas_Object *label;
+
+ if (!base || !style)
+ return NULL;
+
+ label = elm_label_add(base);
+ if (!label)
+ return NULL;
+
+ elm_object_style_set(label, style);
+ evas_object_show(label);
+
+ return label;
+}
+
+static Evas_Object *_add_box(Evas_Object *base, int h_padding)
+{
+ Evas_Object *box;
+
+ if (!base)
+ return NULL;
+
+ box = elm_box_add(base);
+ if (!box)
+ return NULL;
+
+ elm_box_homogeneous_set(box, EINA_FALSE);
+ elm_box_horizontal_set(box, EINA_TRUE);
+ elm_box_padding_set(box, h_padding, 0);
+ evas_object_show(box);
+
+ return box;
+}
+
+static void _btn_focused(void *data, Evas_Object *obj, void *ev_info)
+{
+ struct _priv *priv;
+
+ if (!data)
+ return;
+
+ priv = (struct _priv *)data;
+ if (priv->send_sig_back)
+ priv->send_sig_back(priv->base, E_HIGHLIGHT);
+}
+
+static int _add_no_src_label(struct _priv *priv)
+{
+ Evas_Object *btn, *box, *top_box;
+ Evas_Object *label, *separator, *switch_label, *direct_switch_label;
+
+ if (!priv)
+ return -1;
+
+ priv->text_ly = util_add_layout(priv->layout, GRP_NO_NEAR_SRC_LABEL);
+ if (!priv->text_ly)
+ return -1;
+
+ btn = util_add_btn(priv->text_ly, BTN_STYLE_SET_UP_NETWORK);
+ if (!btn)
+ goto error;
+
+ elm_object_text_set(btn, _(SET_UP_NETWORK));
+ evas_object_smart_callback_add(btn, "focused", _btn_focused, priv);
+ evas_object_event_callback_add(btn, EVAS_CALLBACK_KEY_DOWN,
+ _btn_key_down, NULL);
+ elm_object_part_content_set(priv->text_ly,
+ PART_BUTTON, btn);
+ elm_object_part_text_set(priv->text_ly,
+ PART_NO_SRC_TEXT_LINE1, _(NO_SRC_TEXT_LINE1));
+ elm_object_part_text_set(priv->text_ly,
+ PART_NO_SRC_TEXT_LINE2, _(NO_SRC_TEXT_LINE2));
+
+ /*add box for the line3 text*/
+ box = _add_box(priv->text_ly, PADDING_13);
+ if (!box)
+ goto error;
+
+ elm_object_part_content_set(priv->text_ly, PART_NO_SRC_TEXT_LINE3, box);
+
+ /*add wifi label for string "Wi-Fi"*/
+ label = _add_label(box, LABEL_STYLE_WIFI);
+ if (!label)
+ goto error;
+
+ elm_object_text_set(label, _(WI_FI));
+ elm_box_pack_end(box, label);
+
+ /*add box for the second pack*/
+ top_box = _add_box(box, PADDING_30);
+ if (!top_box)
+ goto error;
+
+ elm_box_pack_end(box, top_box);
+
+ /*add wifi switch label for string "ON/OFF"*/
+ switch_label = _add_label(top_box, LABEL_STYLE_WIFI_SWITCH);
+ if (!switch_label)
+ goto error;
+
+ elm_object_text_set(switch_label, _(ON));
+ elm_box_pack_end(top_box, switch_label);
+
+ /*add separator for the line3 string*/
+ separator = util_add_layout(top_box, GRP_NO_NEAR_SRC_SEPARATOR);
+ if (!separator)
+ goto error;
+
+ evas_object_show(separator);
+ elm_box_pack_end(top_box, separator);
+
+ /*add label for string "Wi-Fi Direct"*/
+ label = _add_label(top_box, LABEL_STYLE_WIFI);
+ if (!label)
+ goto error;
+
+ elm_object_text_set(label, _(WI_FI_DIRECT));
+ elm_box_pack_end(top_box, label);
+
+ /*add label for wifi direct switch string "ON/OFF"*/
+ direct_switch_label = _add_label(box, LABEL_STYLE_WIFI_SWITCH);
+ if (!direct_switch_label)
+ goto error;
+
+ elm_object_text_set(direct_switch_label, _(ON));
+ elm_box_pack_end(box, direct_switch_label);
+
+ priv->wifi_switch_label = switch_label;
+ priv->wfd_switch_label = direct_switch_label;
+
+ return 0;
+error:
+ evas_object_del(priv->text_ly);
+ priv->text_ly = NULL;
+ return -1;
+}
+
+static void _add_no_src_utility(struct _priv *priv)
+{
+ Evas_Object *pb, *btn;
+
+ if (!priv || priv->utility_btn)
+ return;
+
+ pb = elm_progressbar_add(priv->base);
+ if (!pb)
+ return;
+
+ elm_object_style_set(pb, PB_STYLE_SRC_LOAD);
+ elm_object_part_content_set(priv->base, PART_UTILITY_LOADING, pb);
+ elm_progressbar_pulse(priv->utility_pb, EINA_TRUE);
+ evas_object_show(priv->utility_pb);
+
+ /*TODO:to add utility button*/
+ btn = util_add_btn(priv->layout, BTN_STYLE_NETWORK_SET);
+ if (!btn) {
+ evas_object_del(pb);
+ return;
+ }
+ elm_object_text_set(btn, _(NET_WORK_SET));
+ elm_object_part_content_set(priv->base, PART_UTILITY_BUTTON, btn);
+ evas_object_event_callback_add(btn, EVAS_CALLBACK_KEY_DOWN,
+ _btn_key_down, NULL);
+
+ priv->utility_pb = pb;
+ priv->utility_btn = btn;
+}
+
+static void _del_no_src_utility(struct _priv *priv)
+{
+ if (!priv)
+ return;
+
+ if (priv->utility_btn) {
+ evas_object_del(priv->utility_btn);
+ priv->utility_btn = NULL;
+ }
+
+ if (priv->utility_pb) {
+ evas_object_del(priv->utility_pb);
+ priv->utility_pb = NULL;
+ }
+}
+
+static void _replace_content(Evas_Object *layout, const char *part,
+ Evas_Object *old, Evas_Object *new_obj)
+{
+ if (!layout || !part || !old || !new_obj)
+ return;
+
+ elm_object_part_content_unset(layout, part);
+ evas_object_hide(old);
+
+ elm_object_part_content_set(layout, part, new_obj);
+ evas_object_show(new_obj);
+}
+
+static void _grid_to_label(struct _priv *priv)
+{
+ if (!priv || priv->is_pause)
+ return;
+
+ _replace_content(priv->layout,
+ PART_CONTENT_CONTENT, priv->grid, priv->text_ly);
+ priv->is_grid = 0;
+
+ _add_no_src_utility(priv);
+
+ if (priv->send_sig_back)
+ priv->send_sig_back(priv->base, E_RETURN);
+}
+
+static void _label_to_grid(struct _priv *priv)
+{
+ if (!priv || priv->is_pause)
+ return;
+
+ _replace_content(priv->layout,
+ PART_CONTENT_CONTENT, priv->text_ly, priv->grid);
+ priv->is_grid = 1;
+
+ _del_no_src_utility(priv);
+}
+
+static Evas_Object *_create_layout(Evas_Object *base, sig_event_cb ptr)
+{
+ ASSERT(base);
+
+ int ret;
+ struct _priv *priv;
+
+ CViewMgr *vmgr = CViewMgr::GetInstance();
+ CSourceMgr *src_mgr = CSourceMgr::GetInstance();
+
+ ASSERT(vmgr);
+ ASSERT(src_mgr);
+
+ priv = (struct _priv *)calloc(1, sizeof(*priv));
+ if (!priv)
+ return NULL;
+
+ priv->src_mgr = src_mgr;
+ priv->vmgr = vmgr;
+ priv->base = base;
+ priv->send_sig_back = ptr;
+
+ priv->layout = util_add_layout(base, GRP_CONTENT);
+ if (!priv->layout) {
+ _ERR("Add layout failed.");
+ UTIL_FREE(priv);
+ return NULL;
+ }
+
+ priv->grid = util_add_grid(priv->layout, ITEM_W, ITEM_H);
+ if (!priv->grid) {
+ _ERR("Add gengrid failed.");
+ goto error;
+ }
+
+ evas_object_event_callback_add(priv->grid, EVAS_CALLBACK_MOUSE_MOVE,
+ _grid_mouse_move, priv);
+ evas_object_event_callback_add(priv->grid, EVAS_CALLBACK_KEY_DOWN,
+ _grid_key_down, priv);
+ evas_object_smart_callback_add(priv->grid, "item,focused",
+ _grid_focused, priv);
+
+ ret = _add_no_src_label(priv);
+ if (ret) {
+ _ERR("Add no src label failed.");
+ goto error;
+ }
+
+ evas_object_data_set(priv->layout, PRIV, priv);
+
+ return priv->layout;
+error:
+ evas_object_del(priv->layout);
+ UTIL_FREE(priv);
+
+ return NULL;
+}
+
+static void _destory_layout(Evas_Object *layout)
+{
+ struct _priv *priv;
+
+ if (!layout) {
+ _ERR("Invaild data.");
+ return;
+ }
+
+ priv = (struct _priv *)evas_object_data_get(layout, PRIV);
+
+ UTIL_FREE(priv);
+
+ evas_object_del(layout);
+}
+
+static Eina_Bool _timer_del_item_cb(void *data)
+{
+ struct _priv *priv;
+ Elm_Object_Item *prev;
+ Elm_Object_Item *next;
+
+ if (!data)
+ return EINA_FALSE;
+
+ priv = (struct _priv *)data;
+
+ if (!priv->del_it)
+ return EINA_FALSE;
+
+ prev = elm_gengrid_item_prev_get(priv->del_it);
+ next = elm_gengrid_item_prev_get(priv->del_it);
+
+ elm_object_item_data_set(priv->del_it, NULL);
+ elm_object_item_del(priv->del_it);
+
+ if (!prev && !next) {
+ _grid_to_label(priv);
+ } else if (priv->del_it == priv->focus_it) {
+ if (prev)
+ priv->focus_it = prev;
+ else
+ priv->focus_it = next;
+
+ elm_object_item_focus_set(priv->focus_it, EINA_TRUE);
+ }
+
+ priv->del_it = NULL;
+
+ return EINA_FALSE;
+}
+
+static void _update_src_list(void *user_data, void *data, enum update_ui type)
+{
+ Eina_List *list, *l;
+ Ecore_Timer *timer;
+ Evas_Object *layout;
+ struct _priv *priv;
+ CSourceMgr *src_mgr;
+ CSourceInfo *si;
+ CSourceInfo *si_data = (CSourceInfo *)data;
+ int count;
+ void *obj;
+
+ if (!user_data) {
+ _ERR("Invaild data.");
+ return;
+ }
+
+ layout = (Evas_Object*)user_data;
+ priv = (struct _priv *)evas_object_data_get(layout, PRIV);
+ if (!priv || !priv->grid || !priv->src_mgr || priv->is_pause) {
+ _ERR("Invaild data.");
+ return;
+ }
+
+ src_mgr = priv->src_mgr;
+ /*TODO:there is only nearby connected source list*/
+ list = src_mgr->NearbyConnList();
+ count = eina_list_count(list);
+
+ if (type == SRC_PLUG_ADD_ONE && data) {
+ util_add_item(priv->grid, (CSourceInfo *)data);
+
+ if (count >= 1)
+ _label_to_grid(priv);
+ } else if (type == SRC_PLUG_DEL_ONE && data) {
+ priv->del_it = (Elm_Object_Item*)si_data->Data();
+ si_data->SetData(NULL);
+
+ timer = ecore_timer_add(DEL_IT_TIME, _timer_del_item_cb, priv);
+ elm_object_item_data_set(priv->del_it, timer);
+ util_dim_item(priv->del_it);
+ } else if (type == SRC_UPDATE_ALL) {
+ if (count == 0) {
+ _grid_to_label(priv);
+ } else {
+ _label_to_grid(priv);
+ elm_gengrid_clear(priv->grid);
+
+ EINA_LIST_FOREACH(list, l, obj) {
+ si = (CSourceInfo *)obj;
+ util_add_item(priv->grid, si);
+ }
+ }
+ }
+
+ return;
+}
+
+static void _pause_layout(Evas_Object *layout)
+{
+ struct _priv *priv;
+
+ if (!layout)
+ return;
+
+ priv = (struct _priv *)evas_object_data_get(layout, PRIV);
+ if (!priv)
+ return;
+
+ priv->is_pause = 1;
+ _del_no_src_utility(priv);
+ evas_object_hide(layout);
+}
+
+static void _resume_layout(Evas_Object *layout)
+{
+ struct _priv *priv;
+
+ if (!layout)
+ return;
+
+ priv = (struct _priv *)evas_object_data_get(layout, PRIV);
+ if (!priv)
+ return;
+
+ priv->is_pause = 0;
+ _update_src_list(layout, NULL, SRC_UPDATE_ALL);
+ evas_object_show(layout);
+}
+
+static struct layout_class _lclass;/* = {
+ .create = _create_layout,
+ .destory = _destory_layout,
+ .pause = _pause_layout,
+ .resume = _resume_layout,
+ .update = _update_src_list
+};*/
+
+struct layout_class *get_nearby_lclass()
+{
+ _lclass.create = _create_layout;
+ _lclass.destory = _destory_layout;
+ _lclass.pause = _pause_layout;
+ _lclass.resume = _resume_layout;
+ _lclass.update = _update_src_list;
+ return &_lclass;
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 <utilX.h>
+#include <app.h>
+#include "def.h"
+#include "dbg.h"
+
+#include "AppCommon.h"
+#include "BaseView.h"
+#include "ViewMgr.h"
+#include "external.h"
+#include "source_mgr.h"
+#include "layout_mgr.h"
+#include "menu_view.h"
+#include "util.h"
+
+#define PRIV "priv"
+
+struct _priv {
+ Evas_Object *base;
+ Evas_Object *layout;
+ Evas_Object *grid;
+ Evas_Object *label;
+ Elm_Object_Item *focus_it;
+ Elm_Object_Item *del_it;
+ CSourceMgr *srcmgr;
+ CViewMgr *vmgr;
+ int is_pause;
+ int is_grid;
+
+ sig_event_cb send_sig_back_func;
+};
+
+static void _grid_mouse_move(void *data,
+ Evas *e, Evas_Object *obj, void *ev_info)
+{
+ struct _priv *priv;
+ Elm_Object_Item *it;
+ Evas_Event_Mouse_Move *ev;
+
+ if (!data || !ev_info)
+ return;
+
+ priv = (struct _priv *)data;
+ ev = (Evas_Event_Mouse_Move *)ev_info;
+ it = elm_gengrid_at_xy_item_get(obj, ev->cur.canvas.x,
+ ev->cur.canvas.y, NULL, NULL);
+ if (!it)
+ return;
+
+ if (elm_object_item_focus_get(it))
+ return;
+
+ elm_object_item_focus_set(it, EINA_TRUE);
+
+ if (priv->send_sig_back_func)
+ priv->send_sig_back_func(priv->base, E_HIGHLIGHT);
+}
+
+static void _grid_key_down(void *data,
+ Evas *e, Evas_Object *obj, void *ev_info)
+{
+ struct _priv *priv;
+ CSourceInfo *si;
+ Evas_Event_Key_Down *ev;
+
+ if (!data || !ev_info)
+ return;
+
+ priv = (struct _priv *)data;
+ ev = (Evas_Event_Key_Down *)ev_info;
+ si = priv->srcmgr->SourceInfoByData(priv->focus_it);
+ if (!ev->keyname || !si)
+ return;
+
+ if (!strcmp(ev->keyname, KEY_MENU))
+ priv->vmgr->PushView(MENU_VIEW, si);
+}
+
+static void _grid_focused(void *data,
+ Evas_Object *obj, void *ev_info)
+{
+ struct _priv *priv;
+
+ if (!data)
+ return;
+
+ priv = (struct _priv *)data;
+ priv->focus_it = (Elm_Object_Item*)ev_info;
+
+ if (priv->send_sig_back_func)
+ priv->send_sig_back_func(priv->base, E_HIGHLIGHT);
+}
+
+static Evas_Object *_create_layout(Evas_Object *base, sig_event_cb ptr)
+{
+ ASSERT(base);
+
+ Evas_Object *layout;
+ struct _priv *priv;
+
+ CViewMgr *vmgr = CViewMgr::GetInstance();
+ CSourceMgr *srcmgr = CSourceMgr::GetInstance();
+
+ ASSERT(vmgr);
+ ASSERT(srcmgr);
+
+ priv = (struct _priv *)calloc(1, sizeof(*priv));
+ if (!priv) {
+ return NULL;
+ }
+
+ layout = util_add_layout(base, GRP_CONTENT);
+ if (!layout) {
+ _ERR("Add layout failed.");
+ UTIL_FREE(priv);
+ return NULL;
+ }
+
+ priv->grid = util_add_grid(layout, ITEM_W, ITEM_H);
+ if (!priv->grid) {
+ _ERR("Add gengrid failed.");
+ goto error;
+ }
+ evas_object_event_callback_add(priv->grid, EVAS_CALLBACK_MOUSE_MOVE,
+ _grid_mouse_move, priv);
+ evas_object_event_callback_add(priv->grid, EVAS_CALLBACK_KEY_DOWN,
+ _grid_key_down, priv);
+ evas_object_smart_callback_add(priv->grid, "item,focused",
+ _grid_focused, priv);
+ priv->label = util_add_layout(layout, GRP_NO_PLUG_SRC_LABEL);
+ if (!priv->label) {
+ _ERR("Add no plug src label failed.");
+ goto error;
+ }
+
+ priv->is_pause = 1;
+ priv->srcmgr = srcmgr;
+ priv->vmgr = vmgr;
+ priv->base = base;
+ priv->layout = layout;
+ priv->send_sig_back_func = ptr;
+ evas_object_data_set(layout, PRIV, priv);
+
+ evas_object_show(priv->label);
+ elm_object_part_content_set(layout, PART_CONTENT_CONTENT, priv->label);
+
+ return layout;
+error:
+ UTIL_FREE(priv);
+ evas_object_del(layout);
+
+ return NULL;
+}
+
+static void _destory_layout(Evas_Object *layout)
+{
+ struct _priv *priv;
+
+ if (!layout) {
+ _ERR("Invaild data.");
+ return;
+ }
+
+ priv = (struct _priv *)evas_object_data_get(layout, PRIV);
+
+ UTIL_FREE(priv);
+
+ evas_object_del(layout);
+}
+
+static void _grid_to_label(Evas_Object *layout)
+{
+ struct _priv *priv;
+
+ if (!layout)
+ return;
+
+ priv = (struct _priv *)evas_object_data_get(layout, PRIV);
+ if (!priv || !priv->is_grid || !priv->grid)
+ return;
+
+ elm_object_part_content_unset(layout, PART_CONTENT_CONTENT);
+ evas_object_hide(priv->grid);
+
+ elm_object_part_content_set(layout, PART_CONTENT_CONTENT, priv->label);
+ evas_object_show(priv->label);
+
+ if (priv->send_sig_back_func)
+ priv->send_sig_back_func(priv->base, E_RETURN);
+
+ priv->is_grid = 0;
+}
+
+static void _label_to_grid(Evas_Object *layout)
+{
+ struct _priv *priv;
+
+ if (!layout)
+ return;
+
+ priv = (struct _priv *)evas_object_data_get(layout, PRIV);
+ if (!priv || priv->is_grid || !priv->label)
+ return;
+
+ elm_object_part_content_unset(layout, PART_CONTENT_CONTENT);
+ evas_object_hide(priv->label);
+
+ elm_object_part_content_set(layout, PART_CONTENT_CONTENT, priv->grid);
+ evas_object_show(priv->grid);
+
+ priv->is_grid = 1;
+}
+
+static Eina_Bool _timer_del_item_cb(void *data)
+{
+ struct _priv *priv;
+ Elm_Object_Item *prev;
+ Elm_Object_Item *next;
+
+ if (!data)
+ return EINA_FALSE;
+
+ priv = (struct _priv *)data;
+
+ if (!priv->del_it)
+ return EINA_FALSE;
+
+ prev = elm_gengrid_item_prev_get(priv->del_it);
+ next = elm_gengrid_item_prev_get(priv->del_it);
+
+ elm_object_item_data_set(priv->del_it, NULL);
+ elm_object_item_del(priv->del_it);
+
+ if (!prev && !next)
+ _grid_to_label(priv->layout);
+ else if (priv->del_it == priv->focus_it) {
+ if (prev)
+ priv->focus_it = prev;
+
+ else
+ priv->focus_it = next;
+
+ elm_object_item_focus_set(priv->focus_it, EINA_TRUE);
+ }
+
+ priv->del_it = NULL;
+
+ return EINA_FALSE;
+}
+
+static void _update_src_list(void *user_data, void *data, enum update_ui type)
+{
+ Eina_List *list, *l;
+ Ecore_Timer *timer;
+ Evas_Object *layout;
+ struct _priv *priv;
+ CSourceMgr *srcmgr;
+ CSourceInfo *si;
+ CSourceInfo *si_data = (CSourceInfo *)data;
+ int count;
+ void *obj;
+
+ if (!user_data) {
+ _ERR("Invaild data.");
+ return;
+ }
+
+ layout = (Evas_Object *)user_data;
+ priv = (struct _priv *)evas_object_data_get(layout, PRIV);
+ if (!priv || !priv->grid || !priv->srcmgr || priv->is_pause) {
+ _ERR("Invaild data.");
+ return;
+ }
+
+ srcmgr = priv->srcmgr;
+ list = srcmgr->PluggedList();
+ count = eina_list_count(list);
+
+ if (type == SRC_PLUG_ADD_ONE && data) {
+
+ util_add_item(priv->grid, si_data);
+
+ if (count >= 1)
+ _label_to_grid(layout);
+ } else if (type == SRC_PLUG_DEL_ONE && data) {
+
+ priv->del_it = (Elm_Object_Item*)si_data->Data();
+ si_data->SetData(NULL);
+
+ timer = ecore_timer_add(DEL_IT_TIME, _timer_del_item_cb, priv);
+ elm_object_item_data_set(priv->del_it, timer);
+ util_dim_item(priv->del_it);
+ } else if (type == SRC_UPDATE_ALL) {
+
+ if (count == 0)
+ _grid_to_label(layout);
+ else {
+ _label_to_grid(layout);
+
+ elm_gengrid_clear(priv->grid);
+
+ EINA_LIST_FOREACH(list, l, obj) {
+ si = (CSourceInfo *)obj;
+ util_add_item(priv->grid, si);
+ }
+ }
+ }
+}
+
+static void _pause_layout(Evas_Object *layout)
+{
+ struct _priv *priv;
+
+ if (!layout)
+ return;
+
+ priv = (struct _priv *)evas_object_data_get(layout, PRIV);
+ if (!priv || !priv->grid || priv->is_pause)
+ return;
+
+ priv->is_pause = 1;
+ elm_gengrid_clear(priv->grid);
+ evas_object_hide(layout);
+}
+
+static void _resume_layout(Evas_Object *layout)
+{
+ struct _priv *priv;
+
+ if (!layout)
+ return;
+
+ priv = (struct _priv *)evas_object_data_get(layout, PRIV);
+ if (!priv || !priv->is_pause)
+ return;
+
+ priv->is_pause = 0;
+ _update_src_list(layout, NULL, SRC_UPDATE_ALL);
+ evas_object_show(layout);
+}
+
+static struct layout_class _lclass; /* = {
+ .create = _create_layout,
+ .destory = _destory_layout,
+ .pause = _pause_layout,
+ .resume = _resume_layout,
+ .update = _update_src_list
+};*/
+
+struct layout_class *get_plugged_lclass()
+{
+ _lclass.create = _create_layout;
+ _lclass.destory = _destory_layout;
+ _lclass.pause = _pause_layout;
+ _lclass.resume = _resume_layout;
+ _lclass.update = _update_src_list;
+ return &_lclass;
+}