tasn pushed a commit to branch master. http://git.enlightenment.org/core/elementary.git/commit/?id=2fe8b390f5914e0b08340a8f1657c8570075b99b
commit 2fe8b390f5914e0b08340a8f1657c8570075b99b Author: Vitor Sousa <vitorsousasi...@gmail.com> Date: Tue Jan 26 13:02:52 2016 +0000 elm calendar: add mark_del method and move Elm_Calendar_Mark to .eo file Summary: Add mark_del as a method in the Elm.Calendar class. Move the elm_calendar_mark_del() function (which do not receive an Eo object) to elm_calendar_legacy.h. Move the declaration of Elm_Calendar_Mark to elm_calendar.eo as an opaque struct. Rename it to Elm.Calendar.Mark to follow eolian standards. Update documentation to refer to mark_del method instead of the elm_calendar_mark_del() function. Reviewers: felipealmeida, vinipsmaker, larryolj, cedric, tasn Reviewed By: tasn Differential Revision: https://phab.enlightenment.org/D3582 --- src/lib/elm_calendar.c | 10 ++++++++++ src/lib/elm_calendar.eo | 32 ++++++++++++++++++++++++++------ src/lib/elm_calendar_common.h | 16 ---------------- src/lib/elm_calendar_legacy.h | 16 +++++++++++++++- 4 files changed, 51 insertions(+), 23 deletions(-) diff --git a/src/lib/elm_calendar.c b/src/lib/elm_calendar.c index 0ba6fa5..6e7a5a1 100644 --- a/src/lib/elm_calendar.c +++ b/src/lib/elm_calendar.c @@ -1747,6 +1747,16 @@ _elm_calendar_mark_add(Eo *obj, Elm_Calendar_Data *sd, const char *mark_type, st return mark; } +EOLIAN static void +_elm_calendar_mark_del(Eo *obj, Elm_Calendar_Data *sd, Elm_Calendar_Mark *mark) +{ + EINA_SAFETY_ON_NULL_RETURN(mark); + EINA_SAFETY_ON_TRUE_RETURN(mark->obj != obj); + + sd->marks = eina_list_remove_list(sd->marks, mark->node); + _mark_free(mark); +} + EAPI void elm_calendar_mark_del(Elm_Calendar_Mark *mark) { diff --git a/src/lib/elm_calendar.eo b/src/lib/elm_calendar.eo index c4ab80b..fe067df 100644 --- a/src/lib/elm_calendar.eo +++ b/src/lib/elm_calendar.eo @@ -70,6 +70,11 @@ enum Elm.Calendar.Selectable day = (1 << 2) } +struct Elm.Calendar.Mark; [[Item handle for a calendar mark. + Created with @Elm.Calendar.mark_add and deleted + with @Elm.Calendar.mark_del. + ]] + class Elm.Calendar (Elm.Layout, Elm_Interface_Atspi_Widget_Action) { eo_prefix: elm_obj_calendar; @@ -282,7 +287,7 @@ class Elm.Calendar (Elm.Layout, Elm_Interface_Atspi_Widget_Action) [[Get a list of all the calendar marks. See also @.mark_add, - \@ref elm_calendar_mark_del(), + @.mark_del(), @.marks_clear. ]] @@ -333,10 +338,10 @@ class Elm.Calendar (Elm.Layout, Elm_Interface_Atspi_Widget_Action) next or previous month calendar forces marks drawn. Marks created with this method can be deleted with - \@ref elm_calendar_mark_del(). + @.mark_del(). See also @.marks_draw, - \@ref elm_calendar_mark_del(). + @.mark_del(). \@ref calendar_example_06 ]] @@ -358,7 +363,7 @@ class Elm.Calendar (Elm.Layout, Elm_Interface_Atspi_Widget_Action) * elm_calendar_marks_draw(cal); * @endcode */ - return: Elm_Calendar_Mark *; + return: Elm.Calendar.Mark *; params { @in mark_type: const(char)*; [[A string used to define the type of mark. It will be emitted to the theme, that should display a related modification on these @@ -370,11 +375,26 @@ class Elm.Calendar (Elm.Layout, Elm_Interface_Atspi_Widget_Action) mark (that don't repeat), daily, weekly, monthly or annually.]] } } + mark_del { + [[ + Delete mark from the calendar. + + If deleting all calendar marks is required, @.marks_clear() + should be used instead of getting marks list and deleting each one. + + See also @.mark_add(), + @.marks_clear(). + ]] + legacy: null; + params { + @in mark: Elm.Calendar.Mark *; [[ The mark to be deleted. ]] + } + } marks_clear { [[Remove all calendar's marks See also @.mark_add, - \@ref elm_calendar_mark_del(). + @.mark_del(). ]] @@ -391,7 +411,7 @@ class Elm.Calendar (Elm.Layout, Elm_Interface_Atspi_Widget_Action) marks will be drawn. See also @.mark_add, - \@ref elm_calendar_mark_del(), + @.mark_del(), @.marks_clear. \@ref calendar_example_06 diff --git a/src/lib/elm_calendar_common.h b/src/lib/elm_calendar_common.h index 5d50f6e..08f52f8 100644 --- a/src/lib/elm_calendar_common.h +++ b/src/lib/elm_calendar_common.h @@ -4,8 +4,6 @@ * @{ */ -typedef struct _Elm_Calendar_Mark Elm_Calendar_Mark; /**< Item handle for a calendar mark. Created with elm_calendar_mark_add() and deleted with elm_calendar_mark_del(). */ - /** * This callback type is used to format the string that will be used * to display month and year. @@ -17,20 +15,6 @@ typedef struct _Elm_Calendar_Mark Elm_Calendar_Mark; /**< Item handle for a c */ typedef char * (*Elm_Calendar_Format_Cb)(struct tm *stime); -/** - * Delete mark from the calendar. - * - * @param mark The mark to be deleted. - * - * If deleting all calendar marks is required, elm_calendar_marks_clear() - * should be used instead of getting marks list and deleting each one. - * - * @see elm_calendar_mark_add() - * - * @ref calendar_example_06 - */ -EAPI void elm_calendar_mark_del(Elm_Calendar_Mark *mark); - /* temporary until better solution is found: is here because of eolian */ typedef struct tm Elm_Calendar_Time; diff --git a/src/lib/elm_calendar_legacy.h b/src/lib/elm_calendar_legacy.h index 26a1669..be54a5d 100644 --- a/src/lib/elm_calendar_legacy.h +++ b/src/lib/elm_calendar_legacy.h @@ -1,3 +1,5 @@ +#include "elm_calendar.eo.legacy.h" + /** * Add a new calendar widget to the given parent Elementary * (container) object. @@ -13,4 +15,16 @@ */ EAPI Evas_Object *elm_calendar_add(Evas_Object *parent); -#include "elm_calendar.eo.legacy.h" \ No newline at end of file +/** + * Delete mark from the calendar. + * + * @param mark The mark to be deleted. + * + * If deleting all calendar marks is required, elm_calendar_marks_clear() + * should be used instead of getting marks list and deleting each one. + * + * @see elm_calendar_mark_add() + * + * @ref calendar_example_06 + */ +EAPI void elm_calendar_mark_del(Elm_Calendar_Mark *mark); --