1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
2  *
3  * Copyright (C) 2005-2007 Richard Hughes <richard@hughsie.com>
4  * Copyright (C) 2004-2005 William Jon McCann <mccann@jhu.edu>
5  * Copyright (C) 2012-2021 MATE Developers
6  *
7  * Licensed under the GNU General Public License Version 2
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
23 
24 #ifndef __GPM_BACKLIGHT_H
25 #define __GPM_BACKLIGHT_H
26 
27 #include <glib-object.h>
28 
29 G_BEGIN_DECLS
30 
31 #define GPM_TYPE_BACKLIGHT		(gpm_backlight_get_type ())
32 #define GPM_BACKLIGHT(o)		(G_TYPE_CHECK_INSTANCE_CAST ((o), GPM_TYPE_BACKLIGHT, GpmBacklight))
33 #define GPM_BACKLIGHT_CLASS(k)		(G_TYPE_CHECK_CLASS_CAST((k), GPM_TYPE_BACKLIGHT, GpmBacklightClass))
34 #define GPM_IS_BACKLIGHT(o)		(G_TYPE_CHECK_INSTANCE_TYPE ((o), GPM_TYPE_BACKLIGHT))
35 #define GPM_IS_BACKLIGHT_CLASS(k)	(G_TYPE_CHECK_CLASS_TYPE ((k), GPM_TYPE_BACKLIGHT))
36 #define GPM_BACKLIGHT_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), GPM_TYPE_BACKLIGHT, GpmBacklightClass))
37 
38 typedef struct GpmBacklightPrivate GpmBacklightPrivate;
39 
40 typedef struct
41 {
42 	GObject		         parent;
43 	GpmBacklightPrivate *priv;
44 } GpmBacklight;
45 
46 typedef struct
47 {
48 	GObjectClass	parent_class;
49 	void		(* brightness_changed)		(GpmBacklight	*backlight,
50 							 gint		 brightness);
51 } GpmBacklightClass;
52 
53 typedef enum
54 {
55 	 GPM_BACKLIGHT_ERROR_GENERAL,
56 	 GPM_BACKLIGHT_ERROR_DATA_NOT_AVAILABLE,
57 	 GPM_BACKLIGHT_ERROR_HARDWARE_NOT_PRESENT
58 } GpmBacklightError;
59 
60 GType		 gpm_backlight_get_type			(void);
61 GQuark		 gpm_backlight_error_quark		(void);
62 GpmBacklight	*gpm_backlight_new			(void);
63 
64 gboolean	 gpm_backlight_get_brightness		(GpmBacklight	*backlight,
65 							 guint		*brightness,
66 							 GError		**error);
67 gboolean	 gpm_backlight_set_brightness		(GpmBacklight	*backlight,
68 							 guint		 brightness,
69 							 GError		**error);
70 
71 G_END_DECLS
72 
73 #endif /* __GPM_BACKLIGHT_H */
74 
75