GtkFontChooser: Renaming the class names and fixing the tests
This commit is contained in:
committed by
Matthias Clasen
parent
f2376ad401
commit
334ee81901
@ -218,6 +218,7 @@ gtk_public_h_sources = \
|
|||||||
gtkfixed.h \
|
gtkfixed.h \
|
||||||
gtkfontbutton.h \
|
gtkfontbutton.h \
|
||||||
gtkfontsel.h \
|
gtkfontsel.h \
|
||||||
|
gtkfontchooser.h \
|
||||||
gtkframe.h \
|
gtkframe.h \
|
||||||
gtkgradient.h \
|
gtkgradient.h \
|
||||||
gtkgrid.h \
|
gtkgrid.h \
|
||||||
@ -548,6 +549,7 @@ gtk_base_c_sources = \
|
|||||||
gtkfixed.c \
|
gtkfixed.c \
|
||||||
gtkfontbutton.c \
|
gtkfontbutton.c \
|
||||||
gtkfontsel.c \
|
gtkfontsel.c \
|
||||||
|
gtkfontchooser.c \
|
||||||
gtkframe.c \
|
gtkframe.c \
|
||||||
gtkgradient.c \
|
gtkgradient.c \
|
||||||
gtkgrid.c \
|
gtkgrid.c \
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
|||||||
* Copyright (C) 2011 Alberto Ruiz <aruiz@gnome.org>
|
* Copyright (C) 2011 Alberto Ruiz <aruiz@gnome.org>
|
||||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||||
*
|
*
|
||||||
* GtkFontSelection widget for Gtk+, by Damon Chaplin, May 1998.
|
* GtkFontChooser widget for Gtk+, by Damon Chaplin, May 1998.
|
||||||
* Based on the GnomeFontSelector widget, by Elliot Lee, but major changes.
|
* Based on the GnomeFontSelector widget, by Elliot Lee, but major changes.
|
||||||
* The GnomeFontSelector was derived from app/text_tool.c in the GIMP.
|
* The GnomeFontSelector was derived from app/text_tool.c in the GIMP.
|
||||||
*
|
*
|
||||||
@ -22,19 +22,12 @@
|
|||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
|
||||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
||||||
* files for a list of changes. These files are distributed with
|
|
||||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||||
#error "Only <gtk/gtk.h> can be included directly."
|
#error "Only <gtk/gtk.h> can be included directly."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __GTK_FONTSEL_H__
|
#ifndef __GTK_FONT_CHOOSER_H__
|
||||||
#define __GTK_FONTSEL_H__
|
#define __GTK_FONT_CHOOSER_H__
|
||||||
|
|
||||||
|
|
||||||
#include <gtk/gtkdialog.h>
|
#include <gtk/gtkdialog.h>
|
||||||
@ -43,39 +36,39 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define GTK_TYPE_FONT_SELECTION (gtk_font_selection_get_type ())
|
#define GTK_TYPE_FONT_CHOOSER (gtk_font_chooser_get_type ())
|
||||||
#define GTK_FONT_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FONT_SELECTION, GtkFontSelection))
|
#define GTK_FONT_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FONT_CHOOSER, GtkFontChooser))
|
||||||
#define GTK_FONT_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FONT_SELECTION, GtkFontSelectionClass))
|
#define GTK_FONT_CHOOSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FONT_CHOOSER, GtkFontChooserClass))
|
||||||
#define GTK_IS_FONT_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FONT_SELECTION))
|
#define GTK_IS_FONT_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FONT_CHOOSER))
|
||||||
#define GTK_IS_FONT_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FONT_SELECTION))
|
#define GTK_IS_FONT_CHOOSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FONT_CHOOSER))
|
||||||
#define GTK_FONT_SELECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FONT_SELECTION, GtkFontSelectionClass))
|
#define GTK_FONT_CHOOSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FONT_CHOOSER, GtkFontChooserClass))
|
||||||
|
|
||||||
|
|
||||||
#define GTK_TYPE_FONT_SELECTION_DIALOG (gtk_font_selection_dialog_get_type ())
|
#define GTK_TYPE_FONT_CHOOSER_DIALOG (gtk_font_chooser_dialog_get_type ())
|
||||||
#define GTK_FONT_SELECTION_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FONT_SELECTION_DIALOG, GtkFontSelectionDialog))
|
#define GTK_FONT_CHOOSER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FONT_CHOOSER_DIALOG, GtkFontChooserDialog))
|
||||||
#define GTK_FONT_SELECTION_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FONT_SELECTION_DIALOG, GtkFontSelectionDialogClass))
|
#define GTK_FONT_CHOOSER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FONT_CHOOSER_DIALOG, GtkFontChooserDialogClass))
|
||||||
#define GTK_IS_FONT_SELECTION_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FONT_SELECTION_DIALOG))
|
#define GTK_IS_FONT_CHOOSER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FONT_CHOOSER_DIALOG))
|
||||||
#define GTK_IS_FONT_SELECTION_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FONT_SELECTION_DIALOG))
|
#define GTK_IS_FONT_CHOOSER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FONT_CHOOSER_DIALOG))
|
||||||
#define GTK_FONT_SELECTION_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FONT_SELECTION_DIALOG, GtkFontSelectionDialogClass))
|
#define GTK_FONT_CHOOSER_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FONT_CHOOSER_DIALOG, GtkFontChooserDialogClass))
|
||||||
|
|
||||||
|
|
||||||
typedef struct _GtkFontSelection GtkFontSelection;
|
typedef struct _GtkFontChooser GtkFontChooser;
|
||||||
typedef struct _GtkFontSelectionPrivate GtkFontSelectionPrivate;
|
typedef struct _GtkFontChooserPrivate GtkFontChooserPrivate;
|
||||||
typedef struct _GtkFontSelectionClass GtkFontSelectionClass;
|
typedef struct _GtkFontChooserClass GtkFontChooserClass;
|
||||||
|
|
||||||
typedef struct _GtkFontSelectionDialog GtkFontSelectionDialog;
|
typedef struct _GtkFontChooserDialog GtkFontChooserDialog;
|
||||||
typedef struct _GtkFontSelectionDialogPrivate GtkFontSelectionDialogPrivate;
|
typedef struct _GtkFontChooserDialogPrivate GtkFontChooserDialogPrivate;
|
||||||
typedef struct _GtkFontSelectionDialogClass GtkFontSelectionDialogClass;
|
typedef struct _GtkFontChooserDialogClass GtkFontChooserDialogClass;
|
||||||
|
|
||||||
struct _GtkFontSelection
|
struct _GtkFontChooser
|
||||||
{
|
{
|
||||||
GtkVBox parent_instance;
|
GtkVBox parent_instance;
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
GtkFontSelectionPrivate *priv;
|
GtkFontChooserPrivate *priv;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GtkFontSelectionClass
|
struct _GtkFontChooserClass
|
||||||
{
|
{
|
||||||
GtkVBoxClass parent_class;
|
GtkVBoxClass parent_class;
|
||||||
|
|
||||||
@ -87,15 +80,15 @@ struct _GtkFontSelectionClass
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct _GtkFontSelectionDialog
|
struct _GtkFontChooserDialog
|
||||||
{
|
{
|
||||||
GtkDialog parent_instance;
|
GtkDialog parent_instance;
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
GtkFontSelectionDialogPrivate *priv;
|
GtkFontChooserDialogPrivate *priv;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GtkFontSelectionDialogClass
|
struct _GtkFontChooserDialogClass
|
||||||
{
|
{
|
||||||
GtkDialogClass parent_class;
|
GtkDialogClass parent_class;
|
||||||
|
|
||||||
@ -109,76 +102,61 @@ struct _GtkFontSelectionDialogClass
|
|||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* GtkFontSelection functions.
|
* GtkFontChooser functions.
|
||||||
* see the comments in the GtkFontSelectionDialog functions.
|
* see the comments in the GtkFontChooserDialog functions.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
GType gtk_font_selection_get_type (void) G_GNUC_CONST;
|
GType gtk_font_chooser_get_type (void) G_GNUC_CONST;
|
||||||
GtkWidget* gtk_font_selection_new (void);
|
GtkWidget* gtk_font_chooser_new (void);
|
||||||
PangoFontFamily*
|
PangoFontFamily*
|
||||||
gtk_font_selection_get_family (GtkFontSelection *fontsel);
|
gtk_font_chooser_get_family (GtkFontChooser *fontchooser);
|
||||||
PangoFontFace*
|
PangoFontFace*
|
||||||
gtk_font_selection_get_face (GtkFontSelection *fontsel);
|
gtk_font_chooser_get_face (GtkFontChooser *fontchooser);
|
||||||
gint gtk_font_selection_get_size (GtkFontSelection *fontsel);
|
gint gtk_font_chooser_get_size (GtkFontChooser *fontchooser);
|
||||||
gchar* gtk_font_selection_get_font_name (GtkFontSelection *fontsel);
|
gchar* gtk_font_chooser_get_font_name (GtkFontChooser *fontchooser);
|
||||||
|
|
||||||
gboolean gtk_font_selection_set_font_name (GtkFontSelection *fontsel,
|
|
||||||
const gchar *fontname);
|
|
||||||
const gchar* gtk_font_selection_get_preview_text (GtkFontSelection *fontsel);
|
|
||||||
void gtk_font_selection_set_preview_text (GtkFontSelection *fontsel,
|
|
||||||
const gchar *text);
|
|
||||||
gboolean gtk_font_selection_get_show_preview_entry (GtkFontSelection *fontsel);
|
|
||||||
void gtk_font_selection_set_show_preview_entry (GtkFontSelection *fontsel,
|
|
||||||
gboolean show_preview_entry);
|
|
||||||
/* Deprecated GtkFontSelection methods */
|
|
||||||
#ifndef GTK_DISABLE_DEPRECATED
|
|
||||||
GtkWidget* gtk_font_selection_get_family_list (GtkFontSelection *fontsel);
|
|
||||||
GtkWidget* gtk_font_selection_get_face_list (GtkFontSelection *fontsel);
|
|
||||||
GtkWidget* gtk_font_selection_get_size_entry (GtkFontSelection *fontsel);
|
|
||||||
GtkWidget* gtk_font_selection_get_size_list (GtkFontSelection *fontsel);
|
|
||||||
GtkWidget* gtk_font_selection_get_preview_entry (GtkFontSelection *fontsel);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
gboolean gtk_font_chooser_set_font_name (GtkFontChooser *fontchooser,
|
||||||
|
const gchar *fontname);
|
||||||
|
const gchar* gtk_font_chooser_get_preview_text (GtkFontChooser *fontchooser);
|
||||||
|
void gtk_font_chooser_set_preview_text (GtkFontChooser *fontchooser,
|
||||||
|
const gchar *text);
|
||||||
|
gboolean gtk_font_chooser_get_show_preview_entry (GtkFontChooser *fontchooser);
|
||||||
|
void gtk_font_chooser_set_show_preview_entry (GtkFontChooser *fontchooser,
|
||||||
|
gboolean show_preview_entry);
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* GtkFontSelectionDialog functions.
|
* GtkFontChooserDialog functions.
|
||||||
* most of these functions simply call the corresponding function in the
|
* most of these functions simply call the corresponding function in the
|
||||||
* GtkFontSelection.
|
* GtkFontChooser.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
GType gtk_font_selection_dialog_get_type (void) G_GNUC_CONST;
|
GType gtk_font_chooser_dialog_get_type (void) G_GNUC_CONST;
|
||||||
GtkWidget* gtk_font_selection_dialog_new (const gchar *title);
|
GtkWidget* gtk_font_chooser_dialog_new (const gchar *title);
|
||||||
|
|
||||||
GtkWidget* gtk_font_selection_dialog_get_font_selection (GtkFontSelectionDialog *fsd);
|
GtkWidget* gtk_font_chooser_dialog_get_font_selection (GtkFontChooserDialog *fcd);
|
||||||
|
|
||||||
/* This returns the X Logical Font Description fontname, or NULL if no font
|
/* This returns the X Logical Font Description fontname, or NULL if no font
|
||||||
is selected. Note that there is a slight possibility that the font might not
|
is selected. Note that there is a slight possibility that the font might not
|
||||||
have been loaded OK. You should call gtk_font_selection_dialog_get_font()
|
have been loaded OK. You should call gtk_font_chooser_dialog_get_font()
|
||||||
to see if it has been loaded OK.
|
to see if it has been loaded OK.
|
||||||
You should g_free() the returned font name after you're done with it. */
|
You should g_free() the returned font name after you're done with it. */
|
||||||
gchar* gtk_font_selection_dialog_get_font_name (GtkFontSelectionDialog *fsd);
|
gchar* gtk_font_chooser_dialog_get_font_name (GtkFontChooserDialog *fcd);
|
||||||
|
|
||||||
/* This sets the currently displayed font. It should be a valid X Logical
|
/* This sets the currently displayed font. It should be a valid X Logical
|
||||||
Font Description font name (anything else will be ignored), e.g.
|
Font Description font name (anything else will be ignored), e.g.
|
||||||
"-adobe-courier-bold-o-normal--25-*-*-*-*-*-*-*"
|
"-adobe-courier-bold-o-normal--25-*-*-*-*-*-*-*"
|
||||||
It returns TRUE on success. */
|
It returns TRUE on success. */
|
||||||
gboolean gtk_font_selection_dialog_set_font_name (GtkFontSelectionDialog *fsd,
|
gboolean gtk_font_chooser_dialog_set_font_name (GtkFontChooserDialog *fcd,
|
||||||
const gchar *fontname);
|
const gchar *fontname);
|
||||||
|
|
||||||
/* This returns the text in the preview entry. You should copy the returned
|
/* This returns the text in the preview entry. You should copy the returned
|
||||||
text if you need it. */
|
text if you need it. */
|
||||||
G_CONST_RETURN gchar*
|
G_CONST_RETURN gchar*
|
||||||
gtk_font_selection_dialog_get_preview_text (GtkFontSelectionDialog *fsd);
|
gtk_font_chooser_dialog_get_preview_text (GtkFontChooserDialog *fcd);
|
||||||
|
|
||||||
/* This sets the text in the preview entry. It will be copied by the entry,
|
/* This sets the text in the preview entry. It will be copied by the entry,
|
||||||
so there's no need to g_strdup() it first. */
|
so there's no need to g_strdup() it first. */
|
||||||
void gtk_font_selection_dialog_set_preview_text (GtkFontSelectionDialog *fsd,
|
void gtk_font_chooser_dialog_set_preview_text (GtkFontChooserDialog *fcd,
|
||||||
const gchar *text);
|
const gchar *text);
|
||||||
|
|
||||||
/* Deprecated GtkFontSelectionDialog methods */
|
|
||||||
#ifndef GTK_DISABLE_DEPRECATED
|
|
||||||
GtkWidget* gtk_font_selection_dialog_get_cancel_button (GtkFontSelectionDialog *fsd);
|
|
||||||
GtkWidget* gtk_font_selection_dialog_get_ok_button (GtkFontSelectionDialog *fsd);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|||||||
@ -33,13 +33,6 @@ notify_preview_text_cb (GObject *fontsel, GParamSpec *pspec, gpointer data)
|
|||||||
g_debug ("Changed preview text %s", gtk_font_selection_get_preview_text (GTK_FONT_SELECTION (fontsel)));
|
g_debug ("Changed preview text %s", gtk_font_selection_get_preview_text (GTK_FONT_SELECTION (fontsel)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
notify_show_preview_entry_cb (GObject *fontsel, GParamSpec *pspec, gpointer data)
|
|
||||||
{
|
|
||||||
g_debug ("Changed show preview_entry %d",
|
|
||||||
gtk_font_selection_get_show_preview_entry (GTK_FONT_SELECTION (fontsel)));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -73,14 +66,10 @@ main (int argc, char *argv[])
|
|||||||
g_signal_connect (G_OBJECT (window), "delete-event", G_CALLBACK(gtk_main_quit), NULL);
|
g_signal_connect (G_OBJECT (window), "delete-event", G_CALLBACK(gtk_main_quit), NULL);
|
||||||
g_signal_connect (G_OBJECT (fontsel), "notify::font-name", G_CALLBACK(notify_font_name_cb), NULL);
|
g_signal_connect (G_OBJECT (fontsel), "notify::font-name", G_CALLBACK(notify_font_name_cb), NULL);
|
||||||
g_signal_connect (G_OBJECT (fontsel), "notify::preview-text", G_CALLBACK(notify_preview_text_cb), NULL);
|
g_signal_connect (G_OBJECT (fontsel), "notify::preview-text", G_CALLBACK(notify_preview_text_cb), NULL);
|
||||||
g_signal_connect (G_OBJECT (fontsel), "notify::show-preview-entry",
|
|
||||||
G_CALLBACK(notify_show_preview_entry_cb), NULL);
|
|
||||||
|
|
||||||
gtk_font_selection_set_font_name (GTK_FONT_SELECTION (fontsel), "Bitstream Vera Sans 45");
|
gtk_font_selection_set_font_name (GTK_FONT_SELECTION (fontsel), "Bitstream Vera Sans 45");
|
||||||
gtk_font_selection_set_preview_text (GTK_FONT_SELECTION (fontsel), "[user@host ~]$ ");
|
gtk_font_selection_set_preview_text (GTK_FONT_SELECTION (fontsel), "[user@host ~]$ ");
|
||||||
|
|
||||||
gtk_font_selection_set_show_preview_entry (GTK_FONT_SELECTION (fontsel), FALSE);
|
|
||||||
|
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
|
|
||||||
gtk_widget_destroy (window);
|
gtk_widget_destroy (window);
|
||||||
|
|||||||
@ -25,18 +25,12 @@ main (int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
GtkWidget *ok;
|
GtkWidget *ok;
|
||||||
GtkWidget *select;
|
|
||||||
|
|
||||||
gtk_init (&argc, &argv);
|
gtk_init (&argc, &argv);
|
||||||
|
|
||||||
dialog = gtk_font_selection_dialog_new (NULL);
|
dialog = gtk_font_selection_dialog_new (NULL);
|
||||||
|
|
||||||
#ifndef GTK_DISABLE_DEPRECATED
|
|
||||||
ok = gtk_font_selection_dialog_get_ok_button (GTK_FONT_SELECTION_DIALOG (dialog));
|
ok = gtk_font_selection_dialog_get_ok_button (GTK_FONT_SELECTION_DIALOG (dialog));
|
||||||
select = gtk_font_selection_dialog_get_select_button (GTK_FONT_SELECTION_DIALOG (dialog));
|
|
||||||
|
|
||||||
g_assert (ok == select);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gtk_dialog_run (GTK_DIALOG (dialog));
|
gtk_dialog_run (GTK_DIALOG (dialog));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user