bloatpad: Use a box, not a toolbar
authorBenjamin Otte <otte@redhat.com>
Mon, 3 Feb 2020 03:29:10 +0000 (04:29 +0100)
committerBenjamin Otte <otte@redhat.com>
Fri, 7 Feb 2020 13:08:08 +0000 (14:08 +0100)
examples/bp/bloatpad.c

index 0cac3c711186b214264015848e392a5d74ba1ab2..fcbca05484b232a3662fb031721eb1c721c77ba2 100644 (file)
@@ -213,7 +213,7 @@ new_window (GApplication *app,
 {
   GtkWidget *window, *grid, *scrolled, *view;
   GtkWidget *toolbar;
-  GtkToolItem *button;
+  GtkWidget *button;
   GtkWidget *sw, *box, *label;
 
   window = gtk_application_window_new (GTK_APPLICATION (app));
@@ -224,37 +224,31 @@ new_window (GApplication *app,
   grid = gtk_grid_new ();
   gtk_container_add (GTK_CONTAINER (window), grid);
 
-  toolbar = gtk_toolbar_new ();
-  button = gtk_toggle_tool_button_new ();
-  gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (button), "format-justify-left");
+  toolbar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+  button = gtk_toggle_button_new ();
+  gtk_button_set_icon_name (GTK_BUTTON (button), "format-justify-left");
   gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (button), "win.justify::left");
-  gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button));
+  gtk_container_add (GTK_CONTAINER (toolbar), button);
 
-  button = gtk_toggle_tool_button_new ();
-  gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (button), "format-justify-center");
+  button = gtk_toggle_button_new ();
+  gtk_button_set_icon_name (GTK_BUTTON (button), "format-justify-center");
   gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (button), "win.justify::center");
-  gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button));
+  gtk_container_add (GTK_CONTAINER (toolbar), button);
 
-  button = gtk_toggle_tool_button_new ();
-  gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (button), "format-justify-right");
+  button = gtk_toggle_button_new ();
+  gtk_button_set_icon_name (GTK_BUTTON (button), "format-justify-right");
   gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (button), "win.justify::right");
-  gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button));
+  gtk_container_add (GTK_CONTAINER (toolbar), button);
 
-  button = gtk_separator_tool_item_new ();
-  gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (button), FALSE);
-  gtk_tool_item_set_expand (GTK_TOOL_ITEM (button), TRUE);
-  gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button));
-
-  button = gtk_tool_item_new ();
   box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
-  gtk_container_add (GTK_CONTAINER (button), box);
+  gtk_widget_set_halign (box, GTK_ALIGN_END);
   label = gtk_label_new ("Fullscreen:");
   gtk_container_add (GTK_CONTAINER (box), label);
   sw = gtk_switch_new ();
   gtk_widget_set_valign (sw, GTK_ALIGN_CENTER);
   gtk_actionable_set_action_name (GTK_ACTIONABLE (sw), "win.fullscreen");
   gtk_container_add (GTK_CONTAINER (box), sw);
-  gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button));
+  gtk_container_add (GTK_CONTAINER (toolbar), box);
 
   gtk_grid_attach (GTK_GRID (grid), toolbar, 0, 0, 1, 1);