ibusenginedesc.h \
ibusobservedpath.h \
ibuscomponent.h \
+ ibusmainloop.h \
$(NULL)
ibus_h_sources = \
ibusinternal.h \
ibusenginedesc.c \
ibusobservedpath.c \
ibuscomponent.c \
+ ibusmainloop.c \
$(NULL)
ibusincludedir = $(includedir)/ibus-1.0
ibusinclude_HEADERS = \
#ifndef __IBUS_H_
#define __IBUS_H_
+#include <ibusmainloop.h>
#include <ibusshare.h>
#include <ibusobject.h>
#include <ibusserializable.h>
(DBusHandleMessageFunction) _connection_handle_message_cb,
connection, NULL);
- dbus_connection_setup (priv->connection, NULL);
+ ibus_dbus_connection_setup (priv->connection);
g_warn_if_fail (result);
}
--- /dev/null
+/* vim:set et sts=4: */
+/* ibus - 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.
+ */
+#include "ibusmainloop.h"
+#include "ibusinternal.h"
+
+static DBusConnectionSetupFunc _connection_setup_func = dbus_connection_setup;
+static DBusServerSetupFunc _server_setup_func = dbus_server_setup;
+static gpointer _user_data = NULL;
+
+void
+ibus_mainloop_setup (DBusConnectionSetupFunc connection_func,
+ DBusServerSetupFunc server_func,
+ gpointer user_data)
+{
+ _connection_setup_func = connection_func;
+ _server_setup_func = server_func;
+ _user_data = user_data;
+}
+
+void
+ibus_dbus_connection_setup (DBusConnection *connection)
+{
+ if (_connection_setup_func != NULL)
+ (_connection_setup_func) (connection, _user_data);
+}
+
+void
+ibus_dbus_server_setup (DBusServer *server)
+{
+ if (_server_setup_func != NULL)
+ (_server_setup_func) (server, _user_data);
+}
+
--- /dev/null
+/* vim:set et sts=4: */
+/* ibus - 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 __IBUS_MAINLOOP_H_
+#define __IBUS_MAINLOOP_H_
+
+#include <glib.h>
+#include <dbus/dbus.h>
+
+typedef void (* DBusConnectionSetupFunc) (DBusConnection *connection,
+ gpointer user_data);
+typedef void (* DBusServerSetupFunc) (DBusServer *server,
+ gpointer user_data);
+
+void ibus_mainloop_setup (DBusConnectionSetupFunc connection_func,
+ DBusServerSetupFunc server_func,
+ gpointer user_data);
+void ibus_dbus_server_setup (DBusServer *server);
+void ibus_dbus_connection_setup (DBusConnection *connection);
+
+#endif
+
dbus_server_set_auth_mechanisms (priv->server, NULL);
- dbus_server_setup (priv->server, NULL);
+ ibus_dbus_server_setup (priv->server);
return TRUE;
}