gnome-power-manager r3074 - in trunk: . src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-power-manager r3074 - in trunk: . src
- Date: Tue, 4 Nov 2008 11:49:27 +0000 (UTC)
Author: rhughes
Date: Tue Nov 4 11:49:27 2008
New Revision: 3074
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=3074&view=rev
Log:
2008-11-04 Richard Hughes <richard hughsie com>
* src/gpm-engine.c: (gpm_engine_class_init),
(gpm_cell_array_charge_low_cb),
(gpm_cell_array_charge_critical_cb),
(gpm_cell_array_charge_action_cb):
* src/gpm-manager.c: (gpm_engine_charge_low_cb),
(gpm_engine_charge_critical_cb), (gpm_engine_charge_action_cb),
(has_inhibit_changed_cb):
Don't proxy down the kind, just send the unit from the engine.
Modified:
trunk/ChangeLog
trunk/src/gpm-engine.c
trunk/src/gpm-manager.c
Modified: trunk/src/gpm-engine.c
==============================================================================
--- trunk/src/gpm-engine.c (original)
+++ trunk/src/gpm-engine.c Tue Nov 4 11:49:27 2008
@@ -205,28 +205,28 @@
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GpmEngineClass, charge_action),
NULL, NULL,
- gpm_marshal_VOID__UINT_UINT,
- G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_POINTER);
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1, G_TYPE_POINTER);
signals [CHARGE_LOW] =
g_signal_new ("charge-low",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GpmEngineClass, charge_low),
NULL, NULL,
- gpm_marshal_VOID__UINT_POINTER,
- G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_POINTER);
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1, G_TYPE_POINTER);
signals [CHARGE_CRITICAL] =
g_signal_new ("charge-critical",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GpmEngineClass, charge_critical),
NULL, NULL,
- gpm_marshal_VOID__UINT_POINTER,
- G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_POINTER);
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1, G_TYPE_POINTER);
}
/**
- * gpm_engine_get_summary:
+ * gpm_engine_get_collection:
* @engine: This engine class instance
* @string: The returned string
*
@@ -755,7 +755,6 @@
gfloat percent,
GpmEngine *engine)
{
- GpmCellUnitKind kind;
GpmCellUnit *unit;
g_return_if_fail (engine != NULL);
@@ -765,12 +764,11 @@
gpm_engine_recalculate_state (engine);
/* find the kind for easy multiplexing */
- kind = gpm_cell_array_get_kind (cell_array);
unit = gpm_cell_array_get_unit (cell_array);
/* just proxy it to the GUI layer */
egg_debug ("** EMIT: charge-low");
- g_signal_emit (engine, signals [CHARGE_LOW], 0, kind, unit);
+ g_signal_emit (engine, signals [CHARGE_LOW], 0, unit);
}
/**
@@ -781,7 +779,6 @@
gfloat percent,
GpmEngine *engine)
{
- GpmCellUnitKind kind;
GpmCellUnit *unit;
g_return_if_fail (engine != NULL);
@@ -791,12 +788,11 @@
gpm_engine_recalculate_state (engine);
/* find the kind for easy multiplexing */
- kind = gpm_cell_array_get_kind (cell_array);
unit = gpm_cell_array_get_unit (cell_array);
/* just proxy it to the GUI layer */
egg_debug ("** EMIT: charge-critical");
- g_signal_emit (engine, signals [CHARGE_CRITICAL], 0, kind, unit);
+ g_signal_emit (engine, signals [CHARGE_CRITICAL], 0, unit);
}
/**
@@ -807,7 +803,6 @@
gfloat percent,
GpmEngine *engine)
{
- GpmCellUnitKind kind;
GpmCellUnit *unit;
g_return_if_fail (engine != NULL);
@@ -817,12 +812,11 @@
gpm_engine_recalculate_state (engine);
/* find the kind for easy multiplexing */
- kind = gpm_cell_array_get_kind (cell_array);
unit = gpm_cell_array_get_unit (cell_array);
/* just proxy it to the GUI layer */
egg_debug ("** EMIT: charge-action");
- g_signal_emit (engine, signals [CHARGE_ACTION], 0, kind, unit);
+ g_signal_emit (engine, signals [CHARGE_ACTION], 0, unit);
}
/**
Modified: trunk/src/gpm-manager.c
==============================================================================
--- trunk/src/gpm-manager.c (original)
+++ trunk/src/gpm-manager.c Tue Nov 4 11:49:27 2008
@@ -1541,7 +1541,6 @@
*/
static void
gpm_engine_charge_low_cb (GpmEngine *engine,
- GpmCellUnitKind kind,
GpmCellUnit *unit,
GpmManager *manager)
{
@@ -1550,26 +1549,26 @@
gchar *remaining_text;
gchar *icon;
- if (kind == GPM_CELL_UNIT_KIND_PRIMARY) {
+ if (unit->kind == GPM_CELL_UNIT_KIND_PRIMARY) {
title = _("Laptop battery low");
remaining_text = gpm_get_timestring (unit->time_discharge);
message = g_strdup_printf (_("You have approximately <b>%s</b> of remaining battery life (%.1f%%)"),
remaining_text, unit->percentage);
- } else if (kind == GPM_CELL_UNIT_KIND_UPS) {
+ } else if (unit->kind == GPM_CELL_UNIT_KIND_UPS) {
title = _("UPS low");
remaining_text = gpm_get_timestring (unit->time_discharge);
message = g_strdup_printf (_("You have approximately <b>%s</b> of remaining UPS backup power (%.1f%%)"),
remaining_text, unit->percentage);
- } else if (kind == GPM_CELL_UNIT_KIND_MOUSE) {
+ } else if (unit->kind == GPM_CELL_UNIT_KIND_MOUSE) {
title = _("Mouse battery low");
message = g_strdup_printf (_("The wireless mouse attached to this computer is low in power (%.1f%%)"), unit->percentage);
- } else if (kind == GPM_CELL_UNIT_KIND_KEYBOARD) {
+ } else if (unit->kind == GPM_CELL_UNIT_KIND_KEYBOARD) {
title = _("Keyboard battery low");
message = g_strdup_printf (_("The wireless keyboard attached to this computer is low in power (%.1f%%)"), unit->percentage);
- } else if (kind == GPM_CELL_UNIT_KIND_PDA) {
+ } else if (unit->kind == GPM_CELL_UNIT_KIND_PDA) {
title = _("PDA battery low");
message = g_strdup_printf (_("The PDA attached to this computer is low in power (%.1f%%)"), unit->percentage);
- } else if (kind == GPM_CELL_UNIT_KIND_PHONE) {
+ } else if (unit->kind == GPM_CELL_UNIT_KIND_PHONE) {
title = _("Cell phone battery low");
message = g_strdup_printf (_("The cell phone attached to this computer is low in power (%.1f%%)"), unit->percentage);
}
@@ -1607,7 +1606,6 @@
*/
static void
gpm_engine_charge_critical_cb (GpmEngine *engine,
- GpmCellUnitKind kind,
GpmCellUnit *unit,
GpmManager *manager)
{
@@ -1619,7 +1617,7 @@
gchar *icon;
gchar *time_text;
- if (kind == GPM_CELL_UNIT_KIND_PRIMARY) {
+ if (unit->kind == GPM_CELL_UNIT_KIND_PRIMARY) {
title = _("Laptop battery critically low");
remaining_text = gpm_get_timestring (unit->time_discharge);
time_text = gpm_manager_get_time_until_action_text (manager);
@@ -1648,29 +1646,29 @@
g_free (action_text);
g_free (remaining_text);
g_free (time_text);
- } else if (kind == GPM_CELL_UNIT_KIND_UPS) {
+ } else if (unit->kind == GPM_CELL_UNIT_KIND_UPS) {
title = _("UPS critically low");
remaining_text = gpm_get_timestring (unit->time_discharge);
message = g_strdup_printf (_("You have approximately <b>%s</b> of remaining UPS power (%.1f%%). "
"Restore AC power to your computer to avoid losing data."),
remaining_text, unit->percentage);
g_free (remaining_text);
- } else if (kind == GPM_CELL_UNIT_KIND_MOUSE) {
+ } else if (unit->kind == GPM_CELL_UNIT_KIND_MOUSE) {
title = _("Mouse battery low");
message = g_strdup_printf (_("The wireless mouse attached to this computer is very low in power (%.1f%%). "
"This device will soon stop functioning if not charged."),
unit->percentage);
- } else if (kind == GPM_CELL_UNIT_KIND_KEYBOARD) {
+ } else if (unit->kind == GPM_CELL_UNIT_KIND_KEYBOARD) {
title = _("Keyboard battery low");
message = g_strdup_printf (_("The wireless keyboard attached to this computer is very low in power (%.1f%%). "
"This device will soon stop functioning if not charged."),
unit->percentage);
- } else if (kind == GPM_CELL_UNIT_KIND_PDA) {
+ } else if (unit->kind == GPM_CELL_UNIT_KIND_PDA) {
title = _("PDA battery low");
message = g_strdup_printf (_("The PDA attached to this computer is very low in power (%.1f%%). "
"This device will soon stop functioning if not charged."),
unit->percentage);
- } else if (kind == GPM_CELL_UNIT_KIND_PHONE) {
+ } else if (unit->kind == GPM_CELL_UNIT_KIND_PHONE) {
title = _("Cell phone battery low");
message = g_strdup_printf (_("Your cell phone is very low in power (%.1f%%). "
"This device will soon stop functioning if not charged."),
@@ -1691,14 +1689,14 @@
* gpm_engine_charge_action_cb:
*/
static void
-gpm_engine_charge_action_cb (GpmEngine *engine, GpmCellUnitKind kind, GpmCellUnit *unit, GpmManager *manager)
+gpm_engine_charge_action_cb (GpmEngine *engine, GpmCellUnit *unit, GpmManager *manager)
{
const gchar *title = NULL;
gchar *action;
gchar *message = NULL;
gchar *icon;
- if (kind == GPM_CELL_UNIT_KIND_PRIMARY) {
+ if (unit->kind == GPM_CELL_UNIT_KIND_PRIMARY) {
title = _("Laptop battery critically low");
/* we have to do different warnings depending on the policy */
@@ -1730,7 +1728,7 @@
/* wait 10 seconds for user-panic */
g_timeout_add (1000*10, (GSourceFunc) manager_critical_action_do, manager);
- } else if (kind == GPM_CELL_UNIT_KIND_UPS) {
+ } else if (unit->kind == GPM_CELL_UNIT_KIND_UPS) {
title = _("UPS critically low");
/* we have to do different warnings depending on the policy */
@@ -1772,9 +1770,7 @@
* has_inhibit_changed_cb:
**/
static void
-has_inhibit_changed_cb (GpmInhibit *inhibit,
- gboolean has_inhibit,
- GpmManager *manager)
+has_inhibit_changed_cb (GpmInhibit *inhibit, gboolean has_inhibit, GpmManager *manager)
{
HalManager *hal_manager;
gboolean is_laptop;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]