void bus_server_quit (BusServer *server) { g_assert (BUS_IS_SERVER (server)); g_main_loop_quit (server->loop); }
static void bus_server_new_connection (BusServer *server, BusConnection *connection) { g_assert (BUS_IS_SERVER (server)); bus_dbus_impl_new_connection (server->dbus, connection); }
static void bus_server_destroy (BusServer *server) { g_assert (BUS_IS_SERVER (server)); ibus_object_destroy ((IBusObject *) server->dbus); g_object_unref (server->dbus); ibus_object_destroy ((IBusObject *) server->ibus); g_object_unref (server->ibus); while (g_main_loop_is_running (server->loop)) { g_main_loop_quit (server->loop); } g_main_loop_unref (server->loop); IBUS_OBJECT_CLASS (bus_server_parent_class)->destroy (IBUS_OBJECT (server)); }
gboolean bus_server_listen (BusServer *server) { g_assert (BUS_IS_SERVER (server)); const gchar *mechanisms[] = { "EXTERNAL", NULL }; const gchar *address = "unix:tmpdir=/tmp/"; gboolean retval; #if 0 path = ibus_get_socket_folder (); mkdir (path, 0700); chmod (path, 0700); address = ibus_get_address (); #endif retval = ibus_server_listen (IBUS_SERVER (server), address); #if 0 chmod (ibus_get_socket_path (), 0600); #endif ibus_server_set_auth_mechanisms ((IBusServer *)server, mechanisms); if (!retval) { #if 0 g_printerr ("Can not listen on %s! Please try remove directory %s and run again.", address, path); #else g_printerr ("Can not listen on %s!", address); #endif exit (-1); } ibus_write_address (ibus_server_get_address (IBUS_SERVER (server))); return retval; }
gboolean bus_server_listen (BusServer *server) { g_assert (BUS_IS_SERVER (server)); // const gchar *address = "unix:abstract=/tmp/ibus-c" const gchar *address; gchar *path; gboolean retval; path = g_strdup_printf("/tmp/ibus-%s", ibus_get_user_name ()); mkdir (path, 0775); address = ibus_get_address (); retval = ibus_server_listen (IBUS_SERVER (server), address); if (!retval) { g_printerr ("Can not listen on %s! Please try remove directory %s and run again.", address, path); exit (-1); } g_free(path); return retval; }