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
This commit is contained in:
Vitor Sousa 2016-01-26 13:02:52 +00:00 committed by Tom Hacohen
parent d3deb1e6a7
commit 363a3b4438
4 changed files with 51 additions and 23 deletions

View File

@ -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)
{

View File

@ -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

View File

@ -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;

View File

@ -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"
/**
* 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);