forked from AuroraMiddleware/gtk
texttag: add gtk_text_tag_changed()
The function is useful for a GtkTextTag subclass that adds new properties. https://bugzilla.gnome.org/show_bug.cgi?id=755416
This commit is contained in:
parent
cc2224cc62
commit
5a561a8ddb
@ -3809,6 +3809,7 @@ gtk_text_tag_new
|
||||
gtk_text_tag_get_priority
|
||||
gtk_text_tag_set_priority
|
||||
gtk_text_tag_event
|
||||
gtk_text_tag_changed
|
||||
GtkTextAttributes
|
||||
GtkTextAppearance
|
||||
gtk_text_attributes_new
|
||||
|
@ -1822,20 +1822,12 @@ gtk_text_tag_set_property (GObject *object,
|
||||
break;
|
||||
}
|
||||
|
||||
/* FIXME I would like to do this after all set_property in a single
|
||||
* g_object_set () have been called. But an idle function won't
|
||||
* work; we need to emit when the tag is changed, not when we get
|
||||
* around to the event loop. So blah, we eat some inefficiency.
|
||||
/* The signal is emitted for each set_property(). A possible optimization is
|
||||
* to send the signal only once when several properties are set at the same
|
||||
* time with e.g. g_object_set(). The signal could be emitted when the notify
|
||||
* signal is thawed.
|
||||
*/
|
||||
|
||||
/* This is also somewhat weird since we emit another object's
|
||||
* signal here, but the two objects are already tightly bound.
|
||||
*/
|
||||
|
||||
if (priv->table)
|
||||
g_signal_emit_by_name (priv->table,
|
||||
"tag_changed",
|
||||
text_tag, size_changed);
|
||||
gtk_text_tag_changed (text_tag, size_changed);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2294,6 +2286,40 @@ gtk_text_tag_event (GtkTextTag *tag,
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_text_tag_changed:
|
||||
* @tag: a #GtkTextTag.
|
||||
* @size_changed: whether the change affects the #GtkTextView layout.
|
||||
*
|
||||
* Emits the #GtkTextTagTable::tag-changed signal on the #GtkTextTagTable where
|
||||
* the tag is included.
|
||||
*
|
||||
* The signal is already emitted when setting a #GtkTextTag property. This
|
||||
* function is useful for a #GtkTextTag subclass.
|
||||
*
|
||||
* Since: 3.20
|
||||
*/
|
||||
void
|
||||
gtk_text_tag_changed (GtkTextTag *tag,
|
||||
gboolean size_changed)
|
||||
{
|
||||
GtkTextTagPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_TEXT_TAG (tag));
|
||||
|
||||
priv = tag->priv;
|
||||
|
||||
/* This is somewhat weird since we emit another object's signal here, but the
|
||||
* two objects are already tightly bound. If a GtkTextTag::changed signal is
|
||||
* added, this would increase significantly the number of signal connections.
|
||||
*/
|
||||
if (priv->table != NULL)
|
||||
g_signal_emit_by_name (priv->table,
|
||||
"tag-changed",
|
||||
tag,
|
||||
size_changed);
|
||||
}
|
||||
|
||||
static int
|
||||
tag_sort_func (gconstpointer first, gconstpointer second)
|
||||
{
|
||||
|
@ -112,7 +112,9 @@ gboolean gtk_text_tag_event (GtkTextTag *tag,
|
||||
GObject *event_object,
|
||||
GdkEvent *event,
|
||||
const GtkTextIter *iter);
|
||||
|
||||
GDK_AVAILABLE_IN_3_20
|
||||
void gtk_text_tag_changed (GtkTextTag *tag,
|
||||
gboolean size_changed);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -103,7 +103,7 @@ gtk_text_tag_table_class_init (GtkTextTagTableClass *klass)
|
||||
* GtkTextTagTable::tag-changed:
|
||||
* @texttagtable: the object which received the signal.
|
||||
* @tag: the changed tag.
|
||||
* @size_changed: whether the size has been changed.
|
||||
* @size_changed: whether the change affects the #GtkTextView layout.
|
||||
*/
|
||||
signals[TAG_CHANGED] =
|
||||
g_signal_new (I_("tag-changed"),
|
||||
|
Loading…
Reference in New Issue
Block a user