mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-11 11:20:12 +00:00
GtkFontChooser: Add callbacks and improve test to take deprecated widgets into account
This commit is contained in:
parent
e80053c659
commit
4b92872a97
@ -900,7 +900,6 @@ gtk_font_selection_bootstrap_fontlist (GtkFontSelection* fontsel)
|
||||
"markup", PREVIEW_TEXT_COLUMN,
|
||||
NULL);
|
||||
|
||||
|
||||
g_object_set (cell, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
|
||||
|
||||
gtk_tree_view_append_column (treeview, col);
|
||||
@ -926,7 +925,6 @@ gtk_font_selection_finalize (GObject *object)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
G_OBJECT_CLASS (gtk_font_selection_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
@ -1033,6 +1031,23 @@ update_face_model (GtkFontSelection *fontsel)
|
||||
g_free (faces);
|
||||
}
|
||||
|
||||
static void
|
||||
size_list_cursor_changed_cb (GtkTreeView *treeview, gpointer data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
family_list_cursor_changed_cb (GtkTreeView *treeview, gpointer data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
face_list_cursor_changed_cb (GtkTreeView *treeview, gpointer data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
initialize_deprecated_widgets (GtkFontSelection *fontsel)
|
||||
{
|
||||
@ -1083,6 +1098,15 @@ initialize_deprecated_widgets (GtkFontSelection *fontsel)
|
||||
gtk_container_add (GTK_CONTAINER (priv->face_list), face_list);
|
||||
gtk_container_add (GTK_CONTAINER (priv->size_list), size_list);
|
||||
|
||||
g_signal_connect (G_OBJECT (font_list), "cursor-changed",
|
||||
G_CALLBACK (family_list_cursor_changed_cb), fontsel);
|
||||
|
||||
g_signal_connect (G_OBJECT (face_list), "cursor-changed",
|
||||
G_CALLBACK (face_list_cursor_changed_cb), fontsel);
|
||||
|
||||
g_signal_connect (G_OBJECT (size_list), "cursor-changed",
|
||||
G_CALLBACK (size_list_cursor_changed_cb), fontsel);
|
||||
|
||||
populate_font_model (fontsel);
|
||||
cursor_changed_cb (priv->family_face_list, priv);
|
||||
}
|
||||
|
@ -26,28 +26,32 @@ int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *fontsel;
|
||||
|
||||
gtk_init (NULL, NULL);
|
||||
|
||||
dialog = gtk_font_selection_dialog_new (NULL);
|
||||
fontsel = gtk_font_selection_new ();
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_widget_set_size_request (window, 300, 300);
|
||||
vbox = gtk_vbox_new (TRUE, 6);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_widget_set_size_request (window, 600, 600);
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
gtk_container_add (GTK_CONTAINER (window), hbox);
|
||||
|
||||
fontsel = gtk_font_selection_dialog_get_font_selection (GTK_FONT_SELECTION_DIALOG (dialog));
|
||||
gtk_container_add (GTK_CONTAINER (vbox), gtk_font_selection_get_size_list (GTK_FONT_SELECTION (fontsel)));
|
||||
gtk_container_add (GTK_CONTAINER (vbox), gtk_font_selection_get_family_list (GTK_FONT_SELECTION (fontsel)));
|
||||
gtk_container_add (GTK_CONTAINER (vbox), gtk_font_selection_get_face_list (GTK_FONT_SELECTION (fontsel)));
|
||||
g_object_ref (gtk_font_selection_get_size_list (GTK_FONT_SELECTION (fontsel)));
|
||||
g_object_ref (gtk_font_selection_get_family_list (GTK_FONT_SELECTION (fontsel)));
|
||||
g_object_ref (gtk_font_selection_get_face_list (GTK_FONT_SELECTION (fontsel)));
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (hbox), gtk_font_selection_get_size_list (GTK_FONT_SELECTION (fontsel)));
|
||||
gtk_container_add (GTK_CONTAINER (hbox), gtk_font_selection_get_family_list (GTK_FONT_SELECTION (fontsel)));
|
||||
gtk_container_add (GTK_CONTAINER (hbox), gtk_font_selection_get_face_list (GTK_FONT_SELECTION (fontsel)));
|
||||
gtk_container_add (GTK_CONTAINER (hbox), fontsel);
|
||||
|
||||
gtk_widget_show_all (window);
|
||||
|
||||
gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
gtk_main ();
|
||||
|
||||
gtk_widget_destroy (window);
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user