[gnome-settings-daemon] power: Remove unused gpm_upower_get_device_icon()



commit cedb4a4e892dd0e4b67e7ccba76553f42c9ace93
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Oct 17 10:48:53 2013 +0200

    power: Remove unused gpm_upower_get_device_icon()
    
    We're using the icons from UPower now.

 plugins/power/gpm-common.c |  144 --------------------------------------------
 plugins/power/gpm-common.h |    2 -
 2 files changed, 0 insertions(+), 146 deletions(-)
---
diff --git a/plugins/power/gpm-common.c b/plugins/power/gpm-common.c
index 7e47f2d..ebbaa7a 100644
--- a/plugins/power/gpm-common.c
+++ b/plugins/power/gpm-common.c
@@ -98,150 +98,6 @@ gpm_get_timestring (guint time_secs)
         return timestring;
 }
 
-static const gchar *
-gpm_upower_get_device_icon_index (UpDevice *device)
-{
-        gdouble percentage;
-        /* get device properties */
-        g_object_get (device, "percentage", &percentage, NULL);
-        if (percentage < 10)
-                return "000";
-        else if (percentage < 30)
-                return "020";
-        else if (percentage < 50)
-                return "040";
-        else if (percentage < 70)
-                return "060";
-        else if (percentage < 90)
-                return "080";
-        return "100";
-}
-
-static const gchar *
-gpm_upower_get_device_icon_suffix (UpDevice *device)
-{
-        gdouble percentage;
-        /* get device properties */
-        g_object_get (device, "percentage", &percentage, NULL);
-        if (percentage < 10)
-                return "caution";
-        else if (percentage < 30)
-                return "low";
-        else if (percentage < 60)
-                return "good";
-        return "full";
-}
-
-GIcon *
-gpm_upower_get_device_icon (UpDevice *device, gboolean use_symbolic)
-{
-        GString *filename;
-        gchar **iconnames;
-        const gchar *kind_str;
-        const gchar *suffix_str;
-        const gchar *index_str;
-        UpDeviceKind kind;
-        UpDeviceState state;
-        gboolean is_present;
-        gdouble percentage;
-        GIcon *icon = 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,
-                      NULL);
-
-        /* get correct icon prefix */
-        filename = g_string_new (NULL);
-
-        /* get the icon from some simple rules */
-        if (kind == UP_DEVICE_KIND_LINE_POWER) {
-                if (use_symbolic)
-                        g_string_append (filename, "ac-adapter-symbolic;");
-                g_string_append (filename, "ac-adapter;");
-
-        } else if (kind == UP_DEVICE_KIND_MONITOR) {
-                if (use_symbolic)
-                        g_string_append (filename, "gpm-monitor-symbolic;");
-                g_string_append (filename, "gpm-monitor;");
-
-        } else {
-
-                kind_str = up_device_kind_to_string (kind);
-                if (!is_present) {
-                        if (use_symbolic)
-                                g_string_append (filename, "battery-missing-symbolic;");
-                        g_string_append_printf (filename, "gpm-%s-missing;", kind_str);
-                        g_string_append_printf (filename, "gpm-%s-000;", kind_str);
-                        g_string_append (filename, "battery-missing;");
-
-                } else {
-                        switch (state) {
-                        case UP_DEVICE_STATE_EMPTY:
-                                if (use_symbolic)
-                                        g_string_append (filename, "battery-empty-symbolic;");
-                                g_string_append_printf (filename, "gpm-%s-empty;", kind_str);
-                                g_string_append_printf (filename, "gpm-%s-000;", kind_str);
-                                g_string_append (filename, "battery-empty;");
-                                break;
-                        case UP_DEVICE_STATE_FULLY_CHARGED:
-                                if (use_symbolic) {
-                                        g_string_append (filename, "battery-full-charged-symbolic;");
-                                        g_string_append (filename, "battery-full-charging-symbolic;");
-                                }
-                                g_string_append_printf (filename, "gpm-%s-full;", kind_str);
-                                g_string_append_printf (filename, "gpm-%s-100;", kind_str);
-                                g_string_append (filename, "battery-full-charged;");
-                                g_string_append (filename, "battery-full-charging;");
-                                break;
-                        case UP_DEVICE_STATE_CHARGING:
-                        case UP_DEVICE_STATE_PENDING_CHARGE:
-                                suffix_str = gpm_upower_get_device_icon_suffix (device);
-                                index_str = gpm_upower_get_device_icon_index (device);
-                                if (use_symbolic)
-                                        g_string_append_printf (filename, "battery-%s-charging-symbolic;", 
suffix_str);
-                                g_string_append_printf (filename, "gpm-%s-%s-charging;", kind_str, 
index_str);
-                                g_string_append_printf (filename, "battery-%s-charging;", suffix_str);
-                                break;
-                        case UP_DEVICE_STATE_DISCHARGING:
-                        case UP_DEVICE_STATE_PENDING_DISCHARGE:
-                                suffix_str = gpm_upower_get_device_icon_suffix (device);
-                                index_str = gpm_upower_get_device_icon_index (device);
-                                if (use_symbolic)
-                                        g_string_append_printf (filename, "battery-%s-symbolic;", 
suffix_str);
-                                g_string_append_printf (filename, "gpm-%s-%s;", kind_str, index_str);
-                                g_string_append_printf (filename, "battery-%s;", suffix_str);
-                                break;
-                        default:
-                                if (use_symbolic)
-                                        g_string_append (filename, "battery-missing-symbolic;");
-                                g_string_append (filename, "gpm-battery-missing;");
-                                g_string_append (filename, "battery-missing;");
-                        }
-                }
-        }
-
-        /* nothing matched */
-        if (filename->len == 0) {
-                g_warning ("nothing matched, falling back to default icon");
-                g_string_append (filename, "dialog-warning;");
-        }
-
-        g_debug ("got filename: %s", filename->str);
-
-        iconnames = g_strsplit (filename->str, ";", -1);
-        icon = g_themed_icon_new_from_names (iconnames, -1);
-
-        g_strfreev (iconnames);
-        g_string_free (filename, TRUE);
-        return icon;
-}
-
 static gboolean
 parse_vm_kernel_cmdline (gboolean *is_virtual_machine)
 {
diff --git a/plugins/power/gpm-common.h b/plugins/power/gpm-common.h
index ffd2d7a..422f130 100644
--- a/plugins/power/gpm-common.h
+++ b/plugins/power/gpm-common.h
@@ -29,8 +29,6 @@ G_BEGIN_DECLS
 
 /* UPower helpers */
 gchar           *gpm_get_timestring                     (guint           time);
-GIcon           *gpm_upower_get_device_icon             (UpDevice       *device,
-                                                         gboolean        use_symbolic);
 
 /* Power helpers */
 gboolean         gsd_power_is_hardware_a_vm             (void);


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