[latexila] Build tool dialog: the UI for opening files



commit d8c3a9307eb22c78b613caeb65063a41352e137a
Author: SÃbastien Wilmet <swilmet src gnome org>
Date:   Fri Jul 13 02:08:00 2012 +0200

    Build tool dialog: the UI for opening files
    
    Currently, the "$view" placeholder is used to open files. xdg-open is
    used for that, but the plan is to use gtk_show_uri(). It would have been
    possible to keep the $view placeholder, analyze the commands and execute
    gtk_show_uri() when we see a $view. But the problem is that the Post
    Processor is not used when gtk_show_uri() is called. A solution would be
    to make the post processor insensitive when $view is present in the
    command. But I don't like this.
    
    With this commit, it is IMHO easier: first, the build jobs (the
    commands) are executed. And if all the commands succeed, then the
    specified files are opened.
    
    It is not useful to open a file before executing a command. But if the
    user wants absolutely do that, it is still possible to add a command
    with xdg-open or another application's name.
    
    So there is clearly a distinction between executing a command, and
    opening a file.

 src/build_tool_dialog.vala |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/src/build_tool_dialog.vala b/src/build_tool_dialog.vala
index 4c93047..cddf972 100644
--- a/src/build_tool_dialog.vala
+++ b/src/build_tool_dialog.vala
@@ -50,6 +50,7 @@ private class BuildToolDialog : Dialog
     private Entry _entry_label;
     private Entry _entry_desc;
     private Entry _entry_extensions;
+    private Entry _entry_files_to_open;
 
     private ListStore _icons_store;
     private ComboBox _icons_combobox;
@@ -148,6 +149,7 @@ private class BuildToolDialog : Dialog
         _entry_label = new Entry ();
         _entry_desc = new Entry ();
         _entry_extensions = new Entry ();
+        _entry_files_to_open = new Entry ();
     }
 
     private void init_icons_store ()
@@ -419,6 +421,7 @@ private class BuildToolDialog : Dialog
         _entry_label.text = "";
         _entry_desc.text = "";
         _entry_extensions.text = "";
+        _entry_files_to_open.text = "";
 
         _icons_combobox.set_active (0);
 
@@ -433,6 +436,7 @@ private class BuildToolDialog : Dialog
         _entry_label.text = build_tool.label;
         _entry_desc.text = build_tool.description;
         _entry_extensions.text = build_tool.extensions;
+        _entry_files_to_open.text = "";
 
         /* Icon */
 
@@ -554,6 +558,7 @@ private class BuildToolDialog : Dialog
         main_grid.attach (get_extensions_grid (), 0, 1, 1, 1);
         main_grid.attach (get_icons_grid (), 1, 1, 1, 1);
         main_grid.attach (get_jobs_grid (), 0, 2, 2, 1);
+        main_grid.attach (get_files_to_open_grid (), 0, 3, 2, 1);
 
         return main_grid;
     }
@@ -620,16 +625,12 @@ private class BuildToolDialog : Dialog
             _("The active document's filename without its extension.") + "\n" +
             _("If the active document belongs to a project, the main file is choosen."));
 
-        Label placeholder_view = new Label ("$view");
-        placeholder_view.set_tooltip_text (_("The program for viewing documents"));
-
         Grid placeholders_grid = new Grid ();
         placeholders_grid.set_orientation (Orientation.HORIZONTAL);
         placeholders_grid.set_column_spacing (10);
         placeholders_grid.add (placeholders);
         placeholders_grid.add (placeholder_filename);
         placeholders_grid.add (placeholder_shortname);
-        placeholders_grid.add (placeholder_view);
 
         /* Jobs tree view */
 
@@ -637,7 +638,7 @@ private class BuildToolDialog : Dialog
 
         ScrolledWindow scrolled_window =
             Utils.add_scrollbar (_jobs_view) as ScrolledWindow;
-        scrolled_window.set_size_request (600, 110);
+        scrolled_window.set_size_request (600, 80);
         scrolled_window.set_shadow_type (ShadowType.IN);
 
         StyleContext context = scrolled_window.get_style_context ();
@@ -669,4 +670,15 @@ private class BuildToolDialog : Dialog
 
         return Utils.get_dialog_component (_("Jobs"), jobs_grid);
     }
+
+    private Grid get_files_to_open_grid ()
+    {
+        _entry_files_to_open.set_tooltip_text (
+            _("List of files to open after executing the build jobs.") + "\n" +
+            _("The files are separated by spaces.") + "\n" +
+            _("You should use the placeholders to specify the files."));
+
+        _entry_files_to_open.hexpand = true;
+        return Utils.get_dialog_component (_("Files to open"), _entry_files_to_open);
+    }
 }



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