destroy service view only when home button is clicked
authorJiansong Jin <jiansong.jin@samsung.com>
Tue, 4 Sep 2012 06:37:31 +0000 (15:37 +0900)
committerJiansong Jin <jiansong.jin@samsung.com>
Tue, 4 Sep 2012 06:37:31 +0000 (15:37 +0900)
Change-Id: I008632b55bd874aeeee523bb2f05f4ba2ad69ab2

CMakeLists.txt
include/gallery.h
packaging/org.tizen.gallery.spec
src/gallery.c

index 76c26e7..81dfb81 100755 (executable)
@@ -81,6 +81,7 @@ pkg_check_modules(pkgs REQUIRED
        capi-appfw-application
        capi-appfw-app-manager
        capi-system-haptic
+       utilX
 )
 
 FOREACH(flag ${pkgs_CFLAGS})
index 36ea6e1..24c59f6 100755 (executable)
@@ -436,6 +436,8 @@ typedef struct
        int rotate_mode;        /* Type: appcore_rm; Indicate rotation mode of whole application */
        int view_mode;          /* Type: gl_view_mode; Indicate view mode of whole application */
        bool reentrant;
+       /* Mouse down event handle */
+       Ecore_Event_Handler *keydown_handler;
        int all_medias_cnt;
        time_t last_mtime;
        Eina_List *medias_elist;/* List of all medias of a album */
index 8fce5c4..0680c61 100755 (executable)
@@ -4,7 +4,7 @@
 
 Name:       org.tizen.gallery
 Summary:    org.tizen.gallery UX
-Version:    1.1.31
+Version:    1.1.32
 Release:    1
 Group:      Applications
 License:    Flora Software License
@@ -31,6 +31,7 @@ BuildRequires:  pkgconfig(gthread-2.0)
 BuildRequires:  pkgconfig(capi-appfw-application)
 BuildRequires:  pkgconfig(capi-appfw-app-manager)
 BuildRequires:  pkgconfig(capi-system-haptic)
+BuildRequires:  pkgconfig(utilX)
 
 %description
 Description: org.tizen.gallery UX
index 103b8c8..91015fe 100755 (executable)
@@ -15,6 +15,7 @@
   */
 
 #include <Evas.h>
+#include <utilX.h> /* Key event */
 #include "gallery.h"
 #include "gl-debug.h"
 #include "gl-albums.h"
@@ -107,6 +108,31 @@ static void _gallery_lang_changed_cb(void *data)
        _gl_lang_update(data);
 }
 
+static Eina_Bool __gallery_key_down_cb(void *data, int type, void *event)
+{
+       if (!data) {
+               gl_dbgE("Invalid parameter!");
+               return ECORE_CALLBACK_PASS_ON;
+       }
+
+       gl_appdata *ad = (gl_appdata *)data;
+       Ecore_Event_Key *key_event = (Ecore_Event_Key *)event;
+
+       if (!strcmp(key_event->keyname, KEY_END)) {
+               gl_dbgW("Bakc(End) key");
+       } else if (!strcmp(key_event->keyname, KEY_SELECT)) {
+               gl_dbgW("Home key");
+               /* For select appsvc, destory ug when HOME key is pressed */
+               gl_ext_destroy_gallery_ug(ad);
+       } else if (!strcmp(key_event->keyname, KEY_POWER)) {
+               gl_dbgW("Power key");
+       }
+
+       gl_dbg("Key down : %s", key_event->keyname);
+
+       return ECORE_CALLBACK_PASS_ON;
+}
+
 static void _gallery_low_battery_cb(void *data)
 {
        gl_dbg("");
@@ -360,6 +386,10 @@ static bool _gallery_create(void *data)
 
        gl_dbg_launch("  register callbacks:start");
        gl_reg_db_update_noti(ad);
+       /* Register key down handler */
+       ad->maininfo.keydown_handler = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,
+                                                              __gallery_key_down_cb,
+                                                              data);
        gl_dbg_launch("  register callbacks:end");
 
        if (ad->albuminfo.create_albums_idler == NULL) {
@@ -429,6 +459,11 @@ static int _gallery_close_app(void *data)
        _gl_list_clear_data(ad);
        /* delete notification. */
        _gl_notify_destroy_notiinfo(ad);
+       /* Remove down event handler */
+       if(ad->maininfo.keydown_handler) {
+               ecore_event_handler_del(ad->maininfo.keydown_handler);
+               ad->maininfo.keydown_handler = NULL;
+       }
 
        /* DB update callback unregister. */
        gl_dereg_db_update_noti();
@@ -463,9 +498,6 @@ static void _gallery_pause(void *data)
        ad->maininfo.reentrant = TRUE;
 
        ug_pause();
-
-       /* For select appsvc, destory ug when HOME key is pressed */
-       gl_ext_destroy_gallery_ug(ad);
 }
 
 /* auto rotate view after resume if disabling/re-enabling rotate device */