143
138
return cTimeString;
146
static void _cd_powermanager_dialog (GString *sInfo) {
147
cd_debug ("%s", __func__);
148
gchar *cIconPath = NULL;
141
static void _cd_powermanager_dialog (const gchar *cInfo, int iDuration)
143
cairo_dock_remove_dialog_if_any (myIcon);
145
const gchar *cIconPath;
150
146
if (!myData.on_battery || !myData.battery_present)
151
cIconPath = g_strdup_printf("%s/%s", MY_APPLET_SHARE_DATA_DIR, "sector.svg");
147
cIconPath = MY_APPLET_SHARE_DATA_DIR"/sector.svg";
153
cIconPath = g_strdup_printf("%s/%s", MY_APPLET_SHARE_DATA_DIR, "default-battery.svg");
155
cd_debug ("%s (%s)", sInfo->str, cIconPath);
156
cairo_dock_show_temporary_dialog_with_icon (sInfo->str, myIcon, myContainer, 6000, cIconPath);
149
cIconPath = MY_APPLET_SHARE_DATA_DIR"/default-battery.svg";
151
cd_debug ("%s (%s)", cInfo, cIconPath);
152
cairo_dock_show_temporary_dialog_with_icon (cInfo, myIcon, myContainer, 1000*iDuration, cIconPath);
160
155
void cd_powermanager_bubble (void)
162
cd_debug ("%s", __func__);
163
157
GString *sInfo = g_string_new ("");
164
158
if(myData.battery_present)
170
164
hms = g_strdup_printf ("%s", D_("Unknown"));
171
165
if(myData.on_battery)
173
g_string_printf (sInfo, "%s %.2f%% \n %s %s", D_("Laptop on Battery.\n Battery charged at:"), myData.battery_charge, D_("Estimated time with Charge:"), hms);
167
g_string_printf (sInfo, "%s %.2f%% \n %s %s", D_("Laptop on Battery.\n Battery charged at:"), myData.battery_charge, D_("Estimated time with charge:"), hms);
177
g_string_printf (sInfo, "%s %.2f%% \n %s %s", D_("Laptop on Charge.\n Battery charged at:"), myData.battery_charge, D_("Estimated Charge time:"), hms);
171
g_string_printf (sInfo, "%s %.2f%% \n %s %s", D_("Laptop on Charge.\n Battery charged at:"), myData.battery_charge, D_("Estimated charge time:"), hms);
183
g_string_printf (sInfo, "%s", D_("No Battery found."));
177
g_string_printf (sInfo, "%s", D_("No battery found."));
186
_cd_powermanager_dialog (sInfo);
180
_cd_powermanager_dialog (sInfo->str, 6000);
187
181
g_string_free (sInfo, TRUE);
201
195
if ((alert == POWER_MANAGER_CHARGE_LOW && myConfig.lowBatteryWitness) || (alert == POWER_MANAGER_CHARGE_CRITICAL && myConfig.criticalBatteryWitness))
203
g_string_printf (sInfo, "%s (%.2f%%) \n %s %s \n %s", D_("PowerManager.\nBattery charge seems to be low"), myData.battery_charge, D_("Estimated time with Charge:"), hms, D_("Please put your Laptop on charge."));
204
_cd_powermanager_dialog (sInfo);
197
if (myConfig.iNotificationType != 1)
199
g_string_printf (sInfo, "%s (%.2f%%) \n %s %s \n %s", D_("PowerManager.\nBattery charge seems to be low"), myData.battery_charge, D_("Estimated time with charge:"), hms, D_("Please put your laptop on charge."));
200
_cd_powermanager_dialog (sInfo->str, myConfig.iNotificationDuration);
202
if (myConfig.iNotificationType != 2)
204
CD_APPLET_DEMANDS_ATTENTION (myConfig.cNotificationAnimation, myConfig.iNotificationDuration);
206
if (myConfig.cSoundPath[alert] != NULL)
207
cairo_dock_play_sound (myConfig.cSoundPath[alert]);
207
209
else if (alert == POWER_MANAGER_CHARGE_FULL && myConfig.highBatteryWitness)
209
g_string_printf (sInfo, "%s (%.2f%%) \n %s %s ", D_("PowerManager.\nYour battery is now Charged"), myData.battery_charge, D_("Estimated time with Charge:"), hms);
210
_cd_powermanager_dialog (sInfo);
211
if (myConfig.cSoundPath[POWER_MANAGER_CHARGE_FULL] != NULL)
212
cairo_dock_play_sound (myConfig.cSoundPath[POWER_MANAGER_CHARGE_FULL]);
214
if (myConfig.batteryWitness)
216
CD_APPLET_ANIMATE_MY_ICON ("rotate", 3);
211
if (myConfig.iNotificationType != 1)
213
g_string_printf (sInfo, "%s (%.2f%%) \n %s %s ", D_("PowerManager.\nYour battery is now charged"), myData.battery_charge, D_("Estimated time with charge:"), hms);
214
_cd_powermanager_dialog (sInfo->str, myConfig.iNotificationDuration);
216
if (myConfig.iNotificationType != 2)
218
CD_APPLET_DEMANDS_ATTENTION (myConfig.cNotificationAnimation, myConfig.iNotificationDuration);
220
if (myConfig.cSoundPath[alert] != NULL)
221
cairo_dock_play_sound (myConfig.cSoundPath[alert]);