[lightsoff/arnaudb/drop-clutter] Allow compiling with --enable-experimental-non-null.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [lightsoff/arnaudb/drop-clutter] Allow compiling with --enable-experimental-non-null.
- Date: Thu, 15 Oct 2020 14:34:56 +0000 (UTC)
commit f9f3660db1c2b04c939473379315fd196278e537
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Thu Oct 15 16:33:42 2020 +0200
Allow compiling with --enable-experimental-non-null.
src/game-view-gtk.vala | 12 ++++++------
src/lightsoff-window.vala | 7 +++++--
src/lightsoff.vala | 18 ++++++++----------
src/puzzle-generator.vala | 2 +-
4 files changed, 20 insertions(+), 19 deletions(-)
---
diff --git a/src/game-view-gtk.vala b/src/game-view-gtk.vala
index 1f1d10b..17babae 100644
--- a/src/game-view-gtk.vala
+++ b/src/game-view-gtk.vala
@@ -22,11 +22,11 @@ public class GtkGameView : Gtk.Stack, GameView {
}
var new_level = "level %d".printf(current_level);
- add_named (new_board as Gtk.Widget, new_level);
- set_visible_child (new_board as Gtk.Widget);
+ add_named ((Gtk.Widget)new_board, new_level);
+ set_visible_child ((Gtk.Widget)new_board);
((BoardViewGtk)old_board).playable = false;
if (Gtk.Settings.get_for_screen (((Gtk.Widget)new_board).get_screen ()).gtk_enable_animations)
- handlers.push_tail(notify["transition-running"].connect(() => board_replaced (old_board as
BoardViewGtk, new_board as BoardViewGtk)));
+ handlers.push_tail(notify["transition-running"].connect(() => board_replaced
((BoardViewGtk)old_board, (BoardViewGtk)new_board)));
else
board_replaced ((BoardViewGtk)old_board, (BoardViewGtk)new_board);
level_changed (current_level);
@@ -65,7 +65,7 @@ public class GtkGameView : Gtk.Stack, GameView {
public GtkGameView (int level)
{
- board_view = create_board_view (level) as BoardViewGtk;
+ board_view = (BoardViewGtk)create_board_view (level);
board_view.playable = true;
add (board_view);
}
@@ -79,12 +79,12 @@ public class GtkGameView : Gtk.Stack, GameView {
view.game_won.connect (() => game_won_cb());
view.light_toggled.connect (light_toggled_cb);
view.playable = false;
- return view as BoardView;
+ return (BoardView)view;
}
public BoardView get_board_view ()
{
- return board_view as BoardView;
+ return (BoardView)board_view;
}
public int next_level (int direction) {
diff --git a/src/lightsoff-window.vala b/src/lightsoff-window.vala
index e8527e6..6be2bd7 100644
--- a/src/lightsoff-window.vala
+++ b/src/lightsoff-window.vala
@@ -47,11 +47,14 @@ public class LightsoffWindow : ApplicationWindow
gtk_game_view.show ();
aspect_frame.add (gtk_game_view);
-
out_game_view = gtk_game_view;
+
var provider = new Gtk.CssProvider ();
provider.load_from_resource ("/org/gnome/LightsOff/ui/lightsoff.css");
- Gtk.StyleContext.add_provider_for_screen (Gdk.Screen.get_default (), provider,
STYLE_PROVIDER_PRIORITY_APPLICATION);
+ Gdk.Screen? gdk_screen = Gdk.Screen.get_default ();
+ if (gdk_screen != null) // else..?
+ StyleContext.add_provider_for_screen ((!) gdk_screen, provider,
STYLE_PROVIDER_PRIORITY_APPLICATION);
+
return aspect_frame;
}
diff --git a/src/lightsoff.vala b/src/lightsoff.vala
index ad2d168..43923f8 100644
--- a/src/lightsoff.vala
+++ b/src/lightsoff.vala
@@ -23,7 +23,7 @@ public class LightsOff : Gtk.Application
{ "version", 0, 0, OptionArg.NONE, ref version, "Display version number", null },
// list terminator
- { null }
+ {}
};
private const GLib.ActionEntry[] action_entries =
@@ -43,7 +43,9 @@ public class LightsOff : Gtk.Application
base.startup ();
Gtk.Window.set_default_icon_name ("org.gnome.LightsOff");
- Gtk.Settings.get_default ().set ("gtk-application-prefer-dark-theme", true);
+ Gtk.Settings? gtk_settings = Gtk.Settings.get_default ();
+ if (gtk_settings != null) // else..?
+ ((!) gtk_settings).set ("gtk-application-prefer-dark-theme", true);
add_action_entries (action_entries, this);
@@ -87,21 +89,18 @@ public class LightsOff : Gtk.Application
{
"Tim Horton",
"Robert Ancell",
- "Robert Roth",
- null
+ "Robert Roth"
};
string[] artists =
{
"Tim Horton",
- "Ulisse Perusin",
- null
+ "Ulisse Perusin"
};
string[] documenters =
{
- "Eric Baudais",
- null
+ "Eric Baudais"
};
Gtk.show_about_dialog (window,
@@ -116,8 +115,7 @@ public class LightsOff : Gtk.Application
"documenters", documenters,
"translator-credits", _("translator-credits"),
"logo-icon-name", "org.gnome.LightsOff",
- "website", "https://wiki.gnome.org/Apps/Lightsoff",
- null);
+ "website", "https://wiki.gnome.org/Apps/Lightsoff");
}
public static int main (string[] args)
diff --git a/src/puzzle-generator.vala b/src/puzzle-generator.vala
index 2f89601..1871fc4 100644
--- a/src/puzzle-generator.vala
+++ b/src/puzzle-generator.vala
@@ -59,7 +59,7 @@ public class PuzzleGenerator : Object
}
// Row-reduction over field with two elements
- List<int> non_pivot_cols = null;
+ List<int> non_pivot_cols = new List<int> ();
var ipiv = 0;
for (var jpiv = 0; jpiv < size * size; jpiv++)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]