gnome-power-manager r3119 - in trunk: . src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-power-manager r3119 - in trunk: . src
- Date: Tue, 2 Dec 2008 17:48:18 +0000 (UTC)
Author: rhughes
Date: Tue Dec 2 17:48:18 2008
New Revision: 3119
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=3119&view=rev
Log:
2008-12-02 Richard Hughes <richard hughsie com>
* src/Makefile.am:
* src/gpm-cell-array.c: (gpm_cell_array_get_time_until_action),
(gpm_cell_array_update), (gpm_cell_array_percent_changed),
(gpm_cell_percent_changed_cb), (gpm_cell_charging_changed_cb),
(gpm_cell_array_collection_changed),
(gpm_cell_array_get_description), (gpm_cell_array_init),
(gpm_cell_array_finalize):
* src/gpm-engine-old.c: (gpm_engine_get_summary),
(gpm_engine_init), (gpm_engine_finalize):
* src/gpm-engine.c:
* src/gpm-manager.c:
* src/gpm-profile.c:
* src/gpm-profile.h:
* src/gpm-self-test.c: (main):
* src/org.freedesktop.PowerManagement.Statistics.xml:
Remove the profiling code from the session, this is now done more
effectively in DeviceKit-power.
Removed:
trunk/src/gpm-profile.c
trunk/src/gpm-profile.h
trunk/src/org.freedesktop.PowerManagement.Statistics.xml
Modified:
trunk/ChangeLog
trunk/src/Makefile.am
trunk/src/gpm-cell-array.c
trunk/src/gpm-engine-old.c
trunk/src/gpm-engine.c
trunk/src/gpm-manager.c
trunk/src/gpm-self-test.c
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Tue Dec 2 17:48:18 2008
@@ -7,7 +7,6 @@
org.freedesktop.PowerManagement.xml \
org.freedesktop.PowerManagement.Inhibit.xml \
org.freedesktop.PowerManagement.Backlight.xml \
- org.freedesktop.PowerManagement.Statistics.xml \
gpm-marshal.list \
$(NULL)
@@ -373,15 +372,6 @@
--output=org.freedesktop.PowerManagement.Inhibit.h \
$(srcdir)/org.freedesktop.PowerManagement.Inhibit.xml
-if !HAVE_DK_POWER
-org.freedesktop.PowerManagement.Statistics.h: org.freedesktop.PowerManagement.Statistics.xml
- libtool --mode=execute dbus-binding-tool \
- --prefix=gpm_statistics \
- --mode=glib-server \
- --output=org.freedesktop.PowerManagement.Statistics.h \
- $(srcdir)/org.freedesktop.PowerManagement.Statistics.xml
-endif
-
org.freedesktop.PowerManagement.Backlight.h: org.freedesktop.PowerManagement.Backlight.xml
libtool --mode=execute dbus-binding-tool \
--prefix=gpm_backlight \
Modified: trunk/src/gpm-cell-array.c
==============================================================================
--- trunk/src/gpm-cell-array.c (original)
+++ trunk/src/gpm-cell-array.c Tue Dec 2 17:48:18 2008
@@ -42,7 +42,6 @@
#include "gpm-phone.h"
#include "gpm-control.h"
#include "gpm-warnings.h"
-#include "gpm-profile.h"
static void gpm_cell_array_class_init (GpmCellArrayClass *klass);
static void gpm_cell_array_init (GpmCellArray *cell_array);
@@ -58,7 +57,6 @@
HalManager *hal_manager;
GpmCellUnit unit;
GpmAcAdapter *ac_adapter;
- GpmProfile *profile;
GConfClient *conf;
GpmPhone *phone;
GpmControl *control;
@@ -197,13 +195,8 @@
action_time = gconf_client_get_int (cell_array->priv->conf, GPM_CONF_THRESH_TIME_ACTION, NULL);
difference = (gint) unit->time_discharge - (gint) action_time;
} else {
- /* we have to work out the time for this percentage */
- action_percentage = gconf_client_get_int (cell_array->priv->conf, GPM_CONF_THRESH_PERCENTAGE_ACTION, NULL);
- action_time = gpm_profile_get_time (cell_array->priv->profile, action_percentage, TRUE);
- if (action_time == 0) {
- return 0;
- }
- difference = (gint) unit->time_discharge - (gint) action_time;
+ /* we can't convert percentage -> time */
+ return 0;
}
/* if invalid, don't return junk */
@@ -394,39 +387,31 @@
}
}
- /* We may want to use the old time remaining code.
- * Hopefully we can remove this in 2.19.x sometime. */
- if (cell_array->priv->use_profile_calc &&
- unit->kind == GPM_CELL_UNIT_KIND_PRIMARY) {
- egg_debug ("unit->percentage = %.1f", unit->percentage);
- unit->time_discharge = gpm_profile_get_time (cell_array->priv->profile, unit->percentage, TRUE);
- unit->time_charge = gpm_profile_get_time (cell_array->priv->profile, unit->percentage, FALSE);
- } else {
- /* We only do the "better" remaining time algorithm if the battery has rate,
- * i.e not a UPS, which gives it's own battery.time_charge but has no rate */
- if (unit->rate > 0) {
- if (unit->is_discharging) {
- unit->time_discharge = 3600 * ((float)unit->charge_current /
- (float)unit->rate);
- } else if (unit->is_charging) {
- unit->time_charge = 3600 *
- ((float)(unit->charge_last_full - unit->charge_current) /
- (float)unit->rate);
- }
- }
- /* Check the remaining time is under a set limit, to deal with broken
- primary batteries rate. Fixes bug #328927 */
- if (unit->time_charge > (100 * 60 * 60)) {
- egg_warning ("Another sanity check kicked in! "
- "Remaining time cannot be > 100 hours!");
- unit->time_charge = 0;
- }
- if (unit->time_discharge > (100 * 60 * 60)) {
- egg_warning ("Another sanity check kicked in! "
- "Remaining time cannot be > 100 hours!");
- unit->time_discharge = 0;
+ /* We only do the "better" remaining time algorithm if the battery has rate,
+ * i.e not a UPS, which gives it's own battery.time_charge but has no rate */
+ if (unit->rate > 0) {
+ if (unit->is_discharging) {
+ unit->time_discharge = 3600 * ((float)unit->charge_current /
+ (float)unit->rate);
+ } else if (unit->is_charging) {
+ unit->time_charge = 3600 *
+ ((float)(unit->charge_last_full - unit->charge_current) /
+ (float)unit->rate);
}
}
+ /* Check the remaining time is under a set limit, to deal with broken
+ primary batteries rate. Fixes bug #328927 */
+ if (unit->time_charge > (100 * 60 * 60)) {
+ egg_warning ("Another sanity check kicked in! "
+ "Remaining time cannot be > 100 hours!");
+ unit->time_charge = 0;
+ }
+ if (unit->time_discharge > (100 * 60 * 60)) {
+ egg_warning ("Another sanity check kicked in! "
+ "Remaining time cannot be > 100 hours!");
+ unit->time_discharge = 0;
+ }
+
return TRUE;
}
@@ -550,12 +535,6 @@
cell_array->priv->done_fully_charged = FALSE;
}
- /* do we trust the profile enough to make a decision based on time? */
- if (unit->kind == GPM_CELL_UNIT_KIND_PRIMARY) {
- accuracy = gpm_profile_get_accuracy_average (cell_array->priv->profile, unit->is_discharging);
- gpm_warnings_time_is_accurate (cell_array->priv->warnings, (accuracy > GPM_PROFILE_GOOD_TRUST));
- }
-
/* only get a warning state if we are discharging */
if (unit->is_discharging) {
warnings_state = gpm_warnings_get_state (cell_array->priv->warnings, unit);
@@ -606,11 +585,6 @@
/* recalculate */
gpm_cell_array_update (cell_array);
- /* provide data if we are primary. Will need profile if multibattery */
- if (unit->kind == GPM_CELL_UNIT_KIND_PRIMARY) {
- gpm_profile_register_percentage (cell_array->priv->profile, (guint) percent);
- }
-
/* proxy to engine if different */
if (old_percent != unit->percentage) {
egg_debug ("** EMIT: percent-changed");
@@ -643,11 +617,6 @@
cell_array->priv->warnings_state = GPM_WARNINGS_NONE;
}
- /* provide data if we are primary. */
- if (unit->kind == GPM_CELL_UNIT_KIND_PRIMARY) {
- gpm_profile_register_charging (cell_array->priv->profile, charging);
- }
-
/* proxy to engine */
egg_debug ("** EMIT: charging-changed");
g_signal_emit (cell_array, signals [CHARGING_CHANGED], 0, charging);
@@ -767,14 +736,6 @@
unit = &(cell_array->priv->unit);
- /* reset the profile config id if primary */
- if (unit->kind == GPM_CELL_UNIT_KIND_PRIMARY) {
- /* we have to use a profile ID for hot-swapping batteries */
- config_id = gpm_cell_array_get_config_id (cell_array);
- gpm_profile_set_config_id (cell_array->priv->profile, config_id);
- g_free (config_id);
- }
-
/* recalculate */
gpm_cell_array_update (cell_array);
@@ -992,10 +953,6 @@
return g_strdup_printf ("%s (%.1f%%)\n", type_desc, unit->percentage);
}
- /* don't display the text if we are low in accuracy */
- accuracy = gpm_profile_get_accuracy (cell_array->priv->profile, (guint) unit->percentage);
- egg_debug ("accuracy = %i", accuracy);
-
/* precalculate so we don't get Unknown time remaining */
charge_time_round = egg_precision_round_down (unit->time_charge, GPM_UI_TIME_PRECISION);
discharge_time_round = egg_precision_round_down (unit->time_discharge, GPM_UI_TIME_PRECISION);
@@ -1005,18 +962,8 @@
http://bugzilla.gnome.org/show_bug.cgi?id=329027 */
if (gpm_cell_unit_is_charged (unit)) {
- if (unit->kind == GPM_CELL_UNIT_KIND_PRIMARY &&
- accuracy > GPM_CELL_ARRAY_TEXT_MIN_ACCURACY) {
- time = gpm_profile_get_time (cell_array->priv->profile, (guint) unit->percentage, TRUE);
- discharge_time_round = egg_precision_round_down (time, GPM_UI_TIME_PRECISION);
- discharge_timestring = gpm_get_timestring (discharge_time_round);
- description = g_strdup_printf (_("%s fully charged (%.1f%%)\nProvides %s battery runtime\n"),
- type_desc, unit->percentage, discharge_timestring);
- g_free (discharge_timestring);
- } else {
- description = g_strdup_printf (_("%s fully charged (%.1f%%)\n"),
- type_desc, unit->percentage);
- }
+ description = g_strdup_printf (_("%s fully charged (%.1f%%)\n"),
+ type_desc, unit->percentage);
} else if (unit->is_discharging) {
@@ -1398,7 +1345,6 @@
cell_array->priv = GPM_CELL_ARRAY_GET_PRIVATE (cell_array);
cell_array->priv->array = g_ptr_array_new ();
- cell_array->priv->profile = gpm_profile_new ();
cell_array->priv->conf = gconf_client_get_default ();
g_signal_connect (cell_array->priv->conf, "value-changed",
G_CALLBACK (conf_key_changed_cb), cell_array);
@@ -1460,7 +1406,6 @@
g_object_unref (cell_array->priv->ac_adapter);
g_object_unref (cell_array->priv->warnings);
g_object_unref (cell_array->priv->hal_manager);
- g_object_unref (cell_array->priv->profile);
g_object_unref (cell_array->priv->conf);
g_object_unref (cell_array->priv->control);
G_OBJECT_CLASS (gpm_cell_array_parent_class)->finalize (object);
Modified: trunk/src/gpm-engine-old.c
==============================================================================
--- trunk/src/gpm-engine-old.c (original)
+++ trunk/src/gpm-engine-old.c Tue Dec 2 17:48:18 2008
@@ -32,7 +32,6 @@
#include "gpm-ac-adapter.h"
#include "gpm-common.h"
#include "gpm-control.h"
-#include "gpm-profile.h"
#include "gpm-marshal.h"
#include "gpm-engine-old.h"
#include "gpm-cell-unit.h"
@@ -57,7 +56,6 @@
GConfClient *conf;
GpmWarnings *warnings;
GpmIconPolicy icon_policy;
- GpmProfile *profile;
GpmControl *control;
GpmAcAdapter *ac_adapter;
GpmEngineCollection collection;
@@ -164,7 +162,6 @@
GString *tooltip = NULL;
GpmCellUnit *unit;
GpmEngineCollection *collection;
- guint accuracy;
gboolean on_ac;
gchar *part;
@@ -193,24 +190,6 @@
g_free (part);
/* if we have limited accuracy, add this to the tooltip */
- unit = gpm_cell_array_get_unit (collection->primary);
- accuracy = gpm_profile_get_accuracy_average (engine->priv->profile,
- unit->is_discharging);
-
- if (unit->is_present) {
- if (accuracy == 0) {
- if (unit->is_discharging)
- tooltip = g_string_append (tooltip, _("Battery discharge time is currently unknown\n"));
- else
- tooltip = g_string_append (tooltip, _("Battery charge time is currently unknown\n"));
- } else if (accuracy < GPM_PROFILE_GOOD_TRUST) {
- if (unit->is_discharging)
- tooltip = g_string_append (tooltip, _("Battery discharge time is estimated\n"));
- else
- tooltip = g_string_append (tooltip, _("Battery charge time is estimated\n"));
- }
- }
-
part = gpm_cell_array_get_description (collection->ups);
if (part != NULL)
tooltip = g_string_append (tooltip, part);
@@ -803,7 +782,6 @@
G_CALLBACK (gpm_engine_conf_key_changed_cb), engine);
engine->priv->warnings = gpm_warnings_new ();
- engine->priv->profile = gpm_profile_new ();
engine->priv->previous_icon = NULL;
engine->priv->previous_summary = NULL;
@@ -1022,7 +1000,6 @@
g_free (engine->priv->previous_summary);
g_object_unref (engine->priv->hal_manager);
- g_object_unref (engine->priv->profile);
g_object_unref (engine->priv->warnings);
g_object_unref (engine->priv->ac_adapter);
g_object_unref (engine->priv->control);
Modified: trunk/src/gpm-engine.c
==============================================================================
--- trunk/src/gpm-engine.c (original)
+++ trunk/src/gpm-engine.c Tue Dec 2 17:48:18 2008
@@ -31,7 +31,6 @@
#include "egg-debug.h"
#include "gpm-common.h"
-#include "gpm-profile.h"
#include "gpm-devicekit.h"
#include "gpm-marshal.h"
#include "gpm-engine.h"
@@ -48,7 +47,6 @@
/* Left to convert:
* 1. Recall data
- * 2. GConf key fixes
*/
struct GpmEnginePrivate
Modified: trunk/src/gpm-manager.c
==============================================================================
--- trunk/src/gpm-manager.c (original)
+++ trunk/src/gpm-manager.c Tue Dec 2 17:48:18 2008
@@ -70,20 +70,14 @@
#include "gpm-tray-icon.h"
#ifdef HAVE_DK_POWER
#include "gpm-engine.h"
+ #include "gpm-devicekit.h"
#else
#include "gpm-engine-old.h"
#endif
#include "gpm-feedback-widget.h"
-#ifdef HAVE_DK_POWER
- #include "gpm-devicekit.h"
-#endif
-
#include "org.freedesktop.PowerManagement.Inhibit.h"
#include "org.freedesktop.PowerManagement.Backlight.h"
-#ifndef HAVE_DK_POWER
- #include "org.freedesktop.PowerManagement.Statistics.h"
-#endif
static void gpm_manager_class_init (GpmManagerClass *klass);
static void gpm_manager_init (GpmManager *manager);
Modified: trunk/src/gpm-self-test.c
==============================================================================
--- trunk/src/gpm-self-test.c (original)
+++ trunk/src/gpm-self-test.c Tue Dec 2 17:48:18 2008
@@ -39,7 +39,6 @@
void gpm_cell_test (EggTest *test);
void gpm_cell_test_array (EggTest *test);
void gpm_inhibit_test (EggTest *test);
-void gpm_profile_test (EggTest *test);
void gpm_phone_test (EggTest *test);
void gpm_graph_widget_test (EggTest *test);
void gpm_proxy_test (EggTest *test);
@@ -73,7 +72,6 @@
gpm_cell_test (test);
gpm_cell_test_array (test);
gpm_inhibit_test (test);
- gpm_profile_test (test);
gpm_phone_test (test);
// gpm_graph_widget_test (test);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]