122
122
/* battery missing */
123
123
filename = g_strdup_printf ("gpm-%s-missing", prefix);
125
} else if (state == DKP_DEVICE_STATE_EMPTY) {
126
filename = g_strdup_printf ("gpm-%s-empty", prefix);
125
128
} else if (state == DKP_DEVICE_STATE_FULLY_CHARGED) {
126
129
filename = g_strdup_printf ("gpm-%s-charged", prefix);
131
#if !DKP_CHECK_VERSION(0x009)
128
132
} else if (state == DKP_DEVICE_STATE_UNKNOWN && percentage > 95.0f) {
129
133
egg_warning ("fixing up unknown %f", percentage);
130
134
filename = g_strdup_printf ("gpm-%s-charged", prefix);
132
137
} else if (state == DKP_DEVICE_STATE_CHARGING) {
133
138
index_str = gpm_devicekit_get_object_icon_index (device);
136
141
} else if (state == DKP_DEVICE_STATE_DISCHARGING) {
137
142
index_str = gpm_devicekit_get_object_icon_index (device);
138
143
filename = g_strdup_printf ("gpm-%s-%s", prefix, index_str);
145
#if !DKP_CHECK_VERSION(0x009)
146
/* the battery isn't charging or discharging, it's just
147
* sitting there half full doing nothing */
152
/* get battery status */
153
client = dkp_client_new ();
154
g_object_get (client,
155
"on-battery", &on_battery,
157
g_object_unref (client);
159
/* try to find a suitable icon depending on AC state */
161
index_str = gpm_devicekit_get_object_icon_index (device);
162
filename = g_strdup_printf ("gpm-%s-%s", prefix, index_str);
164
index_str = gpm_devicekit_get_object_icon_index (device);
165
filename = g_strdup_printf ("gpm-%s-%s-charging", prefix, index_str);
168
} else if (state == DKP_DEVICE_STATE_PENDING_CHARGE) {
169
index_str = gpm_devicekit_get_object_icon_index (device);
170
/* FIXME: do new grey icons */
171
filename = g_strdup_printf ("gpm-%s-%s-charging", prefix, index_str);
173
} else if (state == DKP_DEVICE_STATE_PENDING_DISCHARGE) {
174
index_str = gpm_devicekit_get_object_icon_index (device);
175
filename = g_strdup_printf ("gpm-%s-%s", prefix, index_str);
140
179
} else if (type == DKP_DEVICE_TYPE_MOUSE ||
141
180
type == DKP_DEVICE_TYPE_KEYBOARD ||
142
181
type == DKP_DEVICE_TYPE_PHONE) {
152
191
filename = g_strdup_printf ("gpm-%s-%s", prefix, index_str);
195
/* nothing matched */
196
if (filename == NULL) {
197
egg_warning ("nothing matched, falling back to default icon");
198
filename = g_strdup ("dialog-warning");
155
201
egg_debug ("got filename: %s", filename);
260
306
type_desc, percentage);
309
#if DKP_CHECK_VERSION(0x009)
310
} else if (state == DKP_DEVICE_STATE_PENDING_DISCHARGE) {
312
/* TRANSLATORS: this is only shown for laptops with multiple batteries */
313
description = g_strdup_printf (_("%s waiting to discharge (%.1f%%)"),
314
type_desc, percentage);
316
} else if (state == DKP_DEVICE_STATE_PENDING_CHARGE) {
318
/* TRANSLATORS: this is only shown for laptops with multiple batteries */
319
description = g_strdup_printf (_("%s waiting to charge (%.1f%%)"), type_desc, percentage);
264
323
egg_warning ("in an undefined state we are not charging or "
265
324
"discharging and the batteries are also not charged");