Remove server-service
This commit is contained in:
		@ -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);
 | 
			
		||||
 | 
			
		||||
@ -31,7 +31,7 @@
 | 
			
		||||
#include <clutter-gtk/clutter-gtk.h>
 | 
			
		||||
#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);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,63 +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/>.
 | 
			
		||||
 */
 | 
			
		||||
#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);
 | 
			
		||||
}
 | 
			
		||||
@ -1,38 +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 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 */
 | 
			
		||||
		Reference in New Issue
	
	Block a user