| 1 |
/** |
| 2 |
* This file is a part of the Cairo-Dock project |
| 3 |
* |
| 4 |
* Copyright : (C) see the 'copyright' file. |
| 5 |
* E-mail : see the 'copyright' file. |
| 6 |
* |
| 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. |
| 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 |
* 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/>. |
| 18 |
*/ |
| 19 |
|
| 20 |
#ifndef __POWERMANAGER_STRUCT__ |
| 21 |
#define __POWERMANAGER_STRUCT__ |
| 22 |
|
| 23 |
#include <cairo-dock.h> |
| 24 |
#ifdef CD_UPOWER_AVAILABLE |
| 25 |
#include <upower.h> |
| 26 |
#endif |
| 27 |
|
| 28 |
typedef enum _CDPowermanagerDisplayType { |
| 29 |
CD_POWERMANAGER_GAUGE=0, |
| 30 |
CD_POWERMANAGER_GRAPH, |
| 31 |
CD_POWERMANAGER_ICONS, |
| 32 |
CD_POWERMANAGER_NB_TYPES |
| 33 |
} CDPowermanagerDisplayType; |
| 34 |
|
| 35 |
typedef enum { |
| 36 |
POWER_MANAGER_NOTHING = 0, |
| 37 |
POWER_MANAGER_CHARGE, |
| 38 |
POWER_MANAGER_TIME, |
| 39 |
POWER_MANAGER_NB_QUICK_INFO_TYPE |
| 40 |
} MyAppletQuickInfoType; |
| 41 |
|
| 42 |
|
| 43 |
typedef enum { |
| 44 |
POWER_MANAGER_CHARGE_CRITICAL = 0, |
| 45 |
POWER_MANAGER_CHARGE_LOW, |
| 46 |
POWER_MANAGER_CHARGE_FULL, |
| 47 |
POWER_MANAGER_NB_CHARGE_LEVEL, |
| 48 |
} MyAppletCharge; |
| 49 |
|
| 50 |
|
| 51 |
struct _AppletConfig { |
| 52 |
gchar *defaultTitle; |
| 53 |
MyAppletQuickInfoType quickInfoType; |
| 54 |
gint iCheckInterval; |
| 55 |
|
| 56 |
CDPowermanagerDisplayType iDisplayType; |
| 57 |
CairoDockTypeGraph iGraphType; |
| 58 |
gdouble fLowColor[3]; |
| 59 |
gdouble fHigholor[3]; |
| 60 |
gdouble fBgColor[4]; |
| 61 |
|
| 62 |
gint iNotificationType; |
| 63 |
gchar *cNotificationAnimation; |
| 64 |
gint iNotificationDuration; |
| 65 |
gboolean highBatteryWitness; |
| 66 |
gboolean lowBatteryWitness; |
| 67 |
gboolean criticalBatteryWitness; |
| 68 |
gint lowBatteryValue; |
| 69 |
gchar *cGThemePath; |
| 70 |
gchar *cSoundPath[POWER_MANAGER_NB_CHARGE_LEVEL]; |
| 71 |
|
| 72 |
gdouble fLastDischargeMeanRate; |
| 73 |
gdouble fLastChargeMeanRate; |
| 74 |
|
| 75 |
gchar *cUserBatteryIconName; |
| 76 |
gchar *cUserChargeIconName; |
| 77 |
gchar *cEmblemIconName; |
| 78 |
gboolean bHideNotOnBattery; |
| 79 |
} ; |
| 80 |
|
| 81 |
|
| 82 |
#ifdef CD_UPOWER_AVAILABLE |
| 83 |
typedef struct { |
| 84 |
UpClient *pUPowerClient; |
| 85 |
GList *pBatteryDeviceList; |
| 86 |
} CDSharedMemory; |
| 87 |
#endif |
| 88 |
|
| 89 |
struct _AppletData { |
| 90 |
GldiTask *pTask; // async task to find the available backend (launched on startup) |
| 91 |
|
| 92 |
// UPower |
| 93 |
#ifdef CD_UPOWER_AVAILABLE |
| 94 |
UpClient *pUPowerClient; |
| 95 |
GList *pSignalIDList; // SID for the "battery properties changed" signal of the UPower battery device |
| 96 |
gint iSignalIDAdded; |
| 97 |
gint iSignalIDRemoved; |
| 98 |
#endif |
| 99 |
GList *pBatteryDeviceList; |
| 100 |
|
| 101 |
// ACPI |
| 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 |
| 106 |
|
| 107 |
// Properties |
| 108 |
gchar *cTechnology; |
| 109 |
gchar *cVendor; |
| 110 |
gchar *cModel; |
| 111 |
gdouble fMaxAvailableCapacity; |
| 112 |
|
| 113 |
gint iTime; |
| 114 |
gint iPercentage; |
| 115 |
gboolean bOnBattery; |
| 116 |
gboolean bBatteryPresent; |
| 117 |
gint iPrevTime; |
| 118 |
gint iPrevPercentage; |
| 119 |
gboolean bPrevOnBattery; |
| 120 |
gboolean bIsHidden; |
| 121 |
|
| 122 |
gint iCapacity; |
| 123 |
|
| 124 |
gdouble fChargeMeanRate; |
| 125 |
gint iNbChargeMeasures; |
| 126 |
gdouble fDischargeMeanRate; |
| 127 |
gint iNbDischargeMeasures; |
| 128 |
|
| 129 |
gint iStatPercentage; |
| 130 |
gint iStatPercentageBegin; |
| 131 |
gint iStatTime; |
| 132 |
gint iStatTimeCount; |
| 133 |
|
| 134 |
gint iOnBatteryImage; // -1 = no image yet, 0 = charging, 1 = on battery |
| 135 |
} ; |
| 136 |
|
| 137 |
|
| 138 |
#endif |