[gnome-calculator] Better handle GtkSourceView API break



commit 35b86380dc9b1f4d59b9ba91c35ba9472f4a61ea
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sun Oct 26 15:27:15 2014 -0500

    Better handle GtkSourceView API break
    
    Use the return value instead of weird hacks to see if this succeeded or
    not; this is identical to Evan Nemerson's original patch.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=738896

 src/math-display.vala |   20 ++------------------
 1 files changed, 2 insertions(+), 18 deletions(-)
---
diff --git a/src/math-display.vala b/src/math-display.vala
index a4b3f57..863f817 100644
--- a/src/math-display.vala
+++ b/src/math-display.vala
@@ -485,17 +485,9 @@ public class FunctionCompletionProvider : CompletionProvider
 
     public override void populate (Gtk.SourceCompletionContext context)
     {
-        Gtk.TextIter emptyiter = {};
-
         Gtk.TextIter iter1;
-        context.get_iter (out iter1);
-        // This check is based on the assumption/knowledge
-        // that vala nulls the iter before passing at as a reference.
-        // The gtksourceview api has no way to signal error.
-        if (iter1 == emptyiter)
-        {
+        if (!context.get_iter (out iter1))
             return;
-        }
 
         Gtk.TextBuffer text_buffer = iter1.get_buffer ();
         MathFunction[] functions = get_matches_for_completion_at_cursor (text_buffer);
@@ -548,17 +540,9 @@ public class VariableCompletionProvider : CompletionProvider
 
     public override void populate (Gtk.SourceCompletionContext context)
     {
-        Gtk.TextIter emptyiter = {};
-
         Gtk.TextIter iter1;
-        context.get_iter (out iter1);
-        // This check is based on the assumption/knowledge
-        // that vala nulls the iter before passing at as a reference.
-        // The gtksourceview api has no way to signal error.
-        if (iter1 == emptyiter)
-        {
+        if (!context.get_iter (out iter1))
             return;
-        }
 
         Gtk.TextBuffer text_buffer = iter1.get_buffer ();
         string[] variables = get_matches_for_completion_at_cursor (text_buffer, _equation.variables);


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