mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-04-19 20:40:40 +02:00
trivial: DkpInput -> UpInput (no ABI or API break)
This commit is contained in:
parent
e04b5a9e00
commit
c8cec18f06
3 changed files with 48 additions and 48 deletions
|
|
@ -77,7 +77,7 @@ up_backend_device_new (UpBackend *backend, GUdevDevice *native)
|
|||
const gchar *subsys;
|
||||
const gchar *native_path;
|
||||
UpDevice *device = NULL;
|
||||
DkpInput *input;
|
||||
UpInput *input;
|
||||
gboolean ret;
|
||||
|
||||
subsys = g_udev_device_get_subsystem (native);
|
||||
|
|
@ -127,8 +127,8 @@ up_backend_device_new (UpBackend *backend, GUdevDevice *native)
|
|||
} else if (g_strcmp0 (subsys, "input") == 0) {
|
||||
|
||||
/* check input device */
|
||||
input = dkp_input_new ();
|
||||
ret = dkp_input_coldplug (input, backend->priv->daemon, native);
|
||||
input = up_input_new ();
|
||||
ret = up_input_coldplug (input, backend->priv->daemon, native);
|
||||
if (!ret) {
|
||||
g_object_unref (input);
|
||||
goto out;
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
#include "up-input.h"
|
||||
#include "up-daemon.h"
|
||||
|
||||
struct DkpInputPrivate
|
||||
struct UpInputPrivate
|
||||
{
|
||||
int eventfp;
|
||||
struct input_event event;
|
||||
|
|
@ -56,8 +56,8 @@ struct DkpInputPrivate
|
|||
UpDaemon *daemon;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (DkpInput, dkp_input, G_TYPE_OBJECT)
|
||||
#define DKP_INPUT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DKP_TYPE_INPUT, DkpInputPrivate))
|
||||
G_DEFINE_TYPE (UpInput, up_input, G_TYPE_OBJECT)
|
||||
#define UP_INPUT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_INPUT, UpInputPrivate))
|
||||
|
||||
/* we must use this kernel-compatible implementation */
|
||||
#define BITS_PER_LONG (sizeof(long) * 8)
|
||||
|
|
@ -68,10 +68,10 @@ G_DEFINE_TYPE (DkpInput, dkp_input, G_TYPE_OBJECT)
|
|||
#define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1)
|
||||
|
||||
/**
|
||||
* dkp_input_str_to_bitmask:
|
||||
* up_input_str_to_bitmask:
|
||||
**/
|
||||
static gint
|
||||
dkp_input_str_to_bitmask (const gchar *s, glong *bitmask, size_t max_size)
|
||||
up_input_str_to_bitmask (const gchar *s, glong *bitmask, size_t max_size)
|
||||
{
|
||||
gint i, j;
|
||||
gchar **v;
|
||||
|
|
@ -96,12 +96,12 @@ dkp_input_str_to_bitmask (const gchar *s, glong *bitmask, size_t max_size)
|
|||
}
|
||||
|
||||
/**
|
||||
* dkp_input_event_io:
|
||||
* up_input_event_io:
|
||||
**/
|
||||
static gboolean
|
||||
dkp_input_event_io (GIOChannel *channel, GIOCondition condition, gpointer data)
|
||||
up_input_event_io (GIOChannel *channel, GIOCondition condition, gpointer data)
|
||||
{
|
||||
DkpInput *input = (DkpInput*) data;
|
||||
UpInput *input = (UpInput*) data;
|
||||
GError *error = NULL;
|
||||
gsize read_bytes;
|
||||
glong bitmask[NBITS(SW_MAX)];
|
||||
|
|
@ -161,10 +161,10 @@ out:
|
|||
}
|
||||
|
||||
/**
|
||||
* dkp_input_coldplug:
|
||||
* up_input_coldplug:
|
||||
**/
|
||||
gboolean
|
||||
dkp_input_coldplug (DkpInput *input, UpDaemon *daemon, GUdevDevice *d)
|
||||
up_input_coldplug (UpInput *input, UpDaemon *daemon, GUdevDevice *d)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
gchar *path;
|
||||
|
|
@ -200,7 +200,7 @@ dkp_input_coldplug (DkpInput *input, UpDaemon *daemon, GUdevDevice *d)
|
|||
}
|
||||
|
||||
/* convert to a bitmask */
|
||||
num_bits = dkp_input_str_to_bitmask (contents, bitmask, sizeof (bitmask));
|
||||
num_bits = up_input_str_to_bitmask (contents, bitmask, sizeof (bitmask));
|
||||
if (num_bits != 1) {
|
||||
egg_debug ("not one bitmask entry for %s", native_path);
|
||||
ret = FALSE;
|
||||
|
|
@ -254,7 +254,7 @@ dkp_input_coldplug (DkpInput *input, UpDaemon *daemon, GUdevDevice *d)
|
|||
input->priv->daemon = g_object_ref (daemon);
|
||||
|
||||
/* watch this */
|
||||
g_io_add_watch (input->priv->channel, G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL, dkp_input_event_io, input);
|
||||
g_io_add_watch (input->priv->channel, G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL, up_input_event_io, input);
|
||||
|
||||
/* set if we are closed */
|
||||
egg_debug ("using %s for lid event", native_path);
|
||||
|
|
@ -268,29 +268,29 @@ out:
|
|||
}
|
||||
|
||||
/**
|
||||
* dkp_input_init:
|
||||
* up_input_init:
|
||||
**/
|
||||
static void
|
||||
dkp_input_init (DkpInput *input)
|
||||
up_input_init (UpInput *input)
|
||||
{
|
||||
input->priv = DKP_INPUT_GET_PRIVATE (input);
|
||||
input->priv = UP_INPUT_GET_PRIVATE (input);
|
||||
input->priv->eventfp = -1;
|
||||
input->priv->channel = NULL;
|
||||
input->priv->daemon = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* dkp_input_finalize:
|
||||
* up_input_finalize:
|
||||
**/
|
||||
static void
|
||||
dkp_input_finalize (GObject *object)
|
||||
up_input_finalize (GObject *object)
|
||||
{
|
||||
DkpInput *input;
|
||||
UpInput *input;
|
||||
|
||||
g_return_if_fail (object != NULL);
|
||||
g_return_if_fail (DKP_IS_INPUT (object));
|
||||
g_return_if_fail (UP_IS_INPUT (object));
|
||||
|
||||
input = DKP_INPUT (object);
|
||||
input = UP_INPUT (object);
|
||||
g_return_if_fail (input->priv != NULL);
|
||||
|
||||
if (input->priv->daemon != NULL)
|
||||
|
|
@ -301,26 +301,26 @@ dkp_input_finalize (GObject *object)
|
|||
g_io_channel_shutdown (input->priv->channel, FALSE, NULL);
|
||||
g_io_channel_unref (input->priv->channel);
|
||||
}
|
||||
G_OBJECT_CLASS (dkp_input_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (up_input_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
/**
|
||||
* dkp_input_class_init:
|
||||
* up_input_class_init:
|
||||
**/
|
||||
static void
|
||||
dkp_input_class_init (DkpInputClass *klass)
|
||||
up_input_class_init (UpInputClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
object_class->finalize = dkp_input_finalize;
|
||||
g_type_class_add_private (klass, sizeof (DkpInputPrivate));
|
||||
object_class->finalize = up_input_finalize;
|
||||
g_type_class_add_private (klass, sizeof (UpInputPrivate));
|
||||
}
|
||||
|
||||
/**
|
||||
* dkp_input_new:
|
||||
* up_input_new:
|
||||
**/
|
||||
DkpInput *
|
||||
dkp_input_new (void)
|
||||
UpInput *
|
||||
up_input_new (void)
|
||||
{
|
||||
return g_object_new (DKP_TYPE_INPUT, NULL);
|
||||
return g_object_new (UP_TYPE_INPUT, NULL);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#ifndef __DKP_INPUT_H__
|
||||
#define __DKP_INPUT_H__
|
||||
#ifndef __UP_INPUT_H__
|
||||
#define __UP_INPUT_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
|
|
@ -27,33 +27,33 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define DKP_TYPE_INPUT (dkp_input_get_type ())
|
||||
#define DKP_INPUT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), DKP_TYPE_INPUT, DkpInput))
|
||||
#define DKP_INPUT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), DKP_TYPE_INPUT, DkpInputClass))
|
||||
#define DKP_IS_INPUT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), DKP_TYPE_INPUT))
|
||||
#define DKP_IS_INPUT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), DKP_TYPE_INPUT))
|
||||
#define DKP_INPUT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), DKP_TYPE_INPUT, DkpInputClass))
|
||||
#define UP_TYPE_INPUT (up_input_get_type ())
|
||||
#define UP_INPUT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), UP_TYPE_INPUT, UpInput))
|
||||
#define UP_INPUT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), UP_TYPE_INPUT, UpInputClass))
|
||||
#define UP_IS_INPUT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), UP_TYPE_INPUT))
|
||||
#define UP_IS_INPUT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), UP_TYPE_INPUT))
|
||||
#define UP_INPUT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), UP_TYPE_INPUT, UpInputClass))
|
||||
|
||||
typedef struct DkpInputPrivate DkpInputPrivate;
|
||||
typedef struct UpInputPrivate UpInputPrivate;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GObject parent;
|
||||
DkpInputPrivate *priv;
|
||||
} DkpInput;
|
||||
UpInputPrivate *priv;
|
||||
} UpInput;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
} DkpInputClass;
|
||||
} UpInputClass;
|
||||
|
||||
GType dkp_input_get_type (void);
|
||||
DkpInput *dkp_input_new (void);
|
||||
gboolean dkp_input_coldplug (DkpInput *input,
|
||||
GType up_input_get_type (void);
|
||||
UpInput *up_input_new (void);
|
||||
gboolean up_input_coldplug (UpInput *input,
|
||||
UpDaemon *daemon,
|
||||
GUdevDevice *d);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __DKP_INPUT_H__ */
|
||||
#endif /* __UP_INPUT_H__ */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue