widget-factory: Add a second page

The widget-factory was pretty much overflowing, so I've
made it page, and started to fill the second page with
vertical spin buttons. New examples and widgets should
be added to page 2 now.
This commit is contained in:
Matthias Clasen 2012-09-09 16:02:15 -04:00
parent 26f1c08d75
commit 1c9f52038b
2 changed files with 1563 additions and 1457 deletions

View File

@ -65,12 +65,26 @@ show_about (GtkMenuItem *item, GtkWidget *window)
g_object_unref (pixbuf);
}
static void
on_page_toggled (GtkToggleButton *button,
GtkNotebook *pages)
{
gint page;
if (!gtk_toggle_button_get_active (button))
return;
page = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "page"));
gtk_notebook_set_current_page (pages, page);
}
int
main (int argc, char *argv[])
{
GtkBuilder *builder;
GtkWidget *window;
GtkWidget *widget;
GtkWidget *notebook;
gboolean dark = FALSE;
gtk_init (&argc, &argv);
@ -88,6 +102,15 @@ main (int argc, char *argv[])
g_signal_connect (widget, "toggled", G_CALLBACK (dark_toggled), NULL);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (widget), dark);
notebook = (GtkWidget*) gtk_builder_get_object (builder, "toplevel_notebook");
widget = (GtkWidget*) gtk_builder_get_object (builder, "togglepage1");
g_object_set_data (G_OBJECT (widget), "page", GINT_TO_POINTER (0));
g_signal_connect (widget, "toggled", G_CALLBACK (on_page_toggled), notebook);
widget = (GtkWidget*) gtk_builder_get_object (builder, "togglepage2");
g_object_set_data (G_OBJECT (widget), "page", GINT_TO_POINTER (1));
g_signal_connect (widget, "toggled", G_CALLBACK (on_page_toggled), notebook);
widget = (GtkWidget*) gtk_builder_get_object (builder, "aboutmenuitem");
g_signal_connect (widget, "activate", G_CALLBACK (show_about), window);

File diff suppressed because it is too large Load Diff