[dconf-editor] Nullable and non-nullable tweaks.



commit 764f6b3516665a4ec31d9106b3968582d2db91b8
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Mon Apr 25 03:00:58 2016 +0200

    Nullable and non-nullable tweaks.

 editor/dconf-editor.vala |    4 +++-
 editor/dconf-view.vala   |    4 ++--
 editor/dconf-window.vala |    9 ++++++---
 3 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/editor/dconf-editor.vala b/editor/dconf-editor.vala
index 5060b04..fc4c863 100644
--- a/editor/dconf-editor.vala
+++ b/editor/dconf-editor.vala
@@ -77,7 +77,9 @@ class ConfigurationEditor : Gtk.Application
 
         Gtk.CssProvider css_provider = new Gtk.CssProvider ();
         css_provider.load_from_resource ("/ca/desrt/dconf-editor/ui/dconf-editor.css");
-        Gtk.StyleContext.add_provider_for_screen (Gdk.Screen.get_default (), css_provider, 
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
+        Gdk.Screen? screen = Gdk.Screen.get_default ();
+        return_if_fail (screen != null);
+        Gtk.StyleContext.add_provider_for_screen ((!) screen, css_provider, 
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
 
         add_window (new DConfWindow ());
     }
diff --git a/editor/dconf-view.vala b/editor/dconf-view.vala
index c8e39f4..2b5bd25 100644
--- a/editor/dconf-view.vala
+++ b/editor/dconf-view.vala
@@ -217,7 +217,7 @@ private class KeyEditorNoSchema : KeyEditorDialog       // TODO add type informa
 
         this.title = key.name;
         if (this.use_header_bar == 1)        // TODO else..?
-            ((HeaderBar) this.get_header_bar ()).subtitle = key.parent.full_name;   // TODO get_header_bar() 
is [transfer none]
+            ((HeaderBar) this.get_header_bar ()).subtitle = ((!) key.parent).full_name;   // TODO 
get_header_bar() is [transfer none]
 
         Widget _key_editor_child = create_child ((Key) _key);
         grid.attach (_key_editor_child, 1, 1, 1, 1);
@@ -261,7 +261,7 @@ private class KeyEditor : KeyEditorDialog
 
         this.title = key.name;
         if (this.use_header_bar == 1)        // TODO else..?
-            ((HeaderBar) this.get_header_bar ()).subtitle = key.parent.full_name;   // TODO get_header_bar() 
is [transfer none]
+            ((HeaderBar) this.get_header_bar ()).subtitle = ((!) key.parent).full_name;   // TODO 
get_header_bar() is [transfer none]
 
         Widget _key_editor_child = create_child ((Key) key);
         grid.attach (_key_editor_child, 1, 6, 1, 1);
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index 70cc525..cc2ce4a 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -248,11 +248,14 @@ class DConfWindow : ApplicationWindow
         reset_generic (key_model, true);
     } */
 
-    private void reset_generic (GLib.ListStore objects, bool recursively)
+    private void reset_generic (GLib.ListStore? objects, bool recursively)
     {
+        if (objects == null)
+            return;
+
         for (uint position = 0;; position++)
         {
-            Object? object = objects.get_object (position);
+            Object? object = ((!) objects).get_object (position);
             if (object == null)
                 return;
 
@@ -272,7 +275,7 @@ class DConfWindow : ApplicationWindow
     [GtkCallback]
     private bool on_key_press_event (Widget widget, Gdk.EventKey event)     // TODO better?
     {
-        string name = Gdk.keyval_name (event.keyval);
+        string name = Gdk.keyval_name (event.keyval) ?? "";
 
         if ((event.state & Gdk.ModifierType.CONTROL_MASK) != 0)
         {


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