Commit 5e8ba545 authored by Richard Hughes's avatar Richard Hughes

trivial: rename the new libupower 'type' to 'kind' to avoid clashing with GObject generated names

parent 27fada20
......@@ -73,28 +73,28 @@ typedef enum {
} DkpQosType;
/* compat */
typedef DkpDeviceType UpDeviceType;
typedef DkpDeviceType UpDeviceKind;
typedef DkpDeviceState UpDeviceState;
typedef DkpDeviceTechnology UpDeviceTechnology;
typedef DkpQosType UpQosType;
#define up_device_type_to_text dkp_device_type_to_text
#define up_device_kind_to_text dkp_device_type_to_text
#define up_device_state_to_text dkp_device_state_to_text
#define up_device_technology_to_text dkp_device_technology_to_text
#define up_qos_type_to_text dkp_qos_type_to_text
#define up_device_type_from_text dkp_device_type_from_text
#define up_device_kind_from_text dkp_device_type_from_text
#define up_device_state_from_text dkp_device_state_from_text
#define up_device_technology_from_text dkp_device_technology_from_text
#define up_qos_type_from_text dkp_qos_type_from_text
#define UP_DEVICE_TYPE_UNKNOWN DKP_DEVICE_TYPE_UNKNOWN
#define UP_DEVICE_TYPE_LINE_POWER DKP_DEVICE_TYPE_LINE_POWER
#define UP_DEVICE_TYPE_BATTERY DKP_DEVICE_TYPE_BATTERY
#define UP_DEVICE_TYPE_UPS DKP_DEVICE_TYPE_UPS
#define UP_DEVICE_TYPE_MONITOR DKP_DEVICE_TYPE_MONITOR
#define UP_DEVICE_TYPE_MOUSE DKP_DEVICE_TYPE_MOUSE
#define UP_DEVICE_TYPE_KEYBOARD DKP_DEVICE_TYPE_KEYBOARD
#define UP_DEVICE_TYPE_PDA DKP_DEVICE_TYPE_PDA
#define UP_DEVICE_TYPE_PHONE DKP_DEVICE_TYPE_PHONE
#define UP_DEVICE_TYPE_LAST DKP_DEVICE_TYPE_LAST
#define UP_DEVICE_KIND_UNKNOWN DKP_DEVICE_TYPE_UNKNOWN
#define UP_DEVICE_KIND_LINE_POWER DKP_DEVICE_TYPE_LINE_POWER
#define UP_DEVICE_KIND_BATTERY DKP_DEVICE_TYPE_BATTERY
#define UP_DEVICE_KIND_UPS DKP_DEVICE_TYPE_UPS
#define UP_DEVICE_KIND_MONITOR DKP_DEVICE_TYPE_MONITOR
#define UP_DEVICE_KIND_MOUSE DKP_DEVICE_TYPE_MOUSE
#define UP_DEVICE_KIND_KEYBOARD DKP_DEVICE_TYPE_KEYBOARD
#define UP_DEVICE_KIND_PDA DKP_DEVICE_TYPE_PDA
#define UP_DEVICE_KIND_PHONE DKP_DEVICE_TYPE_PHONE
#define UP_DEVICE_KIND_LAST DKP_DEVICE_TYPE_LAST
#define UP_DEVICE_STATE_UNKNOWN DKP_DEVICE_STATE_UNKNOWN
#define UP_DEVICE_STATE_CHARGING DKP_DEVICE_STATE_CHARGING
#define UP_DEVICE_STATE_DISCHARGING DKP_DEVICE_STATE_DISCHARGING
......
......@@ -69,7 +69,7 @@ struct _UpDevicePrivate
gboolean is_rechargeable;
gboolean has_history;
gboolean has_statistics;
UpDeviceType type;
UpDeviceKind kind;
UpDeviceState state;
UpDeviceTechnology technology;
gdouble capacity; /* percent */
......@@ -100,7 +100,7 @@ enum {
PROP_IS_RECHARGEABLE,
PROP_HAS_HISTORY,
PROP_HAS_STATISTICS,
PROP_TYPE,
PROP_KIND,
PROP_STATE,
PROP_TECHNOLOGY,
PROP_CAPACITY,
......@@ -174,7 +174,7 @@ up_device_collect_props_cb (const char *key, const GValue *value, UpDevice *devi
} else if (g_strcmp0 (key, "UpdateTime") == 0) {
device->priv->update_time = g_value_get_uint64 (value);
} else if (g_strcmp0 (key, "Type") == 0) {
device->priv->type = g_value_get_uint (value);
device->priv->kind = g_value_get_uint (value);
} else if (g_strcmp0 (key, "Online") == 0) {
device->priv->online = g_value_get_boolean (value);
} else if (g_strcmp0 (key, "HasHistory") == 0) {
......@@ -408,39 +408,39 @@ up_device_to_text (UpDevice *device)
g_string_printf (string, " updated: %s (%d seconds ago)\n", time_buf, (int) (time (NULL) - device->priv->update_time));
g_string_printf (string, " has history: %s\n", up_device_bool_to_string (device->priv->has_history));
g_string_printf (string, " has statistics: %s\n", up_device_bool_to_string (device->priv->has_statistics));
g_string_printf (string, " %s\n", up_device_type_to_string (device->priv->type));
g_string_printf (string, " %s\n", up_device_kind_to_string (device->priv->kind));
if (device->priv->type == UP_DEVICE_TYPE_BATTERY ||
device->priv->type == UP_DEVICE_TYPE_MOUSE ||
device->priv->type == UP_DEVICE_TYPE_KEYBOARD ||
device->priv->type == UP_DEVICE_TYPE_UPS)
if (device->priv->kind == UP_DEVICE_KIND_BATTERY ||
device->priv->kind == UP_DEVICE_KIND_MOUSE ||
device->priv->kind == UP_DEVICE_KIND_KEYBOARD ||
device->priv->kind == UP_DEVICE_KIND_UPS)
g_string_printf (string, " present: %s\n", up_device_bool_to_string (device->priv->is_present));
if (device->priv->type == UP_DEVICE_TYPE_BATTERY ||
device->priv->type == UP_DEVICE_TYPE_MOUSE ||
device->priv->type == UP_DEVICE_TYPE_KEYBOARD)
if (device->priv->kind == UP_DEVICE_KIND_BATTERY ||
device->priv->kind == UP_DEVICE_KIND_MOUSE ||
device->priv->kind == UP_DEVICE_KIND_KEYBOARD)
g_string_printf (string, " rechargeable: %s\n", up_device_bool_to_string (device->priv->is_rechargeable));
if (device->priv->type == UP_DEVICE_TYPE_BATTERY ||
device->priv->type == UP_DEVICE_TYPE_MOUSE ||
device->priv->type == UP_DEVICE_TYPE_KEYBOARD ||
device->priv->type == UP_DEVICE_TYPE_UPS)
if (device->priv->kind == UP_DEVICE_KIND_BATTERY ||
device->priv->kind == UP_DEVICE_KIND_MOUSE ||
device->priv->kind == UP_DEVICE_KIND_KEYBOARD ||
device->priv->kind == UP_DEVICE_KIND_UPS)
g_string_printf (string, " state: %s\n", up_device_state_to_string (device->priv->state));
if (device->priv->type == UP_DEVICE_TYPE_BATTERY) {
if (device->priv->kind == UP_DEVICE_KIND_BATTERY) {
g_string_printf (string, " energy: %g Wh\n", device->priv->energy);
g_string_printf (string, " energy-empty: %g Wh\n", device->priv->energy_empty);
g_string_printf (string, " energy-full: %g Wh\n", device->priv->energy_full);
g_string_printf (string, " energy-full-design: %g Wh\n", device->priv->energy_full_design);
}
if (device->priv->type == UP_DEVICE_TYPE_BATTERY ||
device->priv->type == UP_DEVICE_TYPE_MONITOR)
if (device->priv->kind == UP_DEVICE_KIND_BATTERY ||
device->priv->kind == UP_DEVICE_KIND_MONITOR)
g_string_printf (string, " energy-rate: %g W\n", device->priv->energy_rate);
if (device->priv->type == UP_DEVICE_TYPE_UPS ||
device->priv->type == UP_DEVICE_TYPE_BATTERY ||
device->priv->type == UP_DEVICE_TYPE_MONITOR) {
if (device->priv->kind == UP_DEVICE_KIND_UPS ||
device->priv->kind == UP_DEVICE_KIND_BATTERY ||
device->priv->kind == UP_DEVICE_KIND_MONITOR) {
if (device->priv->voltage > 0)
g_string_printf (string, " voltage: %g V\n", device->priv->voltage);
}
if (device->priv->type == UP_DEVICE_TYPE_BATTERY ||
device->priv->type == UP_DEVICE_TYPE_UPS) {
if (device->priv->kind == UP_DEVICE_KIND_BATTERY ||
device->priv->kind == UP_DEVICE_KIND_UPS) {
if (device->priv->time_to_full > 0) {
time_str = up_device_to_text_time_to_string (device->priv->time_to_full);
g_string_printf (string, " time to full: %s\n", time_str);
......@@ -452,22 +452,22 @@ up_device_to_text (UpDevice *device)
g_free (time_str);
}
}
if (device->priv->type == UP_DEVICE_TYPE_BATTERY ||
device->priv->type == UP_DEVICE_TYPE_MOUSE ||
device->priv->type == UP_DEVICE_TYPE_KEYBOARD ||
device->priv->type == UP_DEVICE_TYPE_UPS)
if (device->priv->kind == UP_DEVICE_KIND_BATTERY ||
device->priv->kind == UP_DEVICE_KIND_MOUSE ||
device->priv->kind == UP_DEVICE_KIND_KEYBOARD ||
device->priv->kind == UP_DEVICE_KIND_UPS)
g_string_printf (string, " percentage: %g%%\n", device->priv->percentage);
if (device->priv->type == UP_DEVICE_TYPE_BATTERY) {
if (device->priv->kind == UP_DEVICE_KIND_BATTERY) {
if (device->priv->capacity > 0)
g_string_printf (string, " capacity: %g%%\n", device->priv->capacity);
}
if (device->priv->type == UP_DEVICE_TYPE_BATTERY) {
if (device->priv->kind == UP_DEVICE_KIND_BATTERY) {
if (device->priv->technology != UP_DEVICE_TECHNOLOGY_UNKNOWN)
g_string_printf (string, " technology: %s\n", up_device_technology_to_string (device->priv->technology));
}
if (device->priv->type == UP_DEVICE_TYPE_LINE_POWER)
if (device->priv->kind == UP_DEVICE_KIND_LINE_POWER)
g_string_printf (string, " online: %s\n", up_device_bool_to_string (device->priv->online));
if (device->priv->type == UP_DEVICE_TYPE_BATTERY) {
if (device->priv->kind == UP_DEVICE_KIND_BATTERY) {
if (device->priv->recall_notice) {
g_string_printf (string, " recall vendor: %s\n", device->priv->recall_vendor);
g_string_printf (string, " recall url: %s\n", device->priv->recall_url);
......@@ -536,8 +536,8 @@ up_device_set_property (GObject *object, guint prop_id, const GValue *value, GPa
case PROP_UPDATE_TIME:
device->priv->update_time = g_value_get_uint64 (value);
break;
case PROP_TYPE:
device->priv->type = g_value_get_uint (value);
case PROP_KIND:
device->priv->kind = g_value_get_uint (value);
break;
case PROP_POWER_SUPPLY:
device->priv->power_supply = g_value_get_boolean (value);
......@@ -652,8 +652,8 @@ up_device_get_property (GObject *object, guint prop_id, GValue *value, GParamSpe
case PROP_HAS_STATISTICS:
g_value_set_boolean (value, device->priv->has_statistics);
break;
case PROP_TYPE:
g_value_set_uint (value, device->priv->type);
case PROP_KIND:
g_value_set_uint (value, device->priv->kind);
break;
case PROP_STATE:
g_value_set_uint (value, device->priv->state);
......@@ -878,19 +878,19 @@ up_device_class_init (UpDeviceClass *klass)
FALSE,
G_PARAM_READWRITE));
/**
* UpDevice:type:
* UpDevice:kind:
*
* The device type, e.g. %UP_DEVICE_TYPE_KEYBOARD.
* The device kind, e.g. %UP_DEVICE_KIND_KEYBOARD.
*
* Since: 0.9.0
**/
g_object_class_install_property (object_class,
PROP_TYPE,
g_param_spec_uint ("type",
PROP_KIND,
g_param_spec_uint ("kind",
NULL, NULL,
UP_DEVICE_TYPE_UNKNOWN,
UP_DEVICE_TYPE_LAST,
UP_DEVICE_TYPE_UNKNOWN,
UP_DEVICE_KIND_UNKNOWN,
UP_DEVICE_KIND_LAST,
UP_DEVICE_KIND_UNKNOWN,
G_PARAM_READWRITE));
/**
* UpDevice:state:
......
......@@ -36,41 +36,41 @@
#include "up-types.h"
/**
* up_device_type_to_string:
* up_device_kind_to_string:
*
* Converts a #UpDeviceType to a string.
* Converts a #UpDeviceKind to a string.
*
* Return value: identifier string
*
* Since: 0.9.0
**/
const gchar *
up_device_type_to_string (UpDeviceType type_enum)
up_device_kind_to_string (UpDeviceKind type_enum)
{
const gchar *type = NULL;
switch (type_enum) {
case UP_DEVICE_TYPE_LINE_POWER:
case UP_DEVICE_KIND_LINE_POWER:
type = "line-power";
break;
case UP_DEVICE_TYPE_BATTERY:
case UP_DEVICE_KIND_BATTERY:
type = "battery";
break;
case UP_DEVICE_TYPE_UPS:
case UP_DEVICE_KIND_UPS:
type = "ups";
break;
case UP_DEVICE_TYPE_MONITOR:
case UP_DEVICE_KIND_MONITOR:
type = "monitor";
break;
case UP_DEVICE_TYPE_MOUSE:
case UP_DEVICE_KIND_MOUSE:
type = "mouse";
break;
case UP_DEVICE_TYPE_KEYBOARD:
case UP_DEVICE_KIND_KEYBOARD:
type = "keyboard";
break;
case UP_DEVICE_TYPE_PDA:
case UP_DEVICE_KIND_PDA:
type = "pda";
break;
case UP_DEVICE_TYPE_PHONE:
case UP_DEVICE_KIND_PHONE:
type = "phone";
break;
default:
......@@ -81,36 +81,36 @@ up_device_type_to_string (UpDeviceType type_enum)
}
/**
* up_device_type_from_string:
* up_device_kind_from_string:
*
* Converts a string to a #UpDeviceType.
* Converts a string to a #UpDeviceKind.
*
* Return value: enumerated value
*
* Since: 0.9.0
**/
UpDeviceType
up_device_type_from_string (const gchar *type)
UpDeviceKind
up_device_kind_from_string (const gchar *type)
{
if (type == NULL)
return UP_DEVICE_TYPE_UNKNOWN;
return UP_DEVICE_KIND_UNKNOWN;
if (g_strcmp0 (type, "line-power") == 0)
return UP_DEVICE_TYPE_LINE_POWER;
return UP_DEVICE_KIND_LINE_POWER;
if (g_strcmp0 (type, "battery") == 0)
return UP_DEVICE_TYPE_BATTERY;
return UP_DEVICE_KIND_BATTERY;
if (g_strcmp0 (type, "ups") == 0)
return UP_DEVICE_TYPE_UPS;
return UP_DEVICE_KIND_UPS;
if (g_strcmp0 (type, "monitor") == 0)
return UP_DEVICE_TYPE_MONITOR;
return UP_DEVICE_KIND_MONITOR;
if (g_strcmp0 (type, "mouse") == 0)
return UP_DEVICE_TYPE_MOUSE;
return UP_DEVICE_KIND_MOUSE;
if (g_strcmp0 (type, "keyboard") == 0)
return UP_DEVICE_TYPE_KEYBOARD;
return UP_DEVICE_KIND_KEYBOARD;
if (g_strcmp0 (type, "pda") == 0)
return UP_DEVICE_TYPE_PDA;
return UP_DEVICE_KIND_PDA;
if (g_strcmp0 (type, "phone") == 0)
return UP_DEVICE_TYPE_PHONE;
return UP_DEVICE_TYPE_UNKNOWN;
return UP_DEVICE_KIND_PHONE;
return UP_DEVICE_KIND_UNKNOWN;
}
/**
......
......@@ -31,22 +31,22 @@
G_BEGIN_DECLS
/**
* UpDeviceType:
* UpDeviceKind:
*
* The device type.
**/
typedef enum {
UP_DEVICE_TYPE_UNKNOWN,
UP_DEVICE_TYPE_LINE_POWER,
UP_DEVICE_TYPE_BATTERY,
UP_DEVICE_TYPE_UPS,
UP_DEVICE_TYPE_MONITOR,
UP_DEVICE_TYPE_MOUSE,
UP_DEVICE_TYPE_KEYBOARD,
UP_DEVICE_TYPE_PDA,
UP_DEVICE_TYPE_PHONE,
UP_DEVICE_TYPE_LAST
} UpDeviceType;
UP_DEVICE_KIND_UNKNOWN,
UP_DEVICE_KIND_LINE_POWER,
UP_DEVICE_KIND_BATTERY,
UP_DEVICE_KIND_UPS,
UP_DEVICE_KIND_MONITOR,
UP_DEVICE_KIND_MOUSE,
UP_DEVICE_KIND_KEYBOARD,
UP_DEVICE_KIND_PDA,
UP_DEVICE_KIND_PHONE,
UP_DEVICE_KIND_LAST
} UpDeviceKind;
/**
* UpDeviceState:
......@@ -92,10 +92,10 @@ typedef enum {
UP_QOS_TYPE_LAST
} UpQosType;
const gchar *up_device_type_to_string (UpDeviceType type_enum);
const gchar *up_device_kind_to_string (UpDeviceKind type_enum);
const gchar *up_device_state_to_string (UpDeviceState state_enum);
const gchar *up_device_technology_to_string (UpDeviceTechnology technology_enum);
UpDeviceType up_device_type_from_string (const gchar *type);
UpDeviceKind up_device_kind_from_string (const gchar *type);
UpDeviceState up_device_state_from_string (const gchar *state);
UpDeviceTechnology up_device_technology_from_string (const gchar *technology);
const gchar *up_qos_type_to_string (UpQosType type);
......
......@@ -166,7 +166,7 @@ up_backend_init (UpBackend *backend)
"vendor", "hughsie",
"model", "BAT1",
"serial", "0001",
"type", UP_DEVICE_TYPE_BATTERY,
"type", UP_DEVICE_KIND_BATTERY,
"online", FALSE,
"power-supply", TRUE,
"is-present", TRUE,
......
......@@ -130,7 +130,7 @@ up_device_supply_acline_coldplug (UpDevice *device)
g_object_set (device,
"online", FALSE,
"power-supply", TRUE,
"type", UP_DEVICE_TYPE_LINE_POWER,
"type", UP_DEVICE_KIND_LINE_POWER,
NULL);
ret = up_device_supply_acline_set_properties (device);
......@@ -146,7 +146,7 @@ up_device_supply_battery_coldplug (UpDevice *device, UpAcpiNative *native)
{
gboolean ret;
g_object_set (device, "type", UP_DEVICE_TYPE_BATTERY, NULL);
g_object_set (device, "type", UP_DEVICE_KIND_BATTERY, NULL);
ret = up_device_supply_battery_set_properties (device, native);
return ret;
......@@ -386,15 +386,15 @@ up_device_supply_refresh (UpDevice *device)
{
GObject *object;
GTimeVal timeval;
UpDeviceType type;
UpDeviceKind type;
gboolean ret;
g_object_get (device, "type", &type, NULL);
switch (type) {
case UP_DEVICE_TYPE_LINE_POWER:
case UP_DEVICE_KIND_LINE_POWER:
ret = up_device_supply_acline_set_properties (device);
break;
case UP_DEVICE_TYPE_BATTERY:
case UP_DEVICE_KIND_BATTERY:
object = up_device_get_native (device);
ret = up_device_supply_battery_set_properties (device, UP_ACPI_NATIVE (object));
break;
......@@ -417,7 +417,7 @@ up_device_supply_refresh (UpDevice *device)
static gboolean
up_device_supply_get_on_battery (UpDevice *device, gboolean *on_battery)
{
UpDeviceType type;
UpDeviceKind type;
UpDeviceState state;
gboolean is_present;
......@@ -429,7 +429,7 @@ up_device_supply_get_on_battery (UpDevice *device, gboolean *on_battery)
"is-present", &is_present,
NULL);
if (type != UP_DEVICE_TYPE_BATTERY)
if (type != UP_DEVICE_KIND_BATTERY)
return FALSE;
if (state == UP_DEVICE_STATE_UNKNOWN)
return FALSE;
......@@ -472,7 +472,7 @@ up_device_supply_get_low_battery (UpDevice *device, gboolean *low_battery)
static gboolean
up_device_supply_get_online (UpDevice *device, gboolean *online)
{
UpDeviceType type;
UpDeviceKind type;
gboolean online_tmp;
g_return_val_if_fail (online != NULL, FALSE);
......@@ -482,7 +482,7 @@ up_device_supply_get_online (UpDevice *device, gboolean *online)
"online", &online_tmp,
NULL);
if (type != UP_DEVICE_TYPE_LINE_POWER)
if (type != UP_DEVICE_KIND_LINE_POWER)
return FALSE;
*online = online_tmp;
......
......@@ -146,9 +146,9 @@ up_device_csr_coldplug (UpDevice *device)
/* which one? */
if (g_strcmp0 (type, "mouse") == 0)
g_object_set (device, "type", UP_DEVICE_TYPE_MOUSE, NULL);
g_object_set (device, "type", UP_DEVICE_KIND_MOUSE, NULL);
else if (g_strcmp0 (type, "keyboard") == 0)
g_object_set (device, "type", UP_DEVICE_TYPE_KEYBOARD, NULL);
g_object_set (device, "type", UP_DEVICE_KIND_KEYBOARD, NULL);
else {
egg_debug ("not a recognised csr device");
goto out;
......
......@@ -347,7 +347,7 @@ up_device_hid_coldplug (UpDevice *device)
/* hardcode some values */
g_object_set (device,
"type", UP_DEVICE_TYPE_UPS,
"type", UP_DEVICE_KIND_UPS,
"is-rechargeable", TRUE,
"power-supply", TRUE,
"is-present", TRUE,
......
......@@ -128,7 +128,7 @@ static gboolean
up_device_supply_get_on_battery (UpDevice *device, gboolean *on_battery)
{
UpDeviceSupply *supply = UP_DEVICE_SUPPLY (device);
UpDeviceType type;
UpDeviceKind type;
UpDeviceState state;
gboolean is_present;
......@@ -141,7 +141,7 @@ up_device_supply_get_on_battery (UpDevice *device, gboolean *on_battery)
"is-present", &is_present,
NULL);
if (type != UP_DEVICE_TYPE_BATTERY)
if (type != UP_DEVICE_KIND_BATTERY)
return FALSE;
if (state == UP_DEVICE_STATE_UNKNOWN)
return FALSE;
......@@ -189,7 +189,7 @@ static gboolean
up_device_supply_get_online (UpDevice *device, gboolean *online)
{
UpDeviceSupply *supply = UP_DEVICE_SUPPLY (device);
UpDeviceType type;
UpDeviceKind type;
gboolean online_tmp;
g_return_val_if_fail (UP_IS_DEVICE_SUPPLY (supply), FALSE);
......@@ -200,7 +200,7 @@ up_device_supply_get_online (UpDevice *device, gboolean *online)
"online", &online_tmp,
NULL);
if (type != UP_DEVICE_TYPE_LINE_POWER)
if (type != UP_DEVICE_KIND_LINE_POWER)
return FALSE;
*online = online_tmp;
......@@ -600,7 +600,7 @@ up_device_supply_refresh_battery (UpDeviceSupply *supply)
NULL);
/* only guess when we have more than one battery devices */
battery_count = up_daemon_get_number_devices_of_type (daemon, UP_DEVICE_TYPE_BATTERY);
battery_count = up_daemon_get_number_devices_of_type (daemon, UP_DEVICE_KIND_BATTERY);
/* try to find a suitable icon depending on AC state */
if (battery_count > 1) {
......@@ -718,7 +718,7 @@ up_device_supply_coldplug (UpDevice *device)
GUdevDevice *native;
const gchar *native_path;
gchar *device_type = NULL;
UpDeviceType type = UP_DEVICE_TYPE_UNKNOWN;
UpDeviceKind type = UP_DEVICE_KIND_UNKNOWN;
up_device_supply_reset_values (supply);
......@@ -734,21 +734,21 @@ up_device_supply_coldplug (UpDevice *device)
device_type = up_device_supply_get_string (native_path, "type");
if (device_type != NULL) {
if (g_ascii_strcasecmp (device_type, "mains") == 0) {
type = UP_DEVICE_TYPE_LINE_POWER;
type = UP_DEVICE_KIND_LINE_POWER;
} else if (g_ascii_strcasecmp (device_type, "battery") == 0) {
type = UP_DEVICE_TYPE_BATTERY;
type = UP_DEVICE_KIND_BATTERY;
} else {
egg_warning ("did not recognise type %s, please report", device_type);
}
}
/* if reading the device type did not work, use the previous method */
if (type == UP_DEVICE_TYPE_UNKNOWN) {
if (type == UP_DEVICE_KIND_UNKNOWN) {
if (sysfs_file_exists (native_path, "online")) {
type = UP_DEVICE_TYPE_LINE_POWER;
type = UP_DEVICE_KIND_LINE_POWER;
} else {
/* this is a good guess as UPS and CSR are not in the kernel */
type = UP_DEVICE_TYPE_BATTERY;
type = UP_DEVICE_KIND_BATTERY;
}
}
......@@ -807,7 +807,7 @@ up_device_supply_refresh (UpDevice *device)
gboolean ret;
GTimeVal timeval;
UpDeviceSupply *supply = UP_DEVICE_SUPPLY (device);
UpDeviceType type;
UpDeviceKind type;
if (supply->priv->poll_timer_id > 0) {
g_source_remove (supply->priv->poll_timer_id);
......@@ -816,10 +816,10 @@ up_device_supply_refresh (UpDevice *device)
g_object_get (device, "type", &type, NULL);
switch (type) {
case UP_DEVICE_TYPE_LINE_POWER:
case UP_DEVICE_KIND_LINE_POWER:
ret = up_device_supply_refresh_line_power (supply);
break;
case UP_DEVICE_TYPE_BATTERY:
case UP_DEVICE_KIND_BATTERY:
ret = up_device_supply_refresh_battery (supply);
/* Seems that we don't get change uevents from the
......
......@@ -363,7 +363,7 @@ up_device_wup_coldplug (UpDevice *device)
/* hardcode some values */
native_path = g_udev_device_get_sysfs_path (native);
g_object_set (device,
"type", UP_DEVICE_TYPE_MONITOR,
"type", UP_DEVICE_KIND_MONITOR,
"is-rechargeable", FALSE,
"power-supply", FALSE,
"is-present", FALSE,
......
......@@ -330,12 +330,12 @@ up_daemon_get_on_battery_local (UpDaemon *daemon)
* up_daemon_get_number_devices_of_type:
**/
guint
up_daemon_get_number_devices_of_type (UpDaemon *daemon, UpDeviceType type)
up_daemon_get_number_devices_of_type (UpDaemon *daemon, UpDeviceKind type)
{
guint i;
UpDevice *device;
GPtrArray *array;
UpDeviceType type_tmp;
UpDeviceKind type_tmp;
guint count = 0;
/* ask each device */
......@@ -445,7 +445,7 @@ up_daemon_refresh_battery_devices (UpDaemon *daemon)
guint i;
GPtrArray *array;
UpDevice *device;
UpDeviceType type;
UpDeviceKind type;
/* refresh all devices in array */
array = up_device_list_get_array (daemon->priv->power_devices);
......@@ -455,7 +455,7 @@ up_daemon_refresh_battery_devices (UpDaemon *daemon)
g_object_get (device,
"type", &type,
NULL);
if (type == UP_DEVICE_TYPE_BATTERY)
if (type == UP_DEVICE_KIND_BATTERY)
up_device_refresh_internal (device);
}
g_ptr_array_unref (array);
......@@ -742,7 +742,7 @@ static void
up_daemon_device_changed_cb (UpDevice *device, UpDaemon *daemon)
{
const gchar *object_path;
UpDeviceType type;
UpDeviceKind type;
gboolean ret;
g_return_if_fail (UP_IS_DAEMON (daemon));
......@@ -752,7 +752,7 @@ up_daemon_device_changed_cb (UpDevice *device, UpDaemon *daemon)
g_object_get (device,
"type", &type,
NULL);
if (type == UP_DEVICE_TYPE_LINE_POWER) {
if (type == UP_DEVICE_KIND_LINE_POWER) {
/* refresh now, and again in a little while */
up_daemon_refresh_battery_devices (daemon);
up_daemon_poll_battery_devices_for_a_little_bit (daemon);
......@@ -791,7 +791,7 @@ up_daemon_device_changed_cb (UpDevice *device, UpDaemon *daemon)
static void
up_daemon_device_added_cb (UpBackend *backend, GObject *native, UpDevice *device, UpDaemon *daemon)
{
UpDeviceType type;
UpDeviceKind type;
const gchar *object_path;
g_return_if_fail (UP_IS_DAEMON (daemon));
......@@ -809,7 +809,7 @@ up_daemon_device_added_cb (UpBackend *backend, GObject *native, UpDevice *device
g_object_get (device,
"type", &type,
NULL);
if (type == UP_DEVICE_TYPE_BATTERY)
if (type == UP_DEVICE_KIND_BATTERY)
up_daemon_poll_battery_devices_for_a_little_bit (daemon);