~ubuntu-branches/ubuntu/karmic/gnome-power-manager/karmic-updates

« back to all changes in this revision

Viewing changes to src/gpm-devicekit.c

  • Committer: Bazaar Package Importer
  • Author(s): Chris Coulson
  • Date: 2009-07-07 23:53:51 UTC
  • mfrom: (2.1.41 upstream)
  • Revision ID: james.westby@ubuntu.com-20090707235351-lpmrb0epbepo42i0
Tags: 2.27.2-0ubuntu1
* New upstream release (LP: #396437):
  - Use composite battery mode by default to fix multi-battery 
    laptops (Richard Hughes).
  - Add manager policy to change the disk spindown based on timeouts 
    set in GConf (Richard Hughes).
  - Add GConf keys for the disk spindown functionality (Richard Hughes).
  - Add preferences checkboxes for the disk spindown functionality 
    (Richard Hughes).
  - No longer support HAL legacy buttons (Richard Hughes).
  - Add support for recall data provided by DeviceKit-power 
    (Richard Hughes).
  - Prefix GTKBuilder files with gettext/glade (Claude Paroz)
  - Use gtk_show_uri i.s.o. gnome-open (Jaap A. Haitsma)
  - Remove -Wunitialized because it does not compile on Ubuntu Jaunty 
    (Jaap A. Haitsma)
  - Fix the category in the gnome-power-statistic desktop file. 
    Fixes rh#489041 (Richard Hughes)
  - Make minimum size of th statistics graphs smaller. Fixes rh#491426 
    (Richard Hughes)
  - Don't show the feedback widget when the brightness changes, 
    only on key press and when interactive (Richard Hughes)
  - If we caught our idletime alarm, then remove from the filter 
    (Richard Hughes)
  - Take the battery capacity into account when using multiple 
    batteries (Richard Hughes)
  - Ignore capacity readings of less than 1% (Richard Hughes)
  - Show a label to the user when there is no graph data (Richard Hughes)
  - Add statistics devices in visually pleasing order (Richard Hughes)
  - Use the composite device for getting the global system warning icon 
    (Richard Hughes)
  - Setup the reset event before we do the idle action, to finally fix 
    blanking (Richard Hughes)
  - Be more paranoid about setting idle in a race (Richard Hughes)
  - Remove three unused GConf keys (Richard Hughes)
  - Don't show the whole object path in the GUI, just show the ID
    (Richard Hughes)
  - Only print the DeviceKit device if we are using --verbose 
    (Richard Hughes)
  - Remove a little bit more of our HAL dep, and use the lid-is-present 
    DK-p property (Richard Hughes)
  - Fix compile with DKP_DISABLE_DEPRECATED turned on (Richard Hughes)
  - Remove ambient light sensor support, and keyboard backlight devices 
    (Richard Hughes)
  - Support DKP_DEVICE_STATE_PENDING_x in more places (Richard Hughes)
* Refreshed patches:
  - 03-system-policy.patch.
  - 14_inhibit_tool.patch.
  - 21_idle_key_removal.patch.
  - 22_xfce_desktop_files.patch.
  - 23_numlock_hotkey.patch.
  - 25_sparc_char_to_int.patch.
  - 74-disable-quirks-reference.patch.
  - 97_remove-discharging-notify.patch.
* Dropped 94-fix-light-sensor-scaling.patch: the ambient light sensor
  support has gone now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
122
122
                        /* battery missing */
123
123
                        filename = g_strdup_printf ("gpm-%s-missing", prefix);
124
124
 
 
125
                } else if (state == DKP_DEVICE_STATE_EMPTY) {
 
126
                        filename = g_strdup_printf ("gpm-%s-empty", prefix);
 
127
 
125
128
                } else if (state == DKP_DEVICE_STATE_FULLY_CHARGED) {
126
129
                        filename = g_strdup_printf ("gpm-%s-charged", prefix);
127
130
 
 
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);
 
135
#endif
131
136
 
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);
 
144
 
 
145
#if !DKP_CHECK_VERSION(0x009)
 
146
                /* the battery isn't charging or discharging, it's just
 
147
                 * sitting there half full doing nothing */
 
148
                } else {
 
149
                        DkpClient *client;
 
150
                        gboolean on_battery;
 
151
 
 
152
                        /* get battery status */
 
153
                        client = dkp_client_new ();
 
154
                        g_object_get (client,
 
155
                                      "on-battery", &on_battery,
 
156
                                      NULL);
 
157
                        g_object_unref (client);
 
158
 
 
159
                        /* try to find a suitable icon depending on AC state */
 
160
                        if (on_battery) {
 
161
                                index_str = gpm_devicekit_get_object_icon_index (device);
 
162
                                filename = g_strdup_printf ("gpm-%s-%s", prefix, index_str);
 
163
                        } else {
 
164
                                index_str = gpm_devicekit_get_object_icon_index (device);
 
165
                                filename = g_strdup_printf ("gpm-%s-%s-charging", prefix, index_str);
 
166
                        }
 
167
#else
 
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);
 
172
 
 
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);
 
176
#endif
139
177
                }
 
178
 
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);
153
192
                }
154
193
        }
 
194
 
 
195
        /* nothing matched */
 
196
        if (filename == NULL) {
 
197
                egg_warning ("nothing matched, falling back to default icon");
 
198
                filename = g_strdup ("dialog-warning");
 
199
        }
 
200
 
155
201
        egg_debug ("got filename: %s", filename);
156
202
        return filename;
157
203
}
260
306
                                                type_desc, percentage);
261
307
                }
262
308
 
 
309
#if DKP_CHECK_VERSION(0x009)
 
310
        } else if (state == DKP_DEVICE_STATE_PENDING_DISCHARGE) {
 
311
 
 
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);
 
315
 
 
316
        } else if (state == DKP_DEVICE_STATE_PENDING_CHARGE) {
 
317
 
 
318
                /* TRANSLATORS: this is only shown for laptops with multiple batteries */
 
319
                description = g_strdup_printf (_("%s waiting to charge (%.1f%%)"), type_desc, percentage);
 
320
#endif
 
321
 
263
322
        } else {
264
323
                egg_warning ("in an undefined state we are not charging or "
265
324
                             "discharging and the batteries are also not charged");