Class: Gio::ListStore
- Inherits:
-
Object
- Object
- Gio::ListStore
- Defined in:
- (unknown)
Instance Method Summary collapse
-
#append(item) ⇒ nil
Appends item to store.
-
#find(item, position) ⇒ Boolean
Looks up the given item in the list store by looping over the items until the first occurrence of item.
-
#find_with_equal_func(item, equal_func, position) ⇒ Boolean
Looks up the given item in the list store by looping over the items and comparing them with equal_func until the first occurrence of item which matches.
-
#find_with_equal_func_full(item, equal_func, user_data, position) ⇒ Boolean
Like g_list_store_find_with_equal_func() but with an additional user_data that is passed to equal_func.
-
#initialize(item_type) ⇒ Gio::ListStore
constructor
Creates a new GList::Store with items of type item_type.
-
#insert(position, item) ⇒ nil
Inserts item into store at position.
-
#insert_sorted(item, compare_func, user_data) ⇒ Integer
Inserts item into store at a position to be determined by the compare_func.
-
#item_type ⇒ GLib::Type
The type of items contained in this list store.
-
#item_type=(item_type) ⇒ GLib::Type
The type of items contained in this list store.
-
#n_items ⇒ Integer
The number of items contained in this list store.
-
#n_items=(n_items) ⇒ Integer
The number of items contained in this list store.
-
#remove(position) ⇒ nil
Removes the item from store that is at position.
-
#remove_all ⇒ nil
Removes all items from store.
-
#sort(compare_func, user_data) ⇒ nil
Sort the items in store according to compare_func.
-
#splice(position, n_removals, additions, n_additions) ⇒ nil
Changes store by removing n_removals items and adding n_additions items to it.
Constructor Details
#initialize(item_type) ⇒ Gio::ListStore
Creates a new GList::Store with items of type item_type. item_type must be a subclass of #GObject.
Instance Method Details
#append(item) ⇒ nil
Appends item to store. item must be of type GList::Store:item-type.
This function takes a ref on item.
Use g_list_store_splice() to append multiple items at the same time efficiently.
#find(item, position) ⇒ Boolean
Looks up the given item in the list store by looping over the items until the first occurrence of item. If item was not found, then position will not be set, and this method will return false.
If you need to compare the two items with a custom comparison function, use g_list_store_find_with_equal_func() with a custom GEqual::Func instead. set to the position where item occurred for the first time.
#find_with_equal_func(item, equal_func, position) ⇒ Boolean
Looks up the given item in the list store by looping over the items and comparing them with equal_func until the first occurrence of item which matches. If item was not found, then position will not be set, and this method will return false.
item is always passed as second parameter to equal_func.
Since GLib 2.76 it is possible to pass NULL for item.
set to the position where item occurred for the first time.
#find_with_equal_func_full(item, equal_func, user_data, position) ⇒ Boolean
Like g_list_store_find_with_equal_func() but with an additional user_data that is passed to equal_func.
item is always passed as second parameter to equal_func.
Since GLib 2.76 it is possible to pass NULL for item.
set to the position where item occurred for the first time.
#insert(position, item) ⇒ nil
Inserts item into store at position. item must be of type GList::Store:item-type or derived from it. position must be smaller than the length of the list, or equal to it to append.
This function takes a ref on item.
Use g_list_store_splice() to insert multiple items at the same time efficiently.
#insert_sorted(item, compare_func, user_data) ⇒ Integer
Inserts item into store at a position to be determined by the compare_func.
The list must already be sorted before calling this function or the result is undefined. Usually you would approach this by only ever inserting items by way of this function.
This function takes a ref on item.
#item_type ⇒ GLib::Type
The type of items contained in this list store. Items must be subclasses of #GObject.
#item_type=(item_type) ⇒ GLib::Type
The type of items contained in this list store. Items must be subclasses of #GObject.
#n_items ⇒ Integer
The number of items contained in this list store.
#n_items=(n_items) ⇒ Integer
The number of items contained in this list store.
#remove(position) ⇒ nil
Removes the item from store that is at position. position must be smaller than the current length of the list.
Use g_list_store_splice() to remove multiple items at the same time efficiently.
#remove_all ⇒ nil
Removes all items from store.
#sort(compare_func, user_data) ⇒ nil
Sort the items in store according to compare_func.
#splice(position, n_removals, additions, n_additions) ⇒ nil
Changes store by removing n_removals items and adding n_additions items to it. additions must contain n_additions items of type GList::Store:item-type. nil is not permitted.
This function is more efficient than g_list_store_insert() and g_list_store_remove(), because it only emits GList::Model::items-changed once for the change.
This function takes a ref on each item in additions.
The parameters position and n_removals must be correct (ie: position + n_removals must be less than or equal to the length of the list at the time this function is called).