Rename GtkFontChooser:font-name to :font

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.
This commit is contained in:
Christian Persch 2011-09-05 13:26:49 +02:00
parent 5452525143
commit eb9efc9fd2
9 changed files with 51 additions and 53 deletions

View File

@ -1483,8 +1483,8 @@ GtkFontChooser
gtk_font_chooser_get_family
gtk_font_chooser_get_face
gtk_font_chooser_get_size
gtk_font_chooser_get_font_name
gtk_font_chooser_set_font_name
gtk_font_chooser_get_font
gtk_font_chooser_set_font
gtk_font_chooser_get_preview_text
gtk_font_chooser_set_preview_text
gtk_font_chooser_get_show_preview_entry

View File

@ -1049,17 +1049,15 @@ gtk_font_button_set_use_font
gtk_font_button_set_use_size
gtk_font_chooser_dialog_get_type
gtk_font_chooser_dialog_new
gtk_font_chooser_dialog_set_font_name
gtk_font_chooser_dialog_set_preview_text
gtk_font_chooser_get_face
gtk_font_chooser_get_family
gtk_font_chooser_get_font_name
gtk_font_chooser_get_font
gtk_font_chooser_get_preview_text
gtk_font_chooser_get_show_preview_entry
gtk_font_chooser_get_size
gtk_font_chooser_get_type
gtk_font_chooser_set_filter_func
gtk_font_chooser_set_font_name
gtk_font_chooser_set_font
gtk_font_chooser_set_preview_text
gtk_font_chooser_set_show_preview_entry
gtk_font_chooser_widget_get_type

View File

@ -690,8 +690,8 @@ gtk_font_button_set_font_name (GtkFontButton *font_button,
gtk_font_button_update_font_info (font_button);
if (font_button->priv->font_dialog)
result = gtk_font_chooser_set_font_name (GTK_FONT_CHOOSER (font_button->priv->font_dialog),
font_button->priv->fontname);
result = gtk_font_chooser_set_font (GTK_FONT_CHOOSER (font_button->priv->font_dialog),
font_button->priv->fontname);
else
result = FALSE;
@ -736,7 +736,7 @@ gtk_font_button_clicked (GtkButton *button)
if (!gtk_widget_get_visible (font_button->priv->font_dialog))
{
font_dialog = GTK_FONT_CHOOSER (font_button->priv->font_dialog);
gtk_font_chooser_set_font_name (font_dialog, font_button->priv->fontname);
gtk_font_chooser_set_font (font_dialog, font_button->priv->fontname);
}
gtk_window_present (GTK_WINDOW (font_button->priv->font_dialog));
@ -755,7 +755,7 @@ response_cb (GtkDialog *dialog,
return;
g_free (font_button->priv->fontname);
font_button->priv->fontname = gtk_font_chooser_get_font_name (GTK_FONT_CHOOSER (font_button->priv->font_dialog));
font_button->priv->fontname = gtk_font_chooser_get_font (GTK_FONT_CHOOSER (font_button->priv->font_dialog));
/* Set label font */
gtk_font_button_update_font_info (font_button);

View File

@ -61,8 +61,8 @@ gtk_font_chooser_default_init (GtkFontChooserInterface *iface)
{
g_object_interface_install_property
(iface,
g_param_spec_string ("font-name",
P_("Font name"),
g_param_spec_string ("font",
P_("Font"),
P_("The string that represents this font"),
DEFAULT_FONT_NAME,
GTK_PARAM_READWRITE));
@ -166,7 +166,7 @@ gtk_font_chooser_get_size (GtkFontChooser *fontchooser)
}
/**
* gtk_font_chooser_get_font_name:
* gtk_font_chooser_get_font:
* @fontchooser: a #GtkFontChooser
*
* Gets the currently-selected font name.
@ -187,15 +187,15 @@ gtk_font_chooser_get_size (GtkFontChooser *fontchooser)
* Since: 3.2
*/
gchar *
gtk_font_chooser_get_font_name (GtkFontChooser *fontchooser)
gtk_font_chooser_get_font (GtkFontChooser *fontchooser)
{
g_return_val_if_fail (GTK_IS_FONT_CHOOSER (fontchooser), NULL);
return GTK_FONT_CHOOSER_GET_IFACE (fontchooser)->get_font_name (fontchooser);
return GTK_FONT_CHOOSER_GET_IFACE (fontchooser)->get_font (fontchooser);
}
/**
* gtk_font_chooser_set_font_name:
* gtk_font_chooser_set_font:
* @fontchooser: a #GtkFontChooser
* @fontname: a font name like "Helvetica 12" or "Times Bold 18"
*
@ -208,14 +208,14 @@ gtk_font_chooser_get_font_name (GtkFontChooser *fontchooser)
* Since: 3.2
*/
gboolean
gtk_font_chooser_set_font_name (GtkFontChooser *fontchooser,
const gchar *fontname)
gtk_font_chooser_set_font (GtkFontChooser *fontchooser,
const gchar *fontname)
{
g_return_val_if_fail (GTK_IS_FONT_CHOOSER (fontchooser), FALSE);
g_return_val_if_fail (fontname != NULL, FALSE);
return GTK_FONT_CHOOSER_GET_IFACE (fontchooser)->set_font_name (fontchooser,
fontname);
return GTK_FONT_CHOOSER_GET_IFACE (fontchooser)->set_font (fontchooser,
fontname);
}
/**

View File

@ -59,8 +59,8 @@ struct _GtkFontChooserIface
GTypeInterface base_iface;
/* Methods */
gchar * (* get_font_name) (GtkFontChooser *chooser);
gboolean (* set_font_name) (GtkFontChooser *chooser,
gchar * (* get_font) (GtkFontChooser *chooser);
gboolean (* set_font) (GtkFontChooser *chooser,
const gchar *fontname);
PangoFontFamily * (* get_font_family) (GtkFontChooser *chooser);
PangoFontFace * (* get_font_face) (GtkFontChooser *chooser);
@ -83,9 +83,9 @@ GType gtk_font_chooser_get_type (void) G_GNUC_CONST;
PangoFontFamily *gtk_font_chooser_get_family (GtkFontChooser *fontchooser);
PangoFontFace *gtk_font_chooser_get_face (GtkFontChooser *fontchooser);
gint gtk_font_chooser_get_size (GtkFontChooser *fontchooser);
gchar* gtk_font_chooser_get_font_name (GtkFontChooser *fontchooser);
gchar* gtk_font_chooser_get_font (GtkFontChooser *fontchooser);
gboolean gtk_font_chooser_set_font_name (GtkFontChooser *fontchooser,
gboolean gtk_font_chooser_set_font (GtkFontChooser *fontchooser,
const gchar *font_name);
gchar* gtk_font_chooser_get_preview_text (GtkFontChooser *fontchooser);
void gtk_font_chooser_set_preview_text (GtkFontChooser *fontchooser,

View File

@ -36,16 +36,16 @@ get_delegate (GtkFontChooser *receiver)
}
static gchar *
delegate_get_font_name (GtkFontChooser *chooser)
delegate_get_font (GtkFontChooser *chooser)
{
return gtk_font_chooser_get_font_name (get_delegate (chooser));
return gtk_font_chooser_get_font (get_delegate (chooser));
}
static gboolean
delegate_set_font_name (GtkFontChooser *chooser,
delegate_set_font (GtkFontChooser *chooser,
const gchar *fontname)
{
return gtk_font_chooser_set_font_name (get_delegate (chooser), fontname);
return gtk_font_chooser_set_font (get_delegate (chooser), fontname);
}
static PangoFontFamily *
@ -125,8 +125,8 @@ void
_gtk_font_chooser_install_properties (GObjectClass *klass)
{
g_object_class_override_property (klass,
GTK_FONT_CHOOSER_PROP_FONT_NAME,
"font-name");
GTK_FONT_CHOOSER_PROP_FONT,
"font");
g_object_class_override_property (klass,
GTK_FONT_CHOOSER_PROP_PREVIEW_TEXT,
"preview-text");
@ -149,8 +149,8 @@ _gtk_font_chooser_install_properties (GObjectClass *klass)
void
_gtk_font_chooser_delegate_iface_init (GtkFontChooserIface *iface)
{
iface->get_font_name = delegate_get_font_name;
iface->set_font_name = delegate_set_font_name;
iface->get_font = delegate_get_font;
iface->set_font = delegate_set_font;
iface->get_font_family = delegate_get_font_family;
iface->get_font_face = delegate_get_font_face;
iface->get_font_size = delegate_get_font_size;

View File

@ -35,7 +35,7 @@ G_BEGIN_DECLS
typedef enum {
GTK_FONT_CHOOSER_PROP_FIRST = 0x4000,
GTK_FONT_CHOOSER_PROP_FONT_NAME,
GTK_FONT_CHOOSER_PROP_FONT,
GTK_FONT_CHOOSER_PROP_PREVIEW_TEXT,
GTK_FONT_CHOOSER_PROP_SHOW_PREVIEW_ENTRY,
GTK_FONT_CHOOSER_PROP_LAST

View File

@ -62,12 +62,12 @@
* selecting fonts.
*
* To set the font which is initially selected, use
* gtk_font_chooser_widget_set_font_name().
* gtk_font_chooser_set_font().
*
* To get the selected font use gtk_font_chooser_widget_get_font_name().
* To get the selected font use gtk_font_chooser_get_font().
*
* To change the text which is shown in the preview area, use
* gtk_font_chooser_widget_set_preview_text().
* gtk_font_chooser_set_preview_text().
*
* Since: 3.2
*/
@ -148,8 +148,8 @@ static void gtk_font_chooser_widget_bootstrap_fontlist (GtkFontChooserWidget *
static gboolean gtk_font_chooser_widget_select_font_name (GtkFontChooserWidget *fontchooser);
static gchar *gtk_font_chooser_widget_get_font_name (GtkFontChooser *chooser);
static gboolean gtk_font_chooser_widget_set_font_name (GtkFontChooser *chooser,
static gchar *gtk_font_chooser_widget_get_font (GtkFontChooser *chooser);
static gboolean gtk_font_chooser_widget_set_font (GtkFontChooser *chooser,
const gchar *fontname);
static const gchar *gtk_font_chooser_widget_get_preview_text (GtkFontChooserWidget *fontchooser);
@ -195,8 +195,8 @@ gtk_font_chooser_widget_set_property (GObject *object,
switch (prop_id)
{
case GTK_FONT_CHOOSER_PROP_FONT_NAME:
gtk_font_chooser_widget_set_font_name (GTK_FONT_CHOOSER (fontchooser), g_value_get_string (value));
case GTK_FONT_CHOOSER_PROP_FONT:
gtk_font_chooser_widget_set_font (GTK_FONT_CHOOSER (fontchooser), g_value_get_string (value));
break;
case GTK_FONT_CHOOSER_PROP_PREVIEW_TEXT:
gtk_font_chooser_widget_set_preview_text (fontchooser, g_value_get_string (value));
@ -220,8 +220,8 @@ gtk_font_chooser_widget_get_property (GObject *object,
switch (prop_id)
{
case GTK_FONT_CHOOSER_PROP_FONT_NAME:
g_value_take_string (value, gtk_font_chooser_widget_get_font_name (GTK_FONT_CHOOSER (fontchooser)));
case GTK_FONT_CHOOSER_PROP_FONT:
g_value_take_string (value, gtk_font_chooser_widget_get_font (GTK_FONT_CHOOSER (fontchooser)));
break;
case GTK_FONT_CHOOSER_PROP_PREVIEW_TEXT:
g_value_set_string (value, gtk_font_chooser_widget_get_preview_text (fontchooser));
@ -316,7 +316,7 @@ spin_change_cb (GtkAdjustment *adjustment,
pango_font_description_set_size (desc, priv->size);
gtk_widget_override_font (priv->preview, desc);
g_object_notify (G_OBJECT (fontchooser), "font-name");
g_object_notify (G_OBJECT (fontchooser), "font");
/* If the new value is lower than the lower bound of the slider, we set
* the slider adjustment to the lower bound value if it is not already set
@ -383,7 +383,7 @@ row_activated_cb (GtkTreeView *view,
GtkFontChooser *chooser = user_data;
gchar *fontname;
fontname = gtk_font_chooser_widget_get_font_name (chooser);
fontname = gtk_font_chooser_widget_get_font (chooser);
_gtk_font_chooser_font_activated (chooser, fontname);
g_free (fontname);
}
@ -458,7 +458,7 @@ cursor_changed_cb (GtkTreeView *treeview,
pango_font_description_free (desc);
g_object_notify (G_OBJECT (fontchooser), "font-name");
g_object_notify (G_OBJECT (fontchooser), "font");
}
static gboolean
@ -986,7 +986,7 @@ gtk_font_chooser_widget_get_size (GtkFontChooser *chooser)
}
static gchar *
gtk_font_chooser_widget_get_font_name (GtkFontChooser *chooser)
gtk_font_chooser_widget_get_font (GtkFontChooser *chooser)
{
GtkFontChooserWidget *fontchooser = GTK_FONT_CHOOSER_WIDGET (chooser);
gchar *font_name;
@ -1007,8 +1007,8 @@ gtk_font_chooser_widget_get_font_name (GtkFontChooser *chooser)
}
static gboolean
gtk_font_chooser_widget_set_font_name (GtkFontChooser *chooser,
const gchar *fontname)
gtk_font_chooser_widget_set_font (GtkFontChooser *chooser,
const gchar *fontname)
{
GtkFontChooserWidget *fontchooser = GTK_FONT_CHOOSER_WIDGET (chooser);
GtkFontChooserWidgetPrivate *priv = fontchooser->priv;
@ -1021,7 +1021,7 @@ gtk_font_chooser_widget_set_font_name (GtkFontChooser *chooser,
if (gtk_widget_has_screen (GTK_WIDGET (fontchooser)))
found = gtk_font_chooser_widget_select_font_name (fontchooser);
g_object_notify (G_OBJECT (fontchooser), "font-name");
g_object_notify (G_OBJECT (fontchooser), "font");
return found;
}
@ -1189,8 +1189,8 @@ gtk_font_chooser_widget_set_filter_func (GtkFontChooser *chooser,
static void
gtk_font_chooser_widget_iface_init (GtkFontChooserIface *iface)
{
iface->get_font_name = gtk_font_chooser_widget_get_font_name;
iface->set_font_name = gtk_font_chooser_widget_set_font_name;
iface->get_font = gtk_font_chooser_widget_get_font;
iface->set_font = gtk_font_chooser_widget_set_font;
iface->get_font_family = gtk_font_chooser_widget_get_family;
iface->get_font_face = gtk_font_chooser_widget_get_face;
iface->get_font_size = gtk_font_chooser_widget_get_size;

View File

@ -22,7 +22,7 @@
static void
notify_font_name_cb (GObject *fontchooser, GParamSpec *pspec, gpointer data)
{
g_debug ("Changed font name %s", gtk_font_chooser_get_font_name (GTK_FONT_CHOOSER (fontchooser)));
g_debug ("Changed font name %s", gtk_font_chooser_get_font (GTK_FONT_CHOOSER (fontchooser)));
}
static void
@ -57,7 +57,7 @@ main (int argc, char *argv[])
g_signal_connect (fontchooser, "notify::preview-text",
G_CALLBACK (notify_preview_text_cb), NULL);
gtk_font_chooser_set_font_name (GTK_FONT_CHOOSER (fontchooser), "Bitstream Vera Sans 45");
gtk_font_chooser_set_font (GTK_FONT_CHOOSER (fontchooser), "Bitstream Vera Sans 45");
gtk_font_chooser_set_preview_text (GTK_FONT_CHOOSER (fontchooser), "[user@host ~]$ &>>");
gtk_font_chooser_set_show_preview_entry (GTK_FONT_CHOOSER (fontchooser), FALSE);