mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-05-09 10:38:34 +02:00
devkit-power-gobject/up-enum.h be gone
Port from devkit-power-gobject/up-enum.h to libupower-glib/up-types.h
This commit is contained in:
parent
4a12ee1bf7
commit
8e3791afe4
18 changed files with 29 additions and 69 deletions
|
|
@ -67,7 +67,6 @@ libdevkit_power_gobject_la_CFLAGS = \
|
|||
EXTRA_DIST = \
|
||||
up-client.h \
|
||||
up-device.h \
|
||||
up-enum.h \
|
||||
up-history-obj.h \
|
||||
up-qos-obj.h \
|
||||
up-stats-obj.h \
|
||||
|
|
|
|||
|
|
@ -72,50 +72,6 @@ typedef enum {
|
|||
DKP_QOS_TYPE_LAST
|
||||
} DkpQosType;
|
||||
|
||||
/* compat */
|
||||
typedef DkpDeviceType UpDeviceKind;
|
||||
typedef DkpDeviceState UpDeviceState;
|
||||
typedef DkpDeviceTechnology UpDeviceTechnology;
|
||||
typedef DkpQosType UpQosType;
|
||||
#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_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_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
|
||||
#define UP_DEVICE_STATE_EMPTY DKP_DEVICE_STATE_EMPTY
|
||||
#define UP_DEVICE_STATE_FULLY_CHARGED DKP_DEVICE_STATE_FULLY_CHARGED
|
||||
#define UP_DEVICE_STATE_PENDING_CHARGE DKP_DEVICE_STATE_PENDING_CHARGE
|
||||
#define UP_DEVICE_STATE_PENDING_DISCHARGE DKP_DEVICE_STATE_PENDING_DISCHARGE
|
||||
#define UP_DEVICE_STATE_LAST DKP_DEVICE_STATE_LAST
|
||||
#define UP_DEVICE_TECHNOLOGY_UNKNOWN DKP_DEVICE_TECHNOLOGY_UNKNOWN
|
||||
#define UP_DEVICE_TECHNOLOGY_LITHIUM_ION DKP_DEVICE_TECHNOLOGY_LITHIUM_ION
|
||||
#define UP_DEVICE_TECHNOLOGY_LITHIUM_POLYMER DKP_DEVICE_TECHNOLOGY_LITHIUM_POLYMER
|
||||
#define UP_DEVICE_TECHNOLOGY_LITHIUM_IRON_PHOSPHATE DKP_DEVICE_TECHNOLOGY_LITHIUM_IRON_PHOSPHATE
|
||||
#define UP_DEVICE_TECHNOLOGY_LEAD_ACID DKP_DEVICE_TECHNOLOGY_LEAD_ACID
|
||||
#define UP_DEVICE_TECHNOLOGY_NICKEL_CADMIUM DKP_DEVICE_TECHNOLOGY_NICKEL_CADMIUM
|
||||
#define UP_DEVICE_TECHNOLOGY_NICKEL_METAL_HYDRIDE DKP_DEVICE_TECHNOLOGY_NICKEL_METAL_HYDRIDE
|
||||
#define UP_DEVICE_TECHNOLOGY_LAST DKP_DEVICE_TECHNOLOGY_LAST
|
||||
#define UP_QOS_KIND_UNKNOWN DKP_QOS_TYPE_UNKNOWN
|
||||
#define UP_QOS_KIND_NETWORK DKP_QOS_TYPE_NETWORK
|
||||
#define UP_QOS_KIND_CPU_DMA DKP_QOS_TYPE_CPU_DMA
|
||||
#define UP_QOS_KIND_LAST DKP_QOS_TYPE_LAST
|
||||
|
||||
const gchar *dkp_device_type_to_text (DkpDeviceType type_enum);
|
||||
const gchar *dkp_device_state_to_text (DkpDeviceState state_enum);
|
||||
const gchar *dkp_device_technology_to_text (DkpDeviceTechnology technology_enum);
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
dkp-enum.h
|
||||
|
|
@ -25,6 +25,7 @@ INCLUDES = \
|
|||
$(GLIB_CFLAGS)
|
||||
|
||||
DEVKIT_POWER_LIBS = $(top_builddir)/devkit-power-gobject/libdevkit-power-gobject.la
|
||||
UPOWER_LIBS = $(top_builddir)/libupower-glib/libupower-glib.la
|
||||
|
||||
BUILT_SOURCES = \
|
||||
up-daemon-glue.h \
|
||||
|
|
@ -93,7 +94,8 @@ upowerd_LDADD = \
|
|||
$(USB_LIBS) \
|
||||
$(GIO_LIBS) \
|
||||
$(DBUS_GLIB_LIBS) \
|
||||
$(POLKIT_LIBS)
|
||||
$(POLKIT_LIBS) \
|
||||
$(UPOWER_LIBS)
|
||||
|
||||
if BACKEND_TYPE_DUMMY
|
||||
upowerd_LDADD += \
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ INCLUDES = \
|
|||
-DUP_COMPILATION \
|
||||
-DEGG_TEST \
|
||||
-I$(top_srcdir)/devkit-power-gobject \
|
||||
-I$(top_srcdir)/libupower-glib \
|
||||
$(DBUS_GLIB_CFLAGS) \
|
||||
$(POLKIT_CFLAGS) \
|
||||
$(GLIB_CFLAGS)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ INCLUDES = \
|
|||
-I$(top_builddir)/src -I$(top_srcdir)/src \
|
||||
-DUP_COMPILATION \
|
||||
-I$(top_srcdir)/devkit-power-gobject \
|
||||
-I$(top_srcdir)/libupower-glib \
|
||||
$(DBUS_GLIB_CFLAGS) \
|
||||
$(POLKIT_CFLAGS) \
|
||||
$(GLIB_CFLAGS)
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ INCLUDES = \
|
|||
-DUP_COMPILATION \
|
||||
-DG_UDEV_API_IS_SUBJECT_TO_CHANGE \
|
||||
-I$(top_srcdir)/devkit-power-gobject \
|
||||
-I$(top_srcdir)/libupower-glib \
|
||||
$(GIO_CFLAGS) \
|
||||
$(DBUS_GLIB_CFLAGS) \
|
||||
$(GUDEV_CFLAGS) \
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
#include "sysfs-utils.h"
|
||||
#include "egg-debug.h"
|
||||
|
||||
#include "up-enum.h"
|
||||
#include "up-types.h"
|
||||
#include "up-device-csr.h"
|
||||
|
||||
#define UP_DEVICE_CSR_REFRESH_TIMEOUT 30L
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
#include "sysfs-utils.h"
|
||||
#include "egg-debug.h"
|
||||
|
||||
#include "up-enum.h"
|
||||
#include "up-types.h"
|
||||
#include "up-device-hid.h"
|
||||
|
||||
#define UP_DEVICE_HID_REFRESH_TIMEOUT 30l
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
#include "sysfs-utils.h"
|
||||
#include "egg-debug.h"
|
||||
|
||||
#include "up-enum.h"
|
||||
#include "up-types.h"
|
||||
#include "up-device-supply.h"
|
||||
|
||||
#define UP_DEVICE_SUPPLY_REFRESH_TIMEOUT 30 /* seconds */
|
||||
|
|
@ -626,7 +626,7 @@ up_device_supply_refresh_battery (UpDeviceSupply *supply)
|
|||
|
||||
/* print what we did */
|
||||
egg_debug ("guessing battery state '%s' using global on-battery:%i",
|
||||
up_device_state_to_text (state), on_battery);
|
||||
up_device_state_to_string (state), on_battery);
|
||||
|
||||
g_object_unref (daemon);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
#include "sysfs-utils.h"
|
||||
#include "egg-debug.h"
|
||||
|
||||
#include "up-enum.h"
|
||||
#include "up-types.h"
|
||||
#include "up-device-wup.h"
|
||||
|
||||
#define UP_DEVICE_WUP_REFRESH_TIMEOUT 10 /* seconds */
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
#include "sysfs-utils.h"
|
||||
#include "egg-debug.h"
|
||||
|
||||
#include "up-enum.h"
|
||||
#include "up-types.h"
|
||||
#include "up-daemon.h"
|
||||
#include "up-input.h"
|
||||
#include "up-daemon.h"
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "up-enum.h"
|
||||
#include "up-types.h"
|
||||
#include "up-device.h"
|
||||
#include "up-daemon.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include <polkit/polkit.h>
|
||||
#include <dbus/dbus-glib.h>
|
||||
|
||||
#include "up-enum.h"
|
||||
#include "up-types.h"
|
||||
#include "up-device-list.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "up-enum.h"
|
||||
#include "up-types.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
|
|
|||
|
|
@ -795,7 +795,7 @@ up_device_compute_object_path (UpDevice *device)
|
|||
const gchar *type;
|
||||
guint i;
|
||||
|
||||
type = up_device_kind_to_text (device->priv->type);
|
||||
type = up_device_kind_to_string (device->priv->type);
|
||||
native_path = device->priv->native_path;
|
||||
basename = g_path_get_basename (native_path);
|
||||
id = g_strjoin ("_", type, basename, NULL);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "up-enum.h"
|
||||
#include "up-types.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
|
|
|||
23
src/up-qos.c
23
src/up-qos.c
|
|
@ -40,6 +40,7 @@
|
|||
#include "up-polkit.h"
|
||||
#include "up-qos-obj.h"
|
||||
#include "up-qos-glue.h"
|
||||
#include "up-types.h"
|
||||
|
||||
static void up_qos_finalize (GObject *object);
|
||||
|
||||
|
|
@ -121,7 +122,7 @@ up_qos_generate_cookie (UpQos *qos)
|
|||
* up_qos_get_lowest:
|
||||
**/
|
||||
static gint
|
||||
up_qos_get_lowest (UpQos *qos, UpQosType type)
|
||||
up_qos_get_lowest (UpQos *qos, UpQosKind type)
|
||||
{
|
||||
guint i;
|
||||
gint lowest = G_MAXINT;
|
||||
|
|
@ -153,7 +154,7 @@ up_qos_get_lowest (UpQos *qos, UpQosType type)
|
|||
* up_qos_latency_write:
|
||||
**/
|
||||
static gboolean
|
||||
up_qos_latency_write (UpQos *qos, UpQosType type, gint value)
|
||||
up_qos_latency_write (UpQos *qos, UpQosKind type, gint value)
|
||||
{
|
||||
gchar *text = NULL;
|
||||
gint retval;
|
||||
|
|
@ -187,7 +188,7 @@ out:
|
|||
* up_qos_latency_perhaps_changed:
|
||||
**/
|
||||
static gboolean
|
||||
up_qos_latency_perhaps_changed (UpQos *qos, UpQosType type)
|
||||
up_qos_latency_perhaps_changed (UpQos *qos, UpQosKind type)
|
||||
{
|
||||
gint lowest;
|
||||
gint *last;
|
||||
|
|
@ -206,7 +207,7 @@ up_qos_latency_perhaps_changed (UpQos *qos, UpQosType type)
|
|||
up_qos_latency_write (qos, type, lowest);
|
||||
|
||||
/* emit signal */
|
||||
g_signal_emit (qos, signals [LATENCY_CHANGED], 0, up_qos_type_to_text (type), lowest);
|
||||
g_signal_emit (qos, signals [LATENCY_CHANGED], 0, up_qos_kind_to_string (type), lowest);
|
||||
*last = lowest;
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -252,10 +253,10 @@ up_qos_request_latency (UpQos *qos, const gchar *type_text, gint value, gboolean
|
|||
gint pid;
|
||||
PolkitSubject *subject = NULL;
|
||||
gboolean retval;
|
||||
UpQosType type;
|
||||
UpQosKind type;
|
||||
|
||||
/* get correct data */
|
||||
type = up_qos_type_from_text (type_text);
|
||||
type = up_qos_kind_from_string (type_text);
|
||||
if (type == UP_QOS_KIND_UNKNOWN) {
|
||||
error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "type invalid: %s", type_text);
|
||||
dbus_g_method_return_error (context, error);
|
||||
|
|
@ -407,10 +408,10 @@ out:
|
|||
gboolean
|
||||
up_qos_get_latency (UpQos *qos, const gchar *type_text, gint *value, GError **error)
|
||||
{
|
||||
UpQosType type;
|
||||
UpQosKind type;
|
||||
|
||||
/* get correct data */
|
||||
type = up_qos_type_from_text (type_text);
|
||||
type = up_qos_kind_from_string (type_text);
|
||||
if (type == UP_QOS_KIND_UNKNOWN) {
|
||||
g_set_error (error, UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "type invalid: %s", type_text);
|
||||
return FALSE;
|
||||
|
|
@ -427,11 +428,11 @@ up_qos_get_latency (UpQos *qos, const gchar *type_text, gint *value, GError **er
|
|||
void
|
||||
up_qos_set_minimum_latency (UpQos *qos, const gchar *type_text, gint value, DBusGMethodInvocation *context)
|
||||
{
|
||||
UpQosType type;
|
||||
UpQosKind type;
|
||||
GError *error;
|
||||
|
||||
/* type valid? */
|
||||
type = up_qos_type_from_text (type_text);
|
||||
type = up_qos_kind_from_string (type_text);
|
||||
if (type == UP_QOS_KIND_UNKNOWN) {
|
||||
error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "type invalid: %s", type_text);
|
||||
dbus_g_method_return_error (context, error);
|
||||
|
|
@ -471,7 +472,7 @@ up_qos_get_latency_requests (UpQos *qos, GPtrArray **requests, GError **error)
|
|||
3, obj->cmdline,
|
||||
4, 0, //obj->timespec,
|
||||
5, obj->persistent,
|
||||
6, up_qos_type_to_text (obj->type),
|
||||
6, up_qos_kind_to_string (obj->type),
|
||||
7, obj->value,
|
||||
G_MAXUINT);
|
||||
g_ptr_array_add (*requests, g_value_get_boxed (&elem));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue