1 /*
2  * Copyright 2015 Lars Uebernickel
3  * Copyright 2015 Ryan Lortie
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General
16  * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
17  *
18  * Authors:
19  *     Lars Uebernickel <lars@uebernic.de>
20  *     Ryan Lortie <desrt@desrt.ca>
21  */
22 
23 #ifndef __G_LIST_MODEL_H__
24 #define __G_LIST_MODEL_H__
25 
26 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
27 #error "Only <gio/gio.h> can be included directly."
28 #endif
29 
30 #include <gio/giotypes.h>
31 
32 G_BEGIN_DECLS
33 
34 #define G_TYPE_LIST_MODEL g_list_model_get_type ()
35 GLIB_AVAILABLE_IN_2_44
36 G_DECLARE_INTERFACE(GListModel, g_list_model, G, LIST_MODEL, GObject)
37 
38 struct _GListModelInterface
39 {
40   GTypeInterface g_iface;
41 
42   GType     (* get_item_type)   (GListModel *list);
43 
44   guint     (* get_n_items)     (GListModel *list);
45 
46   gpointer  (* get_item)        (GListModel *list,
47                                  guint       position);
48 };
49 
50 GLIB_AVAILABLE_IN_2_44
51 GType                   g_list_model_get_item_type                      (GListModel *list);
52 
53 GLIB_AVAILABLE_IN_2_44
54 guint                   g_list_model_get_n_items                        (GListModel *list);
55 
56 GLIB_AVAILABLE_IN_2_44
57 gpointer                g_list_model_get_item                           (GListModel *list,
58                                                                          guint       position);
59 
60 GLIB_AVAILABLE_IN_2_44
61 GObject *               g_list_model_get_object                         (GListModel *list,
62                                                                          guint       position);
63 
64 GLIB_AVAILABLE_IN_2_44
65 void                    g_list_model_items_changed                      (GListModel *list,
66                                                                          guint       position,
67                                                                          guint       removed,
68                                                                          guint       added);
69 
70 G_END_DECLS
71 
72 #endif /* __G_LIST_MODEL_H__ */
73