dbus: Rename handler from eekboard_service
This commit is contained in:
@ -16,27 +16,15 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* SECTION:eekboard-service
|
|
||||||
* @short_description: base implementation of eekboard service
|
|
||||||
*
|
|
||||||
* Provides a dbus object, and contains the context.
|
|
||||||
*
|
|
||||||
* The #EekboardService class provides a base server side
|
|
||||||
* implementation of eekboard service.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "dbus.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
|
|
||||||
#include "eekboard/eekboard-service.h"
|
|
||||||
|
|
||||||
void
|
void
|
||||||
eekboard_service_destroy(EekboardService *service)
|
dbus_handler_destroy(DBusHandler *service)
|
||||||
{
|
{
|
||||||
g_free (service->object_path);
|
g_free (service->object_path);
|
||||||
|
|
||||||
@ -67,7 +55,7 @@ eekboard_service_destroy(EekboardService *service)
|
|||||||
static gboolean
|
static gboolean
|
||||||
handle_set_visible(SmPuriOSK0 *object, GDBusMethodInvocation *invocation,
|
handle_set_visible(SmPuriOSK0 *object, GDBusMethodInvocation *invocation,
|
||||||
gboolean arg_visible, gpointer user_data) {
|
gboolean arg_visible, gpointer user_data) {
|
||||||
EekboardService *service = user_data;
|
DBusHandler *service = user_data;
|
||||||
|
|
||||||
if (service->context) {
|
if (service->context) {
|
||||||
if (arg_visible) {
|
if (arg_visible) {
|
||||||
@ -80,7 +68,7 @@ handle_set_visible(SmPuriOSK0 *object, GDBusMethodInvocation *invocation,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_visible(EekboardService *service,
|
static void on_visible(DBusHandler *service,
|
||||||
GParamSpec *pspec,
|
GParamSpec *pspec,
|
||||||
ServerContextService *context)
|
ServerContextService *context)
|
||||||
{
|
{
|
||||||
@ -94,16 +82,11 @@ static void on_visible(EekboardService *service,
|
|||||||
sm_puri_osk0_set_visible(service->dbus_interface, visible);
|
sm_puri_osk0_set_visible(service->dbus_interface, visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
DBusHandler *
|
||||||
* eekboard_service_new:
|
dbus_handler_new (GDBusConnection *connection,
|
||||||
* @connection: a #GDBusConnection
|
|
||||||
* @object_path: object path
|
|
||||||
*/
|
|
||||||
EekboardService *
|
|
||||||
eekboard_service_new (GDBusConnection *connection,
|
|
||||||
const gchar *object_path)
|
const gchar *object_path)
|
||||||
{
|
{
|
||||||
EekboardService *self = calloc(1, sizeof(EekboardService));
|
DBusHandler *self = calloc(1, sizeof(DBusHandler));
|
||||||
self->object_path = g_strdup(object_path);
|
self->object_path = g_strdup(object_path);
|
||||||
self->connection = connection;
|
self->connection = connection;
|
||||||
|
|
||||||
@ -127,7 +110,7 @@ eekboard_service_new (GDBusConnection *connection,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
eekboard_service_set_context(EekboardService *service,
|
dbus_handler_set_context(DBusHandler *service,
|
||||||
ServerContextService *context)
|
ServerContextService *context)
|
||||||
{
|
{
|
||||||
g_return_if_fail (!service->context);
|
g_return_if_fail (!service->context);
|
||||||
@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||||
* Copyright (C) 2010-2011 Red Hat, Inc.
|
* Copyright (C) 2010-2011 Red Hat, Inc.
|
||||||
|
* Copyright (C) 2019-2020 Purism, SPC
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -15,10 +16,8 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#ifndef EEKBOARD_SERVICE_H
|
#ifndef DBUS_H_
|
||||||
#define EEKBOARD_SERVICE_H 1
|
#define DBUS_H_ 1
|
||||||
|
|
||||||
#define __EEKBOARD_SERVICE_H_INSIDE__ 1
|
|
||||||
|
|
||||||
#include "server-context-service.h"
|
#include "server-context-service.h"
|
||||||
|
|
||||||
@ -26,13 +25,10 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define EEKBOARD_SERVICE_PATH "/sm/puri/OSK0"
|
#define DBUS_SERVICE_PATH "/sm/puri/OSK0"
|
||||||
#define EEKBOARD_SERVICE_INTERFACE "sm.puri.OSK0"
|
#define DBUS_SERVICE_INTERFACE "sm.puri.OSK0"
|
||||||
|
|
||||||
/**
|
typedef struct _DBusHandler
|
||||||
* EekboardService: DBus handling
|
|
||||||
*/
|
|
||||||
typedef struct _EekboardService
|
|
||||||
{
|
{
|
||||||
GDBusConnection *connection;
|
GDBusConnection *connection;
|
||||||
SmPuriOSK0 *dbus_interface;
|
SmPuriOSK0 *dbus_interface;
|
||||||
@ -41,12 +37,12 @@ typedef struct _EekboardService
|
|||||||
char *object_path;
|
char *object_path;
|
||||||
|
|
||||||
ServerContextService *context; // unowned reference
|
ServerContextService *context; // unowned reference
|
||||||
} EekboardService;
|
} DBusHandler;
|
||||||
|
|
||||||
EekboardService * eekboard_service_new (GDBusConnection *connection,
|
DBusHandler * dbus_handler_new (GDBusConnection *connection,
|
||||||
const gchar *object_path);
|
const gchar *object_path);
|
||||||
void eekboard_service_set_context(EekboardService *service,
|
void dbus_handler_set_context(DBusHandler *service,
|
||||||
ServerContextService *context);
|
ServerContextService *context);
|
||||||
void eekboard_service_destroy(EekboardService*);
|
void dbus_handler_destroy(DBusHandler*);
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
#endif /* EEKBOARD_SERVICE_H */
|
#endif /* DBUS_H_ */
|
||||||
@ -12,6 +12,7 @@ config_h = configure_file(
|
|||||||
|
|
||||||
sources = [
|
sources = [
|
||||||
config_h,
|
config_h,
|
||||||
|
'dbus.c',
|
||||||
'imservice.c',
|
'imservice.c',
|
||||||
'server-context-service.c',
|
'server-context-service.c',
|
||||||
'wayland.c',
|
'wayland.c',
|
||||||
@ -27,7 +28,6 @@ sources = [
|
|||||||
dbus_src,
|
dbus_src,
|
||||||
'../eekboard/key-emitter.c',
|
'../eekboard/key-emitter.c',
|
||||||
'../eekboard/eekboard-context-service.c',
|
'../eekboard/eekboard-context-service.c',
|
||||||
'../eekboard/eekboard-service.c',
|
|
||||||
# '../eekboard/eekboard-xklutil.c',
|
# '../eekboard/eekboard-xklutil.c',
|
||||||
squeekboard_resources,
|
squeekboard_resources,
|
||||||
wl_proto_sources,
|
wl_proto_sources,
|
||||||
|
|||||||
@ -25,9 +25,9 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "eekboard/eekboard-service.h"
|
|
||||||
#include "eek/eek.h"
|
#include "eek/eek.h"
|
||||||
#include "eekboard/eekboard-context-service.h"
|
#include "eekboard/eekboard-context-service.h"
|
||||||
|
#include "dbus.h"
|
||||||
#include "imservice.h"
|
#include "imservice.h"
|
||||||
#include "outputs.h"
|
#include "outputs.h"
|
||||||
#include "server-context-service.h"
|
#include "server-context-service.h"
|
||||||
@ -248,17 +248,17 @@ main (int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
EekboardService *service = eekboard_service_new (connection, EEKBOARD_SERVICE_PATH);
|
DBusHandler *service = dbus_handler_new(connection, DBUS_SERVICE_PATH);
|
||||||
|
|
||||||
if (service == NULL) {
|
if (service == NULL) {
|
||||||
g_printerr ("Can't create dbus server\n");
|
g_printerr ("Can't create dbus server\n");
|
||||||
exit (1);
|
exit (1);
|
||||||
} else {
|
} else {
|
||||||
eekboard_service_set_context(service, instance.context);
|
dbus_handler_set_context(service, instance.context);
|
||||||
}
|
}
|
||||||
|
|
||||||
guint owner_id = g_bus_own_name_on_connection (connection,
|
guint owner_id = g_bus_own_name_on_connection (connection,
|
||||||
EEKBOARD_SERVICE_INTERFACE,
|
DBUS_SERVICE_INTERFACE,
|
||||||
G_BUS_NAME_OWNER_FLAGS_NONE,
|
G_BUS_NAME_OWNER_FLAGS_NONE,
|
||||||
on_name_acquired,
|
on_name_acquired,
|
||||||
on_name_lost,
|
on_name_lost,
|
||||||
|
|||||||
Reference in New Issue
Block a user