From 8ea0b29ec536398d314af99f9f389ba5e1d3a591 Mon Sep 17 00:00:00 2001 From: Jiansong Jin Date: Tue, 4 Sep 2012 15:37:31 +0900 Subject: [PATCH] destroy service view only when home button is clicked Change-Id: I008632b55bd874aeeee523bb2f05f4ba2ad69ab2 --- CMakeLists.txt | 1 + include/gallery.h | 2 ++ packaging/org.tizen.gallery.spec | 3 ++- src/gallery.c | 38 +++++++++++++++++++++++++++++++++++--- 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 76c26e7..81dfb81 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,6 +81,7 @@ pkg_check_modules(pkgs REQUIRED capi-appfw-application capi-appfw-app-manager capi-system-haptic + utilX ) FOREACH(flag ${pkgs_CFLAGS}) diff --git a/include/gallery.h b/include/gallery.h index 36ea6e1..24c59f6 100755 --- a/include/gallery.h +++ b/include/gallery.h @@ -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 */ diff --git a/packaging/org.tizen.gallery.spec b/packaging/org.tizen.gallery.spec index 8fce5c4..0680c61 100755 --- a/packaging/org.tizen.gallery.spec +++ b/packaging/org.tizen.gallery.spec @@ -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 diff --git a/src/gallery.c b/src/gallery.c index 103b8c8..91015fe 100755 --- a/src/gallery.c +++ b/src/gallery.c @@ -15,6 +15,7 @@ */ #include +#include /* 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 */ -- 2.7.4