1 /*
2  * applications-menu-model: A list model containing menu items
3  *                          of applications
4  *
5  * Copyright 2012-2020 Stephan Haller <nomad@froevel.de>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20  * MA 02110-1301, USA.
21  *
22  *
23  */
24 
25 #ifndef __LIBXFDASHBOARD_APPLICATIONS_MENU_MODEL__
26 #define __LIBXFDASHBOARD_APPLICATIONS_MENU_MODEL__
27 
28 #if !defined(__LIBXFDASHBOARD_H_INSIDE__) && !defined(LIBXFDASHBOARD_COMPILATION)
29 #error "Only <libxfdashboard/libxfdashboard.h> can be included directly."
30 #endif
31 
32 #include <garcon/garcon.h>
33 
34 #include <libxfdashboard/model.h>
35 
36 G_BEGIN_DECLS
37 
38 #define XFDASHBOARD_TYPE_APPLICATIONS_MENU_MODEL			(xfdashboard_applications_menu_model_get_type())
39 #define XFDASHBOARD_APPLICATIONS_MENU_MODEL(obj)			(G_TYPE_CHECK_INSTANCE_CAST((obj), XFDASHBOARD_TYPE_APPLICATIONS_MENU_MODEL, XfdashboardApplicationsMenuModel))
40 #define XFDASHBOARD_IS_APPLICATIONS_MENU_MODEL(obj)			(G_TYPE_CHECK_INSTANCE_TYPE((obj), XFDASHBOARD_TYPE_APPLICATIONS_MENU_MODEL))
41 #define XFDASHBOARD_APPLICATIONS_MENU_MODEL_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST((klass), XFDASHBOARD_TYPE_APPLICATIONS_MENU_MODEL, XfdashboardApplicationsMenuModelClass))
42 #define XFDASHBOARD_IS_APPLICATIONS_MENU_MODEL_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE((klass), XFDASHBOARD_TYPE_APPLICATIONS_MENU_MODEL))
43 #define XFDASHBOARD_APPLICATIONS_MENU_MODEL_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS((obj), XFDASHBOARD_TYPE_APPLICATIONS_MENU_MODEL, XfdashboardApplicationsMenuModelClass))
44 
45 typedef struct _XfdashboardApplicationsMenuModel			XfdashboardApplicationsMenuModel;
46 typedef struct _XfdashboardApplicationsMenuModelPrivate		XfdashboardApplicationsMenuModelPrivate;
47 typedef struct _XfdashboardApplicationsMenuModelClass		XfdashboardApplicationsMenuModelClass;
48 
49 struct _XfdashboardApplicationsMenuModel
50 {
51 	/*< private >*/
52 	/* Parent instance */
53 	XfdashboardModel							parent_instance;
54 
55 	/* Private structure */
56 	XfdashboardApplicationsMenuModelPrivate		*priv;
57 };
58 
59 struct _XfdashboardApplicationsMenuModelClass
60 {
61 	/*< private >*/
62 	/* Parent class */
63 	XfdashboardModelClass						parent_class;
64 
65 	/*< public >*/
66 	/* Virtual functions */
67 	void (*loaded)(XfdashboardApplicationsMenuModel *self);
68 };
69 
70 /* Public API */
71 
72 /* Columns of model */
73 enum
74 {
75 	XFDASHBOARD_APPLICATIONS_MENU_MODEL_COLUMN_SEQUENCE_ID,
76 
77 	XFDASHBOARD_APPLICATIONS_MENU_MODEL_COLUMN_MENU_ELEMENT,
78 	XFDASHBOARD_APPLICATIONS_MENU_MODEL_COLUMN_PARENT_MENU,
79 	XFDASHBOARD_APPLICATIONS_MENU_MODEL_COLUMN_SECTION,
80 
81 	XFDASHBOARD_APPLICATIONS_MENU_MODEL_COLUMN_TITLE,
82 	XFDASHBOARD_APPLICATIONS_MENU_MODEL_COLUMN_DESCRIPTION,
83 
84 	XFDASHBOARD_APPLICATIONS_MENU_MODEL_COLUMN_LAST
85 };
86 
87 GType xfdashboard_applications_menu_model_get_type(void) G_GNUC_CONST;
88 
89 XfdashboardModel* xfdashboard_applications_menu_model_new(void);
90 
91 void xfdashboard_applications_menu_model_get(XfdashboardApplicationsMenuModel *self,
92 												XfdashboardModelIter *inIter,
93 												...);
94 
95 void xfdashboard_applications_menu_model_filter_by_menu(XfdashboardApplicationsMenuModel *self,
96 														GarconMenu *inMenu);
97 void xfdashboard_applications_menu_model_filter_by_section(XfdashboardApplicationsMenuModel *self,
98 															GarconMenu *inSection);
99 
100 G_END_DECLS
101 
102 #endif	/* __LIBXFDASHBOARD_APPLICATIONS_MENU_MODEL__ */
103 
104