summaryrefslogtreecommitdiff
path: root/contacts
diff options
context:
space:
mode:
Diffstat (limited to 'contacts')
-rwxr-xr-xcontacts/contacts.c58
1 files changed, 21 insertions, 37 deletions
diff --git a/contacts/contacts.c b/contacts/contacts.c
index 87c3679..fdaa9d3 100755
--- a/contacts/contacts.c
+++ b/contacts/contacts.c
@@ -37,6 +37,7 @@ struct contact_data
Evas_Object *icon;
Evas_Object *prev_btn;
#endif
+ int current_rotate;
};
static void ctapp_win_del(void *data, Evas_Object *obj, void *event)
@@ -85,23 +86,6 @@ static void ctapp_language_changed(void *data)
return;
}
-static void device_orientation(app_device_orientation_e orientation, void *data)
-{
- PH_FN_CALL;
- struct contact_data *ad = data;
- ct_front_data *cfront_d = ad->cfront_d;
-#ifdef _PHONE_CONTACTS_DESKTOP_MODE_
- const char *config = elm_config_profile_get();
- if(!strcmp(config, "desktop"))
- return;
-#endif
- p_retm_if(cfront_d == NULL || cfront_d->win == NULL, "Paramter is NULL");
- p_ret_if(!cfront_d->auto_rorate_screen);
- cfront_d->rotate = orientation;
- ctui_front_view_rotate(cfront_d, orientation);
- return;
-}
-
static int ctapp_open(void *data)
{
PH_FN_CALL;
@@ -151,24 +135,25 @@ static void __win_profile_changed_cb(void *data, Evas_Object *obj, void *event_i
}
#endif //_PHONE_CONTACTS_DESKTOP_MODE_
-static void __ctapp_auto_rotate_screen_bool_changed(keynode_t *key, void *data)
+static void __ctapp_rotate_cb(void *data, Evas_Object *obj, void *event)
{
- PH_FN_CALL;
struct contact_data *ad = data;
+ int changed_rotate = elm_win_rotation_get(obj);
+ if (changed_rotate != ad->current_rotate) {
+ ERR("rotate changed %d", changed_rotate);
+ ad->current_rotate = changed_rotate;
- ct_front_data *cfront_d = ad->cfront_d;
- p_retm_if(cfront_d == NULL || cfront_d->win == NULL, "Paramter is NULL");
-
- vconf_get_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &cfront_d->auto_rorate_screen);
- if (cfront_d->rotate != APP_DEVICE_ORIENTATION_0) {
- if (cfront_d->auto_rorate_screen)
- ctui_front_view_rotate(cfront_d, cfront_d->rotate);
- else
- ctui_front_view_rotate(cfront_d, APP_DEVICE_ORIENTATION_0);
+#ifdef _PHONE_CONTACTS_DESKTOP_MODE_
+ const char *config = elm_config_profile_get();
+ if (!strcmp(config, "desktop"))
+ return;
+#endif
+
+ ctui_front_view_rotate(ad->cfront_d, ad->current_rotate);
}
- return;
}
+
static bool ctapp_create(void *data)
{
PH_FN_CALL;
@@ -203,12 +188,14 @@ static bool ctapp_create(void *data)
UG_INIT_EFL(ad->win, UG_OPT_INDICATOR_ENABLE);
ad->cfront_d = ctui_front_view_create(ad->win);
- vconf_notify_key_changed(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, __ctapp_auto_rotate_screen_bool_changed, ad);
- vconf_get_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &(ad->cfront_d->auto_rorate_screen));
+ if (elm_win_wm_rotation_supported_get(win)) {
+ int rotation[4] = {0, 90, 180, 270};
+ elm_win_wm_rotation_available_rotations_set(win, (const int *)(&rotation), 4);
+ ad->current_rotate = elm_win_rotation_get(win);
+ ERR("rotate current %d", ad->current_rotate);
+ evas_object_smart_callback_add(win, "wm,rotation,changed", __ctapp_rotate_cb, ad);
+ }
- ad->cfront_d->rotate = app_get_device_orientation();
- if (ad->cfront_d->auto_rorate_screen)
- elm_win_rotation_with_resize_set(ad->cfront_d->win, ad->cfront_d->rotate);
appcore_set_open_cb(ctapp_open, data);
return true;
}
@@ -219,8 +206,6 @@ static void ctapp_terminate(void *data)
contacts_error_e err = CONTACTS_ERROR_NONE;
struct contact_data *ad = data;
- vconf_ignore_key_changed(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, __ctapp_auto_rotate_screen_bool_changed);
-
if (NULL != ad->win)
evas_object_del(ad->win);
//ug_destroy_all();
@@ -311,7 +296,6 @@ API int main(int argc, char *argv[])
event_callback.service = ctapp_service;
event_callback.low_memory = NULL;
event_callback.low_battery = NULL;
- event_callback.device_orientation = device_orientation;
event_callback.language_changed = ctapp_language_changed;
event_callback.region_format_changed = ctapp_region_changed;