[gnome-taquin/arnaudb/wip/gtk4] Adapt to Container removing.



commit 0a6d28c63cb823d16b84ee9b8450d72f594eaa8b
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Tue Sep 29 17:06:11 2020 +0200

    Adapt to Container removing.

 data/ui/base-view.ui   |  2 +-
 data/ui/base-window.ui |  2 +-
 src/about-list.vala    | 16 +++++++---------
 src/base-view.vala     |  4 ++--
 src/base-window.vala   |  4 ++--
 src/game-view.vala     | 18 +++++++++---------
 6 files changed, 22 insertions(+), 24 deletions(-)
---
diff --git a/data/ui/base-view.ui b/data/ui/base-view.ui
index 57ea518..714a71d 100644
--- a/data/ui/base-view.ui
+++ b/data/ui/base-view.ui
@@ -30,7 +30,7 @@
             <property name="child">
               <object class="GtkOverlay" id="notifications_overlay">
                 <child>
-                  <object class="GtkGrid" id="main_grid">
+                  <object class="GtkGrid" id="main_box">
                     <property name="orientation">vertical</property>
                   </object>
                 </child>
diff --git a/data/ui/base-window.ui b/data/ui/base-window.ui
index 5a6c7c3..26d67f6 100644
--- a/data/ui/base-window.ui
+++ b/data/ui/base-window.ui
@@ -22,7 +22,7 @@
     <child>
       <object class="GtkOverlay" id="main_overlay">
         <child>
-          <object class="GtkGrid" id="main_grid">
+          <object class="GtkBox" id="main_box">
             <property name="orientation">vertical</property>
           </object>
         </child>
diff --git a/src/about-list.vala b/src/about-list.vala
index bc1580a..dbf927b 100644
--- a/src/about-list.vala
+++ b/src/about-list.vala
@@ -216,7 +216,7 @@ private class AboutListItem : OverlayedListRow
         label.can_focus = false;
         if (css_class != null)
             label.get_style_context ().add_class ((!) css_class);
-        add (label);
+        set_child (label);
     }
 
     internal AboutListItem.from_icon_name (string icon_name, string copy_text)
@@ -227,7 +227,7 @@ private class AboutListItem : OverlayedListRow
         image.pixel_size = 128;
         image.visible = true;
         image.hexpand = true;
-        add (image);
+        set_child (image);
     }
 
     internal AboutListItem.from_link (string link, string text_or_empty) // TODO do not allow button focus, 
and activate it on row activation
@@ -250,17 +250,15 @@ private class AboutListItem : OverlayedListRow
         label.wrap = true;
         label.justify = Justification.CENTER;
 
-        add (button);
+        set_child (button);
     }
 
     internal AboutListItem.with_title (string text, string title)
     {
         Object (copy_text: text);
 
-        Grid grid = new Grid ();
-        grid.orientation = Orientation.VERTICAL;
-        grid.visible = true;
-        add (grid);
+        Box box = new Box (Orientation.VERTICAL, /* spacing */ 0);
+        set_child (box);
 
         Label label = new Label (title);
         label.visible = true;
@@ -268,7 +266,7 @@ private class AboutListItem : OverlayedListRow
         label.wrap_mode = Pango.WrapMode.WORD_CHAR;
         label.wrap = true;
         label.get_style_context ().add_class ("bold-label");
-        grid.add (label);
+        box.append (label);
 
         label = new Label (text);
         label.visible = true;
@@ -278,6 +276,6 @@ private class AboutListItem : OverlayedListRow
         label.selectable = true;
         label.get_style_context ().add_class ("small-label");
         label.justify = Justification.CENTER;
-        grid.add (label);
+        box.append (label);
     }
 }
diff --git a/src/base-view.vala b/src/base-view.vala
index 2b09f10..6986bed 100644
--- a/src/base-view.vala
+++ b/src/base-view.vala
@@ -21,7 +21,7 @@ using Gtk;
 private class BaseView : Widget, AdaptativeWidget
 {
     [GtkChild] private Stack stack;
-    [GtkChild] protected Grid main_grid;
+    [GtkChild] protected Box main_box;
 
     internal virtual bool handle_copy_text (out string copy_text)
     {
@@ -98,7 +98,7 @@ private class BaseView : Widget, AdaptativeWidget
                                     /* big placeholder */ true,
                                     ref artists, ref authors, ref comments, ref copyright, ref documenters, 
ref logo_icon_name, ref program_name, ref translator_credits, ref version, ref website, ref website_label);
         about_list.set_window_size (saved_window_size);
-        stack.add (about_list);
+        stack.add_child (about_list);
         about_list_created = true;
     }
 
diff --git a/src/base-window.vala b/src/base-window.vala
index 1b5554e..3fe6eec 100644
--- a/src/base-window.vala
+++ b/src/base-window.vala
@@ -74,7 +74,7 @@ private class BaseWindow : AdaptativeWindow, AdaptativeWidget
     * * main layout
     \*/
 
-    [GtkChild] private Grid main_grid;
+    [GtkChild] private Box main_box;
     [GtkChild] private Button unfullscreen_button;
     [GtkChild] private Overlay main_overlay;
 
@@ -85,7 +85,7 @@ private class BaseWindow : AdaptativeWindow, AdaptativeWidget
 
     protected void add_to_main_grid (Widget widget)
     {
-        main_grid.add (widget);
+        main_box.append (widget);
     }
 
     protected override void on_fullscreen ()
diff --git a/src/game-view.vala b/src/game-view.vala
index 1d08391..5f1cf3e 100644
--- a/src/game-view.vala
+++ b/src/game-view.vala
@@ -34,21 +34,21 @@ private class GameView : BaseView, AdaptativeWidget
         game_stack = new Stack ();
         game_stack.hexpand = true;
         game_stack.vexpand = true;
-        main_grid.add (game_stack);
+        main_box.append (game_stack);
 
         scrolled = new ScrolledWindow ();
         scrolled.visible = true;
-        game_stack.add (scrolled);
+        game_stack.add_child (scrolled);
 
         new_game_box = new Box (Orientation.VERTICAL, /* spacing */ 0);
         new_game_box.halign = Align.CENTER;
         new_game_box.valign = Align.CENTER;
-        scrolled.add (new_game_box);
+        scrolled.set_child (new_game_box);
     }
 
     internal GameView (GameWindowFlags flags, Box new_game_screen, Widget content, GameActionBarPlaceHolder 
actionbar_placeholder)
     {
-        new_game_box.add (new_game_screen);
+        new_game_box.append (new_game_screen);
 
         if (GameWindowFlags.SHOW_START_BUTTON in flags)
         {
@@ -62,7 +62,7 @@ private class GameView : BaseView, AdaptativeWidget
             context.add_class ("suggested-action");
             /* Translators: when configuring a new game, tooltip text of the blue Start button */
             // _start_game_button.set_tooltip_text (_("Start a new game as configured"));
-            new_game_box.add (_start_game_button);
+            new_game_box.append (_start_game_button);
             start_game_button = _start_game_button;
         }
 
@@ -75,14 +75,14 @@ private class GameView : BaseView, AdaptativeWidget
         // during a transition, Stack doesn’t apply correctly its child CSS padding or margin; so add 
padding/margin to a box inside a box
         Box game_box_2 = new Box (Orientation.HORIZONTAL, 0);
         game_box_2.get_style_context ().add_class ("game-box");
-        game_box_2.add (game_content);
+        game_box_2.append (game_content);
 
-        game_box_1.add (game_box_2);
-        game_box_1.add (actionbar_placeholder);
+        game_box_1.append (game_box_2);
+        game_box_1.append (actionbar_placeholder);
 
         // for the new-game-screen-to-game animation, it is probably better to have the game under 
("uncovered")
 //        game_box.insert_before (game_stack, game_stack.get_first_child ());
-        game_stack.add (game_box_1);
+        game_stack.add_child (game_box_1);
         content.can_focus = true;
     }
 


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