summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authordchen@redhat.com <dchen@dchen.redhat.com>2009-02-11 15:07:13 +1000
committerdchen@redhat.com <dchen@dchen.redhat.com>2009-02-11 15:07:13 +1000
commitdbdebcff3e27da92f9e4071a088077fb16ca9c02 (patch)
tree04f26e752dd6ee442876855b8200f5a68e297e7c /src
parent445d68d0a6ad1403f1c834067a2f04ffd06d485f (diff)
parente24356351f817c873273d11a2efbdc4e47189fff (diff)
downloadibus-dbdebcff3e27da92f9e4071a088077fb16ca9c02.tar.gz
ibus-dbdebcff3e27da92f9e4071a088077fb16ca9c02.tar.xz
ibus-dbdebcff3e27da92f9e4071a088077fb16ca9c02.zip
Fix conflict merge with phuang
Diffstat (limited to 'src')
-rw-r--r--src/ibusbus.c54
-rw-r--r--src/ibusbus.h3
-rw-r--r--src/ibusconnection.c52
-rw-r--r--src/ibusconnection.h2
-rw-r--r--src/ibusengine.c2
-rw-r--r--src/ibushotkey.c4
-rw-r--r--src/ibusinputcontext.c5
-rw-r--r--src/ibuslookuptable.c15
-rw-r--r--src/ibuslookuptable.h5
-rw-r--r--src/ibusmessage.c2
-rw-r--r--src/ibusobject.h3
-rw-r--r--src/test-lookuptable.c2
12 files changed, 68 insertions, 81 deletions
diff --git a/src/ibusbus.c b/src/ibusbus.c
index be72770..9965761 100644
--- a/src/ibusbus.c
+++ b/src/ibusbus.c
@@ -138,50 +138,6 @@ ibus_bus_class_init (IBusBusClass *klass)
#endif
}
-#if 0
-static gboolean
-_connection_dbus_signal_cb (IBusConnection *connection,
- DBusMessage *message,
- IBusBus *bus)
-{
- g_assert (IBUS_IS_BUS (bus));
- g_assert (message != NULL);
- g_assert (IBUS_IS_CONNECTION (connection));
-
- IBusBusPrivate *priv;
- priv = IBUS_BUS_GET_PRIVATE (bus);
-
- if (dbus_message_is_signal (message, DBUS_INTERFACE_DBUS, "NameOwnerChanged")) {
- DBusError error;
- const gchar *name;
- const gchar *old_name;
- const gchar *new_name;
- gboolean retval;
-
- dbus_error_init (&error);
- retval = dbus_message_get_args (message, &error,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &old_name,
- DBUS_TYPE_STRING, &new_name,
- DBUS_TYPE_INVALID);
- if (!retval) {
- g_warning ("%s: %s", error.name, error.message);
- dbus_error_free (&error);
- }
- else {
- g_signal_emit (bus,
- bus_signals[NAME_OWNER_CHANGED],
- 0,
- name,
- old_name,
- new_name);
- }
- }
-
- return FALSE;
-}
-#endif
-
static void
_connection_destroy_cb (IBusConnection *connection,
IBusBus *bus)
@@ -211,12 +167,6 @@ ibus_bus_connect (IBusBus *bus)
if (priv->connection) {
ibus_bus_hello (bus);
-#if 0
- g_signal_connect (priv->connection,
- "dbus-signal",
- (GCallback) _connection_dbus_signal_cb,
- bus);
-#endif
g_signal_connect (priv->connection,
"destroy",
(GCallback) _connection_destroy_cb,
@@ -684,7 +634,8 @@ ibus_bus_get_connection (IBusBus *bus)
}
gboolean
-ibus_bus_kill (IBusBus *bus)
+ibus_bus_exit (IBusBus *bus,
+ gboolean restart)
{
g_assert (IBUS_IS_BUS (bus));
@@ -694,6 +645,7 @@ ibus_bus_kill (IBusBus *bus)
IBUS_PATH_IBUS,
IBUS_INTERFACE_IBUS,
"Kill",
+ G_TYPE_BOOLEAN, &restart,
G_TYPE_INVALID,
G_TYPE_INVALID);
return result;
diff --git a/src/ibusbus.h b/src/ibusbus.h
index d1d3a7e..4a07d7c 100644
--- a/src/ibusbus.h
+++ b/src/ibusbus.h
@@ -138,7 +138,8 @@ void ibus_bus_remove_match (IBusBus *bus,
const gchar *ibus_bus_get_name_owner (IBusBus *bus,
const gchar *name);
/* declare ibus methods */
-gboolean ibus_bus_kill (IBusBus *bus);
+gboolean ibus_bus_exit (IBusBus *bus,
+ gboolean restart);
IBusInputContext
*ibus_bus_create_input_context
(IBusBus *bus,
diff --git a/src/ibusconnection.c b/src/ibusconnection.c
index 90776cd..acc9037 100644
--- a/src/ibusconnection.c
+++ b/src/ibusconnection.c
@@ -370,6 +370,16 @@ ibus_connection_get_connection (IBusConnection *connection)
return priv->connection;
}
+gboolean
+ibus_connection_read_write_dispatch (IBusConnection *connection,
+ gint timeout)
+{
+ IBusConnectionPrivate *priv;
+ priv = IBUS_CONNECTION_GET_PRIVATE (connection);
+
+ return dbus_connection_read_write_dispatch (priv->connection, timeout);
+}
+
typedef struct _VTableCallData {
IBusMessageFunc message_func;
gpointer user_data;
@@ -558,10 +568,14 @@ ibus_connection_send_with_reply (IBusConnection *connection,
IBusConnectionPrivate *priv;
priv = IBUS_CONNECTION_GET_PRIVATE (connection);
- return dbus_connection_send_with_reply (priv->connection,
- message,
- pending_return,
- timeout_milliseconds);
+ gboolean retval;
+
+ retval = dbus_connection_send_with_reply (priv->connection,
+ message,
+ pending_return,
+ timeout_milliseconds);
+
+ return retval;
}
IBusMessage *
@@ -591,13 +605,16 @@ ibus_connection_send_with_reply_and_block (IBusConnection *connection,
connection_signals[IBUS_MESSAGE_SENT],
0,
message);
+ ibus_error_free (_error);
}
-
- if (reply == NULL && error != NULL) {
+ else {
+ if (error != NULL) {
*error = _error;
+ }
+ else {
+ ibus_error_free (_error);
+ }
}
- else
- ibus_error_free (_error);
return reply;
}
@@ -652,8 +669,9 @@ ibus_connection_call (IBusConnection *connection,
if (error) {
*error = tmp_error;
}
- else
+ else {
ibus_error_free (tmp_error);
+ }
ibus_message_unref (reply);
return FALSE;
}
@@ -662,7 +680,7 @@ ibus_connection_call (IBusConnection *connection,
type = first_arg_type;
- while (type != DBUS_TYPE_INVALID) {
+ while (type != G_TYPE_INVALID) {
va_arg (args, gpointer);
type = va_arg (args, GType);
}
@@ -671,16 +689,14 @@ ibus_connection_call (IBusConnection *connection,
if (type != G_TYPE_INVALID) {
retval = ibus_message_get_args_valist (reply, error, type, args);
}
-
- va_end (args);
-
- ibus_message_unref (reply);
-
- if (!retval) {
- return FALSE;
+ else {
+ retval = TRUE;
}
+
+ va_end (args);
+ ibus_message_unref (reply);
- return TRUE;
+ return retval;
}
void
diff --git a/src/ibusconnection.h b/src/ibusconnection.h
index 0d58f02..d5bdf59 100644
--- a/src/ibusconnection.h
+++ b/src/ibusconnection.h
@@ -104,6 +104,8 @@ IBusConnection *ibus_connection_open_private (const gchar *address
void ibus_connection_close (IBusConnection *connection);
gboolean ibus_connection_is_connected (IBusConnection *connection);
DBusConnection *ibus_connection_get_connection (IBusConnection *connection);
+gboolean ibus_connection_read_write_dispatch(IBusConnection *connection,
+ gint timeout);
gboolean ibus_connection_send (IBusConnection *connection,
IBusMessage *message);
gboolean ibus_connection_send_signal (IBusConnection *connection,
diff --git a/src/ibusengine.c b/src/ibusengine.c
index ddedcde..0c36dd4 100644
--- a/src/ibusengine.c
+++ b/src/ibusengine.c
@@ -505,7 +505,7 @@ ibus_engine_ibus_message (IBusEngine *engine,
return_message = ibus_message_new_method_return (message);
ibus_message_append_args (return_message,
G_TYPE_BOOLEAN, &retval,
- DBUS_TYPE_INVALID);
+ G_TYPE_INVALID);
ibus_connection_send (connection, return_message);
ibus_message_unref (return_message);
return TRUE;
diff --git a/src/ibushotkey.c b/src/ibushotkey.c
index 16aad70..eca7666 100644
--- a/src/ibushotkey.c
+++ b/src/ibushotkey.c
@@ -344,7 +344,7 @@ ibus_hotkey_profile_add_hotkey (IBusHotkeyProfile *profile,
g_return_val_if_reached (FALSE);
}
- g_tree_insert (priv->hotkeys, hotkey, (gpointer)event);
+ g_tree_insert (priv->hotkeys, (gpointer) hotkey, GUINT_TO_POINTER (event));
gint i;
IBusHotkeyEvent *p = NULL;
@@ -469,7 +469,7 @@ ibus_hotkey_profile_filter_key_event (IBusHotkeyProfile *profile,
modifiers : modifiers & priv->mask,
};
- GQuark event = (GQuark) g_tree_lookup (priv->hotkeys, &hotkey);
+ GQuark event = (GQuark) GPOINTER_TO_UINT (g_tree_lookup (priv->hotkeys, &hotkey));
if (event != 0) {
g_signal_emit (profile, profile_signals[TRIGGER], event, event, user_data);
diff --git a/src/ibusinputcontext.c b/src/ibusinputcontext.c
index 71de8fb..94de55a 100644
--- a/src/ibusinputcontext.c
+++ b/src/ibusinputcontext.c
@@ -573,7 +573,10 @@ ibus_input_context_process_key_event (IBusInputContext *context,
}
/* wait reply or timeout */
- ibus_pending_call_wait (pending);
+ IBusConnection *connection = ibus_proxy_get_connection ((IBusProxy *) context);
+ while (!ibus_pending_call_get_completed (pending)) {
+ ibus_connection_read_write_dispatch (connection, -1);
+ }
reply_message = ibus_pending_call_steal_reply (pending);
ibus_pending_call_unref (pending);
diff --git a/src/ibuslookuptable.c b/src/ibuslookuptable.c
index aab3ecd..e2935b8 100644
--- a/src/ibuslookuptable.c
+++ b/src/ibuslookuptable.c
@@ -73,7 +73,7 @@ ibus_lookup_table_class_init (IBusLookupTableClass *klass)
serializable_class->deserialize = (IBusSerializableDeserializeFunc) ibus_lookup_table_deserialize;
serializable_class->copy = (IBusSerializableCopyFunc) ibus_lookup_table_copy;
- g_string_append (serializable_class->signature, "uubav");
+ g_string_append (serializable_class->signature, "uubbav");
}
static void
@@ -121,6 +121,9 @@ ibus_lookup_table_serialize (IBusLookupTable *table,
retval = ibus_message_iter_append (iter, G_TYPE_BOOLEAN, &table->cursor_visible);
g_return_val_if_fail (retval, FALSE);
+
+ retval = ibus_message_iter_append (iter, G_TYPE_BOOLEAN, &table->round);
+ g_return_val_if_fail (retval, FALSE);
retval = ibus_message_iter_open_container (iter,
IBUS_TYPE_ARRAY,
@@ -165,6 +168,9 @@ ibus_lookup_table_deserialize (IBusLookupTable *table,
retval = ibus_message_iter_get (iter, G_TYPE_BOOLEAN, &table->cursor_visible);
g_return_val_if_fail (retval, FALSE);
+
+ retval = ibus_message_iter_get (iter, G_TYPE_BOOLEAN, &table->round);
+ g_return_val_if_fail (retval, FALSE);
retval = ibus_message_iter_recurse (iter, IBUS_TYPE_ARRAY, &array_iter);
g_return_val_if_fail (retval, FALSE);
@@ -213,15 +219,18 @@ ibus_lookup_table_copy (IBusLookupTable *dest,
IBusLookupTable *
ibus_lookup_table_new (guint page_size,
- gboolean cursor_visible)
+ guint cursor_pos,
+ gboolean cursor_visible,
+ gboolean round)
{
IBusLookupTable *table;
table= g_object_new (IBUS_TYPE_LOOKUP_TABLE, NULL);
- table->cursor_pos = 0;
table->page_size = page_size;
+ table->cursor_pos = cursor_pos;
table->cursor_visible = cursor_visible;
+ table->round = round;
return table;
}
diff --git a/src/ibuslookuptable.h b/src/ibuslookuptable.h
index 2b29138..62ca7d8 100644
--- a/src/ibuslookuptable.h
+++ b/src/ibuslookuptable.h
@@ -52,6 +52,7 @@ struct _IBusLookupTable {
guint page_size;
guint cursor_pos;
gboolean cursor_visible;
+ gboolean round;
GArray *candidates;
};
@@ -63,7 +64,9 @@ struct _IBusLookupTableClass {
GType ibus_lookup_table_get_type (void);
IBusLookupTable *ibus_lookup_table_new (guint page_size,
- gboolean cursor_visible);
+ guint cursor_pos,
+ gboolean cursor_visible,
+ gboolean round);
void ibus_lookup_table_append_candidate
(IBusLookupTable *table,
IBusText *text);
diff --git a/src/ibusmessage.c b/src/ibusmessage.c
index 08457a3..0541778 100644
--- a/src/ibusmessage.c
+++ b/src/ibusmessage.c
@@ -424,7 +424,7 @@ ibus_message_get_args_valist (IBusMessage *message,
if (!retval) {
if (error) {
*error = ibus_error_new_from_printf (DBUS_ERROR_INVALID_ARGS,
- "Message does not have arguments!");
+ "Message does not have arguments!");
}
return FALSE;
}
diff --git a/src/ibusobject.h b/src/ibusobject.h
index 36e8fc9..627936f 100644
--- a/src/ibusobject.h
+++ b/src/ibusobject.h
@@ -57,9 +57,10 @@ typedef enum {
IBUS_RESERVED_2 = (1 << 3),
} IBusObjectFlags;
-#define IBUS_OBJECT_FLAGS(obj) (IBUS_OBJECT (obj)->flags)
+#define IBUS_OBJECT_FLAGS(obj) (IBUS_OBJECT (obj)->flags)
#define IBUS_OBJECT_SET_FLAGS(obj,flag) G_STMT_START{ (IBUS_OBJECT_FLAGS (obj) |= (flag)); }G_STMT_END
#define IBUS_OBJECT_UNSET_FLAGS(obj,flag) G_STMT_START{ (IBUS_OBJECT_FLAGS (obj) &= ~(flag)); }G_STMT_END
+#define IBUS_OBJECT_DESTROYED(obj) (IBUS_OBJECT_FLAGS (obj) & IBUS_DESTROYED)
G_BEGIN_DECLS
diff --git a/src/test-lookuptable.c b/src/test-lookuptable.c
index ec56811..731f74b 100644
--- a/src/test-lookuptable.c
+++ b/src/test-lookuptable.c
@@ -8,7 +8,7 @@ int main()
IBusError *error;
gboolean retval;
- table = ibus_lookup_table_new (9, TRUE);
+ table = ibus_lookup_table_new (9, 0, TRUE, FALSE);
ibus_lookup_table_append_candidate (table, ibus_text_new_from_static_string ("Hello"));
ibus_lookup_table_append_candidate (table, ibus_text_new_from_static_string ("Cool"));