From 7e4cfb3451450f8f64804e8c02f8e2ec15fe08b9 Mon Sep 17 00:00:00 2001 From: MyoungJune Park Date: Sun, 24 Mar 2013 19:04:48 +0900 Subject: [PATCH] handling invalid path for homescreen&lockscreen - if homescreen&lockscreen path is incorrect, return erorr code --- TC_gui/main.c | 22 ++++++++++++++++++++++ debian/changelog | 7 +++++++ packaging/capi-system-system-settings.spec | 8 +++++++- src/system_setting_platform.c | 22 ++++++++++++++++++++++ 4 files changed, 58 insertions(+), 1 deletion(-) diff --git a/TC_gui/main.c b/TC_gui/main.c index 7409b6b..ed4e26d 100644 --- a/TC_gui/main.c +++ b/TC_gui/main.c @@ -159,6 +159,26 @@ void system_settings_changed_motion_activation(system_settings_key_e key, void * printf(">>>>>>>> system_settings_changed_motion_activation key = %d \n", key); printf("---------------------------------CALLED BY USER APPLICATION-MOTION ACTIVIATION \n"); } +void list_item_touch_handler7(void* data, Evas_Object* obj, void* event_info) +{ + char* path = "/opt/usr/media/Images/image16.jpg"; + int ret = system_settings_set_value_string(SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, "/aaa.png"); + printf(">>>>>>>> home screen - error case :: %d \n", ret); + + ret = system_settings_set_value_string(SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, path); + printf(">>>>>>>> home screen - error case :: %d \n", ret); + +} + +void list_item_touch_handler8(void* data, Evas_Object* obj, void* event_info) +{ + char* path = "/opt/usr/media/Images/image16.jpg"; + int ret = system_settings_set_value_string(SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, "aaa.png"); + printf(">>>>>>>> lock screen - error case : %d \n", ret); + + ret = system_settings_set_value_string(SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, path); + printf(">>>>>>>> lock screen - error case : %d \n", ret); +} static Evas_Object* _create_list_winset(Evas_Object* parent, struct appdata* ad) { @@ -193,6 +213,8 @@ static Evas_Object* _create_list_winset(Evas_Object* parent, struct appdata* ad) elm_list_item_append( li, "font type - choose Helvetica 2 ", NULL, NULL, list_item_touch_handler4, ad); elm_list_item_append( li, "motion activation ON ", NULL, NULL, list_item_touch_handler5, ad); elm_list_item_append( li, "motion activation OFF ", NULL, NULL, list_item_touch_handler6, ad); + elm_list_item_append( li, "homescreen - set ", NULL, NULL, list_item_touch_handler7, ad); + elm_list_item_append( li, "lockscreen - set ", NULL, NULL, list_item_touch_handler8, ad); elm_list_go(li); return li; diff --git a/debian/changelog b/debian/changelog index 2741839..6506bdd 100755 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +capi-system-system-settings (0.0.1-8) precise; urgency=low + + * release + * font-type API refinement + + -- mjpark Wed, 23 Jan 2013 15:25:21 +0900 + capi-system-system-settings (0.0.1-7) unstable; urgency=low * release diff --git a/packaging/capi-system-system-settings.spec b/packaging/capi-system-system-settings.spec index c1f43c5..796c3b4 100755 --- a/packaging/capi-system-system-settings.spec +++ b/packaging/capi-system-system-settings.spec @@ -20,6 +20,9 @@ BuildRequires: pkgconfig(gobject-2.0) BuildRequires: pkgconfig(fontconfig) BuildRequires: pkgconfig(libxml-2.0) +Requires(post): /sbin/ldconfig +Requires(postun): /sbin/ldconfig + %description @@ -31,11 +34,14 @@ Requires: pkgconfig(capi-base-common) %description devel + + %prep %setup -q + %build -MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` +MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` %cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} make %{?jobs:-j%jobs} diff --git a/src/system_setting_platform.c b/src/system_setting_platform.c index 6258edb..ade0fbf 100755 --- a/src/system_setting_platform.c +++ b/src/system_setting_platform.c @@ -17,11 +17,14 @@ #include #include #include +#include + #include #include #include #include + #include #include @@ -177,12 +180,26 @@ int system_setting_set_email_alert_ringtone(system_settings_key_e key, system_se } +static int _is_file_accessible(const char * path) +{ + int ret = access(path ,R_OK); + if (ret == 0) + return 0; + else + return errno; +} + int system_setting_set_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void* value) { printf(" mock --> real system_setting_set_wallpaper_home_screen \n"); char* vconf_value; vconf_value = (char*)value; + + // error handling here + if (_is_file_accessible(vconf_value) != 0) + return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; + if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, vconf_value)) { return SYSTEM_SETTINGS_ERROR_IO_ERROR; } @@ -196,6 +213,11 @@ int system_setting_set_wallpaper_lock_screen(system_settings_key_e key, system_s char* vconf_value; vconf_value = (char*)value; + + // error handling here + if (_is_file_accessible(vconf_value) != 0) + return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; + if (system_setting_vconf_set_value_string(VCONFKEY_IDLE_LOCK_BGSET, vconf_value)) { return SYSTEM_SETTINGS_ERROR_IO_ERROR; } -- 2.7.4