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 322113 - Default value of GtkTextTag's properties are *NOT* the same as documented
Default value of GtkTextTag's properties are *NOT* the same as documented
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Documentation
2.8.x
Other All
: Normal minor
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2005-11-22 10:13 UTC by Yong Wang
Modified: 2006-01-06 17:55 UTC
See Also:
GNOME target: ---
GNOME version: 2.7/2.8



Description Yong Wang 2005-11-22 10:13:34 UTC
Documentation bug
Section: GtkTextTag
The "direction" property
  "direction"            GtkTextDirection      : Read / Write
Text direction, e.g. right-to-left or left-to-right.

Default value: GTK_TEXT_DIR_LTR

------------------------------------------------------------------------
--------

The "editable" property
  "editable"             gboolean              : Read / Write
Whether the text can be modified by the user.

Default value: TRUE

------------------------------------------------------------------------
--------

The "font" property
  "font"                 gchararray            : Read / Write
Font description as a string, e.g. "Sans Italic 12".

Default value: NULL

------------------------------------------------------------------------
--------

The "language" property
  "language"             gchararray            : Read / Write
The language this text is in, as an ISO code. Pango can use this as a
hint when rendering the text. If not set, an appropriate default will be
used.

Default value: NULL


Correct version:
The "direction" property
  "direction"            GtkTextDirection      : Read / Write
Text direction, e.g. right-to-left or left-to-right.

Default value: GTK_TEXT_DIR_NONE

------------------------------------------------------------------------
--------

The "editable" property
  "editable"             gboolean              : Read / Write
Whether the text can be modified by the user.

Default value: FALSE

------------------------------------------------------------------------
--------

The "font" property
  "font"                 gchararray            : Read / Write
Font description as a string, e.g. "Sans Italic 12".

Default value: "Normal"

------------------------------------------------------------------------
--------

The "language" property
  "language"             gchararray            : Read / Write
The language this text is in, as an ISO code. Pango can use this as a
hint when rendering the text. If not set, an appropriate default will be
used.

Default value: "en-us"


Other information:
Below is the test case and its
output. 

#include <gtk/gtk.h>

int main (int argc, char* argv[])
{
        GtkTextTag *tag;
        GtkTextDirection direction;
        gboolean editable;
        gchararray font;
        gchararray language;

        gtk_init (&argc, &argv);

        tag = gtk_text_tag_new ("foo");

        g_object_get(G_OBJECT(tag), "direction", &direction, NULL);
        if (direction != GTK_TEXT_DIR_LTR)
                g_printf ("direction = %d, should be %d\n", direction,
GTK_TEXT_DIR_LTR);

        g_object_get(G_OBJECT(tag), "editable", &editable, NULL);
        if (editable != TRUE)
                g_printf ("editable = %d, should be %d\n", editable,
TRUE);

        g_object_get(G_OBJECT(tag), "font", &font, NULL);
        if (font != NULL)
                g_printf ("font = %s, should be NULL\n", font);

        g_object_get(G_OBJECT(tag), "language", &language, NULL);
        if (language != NULL)
                g_printf ("language = %s, should be NULL\n", language);

        return 0;
}

********** Output ********** 

direction = 0, should be 1
editable = 0, should be 1
font = Normal, should be NULL
language = en-us, should be NULL
Comment 1 Yong Wang 2005-11-22 10:15:59 UTC
BTW, this bug occurs on both GTK+ 2.6 and 2.8.
Comment 2 Matthias Clasen 2006-01-06 17:55:21 UTC
2006-01-06  Matthias Clasen  <mclasen@redhat.com> 

	* gtk/gtktexttag.c (gtk_text_attributes_new): Initialize editable 
	to TRUE. 
	(gtk_text_tag_class_init): The default value for the direction 
	property is GTK_TEXT_DIR_NONE. Add notes about the initial values 
	of the font and language properties.