matchrule.h \
registry.c \
registry.h \
+ option.h \
$(NULL)
ibus_daemon_CFLAGS = \
$(AM_CFLAGS) \
$(MAKE) -C $(top_builddir)/src
test: ibus-daemon
- $(builddir)/ibus-daemon
+ $(builddir)/ibus-daemon -v
#include <ibusmarshalers.h>
#include "ibusimpl.h"
#include "engineproxy.h"
-
-#define PROCESS_KEY_EVENT_TIMEOUT (10000)
+#include "option.h"
enum {
COMMIT_TEXT,
typedef struct {
GFunc func;
gpointer user_data;
-}CallData;
+ BusEngineProxy *engine;
+} CallData;
static void
bus_engine_proxy_process_key_event_reply_cb (IBusPendingCall *pending,
reply_message = dbus_pending_call_steal_reply (pending);
if (reply_message == NULL) {
+ /* reply timeout */
+ IBusObject *connection;
+ connection = (IBusObject *) ibus_proxy_get_connection ((IBusProxy *)call_data->engine);
+ ibus_object_destroy (connection);
goto _out;
}
else if ((error = ibus_error_new_from_message (reply_message)) != NULL) {
+ if (g_strcmp0 (error->name, DBUS_ERROR_NO_REPLY) == 0) {
+ /* reply timeout */
+ IBusObject *connection;
+ connection = (IBusObject *) ibus_proxy_get_connection ((IBusProxy *)call_data->engine);
+ ibus_object_destroy (connection);
+ }
g_warning ("%s: %s", error->name, error->message);
ibus_error_free (error);
goto _out;
if (reply_message) {
ibus_message_unref (reply_message);
}
+ g_object_unref (call_data->engine);
call_data->func (GINT_TO_POINTER (retval), call_data->user_data);
g_slice_free (CallData, call_data);
}
retval = ibus_proxy_call_with_reply ((IBusProxy *) engine,
"ProcessKeyEvent",
&pending,
- PROCESS_KEY_EVENT_TIMEOUT,
+ g_dbus_timeout,
&error,
G_TYPE_UINT, &keyval,
G_TYPE_UINT, &keycode,
call_data = g_slice_new0 (CallData);
call_data->func = return_cb;
call_data->user_data = user_data;
+ g_object_ref (engine);
+ call_data->engine = engine;
retval = ibus_pending_call_set_notify (pending,
(IBusPendingCallNotifyFunction) bus_engine_proxy_process_key_event_reply_cb,
ibus_pending_call_unref (pending);
if (!retval) {
+ g_object_unref (call_data->engine);
g_slice_free (CallData, call_data);
g_warning ("%s : ProcessKeyEvent", DBUS_ERROR_NO_MEMORY);
return_cb (GINT_TO_POINTER (FALSE), user_data);
#include <ibusmarshalers.h>
#include "dbusimpl.h"
#include "factoryproxy.h"
-
-#define REPLY_TIMEOUT (-1)
+#include "option.h"
/* functions prototype */
static void bus_factory_proxy_class_init (BusFactoryProxyClass *klass);
retval = ibus_proxy_call_with_reply ((IBusProxy *) factory,
"CreateEngine",
&pending,
- REPLY_TIMEOUT,
+ g_dbus_timeout,
&error,
G_TYPE_STRING, &(desc->name),
G_TYPE_INVALID);
ibus_pending_call_unref (pending);
if (reply_message == NULL) {
+ IBusObject *connection;
+ connection = (IBusObject *) ibus_proxy_get_connection ((IBusProxy *)factory);
+ ibus_object_destroy (connection);
g_warning ("%s: %s", error->name, error->message);
ibus_error_free (error);
return NULL;
}
if ((error = ibus_error_new_from_message (reply_message)) != NULL) {
+ if (g_strcmp0 (error->name, DBUS_ERROR_NO_REPLY) == 0) {
+ IBusObject *connection;
+ connection = (IBusObject *) ibus_proxy_get_connection ((IBusProxy *)factory);
+ ibus_object_destroy (connection);
+ }
g_warning ("%s: %s", error->name, error->message);
ibus_error_free (error);
ibus_message_unref (reply_message);
#include "factoryproxy.h"
#include "panelproxy.h"
#include "inputcontext.h"
-
+#include "option.h"
enum {
LAST_SIGNAL,
static IBusServiceClass *parent_class = NULL;
-extern gboolean g_verbose;
-
GType
bus_ibus_impl_get_type (void)
{
gboolean g_rescan = FALSE;
gboolean g_mempro = FALSE;
gboolean g_verbose = FALSE;
+gint g_dbus_timeout = -1;
static const GOptionEntry entries[] =
{
{ "address", 'a', 0, G_OPTION_ARG_STRING, &address, "specify the address of ibus daemon.", "address" },
{ "replace", 'r', 0, G_OPTION_ARG_NONE, &replace, "if there is an old ibus-daemon is running, it will be replaced.", NULL },
{ "re-scan", 't', 0, G_OPTION_ARG_NONE, &g_rescan, "force to re-scan components, and re-create registry cache.", NULL },
+ { "timeout", 'o', 0, G_OPTION_ARG_INT, &g_dbus_timeout, "dbus reply timeout", "timeout" },
{ "mem-profile", 'm', 0, G_OPTION_ARG_NONE, &g_mempro, "enable memory profile, send SIGUSR2 to print out the memory profile.", NULL },
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &g_verbose, "verbose.", NULL },
{ NULL },
--- /dev/null
+/* vim:set et sts=4: */
+/* bus - The Input Bus
+ * Copyright (C) 2008-2009 Huang Peng <shawn.p.huang@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifndef __OPTION_H_
+#define __OPTION_H_
+
+G_BEGIN_DECLS
+
+extern gboolean g_rescan;
+extern gboolean g_mempro;
+extern gboolean g_verbose;
+extern gint g_dbus_timeout;
+
+G_END_DECLS
+#endif
+
#include <stdlib.h>
#include <string.h>
#include "registry.h"
+#include "option.h"
enum {
LAST_SIGNAL,
registry->components = NULL;
registry->engine_table = g_hash_table_new (g_str_hash, g_str_equal);
- extern gboolean g_rescan;
-
if (g_rescan ||
bus_registry_load_cache (registry) == FALSE ||
bus_registry_check_modification (registry)) {