static int app_lang_changed(void *data);
static int app_region_changed(void *data);
-static Evas_Object *create_win(const char *name);
+static Evas_Object *create_win(const char *name, struct appdata *ad);
static void win_del(void *data, Evas_Object *obj, void *event);
static void launch_email_ug(service_h b, struct appdata *ad);
static int check_app_svc_operation(service_h b, struct appdata *ad, gint account_id);
static void destroy_cb(ui_gadget_h ug, void *priv);
static void aul_destroy_cb(ui_gadget_h ug, void *priv);
ui_gadget_h create_ug(char *ug_name, service_h bd, void *data);
-static int _email_main_rotation_cb(app_device_orientation_e m, void *data);
+static void _email_main_rotation_cb(void *data, Evas_Object *obj, void *event);
static void _email_timezone_change_cb(keynode_t *key, void *data);
return ug;
}
-static int _email_main_rotation_cb(app_device_orientation_e m, void *data)
+static void _email_main_rotation_cb(void *data, Evas_Object *obj, void *event)
{
debug_log("");
struct appdata *ad = data;
- int rotation_mode = -1;
+ enum ug_event rotation_mode;
+ int m = 0;
if (ad == NULL || ad->win_main == NULL) {
- return -1;
+ debug_log("ad or ad->win_main is NULL");
+ return;
}
+ m = elm_win_rotation_get(ad->win_main);
debug_log("app_device_orientation: %d", m);
switch (m) {
ret = service_create(&service);
if (!service) {
debug_log("service create failed");
- return 0;
+ return;
}
snprintf(buf, sizeof(buf), "%d", rotation_mode);
debug_log("service_destroy: %d", ret);
}
- return 0;
+ return;
}
static bool app_create(void *data)
elm_config_preferred_engine_set("opengl_x11"); //"software_x11"
/* create window */
- win = create_win(PACKAGE);
+ win = create_win(PACKAGE, ad);
+ debug_log("create_win, ad: %p", ad);
if (win == NULL) {
debug_log("create_win returns NULL");
return false;
ops.service = (app_service_cb)app_reset;
ops.low_memory = (app_low_memory_cb)app_low_memory;
ops.low_battery = (app_low_battery_cb)app_low_battery;
- ops.device_orientation = (app_device_orientation_cb)_email_main_rotation_cb;
+ ops.device_orientation = NULL;
ops.language_changed = (app_language_changed_cb)app_lang_changed;
ops.region_format_changed = (app_region_format_changed_cb)app_region_changed;
return app_efl_main(&argc, &argv, &ops, &ad);
}
-static Evas_Object *create_win(const char *name)
+static Evas_Object *create_win(const char *name, struct appdata *ad)
{
debug_log("");
Evas_Object *eo;
evas_object_smart_callback_add(eo, "delete,request", win_del, NULL);
ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
evas_object_resize(eo, w, h);
+
+ if (elm_win_wm_rotation_supported_get(eo)) {
+ const int rots[4] = { APP_DEVICE_ORIENTATION_0,
+ APP_DEVICE_ORIENTATION_90,
+ APP_DEVICE_ORIENTATION_180,
+ APP_DEVICE_ORIENTATION_270 };
+ debug_log("");
+ elm_win_wm_rotation_available_rotations_set(eo, rots, 4);
+ }
+ /* pass '-1' value to this API then it will unset
+ * preferred rotation angle */
+ elm_win_wm_rotation_preferred_rotation_set(eo, -1);
+ evas_object_smart_callback_add(eo, "wm,rotation,changed",
+ _email_main_rotation_cb, ad);
}
return eo;