2018-01-18 9:35 GMT+01:00 Jean-Philippe ANDRÉ <j...@videolan.org>:

> jpeg pushed a commit to branch master.
>
> http://git.enlightenment.org/core/efl.git/commit/?id=
> f312ed6db9cb64e1c4685fa27d1c41c347c382a6
>
> commit f312ed6db9cb64e1c4685fa27d1c41c347c382a6
> Author: Jean-Philippe Andre <jp.an...@samsung.com>
> Date:   Thu Jan 18 17:13:59 2018 +0900
>
>     widget: Rename orientation_mode_disabled
>
>     Name is stupid and long, why not just invert this bool?
>

The *_mode usually suffix imply a mode to be set (an enum).

obj.orientation_mode = TRUE/FALSE   is not really well readable, you
really need to read the docs to understand it.

I suggest to change the name to "orientation_automatic", "auto_orient",
"orientation_enabled", or something like that.

... Or maybe better to leave the name as "orientation_mode" and make it
an enum so that we can also extend it in the future, fe:
ORIENT_NONE
ORIENT_AUTO
and maybe also:
ORIENT_MANUAL
ORIENT_LANDSCAPE_ONLY
ORIENT_PORTRAIT_ONLY
etc...




> ---
>  src/lib/elementary/efl_ui_widget.c  | 10 +++++-----
>  src/lib/elementary/efl_ui_widget.eo | 17 +++++++----------
>  src/lib/elementary/elm_main.c       |  4 ++--
>  src/lib/elementary/elm_widget.h     |  2 --
>  4 files changed, 14 insertions(+), 19 deletions(-)
>
> diff --git a/src/lib/elementary/efl_ui_widget.c
> b/src/lib/elementary/efl_ui_widget.c
> index dfe47d7661..e8ee8ca9be 100644
> --- a/src/lib/elementary/efl_ui_widget.c
> +++ b/src/lib/elementary/efl_ui_widget.c
> @@ -3456,11 +3456,11 @@ elm_widget_display_mode_set(Evas_Object *obj,
> Evas_Display_Mode dispmode)
>  }
>
>  EOLIAN static void
> -_efl_ui_widget_orientation_mode_disabled_set(Eo *obj,
> Elm_Widget_Smart_Data *sd, Eina_Bool disabled)
> +_efl_ui_widget_orientation_mode_set(Eo *obj, Elm_Widget_Smart_Data *sd,
> Eina_Bool enabled)
>  {
>     int orient_mode = -1;
>
> -   if (!disabled)
> +   if (enabled)
>       {
>          //Get current orient mode from it's parent otherwise, 0.
>          sd->orient_mode = 0;
> @@ -3472,10 +3472,10 @@ _efl_ui_widget_orientation_mode_disabled_set(Eo
> *obj, Elm_Widget_Smart_Data *sd,
>  }
>
>  EOLIAN static Eina_Bool
> -_efl_ui_widget_orientation_mode_disabled_get(Eo *obj EINA_UNUSED,
> Elm_Widget_Smart_Data *sd)
> +_efl_ui_widget_orientation_mode_get(Eo *obj EINA_UNUSED,
> Elm_Widget_Smart_Data *sd)
>  {
> -   if (sd->orient_mode == -1) return EINA_TRUE;
> -   else return EINA_FALSE;
> +   if (sd->orient_mode == -1) return EINA_FALSE;
> +   else return EINA_TRUE;
>  }
>
>  EOLIAN static void
> diff --git a/src/lib/elementary/efl_ui_widget.eo
> b/src/lib/elementary/efl_ui_widget.eo
> index b50f2d7da0..46c66c23d0 100644
> --- a/src/lib/elementary/efl_ui_widget.eo
> +++ b/src/lib/elementary/efl_ui_widget.eo
> @@ -112,8 +112,8 @@ abstract Efl.Ui.Widget (Efl.Canvas.Group, Efl.Access,
>           return: bool; [[$true on success, $false otherwise]]
>           legacy: null;
>        }
> -      @property orientation_mode_disabled {
> -         [[Whether the widget's automatic orientation is disabled or not.
> +      @property orientation_mode {
> +         [[Whether the widget's automatic orientation is enabled or not.
>
>             Orientation mode is used for widgets to change their style or
> send
>             signals based on the canvas rotation (i.e. the window
> orientation).
> @@ -123,11 +123,10 @@ abstract Efl.Ui.Widget (Efl.Canvas.Group, Efl.Access,
>             the theme in order to provide a different look for the widget
> based
>             on the canvas orientation.
>
> -           By default orientation mode is enabled, which means this
> property
> -           is $false.
> +           By default orientation mode is enabled, i.e. this is $true.
>           ]]
>           values {
> -            disabled: bool(false); [[$true if the orientation mode is
> disabled.]]
> +            disabled: bool(true); [[$false if orientation mode is
> disabled.]]
>           }
>        }
>        // FIXME: focus_allow? can_focus? focusable?
> @@ -271,20 +270,18 @@ abstract Efl.Ui.Widget (Efl.Canvas.Group, Efl.Access,
>             This method will be called recursively from the top widget (the
>             window) to all the children objects whenever the window
> rotation
>             is changed. The given $rotation will be one of 0, 90, 180, 270
> or
> -           the special value -1 if @.orientation_mode_disabled is $true.
> +           the special value -1 if @.orientation_mode is $false.
>
> -           If @.orientation_mode_disabled is $false, the default
> implementation
> +           If @.orientation_mode is $true, the default implementation
>             will emit the signal "elm,state,orient,$R" will be emitted
> (where $R
>             is the rotation angle in degrees).
>
>             Note: This function may be called even if the orientation has
> not
>             actually changed, like when a widget needs to be reconfigured.
> -
> -           See also @Efl.Orientation.orientation.set.
>           ]]
>           params {
>              rotation: int; [[Orientation in degrees: 0, 90, 180, 270 or
> -1 if
> -               @.orientation_mode_disabled is $true.]]
> +               @.orientation_mode is $false.]]
>           }
>        }
>        on_disabled_update @protected {
> diff --git a/src/lib/elementary/elm_main.c b/src/lib/elementary/elm_main.c
> index 9b0f4ddb0a..c48f3adee8 100644
> --- a/src/lib/elementary/elm_main.c
> +++ b/src/lib/elementary/elm_main.c
> @@ -2051,13 +2051,13 @@ elm_object_name_find(const Evas_Object *obj, const
> char *name, int recurse)
>  EAPI void
>  elm_object_orientation_mode_disabled_set(Evas_Object *obj, Eina_Bool
> disabled)
>  {
> -   elm_widget_orientation_mode_disabled_set(obj, disabled);
> +   efl_ui_widget_orientation_mode_set(obj, !disabled);
>  }
>
>  EAPI Eina_Bool
>  elm_object_orientation_mode_disabled_get(const Evas_Object *obj)
>  {
> -   return elm_widget_orientation_mode_disabled_get(obj);
> +   return !efl_ui_widget_orientation_mode_get(obj);
>  }
>
>  EAPI Elm_Object_Item *
> diff --git a/src/lib/elementary/elm_widget.h b/src/lib/elementary/elm_
> widget.h
> index 6ebea70f18..20673e5798 100644
> --- a/src/lib/elementary/elm_widget.h
> +++ b/src/lib/elementary/elm_widget.h
> @@ -736,8 +736,6 @@ EAPI Evas_Object     *elm_widget_content_part_get(const
> Evas_Object *obj, const
>  EAPI Evas_Object     *elm_widget_content_part_unset(Evas_Object *obj,
> const char *part);
>  EAPI void             elm_widget_access_info_set(Evas_Object *obj, const
> char *txt);
>  EAPI const char      *elm_widget_access_info_get(const Evas_Object *obj);
> -EAPI void             elm_widget_orientation_mode_disabled_set(Evas_Object
> *obj, Eina_Bool disabled);
> -EAPI Eina_Bool        elm_widget_orientation_mode_disabled_get(const
> Evas_Object *obj);
>  EAPI Eina_Rect        elm_widget_focus_highlight_geometry_get(const
> Evas_Object *obj);
>  void                  _elm_widget_item_highlight_in_theme(Evas_Object
> *obj, Elm_Object_Item *it);
>  EAPI void             elm_widget_focus_region_show_mode_set(Evas_Object
> *obj, Elm_Focus_Region_Show_Mode mode);
>
> --
>
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to