From be47c4b9c058ab4ff55060dfae082937d751fe7c Mon Sep 17 00:00:00 2001 From: Amitesh Singh Date: Tue, 10 May 2016 12:01:53 +0530 Subject: [PATCH] elm: rename Elm.Nstate to Efl.Ui.Nstate --- config/default/base.src.in | 2 +- config/mobile/base.src.in | 2 +- config/standard/base.src.in | 2 +- doc/widgets/widget_preview_nstate.c | 2 +- src/Makefile_Elementary.am | 7 ++- src/bin/elementary/test_nstate.c | 2 +- src/lib/elementary/Elementary.h.in | 2 +- src/lib/elementary/Makefile.am | 7 ++- .../elementary/{elm_nstate.c => efl_ui_nstate.c} | 54 ++++++++++++---------- .../elementary/{elm_nstate.eo => efl_ui_nstate.eo} | 4 +- .../elementary/{elm_nstate.h => efl_ui_nstate.h} | 2 +- src/lib/elementary/elm_check.c | 8 ++-- src/lib/elementary/elm_check.eo | 6 +-- src/lib/elementary/elm_widget_nstate.h | 38 --------------- 14 files changed, 51 insertions(+), 87 deletions(-) rename src/lib/elementary/{elm_nstate.c => efl_ui_nstate.c} (66%) rename src/lib/elementary/{elm_nstate.eo => efl_ui_nstate.eo} (91%) rename src/lib/elementary/{elm_nstate.h => efl_ui_nstate.h} (96%) delete mode 100644 src/lib/elementary/elm_widget_nstate.h diff --git a/config/default/base.src.in b/config/default/base.src.in index e5933f8..b7270b3 100644 --- a/config/default/base.src.in +++ b/config/default/base.src.in @@ -622,7 +622,7 @@ group "Elm_Config" struct { } } group "Elm_Config_Bindings_Widget" struct { - value "name" string: "Elm_Nstate"; + value "name" string: "Efl.Ui.Nstate"; group "key_bindings" list { group "Elm_Config_Binding_Key" struct { value "context" int: 0; diff --git a/config/mobile/base.src.in b/config/mobile/base.src.in index 7ba03bc..ace09b7 100644 --- a/config/mobile/base.src.in +++ b/config/mobile/base.src.in @@ -626,7 +626,7 @@ group "Elm_Config" struct { } } group "Elm_Config_Bindings_Widget" struct { - value "name" string: "Elm_Nstate"; + value "name" string: "Efl.Ui.Nstate"; group "key_bindings" list { group "Elm_Config_Binding_Key" struct { value "context" int: 0; diff --git a/config/standard/base.src.in b/config/standard/base.src.in index ba0d700..4b81b87 100644 --- a/config/standard/base.src.in +++ b/config/standard/base.src.in @@ -623,7 +623,7 @@ group "Elm_Config" struct { } } group "Elm_Config_Bindings_Widget" struct { - value "name" string: "Elm_Nstate"; + value "name" string: "Efl.Ui.Nstate"; group "key_bindings" list { group "Elm_Config_Binding_Key" struct { value "context" int: 0; diff --git a/doc/widgets/widget_preview_nstate.c b/doc/widgets/widget_preview_nstate.c index b53e998..3c4b721 100644 --- a/doc/widgets/widget_preview_nstate.c +++ b/doc/widgets/widget_preview_nstate.c @@ -1,6 +1,6 @@ #include "widget_preview_tmpl_head.c" -Evas_Object *o = eo_add(ELM_NSTATE_CLASS, win); +Evas_Object *o = eo_add(EFL_UI_NSTATE_CLASS, win); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, o); evas_object_show(o); diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am index b9affa2..95b8334 100644 --- a/src/Makefile_Elementary.am +++ b/src/Makefile_Elementary.am @@ -64,7 +64,7 @@ elm_public_eolian_files = \ lib/elementary/elm_multibuttonentry.eo \ lib/elementary/elm_naviframe.eo \ lib/elementary/elm_notify.eo \ - lib/elementary/elm_nstate.eo \ + lib/elementary/efl_ui_nstate.eo \ lib/elementary/elm_pan.eo \ lib/elementary/elm_panel.eo \ lib/elementary/elm_panes.eo \ @@ -215,7 +215,6 @@ includesunstable_HEADERS = \ lib/elementary/elm_widget_multibuttonentry.h \ lib/elementary/elm_widget_naviframe.h \ lib/elementary/elm_widget_notify.h \ - lib/elementary/elm_widget_nstate.h \ lib/elementary/elm_widget_panel.h \ lib/elementary/elm_widget_panes.h \ lib/elementary/elm_widget_photo.h \ @@ -419,7 +418,7 @@ includesub_HEADERS = \ lib/elementary/elm_notify_common.h \ lib/elementary/elm_notify_eo.h \ lib/elementary/elm_notify_legacy.h \ - lib/elementary/elm_nstate.h \ + lib/elementary/efl_ui_nstate.h \ lib/elementary/elm_object.h \ lib/elementary/elm_object_item.h \ lib/elementary/elm_panel.h \ @@ -594,7 +593,7 @@ lib_elementary_libelementary_la_SOURCES = \ lib/elementary/elm_menu.c \ lib/elementary/elm_module.c \ lib/elementary/elm_notify.c \ - lib/elementary/elm_nstate.c \ + lib/elementary/efl_ui_nstate.c \ lib/elementary/elm_panel.c \ lib/elementary/elm_panes.c \ lib/elementary/elm_photo.c \ diff --git a/src/bin/elementary/test_nstate.c b/src/bin/elementary/test_nstate.c index 8c66ae5..9444fb1 100644 --- a/src/bin/elementary/test_nstate.c +++ b/src/bin/elementary/test_nstate.c @@ -29,7 +29,7 @@ test_nstate(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in elm_win_resize_object_add(win, bx); evas_object_show(bx); - nstate = eo_add(ELM_NSTATE_CLASS, win); + nstate = eo_add(EFL_UI_NSTATE_CLASS, win); efl_ui_nstate_count_set(nstate, 5); elm_object_text_set(nstate, "nstate = 0"); elm_box_pack_end(bx, nstate); diff --git a/src/lib/elementary/Elementary.h.in b/src/lib/elementary/Elementary.h.in index 6439a82..b85eaff 100644 --- a/src/lib/elementary/Elementary.h.in +++ b/src/lib/elementary/Elementary.h.in @@ -235,7 +235,7 @@ EAPI extern Elm_Version *elm_version; #include #include #include -#include +#include #include #include diff --git a/src/lib/elementary/Makefile.am b/src/lib/elementary/Makefile.am index e84ac65..9138607 100644 --- a/src/lib/elementary/Makefile.am +++ b/src/lib/elementary/Makefile.am @@ -69,7 +69,7 @@ elm_eolian_files = \ elm_multibuttonentry.eo \ elm_naviframe.eo \ elm_notify.eo \ - elm_nstate.eo \ + efl_ui_nstate.eo \ elm_pan.eo \ elm_panel.eo \ elm_panes.eo \ @@ -203,7 +203,6 @@ includesunstable_HEADERS = \ elm_widget_multibuttonentry.h \ elm_widget_naviframe.h \ elm_widget_notify.h \ - elm_widget_nstate.h \ elm_widget_panel.h \ elm_widget_panes.h \ elm_widget_photo.h \ @@ -405,7 +404,7 @@ includesub_HEADERS = \ elm_notify_common.h \ elm_notify_eo.h \ elm_notify_legacy.h \ - elm_nstate.h \ + efl_ui_nstate.h \ elm_object.h \ elm_object_item.h \ elm_panel.h \ @@ -580,7 +579,7 @@ libelementary_la_SOURCES = \ elm_menu.c \ elm_module.c \ elm_notify.c \ - elm_nstate.c \ + efl_ui_nstate.c \ elm_panel.c \ elm_panes.c \ elm_photo.c \ diff --git a/src/lib/elementary/elm_nstate.c b/src/lib/elementary/efl_ui_nstate.c similarity index 66% rename from src/lib/elementary/elm_nstate.c rename to src/lib/elementary/efl_ui_nstate.c index dac44d3..530def3 100644 --- a/src/lib/elementary/elm_nstate.c +++ b/src/lib/elementary/efl_ui_nstate.c @@ -2,23 +2,29 @@ # include "elementary_config.h" #endif -#define ELM_NSTATE_PROTECTED +#define EFL_UI_NSTATE_PROTECTED #include "Elementary.h" #include "elm_priv.h" -#include "elm_widget_nstate.h" +#include "efl_ui_nstate.eo.h" #include "elm_widget_button.h" -#define MY_CLASS ELM_NSTATE_CLASS +#define MY_CLASS EFL_UI_NSTATE_CLASS -#define MY_CLASS_NAME "Elm_Nstate" -#define MY_CLASS_NAME_LEGACY "elm_nstate" +#define MY_CLASS_NAME "Efl.Ui.Nstate" + + +typedef struct +{ + int nstate; + int state; +} Efl_Ui_Nstate_Data; static const Evas_Smart_Cb_Description _smart_callbacks[] = { {NULL, NULL} }; static Eina_Bool _key_action_activate(Evas_Object *obj, const char *params); -static void _state_active(Evas_Object *obj, Elm_Nstate_Data *sd); +static void _state_active(Evas_Object *obj, Efl_Ui_Nstate_Data *sd); static const Elm_Action key_actions[] = { {"activate", _key_action_activate}, @@ -26,10 +32,10 @@ static const Elm_Action key_actions[] = { }; EOLIAN static Eo_Base * -_elm_nstate_eo_base_constructor(Eo *obj, Elm_Nstate_Data *pd EINA_UNUSED) +_efl_ui_nstate_eo_base_constructor(Eo *obj, Efl_Ui_Nstate_Data *pd EINA_UNUSED) { obj = eo_constructor(eo_super(obj, MY_CLASS)); - evas_obj_type_set(obj, MY_CLASS_NAME_LEGACY); + evas_obj_type_set(obj, MY_CLASS_NAME); evas_obj_smart_callbacks_descriptions_set(obj, _smart_callbacks); //TODO: Add ATSPI call here @@ -37,14 +43,14 @@ _elm_nstate_eo_base_constructor(Eo *obj, Elm_Nstate_Data *pd EINA_UNUSED) } static void -_next_state_set(Elm_Nstate_Data *sd) +_next_state_set(Efl_Ui_Nstate_Data *sd) { ++sd->state; if (sd->state == sd->nstate) sd->state = 0; } static void -_state_active(Evas_Object *obj, Elm_Nstate_Data *sd) +_state_active(Evas_Object *obj, Efl_Ui_Nstate_Data *sd) { char buf[64]; @@ -52,7 +58,7 @@ _state_active(Evas_Object *obj, Elm_Nstate_Data *sd) elm_layout_signal_emit(obj, buf, "elm"); edje_object_message_signal_process(elm_layout_edje_get(obj)); elm_obj_layout_sizing_eval(obj); - eo_event_callback_call(obj, ELM_NSTATE_EVENT_STATE_CHANGED, NULL); + eo_event_callback_call(obj, EFL_UI_NSTATE_EVENT_STATE_CHANGED, NULL); } static void @@ -65,7 +71,7 @@ _on_state_changed(void *data, } EOLIAN static void -_elm_nstate_evas_object_smart_add(Eo *obj, Elm_Nstate_Data *pd) +_efl_ui_nstate_evas_object_smart_add(Eo *obj, Efl_Ui_Nstate_Data *pd) { ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); @@ -84,19 +90,19 @@ _elm_nstate_evas_object_smart_add(Eo *obj, Elm_Nstate_Data *pd) } EOLIAN static void -_elm_nstate_evas_object_smart_del(Eo *obj, Elm_Nstate_Data *pd EINA_UNUSED) +_efl_ui_nstate_evas_object_smart_del(Eo *obj, Efl_Ui_Nstate_Data *pd EINA_UNUSED) { evas_obj_smart_del(eo_super(obj, MY_CLASS)); } EOLIAN static int -_elm_nstate_count_get(Eo *obj EINA_UNUSED, Elm_Nstate_Data *pd) +_efl_ui_nstate_count_get(Eo *obj EINA_UNUSED, Efl_Ui_Nstate_Data *pd) { return pd->nstate; } EOLIAN static void -_elm_nstate_count_set(Eo *obj EINA_UNUSED, Elm_Nstate_Data *pd, int nstate) +_efl_ui_nstate_count_set(Eo *obj EINA_UNUSED, Efl_Ui_Nstate_Data *pd, int nstate) { if (pd->nstate == nstate) return; @@ -105,13 +111,13 @@ _elm_nstate_count_set(Eo *obj EINA_UNUSED, Elm_Nstate_Data *pd, int nstate) } EOLIAN static int -_elm_nstate_value_get(Eo *obj EINA_UNUSED, Elm_Nstate_Data *pd) +_efl_ui_nstate_value_get(Eo *obj EINA_UNUSED, Efl_Ui_Nstate_Data *pd) { return pd->state; } static Eina_Bool -_is_valid_state(Elm_Nstate_Data *sd, int state) +_is_valid_state(Efl_Ui_Nstate_Data *sd, int state) { if (sd->state == state || (state < 0 || state >= sd->nstate)) return EINA_FALSE; @@ -120,7 +126,7 @@ _is_valid_state(Elm_Nstate_Data *sd, int state) } EOLIAN static void -_elm_nstate_value_set(Eo *obj, Elm_Nstate_Data *pd, int state) +_efl_ui_nstate_value_set(Eo *obj, Efl_Ui_Nstate_Data *pd, int state) { if (!_is_valid_state(pd, state)) return; @@ -129,7 +135,7 @@ _elm_nstate_value_set(Eo *obj, Elm_Nstate_Data *pd, int state) } EOLIAN static Eina_Bool -_elm_nstate_elm_widget_theme_apply(Eo *obj, Elm_Nstate_Data *pd) +_efl_ui_nstate_elm_widget_theme_apply(Eo *obj, Efl_Ui_Nstate_Data *pd) { Eina_Bool int_ret; @@ -149,7 +155,7 @@ _key_action_activate(Evas_Object *obj, const char *params EINA_UNUSED) } EOLIAN static Eina_Bool -_elm_nstate_elm_widget_event(Eo *obj, Elm_Nstate_Data *_pd EINA_UNUSED, Evas_Object *src EINA_UNUSED, Evas_Callback_Type type, void *event_info) +_efl_ui_nstate_elm_widget_event(Eo *obj, Efl_Ui_Nstate_Data *_pd EINA_UNUSED, Evas_Object *src EINA_UNUSED, Evas_Callback_Type type, void *event_info) { Evas_Event_Key_Down *ev = event_info; @@ -164,16 +170,16 @@ _elm_nstate_elm_widget_event(Eo *obj, Elm_Nstate_Data *_pd EINA_UNUSED, Evas_Obj } EOLIAN static void -_elm_nstate_activate(Eo *obj, Elm_Nstate_Data *_pd) +_efl_ui_nstate_activate(Eo *obj, Efl_Ui_Nstate_Data *_pd) { _next_state_set(_pd); _state_active(obj, _pd); } EOLIAN static void -_elm_nstate_class_constructor(Eo_Class *klass) +_efl_ui_nstate_class_constructor(Eo_Class *klass) { - evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass); + evas_smart_legacy_type_register(MY_CLASS_NAME, klass); } -#include "elm_nstate.eo.c" +#include "efl_ui_nstate.eo.c" diff --git a/src/lib/elementary/elm_nstate.eo b/src/lib/elementary/efl_ui_nstate.eo similarity index 91% rename from src/lib/elementary/elm_nstate.eo rename to src/lib/elementary/efl_ui_nstate.eo index 6ff0f89..e21f83f 100644 --- a/src/lib/elementary/elm_nstate.eo +++ b/src/lib/elementary/efl_ui_nstate.eo @@ -1,8 +1,6 @@ -class Elm.Nstate(Elm.Button) +class Efl.Ui.Nstate(Elm.Button) { - eo_prefix: efl_ui_nstate; legacy_prefix: null; - data: Elm_Nstate_Data; methods { activate @protected { } diff --git a/src/lib/elementary/elm_nstate.h b/src/lib/elementary/efl_ui_nstate.h similarity index 96% rename from src/lib/elementary/elm_nstate.h rename to src/lib/elementary/efl_ui_nstate.h index 66d7aed..5e69c19 100644 --- a/src/lib/elementary/elm_nstate.h +++ b/src/lib/elementary/efl_ui_nstate.h @@ -22,5 +22,5 @@ */ #ifdef EFL_EO_API_SUPPORT -#include "elm_nstate.eo.h" +#include "efl_ui_nstate.eo.h" #endif diff --git a/src/lib/elementary/elm_check.c b/src/lib/elementary/elm_check.c index 80d81ad..a113bc5 100644 --- a/src/lib/elementary/elm_check.c +++ b/src/lib/elementary/elm_check.c @@ -5,12 +5,12 @@ #define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED #define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED #define ELM_LAYOUT_PROTECTED -#define ELM_NSTATE_PROTECTED +#define EFL_UI_NSTATE_PROTECTED #include #include "elm_priv.h" +#include "efl_ui_nstate.eo.h" #include "elm_widget_check.h" -#include "elm_widget_nstate.h" #define MY_CLASS ELM_CHECK_CLASS @@ -341,13 +341,13 @@ _elm_check_selected_set(Eo *obj, Elm_Check_Data *pd EINA_UNUSED, Eina_Bool value } EOLIAN static void -_elm_check_elm_nstate_count_set(Eo *obj EINA_UNUSED, Elm_Check_Data *pd EINA_UNUSED, int nstate EINA_UNUSED) +_elm_check_efl_ui_nstate_count_set(Eo *obj EINA_UNUSED, Elm_Check_Data *pd EINA_UNUSED, int nstate EINA_UNUSED) { //NOP; } EOLIAN static void -_elm_check_elm_nstate_value_set(Eo *obj, Elm_Check_Data *pd EINA_UNUSED, int state) +_elm_check_efl_ui_nstate_value_set(Eo *obj, Elm_Check_Data *pd EINA_UNUSED, int state) { Eina_Bool _state = !!state; if (_state == efl_ui_nstate_value_get(obj)) return; diff --git a/src/lib/elementary/elm_check.eo b/src/lib/elementary/elm_check.eo index 40c6fdc..31b67a8 100644 --- a/src/lib/elementary/elm_check.eo +++ b/src/lib/elementary/elm_check.eo @@ -1,4 +1,4 @@ -class Elm.Check (Elm.Nstate, Elm.Interface_Atspi_Widget_Action) +class Elm.Check (Efl.Ui.Nstate, Elm.Interface_Atspi_Widget_Action) { [[Check widget @@ -29,8 +29,8 @@ class Elm.Check (Elm.Nstate, Elm.Interface_Atspi_Widget_Action) Elm.Widget.sub_object_del; Elm.Widget.event; Elm.Layout.text_aliases.get; - Elm.Nstate.count.set; - Elm.Nstate.value.set; + Efl.Ui.Nstate.count.set; + Efl.Ui.Nstate.value.set; Elm.Interface_Atspi_Accessible.state_set.get; Elm.Interface_Atspi_Widget_Action.elm_actions.get; } diff --git a/src/lib/elementary/elm_widget_nstate.h b/src/lib/elementary/elm_widget_nstate.h deleted file mode 100644 index 6733d97..0000000 --- a/src/lib/elementary/elm_widget_nstate.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef ELM_WIDGET_NSTATE_H -#define ELM_WIDGET_NSTATE_H - -#include "elm_nstate.eo.h" - -typedef struct -{ - int nstate; - int state; -} Elm_Nstate_Data; - - -#define ELM_NSTATE_DATA_GET(o, sd) \ - Elm_Nstate_Data * sd = eo_data_scope_get(o, ELM_NSTATE_CLASS) - -#define ELM_NSTATE_DATA_GET_OR_RETURN(o, ptr) \ - ELM_NSTATE_DATA_GET(o, ptr); \ - if (EINA_UNLIKELY(!ptr)) \ - { \ - CRI("No widget data for object %p (%s)", \ - o, evas_object_type_get(o)); \ - return; \ - } - -#define ELM_NSTATE_DATA_GET_OR_RETURN_VAL(o, ptr, val) \ - ELM_NSTATE_DATA_GET(o, ptr); \ - if (EINA_UNLIKELY(!ptr)) \ - { \ - CRI("No widget data for object %p (%s)", \ - o, evas_object_type_get(o)); \ - return val; \ - } - -#define ELM_NSTATE_CHECK(obj) \ - if (EINA_UNLIKELY(!eo_isa((obj), ELM_NSTATE_CLASS))) \ - return - -#endif -- 2.7.4