Fix some issues within codereview.

This commit is contained in:
Peng Huang 2010-11-03 13:37:57 +09:00
Родитель f1c4fcb0e0
Коммит c464170208
24 изменённых файлов: 102 добавлений и 246 удалений

Просмотреть файл

@ -61,9 +61,9 @@ static GQuark bus_connection_quark (void);
G_DEFINE_TYPE (BusConnection, bus_connection, IBUS_TYPE_OBJECT) G_DEFINE_TYPE (BusConnection, bus_connection, IBUS_TYPE_OBJECT)
static void static void
bus_connection_class_init (BusConnectionClass *klass) bus_connection_class_init (BusConnectionClass *class)
{ {
IBusObjectClass *ibus_object_class = IBUS_OBJECT_CLASS (klass); IBusObjectClass *ibus_object_class = IBUS_OBJECT_CLASS (class);
ibus_object_class->destroy = (IBusObjectDestroyFunc) bus_connection_destroy; ibus_object_class->destroy = (IBusObjectDestroyFunc) bus_connection_destroy;
} }
@ -133,7 +133,7 @@ bus_connection_set_dbus_connection (BusConnection *connection,
static GQuark static GQuark
bus_connection_quark (void) bus_connection_quark (void)
{ {
GQuark quark = 0; static GQuark quark = 0;
if (quark == 0) { if (quark == 0) {
quark = g_quark_from_static_string ("BUS_CONNECTION"); quark = g_quark_from_static_string ("BUS_CONNECTION");
} }
@ -226,14 +226,6 @@ bus_connection_add_match (BusConnection *connection,
return TRUE; return TRUE;
} }
gboolean
bus_connection_remove_match (BusConnection *connection,
const gchar *rule)
{
g_assert (BUS_IS_CONNECTION (connection));
return FALSE;
}
GDBusConnection * GDBusConnection *
bus_connection_get_dbus_connection (BusConnection *connection) bus_connection_get_dbus_connection (BusConnection *connection)
{ {
@ -241,7 +233,6 @@ bus_connection_get_dbus_connection (BusConnection *connection)
return connection->connection; return connection->connection;
} }
void void
bus_connection_set_filter (BusConnection *connection, bus_connection_set_filter (BusConnection *connection,
GDBusMessageFilterFunction filter_func, GDBusMessageFilterFunction filter_func,

Просмотреть файл

@ -44,7 +44,7 @@ struct _BusDBusImpl {
GList *objects; GList *objects;
GList *connections; GList *connections;
GList *rules; GList *rules;
gint id; guint id;
GMutex *dispatch_lock; GMutex *dispatch_lock;
GList *dispatch_queue; GList *dispatch_queue;
@ -350,7 +350,15 @@ bus_dbus_impl_name_has_owner (BusDBusImpl *dbus,
g_variant_get (parameters, "(&s)", &name); g_variant_get (parameters, "(&s)", &name);
gboolean has_owner; gboolean has_owner;
if (name[0] == ':') { if (!g_dbus_is_name (name)) {
g_dbus_method_invocation_return_error (invocation,
G_DBUS_ERROR,
G_DBUS_ERROR_FAILED,
"'%s' is not a legal bus name");
return;
}
if (g_dbus_is_unique_name (name)) {
has_owner = g_hash_table_lookup (dbus->unique_names, name) != NULL; has_owner = g_hash_table_lookup (dbus->unique_names, name) != NULL;
} }
else { else {
@ -403,8 +411,8 @@ bus_dbus_impl_get_id (BusDBusImpl *dbus,
GVariant *parameters, GVariant *parameters,
GDBusMethodInvocation *invocation) GDBusMethodInvocation *invocation)
{ {
/* FXIME */ /* FIXME */
const gchar *uuid = "FXIME"; const gchar *uuid = "FIXME";
g_dbus_method_invocation_return_value (invocation, g_dbus_method_invocation_return_value (invocation,
g_variant_new ("(s)", uuid)); g_variant_new ("(s)", uuid));
} }
@ -490,7 +498,9 @@ bus_dbus_impl_request_name (BusDBusImpl *dbus,
guint flags = 0; guint flags = 0;
g_variant_get (parameters, "(&su)", &name, &flags); g_variant_get (parameters, "(&su)", &name, &flags);
if (name[0] == ':' || !g_dbus_is_name (name)) { if (name == NULL ||
!g_dbus_is_name (name) ||
g_dbus_is_unique_name (name)) {
g_dbus_method_invocation_return_error (invocation, g_dbus_method_invocation_return_error (invocation,
G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
"'%s' is not a legal service name.", name); "'%s' is not a legal service name.", name);
@ -534,7 +544,9 @@ bus_dbus_impl_release_name (BusDBusImpl *dbus,
const gchar *name= NULL; const gchar *name= NULL;
g_variant_get (parameters, "(&s)", &name); g_variant_get (parameters, "(&s)", &name);
if (name[0] == ':' || !g_dbus_is_name (name)) { if (name == NULL ||
!g_dbus_is_name (name) ||
g_dbus_is_unique_name (name)) {
g_dbus_method_invocation_return_error (invocation, g_dbus_method_invocation_return_error (invocation,
G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
"'%s' is not a legal service name.", name); "'%s' is not a legal service name.", name);
@ -687,54 +699,6 @@ bus_dbus_impl_service_set_property (IBusService *service,
} }
#if 1
static void
message_print(GDBusMessage *message)
{
switch (g_dbus_message_get_message_type (message)) {
case G_DBUS_MESSAGE_TYPE_METHOD_CALL:
g_debug ("From %s to %s, CALL(%u) %s.%s (%s)",
g_dbus_message_get_sender (message),
g_dbus_message_get_destination (message),
g_dbus_message_get_serial (message),
g_dbus_message_get_interface (message),
g_dbus_message_get_member (message),
g_dbus_message_get_signature (message)
);
break;
case G_DBUS_MESSAGE_TYPE_METHOD_RETURN:
g_debug ("From %s to %s, RETURN(%u) (%s)",
g_dbus_message_get_sender (message),
g_dbus_message_get_destination (message),
g_dbus_message_get_reply_serial (message),
g_dbus_message_get_signature (message)
);
break;
case G_DBUS_MESSAGE_TYPE_ERROR:
g_debug ("From %s to %s, ERROR(%u) %s",
g_dbus_message_get_sender (message),
g_dbus_message_get_destination (message),
g_dbus_message_get_reply_serial (message),
g_dbus_message_get_error_name (message)
);
break;
case G_DBUS_MESSAGE_TYPE_SIGNAL:
g_debug ("From %s to %s, SIGNAL %s.%s (%s) @ %s",
g_dbus_message_get_sender (message),
g_dbus_message_get_destination (message),
g_dbus_message_get_interface (message),
g_dbus_message_get_member (message),
g_dbus_message_get_signature (message),
g_dbus_message_get_path (message)
);
break;
default:
break;
}
}
#endif
static GDBusMessage * static GDBusMessage *
bus_dbus_impl_connection_filter_cb (GDBusConnection *dbus_connection, bus_dbus_impl_connection_filter_cb (GDBusConnection *dbus_connection,
GDBusMessage *message, GDBusMessage *message,
@ -778,7 +742,6 @@ bus_dbus_impl_connection_filter_cb (GDBusConnection *dbus_connection,
default: default:
/* dispatch signal messages by match rule */ /* dispatch signal messages by match rule */
bus_dbus_impl_dispatch_message_by_rule (dbus, message, NULL); bus_dbus_impl_dispatch_message_by_rule (dbus, message, NULL);
message_print (message);
g_object_unref (message); g_object_unref (message);
g_return_val_if_reached (NULL); g_return_val_if_reached (NULL);
} }
@ -796,7 +759,6 @@ bus_dbus_impl_connection_filter_cb (GDBusConnection *dbus_connection,
default: default:
/* dispatch signal messages by match rule */ /* dispatch signal messages by match rule */
bus_dbus_impl_dispatch_message_by_rule (dbus, message, NULL); bus_dbus_impl_dispatch_message_by_rule (dbus, message, NULL);
message_print (message);
g_object_unref (message); g_object_unref (message);
g_return_val_if_reached (NULL); g_return_val_if_reached (NULL);
} }
@ -814,7 +776,6 @@ bus_dbus_impl_connection_filter_cb (GDBusConnection *dbus_connection,
default: default:
/* dispatch signal messages by match rule */ /* dispatch signal messages by match rule */
bus_dbus_impl_dispatch_message_by_rule (dbus, message, NULL); bus_dbus_impl_dispatch_message_by_rule (dbus, message, NULL);
message_print (message);
g_object_unref (message); g_object_unref (message);
g_return_val_if_reached (NULL); g_return_val_if_reached (NULL);
} }
@ -928,7 +889,7 @@ bus_dbus_impl_get_connection_by_name (BusDBusImpl *dbus,
g_assert (BUS_IS_DBUS_IMPL (dbus)); g_assert (BUS_IS_DBUS_IMPL (dbus));
g_assert (name != NULL); g_assert (name != NULL);
if (G_LIKELY (name[0] == ':')) { if (G_LIKELY (g_dbus_is_unique_name (name))) {
return (BusConnection *)g_hash_table_lookup (dbus->unique_names, name); return (BusConnection *)g_hash_table_lookup (dbus->unique_names, name);
} }
else { else {
@ -963,12 +924,12 @@ bus_dbus_impl_forward_message_idle_cb (BusDBusImpl *dbus)
NULL, &error); NULL, &error);
if (!retval) { if (!retval) {
g_warning ("send error failed: %s.", error->message); g_warning ("send error failed: %s.", error->message);
// message_print (message);
g_error_free (error); g_error_free (error);
} }
} }
else { else {
/* FIXME can not get destination */ /* FIXME What should we do, if can not get destination.
* It should not happen */
#if 0 #if 0
if (g_dbus_message_get_message_type (message) == G_DBUS_MESSAGE_TYPE_METHOD_CALL) { if (g_dbus_message_get_message_type (message) == G_DBUS_MESSAGE_TYPE_METHOD_CALL) {
/* reply an error message, if the destination does not exist */ /* reply an error message, if the destination does not exist */

Просмотреть файл

@ -59,7 +59,6 @@ gboolean bus_dbus_impl_new_connection (BusDBusImpl *dbus,
BusConnection *bus_dbus_impl_get_connection_by_name BusConnection *bus_dbus_impl_get_connection_by_name
(BusDBusImpl *dbus, (BusDBusImpl *dbus,
const gchar *name); const gchar *name);
/* FIXME */
void bus_dbus_impl_forward_message (BusDBusImpl *dbus, void bus_dbus_impl_forward_message (BusDBusImpl *dbus,
BusConnection *connection, BusConnection *connection,
GDBusMessage *message); GDBusMessage *message);

Просмотреть файл

@ -85,15 +85,15 @@ static void bus_engine_proxy_g_signal (GDBusProxy *proxy,
G_DEFINE_TYPE (BusEngineProxy, bus_engine_proxy, IBUS_TYPE_PROXY) G_DEFINE_TYPE (BusEngineProxy, bus_engine_proxy, IBUS_TYPE_PROXY)
static void static void
bus_engine_proxy_class_init (BusEngineProxyClass *klass) bus_engine_proxy_class_init (BusEngineProxyClass *class)
{ {
IBUS_PROXY_CLASS (klass)->destroy = bus_engine_proxy_real_destroy; IBUS_PROXY_CLASS (class)->destroy = bus_engine_proxy_real_destroy;
G_DBUS_PROXY_CLASS (klass)->g_signal = bus_engine_proxy_g_signal; G_DBUS_PROXY_CLASS (class)->g_signal = bus_engine_proxy_g_signal;
/* install signals */ /* install signals */
engine_signals[COMMIT_TEXT] = engine_signals[COMMIT_TEXT] =
g_signal_new (I_("commit-text"), g_signal_new (I_("commit-text"),
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
0, 0,
NULL, NULL, NULL, NULL,
@ -104,7 +104,7 @@ bus_engine_proxy_class_init (BusEngineProxyClass *klass)
engine_signals[FORWARD_KEY_EVENT] = engine_signals[FORWARD_KEY_EVENT] =
g_signal_new (I_("forward-key-event"), g_signal_new (I_("forward-key-event"),
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
0, 0,
NULL, NULL, NULL, NULL,
@ -117,7 +117,7 @@ bus_engine_proxy_class_init (BusEngineProxyClass *klass)
engine_signals[DELETE_SURROUNDING_TEXT] = engine_signals[DELETE_SURROUNDING_TEXT] =
g_signal_new (I_("delete-surrounding-text"), g_signal_new (I_("delete-surrounding-text"),
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
0, 0,
NULL, NULL, NULL, NULL,
@ -129,7 +129,7 @@ bus_engine_proxy_class_init (BusEngineProxyClass *klass)
engine_signals[UPDATE_PREEDIT_TEXT] = engine_signals[UPDATE_PREEDIT_TEXT] =
g_signal_new (I_("update-preedit-text"), g_signal_new (I_("update-preedit-text"),
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
0, 0,
NULL, NULL, NULL, NULL,
@ -143,7 +143,7 @@ bus_engine_proxy_class_init (BusEngineProxyClass *klass)
engine_signals[SHOW_PREEDIT_TEXT] = engine_signals[SHOW_PREEDIT_TEXT] =
g_signal_new (I_("show-preedit-text"), g_signal_new (I_("show-preedit-text"),
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
0, 0,
NULL, NULL, NULL, NULL,
@ -153,7 +153,7 @@ bus_engine_proxy_class_init (BusEngineProxyClass *klass)
engine_signals[HIDE_PREEDIT_TEXT] = engine_signals[HIDE_PREEDIT_TEXT] =
g_signal_new (I_("hide-preedit-text"), g_signal_new (I_("hide-preedit-text"),
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
0, 0,
NULL, NULL, NULL, NULL,
@ -163,7 +163,7 @@ bus_engine_proxy_class_init (BusEngineProxyClass *klass)
engine_signals[UPDATE_AUXILIARY_TEXT] = engine_signals[UPDATE_AUXILIARY_TEXT] =
g_signal_new (I_("update-auxiliary-text"), g_signal_new (I_("update-auxiliary-text"),
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
0, 0,
NULL, NULL, NULL, NULL,
@ -175,7 +175,7 @@ bus_engine_proxy_class_init (BusEngineProxyClass *klass)
engine_signals[SHOW_AUXILIARY_TEXT] = engine_signals[SHOW_AUXILIARY_TEXT] =
g_signal_new (I_("show-auxiliary-text"), g_signal_new (I_("show-auxiliary-text"),
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
0, 0,
NULL, NULL, NULL, NULL,
@ -185,7 +185,7 @@ bus_engine_proxy_class_init (BusEngineProxyClass *klass)
engine_signals[HIDE_AUXILIARY_TEXT] = engine_signals[HIDE_AUXILIARY_TEXT] =
g_signal_new (I_("hide-auxiliary-text"), g_signal_new (I_("hide-auxiliary-text"),
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
0, 0,
NULL, NULL, NULL, NULL,
@ -195,7 +195,7 @@ bus_engine_proxy_class_init (BusEngineProxyClass *klass)
engine_signals[UPDATE_LOOKUP_TABLE] = engine_signals[UPDATE_LOOKUP_TABLE] =
g_signal_new (I_("update-lookup-table"), g_signal_new (I_("update-lookup-table"),
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
0, 0,
NULL, NULL, NULL, NULL,
@ -207,7 +207,7 @@ bus_engine_proxy_class_init (BusEngineProxyClass *klass)
engine_signals[SHOW_LOOKUP_TABLE] = engine_signals[SHOW_LOOKUP_TABLE] =
g_signal_new (I_("show-lookup-table"), g_signal_new (I_("show-lookup-table"),
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
0, 0,
NULL, NULL, NULL, NULL,
@ -217,7 +217,7 @@ bus_engine_proxy_class_init (BusEngineProxyClass *klass)
engine_signals[HIDE_LOOKUP_TABLE] = engine_signals[HIDE_LOOKUP_TABLE] =
g_signal_new (I_("hide-lookup-table"), g_signal_new (I_("hide-lookup-table"),
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
0, 0,
NULL, NULL, NULL, NULL,
@ -227,7 +227,7 @@ bus_engine_proxy_class_init (BusEngineProxyClass *klass)
engine_signals[PAGE_UP_LOOKUP_TABLE] = engine_signals[PAGE_UP_LOOKUP_TABLE] =
g_signal_new (I_("page-up-lookup-table"), g_signal_new (I_("page-up-lookup-table"),
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
0, 0,
NULL, NULL, NULL, NULL,
@ -237,7 +237,7 @@ bus_engine_proxy_class_init (BusEngineProxyClass *klass)
engine_signals[PAGE_DOWN_LOOKUP_TABLE] = engine_signals[PAGE_DOWN_LOOKUP_TABLE] =
g_signal_new (I_("page-down-lookup-table"), g_signal_new (I_("page-down-lookup-table"),
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
0, 0,
NULL, NULL, NULL, NULL,
@ -247,7 +247,7 @@ bus_engine_proxy_class_init (BusEngineProxyClass *klass)
engine_signals[CURSOR_UP_LOOKUP_TABLE] = engine_signals[CURSOR_UP_LOOKUP_TABLE] =
g_signal_new (I_("cursor-up-lookup-table"), g_signal_new (I_("cursor-up-lookup-table"),
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
0, 0,
NULL, NULL, NULL, NULL,
@ -257,7 +257,7 @@ bus_engine_proxy_class_init (BusEngineProxyClass *klass)
engine_signals[CURSOR_DOWN_LOOKUP_TABLE] = engine_signals[CURSOR_DOWN_LOOKUP_TABLE] =
g_signal_new (I_("cursor-down-lookup-table"), g_signal_new (I_("cursor-down-lookup-table"),
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
0, 0,
NULL, NULL, NULL, NULL,
@ -267,7 +267,7 @@ bus_engine_proxy_class_init (BusEngineProxyClass *klass)
engine_signals[REGISTER_PROPERTIES] = engine_signals[REGISTER_PROPERTIES] =
g_signal_new (I_("register-properties"), g_signal_new (I_("register-properties"),
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
0, 0,
NULL, NULL, NULL, NULL,
@ -278,7 +278,7 @@ bus_engine_proxy_class_init (BusEngineProxyClass *klass)
engine_signals[UPDATE_PROPERTY] = engine_signals[UPDATE_PROPERTY] =
g_signal_new (I_("update-property"), g_signal_new (I_("update-property"),
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
0, 0,
NULL, NULL, NULL, NULL,

Просмотреть файл

@ -59,15 +59,6 @@ BusFactoryProxy *bus_factory_proxy_get_from_component
(IBusComponent *component); (IBusComponent *component);
BusFactoryProxy *bus_factory_proxy_get_from_engine BusFactoryProxy *bus_factory_proxy_get_from_engine
(IBusEngineDesc *desc); (IBusEngineDesc *desc);
#if 0
const gchar *bus_factory_proxy_get_name (BusFactoryProxy *factory);
const gchar *bus_factory_proxy_get_lang (BusFactoryProxy *factory);
const gchar *bus_factory_proxy_get_icon (BusFactoryProxy *factory);
const gchar *bus_factory_proxy_get_authors (BusFactoryProxy *factory);
const gchar *bus_factory_proxy_get_credits (BusFactoryProxy *factory);
#endif
G_END_DECLS G_END_DECLS
#endif #endif

Просмотреть файл

@ -284,7 +284,7 @@ bus_ibus_impl_set_trigger (BusIBusImpl *ibus,
bus_ibus_impl_set_hotkey (ibus, hotkey, value); bus_ibus_impl_set_hotkey (ibus, hotkey, value);
} }
else { else {
/* set defaint trigger */ /* set default trigger */
ibus_hotkey_profile_add_hotkey (ibus->hotkey_profile, ibus_hotkey_profile_add_hotkey (ibus->hotkey_profile,
IBUS_space, IBUS_space,
IBUS_CONTROL_MASK, IBUS_CONTROL_MASK,
@ -754,8 +754,8 @@ _ibus_get_address (BusIBusImpl *ibus,
GVariant *parameters, GVariant *parameters,
GDBusMethodInvocation *invocation) GDBusMethodInvocation *invocation)
{ {
/* FIXME */ g_dbus_method_invocation_return_value (invocation,
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(s)", "FIXME")); g_variant_new ("(s)", bus_server_get_address ()));
} }

Просмотреть файл

@ -667,7 +667,7 @@ _ic_process_key_event_reply_cb (GObject *source,
GVariant *retval = g_dbus_proxy_call_finish ((GDBusProxy *)source, GVariant *retval = g_dbus_proxy_call_finish ((GDBusProxy *)source,
result, &error); result, &error);
if (retval != NULL) { if (retval != NULL) {
/* XXX: need check retval is floating? */ /* FIXME: need check retval is floating? */
g_dbus_method_invocation_return_value ((GDBusMethodInvocation *)user_data, retval); g_dbus_method_invocation_return_value ((GDBusMethodInvocation *)user_data, retval);
g_variant_unref (retval); g_variant_unref (retval);
} }
@ -1699,12 +1699,6 @@ bus_input_context_new (BusConnection *connection,
NULL); NULL);
g_free (path); g_free (path);
#if 0
ibus_service_add_to_connection (IBUS_SERVICE (context),
IBUS_CONNECTION (connection));
#endif
g_object_ref_sink (connection); g_object_ref_sink (connection);
context->connection = connection; context->connection = connection;
context->client = g_strdup (client); context->client = g_strdup (client);

Просмотреть файл

@ -213,7 +213,6 @@ main (gint argc, gchar **argv)
ibus_set_log_handler(g_verbose); ibus_set_log_handler(g_verbose);
/* check if ibus-daemon is running in this session */ /* check if ibus-daemon is running in this session */
#if 0
if (ibus_get_address () != NULL) { if (ibus_get_address () != NULL) {
IBusBus *bus = ibus_bus_new (); IBusBus *bus = ibus_bus_new ();
@ -230,7 +229,7 @@ main (gint argc, gchar **argv)
g_object_unref (bus); g_object_unref (bus);
bus = NULL; bus = NULL;
} }
#endif
bus_server_init (); bus_server_init ();
/* FIXME */ /* FIXME */
if (!single) { if (!single) {

Просмотреть файл

@ -105,9 +105,9 @@ bus_recipient_unref (BusRecipient *recipient)
G_DEFINE_TYPE (BusMatchRule, bus_match_rule, IBUS_TYPE_OBJECT) G_DEFINE_TYPE (BusMatchRule, bus_match_rule, IBUS_TYPE_OBJECT)
static void static void
bus_match_rule_class_init (BusMatchRuleClass *klass) bus_match_rule_class_init (BusMatchRuleClass *class)
{ {
IBusObjectClass *ibus_object_class = IBUS_OBJECT_CLASS (klass); IBusObjectClass *ibus_object_class = IBUS_OBJECT_CLASS (class);
ibus_object_class->destroy = (IBusObjectDestroyFunc) bus_match_rule_destroy; ibus_object_class->destroy = (IBusObjectDestroyFunc) bus_match_rule_destroy;
} }
@ -339,18 +339,26 @@ bus_match_rule_new (const gchar *text)
goto failed; goto failed;
} }
else if (g_strcmp0 (p->key, "sender") == 0) { else if (g_strcmp0 (p->key, "sender") == 0) {
if (!g_dbus_is_name (p->value))
goto failed;
bus_match_rule_set_sender (rule, p->value); bus_match_rule_set_sender (rule, p->value);
} }
else if (g_strcmp0 (p->key, "interface") == 0) { else if (g_strcmp0 (p->key, "interface") == 0) {
if (!g_dbus_is_interface_name (p->value))
goto failed;
bus_match_rule_set_interface (rule, p->value); bus_match_rule_set_interface (rule, p->value);
} }
else if (g_strcmp0 (p->key, "member") == 0) { else if (g_strcmp0 (p->key, "member") == 0) {
if (!g_dbus_is_member_name (p->value))
goto failed;
bus_match_rule_set_member (rule, p->value); bus_match_rule_set_member (rule, p->value);
} }
else if (g_strcmp0 (p->key, "path") == 0) { else if (g_strcmp0 (p->key, "path") == 0) {
bus_match_rule_set_path (rule, p->value); bus_match_rule_set_path (rule, p->value);
} }
else if (g_strcmp0 (p->key, "destination") == 0) { else if (g_strcmp0 (p->key, "destination") == 0) {
if (!g_dbus_is_name (p->value))
goto failed;
bus_match_rule_set_destination (rule, p->value); bus_match_rule_set_destination (rule, p->value);
} }
else if (strncmp (p->key, "arg", 3) == 0) { else if (strncmp (p->key, "arg", 3) == 0) {
@ -485,7 +493,7 @@ static gboolean
bus_match_rule_match_name (const gchar *name, bus_match_rule_match_name (const gchar *name,
const gchar *match_name) const gchar *match_name)
{ {
if (name[0] == ':' && match_name[0] != ':') { if (g_dbus_is_unique_name (name) && !g_dbus_is_unique_name (match_name)) {
BusConnection *connection = BusConnection *connection =
bus_dbus_impl_get_connection_by_name (BUS_DEFAULT_DBUS, match_name); bus_dbus_impl_get_connection_by_name (BUS_DEFAULT_DBUS, match_name);
if (connection == NULL) if (connection == NULL)

Просмотреть файл

@ -48,10 +48,10 @@ static void bus_registry_remove_all (BusRegistry *reg
G_DEFINE_TYPE (BusRegistry, bus_registry, IBUS_TYPE_OBJECT) G_DEFINE_TYPE (BusRegistry, bus_registry, IBUS_TYPE_OBJECT)
static void static void
bus_registry_class_init (BusRegistryClass *klass) bus_registry_class_init (BusRegistryClass *class)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (class);
IBusObjectClass *ibus_object_class = IBUS_OBJECT_CLASS (klass); IBusObjectClass *ibus_object_class = IBUS_OBJECT_CLASS (class);
_signals[CHANGED] = _signals[CHANGED] =
g_signal_new (I_("changed"), g_signal_new (I_("changed"),
@ -192,7 +192,9 @@ bus_registry_load (BusRegistry *registry)
bus_registry_load_in_dir (registry, dirname); bus_registry_load_in_dir (registry, dirname);
g_free (dirname); g_free (dirname);
#if 0 #if 0
/* FIXME Should we support install some IME in user dir? */
dirname = g_build_filename (g_get_user_data_dir (), "ibus", "component", NULL); dirname = g_build_filename (g_get_user_data_dir (), "ibus", "component", NULL);
path = ibus_observed_path_new (dirname, TRUE); path = ibus_observed_path_new (dirname, TRUE);

Просмотреть файл

@ -29,6 +29,7 @@ static GDBusServer *server = NULL;
static GMainLoop *mainloop = NULL; static GMainLoop *mainloop = NULL;
static BusDBusImpl *dbus = NULL; static BusDBusImpl *dbus = NULL;
static BusIBusImpl *ibus = NULL; static BusIBusImpl *ibus = NULL;
static gchar *address = NULL;
static gboolean static gboolean
bus_new_connection_cb (GDBusServer *server, bus_new_connection_cb (GDBusServer *server,
@ -63,14 +64,18 @@ bus_server_init (void)
g_dbus_server_start (server); g_dbus_server_start (server);
gchar *address = g_strdup_printf ("%s,guid=%s", address = g_strdup_printf ("%s,guid=%s",
g_dbus_server_get_client_address (server), g_dbus_server_get_client_address (server),
g_dbus_server_get_guid (server)); g_dbus_server_get_guid (server));
/* write address to file */ /* write address to file */
ibus_write_address (address); ibus_write_address (address);
}
g_free (address); const gchar *
bus_server_get_address (void)
{
return address;
} }
void void

Просмотреть файл

@ -29,7 +29,7 @@ G_BEGIN_DECLS
void bus_server_init (void); void bus_server_init (void);
void bus_server_run (void); void bus_server_run (void);
void bus_server_quit (void); void bus_server_quit (void);
const gchar *bus_server_get_address (void);
G_END_DECLS G_END_DECLS
#endif #endif

Просмотреть файл

@ -31,7 +31,7 @@
# define IDEBUG(a...) # define IDEBUG(a...)
#endif #endif
/* functions prototype */ /* functions prototype */
static void bus_test_client_class_init (BusTestClientClass *klass); static void bus_test_client_class_init (BusTestClientClass *class);
static void bus_test_client_destroy (IBusObject *object); static void bus_test_client_destroy (IBusObject *object);
/* static methods*/ /* static methods*/
@ -57,11 +57,11 @@ static Display *_xdisplay = NULL;
G_DEFINE_TYPE (BusTestClient, bus_test_client, IBUS_TYPE_OBJECT) G_DEFINE_TYPE (BusTestClient, bus_test_client, IBUS_TYPE_OBJECT)
static void static void
bus_test_client_class_init (BusTestClientClass *klass) bus_test_client_class_init (BusTestClientClass *class)
{ {
IDEBUG ("%s", __FUNCTION__); IDEBUG ("%s", __FUNCTION__);
IBusObjectClass *ibus_object_class = IBUS_OBJECT_CLASS (klass); IBusObjectClass *ibus_object_class = IBUS_OBJECT_CLASS (class);
ibus_object_class->destroy = bus_test_client_destroy; ibus_object_class->destroy = bus_test_client_destroy;

Просмотреть файл

@ -90,7 +90,7 @@ static IBusInputContext *_fake_context = NULL;
static GdkWindow *_input_window = NULL; static GdkWindow *_input_window = NULL;
/* functions prototype */ /* functions prototype */
static void ibus_im_context_class_init (IBusIMContextClass *klass); static void ibus_im_context_class_init (IBusIMContextClass *class);
static void ibus_im_context_init (GObject *obj); static void ibus_im_context_init (GObject *obj);
static void ibus_im_context_finalize (GObject *obj); static void ibus_im_context_finalize (GObject *obj);
static void ibus_im_context_reset (GtkIMContext *context); static void ibus_im_context_reset (GtkIMContext *context);
@ -274,14 +274,14 @@ _key_snooper_cb (GtkWidget *widget,
} }
static void static void
ibus_im_context_class_init (IBusIMContextClass *klass) ibus_im_context_class_init (IBusIMContextClass *class)
{ {
IDEBUG ("%s", __FUNCTION__); IDEBUG ("%s", __FUNCTION__);
GtkIMContextClass *im_context_class = GTK_IM_CONTEXT_CLASS (klass); GtkIMContextClass *im_context_class = GTK_IM_CONTEXT_CLASS (class);
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (class);
parent_class = (GtkIMContextClass *) g_type_class_peek_parent (klass); parent_class = (GtkIMContextClass *) g_type_class_peek_parent (class);
im_context_class->reset = ibus_im_context_reset; im_context_class->reset = ibus_im_context_reset;
im_context_class->focus_in = ibus_im_context_focus_in; im_context_class->focus_in = ibus_im_context_focus_in;
@ -294,27 +294,27 @@ ibus_im_context_class_init (IBusIMContextClass *klass)
gobject_class->finalize = ibus_im_context_finalize; gobject_class->finalize = ibus_im_context_finalize;
_signal_commit_id = _signal_commit_id =
g_signal_lookup ("commit", G_TYPE_FROM_CLASS (klass)); g_signal_lookup ("commit", G_TYPE_FROM_CLASS (class));
g_assert (_signal_commit_id != 0); g_assert (_signal_commit_id != 0);
_signal_preedit_changed_id = _signal_preedit_changed_id =
g_signal_lookup ("preedit-changed", G_TYPE_FROM_CLASS (klass)); g_signal_lookup ("preedit-changed", G_TYPE_FROM_CLASS (class));
g_assert (_signal_preedit_changed_id != 0); g_assert (_signal_preedit_changed_id != 0);
_signal_preedit_start_id = _signal_preedit_start_id =
g_signal_lookup ("preedit-start", G_TYPE_FROM_CLASS (klass)); g_signal_lookup ("preedit-start", G_TYPE_FROM_CLASS (class));
g_assert (_signal_preedit_start_id != 0); g_assert (_signal_preedit_start_id != 0);
_signal_preedit_end_id = _signal_preedit_end_id =
g_signal_lookup ("preedit-end", G_TYPE_FROM_CLASS (klass)); g_signal_lookup ("preedit-end", G_TYPE_FROM_CLASS (class));
g_assert (_signal_preedit_end_id != 0); g_assert (_signal_preedit_end_id != 0);
_signal_delete_surrounding_id = _signal_delete_surrounding_id =
g_signal_lookup ("delete-surrounding", G_TYPE_FROM_CLASS (klass)); g_signal_lookup ("delete-surrounding", G_TYPE_FROM_CLASS (class));
g_assert (_signal_delete_surrounding_id != 0); g_assert (_signal_delete_surrounding_id != 0);
_signal_retrieve_surrounding_id = _signal_retrieve_surrounding_id =
g_signal_lookup ("retrieve-surrounding", G_TYPE_FROM_CLASS (klass)); g_signal_lookup ("retrieve-surrounding", G_TYPE_FROM_CLASS (class));
g_assert (_signal_retrieve_surrounding_id != 0); g_assert (_signal_retrieve_surrounding_id != 0);
const gchar *ibus_disable_snooper = g_getenv ("IBUS_DISABLE_SNOOPER"); const gchar *ibus_disable_snooper = g_getenv ("IBUS_DISABLE_SNOOPER");

2
debian/rules поставляемый
Просмотреть файл

@ -6,7 +6,7 @@ build: patch
ln -sf /usr/share/misc/config.sub config.sub ln -sf /usr/share/misc/config.sub config.sub
ln -sf /usr/share/misc/config.guess config.guess ln -sf /usr/share/misc/config.guess config.guess
dh $@ --before auto_configure dh $@ --before auto_configure
dh_auto_configure -- --enable-static LDFLAGS="-Wl,--as-needed" --enable-key-snooper dh_auto_configure -- --enable-static LDFLAGS="-Wl,--as-needed"
dh $@ --before auto_test dh $@ --before auto_test
cd po; make ibus10.pot # https://bugs.launchpad.net/ubuntu/+source/ibus/+bug/188690 cd po; make ibus10.pot # https://bugs.launchpad.net/ubuntu/+source/ibus/+bug/188690
dh $@ --after auto_test dh $@ --after auto_test

Просмотреть файл

@ -111,15 +111,6 @@ ibus_component_stop
ibus_component_is_running ibus_component_is_running
ibus_component_get_from_engine ibus_component_get_from_engine
ibus_component_set_restart ibus_component_set_restart
>>>>>>> wip.
<SUBSECTION Standard>
IBUS_KEYMAP
IBUS_IS_KEYMAP
IBUS_TYPE_KEYMAP
ibus_keymap_get_type
IBUS_KEYMAP_CLASS
IBUS_IS_KEYMAP_CLASS
IBUS_KEYMAP_GET_CLASS
</SECTION> </SECTION>
<SECTION> <SECTION>

Просмотреть файл

@ -18,7 +18,7 @@ struct _IBusConfigGConfClass {
}; };
/* functions prototype */ /* functions prototype */
static void ibus_config_gconf_class_init (IBusConfigGConfClass *klass); static void ibus_config_gconf_class_init (IBusConfigGConfClass *class);
static void ibus_config_gconf_init (IBusConfigGConf *config); static void ibus_config_gconf_init (IBusConfigGConf *config);
static void ibus_config_gconf_destroy (IBusConfigGConf *config); static void ibus_config_gconf_destroy (IBusConfigGConf *config);
static gboolean ibus_config_gconf_set_value (IBusConfigService *config, static gboolean ibus_config_gconf_set_value (IBusConfigService *config,
@ -40,9 +40,9 @@ static GVariant *_from_gconf_value (const GConfValue *gva
G_DEFINE_TYPE (IBusConfigGConf, ibus_config_gconf, IBUS_TYPE_CONFIG_SERVICE) G_DEFINE_TYPE (IBusConfigGConf, ibus_config_gconf, IBUS_TYPE_CONFIG_SERVICE)
static void static void
ibus_config_gconf_class_init (IBusConfigGConfClass *klass) ibus_config_gconf_class_init (IBusConfigGConfClass *class)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (class);
IBUS_OBJECT_CLASS (object_class)->destroy = (IBusObjectDestroyFunc) ibus_config_gconf_destroy; IBUS_OBJECT_CLASS (object_class)->destroy = (IBusObjectDestroyFunc) ibus_config_gconf_destroy;
IBUS_CONFIG_SERVICE_CLASS (object_class)->set_value = ibus_config_gconf_set_value; IBUS_CONFIG_SERVICE_CLASS (object_class)->set_value = ibus_config_gconf_set_value;

Просмотреть файл

@ -36,7 +36,7 @@ struct _IBusConfigMemconfClass {
}; };
/* functions prototype */ /* functions prototype */
static void ibus_config_memconf_class_init (IBusConfigMemconfClass *klass); static void ibus_config_memconf_class_init (IBusConfigMemconfClass *class);
static void ibus_config_memconf_init (IBusConfigMemconf *config); static void ibus_config_memconf_init (IBusConfigMemconf *config);
static void ibus_config_memconf_destroy (IBusConfigMemconf *config); static void ibus_config_memconf_destroy (IBusConfigMemconf *config);
static gboolean ibus_config_memconf_set_value (IBusConfigService *config, static gboolean ibus_config_memconf_set_value (IBusConfigService *config,
@ -56,9 +56,9 @@ static gboolean ibus_config_memconf_unset_value (IBusConfigService *con
G_DEFINE_TYPE (IBusConfigMemconf, ibus_config_memconf, IBUS_TYPE_CONFIG_SERVICE) G_DEFINE_TYPE (IBusConfigMemconf, ibus_config_memconf, IBUS_TYPE_CONFIG_SERVICE)
static void static void
ibus_config_memconf_class_init (IBusConfigMemconfClass *klass) ibus_config_memconf_class_init (IBusConfigMemconfClass *class)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (class);
IBUS_OBJECT_CLASS (object_class)->destroy = (IBusObjectDestroyFunc) ibus_config_memconf_destroy; IBUS_OBJECT_CLASS (object_class)->destroy = (IBusObjectDestroyFunc) ibus_config_memconf_destroy;
IBUS_CONFIG_SERVICE_CLASS (object_class)->set_value = ibus_config_memconf_set_value; IBUS_CONFIG_SERVICE_CLASS (object_class)->set_value = ibus_config_memconf_set_value;

Просмотреть файл

@ -141,6 +141,7 @@ ibus_bus_class_init (IBusBusClass *class)
g_type_class_add_private (class, sizeof (IBusBusPrivate)); g_type_class_add_private (class, sizeof (IBusBusPrivate));
} }
#if 0 #if 0
static gboolean static gboolean
_connection_ibus_signal_cb (GDBusConnection *connection, _connection_ibus_signal_cb (GDBusConnection *connection,
@ -469,7 +470,7 @@ const gchar *
ibus_bus_hello (IBusBus *bus) ibus_bus_hello (IBusBus *bus)
{ {
g_return_val_if_fail (IBUS_IS_BUS (bus), NULL); g_return_val_if_fail (IBUS_IS_BUS (bus), NULL);
/* FIXME */ /* FIXME gdbus connection will say hello by self. */
#if 1 #if 1
if (bus->priv->connection) if (bus->priv->connection)
return g_dbus_connection_get_unique_name (bus->priv->connection); return g_dbus_connection_get_unique_name (bus->priv->connection);

Просмотреть файл

@ -22,9 +22,6 @@
#include "ibusshare.h" #include "ibusshare.h"
#include "ibusconfigservice.h" #include "ibusconfigservice.h"
#define IBUS_CONFIG_SERVICE_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), IBUS_TYPE_CONFIG_SERVICE, IBusConfigServicePrivate))
enum { enum {
LAST_SIGNAL, LAST_SIGNAL,
}; };
@ -128,19 +125,11 @@ ibus_config_service_class_init (IBusConfigServiceClass *class)
class->set_value = ibus_config_service_set_value; class->set_value = ibus_config_service_set_value;
class->get_value = ibus_config_service_get_value; class->get_value = ibus_config_service_get_value;
class->unset_value = ibus_config_service_unset_value; class->unset_value = ibus_config_service_unset_value;
/* install properties */
/*
* g_type_class_add_private (class, sizeof (IBusConfigServicePrivate));
*/
} }
static void static void
ibus_config_service_init (IBusConfigService *config) ibus_config_service_init (IBusConfigService *config)
{ {
/*
* config->priv = IBUS_CONFIG_SERVICE_GET_PRIVATE (config);
*/
} }
static void static void
@ -150,12 +139,6 @@ ibus_config_service_set_property (IBusConfigService *config,
GParamSpec *pspec) GParamSpec *pspec)
{ {
switch (prop_id) { switch (prop_id) {
#if 0
case PROP_CONNECTION:
ibus_service_add_to_connection ((IBusService *) config,
g_value_get_object (value));
break;
#endif
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (config, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (config, prop_id, pspec);
} }

Просмотреть файл

@ -962,35 +962,6 @@ ibus_engine_emit_signal (IBusEngine *engine,
NULL); NULL);
} }
#if 0
static void
_send_signal (IBusEngine *engine,
const gchar *name,
GType first_arg_type,
...)
{
g_assert (IBUS_IS_ENGINE (engine));
g_assert (name != NULL);
va_list args;
const gchar *path;
IBusEnginePrivate *priv;
priv = IBUS_ENGINE_GET_PRIVATE (engine);
path = ibus_service_get_path ((IBusService *)engine);
va_start (args, first_arg_type);
ibus_connection_send_signal_valist (priv->connection,
path,
IBUS_INTERFACE_ENGINE,
name,
first_arg_type,
args);
va_end (args);
}
#endif
IBusEngine * IBusEngine *
ibus_engine_new (const gchar *engine_name, ibus_engine_new (const gchar *engine_name,
const gchar *object_path, const gchar *object_path,

Просмотреть файл

@ -151,14 +151,6 @@ ibus_factory_set_property (IBusFactory *factory,
GParamSpec *pspec) GParamSpec *pspec)
{ {
switch (prop_id) { switch (prop_id) {
#if 0
case PROP_CONNECTION:
priv->connection = g_value_get_object (value);
g_object_ref_sink (priv->connection);
ibus_service_add_to_connection ((IBusService *) factory,
priv->connection);
break;
#endif
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (factory, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (factory, prop_id, pspec);
} }
@ -171,11 +163,6 @@ ibus_factory_get_property (IBusFactory *factory,
GParamSpec *pspec) GParamSpec *pspec)
{ {
switch (prop_id) { switch (prop_id) {
#if 0
case PROP_CONNECTION:
g_value_set_object (value, priv->connection);
break;
#endif
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (factory, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (factory, prop_id, pspec);
} }

Просмотреть файл

@ -129,22 +129,6 @@ ibus_panel_service_class_init (IBusPanelServiceClass *class)
class->show_preedit_text = ibus_panel_service_not_implemented; class->show_preedit_text = ibus_panel_service_not_implemented;
class->start_setup = ibus_panel_service_not_implemented; class->start_setup = ibus_panel_service_not_implemented;
class->state_changed = ibus_panel_service_not_implemented; class->state_changed = ibus_panel_service_not_implemented;
/* install properties */
#if 0
/**
* IBusPanelService:connection:
*
* Connection of this IBusPanelService.
*/
g_object_class_install_property (gobject_class,
PROP_CONNECTION,
g_param_spec_object ("connection",
"connection",
"The connection of service object",
IBUS_TYPE_CONNECTION,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
#endif
} }
static void static void
@ -159,12 +143,6 @@ ibus_panel_service_set_property (IBusPanelService *panel,
GParamSpec *pspec) GParamSpec *pspec)
{ {
switch (prop_id) { switch (prop_id) {
#if 0
case PROP_CONNECTION:
ibus_service_add_to_connection ((IBusService *) panel,
g_value_get_object (value));
break;
#endif
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (panel, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (panel, prop_id, pspec);
} }
@ -177,10 +155,6 @@ ibus_panel_service_get_property (IBusPanelService *panel,
GParamSpec *pspec) GParamSpec *pspec)
{ {
switch (prop_id) { switch (prop_id) {
#if 0
case PROP_CONNECTION:
break;
#endif
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (panel, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (panel, prop_id, pspec);
} }

Просмотреть файл

@ -25,7 +25,6 @@
#define IBUS_SERVICE_GET_PRIVATE(o) \ #define IBUS_SERVICE_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), IBUS_TYPE_SERVICE, IBusServicePrivate)) (G_TYPE_INSTANCE_GET_PRIVATE ((o), IBUS_TYPE_SERVICE, IBusServicePrivate))
/* XXX */
enum { enum {
LAST_SIGNAL LAST_SIGNAL
}; };