gnome-power-manager r2851 - in trunk: . src



Author: rhughes
Date: Sun Jul 27 10:02:39 2008
New Revision: 2851
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=2851&view=rev

Log:
2008-07-27  Richard Hughes  <richard hughsie com>

* src/gpm-cell-array.c: (gpm_cell_array_update),
(gpm_cell_percent_changed_cb), (gpm_cell_array_get_description),
(gpm_cell_array_class_init):
* src/gpm-cell-array.h:
* src/gpm-cell-unit.c: (gpm_cell_unit_init), (gpm_cell_unit_print),
(gpm_st_cell_unit):
* src/gpm-cell-unit.h:
* src/gpm-cell.c: (gpm_cell_refresh_hal_all),
(hal_device_property_modified_cb), (gpm_cell_set_phone_index),
(gpm_cell_get_description), (phone_device_refresh_cb),
(gpm_cell_class_init):
* src/gpm-cell.h:
* src/gpm-engine.c: (gpm_cell_array_percent_changed_cb),
(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):
* src/gpm-tray-icon.c: (gpm_tray_icon_add_device):
Convert the percentage charge to a gfloat type.


Modified:
   trunk/ChangeLog
   trunk/src/gpm-cell-array.c
   trunk/src/gpm-cell-array.h
   trunk/src/gpm-cell-unit.c
   trunk/src/gpm-cell-unit.h
   trunk/src/gpm-cell.c
   trunk/src/gpm-cell.h
   trunk/src/gpm-engine.c
   trunk/src/gpm-manager.c
   trunk/src/gpm-tray-icon.c

Modified: trunk/src/gpm-cell-array.c
==============================================================================
--- trunk/src/gpm-cell-array.c	(original)
+++ trunk/src/gpm-cell-array.c	Sun Jul 27 10:02:39 2008
@@ -354,14 +354,14 @@
 	 * a very high charge. Fixes bug #327471 */
 	if (unit->kind == GPM_CELL_UNIT_KIND_PRIMARY &&
 	    unit->charge_current > 0 && unit->charge_last_full > 0) {
-		gint pc = 100 * ((gfloat)unit->charge_current /
+		gfloat pc = 100.0f * ((gfloat)unit->charge_current /
 				(gfloat)unit->charge_last_full);
-		if (pc < 0) {
+		if (pc < 0.0f) {
 			gpm_warning ("Corrected percentage charge (%i) and set to minimum", pc);
-			pc = 0;
-		} else if (pc > 100) {
+			pc = 0.0f;
+		} else if (pc > 100.0f) {
 			gpm_warning ("Corrected percentage charge (%i) and set to maximum", pc);
-			pc = 100;
+			pc = 100.0f;
 		}
 		unit->percentage = pc;
 	}
@@ -373,7 +373,7 @@
 	if (unit->kind == GPM_CELL_UNIT_KIND_PRIMARY &&
 	    unit->is_charging == FALSE &&
 	    unit->is_discharging == FALSE &&
-	    unit->percentage > 0 &&
+	    unit->percentage > 0.0f &&
 	    unit->percentage < GPM_CELL_UNIT_MIN_CHARGED_PERCENTAGE) {
 		gboolean on_ac;
 
@@ -394,7 +394,7 @@
 	 * Hopefully we can remove this in 2.19.x sometime. */
 	if (cell_array->priv->use_profile_calc &&
 	    unit->kind == GPM_CELL_UNIT_KIND_PRIMARY) {
-		gpm_debug ("unit->percentage = %i", unit->percentage);
+		gpm_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 {
@@ -598,7 +598,7 @@
 
 	/* 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, percent);
+		gpm_profile_register_percentage (cell_array->priv->profile, (guint) percent);
 	}
 
 	/* proxy to engine if different */
@@ -958,19 +958,19 @@
 	if (unit->kind == GPM_CELL_UNIT_KIND_MOUSE ||
 	    unit->kind == GPM_CELL_UNIT_KIND_KEYBOARD ||
 	    unit->kind == GPM_CELL_UNIT_KIND_PDA) {
-		return g_strdup_printf ("%s (%i%%)\n", type_desc, unit->percentage);
+		return g_strdup_printf ("%s (%.1f%%)\n", type_desc, unit->percentage);
 	}
 
 	/* we care if we are on AC */
 	if (unit->kind == GPM_CELL_UNIT_KIND_PHONE) {
 		if (unit->is_charging || unit->is_discharging == FALSE) {
-			return g_strdup_printf ("%s charging (%i%%)\n", type_desc, unit->percentage);
+			return g_strdup_printf ("%s charging (%.1f%%)\n", type_desc, unit->percentage);
 		}
-		return g_strdup_printf ("%s (%i%%)\n", type_desc, unit->percentage);
+		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, unit->percentage);
+	accuracy = gpm_profile_get_accuracy (cell_array->priv->profile, (guint) unit->percentage);
 	gpm_debug ("accuracy = %i", accuracy);
 
 	/* precalculate so we don't get Unknown time remaining */
@@ -984,14 +984,14 @@
 
 		if (unit->kind == GPM_CELL_UNIT_KIND_PRIMARY &&
 		    accuracy > GPM_CELL_ARRAY_TEXT_MIN_ACCURACY) {
-			time = gpm_profile_get_time (cell_array->priv->profile, unit->percentage, TRUE);
+			time = gpm_profile_get_time (cell_array->priv->profile, (guint) unit->percentage, TRUE);
 			discharge_time_round = gpm_precision_round_down (time, GPM_UI_TIME_PRECISION);
 			discharge_timestring = gpm_get_timestring (discharge_time_round);
-			description = g_strdup_printf (_("%s fully charged (%i%%)\nProvides %s battery runtime\n"),
+			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 (%i%%)\n"),
+			description = g_strdup_printf (_("%s fully charged (%.1f%%)\n"),
 							type_desc, unit->percentage);
 		}
 
@@ -999,12 +999,12 @@
 
 		if (discharge_time_round > GPM_CELL_ARRAY_TEXT_MIN_TIME) {
 			discharge_timestring = gpm_get_timestring (discharge_time_round);
-			description = g_strdup_printf (_("%s %s remaining (%i%%)\n"),
+			description = g_strdup_printf (_("%s %s remaining (%.1f%%)\n"),
 						type_desc, discharge_timestring, unit->percentage);
 			g_free (discharge_timestring);
 		} else {
 			/* don't display "Unknown remaining" */
-			description = g_strdup_printf (_("%s discharging (%i%%)\n"),
+			description = g_strdup_printf (_("%s discharging (%.1f%%)\n"),
 						type_desc, unit->percentage);
 		}
 
@@ -1016,19 +1016,19 @@
 			/* display both discharge and charge time */
 			charge_timestring = gpm_get_timestring (charge_time_round);
 			discharge_timestring = gpm_get_timestring (discharge_time_round);
-			description = g_strdup_printf (_("%s %s until charged (%i%%)\nProvides %s battery runtime\n"),
+			description = g_strdup_printf (_("%s %s until charged (%.1f%%)\nProvides %s battery runtime\n"),
 							type_desc, charge_timestring, unit->percentage, discharge_timestring);
 			g_free (charge_timestring);
 			g_free (discharge_timestring);
 		} else if (charge_time_round > GPM_CELL_ARRAY_TEXT_MIN_TIME) {
 			/* display only charge time */
 			charge_timestring = gpm_get_timestring (charge_time_round);
-			description = g_strdup_printf (_("%s %s until charged (%i%%)\n"),
+			description = g_strdup_printf (_("%s %s until charged (%.1f%%)\n"),
 						type_desc, charge_timestring, unit->percentage);
 			g_free (charge_timestring);
 		} else {
 			/* don't display "Unknown remaining" */
-			description = g_strdup_printf (_("%s charging (%i%%)\n"),
+			description = g_strdup_printf (_("%s charging (%.1f%%)\n"),
 						type_desc, unit->percentage);
 		}
 
@@ -1278,8 +1278,8 @@
 			      G_SIGNAL_RUN_LAST,
 			      G_STRUCT_OFFSET (GpmCellArrayClass, percent_changed),
 			      NULL, NULL,
-			      g_cclosure_marshal_VOID__UINT,
-			      G_TYPE_NONE, 1, G_TYPE_UINT);
+			      g_cclosure_marshal_VOID__FLOAT,
+			      G_TYPE_NONE, 1, G_TYPE_FLOAT);
 	signals [CHARGING_CHANGED] =
 		g_signal_new ("charging-changed",
 			      G_TYPE_FROM_CLASS (object_class),

Modified: trunk/src/gpm-cell-array.h
==============================================================================
--- trunk/src/gpm-cell-array.h	(original)
+++ trunk/src/gpm-cell-array.h	Sun Jul 27 10:02:39 2008
@@ -47,7 +47,7 @@
 {
 	GObjectClass	parent_class;
 	void		(* percent_changed)	(GpmCellArray	*cell_array,
-						 guint		 percent);
+						 gfloat		 percent);
 	void		(* charging_changed)	(GpmCellArray	*cell_array,
 						 gboolean	 charging);
 	void		(* discharging_changed)	(GpmCellArray	*cell_array,
@@ -58,11 +58,11 @@
 	void		(* low_capacity)	(GpmCellArray	*cell_array,
 						 guint		 capacity);
 	void		(* charge_low)		(GpmCellArray	*cell_array,
-						 guint		 percent);
+						 gfloat		 percent);
 	void		(* charge_critical)	(GpmCellArray	*cell_array,
-						 guint		 percent);
+						 gfloat		 percent);
 	void		(* charge_action)	(GpmCellArray	*cell_array,
-						 guint		 percent);
+						 gfloat		 percent);
 	void		(* fully_charged)	(GpmCellArray	*cell_array);
 	void		(* collection_changed)	(GpmCellArray	*cell_array);
 	void		(* discharging)		(GpmCellArray	*cell_array);

Modified: trunk/src/gpm-cell-unit.c
==============================================================================
--- trunk/src/gpm-cell-unit.c	(original)
+++ trunk/src/gpm-cell-unit.c	Sun Jul 27 10:02:39 2008
@@ -40,7 +40,7 @@
 	unit->charge_last_full = 0;
 	unit->charge_current = 0;
 	unit->rate = 0;
-	unit->percentage = 0;
+	unit->percentage = 0.0f;
 	unit->time_charge = 0;
 	unit->time_discharge = 0;
 	unit->capacity = 0;
@@ -64,7 +64,7 @@
 
 	gpm_debug ("device         %s", gpm_cell_unit_get_kind_localised (unit, FALSE));
 	gpm_debug ("present        %i", unit->is_present);
-	gpm_debug ("percent        %i", unit->percentage);
+	gpm_debug ("percent        %.1f", unit->percentage);
 	gpm_debug ("is charging    %i", unit->is_charging);
 	gpm_debug ("is discharging %i", unit->is_discharging);
 	if (unit->charge_current > 0) {
@@ -370,7 +370,7 @@
 
 	/************************************************************/
 	gpm_st_title (test, "make sure full battery isn't charged");
-	unit->percentage = 100;
+	unit->percentage = 100.0f;
 	unit->is_charging = FALSE;
 	unit->is_discharging = TRUE;
 	ret = gpm_cell_unit_is_charged (unit);
@@ -409,7 +409,7 @@
 
 	/************************************************************/
 	gpm_st_title (test, "make sure charging battery isn't charged");
-	unit->percentage = 99;
+	unit->percentage = 99.0f;
 	unit->is_charging = TRUE;
 	unit->is_discharging = FALSE;
 	ret = gpm_cell_unit_is_charged (unit);
@@ -421,7 +421,7 @@
 
 	/************************************************************/
 	gpm_st_title (test, "make sure full battery is charged");
-	unit->percentage = 95;
+	unit->percentage = 95.0f;
 	unit->is_charging = FALSE;
 	unit->is_discharging = FALSE;
 	ret = gpm_cell_unit_is_charged (unit);
@@ -433,7 +433,7 @@
 
 	/************************************************************/
 	gpm_st_title (test, "make sure broken battery isn't charged");
-	unit->percentage = 30;
+	unit->percentage = 30.0f;
 	unit->is_charging = FALSE;
 	unit->is_discharging = FALSE;
 	ret = gpm_cell_unit_is_charged (unit);
@@ -445,7 +445,7 @@
 
 	/************************************************************/
 	gpm_st_title (test, "get missing icon");
-	unit->percentage = 30;
+	unit->percentage = 30.0f;
 	unit->is_present = FALSE;
 	value = gpm_cell_unit_get_icon (unit);
 	if (strcmp (value, "gpm-primary-missing") == 0) {
@@ -457,7 +457,7 @@
 
 	/************************************************************/
 	gpm_st_title (test, "get middle icon");
-	unit->percentage = 30;
+	unit->percentage = 30.0f;
 	unit->is_present = TRUE;
 	value = gpm_cell_unit_get_icon (unit);
 	if (strcmp (value, "gpm-primary-040") == 0) {
@@ -471,7 +471,7 @@
 	gpm_st_title (test, "get charged icon");
 	unit->is_charging = FALSE;
 	unit->is_discharging = FALSE;
-	unit->percentage = 95;
+	unit->percentage = 95.0f;
 	unit->is_present = TRUE;
 	value = gpm_cell_unit_get_icon (unit);
 	if (strcmp (value, "gpm-primary-charged") == 0) {

Modified: trunk/src/gpm-cell-unit.h
==============================================================================
--- trunk/src/gpm-cell-unit.h	(original)
+++ trunk/src/gpm-cell-unit.h	Sun Jul 27 10:02:39 2008
@@ -48,7 +48,7 @@
 	guint		 charge_last_full;
 	guint		 charge_current;
 	guint		 rate;
-	guint		 percentage;
+	gfloat		 percentage;
 	guint		 time_charge;
 	guint		 time_discharge;
 	guint		 capacity;

Modified: trunk/src/gpm-cell.c
==============================================================================
--- trunk/src/gpm-cell.c	(original)
+++ trunk/src/gpm-cell.c	Sun Jul 27 10:02:39 2008
@@ -147,8 +147,9 @@
 	}
 
 	/* sanity check that charge_level.percentage exists (if it should) */
-	exists = hal_gdevice_get_uint (device, "battery.charge_level.percentage",
-					  &unit->percentage, NULL);
+	guint percentage;
+	exists = hal_gdevice_get_uint (device, "battery.charge_level.percentage", &percentage, NULL);
+	unit->percentage = (gfloat) percentage;
 	if (exists == FALSE) {
 		gpm_warning ("could not read your battery's percentage charge.");
 	}
@@ -309,7 +310,9 @@
 		}
 
 	} else if (strcmp (key, "battery.charge_level.percentage") == 0) {
-		hal_gdevice_get_uint (device, key, &unit->percentage, NULL);
+		guint percent;
+		hal_gdevice_get_uint (device, key, &percent, NULL);
+		unit->percentage = (gfloat) percent;
 		gpm_debug ("** EMIT: percent-changed: %i", unit->percentage);
 		g_signal_emit (cell, signals [PERCENT_CHANGED], 0, unit->percentage);
 
@@ -419,7 +422,7 @@
 
 	unit->is_discharging = TRUE;
 	unit->is_present = TRUE;
-	unit->percentage = gpm_phone_get_percentage (cell->priv->phone, 0);
+	unit->percentage = (gfloat) gpm_phone_get_percentage (cell->priv->phone, 0);
 	unit->is_charging = gpm_phone_get_on_ac (cell->priv->phone, 0);
 	unit->is_discharging = !unit->is_charging;
 	return TRUE;
@@ -528,20 +531,19 @@
 
 	details = g_string_new ("");
 	if (cell->priv->product) {
-		g_string_append_printf (details, _("<b>Product:</b> %s\n"), cell->priv->product);
+		g_string_append_printf (details, "<b>%s:</b> %s\n", _("Product"), cell->priv->product);
 	}
 	if (unit->is_present == FALSE) {
-		g_string_append (details, _("<b>Status:</b> Missing\n"));
+		g_string_append_printf (details, "<b>%s:</b> %s\n", _("Status"), _("Missing"));
 	} else if (gpm_cell_unit_is_charged (unit)) {
-		g_string_append (details, _("<b>Status:</b> Charged\n"));
+		g_string_append_printf (details, "<b>%s:</b> %s\n", _("Status"), _("Charged"));
 	} else if (unit->is_charging) {
-		g_string_append (details, _("<b>Status:</b> Charging\n"));
+		g_string_append_printf (details, "<b>%s:</b> %s\n", _("Status"), _("Charging"));
 	} else if (unit->is_discharging) {
-		g_string_append (details, _("<b>Status:</b> Discharging\n"));
+		g_string_append_printf (details, "<b>%s:</b> %s\n", _("Status"), _("Discharging"));
 	}
 	if (unit->percentage >= 0) {
-		g_string_append_printf (details, _("<b>Percentage charge:</b> %i%%\n"),
-					unit->percentage);
+		g_string_append_printf (details, "<b>%s:</b> %.1f%%\n", _("Percentage charge"), unit->percentage);
 	}
 	if (cell->priv->vendor) {
 		g_string_append_printf (details, "<b>%s</b> %s\n",
@@ -562,29 +564,29 @@
 				     cell->priv->technology);
 			technology = cell->priv->technology;
 		}
-		g_string_append_printf (details, "<b>%s</b> %s\n",
-					_("Technology:"), technology);
+		g_string_append_printf (details, "<b>%s:</b> %s\n",
+					_("Technology"), technology);
 	}
 	if (cell->priv->serial) {
-		g_string_append_printf (details, "<b>%s</b> %s\n",
-					_("Serial number:"), cell->priv->serial);
+		g_string_append_printf (details, "<b>%s:</b> %s\n",
+					_("Serial number"), cell->priv->serial);
 	}
 	if (cell->priv->model) {
-		g_string_append_printf (details, "<b>%s</b> %s\n",
-					_("Model:"), cell->priv->model);
+		g_string_append_printf (details, "<b>%s:</b> %s\n",
+					_("Model"), cell->priv->model);
 	}
 	if (unit->time_charge > 0) {
 		gchar *time_str;
 		time_str = gpm_get_timestring (unit->time_charge);
-		g_string_append_printf (details, "<b>%s</b> %s\n",
-					_("Charge time:"), time_str);
+		g_string_append_printf (details, "<b>%s:</b> %s\n",
+					_("Charge time"), time_str);
 		g_free (time_str);
 	}
 	if (unit->time_discharge > 0) {
 		gchar *time_str;
 		time_str = gpm_get_timestring (unit->time_discharge);
-		g_string_append_printf (details, "<b>%s</b> %s\n",
-					_("Discharge time:"), time_str);
+		g_string_append_printf (details, "<b>%s:</b> %s\n",
+					_("Discharge time"), time_str);
 		g_free (time_str);
 	}
 	if (unit->capacity > 0) {
@@ -598,42 +600,42 @@
 		} else {
 			condition = _("Poor");
 		}
-		g_string_append_printf (details, "<b>%s</b> %i%% (%s)\n",
-					_("Capacity:"),
+		g_string_append_printf (details, "<b>%s:</b> %i%% (%s)\n",
+					_("Capacity"),
 					unit->capacity, condition);
 	}
 	if (unit->measure == GPM_CELL_UNIT_MWH) {
 		if (unit->charge_current > 0) {
 			g_string_append_printf (details, "<b>%s</b> %.1f Wh\n",
-						_("Current charge:"),
+						_("Current charge"),
 						unit->charge_current / 1000.0f);
 		}
 		if (unit->charge_last_full > 0 &&
 		    unit->charge_design != unit->charge_last_full) {
-			g_string_append_printf (details, "<b>%s</b> %.1f Wh\n",
-						_("Last full charge:"),
+			g_string_append_printf (details, "<b>%s:</b> %.1f Wh\n",
+						_("Last full charge"),
 						unit->charge_last_full / 1000.0f);
 		}
 		if (unit->charge_design > 0) {
-			g_string_append_printf (details, "<b>%s</b> %.1f Wh\n",
-						_("Design charge:"),
+			g_string_append_printf (details, "<b>%s:</b> %.1f Wh\n",
+						_("Design charge"),
 						unit->charge_design / 1000.0f);
 		}
 		if (unit->rate > 0) {
-			g_string_append_printf (details, "<b>%s</b> %.1f W\n",
-						_("Charge rate:"),
+			g_string_append_printf (details, "<b>%s:</b> %.1f W\n",
+						_("Charge rate"),
 						unit->rate / 1000.0f);
 		}
 	}
 	if (unit->measure == GPM_CELL_UNIT_CSR) {
 		if (unit->charge_current > 0) {
-			g_string_append_printf (details, "<b>%s</b> %i/7\n",
-						_("Current charge:"),
+			g_string_append_printf (details, "<b>%s:</b> %i/7\n",
+						_("Current charge"),
 						unit->charge_current);
 		}
 		if (unit->charge_design > 0) {
-			g_string_append_printf (details, "<b>%s</b> %i/7\n",
-						_("Design charge:"),
+			g_string_append_printf (details, "<b>%s:</b> %i/7\n",
+						_("Design charge"),
 						unit->charge_design);
 		}
 	}
@@ -676,9 +678,9 @@
 	}
 
 	if (percentage != unit->percentage) {
-		unit->percentage = percentage;
-		gpm_debug ("** EMIT: percent-changed: %i", percentage);
-		g_signal_emit (cell, signals [PERCENT_CHANGED], 0, percentage);
+		unit->percentage = (gfloat) percentage;
+		gpm_debug ("** EMIT: percent-changed: %.1f", unit->percentage);
+		g_signal_emit (cell, signals [PERCENT_CHANGED], 0, unit->percentage);
 	}
 }
 
@@ -700,8 +702,8 @@
 			      G_STRUCT_OFFSET (GpmCellClass, percent_changed),
 			      NULL,
 			      NULL,
-			      g_cclosure_marshal_VOID__UINT,
-			      G_TYPE_NONE, 1, G_TYPE_UINT);
+			      g_cclosure_marshal_VOID__FLOAT,
+			      G_TYPE_NONE, 1, G_TYPE_FLOAT);
 	signals [DISCHARGING_CHANGED] =
 		g_signal_new ("discharging-changed",
 			      G_TYPE_FROM_CLASS (object_class),

Modified: trunk/src/gpm-cell.h
==============================================================================
--- trunk/src/gpm-cell.h	(original)
+++ trunk/src/gpm-cell.h	Sun Jul 27 10:02:39 2008
@@ -46,7 +46,7 @@
 {
 	GObjectClass	parent_class;
 	void		(* percent_changed)	(GpmCell	*cell,
-						 guint		 percent);
+						 gfloat		 percent);
 	void		(* charging_changed)	(GpmCell	*cell,
 						 gboolean	 charging);
 	void		(* discharging_changed)	(GpmCell	*cell,

Modified: trunk/src/gpm-engine.c
==============================================================================
--- trunk/src/gpm-engine.c	(original)
+++ trunk/src/gpm-engine.c	Sun Jul 27 10:02:39 2008
@@ -730,7 +730,7 @@
  */
 static void
 gpm_cell_array_percent_changed_cb (GpmCellArray *cell_array,
-				   guint         percent,
+				   gfloat        percent,
 				   GpmEngine    *engine)
 {
 	g_return_if_fail (engine != NULL);
@@ -789,7 +789,7 @@
  */
 static void
 gpm_cell_array_charge_low_cb (GpmCellArray *cell_array,
-			      guint         percent,
+			      gfloat        percent,
 			      GpmEngine    *engine)
 {
 	GpmCellUnitKind kind;
@@ -815,7 +815,7 @@
  */
 static void
 gpm_cell_array_charge_critical_cb (GpmCellArray *cell_array,
-				   guint         percent,
+				   gfloat        percent,
 				   GpmEngine    *engine)
 {
 	GpmCellUnitKind kind;
@@ -841,7 +841,7 @@
  */
 static void
 gpm_cell_array_charge_action_cb (GpmCellArray *cell_array,
-				 guint         percent,
+				 gfloat        percent,
 				 GpmEngine    *engine)
 {
 	GpmCellUnitKind kind;

Modified: trunk/src/gpm-manager.c
==============================================================================
--- trunk/src/gpm-manager.c	(original)
+++ trunk/src/gpm-manager.c	Sun Jul 27 10:02:39 2008
@@ -1368,25 +1368,25 @@
 	if (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 (%d%%)"),
+		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) {
 		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 (%d%%)"),
+		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) {
 		title = _("Mouse battery low");
-		message = g_strdup_printf (_("The wireless mouse attached to this computer is low in power (%d%%)"), unit->percentage);
+		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) {
 		title = _("Keyboard battery low");
-		message = g_strdup_printf (_("The wireless keyboard attached to this computer is low in power (%d%%)"), unit->percentage);
+		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) {
 		title = _("PDA battery low");
-		message = g_strdup_printf (_("The PDA attached to this computer is low in power (%d%%)"), unit->percentage);
+		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) {
 		title = _("Cell phone battery low");
-		message = g_strdup_printf (_("The cell phone attached to this computer is low in power (%d%%)"), unit->percentage);
+		message = g_strdup_printf (_("The cell phone attached to this computer is low in power (%.1f%%)"), unit->percentage);
 	}
 
 	/* get correct icon */
@@ -1461,7 +1461,7 @@
 			action_text = g_strdup_printf (_("This computer will shutdown in %s if the AC is not connected."), time_text);
 		}
 
-		message = g_strdup_printf (_("You have approximately <b>%s</b> of remaining battery life (%d%%). %s"),
+		message = g_strdup_printf (_("You have approximately <b>%s</b> of remaining battery life (%.1f%%). %s"),
 					   remaining_text, unit->percentage, action_text);
 
 		g_free (action);
@@ -1471,28 +1471,28 @@
 	} else if (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 (%d%%). "
+		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) {
 		title = _("Mouse battery low");
-		message = g_strdup_printf (_("The wireless mouse attached to this computer is very low in power (%d%%). "
+		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) {
 		title = _("Keyboard battery low");
-		message = g_strdup_printf (_("The wireless keyboard attached to this computer is very low in power (%d%%). "
+		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) {
 		title = _("PDA battery low");
-		message = g_strdup_printf (_("The PDA attached to this computer is very low in power (%d%%). "
+		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) {
 		title = _("Cell phone battery low");
-		message = g_strdup_printf (_("Your cell phone is very low in power (%d%%). "
+		message = g_strdup_printf (_("Your cell phone is very low in power (%.1f%%). "
 					     "This device will soon stop functioning if not charged."),
 					   unit->percentage);
 	}

Modified: trunk/src/gpm-tray-icon.c
==============================================================================
--- trunk/src/gpm-tray-icon.c	(original)
+++ trunk/src/gpm-tray-icon.c	Sun Jul 27 10:02:39 2008
@@ -514,7 +514,7 @@
 
 		/* generate the label */
 		desc = gpm_cell_unit_get_kind_localised (unit, FALSE);
-		label = g_strdup_printf ("%s (%i%%)", desc, unit->percentage);
+		label = g_strdup_printf ("%s (%.1f%%)", desc, unit->percentage);
 		item = gtk_image_menu_item_new_with_label (label);
 		g_free (label);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]