[gnome-settings-daemon] power: Remove unused gpm_upower_get_device_description()
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] power: Remove unused gpm_upower_get_device_description()
- Date: Wed, 16 Oct 2013 20:55:38 +0000 (UTC)
commit 9e63c5d07b90cd6ea37a812714702f0e4fda579c
Author: Bastien Nocera <hadess hadess net>
Date: Wed Oct 16 16:41:02 2013 +0200
power: Remove unused gpm_upower_get_device_description()
plugins/power/gpm-common.c | 152 --------------------------------------------
plugins/power/gpm-common.h | 1 -
2 files changed, 0 insertions(+), 153 deletions(-)
---
diff --git a/plugins/power/gpm-common.c b/plugins/power/gpm-common.c
index 1dd25a7..81af0b7 100644
--- a/plugins/power/gpm-common.c
+++ b/plugins/power/gpm-common.c
@@ -425,158 +425,6 @@ out:
return g_string_free (description, FALSE);
}
-gchar *
-gpm_upower_get_device_description (UpDevice *device)
-{
- GString *details;
- const gchar *text;
- gchar *time_str;
- UpDeviceKind kind;
- UpDeviceState state;
- UpDeviceTechnology technology;
- gdouble percentage;
- gdouble capacity;
- gdouble energy;
- gdouble energy_full;
- gdouble energy_full_design;
- gdouble energy_rate;
- gboolean is_present;
- gint64 time_to_full;
- gint64 time_to_empty;
- gchar *vendor = NULL;
- gchar *serial = NULL;
- gchar *model = NULL;
-
- g_return_val_if_fail (device != NULL, NULL);
-
- /* get device properties */
- g_object_get (device,
- "kind", &kind,
- "state", &state,
- "percentage", &percentage,
- "is-present", &is_present,
- "time-to-full", &time_to_full,
- "time-to-empty", &time_to_empty,
- "technology", &technology,
- "capacity", &capacity,
- "energy", &energy,
- "energy-full", &energy_full,
- "energy-full-design", &energy_full_design,
- "energy-rate", &energy_rate,
- "vendor", &vendor,
- "serial", &serial,
- "model", &model,
- NULL);
-
- details = g_string_new ("");
- text = gpm_device_kind_to_localised_string (kind, 1);
- /* TRANSLATORS: the type of data, e.g. Laptop battery */
- g_string_append_printf (details, "<b>%s</b> %s\n", _("Product:"), text);
-
- if (!is_present) {
- /* TRANSLATORS: device is missing */
- g_string_append_printf (details, "<b>%s</b> %s\n", _("Status:"), _("Missing"));
- } else if (state == UP_DEVICE_STATE_FULLY_CHARGED) {
- /* TRANSLATORS: device is charged */
- g_string_append_printf (details, "<b>%s</b> %s\n", _("Status:"), _("Charged"));
- } else if (state == UP_DEVICE_STATE_CHARGING) {
- /* TRANSLATORS: device is charging */
- g_string_append_printf (details, "<b>%s</b> %s\n", _("Status:"), _("Charging"));
- } else if (state == UP_DEVICE_STATE_DISCHARGING) {
- /* TRANSLATORS: device is discharging */
- g_string_append_printf (details, "<b>%s</b> %s\n", _("Status:"), _("Discharging"));
- }
-
- if (percentage >= 0) {
- /* TRANSLATORS: percentage */
- g_string_append_printf (details, "<b>%s</b> %.1f%%\n", _("Percentage charge:"), percentage);
- }
- if (vendor) {
- /* TRANSLATORS: manufacturer */
- g_string_append_printf (details, "<b>%s</b> %s\n", _("Vendor:"), vendor);
- }
- if (serial) {
- /* TRANSLATORS: serial number of the battery */
- g_string_append_printf (details, "<b>%s</b> %s\n", _("Serial number:"), serial);
- }
- if (model) {
- /* TRANSLATORS: model number of the battery */
- g_string_append_printf (details, "<b>%s</b> %s\n", _("Model:"), model);
- }
- if (time_to_full > 0) {
- time_str = gpm_get_timestring (time_to_full);
- /* TRANSLATORS: time to fully charged */
- g_string_append_printf (details, "<b>%s</b> %s\n", _("Charge time:"), time_str);
- g_free (time_str);
- }
- if (time_to_empty > 0) {
- time_str = gpm_get_timestring (time_to_empty);
- /* TRANSLATORS: time to empty */
- g_string_append_printf (details, "<b>%s</b> %s\n", _("Discharge time:"), time_str);
- g_free (time_str);
- }
- if (capacity > 0) {
- const gchar *condition;
- if (capacity > 99) {
- /* TRANSLATORS: Excellent, Good, Fair and Poor are all related to battery Capacity */
- condition = _("Excellent");
- } else if (capacity > 90) {
- condition = _("Good");
- } else if (capacity > 70) {
- condition = _("Fair");
- } else {
- condition = _("Poor");
- }
- /* TRANSLATORS: %.1f is a percentage and %s the condition (Excellent, Good, ...) */
- g_string_append_printf (details, "<b>%s</b> %.1f%% (%s)\n",
- _("Capacity:"), capacity, condition);
- }
- if (kind == UP_DEVICE_KIND_BATTERY) {
- if (energy > 0) {
- /* TRANSLATORS: current charge */
- g_string_append_printf (details, "<b>%s</b> %.1f Wh\n",
- _("Current charge:"), energy);
- }
- if (energy_full > 0 &&
- energy_full_design != energy_full) {
- /* TRANSLATORS: last full is the charge the battery was seen to charge to */
- g_string_append_printf (details, "<b>%s</b> %.1f Wh\n",
- _("Last full charge:"), energy_full);
- }
- if (energy_full_design > 0) {
- /* Translators: */
- /* TRANSLATORS: Design charge is the amount of charge the battery is designed to
have when brand new */
- g_string_append_printf (details, "<b>%s</b> %.1f Wh\n",
- _("Design charge:"), energy_full_design);
- }
- if (energy_rate > 0) {
- /* TRANSLATORS: the charge or discharge rate */
- g_string_append_printf (details, "<b>%s</b> %.1f W\n",
- _("Charge rate:"), energy_rate);
- }
- }
- if (kind == UP_DEVICE_KIND_MOUSE ||
- kind == UP_DEVICE_KIND_KEYBOARD) {
- if (energy > 0) {
- /* TRANSLATORS: the current charge for CSR devices */
- g_string_append_printf (details, "<b>%s</b> %.0f/7\n",
- _("Current charge:"), energy);
- }
- if (energy_full_design > 0) {
- /* TRANSLATORS: the design charge for CSR devices */
- g_string_append_printf (details, "<b>%s</b> %.0f/7\n",
- _("Design charge:"), energy_full_design);
- }
- }
- /* remove the last \n */
- g_string_truncate (details, details->len-1);
-
- g_free (vendor);
- g_free (serial);
- g_free (model);
- return g_string_free (details, FALSE);
-}
-
const gchar *
gpm_device_kind_to_localised_string (UpDeviceKind kind, guint number)
{
diff --git a/plugins/power/gpm-common.h b/plugins/power/gpm-common.h
index 52fa39a..083f35b 100644
--- a/plugins/power/gpm-common.h
+++ b/plugins/power/gpm-common.h
@@ -36,7 +36,6 @@ const gchar *gpm_device_state_to_localised_string (UpDeviceState state);
GIcon *gpm_upower_get_device_icon (UpDevice *device,
gboolean use_symbolic);
gchar *gpm_upower_get_device_summary (UpDevice *device);
-gchar *gpm_upower_get_device_description (UpDevice *device);
/* Power helpers */
gboolean gsd_power_is_hardware_a_vm (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]