From 2e6d194a6fc3b2bb1d9b86d0c5f8298680cd104b Mon Sep 17 00:00:00 2001 From: Dorota Czaplejewicz Date: Sun, 23 Jun 2019 10:26:24 +0000 Subject: [PATCH] Remove server-service --- eekboard/eekboard-service.c | 7 +---- src/server-main.c | 35 +++++++++------------ src/server-service.c | 63 ------------------------------------- src/server-service.h | 38 ---------------------- 4 files changed, 16 insertions(+), 127 deletions(-) delete mode 100644 src/server-service.c delete mode 100644 src/server-service.h diff --git a/eekboard/eekboard-service.c b/eekboard/eekboard-service.c index f147d92d..f02ebe81 100644 --- a/eekboard/eekboard-service.c +++ b/eekboard/eekboard-service.c @@ -182,12 +182,7 @@ eekboard_service_constructed (GObject *object) } // CreateContext - EekboardServiceClass *klass = EEKBOARD_SERVICE_GET_CLASS(service); - - EekboardContextService *context; - - g_assert (klass->create_context); - context = klass->create_context (service); + EekboardContextService *context = server_context_service_new (); g_object_set_data_full (G_OBJECT(context), "owner", g_strdup ("sender"), (GDestroyNotify)g_free); diff --git a/src/server-main.c b/src/server-main.c index 78fe9570..172d27bf 100644 --- a/src/server-main.c +++ b/src/server-main.c @@ -31,7 +31,7 @@ #include #endif -#include "server-service.h" +#include "eekboard/eekboard-service.h" #include "eek/eek.h" #include "wayland.h" @@ -58,9 +58,10 @@ on_name_lost (GDBusConnection *connection, } static void -on_destroyed (ServerService *service, +on_destroyed (EekboardService *service, gpointer user_data) { + (void)service; GMainLoop *loop = user_data; g_main_loop_quit (loop); @@ -107,27 +108,14 @@ static const struct wl_registry_listener registry_listener = { int main (int argc, char **argv) { - ServerService *service; - GBusType bus_type; - GDBusConnection *connection; - GError *error; - GMainLoop *loop; - guint owner_id; - -#if HAVE_CLUTTER_GTK - if (gtk_clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) { - g_printerr ("Can't init GTK with Clutter\n"); - exit (1); - } -#else if (!gtk_init_check (&argc, &argv)) { g_printerr ("Can't init GTK\n"); exit (1); } -#endif eek_init (); + GBusType bus_type; if (opt_system) bus_type = G_BUS_TYPE_SYSTEM; else if (opt_address) @@ -135,6 +123,8 @@ main (int argc, char **argv) else bus_type = G_BUS_TYPE_SESSION; + GDBusConnection *connection = NULL; + GError *error = NULL; switch (bus_type) { case G_BUS_TYPE_SYSTEM: case G_BUS_TYPE_SESSION: @@ -175,19 +165,24 @@ main (int argc, char **argv) g_error ("Failed to get display: %m\n"); } - struct squeak_wayland wayland; + struct squeak_wayland wayland = {0}; squeak_wayland_init (&wayland); struct wl_registry *registry = wl_display_get_registry (display); wl_registry_add_listener (registry, ®istry_listener, &wayland); squeak_wayland_set_global(&wayland); - service = server_service_new (EEKBOARD_SERVICE_PATH, connection); + + // set up dbus + // TODO: make dbus errors non-always-fatal + // dbus is not strictly necessary for the useful operation + // if text-input is used, as it can bring the keyboard in and out + EekboardService *service = eekboard_service_new (connection, EEKBOARD_SERVICE_PATH); if (service == NULL) { g_printerr ("Can't create server\n"); exit (1); } - owner_id = g_bus_own_name_on_connection (connection, + guint owner_id = g_bus_own_name_on_connection (connection, EEKBOARD_SERVICE_INTERFACE, G_BUS_NAME_OWNER_FLAGS_NONE, on_name_acquired, @@ -199,7 +194,7 @@ main (int argc, char **argv) exit (1); } - loop = g_main_loop_new (NULL, FALSE); + GMainLoop *loop = g_main_loop_new (NULL, FALSE); g_signal_connect (service, "destroyed", G_CALLBACK(on_destroyed), loop); diff --git a/src/server-service.c b/src/server-service.c deleted file mode 100644 index 514b7159..00000000 --- a/src/server-service.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2010-2011 Daiki Ueno - * 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 . - */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif /* HAVE_CONFIG_H */ - -#include "server-service.h" -#include "server-context-service.h" - -typedef struct _ServerServiceClass ServerServiceClass; - -struct _ServerService { - EekboardService parent; -}; - -struct _ServerServiceClass { - EekboardServiceClass parent_class; -}; - -G_DEFINE_TYPE (ServerService, server_service, EEKBOARD_TYPE_SERVICE); - -static EekboardContextService * -server_service_real_create_context (EekboardService *self) -{ - (void)self; - return EEKBOARD_CONTEXT_SERVICE(server_context_service_new ()); -} - -static void -server_service_class_init (ServerServiceClass *klass) -{ - EekboardServiceClass *service_class = EEKBOARD_SERVICE_CLASS(klass); - service_class->create_context = server_service_real_create_context; -} - -static void -server_service_init (ServerService *self) -{ -} - -ServerService *server_service_new (const gchar *object_path, - GDBusConnection *connection) -{ - return g_object_new (SERVER_TYPE_SERVICE, - "object-path", object_path, - "connection", connection, - NULL); -} diff --git a/src/server-service.h b/src/server-service.h deleted file mode 100644 index 9e5e7dd3..00000000 --- a/src/server-service.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2010-2011 Daiki Ueno - * 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 . - */ -#ifndef SERVER_SERVICE_H -#define SERVER_SERVICE_H 1 - -#include "eekboard/eekboard-service.h" - -G_BEGIN_DECLS - -#define SERVER_TYPE_SERVICE (server_service_get_type()) -#define SERVER_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SERVER_TYPE_SERVICE, ServerService)) -#define SERVER_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SERVER_TYPE_SERVICE, ServerServiceClass)) -#define SERVER_IS_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SERVER_TYPE_SERVICE)) -#define SERVER_IS_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SERVER_TYPE_SERVICE)) -#define SERVER_SERVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SERVER_TYPE_SERVICE, ServerServiceClass)) - -typedef struct _ServerService ServerService; - -ServerService *server_service_new (const gchar *object_path, - GDBusConnection *connection); - -G_END_DECLS -#endif /* SERVER_SERVICE_H */