Trait gio::prelude::ListModelExt [−][src]
pub trait ListModelExt: 'static { fn item_type(&self) -> Type; fn n_items(&self) -> u32; fn item(&self, position: u32) -> Option<Object>; fn items_changed(&self, position: u32, removed: u32, added: u32); fn connect_items_changed<F: Fn(&Self, u32, u32, u32) + 'static>(
&self,
f: F
) -> SignalHandlerId; }
Expand description
Required methods
fn items_changed(&self, position: u32, removed: u32, added: u32)
fn items_changed(&self, position: u32, removed: u32, added: u32)
Emits the signal::ListModel::items-changed
signal on self
.
This function should only be called by classes implementing
ListModel
. It has to be called after the internal representation
of self
has been updated, because handlers connected to this signal
might query the new state of the list.
Implementations must only make changes to the model (as visible to
its consumer) in places that will not cause problems for that
consumer. For models that are driven directly by a write API (such
as ListStore
), changes can be reported in response to uses of that
API. For models that represent remote data, changes should only be
made from a fresh mainloop dispatch. It is particularly not
permitted to make changes in response to a call to the ListModel
consumer API.
Stated another way: in general, it is assumed that code making a series of accesses to the model via the API, without returning to the mainloop, and without calling other code, will continue to view the same contents of the model.
position
the position at which self
changed
removed
the number of items removed
added
the number of items added
fn connect_items_changed<F: Fn(&Self, u32, u32, u32) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_items_changed<F: Fn(&Self, u32, u32, u32) + 'static>(
&self,
f: F
) -> SignalHandlerId
This signal is emitted whenever items were added to or removed
from list
. At position
, removed
items were removed and added
items were added in their place.
Note: If removed
!= added
, the positions of all later items
in the model change.
position
the position at which list
changed
removed
the number of items removed
added
the number of items added