[gedit] GeditDocument: simplify goto_line()



commit 12589625d93654a02bff145e1253788d9a148d93
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Oct 18 12:23:34 2015 +0200

    GeditDocument: simplify goto_line()
    
    gtk_text_buffer_get_iter_at_line() has been fixed and now returns a
    value, so the code can be simplified.

 README                 |    2 +-
 configure.ac           |    4 ++--
 gedit/gedit-document.c |   20 ++++----------------
 3 files changed, 7 insertions(+), 19 deletions(-)
---
diff --git a/README b/README
index b9c96d9..bc0f604 100644
--- a/README
+++ b/README
@@ -64,7 +64,7 @@ Information about gedit mailing lists can be found at
 Installation
 ============
 
-gedit requires GTK+ >= 3.16, GtkSourceView >= 3.17.3 and
+gedit requires GTK+ >= 3.19.0, GtkSourceView >= 3.18 and
 libpeas >= 1.14.1 libraries. It also has a run-time dependency on an
 icon theme for its icons. If gedit fails to display icons, installing
 GNOME's default adwaita-icon-theme is a simple way of providing them.
diff --git a/configure.ac b/configure.ac
index 3320fdb..cabb10c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,8 +18,8 @@ AC_SUBST(GEDIT_API_VERSION)
 
 # Dependencies
 GLIB_REQUIRED=2.44
-GTK_REQUIRED=3.16
-GTKSOURCEVIEW_REQUIRED=3.17.3
+GTK_REQUIRED=3.19.0
+GTKSOURCEVIEW_REQUIRED=3.18
 LIBPEAS_REQUIRED=1.14.1
 LIBXML_REQUIRED=2.5.0
 ENCHANT_REQUIRED=1.2.0
diff --git a/gedit/gedit-document.c b/gedit/gedit-document.c
index 2445eeb..56fffbe 100644
--- a/gedit/gedit-document.c
+++ b/gedit/gedit-document.c
@@ -1474,29 +1474,17 @@ gboolean
 gedit_document_goto_line (GeditDocument *doc,
                          gint           line)
 {
-       gboolean ret = TRUE;
-       guint line_count;
        GtkTextIter iter;
+       gboolean ret;
 
        gedit_debug (DEBUG_DOCUMENT);
 
        g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), FALSE);
        g_return_val_if_fail (line >= -1, FALSE);
 
-       line_count = gtk_text_buffer_get_line_count (GTK_TEXT_BUFFER (doc));
-
-       if (line >= line_count)
-       {
-               ret = FALSE;
-               gtk_text_buffer_get_end_iter (GTK_TEXT_BUFFER (doc),
-                                             &iter);
-       }
-       else
-       {
-               gtk_text_buffer_get_iter_at_line (GTK_TEXT_BUFFER (doc),
-                                                 &iter,
-                                                 line);
-       }
+       ret = gtk_text_buffer_get_iter_at_line (GTK_TEXT_BUFFER (doc),
+                                               &iter,
+                                               line);
 
        gtk_text_buffer_place_cursor (GTK_TEXT_BUFFER (doc), &iter);
 


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