After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 589413 - Support addition of text tags in textbuffers
Support addition of text tags in textbuffers
Status: RESOLVED FIXED
Product: glade
Classification: Applications
Component: user interface
3.6.x
Other All
: Normal enhancement
: ---
Assigned To: Glade 3 Maintainers
Glade 3 Maintainers
Depends on: 590326 590327
Blocks:
 
 
Reported: 2009-07-22 17:51 UTC by Rafael Villar Burke
Modified: 2013-05-20 12:29 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Rafael Villar Burke 2009-07-22 17:51:22 UTC
Being able to have text tags added to the text tag table associated with a textbuffer would allow to define a whole MVC component for text.

Even if, as tristan pointed, there's currently problems to support adding preset text with tag support in glade due to gtk+ lack of support, it would be useful anyhow a way to define tags for a buffer as the TextBuffer.insert_with_tags(iter, text, tag1, tag2, ...) or, specially, the TextBuffer.insert_with_tags_by_name(iter, text, tagname1, tagname2, ...) method would allow using them from code.

Not having preset text with support for rich format is a minor problem compared to having to support the more complex and usual case of programmatically added text, and this support could be improved in the future.
Comment 1 Rafael Villar Burke 2009-07-23 15:07:45 UTC
I've been investigating full GtkTextView/GtkTextBuffer MVC support in glade a bit more and it looks like there's some support in GTK+ to serialize and deserialize the contents of a textbuffer object including its tags using an internal format.

The following GtkTextBuffer methods register the internal format handlers:

gtk_text_buffer_register_serialize_tagset ()
gtk_text_buffer_register_deserialize_tagset ()

and the following ones allow serialization and deserialization of contents:

gtk_text_buffer_serialize ()
gtk_text_buffer_deserialize ()

These could be used to have working tags in prefilled text.

What looks like missing in GTK+ is an implementation of the GtkBuildable interface for  GtkTextTagTable and that, from my limited understanding, would be needed to support appending child GtkTextTag elements to a GtkTextTagTable associated with a given GtkTextBuffer so tags can be used with it.
Comment 2 Rafael Villar Burke 2009-09-19 10:41:17 UTC
A new dependency on bug 590327 has been added as GtkTextBuffer needs to implement the GtkBuildable interface to register and unregister the internal format (or any other) and serialize/deserialize the buffer text.
Comment 3 Tristan Van Berkom 2011-01-09 05:13:05 UTC
As at least a starting point, I've added support in Glade master for
adding GtkTextTags to a GtkTextTagTable.

Currently it wont work until I can commit 
 75841f767431f5e258de08998da63257bb954104 to GTK+ master.
Comment 4 Tristan Van Berkom 2013-05-20 12:29:40 UTC
This was implemented years ago, you can add text tags to text tag tables.

Just created this with Glade:

<?xml version="1.0" encoding="UTF-8"?>
<interface>
  <!-- interface-requires gtk+ 3.10 -->
  <object class="GtkTextTagTable" id="texttagtable1">
    <child type="tag">
      <object class="GtkTextTag" id="texttag1">
        <property name="font">Normal</property>
      </object>
    </child>
  </object>
</interface>