[latexila/wip/latexila-next: 54/55] Connect to the LatexilaBuildView::jump-to-file signal



commit f230a403fa9b5f9b329b4ee963a48c3d7f78e0c8
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed Sep 17 20:17:25 2014 +0200

    Connect to the LatexilaBuildView::jump-to-file signal

 src/liblatexila/latexila-build-view.c |    2 +-
 src/liblatexila/latexila-build-view.h |    2 +-
 src/main_window_build_tools.vala      |    8 ++++++++
 3 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/liblatexila/latexila-build-view.c b/src/liblatexila/latexila-build-view.c
index e196b47..ec6b7b7 100644
--- a/src/liblatexila/latexila-build-view.c
+++ b/src/liblatexila/latexila-build-view.c
@@ -368,7 +368,7 @@ latexila_build_view_class_init (LatexilaBuildViewClass *klass)
    * selected. The row must contain a file, otherwise the signal is not emitted.
    * The file should be opened and presented to the user. If @start_line and
    * @end_line are not -1, jump to the @start_line and select those lines. If
-   * only @start_line is provided, jump to it and select it.
+   * @start_line is provided, @end_line is also provided (different than -1).
    */
   signals[SIGNAL_JUMP_TO_FILE] = g_signal_new ("jump-to-file",
                                                LATEXILA_TYPE_BUILD_VIEW,
diff --git a/src/liblatexila/latexila-build-view.h b/src/liblatexila/latexila-build-view.h
index 10594b2..92b2ed6 100644
--- a/src/liblatexila/latexila-build-view.h
+++ b/src/liblatexila/latexila-build-view.h
@@ -84,7 +84,7 @@ typedef enum
  * A build message, one line in the #GtkTreeView. If a @filename is provided,
  * the file will be opened when the user clicks on the message. If @start_line
  * and @end_line are provided, the lines between the two positions will be
- * selected (or just @start_line will be selected if @end_line is -1).
+ * selected.
  *
  * The @expand field assumes that a #LatexilaBuildMsg is included in a #GNode or
  * similar N-ary tree structure.
diff --git a/src/main_window_build_tools.vala b/src/main_window_build_tools.vala
index 8456c2e..e67fc78 100644
--- a/src/main_window_build_tools.vala
+++ b/src/main_window_build_tools.vala
@@ -102,6 +102,14 @@ public class MainWindowBuildTools
     {
         _build_view = build_view;
         connect_toggle_actions ();
+
+        _build_view.jump_to_file.connect ((file, start_line, end_line) =>
+        {
+            if (start_line == -1)
+                _main_window.open_document (file);
+            else
+                _main_window.jump_to_file_position (file, start_line - 1, end_line -1);
+        });
     }
 
     public void set_bottom_panel (BottomPanel bottom_panel)


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