handling invalid path for homescreen&lockscreen
authorMyoungJune Park <mj2004.park@samsung.com>
Sun, 24 Mar 2013 10:04:48 +0000 (19:04 +0900)
committerMyoungJune Park <mj2004.park@samsung.com>
Sun, 24 Mar 2013 10:04:48 +0000 (19:04 +0900)
- if homescreen&lockscreen path is incorrect, return erorr code

TC_gui/main.c
debian/changelog
packaging/capi-system-system-settings.spec
src/system_setting_platform.c

index 7409b6b..ed4e26d 100644 (file)
@@ -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;
index 2741839..6506bdd 100755 (executable)
@@ -1,3 +1,10 @@
+capi-system-system-settings (0.0.1-8) precise; urgency=low
+
+  * release
+  * font-type API refinement
+
+ -- mjpark <mj2004.park@samsung.com>  Wed, 23 Jan 2013 15:25:21 +0900
+
 capi-system-system-settings (0.0.1-7) unstable; urgency=low
 
   * release
index c1f43c5..796c3b4 100755 (executable)
@@ -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}
index 6258edb..ade0fbf 100755 (executable)
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <errno.h>
+
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 
+
 #include <dlog.h>
 #include <vconf.h>
 
@@ -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;
        }