Name it gtk_font_chooser_widget_load_fonts(). Also, don't take any
arguments, they were the same everywhere and they're member variables of
the font chooser anyway.
Instead of reloading the font list, we now just queue a redraw. This
works, because the preview text is added using a cell data func instead
of a custom column.
... which looks up the font in the list of fonts. This then can be used
to select an actual font upon changes.
Also fixes cases where the get_family() and get_face() functions would
return outdated data when set_font() had been called.
They now go through gtk_font_chooser_widget_take_font_desc(). The end
goal is to make all changes go through this function, so that all
updates that are happening are easy to track.
Another change is that the code now merges the font description instead
of just using the new one. This avoids weird situations when people set
the font "Bold" for example, which has neither a size nor a font family.
... instead of rereading all the fonts every time.
With this change, the liststore now contains every font face known to
GTK, so we can actually walk it for matching fonts.
- Don't do unnecessary casts
- Fix weird variable declaration indenting
- Fix loop indentation
- Use a for loop for iterating over a list, instead of a while loop
- Casefold font name only once, instead of every iteration
- Remove needless true_var = true_var && TRUE assignment
The setter for the "font" property returned a boolean that indicated
whether the given font has been found. Instead, fall back to the default
font name when the given font doesn't exist.
GtkFontButton already has a property named "font-name" which may
conflict / be an ABI break when moving GtkFontButton to implement
GtkFontChooser. Also, this is more in line with how other parts in
gtk (e.g. GtkCellRendererText) call a font string property.
Make the GtkFontChooser API similar to the Gtk{File,Recent,App}Chooser
APIs by introducing GtkFontChooser as an interface, that has a default
implementation in GtkFontChooserWidget.
https://bugzilla.gnome.org/show_bug.cgi?id=657627