gtk-demo: Drop uses of GtkAlignment

This commit is contained in:
Matthias Clasen 2011-09-01 13:27:14 -04:00
parent ee6b79becf
commit c5cd4174c3
4 changed files with 26 additions and 47 deletions

View File

@ -147,22 +147,19 @@ create_page3 (GtkWidget *assistant)
static void
create_page4 (GtkWidget *assistant)
{
GtkWidget *page;
page = gtk_alignment_new (0.5, 0.5, 0.5, 0.0);
progress_bar = gtk_progress_bar_new ();
gtk_container_add (GTK_CONTAINER (page), progress_bar);
gtk_widget_set_halign (progress_bar, GTK_ALIGN_CENTER);
gtk_widget_set_valign (progress_bar, GTK_ALIGN_CENTER);
gtk_widget_show_all (page);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), page);
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), page, GTK_ASSISTANT_PAGE_PROGRESS);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, "Applying changes");
gtk_widget_show (progress_bar);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), progress_bar);
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), progress_bar, GTK_ASSISTANT_PAGE_PROGRESS);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), progress_bar, "Applying changes");
/* This prevents the assistant window from being
* closed while we're "busy" applying changes.
*/
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), page, FALSE);
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), progress_bar, FALSE);
}
GtkWidget*

View File

@ -314,7 +314,6 @@ do_images (GtkWidget *do_widget)
GtkWidget *vbox;
GtkWidget *image;
GtkWidget *label;
GtkWidget *align;
GtkWidget *button;
GdkPixbuf *pixbuf;
GIcon *gicon;
@ -346,12 +345,9 @@ do_images (GtkWidget *do_widget)
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
/* The alignment keeps the frame from growing when users resize
* the window
*/
align = gtk_alignment_new (0.5, 0.5, 0, 0);
gtk_container_add (GTK_CONTAINER (align), frame);
gtk_box_pack_start (GTK_BOX (vbox), align, FALSE, FALSE, 0);
gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
/* demo_find_file() looks in the current directory first,
* so you can run gtk-demo without installing GTK, then looks
@ -403,12 +399,9 @@ do_images (GtkWidget *do_widget)
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
/* The alignment keeps the frame from growing when users resize
* the window
*/
align = gtk_alignment_new (0.5, 0.5, 0, 0);
gtk_container_add (GTK_CONTAINER (align), frame);
gtk_box_pack_start (GTK_BOX (vbox), align, FALSE, FALSE, 0);
gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
filename = demo_find_file ("floppybuddy.gif", NULL);
image = gtk_image_new_from_file (filename);
@ -425,12 +418,9 @@ do_images (GtkWidget *do_widget)
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
/* The alignment keeps the frame from growing when users resize
* the window
*/
align = gtk_alignment_new (0.5, 0.5, 0, 0);
gtk_container_add (GTK_CONTAINER (align), frame);
gtk_box_pack_start (GTK_BOX (vbox), align, FALSE, FALSE, 0);
gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gicon = g_themed_icon_new_with_default_fallbacks ("battery-caution-charging-symbolic");
image = gtk_image_new_from_gicon (gicon, GTK_ICON_SIZE_DIALOG);
@ -447,12 +437,9 @@ do_images (GtkWidget *do_widget)
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
/* The alignment keeps the frame from growing when users resize
* the window
*/
align = gtk_alignment_new (0.5, 0.5, 0, 0);
gtk_container_add (GTK_CONTAINER (align), frame);
gtk_box_pack_start (GTK_BOX (vbox), align, FALSE, FALSE, 0);
gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
/* Create an empty image for now; the progressive loader
* will create the pixbuf and fill it in.

View File

@ -401,7 +401,6 @@ do_stock_browser (GtkWidget *do_widget)
GtkWidget *hbox;
GtkWidget *sw;
GtkWidget *treeview;
GtkWidget *align;
GtkTreeModel *model;
GtkCellRenderer *cell_renderer;
StockItemDisplay *display;
@ -480,11 +479,9 @@ do_stock_browser (GtkWidget *do_widget)
NULL,
NULL);
align = gtk_alignment_new (0.5, 0.0, 0.0, 0.0);
gtk_box_pack_end (GTK_BOX (hbox), align, FALSE, FALSE, 0);
frame = gtk_frame_new ("Selected Item");
gtk_container_add (GTK_CONTAINER (align), frame);
gtk_widget_set_valign (frame, GTK_ALIGN_START);
gtk_box_pack_end (GTK_BOX (hbox), frame, FALSE, FALSE, 0);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);

View File

@ -561,7 +561,6 @@ recursive_attach_view (int depth,
GtkWidget *child_view;
GtkWidget *event_box;
GdkRGBA color;
GtkWidget *align;
if (depth > 4)
return;
@ -573,11 +572,10 @@ recursive_attach_view (int depth,
gdk_rgba_parse (&color, "black");
gtk_widget_override_background_color (event_box, 0, &color);
align = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
gtk_container_set_border_width (GTK_CONTAINER (align), 1);
gtk_widget_set_halign (child_view, GTK_ALIGN_FILL);
gtk_widget_set_valign (child_view, GTK_ALIGN_FILL);
gtk_container_add (GTK_CONTAINER (event_box), align);
gtk_container_add (GTK_CONTAINER (align), child_view);
gtk_container_add (GTK_CONTAINER (event_box), child_view);
gtk_text_view_add_child_at_anchor (view, event_box, anchor);