[libgnome-games-support/arnaudb/wip/gtk4: 12/12] Updated with new gtk changes



commit 35fc3ce3929f24f4f12473d699369330bce0cb74
Author: Robert Roth <robert roth bee-tf ro>
Date:   Thu May 21 11:51:26 2020 +0300

    Updated with new gtk changes

 games/scores/context.vala |  7 ++++++-
 games/scores/dialog.vala  | 18 +++++++++---------
 2 files changed, 15 insertions(+), 10 deletions(-)
---
diff --git a/games/scores/context.vala b/games/scores/context.vala
index 89ca6e4..3fb9e68 100644
--- a/games/scores/context.vala
+++ b/games/scores/context.vala
@@ -359,7 +359,12 @@ public class Context : Object
         requires (game_window != null)
     {
         var dialog = new Dialog (this, category_type, style, new_high_score, current_category, game_window, 
icon_name);
-        dialog.run ();
+        dialog.present ();
+        dialog.response.connect (on_score_confirmed);
+    }
+
+    internal void on_score_confirmed (Gtk.Widget dialog, int response)
+    {
         dialog.destroy ();
     }
 
diff --git a/games/scores/dialog.vala b/games/scores/dialog.vala
index a63817f..699a717 100644
--- a/games/scores/dialog.vala
+++ b/games/scores/dialog.vala
@@ -76,14 +76,14 @@ private class Dialog : Gtk.Dialog
             image.icon_name = icon_name + "-symbolic";
             image.pixel_size = 64;
             image.opacity = 0.2;
-            vbox.add (image);
+            vbox.append (image);
 
             var title_label = new Gtk.Label ("<b><span size=\"large\">" + _("No scores yet") + 
"</span></b>");
             title_label.use_markup = true;
-            vbox.add (title_label);
+            vbox.append (title_label);
 
             var description_label = new Gtk.Label (_("Play some games and your scores will show up here."));
-            vbox.add (description_label);
+            vbox.append (description_label);
 
             width_request = 450;
             height_request = 500;
@@ -97,15 +97,15 @@ private class Dialog : Gtk.Dialog
         catbar.margin_top = 20;
         catbar.halign = Gtk.Align.CENTER;
 
-        vbox.add (catbar);
+        vbox.append (catbar);
 
         var hdiv = new Gtk.Separator (Gtk.Orientation.HORIZONTAL);
-        vbox.add (hdiv);
+        vbox.append (hdiv);
 
         var label = new Gtk.Label (category_type);
         label.use_markup = true;
         label.halign = Gtk.Align.CENTER;
-        catbar.add (label);
+        catbar.append (label);
 
         var categories = context.get_categories ();
         if (new_high_score != null || categories.length () == 1)
@@ -116,18 +116,18 @@ private class Dialog : Gtk.Dialog
             category_label.use_markup = true;
             category_label.halign = Gtk.Align.CENTER;
             category_label.valign = Gtk.Align.CENTER;
-            catbar.add (category_label);
+            catbar.append (category_label);
         }
         else
         {
             combo = new Gtk.ComboBoxText ();
             combo.focus_on_click = false;
-            catbar.add (combo);
+            catbar.append (combo);
             combo.changed.connect (load_scores);
         }
 
         grid = new Gtk.Grid ();
-        vbox.add (grid);
+        vbox.append (grid);
 
         grid.row_homogeneous = true;
         grid.column_spacing = 40;


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