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 332756 - docs for GtkFontSelection does not mention that it must be mapped to work
docs for GtkFontSelection does not mention that it must be mapped to work
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: 2006-02-27 16:53 UTC by Jiri Dluhos
Modified: 2006-02-27 18:20 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Jiri Dluhos 2006-02-27 16:53:14 UTC
Documentation 
Section: GTK+ Reference Manual, GtkFontSelection
To set the font which is initially selected, use gtk_font_selection_set_font_name().

To get the selected font use gtk_font_selection_get_font() or
gtk_font_selection_get_font_name().

Correct version:
After the widget is assigned a screen (i.e. inserted into a top-level window):

To set the font which is initially selected, use gtk_font_selection_set_font_name().

To get the selected font use gtk_font_selection_get_font() or
gtk_font_selection_get_font_name().

Note that the font name returned by gtk_font_selection_get_font_name() is
normalized so it may not be exactly the same string as set by
gtk_font_selection_set_font_name(). Use pango_font_description_equal() for
testing if the names returned by this call are equal.


Other information:
Comment 1 Federico Mena Quintero 2006-02-27 17:28:59 UTC
This came up during LSB testing; they assumed that gtk_font_selection_set_font() would work (i.e. return TRUE) on an unattached GtkFontSelection, but it doesn't.  GtkFontSelection won't populate the family_list until it gets its screen set.

We should document this, and also put a g_return_val_if_fail (gtk_widget_has_screen (fs), FALSE) in gtk_font_selection_set_font().
Comment 2 Federico Mena Quintero 2006-02-27 17:43:45 UTC
I meant set_font_name(), of course.
Comment 3 Federico Mena Quintero 2006-02-27 18:20:09 UTC
Fixed in the HEAD branch.

2006-02-27  Federico Mena Quintero  <federico@novell.com>

	* gtk/gtkfontsel.c (gtk_font_selection_set_font_name): Check that
	the fontsel has a screen assigned before doing anything.  This
	will at least warn the caller of what is wrong, since we only
	populate the family_list until we get a screen.  Also, put the
	reference docs here.  Fixes bug #332756.
	(gtk_font_selection_dialog_get_font_name): Document this here.
	(gtk_font_selection_get_font_name): Document this here; mention
	that the font names get normalized, so the result of this function
	may not be the same as what you set with
	gtk_font_selection_set_font_name().