[gtk+/font-chooser-api: 2/4] Rename GtkFontChooser:font-name to :font
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/font-chooser-api: 2/4] Rename GtkFontChooser:font-name to :font
- Date: Mon, 5 Sep 2011 12:24:33 +0000 (UTC)
commit 9f907bc311733952f571c63eb34c4819cdff71d8
Author: Christian Persch <chpe gnome org>
Date: Mon Sep 5 13:26:49 2011 +0200
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.
docs/reference/gtk/gtk3-sections.txt | 4 +-
gtk/gtk.symbols | 6 +---
gtk/gtkfontbutton.c | 8 +++---
gtk/gtkfontchooser.c | 20 +++++++++---------
gtk/gtkfontchooser.h | 8 +++---
gtk/gtkfontchooserutils.c | 16 +++++++-------
gtk/gtkfontchooserutils.h | 2 +-
gtk/gtkfontchooserwidget.c | 36 +++++++++++++++++-----------------
tests/testfontchooser.c | 4 +-
9 files changed, 51 insertions(+), 53 deletions(-)
---
diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt
index 2288f25..991cf82 100644
--- a/docs/reference/gtk/gtk3-sections.txt
+++ b/docs/reference/gtk/gtk3-sections.txt
@@ -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
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols
index 1faa704..fbc91ee 100644
--- a/gtk/gtk.symbols
+++ b/gtk/gtk.symbols
@@ -1047,17 +1047,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
diff --git a/gtk/gtkfontbutton.c b/gtk/gtkfontbutton.c
index 67a9ef3..05a5ee4 100644
--- a/gtk/gtkfontbutton.c
+++ b/gtk/gtkfontbutton.c
@@ -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);
diff --git a/gtk/gtkfontchooser.c b/gtk/gtkfontchooser.c
index 8b8ae71..304b933 100644
--- a/gtk/gtkfontchooser.c
+++ b/gtk/gtkfontchooser.c
@@ -60,8 +60,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));
@@ -165,7 +165,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.
@@ -186,15 +186,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"
*
@@ -207,14 +207,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);
}
/**
diff --git a/gtk/gtkfontchooser.h b/gtk/gtkfontchooser.h
index b78edd7..322302c 100644
--- a/gtk/gtkfontchooser.h
+++ b/gtk/gtkfontchooser.h
@@ -58,8 +58,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);
@@ -82,9 +82,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,
diff --git a/gtk/gtkfontchooserutils.c b/gtk/gtkfontchooserutils.c
index 4dbec90..5cef3a0 100644
--- a/gtk/gtkfontchooserutils.c
+++ b/gtk/gtkfontchooserutils.c
@@ -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;
diff --git a/gtk/gtkfontchooserutils.h b/gtk/gtkfontchooserutils.h
index 5451158..f574f14 100644
--- a/gtk/gtkfontchooserutils.h
+++ b/gtk/gtkfontchooserutils.h
@@ -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
diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c
index 6d669bd..fcc3672 100644
--- a/gtk/gtkfontchooserwidget.c
+++ b/gtk/gtkfontchooserwidget.c
@@ -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;
diff --git a/tests/testfontchooser.c b/tests/testfontchooser.c
index e92815c..4c6f42c 100644
--- a/tests/testfontchooser.c
+++ b/tests/testfontchooser.c
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]