2
* This file is a part of the Cairo-Dock project
4
* Copyright : (C) see the 'copyright' file.
5
* E-mail : see the 'copyright' file.
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation; either version 3
10
* of the License, or (at your option) any later version.
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
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20
#ifndef __POWERMANAGER_STRUCT__
21
#define __POWERMANAGER_STRUCT__
23
#include <cairo-dock.h>
24
#ifdef CD_UPOWER_AVAILABLE
28
typedef enum _CDPowermanagerDisplayType {
29
CD_POWERMANAGER_GAUGE=0,
30
CD_POWERMANAGER_GRAPH,
31
CD_POWERMANAGER_ICONS,
32
CD_POWERMANAGER_NB_TYPES
33
} CDPowermanagerDisplayType;
36
POWER_MANAGER_NOTHING = 0,
39
POWER_MANAGER_NB_QUICK_INFO_TYPE
40
} MyAppletQuickInfoType;
44
POWER_MANAGER_CHARGE_CRITICAL = 0,
45
POWER_MANAGER_CHARGE_LOW,
46
POWER_MANAGER_CHARGE_FULL,
47
POWER_MANAGER_NB_CHARGE_LEVEL,
51
struct _AppletConfig {
53
MyAppletQuickInfoType quickInfoType;
56
CDPowermanagerDisplayType iDisplayType;
57
CairoDockTypeGraph iGraphType;
62
gint iNotificationType;
63
gchar *cNotificationAnimation;
64
gint iNotificationDuration;
65
gboolean highBatteryWitness;
66
gboolean lowBatteryWitness;
67
gboolean criticalBatteryWitness;
70
gchar *cSoundPath[POWER_MANAGER_NB_CHARGE_LEVEL];
72
gdouble fLastDischargeMeanRate;
73
gdouble fLastChargeMeanRate;
75
gchar *cUserBatteryIconName;
76
gchar *cUserChargeIconName;
77
gchar *cEmblemIconName;
78
gboolean bHideNotOnBattery;
82
#ifdef CD_UPOWER_AVAILABLE
84
UpClient *pUPowerClient;
85
GList *pBatteryDeviceList;
90
GldiTask *pTask; // async task to find the available backend (launched on startup)
93
#ifdef CD_UPOWER_AVAILABLE
94
UpClient *pUPowerClient;
95
GList *pSignalIDList; // SID for the "battery properties changed" signal of the UPower battery device
97
gint iSignalIDRemoved;
99
GList *pBatteryDeviceList;
102
gchar *cBatteryStateFilePath; // path to the ACPI file
103
gboolean bProcAcpiFound; // TRUE if in /proc/acpi (old format)
104
gboolean bSysClassFound; // TRUE if in /sys/class (new format)
105
gint checkLoop; // SID of the check loop is no UPower
111
gdouble fMaxAvailableCapacity;
116
gboolean bBatteryPresent;
118
gint iPrevPercentage;
119
gboolean bPrevOnBattery;
124
gdouble fChargeMeanRate;
125
gint iNbChargeMeasures;
126
gdouble fDischargeMeanRate;
127
gint iNbDischargeMeasures;
129
gint iStatPercentage;
130
gint iStatPercentageBegin;
134
gint iOnBatteryImage; // -1 = no image yet, 0 = charging, 1 = on battery