dbus: Rename handler from eekboard_service

This commit is contained in:
Dorota Czaplejewicz
2020-01-09 16:25:53 +00:00
parent 3ecfd701d9
commit 4c2cef30f2
4 changed files with 24 additions and 45 deletions

View File

@ -16,27 +16,15 @@
* 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 "dbus.h"
#include <stdio.h>
#include <gio/gio.h>
#include "eekboard/eekboard-service.h"
void
eekboard_service_destroy(EekboardService *service)
dbus_handler_destroy(DBusHandler *service)
{
g_free (service->object_path);
@ -67,7 +55,7 @@ eekboard_service_destroy(EekboardService *service)
static gboolean
handle_set_visible(SmPuriOSK0 *object, GDBusMethodInvocation *invocation,
gboolean arg_visible, gpointer user_data) {
EekboardService *service = user_data;
DBusHandler *service = user_data;
if (service->context) {
if (arg_visible) {
@ -80,7 +68,7 @@ handle_set_visible(SmPuriOSK0 *object, GDBusMethodInvocation *invocation,
return TRUE;
}
static void on_visible(EekboardService *service,
static void on_visible(DBusHandler *service,
GParamSpec *pspec,
ServerContextService *context)
{
@ -94,16 +82,11 @@ static void on_visible(EekboardService *service,
sm_puri_osk0_set_visible(service->dbus_interface, visible);
}
/**
* eekboard_service_new:
* @connection: a #GDBusConnection
* @object_path: object path
*/
EekboardService *
eekboard_service_new (GDBusConnection *connection,
DBusHandler *
dbus_handler_new (GDBusConnection *connection,
const gchar *object_path)
{
EekboardService *self = calloc(1, sizeof(EekboardService));
DBusHandler *self = calloc(1, sizeof(DBusHandler));
self->object_path = g_strdup(object_path);
self->connection = connection;
@ -127,7 +110,7 @@ eekboard_service_new (GDBusConnection *connection,
}
void
eekboard_service_set_context(EekboardService *service,
dbus_handler_set_context(DBusHandler *service,
ServerContextService *context)
{
g_return_if_fail (!service->context);

View File

@ -1,6 +1,7 @@
/*
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
* 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
* 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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef EEKBOARD_SERVICE_H
#define EEKBOARD_SERVICE_H 1
#define __EEKBOARD_SERVICE_H_INSIDE__ 1
#ifndef DBUS_H_
#define DBUS_H_ 1
#include "server-context-service.h"
@ -26,13 +25,10 @@
G_BEGIN_DECLS
#define EEKBOARD_SERVICE_PATH "/sm/puri/OSK0"
#define EEKBOARD_SERVICE_INTERFACE "sm.puri.OSK0"
#define DBUS_SERVICE_PATH "/sm/puri/OSK0"
#define DBUS_SERVICE_INTERFACE "sm.puri.OSK0"
/**
* EekboardService: DBus handling
*/
typedef struct _EekboardService
typedef struct _DBusHandler
{
GDBusConnection *connection;
SmPuriOSK0 *dbus_interface;
@ -41,12 +37,12 @@ typedef struct _EekboardService
char *object_path;
ServerContextService *context; // unowned reference
} EekboardService;
} DBusHandler;
EekboardService * eekboard_service_new (GDBusConnection *connection,
DBusHandler * dbus_handler_new (GDBusConnection *connection,
const gchar *object_path);
void eekboard_service_set_context(EekboardService *service,
void dbus_handler_set_context(DBusHandler *service,
ServerContextService *context);
void eekboard_service_destroy(EekboardService*);
void dbus_handler_destroy(DBusHandler*);
G_END_DECLS
#endif /* EEKBOARD_SERVICE_H */
#endif /* DBUS_H_ */

View File

@ -12,6 +12,7 @@ config_h = configure_file(
sources = [
config_h,
'dbus.c',
'imservice.c',
'server-context-service.c',
'wayland.c',
@ -27,7 +28,6 @@ sources = [
dbus_src,
'../eekboard/key-emitter.c',
'../eekboard/eekboard-context-service.c',
'../eekboard/eekboard-service.c',
# '../eekboard/eekboard-xklutil.c',
squeekboard_resources,
wl_proto_sources,

View File

@ -25,9 +25,9 @@
#include "config.h"
#include "eekboard/eekboard-service.h"
#include "eek/eek.h"
#include "eekboard/eekboard-context-service.h"
#include "dbus.h"
#include "imservice.h"
#include "outputs.h"
#include "server-context-service.h"
@ -248,17 +248,17 @@ main (int argc, char **argv)
break;
}
EekboardService *service = eekboard_service_new (connection, EEKBOARD_SERVICE_PATH);
DBusHandler *service = dbus_handler_new(connection, DBUS_SERVICE_PATH);
if (service == NULL) {
g_printerr ("Can't create dbus server\n");
exit (1);
} 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,
EEKBOARD_SERVICE_INTERFACE,
DBUS_SERVICE_INTERFACE,
G_BUS_NAME_OWNER_FLAGS_NONE,
on_name_acquired,
on_name_lost,