Rename EekboardProxy to EekboardDevice.

This commit is contained in:
Daiki Ueno
2011-02-14 18:47:23 +09:00
parent ab43010a98
commit 89c5c46dbb
9 changed files with 132 additions and 1827 deletions

View File

@ -18,8 +18,8 @@
lib_LTLIBRARIES = libeekboard.la
libeekboard_headers = eekboard.h eekboard-proxy.h
libeekboard_sources = eekboard-proxy.c
libeekboard_headers = eekboard.h eekboard-device.h
libeekboard_sources = eekboard-device.c
libeekboard_la_SOURCES = $(libeekboard_sources)
libeekboard_la_CFLAGS = -I$(top_srcdir) $(GIO2_CFLAGS)

View File

@ -19,7 +19,7 @@
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include "eekboard-proxy.h"
#include "eekboard-device.h"
enum {
KEY_PRESSED,
@ -29,35 +29,35 @@ enum {
static guint signals[LAST_SIGNAL] = { 0, };
struct _EekboardProxy {
struct _EekboardDevice {
GDBusProxy parent;
};
struct _EekboardProxyClass {
struct _EekboardDeviceClass {
GDBusProxyClass parent_class;
};
G_DEFINE_TYPE (EekboardProxy, eekboard_proxy, G_TYPE_DBUS_PROXY);
G_DEFINE_TYPE (EekboardDevice, eekboard_device, G_TYPE_DBUS_PROXY);
static void
eekboard_proxy_real_g_signal (GDBusProxy *self,
eekboard_device_real_g_signal (GDBusProxy *self,
const gchar *sender_name,
const gchar *signal_name,
GVariant *parameters)
{
EekboardProxy *proxy = EEKBOARD_PROXY (self);
EekboardDevice *device = EEKBOARD_DEVICE (self);
guint *keycode;
if (g_strcmp0 (signal_name, "KeyPressed") == 0) {
g_variant_get (parameters, "(u)", &keycode);
g_signal_emit_by_name (proxy, "key-pressed", keycode);
g_signal_emit_by_name (device, "key-pressed", keycode);
return;
}
if (g_strcmp0 (signal_name, "KeyReleased") == 0) {
g_variant_get (parameters, "(u)", &keycode);
g_signal_emit_by_name (proxy, "key-released", keycode);
g_signal_emit_by_name (device, "key-released", keycode);
return;
}
@ -65,12 +65,12 @@ eekboard_proxy_real_g_signal (GDBusProxy *self,
}
static void
eekboard_proxy_class_init (EekboardProxyClass *klass)
eekboard_device_class_init (EekboardDeviceClass *klass)
{
GDBusProxyClass *proxy_class = G_DBUS_PROXY_CLASS (klass);
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
proxy_class->g_signal = eekboard_proxy_real_g_signal;
proxy_class->g_signal = eekboard_device_real_g_signal;
signals[KEY_PRESSED] =
g_signal_new ("key-pressed",
@ -98,15 +98,15 @@ eekboard_proxy_class_init (EekboardProxyClass *klass)
}
static void
eekboard_proxy_init (EekboardProxy *proxy)
eekboard_device_init (EekboardDevice *device)
{
}
EekboardProxy *
eekboard_proxy_new (const gchar *path,
GDBusConnection *connection,
GCancellable *cancellable,
GError **error)
EekboardDevice *
eekboard_device_new (const gchar *path,
GDBusConnection *connection,
GCancellable *cancellable,
GError **error)
{
GInitable *initable;
@ -114,7 +114,7 @@ eekboard_proxy_new (const gchar *path,
g_assert (G_IS_DBUS_CONNECTION(connection));
initable =
g_initable_new (EEKBOARD_TYPE_PROXY,
g_initable_new (EEKBOARD_TYPE_DEVICE,
cancellable,
error,
"g-connection", connection,
@ -125,7 +125,7 @@ eekboard_proxy_new (const gchar *path,
"g-object-path", path,
NULL);
if (initable != NULL)
return EEKBOARD_PROXY (initable);
return EEKBOARD_DEVICE (initable);
return NULL;
}
@ -146,12 +146,12 @@ proxy_call_async_ready_cb (GObject *source_object,
}
void
eekboard_proxy_set_keyboard (EekboardProxy *proxy, EekKeyboard *keyboard)
eekboard_device_set_keyboard (EekboardDevice *device, EekKeyboard *keyboard)
{
GVariant *variant;
variant = eek_serializable_serialize (EEK_SERIALIZABLE(keyboard));
g_dbus_proxy_call (G_DBUS_PROXY(proxy),
g_dbus_proxy_call (G_DBUS_PROXY(device),
"SetKeyboard",
g_variant_new ("(v)", variant),
G_DBUS_CALL_FLAGS_NONE,
@ -163,9 +163,10 @@ eekboard_proxy_set_keyboard (EekboardProxy *proxy, EekKeyboard *keyboard)
}
void
eekboard_proxy_set_group (EekboardProxy *proxy, gint group)
eekboard_device_set_group (EekboardDevice *device,
gint group)
{
g_dbus_proxy_call (G_DBUS_PROXY(proxy),
g_dbus_proxy_call (G_DBUS_PROXY(device),
"SetGroup",
g_variant_new ("(i)", group),
G_DBUS_CALL_FLAGS_NONE,
@ -176,9 +177,9 @@ eekboard_proxy_set_group (EekboardProxy *proxy, gint group)
}
void
eekboard_proxy_show (EekboardProxy *proxy)
eekboard_device_show (EekboardDevice *device)
{
g_dbus_proxy_call (G_DBUS_PROXY(proxy),
g_dbus_proxy_call (G_DBUS_PROXY(device),
"Show",
NULL,
G_DBUS_CALL_FLAGS_NONE,
@ -189,9 +190,9 @@ eekboard_proxy_show (EekboardProxy *proxy)
}
void
eekboard_proxy_hide (EekboardProxy *proxy)
eekboard_device_hide (EekboardDevice *device)
{
g_dbus_proxy_call (G_DBUS_PROXY(proxy),
g_dbus_proxy_call (G_DBUS_PROXY(device),
"Hide",
NULL,
G_DBUS_CALL_FLAGS_NONE,
@ -202,10 +203,10 @@ eekboard_proxy_hide (EekboardProxy *proxy)
}
void
eekboard_proxy_press_key (EekboardProxy *proxy,
guint keycode)
eekboard_device_press_key (EekboardDevice *device,
guint keycode)
{
g_dbus_proxy_call (G_DBUS_PROXY(proxy),
g_dbus_proxy_call (G_DBUS_PROXY(device),
"PressKey",
g_variant_new ("(u)", keycode),
G_DBUS_CALL_FLAGS_NONE,
@ -216,10 +217,10 @@ eekboard_proxy_press_key (EekboardProxy *proxy,
}
void
eekboard_proxy_release_key (EekboardProxy *proxy,
guint keycode)
eekboard_device_release_key (EekboardDevice *device,
guint keycode)
{
g_dbus_proxy_call (G_DBUS_PROXY(proxy),
g_dbus_proxy_call (G_DBUS_PROXY(device),
"ReleaseKey",
g_variant_new ("(u)", keycode),
G_DBUS_CALL_FLAGS_NONE,

View File

@ -0,0 +1,52 @@
/*
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010-2011 Red Hat, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef EEKBOARD_DEVICE_H
#define EEKBOARD_DEVICE_H 1
#include <gio/gio.h>
#include "eek/eek.h"
G_BEGIN_DECLS
#define EEKBOARD_TYPE_DEVICE (eekboard_device_get_type())
#define EEKBOARD_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEKBOARD_TYPE_DEVICE, EekboardDevice))
#define EEKBOARD_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEKBOARD_TYPE_DEVICE, EekboardDeviceClass))
#define EEKBOARD_IS_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEKBOARD_TYPE_DEVICE))
#define EEKBOARD_IS_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEKBOARD_TYPE_DEVICE))
#define EEKBOARD_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEKBOARD_TYPE_DEVICE, EekboardDeviceClass))
typedef struct _EekboardDevice EekboardDevice;
typedef struct _EekboardDeviceClass EekboardDeviceClass;
EekboardDevice *eekboard_device_new (const gchar *path,
GDBusConnection *connection,
GCancellable *cancellable,
GError **error);
void eekboard_device_set_keyboard (EekboardDevice *device,
EekKeyboard *keyboard);
void eekboard_device_set_group (EekboardDevice *device,
gint group);
void eekboard_device_show (EekboardDevice *device);
void eekboard_device_hide (EekboardDevice *device);
void eekboard_device_press_key (EekboardDevice *device,
guint keycode);
void eekboard_device_release_key (EekboardDevice *device,
guint keycode);
G_END_DECLS
#endif /* EEKBOARD_DEVICE_H */

View File

@ -1,52 +0,0 @@
/*
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010-2011 Red Hat, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef EEKBOARD_PROXY_H
#define EEKBOARD_PROXY_H 1
#include <gio/gio.h>
#include "eek/eek.h"
G_BEGIN_DECLS
#define EEKBOARD_TYPE_PROXY (eekboard_proxy_get_type())
#define EEKBOARD_PROXY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEKBOARD_TYPE_PROXY, EekboardProxy))
#define EEKBOARD_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEKBOARD_TYPE_PROXY, EekboardProxyClass))
#define EEKBOARD_IS_PROXY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEKBOARD_TYPE_PROXY))
#define EEKBOARD_IS_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEKBOARD_TYPE_PROXY))
#define EEKBOARD_PROXY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEKBOARD_TYPE_PROXY, EekboardProxyClass))
typedef struct _EekboardProxy EekboardProxy;
typedef struct _EekboardProxyClass EekboardProxyClass;
EekboardProxy *eekboard_proxy_new (const gchar *path,
GDBusConnection *connection,
GCancellable *cancellable,
GError **error);
void eekboard_proxy_set_keyboard (EekboardProxy *proxy,
EekKeyboard *keyboard);
void eekboard_proxy_set_group (EekboardProxy *proxy,
gint group);
void eekboard_proxy_show (EekboardProxy *proxy);
void eekboard_proxy_hide (EekboardProxy *proxy);
void eekboard_proxy_press_key (EekboardProxy *proxy,
guint keycode);
void eekboard_proxy_release_key (EekboardProxy *proxy,
guint keycode);
G_END_DECLS
#endif /* EEKBOARD_PROXY_H */

View File

@ -18,6 +18,6 @@
#ifndef EEKBOARD_H
#define EEKBOARD_H 1
#include "eekboard/eekboard-proxy.h"
#include "eekboard/eekboard-device.h"
#endif /* EEKBOARD_H */