[gtksourceview] Completion: continue the clean-up



commit 127733f9c4e73da3c0690ad41597eca18c89180d
Author: SÃbastien Wilmet <swilmet gnome org>
Date:   Sun Feb 17 23:21:12 2013 +0100

    Completion: continue the clean-up

 gtksourceview/gtksourcecompletion.c |   27 +++++++--------------------
 1 files changed, 7 insertions(+), 20 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index 14f8355..385de40 100644
--- a/gtksourceview/gtksourcecompletion.c
+++ b/gtksourceview/gtksourcecompletion.c
@@ -4,6 +4,7 @@
  *
  * Copyright (C) 2007 -2009 JesÃs Barbero RodrÃguez <chuchiperriman gmail com>
  * Copyright (C) 2009 - Jesse van den Kieboom <jessevdk gnome org>
+ * Copyright (C) 2013 - SÃbastien Wilmet <swilmet gnome org>
  *
  * GtkSourceView is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -380,17 +381,8 @@ scroll_to_iter (GtkSourceCompletion *completion,
                 GtkTreeIter         *iter)
 {
        GtkTreePath *path;
-       GtkTreeModel *model;
-
-       model = gtk_tree_view_get_model (GTK_TREE_VIEW (completion->priv->tree_view_proposals));
-
-       if (model == NULL)
-       {
-               return;
-       }
 
-       path = gtk_tree_model_get_path (GTK_TREE_MODEL (completion->priv->model_proposals),
-                                       iter);
+       path = gtk_tree_model_get_path (GTK_TREE_MODEL (completion->priv->model_proposals), iter);
 
        gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (completion->priv->tree_view_proposals),
                                      path,
@@ -1264,7 +1256,7 @@ static void
 check_first_selected (GtkSourceCompletion *completion)
 {
        GtkTreeSelection *selection;
-       GtkTreeIter piter;
+       GtkTreeIter iter;
        GtkTreeIter first;
        GtkTreeModel *model;
 
@@ -1282,17 +1274,17 @@ check_first_selected (GtkSourceCompletion *completion)
                return;
        }
 
-       piter = first;
+       iter = first;
 
-       while (gtk_source_completion_model_iter_is_header (completion->priv->model_proposals, &piter))
+       while (gtk_source_completion_model_iter_is_header (completion->priv->model_proposals, &iter))
        {
-               if (!gtk_tree_model_iter_next (model, &piter))
+               if (!gtk_tree_model_iter_next (model, &iter))
                {
                        return;
                }
        }
 
-       gtk_tree_selection_select_iter (selection, &piter);
+       gtk_tree_selection_select_iter (selection, &iter);
        scroll_to_iter (completion, &first);
 }
 
@@ -1997,11 +1989,6 @@ gtk_source_completion_show_default (GtkSourceCompletion *completion)
 
        gtk_widget_show (GTK_WIDGET (completion->priv->main_window));
        gtk_widget_grab_focus (GTK_WIDGET (completion->priv->view));
-
-       if (completion->priv->select_on_show)
-       {
-               select_first_proposal (completion);
-       }
 }
 
 static void


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