RBSource *
rb_generic_player_playlist_source_new (RBShell *shell,
				       RBGenericPlayerSource *player_source,
				       const char *playlist_file,
				       const char *device_root,
				       RhythmDBEntryType entry_type)
{
	RBSource *source;
	source = RB_SOURCE (g_object_new (RB_TYPE_GENERIC_PLAYER_PLAYLIST_SOURCE,
					  "shell", shell,
					  "is-local", FALSE,
					  "entry-type", entry_type,
					  "source-group", RB_SOURCE_GROUP_DEVICES,
					  "player-source", player_source,
					  "playlist-path", playlist_file,
					  "device-root", device_root,
					  NULL));

	if (load_playlist (RB_GENERIC_PLAYER_PLAYLIST_SOURCE (source)) == FALSE) {
		rb_debug ("playlist didn't parse; killing the source");
		if (g_object_is_floating (source))
			g_object_ref_sink (source);
		g_object_unref (source);
		return NULL;
	}

	return source;
}
static void
sink_champlain_map_data_source (GObject *object)
{
    if (g_object_is_floating (object)) {
        g_object_ref_sink (object);
    }
}
void
ibus_sunpinyin_engine_init(IBusEngine *py_engine)
{
    if (g_object_is_floating (py_engine))
        g_object_ref_sink (py_engine);
    GET_PY_ENGINE(py_engine) = new SunPinyinEngine(IBUS_ENGINE(py_engine));
}
Exemple #4
0
/**
 * go_combo_popup_reparent
 * @popup:       Popup
 * @new_parent:  New parent
 * @unrealize:   Unrealize popup if TRUE.
 *
 * Reparent the popup, taking care of the refcounting
 *
 * Compare with gtk_menu_reparent in gtk/gtkmenu.c
 */
static void
go_combo_popup_reparent (GtkWidget *popup,
			 GtkWidget *new_parent,
			 gboolean unrealize)
{
#if GLIB_CHECK_VERSION(2,10,0) && GTK_CHECK_VERSION(2,8,14)
	gboolean was_floating = g_object_is_floating (popup);
	g_object_ref_sink (popup);
#else
	gboolean was_floating = GTK_OBJECT_FLOATING (popup);
	g_object_ref (popup);
	gtk_object_sink (GTK_OBJECT (popup));
#endif

	if (unrealize) {
		g_object_ref (popup);
		gtk_container_remove (GTK_CONTAINER (popup->parent), popup);
		gtk_container_add (GTK_CONTAINER (new_parent), popup);
		g_object_unref (popup);
	}
	else
		gtk_widget_reparent (GTK_WIDGET (popup), new_parent);
	gtk_widget_set_size_request (new_parent, -1, -1);

	if (was_floating) {
#if GLIB_CHECK_VERSION(2,10,0) && GTK_CHECK_VERSION(2,8,14)
		g_object_force_floating (G_OBJECT (popup));
#else
		GTK_OBJECT_SET_FLAGS (GTK_OBJECT (popup), GTK_FLOATING);
#endif
	} else
		g_object_unref (popup);
}
Exemple #5
0
static void
test_finalize_object (gconstpointer data)
{
  GType test_type = GPOINTER_TO_SIZE (data);
  GObject *object;

  object = g_object_new (test_type, NULL);
  g_assert (G_IS_OBJECT (object));

  /* Make sure we have the only reference */
  if (g_object_is_floating (object))
    g_object_ref_sink (object);

  /* Assert that the object finalizes properly */
  g_object_weak_ref (object, check_finalized, &finalized);

  /* Toplevels are owned by GTK+, just tell GTK+ to destroy it */
  if (GTK_IS_WINDOW (object) || GTK_IS_INVISIBLE (object))
    gtk_widget_destroy (GTK_WIDGET (object));
  else
    g_object_unref (object);

  /* Even if the object did finalize, it may have left some dangerous stuff in the GMainContext */
  g_timeout_add (50, main_loop_quit_cb, NULL);
  gtk_main();
}
Exemple #6
0
/**
 * fo_object_sprintf:
 * @object: The #FoObject object.
 * 
 * Calls sprintf method of class of @object, if @object is an
 * #FoObject or descendant type of #FoObject.
 *
 * Return value: Result of sprintf method of class of @object.
 **/
gchar*
fo_object_sprintf (gpointer object)
{
  if (object == NULL)
    {
      return g_strdup ("(null)");
    }
  else if (!G_IS_OBJECT (object))
    {
      return g_strdup_printf ("Not a GObject: %p",
			      object);
    }
  else if (!FO_IS_OBJECT (object))
    {
      return g_strdup_printf ("GObject but not an FoObject:: %s (%p : %d%s)",
			      g_type_name (G_TYPE_FROM_INSTANCE (object)),
			      object,
			      ((GObject *) object)->ref_count,
			      g_object_is_floating (object) ? " (floating)" : "");
    }
  else
    {
      return FO_OBJECT_GET_CLASS (object)->print_sprintf (object);
    }
}
Exemple #7
0
gboolean
gimp_pdb_item_is_floating (GimpItem  *item,
                           GimpImage *dest_image,
                           GError   **error)
{
  g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
  g_return_val_if_fail (GIMP_IS_IMAGE (dest_image), FALSE);
  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);

  if (! g_object_is_floating (item))
    {
      g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
                   _("Item '%s' (%d) has already been added to an image"),
                   gimp_object_get_name (item),
                   gimp_item_get_ID (item));
      return FALSE;
    }
  else if (gimp_item_get_image (item) != dest_image)
    {
      g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
                   _("Trying to add item '%s' (%d) to wrong image"),
                   gimp_object_get_name (item),
                   gimp_item_get_ID (item));
      return FALSE;
    }

  return TRUE;
}
Exemple #8
0
static void
ibus_lanxang_engine_init (IBusLanXangEngine *lanxang_engine)
{
  if (g_object_is_floating (lanxang_engine))
    {
      g_object_ref_sink (lanxang_engine);
    }
}
Exemple #9
0
bool gstObjectIsFloating(GstObject* gstObject)
{
#ifdef GST_API_VERSION_1
    return g_object_is_floating(G_OBJECT(gstObject));
#else
    return GST_OBJECT_IS_FLOATING(gstObject);
#endif
}
static GstStateChangeReturn
gst_gl_mixer_bin_change_state (GstElement * element, GstStateChange transition)
{
  GstGLMixerBin *self = GST_GL_MIXER_BIN (element);
  GstGLMixerBinClass *klass = GST_GL_MIXER_BIN_GET_CLASS (self);
  GstStateChangeReturn ret;

  switch (transition) {
    case GST_STATE_CHANGE_NULL_TO_READY:
      GST_OBJECT_LOCK (element);
      if (!self->mixer) {
        if (klass->create_element)
          self->mixer = klass->create_element ();

        if (!self->mixer) {
          g_signal_emit (element,
              gst_gl_mixer_bin_signals[SIGNAL_CREATE_ELEMENT], 0, &self->mixer);
          if (self->mixer && g_object_is_floating (self->mixer))
            gst_object_ref_sink (self->mixer);
        }

        if (!self->mixer) {
          GST_ERROR_OBJECT (element, "Failed to retrieve element");
          GST_OBJECT_UNLOCK (element);
          return GST_STATE_CHANGE_FAILURE;
        }
        GST_OBJECT_UNLOCK (element);
        if (!_connect_mixer_element (self))
          return GST_STATE_CHANGE_FAILURE;

        GST_OBJECT_LOCK (element);
      }
      self->priv->running = TRUE;
      GST_OBJECT_UNLOCK (element);
      break;
    default:
      break;
  }

  ret =
      GST_ELEMENT_CLASS (gst_gl_mixer_bin_parent_class)->change_state (element,
      transition);
  if (ret == GST_STATE_CHANGE_FAILURE)
    return ret;

  switch (transition) {
    case GST_STATE_CHANGE_READY_TO_NULL:
      GST_OBJECT_LOCK (self);
      self->priv->running = FALSE;
      GST_OBJECT_UNLOCK (self);
    default:
      break;
  }

  return ret;
}
void test_float_sink()
{
	 GTest *test;
	 GObject* obj;
	 test = g_object_new (G_TYPE_TEST, NULL);
	 obj = G_OBJECT(test);
	 g_object_force_floating(obj);
	 g_assert(g_object_is_floating(obj));
	 g_object_ref_sink(obj);
	 g_object_unref(obj);
}
Exemple #12
0
void
gnc_html_destroy( GncHtml* self )
{
    g_return_if_fail( self != NULL );
    g_return_if_fail( GNC_IS_HTML(self) );

    if ( g_object_is_floating( G_OBJECT(self) ) )
    {
        (void)g_object_ref_sink( G_OBJECT(self) );
    }

    g_object_unref( G_OBJECT(self) );
}
Exemple #13
0
void
ibus_engine_update_property (IBusEngine   *engine,
                             IBusProperty *prop)
{
    _send_signal (engine,
                  "UpdateProperty",
                  IBUS_TYPE_PROPERTY, &prop,
                  G_TYPE_INVALID);

    if (g_object_is_floating (prop)) {
        g_object_unref (prop);
    }
}
Exemple #14
0
void
ibus_engine_commit_text (IBusEngine *engine,
                         IBusText   *text)
{
    _send_signal (engine,
                  "CommitText",
                  IBUS_TYPE_TEXT, &text,
                  G_TYPE_INVALID);

    if (g_object_is_floating (text)) {
        g_object_unref (text);
    }
}
Exemple #15
0
void
ibus_engine_register_properties (IBusEngine   *engine,
                                 IBusPropList *prop_list)
{
    _send_signal (engine,
                  "RegisterProperties",
                  IBUS_TYPE_PROP_LIST, &prop_list,
                  G_TYPE_INVALID);

    if (g_object_is_floating (prop_list)) {
        g_object_unref (prop_list);
    }
}
Exemple #16
0
void ibus_engine_update_auxiliary_text (IBusEngine      *engine,
                                        IBusText        *text,
                                        gboolean         visible)
{
    _send_signal (engine,
                  "UpdateAuxiliaryText",
                  IBUS_TYPE_TEXT, &text,
                  G_TYPE_BOOLEAN, &visible,
                  G_TYPE_INVALID);

    if (g_object_is_floating (text)) {
        g_object_unref (text);
    }
}
Exemple #17
0
void
ibus_engine_update_lookup_table (IBusEngine        *engine,
                                 IBusLookupTable   *table,
                                 gboolean           visible)
{
    _send_signal (engine,
                  "UpdateLookupTable",
                  IBUS_TYPE_LOOKUP_TABLE, &table,
                  G_TYPE_BOOLEAN, &visible,
                  G_TYPE_INVALID);

    if (g_object_is_floating (table)) {
        g_object_unref (table);
    }
}
Exemple #18
0
/**
 * bus_new_connection_cb:
 * @user_data: always NULL.
 * @returns: TRUE when the function can handle the connection.
 *
 * Handle incoming connections.
 */
static gboolean
bus_new_connection_cb (GDBusServer     *server,
                       GDBusConnection *dbus_connection,
                       gpointer         user_data)
{
    BusConnection *connection = bus_connection_new (dbus_connection);
    bus_dbus_impl_new_connection (dbus, connection);

    if (g_object_is_floating (connection)) {
        /* bus_dbus_impl_new_connection couldn't handle the connection. just delete the connection and return TRUE
         * (so that other connection handler will not handle the deleted connection.) */
        ibus_object_destroy ((IBusObject *)connection);
        g_object_unref (connection);
    }
    return TRUE;
}
static GstStateChangeReturn
gst_gl_src_bin_change_state (GstElement * element, GstStateChange transition)
{
  GstGLSrcBin *self = GST_GL_SRC_BIN (element);
  GstGLSrcBinClass *klass = GST_GL_SRC_BIN_GET_CLASS (self);
  GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;

  GST_DEBUG ("changing state: %s => %s",
      gst_element_state_get_name (GST_STATE_TRANSITION_CURRENT (transition)),
      gst_element_state_get_name (GST_STATE_TRANSITION_NEXT (transition)));

  switch (transition) {
    case GST_STATE_CHANGE_NULL_TO_READY:
      if (!self->src) {
        if (klass->create_element)
          self->src = klass->create_element ();

        if (!self->src) {
          g_signal_emit (element,
              gst_gl_src_bin_signals[SIGNAL_CREATE_ELEMENT], 0, &self->src);
          if (self->src && g_object_is_floating (self->src))
            gst_object_ref_sink (self->src);
        }

        if (!self->src) {
          GST_ERROR_OBJECT (element, "Failed to retrieve element");
          return GST_STATE_CHANGE_FAILURE;
        }
        if (!_connect_src_element (self))
          return GST_STATE_CHANGE_FAILURE;
      }
      break;
    default:
      break;
  }

  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
  if (ret == GST_STATE_CHANGE_FAILURE)
    return ret;

  switch (transition) {
    default:
      break;
  }

  return ret;
}
static GObject *
impl_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_properties)
{
	RBGenericPlayerPlaylistSource *source;

	source = RB_GENERIC_PLAYER_PLAYLIST_SOURCE (G_OBJECT_CLASS (rb_generic_player_playlist_source_parent_class) -> constructor (type, n_construct_properties, construct_properties));

	if (load_playlist (source) == FALSE) {
		rb_debug ("playlist didn't parse; killing the source");
		if (g_object_is_floating (source))
			g_object_ref_sink (source);
		g_object_unref (source);
		return NULL;
	}

	return G_OBJECT (source);
}
Exemple #21
0
/**
 * _debug_sprintf_default:
 * @object: The #FoObject object.
 * 
 * Default debug_sprintf method.
 *
 * Return value: Type name, address, and reference count of @object.
 **/
static gchar*
_debug_sprintf_default (FoObject *object)
{
  g_return_val_if_fail (object != NULL, NULL);
  g_return_val_if_fail (FO_IS_OBJECT (object), NULL);

  if (object == NULL)
    {
      return g_strdup ("(null)");
    }
  else
    {
      return g_strdup_printf ("%s (%p : %d%s)",
			      g_type_name (G_TYPE_FROM_INSTANCE (object)),
			      object,
			      ((GObject *) object)->ref_count,
			      g_object_is_floating (object) ? " (floating)" : "");
    }
}
Exemple #22
0
void
ibus_engine_update_preedit_text_with_mode (IBusEngine            *engine,
                                           IBusText              *text,
                                           guint                  cursor_pos,
                                           gboolean               visible,
                                           IBusPreeditFocusMode   mode)
{
    _send_signal (engine,
                  "UpdatePreeditText",
                  IBUS_TYPE_TEXT, &text,
                  G_TYPE_UINT, &cursor_pos,
                  G_TYPE_BOOLEAN, &visible,
                  G_TYPE_UINT, &mode,
                  G_TYPE_INVALID);

    if (g_object_is_floating (text)) {
        g_object_unref (text);
    }
}
Exemple #23
0
static void
_new_connection_cb (DBusServer      *dbus_server,
                    DBusConnection  *new_connection,
                    IBusServer      *server)
{
    IBusServerPrivate *priv;
    IBusConnection *connection;

    priv = IBUS_SERVER_GET_PRIVATE (server);
    connection = IBUS_CONNECTION (g_object_new (priv->connection_type, NULL));
    ibus_connection_set_connection (connection, new_connection, FALSE);

    g_signal_emit (server, server_signals[NEW_CONNECTION], 0, connection);

    if (g_object_is_floating (connection)) {
        /* release connection if it is still floating */
        g_object_unref (connection);
    }
}
Exemple #24
0
CajaView *
caja_view_factory_create (const char *id,
                          CajaWindowSlotInfo *slot)
{
    const CajaViewInfo *view_info;
    CajaView *view;

    view_info = caja_view_factory_lookup (id);
    if (view_info == NULL)
    {
        return NULL;
    }

    view = view_info->create (slot);
    if (g_object_is_floating (view))
    {
        g_object_ref_sink (view);
    }
    return view;
}
Exemple #25
0
static GstElement *
setup_pipeline (const gchar * pipe_descr)
{
  GstElement *pipeline;
  GError *error = NULL;

  pipeline = gst_parse_launch (pipe_descr, &error);

  GST_DEBUG ("created %s", pipe_descr);

  if (error != NULL) {
    fail_if (error != NULL, "Error parsing pipeline %s: %s", pipe_descr,
        error->message);
    g_error_free (error);
  }
  fail_unless (pipeline != NULL, "Failed to create pipeline %s", pipe_descr);
  /* Newly returned object should be floating reffed */
  fail_unless (g_object_is_floating (pipeline));
  return pipeline;
}
/**
 * go_combo_popup_reparent
 * @popup:       Popup
 * @new_parent:  New parent
 * @unrealize:   Unrealize popup if TRUE.
 *
 * Reparent the popup, taking care of the refcounting
 *
 * Compare with gtk_menu_reparent in gtk/gtkmenu.c
 */
static void
go_combo_popup_reparent (GtkWidget *popup,
			 GtkWidget *new_parent,
			 gboolean unrealize)
{
	gboolean was_floating = g_object_is_floating (popup);
	g_object_ref_sink (popup);

	if (unrealize) {
		g_object_ref (popup);
		gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (popup)), popup);
		gtk_container_add (GTK_CONTAINER (new_parent), popup);
		g_object_unref (popup);
	}
	else
		gtk_widget_reparent (GTK_WIDGET (popup), new_parent);
	gtk_widget_set_size_request (new_parent, -1, -1);

	if (was_floating) {
		g_object_force_floating (G_OBJECT (popup));
	} else
		g_object_unref (popup);
}
static void
test_get_buffer (void)
{
	GtkWidget* view;
	GtkSourceBuffer* buffer;

	view = gtk_source_view_new ();

	buffer = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));

	g_assert (buffer != NULL);
	g_assert (GTK_SOURCE_IS_BUFFER (buffer));

	if (g_object_is_floating (view))
	{
		g_object_ref_sink (view);
	}

	/* Here we check if notify_buffer recreates the buffer while view is being
	 * destroyed, which causes assertion failure in GtkTextView's finalize ()
	 * function.
	 * Please see: https://bugzilla.gnome.org/show_bug.cgi?id=634510 */
	g_object_unref (view);
}
/*
 * @src: (transfer full):
 */
static gboolean
gst_gl_src_bin_set_src (GstGLSrcBin * self, GstElement * src)
{
  g_return_val_if_fail (GST_IS_ELEMENT (src), FALSE);

  if (self->src) {
    gst_element_set_locked_state (self->src, TRUE);
    gst_bin_remove (GST_BIN (self), self->src);
    gst_element_set_state (self->src, GST_STATE_NULL);
    gst_object_unref (self->src);
    self->src = NULL;
  }
  self->src = src;

  if (src && g_object_is_floating (src))
    gst_object_ref_sink (src);

  if (src && !_connect_src_element (self)) {
    self->src = NULL;
    return FALSE;
  }

  return TRUE;
}
Exemple #29
0
void
ibus_engine_update_lookup_table_fast (IBusEngine        *engine,
                                      IBusLookupTable   *table,
                                      gboolean           visible)
{
    IBusLookupTable *new_table;
    IBusText *text;
    gint page_begin;
    gint i;

    if (table->candidates->len < table->page_size << 2) {
        ibus_engine_update_lookup_table (engine, table, visible);
        return;
    }

    page_begin = (table->cursor_pos / table->page_size) * table->page_size;

    new_table = ibus_lookup_table_new (table->page_size, 0, table->cursor_visible, table->round);

    for (i = page_begin; i < page_begin + table->page_size && i < table->candidates->len; i++) {
        ibus_lookup_table_append_candidate (new_table, ibus_lookup_table_get_candidate (table, i));
    }

    for (i = 0; (text = ibus_lookup_table_get_label (table, i)) != NULL; i++) {
        ibus_lookup_table_append_label (new_table, text);
    }

    ibus_lookup_table_set_cursor_pos (new_table, ibus_lookup_table_get_cursor_in_page (table));
    ibus_lookup_table_set_orientation (new_table, ibus_lookup_table_get_orientation (table));

    ibus_engine_update_lookup_table (engine, new_table, visible);

    if (g_object_is_floating (table)) {
        g_object_unref (table);
    }
}
Exemple #30
0
static gboolean
bus_engine_proxy_ibus_signal (IBusProxy     *proxy,
                              IBusMessage   *message)
{
    g_assert (BUS_IS_ENGINE_PROXY (proxy));
    g_assert (message != NULL);
    g_assert (ibus_message_get_type (message) == DBUS_MESSAGE_TYPE_SIGNAL);

    const gchar *interface;
    const gchar *name;
    BusEngineProxy *engine;
    IBusError *error;
    gint i;

    static const struct {
        const gchar *member;
        const guint signal_id;
    } signals [] = {
        { "ShowPreeditText",        SHOW_PREEDIT_TEXT },
        { "HidePreeditText",        HIDE_PREEDIT_TEXT },
        { "ShowAuxiliaryText",      SHOW_AUXILIARY_TEXT },
        { "HideAuxiliaryText",      HIDE_AUXILIARY_TEXT },
        { "ShowLookupTable",        SHOW_LOOKUP_TABLE },
        { "HideLookupTable",        HIDE_LOOKUP_TABLE },
        { "PageUpLookupTable",      PAGE_UP_LOOKUP_TABLE },
        { "PageDownLookupTable",    PAGE_DOWN_LOOKUP_TABLE },
        { "CursorUpLookupTable",    CURSOR_UP_LOOKUP_TABLE },
        { "CursorDownLookupTable",  CURSOR_DOWN_LOOKUP_TABLE },
    };

    engine = BUS_ENGINE_PROXY (proxy);
    interface = ibus_message_get_interface (message);
    name = ibus_message_get_member (message);

    if (interface != NULL && g_strcmp0 (interface, IBUS_INTERFACE_ENGINE) != 0)
        return FALSE;

    for (i = 0; i < G_N_ELEMENTS (signals); i++) {
        if (g_strcmp0 (name, signals[i].member) == 0) {
            g_signal_emit (engine, engine_signals[signals[i].signal_id], 0);
            goto handled;
        }
    }

    if (g_strcmp0 (name, "CommitText") == 0) {
        IBusText *text;
        gboolean retval;

        retval = ibus_message_get_args (message,
                                        &error,
                                        IBUS_TYPE_TEXT, &text,
                                        G_TYPE_INVALID);
        if (!retval)
            goto failed;
        g_signal_emit (engine, engine_signals[COMMIT_TEXT], 0, text);
        g_object_unref (text);
    }
    else if (g_strcmp0 (name, "ForwardKeyEvent") == 0) {
        guint32 keyval;
        guint32 keycode;
        guint32 states;
        gboolean retval;

        retval = ibus_message_get_args (message,
                                        &error,
                                        G_TYPE_UINT, &keyval,
                                        G_TYPE_UINT, &keycode,
                                        G_TYPE_UINT, &states,
                                        G_TYPE_INVALID);

        if (!retval)
            goto failed;
        g_signal_emit (engine,
                       engine_signals[FORWARD_KEY_EVENT],
                       0,
                       keyval,
                       keycode,
                       states);
    }
    else if (g_strcmp0 (name, "DeleteSurroundingText") == 0) {
        gint  offset_from_cursor;
        guint nchars;
        gboolean retval;

        retval = ibus_message_get_args (message,
                                        &error,
                                        G_TYPE_INT,  &offset_from_cursor,
                                        G_TYPE_UINT, &nchars,
                                        G_TYPE_INVALID);

        if (!retval)
            goto failed;
        g_signal_emit (engine, engine_signals[DELETE_SURROUNDING_TEXT], 0, offset_from_cursor, nchars);
    }
    else if (g_strcmp0 (name, "UpdatePreeditText") == 0) {
        IBusText *text;
        gint cursor_pos;
        gboolean visible;
        gboolean retval;
        guint mode;

        retval = ibus_message_get_args (message,
                                        &error,
                                        IBUS_TYPE_TEXT, &text,
                                        G_TYPE_UINT, &cursor_pos,
                                        G_TYPE_BOOLEAN, &visible,
                                        G_TYPE_UINT, &mode,
                                        G_TYPE_INVALID);

        if (!retval)
            goto failed;

        g_signal_emit (engine, engine_signals[UPDATE_PREEDIT_TEXT], 0,
                        text, cursor_pos, visible, mode);
        if (g_object_is_floating (text))
            g_object_unref (text);
    }
    else if (g_strcmp0 (name, "UpdateAuxiliaryText") == 0) {
        IBusText *text;
        gboolean visible;
        gboolean retval;

        retval = ibus_message_get_args (message,
                                        &error,
                                        IBUS_TYPE_TEXT, &text,
                                        G_TYPE_BOOLEAN, &visible,
                                        G_TYPE_INVALID);

        if (!retval)
            goto failed;

        g_signal_emit (engine, engine_signals[UPDATE_AUXILIARY_TEXT], 0, text, visible);
        if (g_object_is_floating (text))
            g_object_unref (text);
    }
    else if (g_strcmp0 (name, "UpdateLookupTable") == 0) {
        IBusLookupTable *table;
        gboolean visible;
        gboolean retval;

        retval = ibus_message_get_args (message,
                                        &error,
                                        IBUS_TYPE_LOOKUP_TABLE, &table,
                                        G_TYPE_BOOLEAN, &visible,
                                        G_TYPE_INVALID);

        if (!retval)
            goto failed;

        g_signal_emit (engine, engine_signals[UPDATE_LOOKUP_TABLE], 0, table, visible);
        if (g_object_is_floating (table))
            g_object_unref (table);
    }
    else if (g_strcmp0 (name, "RegisterProperties") == 0) {
        gboolean retval;
        IBusPropList *prop_list;

        retval = ibus_message_get_args (message,
                                        &error,
                                        IBUS_TYPE_PROP_LIST, &prop_list,
                                        G_TYPE_INVALID);
        if (!retval) {
            goto failed;
        }
        g_signal_emit (engine, engine_signals[REGISTER_PROPERTIES], 0, prop_list);

        if (g_object_is_floating (prop_list))
            g_object_unref (prop_list);

    }
    else if (g_strcmp0 (name, "UpdateProperty") == 0) {
        IBusProperty *prop;
        gboolean retval;

        retval = ibus_message_get_args (message,
                                        &error,
                                        IBUS_TYPE_PROPERTY, &prop,
                                        G_TYPE_INVALID);

        if (!retval)
            goto failed;

        g_signal_emit (engine, engine_signals[UPDATE_PROPERTY], 0, prop);
        if (g_object_is_floating (prop))
            g_object_unref (prop);
    }
    else
        return FALSE;

handled:
    g_signal_stop_emission_by_name (engine, "ibus-signal");
    return TRUE;

failed:
    g_warning ("%s: %s", error->name, error->message);
    ibus_error_free (error);
    return FALSE;
}