[gtk/wip/otte/toolbar: 107/113] bloatpad: Use a box, not a toolbar



commit 8a60f5dc78b7aac9d3773a4229ca2565fe8214f8
Author: Benjamin Otte <otte redhat com>
Date:   Mon Feb 3 04:29:10 2020 +0100

    bloatpad: Use a box, not a toolbar

 examples/bp/bloatpad.c | 32 +++++++++++++-------------------
 1 file changed, 13 insertions(+), 19 deletions(-)
---
diff --git a/examples/bp/bloatpad.c b/examples/bp/bloatpad.c
index 0cac3c7111..fcbca05484 100644
--- a/examples/bp/bloatpad.c
+++ b/examples/bp/bloatpad.c
@@ -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);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]