]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkfontbutton.c
Deprecate widget flag: GTK_WIDGET_VISIBLE
[~andy/gtk] / gtk / gtkfontbutton.c
index 2f1814434f05aeb828458adcd4aa4aff1085ad23..694c61874a545fe3346987f75398640f37a7f98c 100644 (file)
  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  */
 
-#include <config.h>
+#include "config.h"
 
 #include "gtkfontbutton.h"
 
-#include "gtksignal.h"
 #include "gtkmain.h"
 #include "gtkalignment.h"
 #include "gtkhbox.h"
@@ -231,9 +230,13 @@ gtk_font_button_class_init (GtkFontButtonClass *klass)
    * GtkFontButton::font-set:
    * @widget: the object which received the signal.
    * 
-   * The ::font-set signal is emitted when the user selects a font. When 
-   * handling this signal, use gtk_font_button_get_font_name() to find out
-   * which font was just selected.
+   * The ::font-set signal is emitted when the user selects a font. 
+   * When handling this signal, use gtk_font_button_get_font_name() 
+   * to find out which font was just selected.
+   *
+   * Note that this signal is only emitted when the <emphasis>user</emphasis>
+   * changes the font. If you need to react to programmatic font changes
+   * as well, use the notify::font-name signal.
    *
    * Since: 2.4
    */
@@ -384,7 +387,7 @@ gtk_font_button_new (void)
 GtkWidget *
 gtk_font_button_new_with_font (const gchar *fontname)
 {
-  return g_object_new (GTK_TYPE_FONT_BUTTON, "font_name", fontname, NULL);
+  return g_object_new (GTK_TYPE_FONT_BUTTON, "font-name", fontname, NULL);
 } 
 
 /**
@@ -625,7 +628,12 @@ gtk_font_button_set_show_size (GtkFontButton *font_button,
  * gtk_font_button_get_font_name:
  * @font_button: a #GtkFontButton
  *
- * Retrieves the name of the currently selected font.
+ * Retrieves the name of the currently selected font. This name includes
+ * style and size information as well. If you want to render something
+ * with the font, use this string with pango_font_description_from_string() .
+ * If you're interested in peeking certain values (family name,
+ * style, size, weight) just query these properties from the
+ * #PangoFontDescription object.
  *
  * Returns: an internal copy of the font name which must not be freed.
  *
@@ -697,7 +705,7 @@ gtk_font_button_clicked (GtkButton *button)
       
       font_dialog = GTK_FONT_SELECTION_DIALOG (font_button->priv->font_dialog);
       
-      if (GTK_WIDGET_TOPLEVEL (parent) && GTK_IS_WINDOW (parent))
+      if (gtk_widget_is_toplevel (parent) && GTK_IS_WINDOW (parent))
         {
           if (GTK_WINDOW (parent) != gtk_window_get_transient_for (GTK_WINDOW (font_dialog)))
            gtk_window_set_transient_for (GTK_WINDOW (font_dialog), GTK_WINDOW (parent));
@@ -714,7 +722,7 @@ gtk_font_button_clicked (GtkButton *button)
                         G_CALLBACK (dialog_destroy), font_button);
     }
   
-  if (!GTK_WIDGET_VISIBLE (font_button->priv->font_dialog)) 
+  if (!gtk_widget_get_visible (font_button->priv->font_dialog))
     {
       font_dialog = GTK_FONT_SELECTION_DIALOG (font_button->priv->font_dialog);
       
@@ -849,6 +857,7 @@ gtk_font_button_update_font_info (GtkFontButton *font_button)
       gint n_families, n_faces, i;
 
       n_families = 0;
+      families = NULL;
       pango_context_list_families (gtk_widget_get_pango_context (GTK_WIDGET (font_button)),
                                    &families, &n_families);
       n_faces = 0;