Blame bus/component.h

Packit 3ff832
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
Packit 3ff832
/* vim:set et sts=4: */
Packit 3ff832
/* bus - The Input Bus
Packit 3ff832
 * Copyright (C) 2010 Peng Huang <shawn.p.huang@gmail.com>
Packit 3ff832
 * Copyright (C) 2010 Google Inc.
Packit 3ff832
 *
Packit 3ff832
 * This library is free software; you can redistribute it and/or
Packit 3ff832
 * modify it under the terms of the GNU Lesser General Public
Packit 3ff832
 * License as published by the Free Software Foundation; either
Packit 3ff832
 * version 2.1 of the License, or (at your option) any later version.
Packit 3ff832
 *
Packit 3ff832
 * This library is distributed in the hope that it will be useful,
Packit 3ff832
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 3ff832
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 3ff832
 * Lesser General Public License for more details.
Packit 3ff832
 *
Packit 3ff832
 * You should have received a copy of the GNU Lesser General Public
Packit 3ff832
 * License along with this library; if not, write to the Free Software
Packit 3ff832
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
Packit 3ff832
 * USA
Packit 3ff832
 */
Packit 3ff832
#ifndef __BUS_COMPONENT_H_
Packit 3ff832
#define __BUS_COMPONENT_H_
Packit 3ff832
Packit 3ff832
#include <ibus.h>
Packit 3ff832
#include "factoryproxy.h"
Packit 3ff832
Packit 3ff832
/*
Packit 3ff832
 * Type macros.
Packit 3ff832
 */
Packit 3ff832
Packit 3ff832
/* define GOBJECT macros */
Packit 3ff832
#define BUS_TYPE_COMPONENT             \
Packit 3ff832
    (bus_component_get_type ())
Packit 3ff832
#define BUS_COMPONENT(obj)             \
Packit 3ff832
    (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUS_TYPE_COMPONENT, BusComponent))
Packit 3ff832
#define BUS_COMPONENT_CLASS(klass)     \
Packit 3ff832
    (G_TYPE_CHECK_CLASS_CAST ((klass), BUS_TYPE_COMPONENT, BusComponentClass))
Packit 3ff832
#define BUS_IS_COMPONENT(obj)          \
Packit 3ff832
    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUS_TYPE_COMPONENT))
Packit 3ff832
#define BUS_IS_COMPONENT_CLASS(klass)  \
Packit 3ff832
    (G_TYPE_CHECK_CLASS_TYPE ((klass), BUS_TYPE_COMPONENT))
Packit 3ff832
#define BUS_COMPONENT_GET_CLASS(obj)   \
Packit 3ff832
    (G_TYPE_INSTANCE_GET_CLASS ((obj), BUS_TYPE_COMPONENT, BusComponentClass))
Packit 3ff832
Packit 3ff832
G_BEGIN_DECLS
Packit 3ff832
Packit 3ff832
typedef struct _BusComponent BusComponent;
Packit 3ff832
typedef struct _BusComponentClass BusComponentClass;
Packit 3ff832
Packit 3ff832
GType            bus_component_get_type          (void);
Packit 3ff832
BusComponent    *bus_component_new               (IBusComponent   *component,
Packit 3ff832
                                                  BusFactoryProxy *factory);
Packit 3ff832
IBusComponent   *bus_component_get_component     (BusComponent    *component);
Packit 3ff832
void             bus_component_set_factory       (BusComponent    *compinent,
Packit 3ff832
                                                  BusFactoryProxy *factory);
Packit 3ff832
BusFactoryProxy *bus_component_get_factory       (BusComponent    *factory);
Packit 3ff832
void             bus_component_set_destroy_with_factory
Packit 3ff832
                                                 (BusComponent    *component,
Packit 3ff832
                                                  gboolean         with_factory);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * bus_component_get_name:
Packit 3ff832
 *
Packit 3ff832
 * Return a component name such as "org.freedesktop.IBus.Panel" and "com.google.IBus.Mozc"
Packit 3ff832
 */
Packit 3ff832
const gchar     *bus_component_get_name          (BusComponent    *component);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * bus_component_get_engines:
Packit 3ff832
 *
Packit 3ff832
 * Return a list of IBusEngineDesc objects the component has.
Packit 3ff832
 */
Packit 3ff832
GList           *bus_component_get_engines       (BusComponent    *component);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * bus_component_start:
Packit 3ff832
 * @verbose: if TRUE, the stdout and stderr of the child process is not redirected to /dev/null.
Packit 3ff832
 * @returns: TRUE if the component is successfully started.
Packit 3ff832
 *
Packit 3ff832
 * Start the component by forking and executing an executable file for the component.
Packit 3ff832
 */
Packit 3ff832
gboolean         bus_component_start             (BusComponent    *component,
Packit 3ff832
                                                  gboolean         verbose);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * bus_component_stop:
Packit 3ff832
 * @returns: TRUE
Packit 3ff832
 *
Packit 3ff832
 * Kill a process for the component.
Packit 3ff832
 */
Packit 3ff832
gboolean         bus_component_stop              (BusComponent    *component);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * bus_component_stop:
Packit 3ff832
 * @returns: TRUE if a process for the component exists.
Packit 3ff832
 */
Packit 3ff832
gboolean         bus_component_is_running        (BusComponent    *component);
Packit 3ff832
Packit 3ff832
void             bus_component_set_restart       (BusComponent    *component,
Packit 3ff832
                                                  gboolean         restart);
Packit 3ff832
BusComponent    *bus_component_from_engine_desc  (IBusEngineDesc  *engine);
Packit 3ff832
Packit 3ff832
G_END_DECLS
Packit 3ff832
#endif
Packit 3ff832