forked from AuroraMiddleware/gtk
tests: use actionbar in headerbar test
This is a great example of where headerbar should not be used. https://bugzilla.gnome.org/show_bug.cgi?id=721665
This commit is contained in:
parent
e72aca055d
commit
0a95515bfe
@ -38,22 +38,6 @@ on_bookmark_clicked (GtkButton *button, gpointer data)
|
|||||||
gtk_widget_show (chooser);
|
gtk_widget_show (chooser);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
change_title (GtkButton *button, gpointer data)
|
|
||||||
{
|
|
||||||
GtkWidget *header = GTK_WIDGET (data);
|
|
||||||
|
|
||||||
if (gtk_header_bar_get_custom_title (GTK_HEADER_BAR (header)) == NULL)
|
|
||||||
{
|
|
||||||
gtk_header_bar_set_custom_title (GTK_HEADER_BAR (header), gtk_check_button_new_with_label ("Middle"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gtk_header_bar_set_custom_title (GTK_HEADER_BAR (header), NULL);
|
|
||||||
gtk_header_bar_set_title (GTK_HEADER_BAR (header), "Middle");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static GtkWidget *header;
|
static GtkWidget *header;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -166,20 +150,16 @@ main (int argc, char *argv[])
|
|||||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||||
gtk_container_add (GTK_CONTAINER (window), box);
|
gtk_container_add (GTK_CONTAINER (window), box);
|
||||||
|
|
||||||
footer = gtk_header_bar_new ();
|
footer = gtk_action_bar_new ();
|
||||||
button = gtk_button_new_with_label ("Title");
|
gtk_action_bar_set_center_widget (GTK_ACTION_BAR (footer), gtk_check_button_new_with_label ("Middle"));
|
||||||
g_signal_connect (button, "clicked", G_CALLBACK (change_title), footer);
|
|
||||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (footer), button);
|
|
||||||
gtk_header_bar_set_custom_title (GTK_HEADER_BAR (footer), gtk_check_button_new_with_label ("Middle"));
|
|
||||||
button = gtk_toggle_button_new_with_label ("Custom");
|
button = gtk_toggle_button_new_with_label ("Custom");
|
||||||
g_signal_connect (button, "clicked", G_CALLBACK (change_header), window);
|
g_signal_connect (button, "clicked", G_CALLBACK (change_header), window);
|
||||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (footer), button);
|
gtk_action_bar_pack_start (GTK_ACTION_BAR (footer), button);
|
||||||
gtk_header_bar_set_custom_title (GTK_HEADER_BAR (footer), gtk_check_button_new_with_label ("Middle"));
|
|
||||||
button = gtk_button_new_with_label ("Subtitle");
|
button = gtk_button_new_with_label ("Subtitle");
|
||||||
g_signal_connect (button, "clicked", G_CALLBACK (change_subtitle), NULL);
|
g_signal_connect (button, "clicked", G_CALLBACK (change_subtitle), NULL);
|
||||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (footer), button);
|
gtk_action_bar_pack_end (GTK_ACTION_BAR (footer), button);
|
||||||
button = gtk_button_new_with_label ("Fullscreen");
|
button = gtk_button_new_with_label ("Fullscreen");
|
||||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (footer), button);
|
gtk_action_bar_pack_end (GTK_ACTION_BAR (footer), button);
|
||||||
g_signal_connect (button, "clicked", G_CALLBACK (toggle_fullscreen), window);
|
g_signal_connect (button, "clicked", G_CALLBACK (toggle_fullscreen), window);
|
||||||
gtk_box_pack_end (GTK_BOX (box), footer, FALSE, FALSE, 0);
|
gtk_box_pack_end (GTK_BOX (box), footer, FALSE, FALSE, 0);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user