]>
Commit | Line | Data |
---|---|---|
2dc837f3 JR |
1 | From d7252850d8070a0d8247d4af9d8930014f2a423b Mon Sep 17 00:00:00 2001 |
2 | From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Guelfucci?= <jeromeg@xfce.org> | |
3 | Date: Sun, 11 Aug 2013 22:40:11 +0200 | |
4 | Subject: [PATCH 081/219] Fix typo. | |
5 | ||
6 | --- | |
7 | src/xfpm-battery.c | 252 ++++++++++++++++++++++++++--------------------------- | |
8 | 1 file changed, 126 insertions(+), 126 deletions(-) | |
9 | ||
10 | diff --git a/src/xfpm-battery.c b/src/xfpm-battery.c | |
11 | index 34a1da1..b3690d2 100644 | |
12 | --- a/src/xfpm-battery.c | |
13 | +++ b/src/xfpm-battery.c | |
14 | @@ -55,9 +55,9 @@ struct XfpmBatteryPrivate | |
15 | XfpmButton *button; | |
16 | DBusGProxy *proxy; | |
17 | DBusGProxy *proxy_prop; | |
18 | - | |
19 | + | |
20 | gchar *icon_prefix; | |
21 | - | |
22 | + | |
23 | XfpmBatteryCharge charge; | |
24 | XfpmDeviceState state; | |
25 | XfpmDeviceType type; | |
26 | @@ -68,10 +68,10 @@ struct XfpmBatteryPrivate | |
27 | gint64 time_to_empty; | |
28 | ||
29 | const gchar *battery_name; | |
30 | - | |
31 | + | |
32 | gulong sig; | |
33 | gulong sig_bt; | |
34 | - | |
35 | + | |
36 | guint notify_idle; | |
37 | }; | |
38 | ||
39 | @@ -82,7 +82,7 @@ enum | |
40 | PROP_CHARGE_STATUS, | |
41 | PROP_DEVICE_TYPE | |
42 | }; | |
43 | - | |
44 | + | |
45 | enum | |
46 | { | |
47 | BATTERY_CHARGE_CHANGED, | |
48 | @@ -96,27 +96,27 @@ G_DEFINE_TYPE (XfpmBattery, xfpm_battery, GTK_TYPE_STATUS_ICON) | |
49 | static const gchar * G_GNUC_CONST | |
50 | xfpm_battery_get_icon_index (XfpmDeviceType type, guint percent) | |
51 | { | |
52 | - if (percent < 10) | |
53 | + if (percent < 10) | |
54 | { | |
55 | return "000"; | |
56 | - } | |
57 | - else if (percent < 30) | |
58 | + } | |
59 | + else if (percent < 30) | |
60 | { | |
61 | return ( (type == XFPM_DEVICE_TYPE_BATTERY || type == XFPM_DEVICE_TYPE_UPS) ? "020" : "030"); | |
62 | - } | |
63 | - else if (percent < 50) | |
64 | + } | |
65 | + else if (percent < 50) | |
66 | { | |
67 | return ( (type == XFPM_DEVICE_TYPE_BATTERY || type == XFPM_DEVICE_TYPE_UPS ) ? "040" : "030"); | |
68 | - } | |
69 | - else if (percent < 70) | |
70 | + } | |
71 | + else if (percent < 70) | |
72 | { | |
73 | return "060"; | |
74 | - } | |
75 | - else if (percent < 90) | |
76 | + } | |
77 | + else if (percent < 90) | |
78 | { | |
79 | return ((type == XFPM_DEVICE_TYPE_BATTERY || type == XFPM_DEVICE_TYPE_UPS) ? "080" : "060"); | |
80 | } | |
81 | - | |
82 | + | |
83 | return "100"; | |
84 | } | |
85 | ||
86 | @@ -125,11 +125,11 @@ xfpm_battery_refresh_visible (XfpmBattery *battery) | |
87 | { | |
88 | XfpmShowIcon show_icon; | |
89 | gboolean visible = TRUE; | |
90 | - | |
91 | + | |
92 | g_object_get (G_OBJECT (battery->priv->conf), | |
93 | SHOW_TRAY_ICON_CFG, &show_icon, | |
94 | NULL); | |
95 | - | |
96 | + | |
97 | if ( show_icon == SHOW_ICON_ALWAYS ) | |
98 | visible = TRUE; | |
99 | else if ( show_icon == NEVER_SHOW_ICON ) | |
100 | @@ -148,7 +148,7 @@ xfpm_battery_refresh_visible (XfpmBattery *battery) | |
101 | } | |
102 | ||
103 | XFPM_DEBUG_ENUM (show_icon, XFPM_TYPE_SHOW_ICON, "visible=%s", xfpm_bool_to_string (visible)); | |
104 | - | |
105 | + | |
106 | gtk_status_icon_set_visible (GTK_STATUS_ICON (battery), visible); | |
107 | } | |
108 | ||
109 | @@ -166,13 +166,13 @@ xfpm_battery_get_time_string (guint seconds) | |
110 | /* Add 0.5 to do rounding */ | |
111 | minutes = (int) ( ( seconds / 60.0 ) + 0.5 ); | |
112 | ||
113 | - if (minutes == 0) | |
114 | + if (minutes == 0) | |
115 | { | |
116 | timestring = g_strdup (_("Unknown time")); | |
117 | return timestring; | |
118 | } | |
119 | ||
120 | - if (minutes < 60) | |
121 | + if (minutes < 60) | |
122 | { | |
123 | timestring = g_strdup_printf (ngettext ("%i minute", | |
124 | "%i minutes", | |
125 | @@ -201,8 +201,8 @@ static gchar * | |
126 | xfpm_battery_get_message_from_battery_state (XfpmBattery *battery) | |
127 | { | |
128 | gchar *msg = NULL; | |
129 | - | |
130 | - | |
131 | + | |
132 | + | |
133 | if (battery->priv->type == XFPM_DEVICE_TYPE_BATTERY || battery->priv->type == XFPM_DEVICE_TYPE_UPS) | |
134 | { | |
135 | switch (battery->priv->state) | |
136 | @@ -212,16 +212,16 @@ xfpm_battery_get_message_from_battery_state (XfpmBattery *battery) | |
137 | break; | |
138 | case XFPM_DEVICE_STATE_CHARGING: | |
139 | msg = g_strdup_printf (_("Your %s is charging"), battery->priv->battery_name); | |
140 | - | |
141 | + | |
142 | if ( battery->priv->time_to_full != 0 ) | |
143 | { | |
144 | gchar *tmp, *est_time_str; | |
145 | tmp = g_strdup (msg); | |
146 | g_free (msg); | |
147 | - | |
148 | + | |
149 | est_time_str = xfpm_battery_get_time_string (battery->priv->time_to_full); | |
150 | - | |
151 | - msg = g_strdup_printf (_("%s (%i%%)\n%s until is fully charged."), tmp, battery->priv->percentage, est_time_str); | |
152 | + | |
153 | + msg = g_strdup_printf (_("%s (%i%%)\n%s until it is fully charged."), tmp, battery->priv->percentage, est_time_str); | |
154 | g_free (est_time_str); | |
155 | g_free (tmp); | |
156 | } | |
157 | @@ -232,15 +232,15 @@ xfpm_battery_get_message_from_battery_state (XfpmBattery *battery) | |
158 | msg = g_strdup_printf (_("Your %s is discharging"), battery->priv->battery_name); | |
159 | else | |
160 | msg = g_strdup_printf (_("System is running on %s power"), battery->priv->battery_name); | |
161 | - | |
162 | + | |
163 | if ( battery->priv->time_to_empty != 0 ) | |
164 | { | |
165 | gchar *tmp, *est_time_str; | |
166 | tmp = g_strdup (msg); | |
167 | g_free (msg); | |
168 | - | |
169 | + | |
170 | est_time_str = xfpm_battery_get_time_string (battery->priv->time_to_empty); | |
171 | - | |
172 | + | |
173 | msg = g_strdup_printf (_("%s (%i%%)\nEstimated time left is %s."), tmp, battery->priv->percentage, est_time_str); | |
174 | g_free (tmp); | |
175 | g_free (est_time_str); | |
176 | @@ -252,7 +252,7 @@ xfpm_battery_get_message_from_battery_state (XfpmBattery *battery) | |
177 | default: | |
178 | break; | |
179 | } | |
180 | - | |
181 | + | |
182 | } | |
183 | else if (battery->priv->type >= XFPM_DEVICE_TYPE_MONITOR) | |
184 | { | |
185 | @@ -274,7 +274,7 @@ xfpm_battery_get_message_from_battery_state (XfpmBattery *battery) | |
186 | break; | |
187 | } | |
188 | } | |
189 | - | |
190 | + | |
191 | return msg; | |
192 | } | |
193 | ||
194 | @@ -282,10 +282,10 @@ static void | |
195 | xfpm_battery_refresh_icon (XfpmBattery *battery) | |
196 | { | |
197 | gchar icon_name[128]; | |
198 | - | |
199 | + | |
200 | XFPM_DEBUG ("Battery state %d", battery->priv->state); | |
201 | - | |
202 | - if ( battery->priv->type == XFPM_DEVICE_TYPE_BATTERY || | |
203 | + | |
204 | + if ( battery->priv->type == XFPM_DEVICE_TYPE_BATTERY || | |
205 | battery->priv->type == XFPM_DEVICE_TYPE_UPS ) | |
206 | { | |
207 | if (!battery->priv->present) | |
208 | @@ -296,19 +296,19 @@ xfpm_battery_refresh_icon (XfpmBattery *battery) | |
209 | { | |
210 | g_snprintf (icon_name, 128, "%s%s", battery->priv->icon_prefix, battery->priv->ac_online ? "charged" : "100"); | |
211 | } | |
212 | - else if ( battery->priv->state == XFPM_DEVICE_STATE_CHARGING || | |
213 | + else if ( battery->priv->state == XFPM_DEVICE_STATE_CHARGING || | |
214 | battery->priv->state == XFPM_DEVICE_STATE_PENDING_CHARGING) | |
215 | { | |
216 | - g_snprintf (icon_name, 128, "%s%s-%s", | |
217 | - battery->priv->icon_prefix, | |
218 | + g_snprintf (icon_name, 128, "%s%s-%s", | |
219 | + battery->priv->icon_prefix, | |
220 | xfpm_battery_get_icon_index (battery->priv->type, battery->priv->percentage), | |
221 | "charging"); | |
222 | } | |
223 | else if ( battery->priv->state == XFPM_DEVICE_STATE_DISCHARGING || | |
224 | battery->priv->state == XFPM_DEVICE_STATE_PENDING_DISCHARGING) | |
225 | { | |
226 | - g_snprintf (icon_name, 128, "%s%s", | |
227 | - battery->priv->icon_prefix, | |
228 | + g_snprintf (icon_name, 128, "%s%s", | |
229 | + battery->priv->icon_prefix, | |
230 | xfpm_battery_get_icon_index (battery->priv->type, battery->priv->percentage)); | |
231 | } | |
232 | else if ( battery->priv->state == XFPM_DEVICE_STATE_EMPTY) | |
233 | @@ -328,12 +328,12 @@ xfpm_battery_refresh_icon (XfpmBattery *battery) | |
234 | } | |
235 | else if ( battery->priv->state == XFPM_DEVICE_STATE_DISCHARGING ) | |
236 | { | |
237 | - g_snprintf (icon_name, 128, "%s-%s", | |
238 | - battery->priv->icon_prefix, | |
239 | + g_snprintf (icon_name, 128, "%s-%s", | |
240 | + battery->priv->icon_prefix, | |
241 | xfpm_battery_get_icon_index (battery->priv->type, battery->priv->percentage)); | |
242 | } | |
243 | } | |
244 | - | |
245 | + | |
246 | gtk_status_icon_set_from_icon_name (GTK_STATUS_ICON (battery), icon_name); | |
247 | } | |
248 | ||
249 | @@ -341,21 +341,21 @@ static void | |
250 | xfpm_battery_notify (XfpmBattery *battery) | |
251 | { | |
252 | gchar *message = NULL; | |
253 | - | |
254 | + | |
255 | message = xfpm_battery_get_message_from_battery_state (battery); | |
256 | - | |
257 | + | |
258 | if ( !message ) | |
259 | return; | |
260 | - | |
261 | - xfpm_notify_show_notification (battery->priv->notify, | |
262 | - _("Power Manager"), | |
263 | - message, | |
264 | + | |
265 | + xfpm_notify_show_notification (battery->priv->notify, | |
266 | + _("Power Manager"), | |
267 | + message, | |
268 | gtk_status_icon_get_icon_name (GTK_STATUS_ICON (battery)), | |
269 | 8000, | |
270 | FALSE, | |
271 | XFPM_NOTIFY_NORMAL, | |
272 | GTK_STATUS_ICON (battery)); | |
273 | - | |
274 | + | |
275 | g_free (message); | |
276 | } | |
277 | ||
278 | @@ -363,10 +363,10 @@ static gboolean | |
279 | xfpm_battery_notify_idle (gpointer data) | |
280 | { | |
281 | XfpmBattery *battery = XFPM_BATTERY (data); | |
282 | - | |
283 | + | |
284 | xfpm_battery_notify (battery); | |
285 | battery->priv->notify_idle = 0; | |
286 | - | |
287 | + | |
288 | return FALSE; | |
289 | } | |
290 | ||
291 | @@ -375,10 +375,10 @@ xfpm_battery_notify_state (XfpmBattery *battery) | |
292 | { | |
293 | gboolean notify; | |
294 | static gboolean starting_up = TRUE; | |
295 | - | |
296 | + | |
297 | if ( !gtk_status_icon_get_visible (GTK_STATUS_ICON (battery)) ) | |
298 | return; | |
299 | - | |
300 | + | |
301 | if ( battery->priv->type == XFPM_DEVICE_TYPE_BATTERY || | |
302 | battery->priv->type == XFPM_DEVICE_TYPE_UPS ) | |
303 | { | |
304 | @@ -387,11 +387,11 @@ xfpm_battery_notify_state (XfpmBattery *battery) | |
305 | starting_up = FALSE; | |
306 | return; | |
307 | } | |
308 | - | |
309 | + | |
310 | g_object_get (G_OBJECT (battery->priv->conf), | |
311 | GENERAL_NOTIFICATION_CFG, ¬ify, | |
312 | NULL); | |
313 | - | |
314 | + | |
315 | if ( notify ) | |
316 | { | |
317 | if (battery->priv->notify_idle == 0) | |
318 | @@ -409,24 +409,24 @@ xfpm_battery_set_tooltip_primary (XfpmBattery *battery, GtkTooltip *tooltip) | |
319 | gchar *tip; | |
320 | gchar *est_time_str = NULL; | |
321 | gchar *power_status = NULL; | |
322 | - | |
323 | + | |
324 | power_status = g_strdup_printf (battery->priv->ac_online ? _("Adaptor is online") : _("System is running on battery power")); | |
325 | - | |
326 | + | |
327 | if ( battery->priv->state == XFPM_DEVICE_STATE_FULLY_CHARGED ) | |
328 | { | |
329 | if ( battery->priv->time_to_empty > 0 ) | |
330 | { | |
331 | est_time_str = xfpm_battery_get_time_string (battery->priv->time_to_empty); | |
332 | - tip = g_strdup_printf (_("%s\nYour %s is fully charged (%i%%).\nProvides %s runtime"), | |
333 | + tip = g_strdup_printf (_("%s\nYour %s is fully charged (%i%%).\nProvides %s runtime"), | |
334 | power_status, | |
335 | - battery->priv->battery_name, | |
336 | + battery->priv->battery_name, | |
337 | battery->priv->percentage, | |
338 | est_time_str); | |
339 | g_free (est_time_str); | |
340 | } | |
341 | else | |
342 | { | |
343 | - tip = g_strdup_printf (_("%s\nYour %s is fully charged (%i%%)."), | |
344 | + tip = g_strdup_printf (_("%s\nYour %s is fully charged (%i%%)."), | |
345 | power_status, | |
346 | battery->priv->battery_name, | |
347 | battery->priv->percentage); | |
348 | @@ -437,10 +437,10 @@ xfpm_battery_set_tooltip_primary (XfpmBattery *battery, GtkTooltip *tooltip) | |
349 | if ( battery->priv->time_to_full != 0 ) | |
350 | { | |
351 | est_time_str = xfpm_battery_get_time_string (battery->priv->time_to_full); | |
352 | - tip = g_strdup_printf (_("%s\nYour %s is charging (%i%%)\n%s until is fully charged."), | |
353 | + tip = g_strdup_printf (_("%s\nYour %s is charging (%i%%)\n%s until is fully charged."), | |
354 | power_status, | |
355 | - battery->priv->battery_name, | |
356 | - battery->priv->percentage, | |
357 | + battery->priv->battery_name, | |
358 | + battery->priv->percentage, | |
359 | est_time_str); | |
360 | g_free (est_time_str); | |
361 | } | |
362 | @@ -457,10 +457,10 @@ xfpm_battery_set_tooltip_primary (XfpmBattery *battery, GtkTooltip *tooltip) | |
363 | if ( battery->priv->time_to_empty != 0 ) | |
364 | { | |
365 | est_time_str = xfpm_battery_get_time_string (battery->priv->time_to_empty); | |
366 | - tip = g_strdup_printf (_("%s\nYour %s is discharging (%i%%)\nEstimated time left is %s."), | |
367 | + tip = g_strdup_printf (_("%s\nYour %s is discharging (%i%%)\nEstimated time left is %s."), | |
368 | power_status, | |
369 | - battery->priv->battery_name, | |
370 | - battery->priv->percentage, | |
371 | + battery->priv->battery_name, | |
372 | + battery->priv->percentage, | |
373 | est_time_str); | |
374 | g_free (est_time_str); | |
375 | } | |
376 | @@ -471,7 +471,7 @@ xfpm_battery_set_tooltip_primary (XfpmBattery *battery, GtkTooltip *tooltip) | |
377 | battery->priv->battery_name, | |
378 | battery->priv->percentage); | |
379 | } | |
380 | - | |
381 | + | |
382 | } | |
383 | else if ( battery->priv->state == XFPM_DEVICE_STATE_PENDING_CHARGING ) | |
384 | { | |
385 | @@ -485,7 +485,7 @@ xfpm_battery_set_tooltip_primary (XfpmBattery *battery, GtkTooltip *tooltip) | |
386 | { | |
387 | tip = g_strdup_printf (_("%s\nYour %s is empty"), power_status, battery->priv->battery_name); | |
388 | } | |
389 | - | |
390 | + | |
391 | gtk_tooltip_set_text (tooltip, tip); | |
392 | g_free (power_status); | |
393 | g_free (tip); | |
394 | @@ -496,20 +496,20 @@ xfpm_battery_check_charge (XfpmBattery *battery) | |
395 | { | |
396 | XfpmBatteryCharge charge; | |
397 | guint critical_level, low_level; | |
398 | - | |
399 | + | |
400 | g_object_get (G_OBJECT (battery->priv->conf), | |
401 | CRITICAL_POWER_LEVEL, &critical_level, | |
402 | NULL); | |
403 | - | |
404 | + | |
405 | low_level = critical_level + 10; | |
406 | - | |
407 | + | |
408 | if ( battery->priv->percentage > low_level ) | |
409 | charge = XFPM_BATTERY_CHARGE_OK; | |
410 | else if ( battery->priv->percentage <= low_level && battery->priv->percentage > critical_level ) | |
411 | charge = XFPM_BATTERY_CHARGE_LOW; | |
412 | else if ( battery->priv->percentage <= critical_level ) | |
413 | charge = XFPM_BATTERY_CHARGE_CRITICAL; | |
414 | - | |
415 | + | |
416 | if ( charge != battery->priv->charge) | |
417 | { | |
418 | battery->priv->charge = charge; | |
419 | @@ -527,24 +527,24 @@ xfpm_battery_refresh (XfpmBattery *battery, GHashTable *props) | |
420 | { | |
421 | GValue *value; | |
422 | guint state; | |
423 | - | |
424 | + | |
425 | value = g_hash_table_lookup (props, "IsPresent"); | |
426 | - | |
427 | + | |
428 | if ( value == NULL ) | |
429 | { | |
430 | g_warning ("No 'IsPresent' property found"); | |
431 | goto out; | |
432 | } | |
433 | - | |
434 | + | |
435 | battery->priv->present = g_value_get_boolean (value); | |
436 | - | |
437 | + | |
438 | value = g_hash_table_lookup (props, "State"); | |
439 | - | |
440 | + | |
441 | if ( value == NULL ) | |
442 | { | |
443 | g_warning ("No 'State' property found"); | |
444 | } | |
445 | - | |
446 | + | |
447 | state = g_value_get_uint (value); | |
448 | if ( state != battery->priv->state ) | |
449 | { | |
450 | @@ -552,45 +552,45 @@ xfpm_battery_refresh (XfpmBattery *battery, GHashTable *props) | |
451 | xfpm_battery_refresh_visible (battery); | |
452 | xfpm_battery_notify_state (battery); | |
453 | } | |
454 | - | |
455 | + | |
456 | value = g_hash_table_lookup (props, "Percentage"); | |
457 | - | |
458 | + | |
459 | if ( value == NULL ) | |
460 | { | |
461 | g_warning ("No 'Percentage' property found on battery device"); | |
462 | goto out; | |
463 | } | |
464 | - | |
465 | + | |
466 | battery->priv->percentage = (guint) g_value_get_double (value); | |
467 | - | |
468 | + | |
469 | xfpm_battery_check_charge (battery); | |
470 | - | |
471 | + | |
472 | xfpm_battery_refresh_icon (battery); | |
473 | - | |
474 | + | |
475 | if ( battery->priv->type == XFPM_DEVICE_TYPE_BATTERY || | |
476 | battery->priv->type == XFPM_DEVICE_TYPE_UPS ) | |
477 | { | |
478 | value = g_hash_table_lookup (props, "TimeToEmpty"); | |
479 | - | |
480 | + | |
481 | if ( value == NULL ) | |
482 | { | |
483 | g_warning ("No 'TimeToEmpty' property found on battery device"); | |
484 | goto out; | |
485 | } | |
486 | - | |
487 | + | |
488 | battery->priv->time_to_empty = g_value_get_int64 (value); | |
489 | - | |
490 | + | |
491 | value = g_hash_table_lookup (props, "TimeToFull"); | |
492 | - | |
493 | + | |
494 | if ( value == NULL ) | |
495 | { | |
496 | g_warning ("No 'TimeToFull' property found on battery device"); | |
497 | goto out; | |
498 | } | |
499 | - | |
500 | + | |
501 | battery->priv->time_to_full = g_value_get_int64 (value); | |
502 | } | |
503 | - | |
504 | + | |
505 | out: | |
506 | g_hash_table_destroy (props); | |
507 | } | |
508 | @@ -606,23 +606,23 @@ static void | |
509 | xfpm_battery_changed_cb (DBusGProxy *proxy, XfpmBattery *battery) | |
510 | { | |
511 | GHashTable *props; | |
512 | - | |
513 | - props = xfpm_power_get_interface_properties (battery->priv->proxy_prop, | |
514 | + | |
515 | + props = xfpm_power_get_interface_properties (battery->priv->proxy_prop, | |
516 | UPOWER_IFACE_DEVICE); | |
517 | - | |
518 | + | |
519 | if ( props ) | |
520 | xfpm_battery_refresh (battery, props); | |
521 | } | |
522 | ||
523 | static gboolean | |
524 | -xfpm_battery_query_tooltip (GtkStatusIcon *icon, | |
525 | +xfpm_battery_query_tooltip (GtkStatusIcon *icon, | |
526 | gint x, | |
527 | gint y, | |
528 | gboolean keyboard_mode, | |
529 | GtkTooltip *tooltip) | |
530 | { | |
531 | XfpmBattery *battery; | |
532 | - | |
533 | + | |
534 | battery = XFPM_BATTERY (icon); | |
535 | ||
536 | if ( battery->priv->type == XFPM_DEVICE_TYPE_BATTERY || | |
537 | @@ -631,7 +631,7 @@ xfpm_battery_query_tooltip (GtkStatusIcon *icon, | |
538 | xfpm_battery_set_tooltip_primary (battery, tooltip); | |
539 | return TRUE; | |
540 | } | |
541 | - | |
542 | + | |
543 | return FALSE; | |
544 | } | |
545 | ||
546 | @@ -647,9 +647,9 @@ static void xfpm_battery_get_property (GObject *object, | |
547 | GParamSpec *pspec) | |
548 | { | |
549 | XfpmBattery *battery; | |
550 | - | |
551 | + | |
552 | battery = XFPM_BATTERY (object); | |
553 | - | |
554 | + | |
555 | switch (prop_id) | |
556 | { | |
557 | case PROP_AC_ONLINE: | |
558 | @@ -673,9 +673,9 @@ static void xfpm_battery_set_property (GObject *object, | |
559 | GParamSpec *pspec) | |
560 | { | |
561 | XfpmBattery *battery; | |
562 | - | |
563 | + | |
564 | battery = XFPM_BATTERY (object); | |
565 | - | |
566 | + | |
567 | switch (prop_id) | |
568 | { | |
569 | case PROP_AC_ONLINE: | |
570 | @@ -700,8 +700,8 @@ xfpm_battery_class_init (XfpmBatteryClass *klass) | |
571 | object_class->set_property = xfpm_battery_set_property; | |
572 | ||
573 | status_icon_class->query_tooltip = xfpm_battery_query_tooltip; | |
574 | - | |
575 | - signals [BATTERY_CHARGE_CHANGED] = | |
576 | + | |
577 | + signals [BATTERY_CHARGE_CHANGED] = | |
578 | g_signal_new ("battery-charge-changed", | |
579 | XFPM_TYPE_BATTERY, | |
580 | G_SIGNAL_RUN_LAST, | |
581 | @@ -709,7 +709,7 @@ xfpm_battery_class_init (XfpmBatteryClass *klass) | |
582 | NULL, NULL, | |
583 | g_cclosure_marshal_VOID__VOID, | |
584 | G_TYPE_NONE, 0, G_TYPE_NONE); | |
585 | - | |
586 | + | |
587 | g_object_class_install_property (object_class, | |
588 | PROP_AC_ONLINE, | |
589 | g_param_spec_boolean("ac-online", | |
590 | @@ -740,7 +740,7 @@ static void | |
591 | xfpm_battery_init (XfpmBattery *battery) | |
592 | { | |
593 | battery->priv = XFPM_BATTERY_GET_PRIVATE (battery); | |
594 | - | |
595 | + | |
596 | battery->priv->conf = xfpm_xfconf_new (); | |
597 | battery->priv->notify = xfpm_notify_new (); | |
598 | battery->priv->proxy_prop = NULL; | |
599 | @@ -752,11 +752,11 @@ xfpm_battery_init (XfpmBattery *battery) | |
600 | battery->priv->time_to_empty = 0; | |
601 | battery->priv->button = xfpm_button_new (); | |
602 | battery->priv->ac_online = TRUE; | |
603 | - | |
604 | + | |
605 | battery->priv->sig = g_signal_connect (G_OBJECT (battery->priv->conf), "notify::" SHOW_TRAY_ICON_CFG, | |
606 | G_CALLBACK (xfpm_battery_tray_icon_settings_changed), battery); | |
607 | - | |
608 | - | |
609 | + | |
610 | + | |
611 | battery->priv->sig_bt = g_signal_connect (G_OBJECT (battery->priv->button), "button-pressed", | |
612 | G_CALLBACK (xfpm_battery_button_pressed_cb), battery); | |
613 | } | |
614 | @@ -767,7 +767,7 @@ xfpm_battery_finalize (GObject *object) | |
615 | XfpmBattery *battery; | |
616 | ||
617 | battery = XFPM_BATTERY (object); | |
618 | - | |
619 | + | |
620 | g_free (battery->priv->icon_prefix); | |
621 | ||
622 | if (battery->priv->notify_idle != 0) | |
623 | @@ -775,13 +775,13 @@ xfpm_battery_finalize (GObject *object) | |
624 | ||
625 | dbus_g_proxy_disconnect_signal (battery->priv->proxy, "Changed", | |
626 | G_CALLBACK (xfpm_battery_changed_cb), battery); | |
627 | - | |
628 | + | |
629 | if ( g_signal_handler_is_connected (battery->priv->conf, battery->priv->sig ) ) | |
630 | g_signal_handler_disconnect (G_OBJECT (battery->priv->conf), battery->priv->sig); | |
631 | - | |
632 | + | |
633 | if ( g_signal_handler_is_connected (battery->priv->button, battery->priv->sig_bt ) ) | |
634 | g_signal_handler_disconnect (G_OBJECT (battery->priv->button), battery->priv->sig_bt); | |
635 | - | |
636 | + | |
637 | g_object_unref (battery->priv->proxy); | |
638 | g_object_unref (battery->priv->proxy_prop); | |
639 | g_object_unref (battery->priv->conf); | |
640 | @@ -798,23 +798,23 @@ xfpm_battery_get_icon_prefix_device_enum_type (XfpmDeviceType type) | |
641 | { | |
642 | return g_strdup (XFPM_PRIMARY_ICON_PREFIX); | |
643 | } | |
644 | - else if ( type == XFPM_DEVICE_TYPE_UPS ) | |
645 | + else if ( type == XFPM_DEVICE_TYPE_UPS ) | |
646 | { | |
647 | return g_strdup (XFPM_UPS_ICON_PREFIX); | |
648 | } | |
649 | - else if ( type == XFPM_DEVICE_TYPE_MOUSE ) | |
650 | + else if ( type == XFPM_DEVICE_TYPE_MOUSE ) | |
651 | { | |
652 | return g_strdup (XFPM_MOUSE_ICON_PREFIX); | |
653 | } | |
654 | - else if ( type == XFPM_DEVICE_TYPE_KBD ) | |
655 | + else if ( type == XFPM_DEVICE_TYPE_KBD ) | |
656 | { | |
657 | return g_strdup (XFPM_KBD_ICON_PREFIX); | |
658 | } | |
659 | - else if ( type == XFPM_DEVICE_TYPE_PHONE ) | |
660 | + else if ( type == XFPM_DEVICE_TYPE_PHONE ) | |
661 | { | |
662 | return g_strdup (XFPM_PHONE_ICON_PREFIX); | |
663 | } | |
664 | - | |
665 | + | |
666 | return g_strdup (XFPM_PRIMARY_ICON_PREFIX); | |
667 | } | |
668 | ||
669 | @@ -822,7 +822,7 @@ static const gchar * | |
670 | xfpm_battery_get_name (XfpmDeviceType type) | |
671 | { | |
672 | const gchar *name = NULL; | |
673 | - | |
674 | + | |
675 | switch (type) | |
676 | { | |
677 | case XFPM_DEVICE_TYPE_BATTERY: | |
678 | @@ -850,7 +850,7 @@ xfpm_battery_get_name (XfpmDeviceType type) | |
679 | name = _("Unknown"); | |
680 | break; | |
681 | } | |
682 | - | |
683 | + | |
684 | return name; | |
685 | } | |
686 | ||
687 | @@ -858,9 +858,9 @@ GtkStatusIcon * | |
688 | xfpm_battery_new (void) | |
689 | { | |
690 | XfpmBattery *battery = NULL; | |
691 | - | |
692 | + | |
693 | battery = g_object_new (XFPM_TYPE_BATTERY, NULL); | |
694 | - | |
695 | + | |
696 | return GTK_STATUS_ICON (battery); | |
697 | } | |
698 | ||
699 | @@ -874,8 +874,8 @@ void xfpm_battery_monitor_device (XfpmBattery *battery, | |
700 | battery->priv->proxy = proxy; | |
701 | battery->priv->icon_prefix = xfpm_battery_get_icon_prefix_device_enum_type (device_type); | |
702 | battery->priv->battery_name = xfpm_battery_get_name (device_type); | |
703 | - | |
704 | - | |
705 | + | |
706 | + | |
707 | dbus_g_proxy_add_signal (proxy, "Changed", G_TYPE_INVALID); | |
708 | dbus_g_proxy_connect_signal (proxy, "Changed", | |
709 | G_CALLBACK (xfpm_battery_changed_cb), battery, NULL); | |
710 | @@ -890,27 +890,27 @@ void xfpm_battery_monitor_device (XfpmBattery *battery, | |
711 | XfpmDeviceType xfpm_battery_get_device_type (XfpmBattery *battery) | |
712 | { | |
713 | g_return_val_if_fail (XFPM_IS_BATTERY (battery), XFPM_DEVICE_TYPE_UNKNOWN ); | |
714 | - | |
715 | + | |
716 | return battery->priv->type; | |
717 | } | |
718 | ||
719 | XfpmBatteryCharge xfpm_battery_get_charge (XfpmBattery *battery) | |
720 | { | |
721 | g_return_val_if_fail (XFPM_IS_BATTERY (battery), XFPM_BATTERY_CHARGE_UNKNOWN); | |
722 | - | |
723 | + | |
724 | return battery->priv->charge; | |
725 | } | |
726 | ||
727 | const gchar *xfpm_battery_get_battery_name (XfpmBattery *battery) | |
728 | { | |
729 | g_return_val_if_fail (XFPM_IS_BATTERY (battery), NULL); | |
730 | - | |
731 | + | |
732 | return battery->priv->battery_name; | |
733 | } | |
734 | ||
735 | gchar *xfpm_battery_get_time_left (XfpmBattery *battery) | |
736 | { | |
737 | g_return_val_if_fail (XFPM_IS_BATTERY (battery), NULL); | |
738 | - | |
739 | + | |
740 | return xfpm_battery_get_time_string (battery->priv->time_to_empty); | |
741 | } | |
742 | -- | |
743 | 1.9.3 | |
744 |