{ "focus-in", G_CALLBACK (_context_focus_in_cb) },
{ "focus-out", G_CALLBACK (_context_focus_out_cb) },
{ "destroy", G_CALLBACK (_context_destroy_cb) },
- { NULL, NULL }
};
- for (i = 0; signals[i].name != NULL; i++) {
+ for (i = 0; G_N_ELEMENTS (signals); i++) {
g_signal_connect (context,
signals[i].name,
signals[i].callback,
{ IBUS_INTERFACE_IBUS, "ListActiveEngines", _ibus_list_active_engines },
{ IBUS_INTERFACE_IBUS, "Exit", _ibus_exit },
{ IBUS_INTERFACE_IBUS, "Ping", _ibus_ping },
- { NULL, NULL, NULL }
};
ibus_message_set_sender (message, bus_connection_get_unique_name (connection));
ibus_message_set_destination (message, DBUS_SERVICE_DBUS);
if (ibus_message_get_type (message) == DBUS_MESSAGE_TYPE_METHOD_CALL) {
- for (i = 0; handlers[i].interface != NULL; i++) {
+ for (i = 0; G_N_ELEMENTS (handlers); i++) {
if (ibus_message_is_method_call (message,
handlers[i].interface,
handlers[i].name)) {
static IBusProxyClass *parent_class = NULL;
-struct _SignalCallbackTable {
- gchar *name;
- GCallback callback;
-} ;
-
-static const struct _SignalCallbackTable __signals[];
-
GType
bus_panel_proxy_get_type (void)
{
}
-void
-bus_panel_proxy_focus_in (BusPanelProxy *panel,
- BusInputContext *context)
-{
- g_assert (BUS_IS_PANEL_PROXY (panel));
- g_assert (BUS_IS_INPUT_CONTEXT (context));
-
- if (panel->focused_context == context)
- return;
-
- if (panel->focused_context != NULL)
- bus_panel_proxy_focus_out (panel, panel->focused_context);
-
- g_object_ref (context);
- panel->focused_context = context;
-
- const gchar *path = ibus_service_get_path ((IBusService *)context);
-
- ibus_proxy_call ((IBusProxy *) panel,
- "FocusIn",
- IBUS_TYPE_OBJECT_PATH, &path,
- G_TYPE_INVALID);
-
- /* install signal handlers */
- gint i;
- for (i = 0; __signals[i].name != NULL; i++) {
- g_signal_connect (context,
- __signals[i].name,
- __signals[i].callback,
- panel);
- }
-}
-
-void
-bus_panel_proxy_focus_out (BusPanelProxy *panel,
- BusInputContext *context)
-{
- g_assert (BUS_IS_PANEL_PROXY (panel));
- g_assert (BUS_IS_INPUT_CONTEXT (context));
-
- g_assert (panel->focused_context == context);
-
- /* uninstall signal handlers */
- gint i;
- for (i = 0; __signals[i].name != NULL; i++) {
- g_signal_handlers_disconnect_by_func (context,
- __signals[i].callback,
- panel);
- }
-
- const gchar *path = ibus_service_get_path ((IBusService *)context);
-
- ibus_proxy_call ((IBusProxy *) panel,
- "FocusOut",
- IBUS_TYPE_OBJECT_PATH, &path,
- G_TYPE_INVALID);
-
- g_object_unref (panel->focused_context);
- panel->focused_context = NULL;
-}
void
bus_panel_proxy_set_cursor_location (BusPanelProxy *panel,
#undef DEFINE_FUNCTION
-static const struct _SignalCallbackTable
-__signals[] = {
+static const struct _SignalCallbackTable {
+ gchar *name;
+ GCallback callback;
+} __signals[] = {
{ "set-cursor-location", G_CALLBACK (_context_set_cursor_location_cb) },
{ "update-preedit-text", G_CALLBACK (_context_update_preedit_text_cb) },
{ "factory-changed", G_CALLBACK (_context_state_changed_cb) },
// { "destroy", G_CALLBACK (_context_destroy_cb) },
- { NULL, NULL}
};
+void
+bus_panel_proxy_focus_in (BusPanelProxy *panel,
+ BusInputContext *context)
+{
+ g_assert (BUS_IS_PANEL_PROXY (panel));
+ g_assert (BUS_IS_INPUT_CONTEXT (context));
+
+ if (panel->focused_context == context)
+ return;
+
+ if (panel->focused_context != NULL)
+ bus_panel_proxy_focus_out (panel, panel->focused_context);
+
+ g_object_ref (context);
+ panel->focused_context = context;
+
+ const gchar *path = ibus_service_get_path ((IBusService *)context);
+
+ ibus_proxy_call ((IBusProxy *) panel,
+ "FocusIn",
+ IBUS_TYPE_OBJECT_PATH, &path,
+ G_TYPE_INVALID);
+
+ /* install signal handlers */
+ gint i;
+ for (i = 0; G_N_ELEMENTS (__signals); i++) {
+ g_signal_connect (context,
+ __signals[i].name,
+ __signals[i].callback,
+ panel);
+ }
+}
+
+void
+bus_panel_proxy_focus_out (BusPanelProxy *panel,
+ BusInputContext *context)
+{
+ g_assert (BUS_IS_PANEL_PROXY (panel));
+ g_assert (BUS_IS_INPUT_CONTEXT (context));
+
+ g_assert (panel->focused_context == context);
+
+ /* uninstall signal handlers */
+ gint i;
+ for (i = 0; G_N_ELEMENTS (__signals); i++) {
+ g_signal_handlers_disconnect_by_func (context,
+ __signals[i].callback,
+ panel);
+ }
+
+ const gchar *path = ibus_service_get_path ((IBusService *)context);
+
+ ibus_proxy_call ((IBusProxy *) panel,
+ "FocusOut",
+ IBUS_TYPE_OBJECT_PATH, &path,
+ G_TYPE_INVALID);
+
+ g_object_unref (panel->focused_context);
+ panel->focused_context = NULL;
+}
+