summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHuang Peng <shawn.p.huang@gmail.com>2008-11-02 13:35:51 +0800
committerHuang Peng <shawn.p.huang@gmail.com>2008-11-02 13:35:51 +0800
commit56220f5befb25c8ac6f8de56707a872e099b2f14 (patch)
tree6113f31eabb5a270d4167eab17a995740b7a602c
parent86aa640c0b64ba4e73ba5ca2e37a384412ed474e (diff)
downloadibus-56220f5befb25c8ac6f8de56707a872e099b2f14.tar.gz
ibus-56220f5befb25c8ac6f8de56707a872e099b2f14.tar.xz
ibus-56220f5befb25c8ac6f8de56707a872e099b2f14.zip
WIP.
-rw-r--r--bus/dbusimpl.c5
-rw-r--r--src/ibusconnection.c40
-rw-r--r--src/ibusconnection.h3
-rw-r--r--src/ibusmarshalers.list1
4 files changed, 45 insertions, 4 deletions
diff --git a/bus/dbusimpl.c b/bus/dbusimpl.c
index 414a143..66b92f3 100644
--- a/bus/dbusimpl.c
+++ b/bus/dbusimpl.c
@@ -948,7 +948,10 @@ bus_dbus_impl_dispatch_message (BusDBusImpl *dbus,
destination = dbus_message_get_destination (message);
if (destination != NULL) {
dest_connection = bus_dbus_impl_get_connection_by_name (dbus, destination);
- ibus_connection_send (IBUS_CONNECTION (dest_connection), message);
+
+ if (dest_connection != NULL) {
+ ibus_connection_send (IBUS_CONNECTION (dest_connection), message);
+ }
}
bus_dbus_impl_dispatch_message_by_rule (dbus, message, dest_connection);
diff --git a/src/ibusconnection.c b/src/ibusconnection.c
index 9236437..69817e4 100644
--- a/src/ibusconnection.c
+++ b/src/ibusconnection.c
@@ -27,6 +27,7 @@
enum {
DBUS_SIGNAL,
DBUS_MESSAGE,
+ DBUS_MESSAGE_SENT,
DISCONNECTED,
LAST_SIGNAL,
};
@@ -128,6 +129,16 @@ ibus_connection_class_init (IBusConnectionClass *klass)
ibus_marshal_BOOL__POINTER,
G_TYPE_BOOLEAN, 1,
G_TYPE_POINTER);
+
+ connection_signals[DBUS_MESSAGE_SENT] =
+ g_signal_new (I_("dbus-message-sent"),
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (IBusConnectionClass, dbus_message_sent),
+ NULL, NULL,
+ ibus_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1,
+ G_TYPE_POINTER);
connection_signals[DISCONNECTED] =
g_signal_new (I_("disconnected"),
@@ -428,10 +439,20 @@ ibus_connection_send (IBusConnection *connection, DBusMessage *message)
g_assert (IBUS_IS_CONNECTION (connection));
g_assert (message != NULL);
+ gboolean retval;
IBusConnectionPrivate *priv;
priv = IBUS_CONNECTION_GET_PRIVATE (connection);
- return dbus_connection_send (priv->connection, message, NULL);
+ retval = dbus_connection_send (priv->connection, message, NULL);
+
+ if (retval) {
+ g_signal_emit (connection,
+ connection_signals[DBUS_MESSAGE_SENT],
+ 0,
+ message);
+ }
+
+ return retval;
}
@@ -559,9 +580,14 @@ ibus_connection_send_with_reply (IBusConnection *connection,
message,
&pending_call,
timeout_milliseconds);
- if (!retval) {
- return retval;
+ if (retval) {
+ g_signal_emit (connection,
+ connection_signals[DBUS_MESSAGE_SENT],
+ 0,
+ message);
}
+ else
+ return FALSE;
data = g_slice_new (PendingCallData);
data->connection = connection;
@@ -603,6 +629,14 @@ ibus_connection_send_with_reply_and_block (IBusConnection *connection,
message,
timeout_milliseconds,
_error);
+
+ if (reply != NULL) {
+ g_signal_emit (connection,
+ connection_signals[DBUS_MESSAGE_SENT],
+ 0,
+ message);
+ }
+
if (reply == NULL && error != NULL) {
*error = _error;
}
diff --git a/src/ibusconnection.h b/src/ibusconnection.h
index da5fac2..d8ee69c 100644
--- a/src/ibusconnection.h
+++ b/src/ibusconnection.h
@@ -72,6 +72,9 @@ struct _IBusConnectionClass {
DBusMessage *message);
gboolean (* dbus_signal) (IBusConnection *connection,
DBusMessage *message);
+ void (* dbus_message_sent)
+ (IBusConnection *connection,
+ DBusMessage *message);
void (* disconnected) (IBusConnection *connection);
};
diff --git a/src/ibusmarshalers.list b/src/ibusmarshalers.list
index 8264afe..b50cba0 100644
--- a/src/ibusmarshalers.list
+++ b/src/ibusmarshalers.list
@@ -4,6 +4,7 @@ NONE:STRING,STRING
NONE:STRING,BOXED
NONE:STRING,STRING,BOXED,INT,BOOL
BOOL:POINTER
+NONE:POINTER
BOOL:POINTER,POINTER
BOOL:UINT,BOOL,UINT
VOID:INT,INT,INT,INT