menu: Fix crash in main menu and eo files

This amends the previous commit to avoid a crash in the main
menu, and adjust the eo files formatting.
This commit is contained in:
Jean-Philippe Andre 2016-11-30 17:12:43 +09:00
parent a58e2e1a79
commit ad250d0ffb
3 changed files with 30 additions and 20 deletions

View File

@ -3,46 +3,50 @@ interface Efl.Ui.Item {
methods {
@property prev {
get {
[[Get the item before $ it in the widget's internal list of
items.
[[Get the item before this one in the widget's list of items.
See also \@ref efl_ui_item_next_get.
See also @.next.
]]
}
values {
item: Efl.Ui.Item; [[The item before the object in its parent's list. If there is no previous item for $ it or there's an error, $null is returned.]]
item: Efl.Ui.Item; [[The item before the object in its parent's
list. If there is no previous item or in case
of error, $null is returned.]]
}
}
@property next {
get {
[[Get the item after $ it in the widget's
internal list of items.
[[Get the item after this one in the widget's list of items.
See also \@ref efl_ui_item_prev_get.
See also @.prev.
]]
}
values {
item: Efl.Ui.Item; [[The item after the object in its parent's list. If there is no previous item for $ it or there's an error, $null is returned.]]
item: Efl.Ui.Item; [[The item after the object in its parent's
list. If there is no next item or in case
of error, $null is returned.]]
}
}
@property selected {
[[Indicates whether this item is currently selected.]]
get {
[[Get the selected state of $item.]]
[[Get the selected state of this item.]]
}
set {
[[Set the selected state of $item.
This sets the selected state of the given item $it.
$true for selected, $false for not selected.
If a new item is selected the previously selected will
be unselected. Previously selected item can be get with
function @Efl.Ui.Menu.selected_item.get.
be unselected. Previously selected item can be retrieved
with @Efl.Ui.Menu.selected_item.get.
Selected items will be highlighted.
]]
}
values {
selected: bool; [[The selection state.]]
selected: bool; [[The selection state.]]
}
}
}

View File

@ -4,19 +4,25 @@ interface Efl.Ui.Menu {
@property selected_item {
get {
[[Get the selected item in the widget.]]
return: Efl.Ui.Item; [[The selected item or $null.]]
}
values {
item: Efl.Ui.Item; [[The selected item or $null.]]
}
}
@property first_item {
get {
[[Get the first item in the widget.]]
return: Efl.Ui.Item;
}
values {
item: Efl.Ui.Item; [[The first item or $null.]]
}
}
@property last_item {
get {
[[Get the last item in the widget.]]
return: Efl.Ui.Item;
}
values {
item: Efl.Ui.Item; [[The last item or $null.]]
}
}
@property items {

View File

@ -423,9 +423,8 @@ static Elm_DBus_Menu *
_elm_dbus_menu_add(Eo *menu)
{
Elm_DBus_Menu *dbus_menu;
const Eina_List *ret = NULL;
Eina_List *items, *l;
Elm_Object_Item *obj_item;
Eina_Iterator *it = NULL;
ELM_MENU_CHECK(menu) NULL;
@ -445,9 +444,8 @@ _elm_dbus_menu_add(Eo *menu)
dbus_menu->menu = menu;
ret = efl_ui_menu_items_get(menu);
items = (Eina_List *)ret;
EINA_LIST_FOREACH (items, l, obj_item)
it = efl_ui_menu_items_get(menu);
EINA_ITERATOR_FOREACH(it, obj_item)
{
ELM_MENU_ITEM_DATA_GET(obj_item, item);
if (!_menu_add_recursive(dbus_menu, item))
@ -456,10 +454,12 @@ _elm_dbus_menu_add(Eo *menu)
goto error_hash;
}
}
eina_iterator_free(it);
return dbus_menu;
error_hash:
eina_iterator_free(it);
eina_hash_free(dbus_menu->elements);
error_menu:
free(dbus_menu);