Tizen release 1.0
authorKim Kibum <kb0929.kim@samsung.com>
Mon, 9 Apr 2012 03:11:59 +0000 (12:11 +0900)
committerKim Kibum <kb0929.kim@samsung.com>
Mon, 9 Apr 2012 03:11:59 +0000 (12:11 +0900)
31 files changed:
CMakeLists.txt [new file with mode: 0755]
INSTALL [new file with mode: 0644]
LICENSE [new file with mode: 0644]
NOTICE [new file with mode: 0644]
app-selector-util.c [new file with mode: 0755]
app-selector-util.h [new file with mode: 0755]
app-selector-view.c [new file with mode: 0755]
app-selector-view.h [new file with mode: 0755]
app-selector.c [new file with mode: 0755]
app-selector.edc [new file with mode: 0644]
app-selector.h [new file with mode: 0755]
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0755]
debian/copyright [new file with mode: 0644]
debian/dirs [new file with mode: 0644]
debian/docs [new file with mode: 0644]
debian/org.tizen.app-selector.install.in [new file with mode: 0644]
debian/rules [new file with mode: 0755]
org.tizen.app-selector.desktop.in [new file with mode: 0644]
org.tizen.app-selector.png [new file with mode: 0644]
packaging/org.tizen.app-selector.spec [new file with mode: 0644]
po/CMakeLists.txt [new file with mode: 0644]
po/POTFILES.in [new file with mode: 0644]
po/app-selector.pot [new file with mode: 0644]
po/en_GB.po [new file with mode: 0644]
po/en_US.po [new file with mode: 0644]
po/ja.po [new file with mode: 0644]
po/ko.po [new file with mode: 0644]
po/update-po.sh [new file with mode: 0755]
po/zh_CN.po [new file with mode: 0644]

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..b0baecd
--- /dev/null
@@ -0,0 +1,71 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(app-selector C)
+
+SET(SRCS app-selector.c app-selector-view.c app-selector-util.c)
+
+SET(VENDOR "tizen")
+SET(PACKAGE ${PROJECT_NAME})
+SET(PKGNAME "org.${VENDOR}.${PACKAGE}")
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(BINDIR "${PREFIX}/bin")
+SET(DATADIR "${PREFIX}/share")
+SET(LOCALEDIR "${DATADIR}/locale")
+SET(ICONDIR "${DATADIR}/icons")
+SET(EDJDIR "${DATADIR}/edje/${PACKAGE}")
+
+IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+       SET(CMAKE_BUILD_TYPE "Release")
+ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED appcore-efl aul utilX ecore-x eina evas ecore ecore-file ecore-input edje ail appsvc x11)
+
+FOREACH(flag ${pkgs_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+SET(CMAKE_C_FLAGS_RELEASE "-O2")
+
+FIND_PROGRAM(UNAME NAMES uname)
+EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
+IF("${ARCH}" MATCHES "^arm.*")
+       ADD_DEFINITIONS("-DTARGET")
+       MESSAGE("add -DTARGET")
+ENDIF("${ARCH}" MATCHES "^arm.*")
+
+ADD_DEFINITIONS("-fpie")
+
+ADD_DEFINITIONS("-DVENDOR=\"${VENDOR}\"")
+ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE}\"")
+ADD_DEFINITIONS("-DPACKAGE_NAME=\"${PKGNAME}\"")
+ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
+ADD_DEFINITIONS("-DLOCALEDIR=\"${LOCALEDIR}\"")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
+
+ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} "-pie")
+
+ADD_CUSTOM_TARGET(app-selector.edj
+               COMMAND edje_cc -id ${CMAKE_SOURCE_DIR}/images  
+               ${CMAKE_SOURCE_DIR}/app-selector.edc ${CMAKE_BINARY_DIR}/app-selector.edj  
+               DEPENDS ${CMAKE_SOURCE_DIR}/app-selector.edc   
+)  
+ADD_DEPENDENCIES(${PROJECT_NAME} app-selector.edj)
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR})
+INSTALL(FILES ${CMAKE_BINARY_DIR}/app-selector.edj DESTINATION ${EDJDIR})
+
+# install desktop file & icon
+CONFIGURE_FILE(${PKGNAME}.desktop.in ${CMAKE_BINARY_DIR}/${PKGNAME}.desktop)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/${PKGNAME}.desktop DESTINATION /opt/share/applications)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/${PKGNAME}.png DESTINATION share/icons/default/small)
+
+# i18n
+ADD_SUBDIRECTORY(po)
+
diff --git a/INSTALL b/INSTALL
new file mode 100644 (file)
index 0000000..ddf4e78
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,33 @@
+1. make the build directory
+
+  ex) 
+
+   $ mkdir build
+
+
+2. change the working directory to the build directory
+
+  ex)
+
+   $ cd build
+
+
+3. run 'cmake'
+
+  $ cmake ${SOURCE_DIR} -DCMAKE_INSTALL_PREFIX=/usr
+
+  ex)
+
+   $ cmake .. -DCMAKE_INSTALL_PREFIX=/usr
+
+   or
+
+   $ cmake ..
+
+
+4. make & make install
+
+  ex)
+
+   $ make -j 2 && make install
+
diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..9c13a9b
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,204 @@
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+\r
+                                 Apache License\r
+                           Version 2.0, January 2004\r
+                        http://www.apache.org/licenses/\r
+\r
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\r
+\r
+   1. Definitions.\r
+\r
+      "License" shall mean the terms and conditions for use, reproduction,\r
+      and distribution as defined by Sections 1 through 9 of this document.\r
+\r
+      "Licensor" shall mean the copyright owner or entity authorized by\r
+      the copyright owner that is granting the License.\r
+\r
+      "Legal Entity" shall mean the union of the acting entity and all\r
+      other entities that control, are controlled by, or are under common\r
+      control with that entity. For the purposes of this definition,\r
+      "control" means (i) the power, direct or indirect, to cause the\r
+      direction or management of such entity, whether by contract or\r
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the\r
+      outstanding shares, or (iii) beneficial ownership of such entity.\r
+\r
+      "You" (or "Your") shall mean an individual or Legal Entity\r
+      exercising permissions granted by this License.\r
+\r
+      "Source" form shall mean the preferred form for making modifications,\r
+      including but not limited to software source code, documentation\r
+      source, and configuration files.\r
+\r
+      "Object" form shall mean any form resulting from mechanical\r
+      transformation or translation of a Source form, including but\r
+      not limited to compiled object code, generated documentation,\r
+      and conversions to other media types.\r
+\r
+      "Work" shall mean the work of authorship, whether in Source or\r
+      Object form, made available under the License, as indicated by a\r
+      copyright notice that is included in or attached to the work\r
+      (an example is provided in the Appendix below).\r
+\r
+      "Derivative Works" shall mean any work, whether in Source or Object\r
+      form, that is based on (or derived from) the Work and for which the\r
+      editorial revisions, annotations, elaborations, or other modifications\r
+      represent, as a whole, an original work of authorship. For the purposes\r
+      of this License, Derivative Works shall not include works that remain\r
+      separable from, or merely link (or bind by name) to the interfaces of,\r
+      the Work and Derivative Works thereof.\r
+\r
+      "Contribution" shall mean any work of authorship, including\r
+      the original version of the Work and any modifications or additions\r
+      to that Work or Derivative Works thereof, that is intentionally\r
+      submitted to Licensor for inclusion in the Work by the copyright owner\r
+      or by an individual or Legal Entity authorized to submit on behalf of\r
+      the copyright owner. For the purposes of this definition, "submitted"\r
+      means any form of electronic, verbal, or written communication sent\r
+      to the Licensor or its representatives, including but not limited to\r
+      communication on electronic mailing lists, source code control systems,\r
+      and issue tracking systems that are managed by, or on behalf of, the\r
+      Licensor for the purpose of discussing and improving the Work, but\r
+      excluding communication that is conspicuously marked or otherwise\r
+      designated in writing by the copyright owner as "Not a Contribution."\r
+\r
+      "Contributor" shall mean Licensor and any individual or Legal Entity\r
+      on behalf of whom a Contribution has been received by Licensor and\r
+      subsequently incorporated within the Work.\r
+\r
+   2. Grant of Copyright License. Subject to the terms and conditions of\r
+      this License, each Contributor hereby grants to You a perpetual,\r
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+      copyright license to reproduce, prepare Derivative Works of,\r
+      publicly display, publicly perform, sublicense, and distribute the\r
+      Work and such Derivative Works in Source or Object form.\r
+\r
+   3. Grant of Patent License. Subject to the terms and conditions of\r
+      this License, each Contributor hereby grants to You a perpetual,\r
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+      (except as stated in this section) patent license to make, have made,\r
+      use, offer to sell, sell, import, and otherwise transfer the Work,\r
+      where such license applies only to those patent claims licensable\r
+      by such Contributor that are necessarily infringed by their\r
+      Contribution(s) alone or by combination of their Contribution(s)\r
+      with the Work to which such Contribution(s) was submitted. If You\r
+      institute patent litigation against any entity (including a\r
+      cross-claim or counterclaim in a lawsuit) alleging that the Work\r
+      or a Contribution incorporated within the Work constitutes direct\r
+      or contributory patent infringement, then any patent licenses\r
+      granted to You under this License for that Work shall terminate\r
+      as of the date such litigation is filed.\r
+\r
+   4. Redistribution. You may reproduce and distribute copies of the\r
+      Work or Derivative Works thereof in any medium, with or without\r
+      modifications, and in Source or Object form, provided that You\r
+      meet the following conditions:\r
+\r
+      (a) You must give any other recipients of the Work or\r
+          Derivative Works a copy of this License; and\r
+\r
+      (b) You must cause any modified files to carry prominent notices\r
+          stating that You changed the files; and\r
+\r
+      (c) You must retain, in the Source form of any Derivative Works\r
+          that You distribute, all copyright, patent, trademark, and\r
+          attribution notices from the Source form of the Work,\r
+          excluding those notices that do not pertain to any part of\r
+          the Derivative Works; and\r
+\r
+      (d) If the Work includes a "NOTICE" text file as part of its\r
+          distribution, then any Derivative Works that You distribute must\r
+          include a readable copy of the attribution notices contained\r
+          within such NOTICE file, excluding those notices that do not\r
+          pertain to any part of the Derivative Works, in at least one\r
+          of the following places: within a NOTICE text file distributed\r
+          as part of the Derivative Works; within the Source form or\r
+          documentation, if provided along with the Derivative Works; or,\r
+          within a display generated by the Derivative Works, if and\r
+          wherever such third-party notices normally appear. The contents\r
+          of the NOTICE file are for informational purposes only and\r
+          do not modify the License. You may add Your own attribution\r
+          notices within Derivative Works that You distribute, alongside\r
+          or as an addendum to the NOTICE text from the Work, provided\r
+          that such additional attribution notices cannot be construed\r
+          as modifying the License.\r
+\r
+      You may add Your own copyright statement to Your modifications and\r
+      may provide additional or different license terms and conditions\r
+      for use, reproduction, or distribution of Your modifications, or\r
+      for any such Derivative Works as a whole, provided Your use,\r
+      reproduction, and distribution of the Work otherwise complies with\r
+      the conditions stated in this License.\r
+\r
+   5. Submission of Contributions. Unless You explicitly state otherwise,\r
+      any Contribution intentionally submitted for inclusion in the Work\r
+      by You to the Licensor shall be under the terms and conditions of\r
+      this License, without any additional terms or conditions.\r
+      Notwithstanding the above, nothing herein shall supersede or modify\r
+      the terms of any separate license agreement you may have executed\r
+      with Licensor regarding such Contributions.\r
+\r
+   6. Trademarks. This License does not grant permission to use the trade\r
+      names, trademarks, service marks, or product names of the Licensor,\r
+      except as required for reasonable and customary use in describing the\r
+      origin of the Work and reproducing the content of the NOTICE file.\r
+\r
+   7. Disclaimer of Warranty. Unless required by applicable law or\r
+      agreed to in writing, Licensor provides the Work (and each\r
+      Contributor provides its Contributions) on an "AS IS" BASIS,\r
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\r
+      implied, including, without limitation, any warranties or conditions\r
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\r
+      PARTICULAR PURPOSE. You are solely responsible for determining the\r
+      appropriateness of using or redistributing the Work and assume any\r
+      risks associated with Your exercise of permissions under this License.\r
+\r
+   8. Limitation of Liability. In no event and under no legal theory,\r
+      whether in tort (including negligence), contract, or otherwise,\r
+      unless required by applicable law (such as deliberate and grossly\r
+      negligent acts) or agreed to in writing, shall any Contributor be\r
+      liable to You for damages, including any direct, indirect, special,\r
+      incidental, or consequential damages of any character arising as a\r
+      result of this License or out of the use or inability to use the\r
+      Work (including but not limited to damages for loss of goodwill,\r
+      work stoppage, computer failure or malfunction, or any and all\r
+      other commercial damages or losses), even if such Contributor\r
+      has been advised of the possibility of such damages.\r
+\r
+   9. Accepting Warranty or Additional Liability. While redistributing\r
+      the Work or Derivative Works thereof, You may choose to offer,\r
+      and charge a fee for, acceptance of support, warranty, indemnity,\r
+      or other liability obligations and/or rights consistent with this\r
+      License. However, in accepting such obligations, You may act only\r
+      on Your own behalf and on Your sole responsibility, not on behalf\r
+      of any other Contributor, and only if You agree to indemnify,\r
+      defend, and hold each Contributor harmless for any liability\r
+      incurred by, or claims asserted against, such Contributor by reason\r
+      of your accepting any such warranty or additional liability.\r
+\r
+   END OF TERMS AND CONDITIONS\r
+\r
+   APPENDIX: How to apply the Apache License to your work.\r
+\r
+      To apply the Apache License to your work, attach the following\r
+      boilerplate notice, with the fields enclosed by brackets "[]"\r
+      replaced with your own identifying information. (Don't include\r
+      the brackets!)  The text should be enclosed in the appropriate\r
+      comment syntax for the file format. We also recommend that a\r
+      file or class name and description of purpose be included on the\r
+      same "printed page" as the copyright notice for easier\r
+      identification within third-party archives.\r
+\r
+   Copyright [yyyy] [name of copyright owner]\r
+\r
+   Licensed under the Apache License, Version 2.0 (the "License");\r
+   you may not use this file except in compliance with the License.\r
+   You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+\r
diff --git a/NOTICE b/NOTICE
new file mode 100644 (file)
index 0000000..4297ee3
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1 @@
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
diff --git a/app-selector-util.c b/app-selector-util.c
new file mode 100755 (executable)
index 0000000..eacf73e
--- /dev/null
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the app-selector
+ * Written by Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+
+
+
+#include <Ecore.h>
+#include <Ecore_X.h>
+
+#include <sys/shm.h>
+
+#include <X11/Xatom.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/extensions/Xcomposite.h>
+#include <X11/extensions/XShm.h>
+
+#include "app-selector.h"
+#include "app-selector-util.h"
+
+
+static pid_t __get_win_pid(Display *d, Window win);
+static int __tm_get_win_with_pid(Display *d, Window * win, pid_t pid);
+static Window __find_top_win(Window win);
+
+
+static pid_t __get_win_pid(Display *d, Window win)
+{
+       int ret;
+       pid_t pid;
+
+       Atom a_pid;
+       Atom a_type;
+       int format;
+       unsigned long nitems;
+       unsigned long bytes_after;
+       unsigned char *prop_ret;
+
+       if (!d)
+               return -1;
+
+       a_pid = XInternAtom(d, "_NET_WM_PID", True);
+       if (a_pid == 0)
+               return -1;
+
+       ret = XGetWindowProperty(d, win, a_pid, 0, 1, False, XA_CARDINAL,
+                                &a_type, &format, &nitems, &bytes_after,
+                                &prop_ret);
+
+       if (ret != 0 || prop_ret == NULL)
+               return -1;
+
+       pid = *(unsigned long *)prop_ret;
+
+       XFree(prop_ret);
+       return pid;
+}
+
+static int __tm_get_win_with_pid(Display *d, Window * win, pid_t pid)
+{
+       int ret;
+       pid_t p;
+       int n;
+       Window root, parent, *child;
+
+       p = __get_win_pid(d, *win);
+       if (p == pid)
+               return 1;
+
+       ret = XQueryTree(d, *win, &root, &parent, &child, &n);
+       if (ret) {
+               int i;
+               int found = 0;
+
+               for (i = 0; i < n; i++) {
+                       found = __tm_get_win_with_pid(d, &child[i], pid);
+                       if (found) {
+                               *win = child[i];
+                               break;
+                       }
+               }
+
+               XFree(child);
+               if (found)
+                       return 1;
+       }
+       return 0;
+}
+
+static Window __find_top_win(Window win)
+{
+       Window root, parent, *childw, return_win;
+       unsigned int nchild;
+       if (!XQueryTree(ecore_x_display_get(),
+           win, &root, &parent, &childw, &nchild)) {
+/*              DBG_PRT("XQueryTree failed.\n");*/
+               return win;
+       }
+       if (parent == root) {
+/*              DBG_PRT("toplevel window: 0x%x \n", (unsigned int)win);*/
+               return_win = win;
+               XFree(childw);
+               return return_win;
+       } else {
+/*              DBG_PRT("window: 0x%x \n",(unsigned int)win);*/
+               XFree(childw);
+               return __find_top_win(parent);
+       }
+}
+
+int set_transient(Ecore_X_Display *display, Ecore_X_Window win,
+                 Ecore_X_Window prev_win)
+{
+       int ret = 0;
+
+       ret = XSetTransientForHint(display, win, prev_win);
+
+       return ret;
+}
diff --git a/app-selector-util.h b/app-selector-util.h
new file mode 100755 (executable)
index 0000000..1d2aee6
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the app-selector
+ * Written by Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+
+
+
+#ifndef __DEF_APP_SELECT_UTIL_H_
+#define __DEF_APP_SELECT_UTIL_H_
+
+#include <Elementary.h>
+
+int set_transient(Ecore_X_Display *display, Ecore_X_Window win,
+                 Ecore_X_Window prev_win);
+
+#endif                         /* __DEF_APP_SELECT_UTIL_H__ */
diff --git a/app-selector-view.c b/app-selector-view.c
new file mode 100755 (executable)
index 0000000..73767bb
--- /dev/null
@@ -0,0 +1,594 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the app-selector
+ * Written by Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+
+
+
+#include <ail.h>
+#include <aul.h>
+#include <appsvc.h>
+
+#include "app-selector.h"
+#include "app-selector-view.h"
+
+#define TBL_NAME "menu"
+#define MIME_FIELD_NAME "mimetype"
+#define PATH_LEN       256
+#define NAME_LEN       256
+#define MAX_MIME_STR_SIZE 256
+#define EDJ_NAME       "/usr/share/edje/app-selector/app-selector.edj"
+
+extern int aul_forward_app(const char* pkgname, bundle *kb);
+
+static Eina_Bool __unload_info_popup(void *data);
+static void __default_app_set_cb(void *data, Evas_Object * obj, 
+                                       void *event_info);
+static void __launch_set_default_app_popup(struct _select_app_info *info);
+static void __response_cb(void *data, Evas_Object * obj, void *event_info);
+static void __clear_app_list(void *data);
+static int __app_list_get_with_mimetype(void *data);
+static Eina_Bool __gl_state_get(const void *data, Evas_Object * obj,
+                              const char *part);
+static void __gl_del(const void *data, Evas_Object * obj);
+static void __gl_sel(void *data, Evas_Object * obj, void *event_info);
+static Evas_Object *__gl_content_get(const void *data, Evas_Object * obj,
+                                const char *part);
+static char *__gl_text_get(const void *data, Evas_Object * obj,
+                          const char *part);
+static void __app_genlist_item_append(struct appdata *ad);
+static Evas_Object *__app_genlist_add(struct appdata *ad);
+
+static Eina_Bool __unload_info_popup(void *data)
+{
+/*     Evas_Object *eo = (Evas_Object *) data;
+       if (eo) {
+               evas_object_hide(eo);
+               evas_object_del(eo);
+       }
+*/     elm_exit();
+
+       return ECORE_CALLBACK_CANCEL;
+}
+
+void load_info_popup(struct appdata *ad, char *str)
+{
+       Evas_Object *eo = NULL;
+       eo = elm_popup_add(ad->win);
+       evas_object_size_hint_weight_set(eo, EVAS_HINT_EXPAND,
+                                        EVAS_HINT_EXPAND);
+       elm_object_text_set(eo, str);
+
+       ecore_timer_add(2.0, __unload_info_popup, eo);
+       evas_object_show(eo);
+}
+
+static void __default_app_set_ok_cb(void *data, Evas_Object * obj,
+                                       void *event_info)
+{
+       char *scheme = NULL;
+       char *tmp = NULL;
+       bundle *outb;
+       int ret;
+       
+       if (!data)
+               return;
+
+       struct _select_app_info *info = (struct _select_app_info *)data;
+
+
+       //printf("MIME :: %s, PKGNAME : %s\n", info->ad->mime_type, info->pkg_name);
+
+       if(info->ad->mime_type){
+               if (aul_set_defapp_with_mime(info->ad->mime_type, info->pkg_name) == AUL_R_OK){
+                       //printf("[Select Application] Insert Complete!!! %d\n", __LINE__);
+               }
+               else{
+                       //printf("[Select Application] Insert Error!!! %d\n", __LINE__);
+               }
+       } else if(info->ad->control_op) {
+
+               if(info->ad->control_uri) {
+                       if(strncmp(info->ad->control_uri,"/",1) == 0){
+                               if(!info->ad->control_mime) {
+                                       info->ad->control_mime = malloc(MAX_MIME_STR_SIZE);
+                                       aul_get_mime_from_file(info->ad->control_uri, info->ad->control_mime, MAX_MIME_STR_SIZE);
+                               }
+                               info->ad->control_uri = NULL;
+                       } else if(strncmp(info->ad->control_uri,"file:/",6)==0){
+                               if(!info->ad->control_mime) {
+                                       info->ad->control_mime = malloc(MAX_MIME_STR_SIZE);
+                                       aul_get_mime_from_file(&info->ad->control_uri[5], info->ad->control_mime, MAX_MIME_STR_SIZE);
+                               }
+                               info->ad->control_uri = NULL;
+                       } else if(strncmp(info->ad->control_uri,"file:///",8) == 0){
+                               if(!info->ad->control_mime) {
+                                       info->ad->control_mime = malloc(MAX_MIME_STR_SIZE);
+                                       aul_get_mime_from_file(&info->ad->control_uri[7], info->ad->control_mime, MAX_MIME_STR_SIZE);
+                               }
+                               info->ad->control_uri = NULL;
+                       }
+               }
+
+               if(info->ad->control_uri){
+                       tmp = strdup(info->ad->control_uri);
+                       scheme = strtok(tmp,":");
+               }
+               appsvc_set_defapp(info->ad->control_op,info->ad->control_mime,scheme,info->pkg_name);
+       }
+
+       ret = aul_forward_app(info->pkg_name, info->ad->kb);
+       _D("ok : aul_forward_app() pkg_name:%s ret:%d", info->pkg_name, ret);
+       
+       elm_exit();
+}
+
+static void __default_app_set_calcel_cb(void *data, Evas_Object * obj,
+                                       void *event_info)
+{
+       int ret;
+
+       if (!data)
+               return;
+
+       struct _select_app_info *info = (struct _select_app_info *)data;
+
+       ret = aul_forward_app(info->pkg_name, info->ad->kb);
+       _D("cancel : aul_forward_app() pkg_name:%s ret:%d", info->pkg_name, ret);
+
+       elm_exit();
+}
+
+
+static void __launch_set_default_app_popup(struct _select_app_info *info)
+{
+       Evas_Object *popup = NULL;
+       Evas_Object *btn1 = NULL;
+       Evas_Object *btn2 = NULL;
+
+       if (!info)
+               return;
+
+       struct appdata *ad = info->ad;
+
+       popup = elm_popup_add(ad->win);
+       evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND,
+                                        EVAS_HINT_EXPAND);
+       elm_object_text_set(popup, _("Set this application as default?"));
+       elm_object_part_text_set(popup, "title,text", _("Default app setting"));
+
+       btn1 = elm_button_add(popup);
+       elm_object_text_set(btn1, dgettext("sys_string", "IDS_COM_SK_OK"));
+       elm_object_part_content_set(popup, "button1", btn1);
+       evas_object_smart_callback_add(btn1, "clicked", __default_app_set_ok_cb, info);
+       btn2 = elm_button_add(popup);
+       elm_object_text_set(btn2, _("Cancel"));
+       elm_object_part_content_set(popup, "button2", btn2);
+       evas_object_smart_callback_add(btn2, "clicked", __default_app_set_calcel_cb, info);
+
+       ad->def_set_popup = popup;
+
+       evas_object_show(popup);
+
+}
+
+static void __response_cb(void *data, Evas_Object * obj, void *event_info)
+{
+       elm_exit();
+}
+
+static void __clear_app_list(void *data)
+{
+       struct appdata *ad = data;
+       Eina_List *l;
+       struct _select_app_info *info;
+
+       if (ad->app_list) {
+               EINA_LIST_FOREACH(ad->app_list, l, info) {
+                       if (info != NULL) {
+                               free(info->pkg_name);
+                               free(info->app_name);
+                               free(info->app_path);
+                               free(info->app_icon_path);
+                               free(info);
+                               info = NULL;
+                       }
+               }
+
+               eina_list_free(ad->app_list);
+               ad->app_list = NULL;
+       }
+
+       if (ad->app_genlist) {
+               elm_genlist_clear(ad->app_genlist);
+       }
+}
+
+static ail_cb_ret_e __iter_func(
+                       const ail_appinfo_h appinfo, void *user_data)
+{
+       struct appdata *ad = (struct appdata *)user_data;
+       struct _select_app_info *info;
+       char *str = NULL;
+
+       info = calloc(1, sizeof(struct _select_app_info));
+
+       ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &str);
+       info->pkg_name = strdup(str);
+
+       ail_appinfo_get_str(appinfo, AIL_PROP_NAME_STR, &str);
+       info->app_name = strdup(str);
+
+       ail_appinfo_get_str(appinfo, AIL_PROP_EXEC_STR, &str);
+       info->app_path = strdup(str);
+
+       ail_appinfo_get_str(appinfo, AIL_PROP_ICON_STR, &str);
+       info->app_icon_path = strdup(str);
+       
+       printf("PKGNAME : %s, ICONPATH : %s\n", info->pkg_name,
+                      info->app_icon_path);
+
+       info->ad = ad;
+
+       ad->app_list = eina_list_append(ad->app_list, info);
+       
+       return AIL_CB_RET_CONTINUE;     
+}
+
+
+static int __app_list_get_with_mimetype(void *data)
+{
+
+       struct appdata *ad = data;
+
+       ail_filter_h filter;
+       ail_error_e ret;
+
+       ret = ail_filter_new(&filter);
+       if (ret != AIL_ERROR_OK) 
+               return -1;
+
+       ret = ail_filter_add_str(filter, AIL_PROP_MIMETYPE_STR, ad->mime_type);
+       if (ret != AIL_ERROR_OK) {
+               ail_filter_destroy(filter);
+               return -1;
+       }
+
+       ail_filter_list_appinfo_foreach(filter, __iter_func, (void *)ad);
+
+       if (eina_list_count(ad->app_list) < 1) {
+               load_info_popup(ad, dgettext("sys_string", "IDS_COM_BODY_NO_APPLICATIONS_CAN_PERFORM_THIS_ACTION"));
+               ail_filter_destroy(filter);
+               return -1;
+       }
+       
+       ail_filter_destroy(filter);
+
+       return 0;
+}
+
+static int __iterate(const char* pkg_name, void *data)
+{
+       struct appdata *ad = data;
+       struct _select_app_info *info;
+       ail_appinfo_h handle;
+       ail_error_e ret;
+       char *str = NULL;
+
+       ret = ail_package_get_appinfo(pkg_name, &handle);
+       if (ret != AIL_ERROR_OK) {
+               return -1;
+       }
+
+       info = calloc(1, sizeof(struct _select_app_info));
+
+       ail_appinfo_get_str(handle, AIL_PROP_PACKAGE_STR, &str);
+       info->pkg_name = strdup(str);
+
+       ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
+       info->app_name = strdup(str);
+
+       ail_appinfo_get_str(handle, AIL_PROP_EXEC_STR, &str);
+       info->app_path = strdup(str);
+
+       ail_appinfo_get_str(handle, AIL_PROP_ICON_STR, &str);
+       info->app_icon_path = strdup(str);
+       
+       printf("PKGNAME : %s, ICONPATH : %s\n", info->pkg_name,
+                      info->app_icon_path);
+
+       info->ad = data;
+
+       ad->app_list = eina_list_append(ad->app_list, info);
+
+       ret = ail_package_destroy_appinfo(handle);
+       if (ret != AIL_ERROR_OK) {
+               return -1;
+       }
+       
+       return 0;
+}
+
+
+static int __app_list_get_with_control(void *data)
+{
+       struct appdata *ad = data;
+       struct _select_app_info *info;
+       bundle *kb;
+
+       char *scheme = NULL;
+       char *tmp = NULL;
+       char op_mime[1024] = {0,};
+       char op_scheme[1024] = {0,};
+
+       kb = bundle_create();
+       if(kb == NULL)
+       {
+               _E("bundle creation fail\n");
+               return -1;
+       }
+
+       if(ad->control_op){
+               appsvc_set_operation(kb, ad->control_op);
+       }
+       
+       if(ad->control_uri){
+               tmp = strdup(ad->control_uri);
+               scheme = strtok(tmp,":");
+       }
+
+       if(ad->control_uri){
+               snprintf(op_scheme,sizeof(op_scheme),"%s:%s",ad->control_op,scheme);
+               appsvc_set_uri(kb, ad->control_uri);
+       }
+
+       if(ad->control_mime){
+               snprintf(op_mime,sizeof(op_scheme),"%s:%s",ad->control_op,ad->control_mime);
+               appsvc_set_mime(kb, ad->control_mime);
+       }
+
+       if( appsvc_get_list(kb, __iterate, ad) != 0 ){
+               load_info_popup(ad, _("Cannot find associated application"));
+               bundle_free(kb);
+               return -1;
+       }
+
+       bundle_free(kb);
+
+       return 0;
+}
+
+static Eina_Bool __gl_state_get(const void *data, Evas_Object * obj,
+                              const char *part)
+{
+       return EINA_FALSE;
+}
+
+static void __gl_del(const void *data, Evas_Object * obj)
+{
+       return;
+}
+
+static void __gl_sel(void *data, Evas_Object * obj, void *event_info)
+{
+       Elm_Object_Item *item = (Elm_Object_Item *) event_info;
+
+       static int flag = 0;
+
+       if (flag == 1)
+               return;
+
+       flag = 1;
+
+       if (item != NULL) {
+               struct _select_app_info *info =
+                   (struct _select_app_info *)elm_object_item_data_get(item);
+
+               __launch_set_default_app_popup(info);
+
+       }
+}
+
+Evas_Object *_add_layout(Evas_Object *parent, const char *file,
+                             const char *group)
+{
+       Evas_Object *eo = NULL;
+       int r;
+
+       eo = elm_layout_add(parent);
+       if (eo == NULL) {
+               printf("[Error] Cannot add layout\n");
+               return NULL;
+       }
+
+       r = elm_layout_file_set(eo, file, group);
+       if (!r) {
+               printf("[Error] Cannot set file layout\n");
+               evas_object_del(eo);
+               return NULL;
+       }
+
+       evas_object_size_hint_weight_set(eo, EVAS_HINT_EXPAND,
+                                        EVAS_HINT_EXPAND);
+
+       return eo;
+}
+
+static Evas_Object *__gl_content_get(const void *data, Evas_Object * obj,
+                                const char *part)
+{
+       struct _select_app_info *info = (struct _select_app_info *)data;
+       char buf[PATH_LEN] = { 0, };
+
+       Evas_Object *icon;
+       Evas_Object *rt, *icon_ly = NULL;
+       double scale = elm_config_scale_get();
+
+       if (!strcmp(part, "elm.icon")) {
+               snprintf(buf, (size_t) PATH_LEN, "%s", info->app_icon_path);
+               if (!ecore_file_exists(buf))
+                       snprintf((char *)buf, PATH_LEN,
+                                (const char *)ICON_PATH
+                                "/icon_app-selector.png");
+
+               
+               if (!strncmp(&buf[strlen(buf) - 3], "edj", 3)) {
+                       icon_ly = _add_layout(obj, buf, "icon");
+                       icon = _add_layout(obj, EDJ_NAME, "icon");
+                       rt = evas_object_rectangle_add(evas_object_evas_get(obj));
+                       
+                       evas_object_color_set(rt, 0, 0, 0, 0);
+                       evas_object_size_hint_min_set(rt, (int)(50.0 * scale),
+                                                     (int)(50.0 * scale));
+                       evas_object_size_hint_max_set(rt, (int)(50.0 * scale),
+                                             (int)(50.0 * scale));
+                       elm_object_part_content_set(icon, "icon_ly", rt);
+                       
+                       elm_object_part_content_set(icon, "icon", icon_ly);
+               
+               } else {
+                       icon = elm_icon_add(obj);
+                       elm_icon_file_set(icon, buf, NULL);
+                       evas_object_size_hint_aspect_set(icon,
+                                                EVAS_ASPECT_CONTROL_VERTICAL,
+                                                1, 1);
+               }               
+               
+               return icon;
+       }
+       return NULL;
+}
+
+static char *__gl_text_get(const void *data, Evas_Object * obj,
+                          const char *part)
+{
+       struct _select_app_info *info = (struct _select_app_info *)data;
+       char buf[NAME_LEN] = { 0, };
+
+       if (!strcmp(part, "elm.text")) {
+               snprintf(buf, NAME_LEN, "%s", info->app_name);
+               return strdup(buf);
+       }
+       return NULL;
+}
+
+static void __app_genlist_item_append(struct appdata *ad)
+{
+       Eina_List *l;
+       struct _select_app_info *info;
+       Elm_Genlist_Item_Class *itc;
+
+       if (!ad)
+               return;
+
+       itc = elm_genlist_item_class_new();
+
+       itc->item_style = "1text.1icon.2";
+       itc->func.text_get = __gl_text_get;
+       itc->func.content_get = __gl_content_get;
+       itc->func.state_get = __gl_state_get;
+       itc->func.del = __gl_del;
+
+       EINA_LIST_FOREACH(ad->app_list, l, info) {
+
+               info->it =
+                   elm_genlist_item_append(ad->app_genlist, itc, (void *)info,
+                                           NULL, ELM_GENLIST_ITEM_NONE,
+                                           __gl_sel, ad);
+
+       }
+
+       elm_genlist_item_class_free(itc);
+}
+
+static Evas_Object *__app_genlist_add(struct appdata *ad)
+{
+       Evas_Object *genlist;
+       if (!ad)
+               return NULL;
+
+       if (ad->app_genlist)
+               return NULL;
+
+       genlist = elm_genlist_add(ad->popup);
+
+       evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND,
+                                        EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL,
+                                       EVAS_HINT_FILL);
+
+       return genlist;
+}
+
+void load_app_list(struct appdata *ad)
+{
+       Evas_Object *popup;
+       Evas_Object *btn1;
+
+       popup = elm_popup_add(ad->win);
+       elm_object_style_set(popup, "menustyle");
+       ad->popup = popup;
+
+       evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND,
+                                        EVAS_HINT_EXPAND);
+       elm_object_part_text_set(popup, "title,text", _("Select application"));
+
+       btn1 = elm_button_add(popup);
+       elm_object_text_set(btn1, _("Cancel"));
+       elm_object_part_content_set(popup, "button1", btn1);
+
+       ad->app_genlist = __app_genlist_add(ad);
+       if (!ad->app_genlist)
+               return;
+
+       __app_genlist_item_append(ad);
+
+       elm_object_content_set(popup, ad->app_genlist);
+       evas_object_smart_callback_add(btn1, "clicked", __response_cb, NULL);
+
+       evas_object_show(popup);
+}
+
+void update_app_list(struct appdata *ad)
+{
+       __clear_app_list(ad);
+       if (__app_list_get_with_mimetype(ad) == -1)
+               return;
+
+       __app_genlist_item_append(ad);
+}
+
+void load_app_select_popup(struct appdata *ad)
+{
+       int ret = -1;
+       
+       if(ad->mime_type)
+               ret = __app_list_get_with_mimetype(ad); 
+       else if(ad->control_op)
+               ret = __app_list_get_with_control(ad);
+       
+       if (ret == -1)
+               {
+               printf("fail fail fail\n");
+               return;
+               }
+       else
+               load_app_list(ad);
+
+}
diff --git a/app-selector-view.h b/app-selector-view.h
new file mode 100755 (executable)
index 0000000..7854a8d
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the app-selector
+ * Written by Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+
+
+
+#ifndef __DEF_APP_SELECT_VIEW_H_
+#define __DEF_APP_SELECT_VIEW_H_
+
+#include <Elementary.h>
+#include "app-selector.h"
+
+void load_info_popup(struct appdata *ad, char *str);
+void update_app_list(struct appdata *ad);
+void load_app_select_popup(struct appdata *ad);
+#endif                         /* __DEF_APP_SELECT_VIEW_H__ */
diff --git a/app-selector.c b/app-selector.c
new file mode 100755 (executable)
index 0000000..f30ab4d
--- /dev/null
@@ -0,0 +1,455 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the app-selector
+ * Written by Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+
+
+
+#include <stdio.h>
+#include <appcore-efl.h>
+#include <Ecore_X.h>
+#include <utilX.h>
+#include <aul.h>
+#include <appsvc.h>
+#include <X11/Xatom.h>
+#include <X11/Xutil.h>
+#include <Ecore.h>
+#include <Ecore_Input.h>
+
+#include "app-selector.h"
+#include "app-selector-view.h"
+#include "app-selector-util.h"
+
+int is_reset = 0;
+
+
+static void __win_del(void *data, Evas_Object * obj, void *event);
+static Evas_Object *__create_win(const char *name);
+static Evas_Object *__create_layout_main(Evas_Object * parent);
+static int __app_create(void *data);
+static int __app_init_with_bundle(void *data);
+static int __app_terminate(void *data);
+static int __app_pause(void *data);
+static int __app_resume(void *data);
+static int __app_reset(bundle *b, void *data);
+
+
+static void __win_del(void *data, Evas_Object * obj, void *event)
+{
+       elm_exit();
+}
+
+static Evas_Object *__create_win(const char *name)
+{
+       Evas_Object *eo;
+       int w;
+       int h;
+
+       eo = elm_win_add(NULL, name, ELM_WIN_DIALOG_BASIC);
+       if (eo) {
+               elm_win_title_set(eo, name);
+               elm_win_borderless_set(eo, EINA_TRUE);
+
+               elm_win_alpha_set(eo, EINA_TRUE);
+
+               evas_object_smart_callback_add(eo, "delete,request",
+                                              __win_del, NULL);
+               ecore_x_window_size_get(ecore_x_window_root_first_get(),
+                                       &w, &h);
+               evas_object_resize(eo, w, h);
+       }
+
+       return eo;
+}
+
+static Evas_Object *__create_layout_main(Evas_Object * parent)
+{
+       Evas_Object *layout;
+
+       if (!parent)
+               return NULL;
+
+       layout = elm_layout_add(parent);
+       if (!layout)
+               return NULL;
+
+       elm_layout_theme_set(layout, "standard", "window", "integration");
+       evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND,
+                                        EVAS_HINT_EXPAND);
+
+       edje_object_signal_emit(_EDJ(layout), "elm,state,show,indicator",
+                               "elm");
+       edje_object_signal_emit(_EDJ(layout), "elm,state,show,content", "elm");
+
+       evas_object_show(layout);
+
+       return layout;
+}
+
+static int __get_window_property(Display *dpy, Window win, Atom atom,
+                                         Atom type, unsigned int *val,
+                                         unsigned int len)
+{
+       unsigned char *prop_ret;
+       Atom type_ret;
+       unsigned long bytes_after;
+       unsigned long  num_ret;
+       int format_ret;
+       unsigned int i;
+       int num;
+
+       prop_ret = NULL;
+       if (XGetWindowProperty(dpy, win, atom, 0, 0x7fffffff, False,
+                              type, &type_ret, &format_ret, &num_ret,
+                              &bytes_after, &prop_ret) != Success)
+               return -1;
+
+       if (type_ret != type || format_ret != 32)
+               num = -1;
+       else if (num_ret == 0 || !prop_ret)
+               num = 0;
+       else {
+               if (num_ret < len)
+                       len = num_ret;
+               for (i = 0; i < len; i++) {
+                       val[i] = ((unsigned long *)prop_ret)[i];
+               }
+               num = len;
+       }
+
+       if (prop_ret)
+               XFree(prop_ret);
+
+       return num;
+}
+
+
+static int __x_rotation_get(Display *dpy, Window win)
+{
+       Window active_win;
+       Window root_win;
+       int rotation = -1;
+       int ret;
+
+       int angles[2];
+
+       Atom atom_active_win;
+       Atom atom_win_rotate_angle;
+
+       root_win = XDefaultRootWindow(dpy);
+
+       atom_active_win = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
+       ret = __get_window_property(dpy, root_win, atom_active_win,
+                                            XA_WINDOW,
+                                            (unsigned int *)&active_win, 1);
+
+       /*printf("[SYSPOPUP] Active win : %x, Window %x\n", active_win, win);*/
+
+       /*active_win = get_active_win(dpy, root_win, atom_active_win);*/
+       if (ret < 0)
+               return ret;
+
+       atom_win_rotate_angle =
+               XInternAtom(dpy, "_E_ILLUME_ROTATE_WINDOW_ANGLE", False);
+       ret = __get_window_property(dpy, active_win,
+                                         atom_win_rotate_angle, XA_CARDINAL,
+                                         (unsigned int *)&rotation, 1);
+
+       /*printf("[SYSPOPUP] Rotation %d\n", rotation);*/
+
+       if (ret != -1)
+               return rotation;
+
+       return -1;
+}
+
+static int __as_rotate(Display *dpy, Window xwin, Evas_Object *win, void *data)
+{
+       int rotation;   
+       struct appdata *ad = data;
+
+       ecore_x_icccm_hints_set(xwin, 0, 0, 0, 0, 0, 0, 0);
+
+       rotation = __x_rotation_get(dpy, xwin);
+
+       if (rotation == -1) {
+               rotation = 0;
+       }
+
+       if (rotation >= 0 && ad->rotate != NULL)
+               elm_win_rotation_with_resize_set(win, rotation);
+
+       return 0;
+}
+
+static Eina_Bool __rotate(void *data, int type, void *event)
+{
+       struct appdata *ad = data;
+
+       Ecore_X_Event_Client_Message *ev = event;
+
+       if (!event)
+               return ECORE_CALLBACK_RENEW;
+
+       if (ev->message_type == ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE)
+               __as_rotate(ad->dpy, ad->xwin, ad->win, ad);    
+
+       return 0;
+}
+
+static Eina_Bool s_key_registered;
+
+static
+Eina_Bool __key_press_cb(void *data, int type, void *event)
+{
+        Evas_Event_Key_Down *ev = event;
+        struct appdata *ad = (struct appdata *)data;
+
+        if (!s_key_registered) {
+                _E("Key is not registered");
+                return ECORE_CALLBACK_RENEW;
+        }
+
+        if (!ev) {
+                _E("Invalid event object");
+                return ECORE_CALLBACK_RENEW;
+        }
+       
+               ecore_event_handler_del(ad->rotate);
+               ad->rotate = NULL;
+               elm_exit();
+
+        return ECORE_CALLBACK_RENEW;
+}
+
+static void __register_key_handler(void *data)
+{
+        Ecore_X_Window win;
+        struct appdata *ad = (struct appdata *)data;
+        win = elm_win_xwindow_get(ad->win);
+
+        ad->key_up = ecore_event_handler_add(ECORE_EVENT_KEY_UP, 
+                                                                                        __key_press_cb, ad);
+        if (!ad->key_up) {
+                _E("Failed to register a key down event handler");
+        }
+
+        _D("Key handler is registered");
+        s_key_registered = EINA_TRUE;
+}
+
+static void __unregister_key_handler(void *data)
+{
+        Ecore_X_Window win;
+        struct appdata *ad = (struct appdata *)data;
+
+        if (ad->key_up) {
+                ecore_event_handler_del(ad->key_up);
+                ad->key_up = NULL;
+                               ad->rotate = NULL;
+        }
+
+        _D("Unregister key handler is invoked");
+        s_key_registered = EINA_FALSE;
+}
+
+static void __grab_home_key(void *data)
+{
+        Ecore_X_Window win;
+        struct appdata *ad = (struct appdata *)data;
+
+        win = elm_win_xwindow_get(ad->win);
+        utilx_grab_key(ecore_x_display_get(), win, KEY_HOME, SHARED_GRAB);
+
+        _D("Grab home key.");
+
+               __register_key_handler(ad);
+}
+
+static void __ungrab_home_key(void *data)
+{
+        Ecore_X_Window win;
+        struct appdata *ad = (struct appdata *)data;
+
+               __unregister_key_handler(ad);
+
+        win = elm_win_xwindow_get(ad->win);
+        utilx_ungrab_key(ecore_x_display_get(), win, KEY_HOME);
+
+        _D("Ungrab home key.");
+}
+
+
+
+static int __app_create(void *data)
+{
+       struct appdata *ad = (struct appdata *)data;
+       Evas_Object *win;
+       Evas_Object *ly;
+       int r;
+       Display *dpy;
+       Ecore_X_Window xwin;
+       
+
+       /* create window */
+       win = __create_win(PACKAGE);
+       if (win == NULL)
+               return -1;
+       ad->win = win;
+
+       /* Base Layout */
+       ly = __create_layout_main(ad->win);
+       if (!ly)
+               return -1;
+
+       edje_object_signal_emit(_EDJ(ly), "elm,bg,show,transparent", "elm");
+       ad->ly_main = ly;
+
+       elm_win_resize_object_add(win, ly);
+
+       ad->dpy = ecore_x_display_get();
+       ad->xwin = elm_win_xwindow_get(win);
+
+       ad->rotate = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE,
+                                                        __rotate, (void *)ad); 
+
+       __as_rotate(ad->dpy, ad->xwin, win, ad);
+
+//     evas_object_show(ly);
+       evas_object_show(win);
+
+       /* init internationalization */
+       r = appcore_set_i18n(PACKAGE, LOCALEDIR);
+       if (r)
+               return -1;      
+
+       __grab_home_key(ad);
+
+       return 0;
+}
+
+static int __app_init_with_bundle(void *data)
+{
+       struct appdata *ad = data;
+
+/*     Ecore_X_Display *display = ecore_x_display_get();
+       Ecore_X_Window xwin = elm_win_xwindow_get(ad->win);
+       Ecore_X_Window prev_win =
+           tm_get_user_created_win_with_pid(ad->parent_pid);
+
+       set_transient(display, xwin, prev_win);
+*/
+       load_app_select_popup(ad);
+
+       return 0;
+}
+
+static int __app_terminate(void *data)
+{
+       struct appdata *ad = data;
+
+       if (ad->popup)
+               evas_object_del(ad->popup);
+
+       if (ad->win)
+               evas_object_del(ad->win);
+
+       __ungrab_home_key(ad);
+
+       return 0;
+}
+
+static int __app_pause(void *data)
+{
+       struct appdata *ad = data;
+       ecore_event_handler_del(ad->rotate);
+       ad->rotate = NULL;
+       
+       sleep(1);
+       elm_exit();
+
+       return 0;
+}
+
+static int __app_resume(void *data)
+{
+       /*struct appdata *ad = data; */
+
+       return 0;
+}
+
+static int __app_reset(bundle *b, void *data)
+{
+       struct appdata *ad = data;
+       char *str = NULL;
+
+       if (ad->kb)
+               bundle_free(ad->kb);
+
+       ad->kb = bundle_dup(b);
+
+       ad->mime_type = bundle_get_val(ad->kb, AUL_K_MIME_TYPE);
+       str = bundle_get_val(ad->kb, AUL_K_CALLER_PID);
+
+       ad->control_op = appsvc_get_operation(ad->kb);
+       ad->control_uri = appsvc_get_uri(ad->kb);
+       ad->control_mime = appsvc_get_mime(ad->kb);
+
+       if (str)
+               ad->parent_pid = atoi(str);
+       else
+               ad->parent_pid = -1;
+
+       if (!ad->mime_type && !ad->control_op) {
+               load_info_popup(ad, _("Cannot get mimetype!"));
+               return 0;
+       }
+
+/*      ad->mime_type = "text"; */
+/*      ad->parent_pid = 0000; */
+
+       /*
+          If AUL_K_ARGV0 is not NULL, the situation is launching(fork & exec).
+          else the situation is being received a reset event(old relaunch evet)
+        */
+       if (is_reset == 0) {
+               __app_init_with_bundle(data);   /*(fork & exec) */
+               is_reset = 1;
+       } else
+               update_app_list(data);  /*(reset event) */
+
+       return 0;
+}
+
+int main(int argc, char *argv[])
+{
+       struct appdata ad;
+       struct appcore_ops ops = {
+               .create = __app_create,
+               .terminate = __app_terminate,
+               .pause = __app_pause,
+               .resume = __app_resume,
+               .reset = __app_reset,
+       };
+
+       memset(&ad, 0x0, sizeof(struct appdata));
+       ops.data = &ad;
+
+       return appcore_efl_main(PACKAGE, &argc, &argv, &ops);
+}
diff --git a/app-selector.edc b/app-selector.edc
new file mode 100644 (file)
index 0000000..a576116
--- /dev/null
@@ -0,0 +1,40 @@
+
+collections {
+       group {
+               name: "icon";
+               parts {
+                       part {
+                               name: "bg";
+                               type: RECT;
+                               scale: 1;
+                               mouse_events: 0;
+                               description {
+                                       state: "default" 0.0;
+                                       color: 0 0 0 0;
+                               }
+                       }
+
+                       part {
+                               name: "icon_ly";
+                               type: SWALLOW;
+                               scale: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0.0 0.0; to: "bg"; }
+                                       rel2 { relative: 1.0 1.0; to: "bg"; }
+                               }
+                       }
+                       part {
+                               name: "icon";
+                               type: SWALLOW;
+                               scale: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       rel1 { to: "icon_ly"; }
+                                       rel2 { to: "icon_ly"; }
+                               }
+                       }
+               }
+       }
+
+}
diff --git a/app-selector.h b/app-selector.h
new file mode 100755 (executable)
index 0000000..59619d0
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the app-selector
+ * Written by Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+
+
+
+#ifndef __APP_COMMON_H__
+#define __APP_COMMON_H__
+
+#include <Elementary.h>
+#include <bundle.h>
+#include <dlog.h>
+#include <X11/Xatom.h>
+#include <X11/Xutil.h>
+
+
+#undef LOG_TAG
+#define LOG_TAG "app-selector"
+
+#define _E(fmt, arg...) LOGE("[%s,%d] "fmt,__FUNCTION__,__LINE__,##arg)
+#define _D(fmt, arg...) LOGD("[%s,%d] "fmt,__FUNCTION__,__LINE__,##arg)
+
+
+#if !defined(PACKAGE)
+#  define PACKAGE "app-selector"
+#endif
+
+#if !defined(LOCALEDIR)
+#  define LOCALEDIR "/usr/share/locale"
+#endif
+
+#define ICON_PATH PREFIX"/share/icon"
+
+#define NAME_BUF_LEN (128)
+#define _EDJ(x)        elm_layout_edje_get(x)
+
+#define _(msgid) gettext(msgid)
+#define N_(msgid) gettext_noop(msgid)
+
+struct appdata {
+       Evas_Object *win;
+       Evas_Object *ly_main;
+
+       Ecore_Event_Handler *key_up;
+       Ecore_Event_Handler *rotate;
+
+       Evas_Object *popup;
+       Evas_Object *def_set_popup;
+
+       Eina_List *app_list;
+       Evas_Object *app_genlist;
+
+       Display *dpy;
+       Ecore_X_Window xwin;
+
+       bundle *kb;
+       int parent_pid;
+
+       char *mime_type;
+
+       char *control_op;
+       char *control_mime;
+       char *control_uri;
+
+        /* add more variables here */
+};
+
+struct _select_app_info {
+       char *pkg_name;
+       char *app_name;
+       char *app_path;
+       char *app_icon_path;
+       struct appdata *ad;
+       Elm_Object_Item *it;
+};
+
+#endif                         /* __APP_COMMON_H__ */
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..ce8c4bd
--- /dev/null
@@ -0,0 +1,7 @@
+app-selector (0.1.0-68) unstable; urgency=low
+
+  * Initial release
+  * Git: pkgs/a/app-selector
+  * Tag: app-selector_0.1.0-68
+
+ -- Sewook Park <sewook7.park@samsung.com>  Thu, 15 Mar 2012 16:56:58 +0900
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100755 (executable)
index 0000000..f053b86
--- /dev/null
@@ -0,0 +1,17 @@
+Source: app-selector
+Section: devel
+Priority: extra
+Maintainer: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>, Noha Park <noha.park@samsung.com>
+Build-Depends: debhelper (>= 5), libappcore-efl-dev, libaul-1-dev, libslp-utilx-dev, libail-0-dev, libappsvc-dev, libx11-dev 
+Standards-Version: 3.7.2
+
+Package: org.tizen.app-selector
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: app-selector
+
+Package: org.tizen.app-selector-dbg
+Architecture: any
+Depends: org.tizen.app-selector (= ${Source-Version}), ${misc:Depends}
+Description: App selector Debug Symbols
+ Debug symbols for app-selector
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/debian/dirs b/debian/dirs
new file mode 100644 (file)
index 0000000..ca882bb
--- /dev/null
@@ -0,0 +1,2 @@
+usr/bin
+usr/sbin
diff --git a/debian/docs b/debian/docs
new file mode 100644 (file)
index 0000000..a0f0008
--- /dev/null
@@ -0,0 +1 @@
+CMakeLists.txt
diff --git a/debian/org.tizen.app-selector.install.in b/debian/org.tizen.app-selector.install.in
new file mode 100644 (file)
index 0000000..84430c2
--- /dev/null
@@ -0,0 +1,5 @@
+@PREFIX@/bin/*
+@DATADIR@/locale/*
+@DATADIR@/icons/*
+@DATADIR@/edje/app-selector/*
+/opt/share/applications/*
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..4f46e8a
--- /dev/null
@@ -0,0 +1,115 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+CFLAGS ?= -Wall -g
+LDFLAGS ?=
+PREFIX ?= /usr
+DATADIR ?= /usr/share
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+       CFLAGS += -O0
+else
+       CFLAGS += -O2
+endif
+
+CFLAGS += -fPIC
+CXXFLAGS += -fPIC
+
+LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--hash-style=both -Wl,--as-needed
+
+CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp
+
+configure: configure-stamp
+configure-stamp:
+       dh_testdir
+       # Add here commands to configure the package.
+       mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && \
+       CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" cmake .. -DCMAKE_INSTALL_PREFIX="$(PREFIX)"
+
+       touch configure-stamp
+
+build: build-stamp
+
+build-stamp: configure-stamp 
+       dh_testdir
+
+       # Add here commands to compile the package.
+       cd $(CMAKE_BUILD_DIR) && $(MAKE)
+
+       for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
+               cat $$f > $${f%.in}; \
+               sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \
+               sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \
+       done
+
+       touch $@
+
+clean:
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp configure-stamp
+
+       # Add here commands to clean up after the build process.
+       rm -rf $(CMAKE_BUILD_DIR)
+
+       for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
+               rm -f $${f%.in}; \
+       done
+
+       dh_clean 
+
+install: build
+       dh_testdir
+       dh_testroot
+       dh_clean -k 
+       dh_installdirs
+
+       # Add here commands to install the package into debian/wavplayer.
+       cd $(CMAKE_BUILD_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+       dh_testdir
+       dh_testroot
+       dh_installchangelogs 
+       dh_installdocs
+       dh_installexamples
+       dh_install --sourcedir=debian/tmp
+#      dh_installmenu
+#      dh_installdebconf       
+#      dh_installlogrotate
+#      dh_installemacsen
+#      dh_installpam
+#      dh_installmime
+#      dh_python
+#      dh_installinit
+#      dh_installcron
+#      dh_installinfo
+       dh_installman
+       dh_link
+       dh_strip --dbg-package=org.tizen.app-selector-dbg
+       dh_compress
+       dh_fixperms
+#      dh_perl
+       dh_makeshlibs
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
diff --git a/org.tizen.app-selector.desktop.in b/org.tizen.app-selector.desktop.in
new file mode 100644 (file)
index 0000000..76f8633
--- /dev/null
@@ -0,0 +1,8 @@
+Name=@PROJECT_NAME@
+Exec=@BINDIR@/@PROJECT_NAME@
+Icon=@PKGNAME@.png
+Type=Application
+NoDisplay=true
+X-Tizen-TaskManage=false
+X-Tizen-Removable=false
+Version=0.1.0-0
diff --git a/org.tizen.app-selector.png b/org.tizen.app-selector.png
new file mode 100644 (file)
index 0000000..bffa6bb
Binary files /dev/null and b/org.tizen.app-selector.png differ
diff --git a/packaging/org.tizen.app-selector.spec b/packaging/org.tizen.app-selector.spec
new file mode 100644 (file)
index 0000000..0341144
--- /dev/null
@@ -0,0 +1,52 @@
+#sbs-git:slp/pkgs/a/app-selector app-selector 0.1.0 766945c4ea0c9e0c20393c2ea47bed1a26130e95
+Name:       org.tizen.app-selector
+Summary:    Application selector
+Version:    0.1.0
+Release:    69
+Group:      TO_BE/FILLED_IN
+License:    Apache License, Version 2.0
+Source0:    %{name}-%{version}.tar.gz
+BuildRequires:  cmake
+BuildRequires:  gettext-tools
+BuildRequires:  edje-tools
+BuildRequires:  pkgconfig(appcore-efl)
+BuildRequires:  pkgconfig(aul)
+BuildRequires:  pkgconfig(utilX)
+BuildRequires:  pkgconfig(ecore-x)
+BuildRequires:  pkgconfig(eina)
+BuildRequires:  pkgconfig(evas)
+BuildRequires:  pkgconfig(ecore)
+BuildRequires:  pkgconfig(ecore-file)
+BuildRequires:  pkgconfig(edje)
+BuildRequires:  pkgconfig(ail)
+BuildRequires:  pkgconfig(appsvc)
+BuildRequires:  pkgconfig(xcomposite)
+BuildRequires:  pkgconfig(xext)
+
+
+%description
+SLP application selector
+%prep
+%setup -q
+
+
+%build
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
+make %{?jobs:-j%jobs}
+
+
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+%files
+/usr/bin/app-selector
+/usr/share/edje/app-selector/app-selector.edj
+/opt/share/applications/org.tizen.app-selector.desktop
+/usr/share/icons/default/small/org.tizen.app-selector.png
+/usr/share/locale/*/LC_MESSAGES/*.mo
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
new file mode 100644 (file)
index 0000000..0500c3f
--- /dev/null
@@ -0,0 +1,24 @@
+# for i18n
+
+SET(POFILES en_US.po en_GB.po ja.po ko.po zh_CN.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 share/locale/${lang}/LC_MESSAGES RENAME ${PROJECT_NAME}.mo)
+       SET(moFiles ${moFiles} ${moFile})
+ENDFOREACH(pofile)
+
+MESSAGE(".mo files: ${moFiles}")
+ADD_CUSTOM_TARGET(po ALL DEPENDS ${moFiles})
diff --git a/po/POTFILES.in b/po/POTFILES.in
new file mode 100644 (file)
index 0000000..6d3187a
--- /dev/null
@@ -0,0 +1,4 @@
+# List of source files containing translatable strings.
+app-selector.c
+app-selector-view.c
+app-selector-util.c
diff --git a/po/app-selector.pot b/po/app-selector.pot
new file mode 100644 (file)
index 0000000..1625f99
--- /dev/null
@@ -0,0 +1,45 @@
+# 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: 2010-09-30 19:47+0900\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"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: app-selector.c:197
+msgid "Cannot get mimetype!"
+msgstr ""
+
+#: app-selector-view.c:80
+msgid "Set this application as default?"
+msgstr ""
+
+#: app-selector-view.c:81
+msgid "Default app setting"
+msgstr ""
+
+#: app-selector-view.c:82
+msgid "IDS_COM_SK_OK"
+msgstr ""
+
+#: app-selector-view.c:82 app-selector-view.c:270
+msgid "Cancel"
+msgstr ""
+
+#: app-selector-view.c:141
+msgid "Cannot find default application"
+msgstr ""
+
+#: app-selector-view.c:269
+msgid "Select application"
+msgstr ""
diff --git a/po/en_GB.po b/po/en_GB.po
new file mode 100644 (file)
index 0000000..01d091f
--- /dev/null
@@ -0,0 +1,45 @@
+# 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: 2010-09-30 19:47+0900\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"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: app-selector.c:197
+msgid "Cannot get mimetype!"
+msgstr ""
+
+#: app-selector-view.c:80
+msgid "Set this application as default?"
+msgstr ""
+
+#: app-selector-view.c:81
+msgid "Default app setting"
+msgstr ""
+
+#: app-selector-view.c:82
+msgid "IDS_COM_SK_OK"
+msgstr ""
+
+#: app-selector-view.c:82 app-selector-view.c:270
+msgid "Cancel"
+msgstr ""
+
+#: app-selector-view.c:141
+msgid "Cannot find default application"
+msgstr ""
+
+#: app-selector-view.c:269
+msgid "Select application"
+msgstr ""
diff --git a/po/en_US.po b/po/en_US.po
new file mode 100644 (file)
index 0000000..01d091f
--- /dev/null
@@ -0,0 +1,45 @@
+# 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: 2010-09-30 19:47+0900\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"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: app-selector.c:197
+msgid "Cannot get mimetype!"
+msgstr ""
+
+#: app-selector-view.c:80
+msgid "Set this application as default?"
+msgstr ""
+
+#: app-selector-view.c:81
+msgid "Default app setting"
+msgstr ""
+
+#: app-selector-view.c:82
+msgid "IDS_COM_SK_OK"
+msgstr ""
+
+#: app-selector-view.c:82 app-selector-view.c:270
+msgid "Cancel"
+msgstr ""
+
+#: app-selector-view.c:141
+msgid "Cannot find default application"
+msgstr ""
+
+#: app-selector-view.c:269
+msgid "Select application"
+msgstr ""
diff --git a/po/ja.po b/po/ja.po
new file mode 100644 (file)
index 0000000..01d091f
--- /dev/null
+++ b/po/ja.po
@@ -0,0 +1,45 @@
+# 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: 2010-09-30 19:47+0900\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"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: app-selector.c:197
+msgid "Cannot get mimetype!"
+msgstr ""
+
+#: app-selector-view.c:80
+msgid "Set this application as default?"
+msgstr ""
+
+#: app-selector-view.c:81
+msgid "Default app setting"
+msgstr ""
+
+#: app-selector-view.c:82
+msgid "IDS_COM_SK_OK"
+msgstr ""
+
+#: app-selector-view.c:82 app-selector-view.c:270
+msgid "Cancel"
+msgstr ""
+
+#: app-selector-view.c:141
+msgid "Cannot find default application"
+msgstr ""
+
+#: app-selector-view.c:269
+msgid "Select application"
+msgstr ""
diff --git a/po/ko.po b/po/ko.po
new file mode 100644 (file)
index 0000000..01d091f
--- /dev/null
+++ b/po/ko.po
@@ -0,0 +1,45 @@
+# 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: 2010-09-30 19:47+0900\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"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: app-selector.c:197
+msgid "Cannot get mimetype!"
+msgstr ""
+
+#: app-selector-view.c:80
+msgid "Set this application as default?"
+msgstr ""
+
+#: app-selector-view.c:81
+msgid "Default app setting"
+msgstr ""
+
+#: app-selector-view.c:82
+msgid "IDS_COM_SK_OK"
+msgstr ""
+
+#: app-selector-view.c:82 app-selector-view.c:270
+msgid "Cancel"
+msgstr ""
+
+#: app-selector-view.c:141
+msgid "Cannot find default application"
+msgstr ""
+
+#: app-selector-view.c:269
+msgid "Select application"
+msgstr ""
diff --git a/po/update-po.sh b/po/update-po.sh
new file mode 100755 (executable)
index 0000000..02c168a
--- /dev/null
@@ -0,0 +1,60 @@
+#!/bin/sh
+
+PACKAGE=app-selector
+SRCROOT=..
+POTFILES=POTFILES.in
+
+#ALL_LINGUAS= am az be ca cs da de el en_CA en_GB es et fi fr hr hu it ja ko lv mk ml ms nb ne nl pa pl pt pt_BR ru rw sk sl sr sr@Latn sv ta tr uk vi zh_CN zh_TW
+ALL_LINGUAS="en_US en_GB ja ko zh_CN"
+
+XGETTEXT=/usr/bin/xgettext
+MSGMERGE=/usr/bin/msgmerge
+
+echo -n "Make ${PACKAGE}.pot  "
+if [ ! -e $POTFILES ] ; then
+       echo "$POTFILES not found"
+       exit 1
+fi
+
+$XGETTEXT --default-domain=${PACKAGE} --directory=${SRCROOT} \
+               --add-comments --keyword=_ --keyword=N_ --files-from=$POTFILES
+if [ $? -ne 0 ]; then
+       echo "xgettext error"
+       exit 1
+fi
+
+if [ ! -f ${PACKAGE}.po ]; then
+       echo "No such file: ${PACKAGE}.po"
+       exit 1
+fi
+
+rm -f ${PACKAGE}.pot && mv ${PACKAGE}.po ${PACKAGE}.pot
+echo "done"
+
+for LANG in $ALL_LINGUAS; do 
+       echo "$LANG : "
+
+       if [ ! -e $LANG.po ] ; then
+               sed 's/CHARSET/UTF-8/g' ${PACKAGE}.pot > ${LANG}.po
+               echo "${LANG}.po created"
+       else
+               if $MSGMERGE ${LANG}.po ${PACKAGE}.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
+
diff --git a/po/zh_CN.po b/po/zh_CN.po
new file mode 100644 (file)
index 0000000..01d091f
--- /dev/null
@@ -0,0 +1,45 @@
+# 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: 2010-09-30 19:47+0900\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"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: app-selector.c:197
+msgid "Cannot get mimetype!"
+msgstr ""
+
+#: app-selector-view.c:80
+msgid "Set this application as default?"
+msgstr ""
+
+#: app-selector-view.c:81
+msgid "Default app setting"
+msgstr ""
+
+#: app-selector-view.c:82
+msgid "IDS_COM_SK_OK"
+msgstr ""
+
+#: app-selector-view.c:82 app-selector-view.c:270
+msgid "Cancel"
+msgstr ""
+
+#: app-selector-view.c:141
+msgid "Cannot find default application"
+msgstr ""
+
+#: app-selector-view.c:269
+msgid "Select application"
+msgstr ""