GNOME Bugzilla – Bug 746615
Add a button in the file browsing panel to open a terminal
Last modified: 2015-03-25 19:38:02 UTC
It would be nice if Latexila can have a button in the file browsing panel to open a terminal. Gedit currently launches a terminal by directly calling gnome-terminal: gnome-terminal --working-directory="$GEDIT_CURRENT_DOCUMENT_DIR" & https://github.com/GNOME/gedit/blob/08e85c5a43ce9b296e804b0af9bda604df1a244b/plugins/externaltools/data/open-terminal-here.tool.in
There is a GSettings key for the default terminal: $ gsettings get org.gnome.desktop.default-applications.terminal exec But I don't know if the --working-directory argument is available for other terminals. To launch the command, a GSubprocess is probably the easiest. Or maybe a GAppInfo can be used.
Created attachment 300093 [details] [review] A first patch Here is an initial patch. Indeed, I use gsettings to get the terminal command. The option "--working-directory" is the same for at least gnome-terminal, terminator (http://linux.die.net/man/1/terminator), lxterminal (http://manpages.ubuntu.com/manpages/lucid/man1/lxterminal.1.html). For Konsole it is "--workdir" (http://manpages.ubuntu.com/manpages/hardy/man1/konsole.1.html)
The patch is against origin/wip/latexila-next
--working-directory for xfce4-terminal too: http://manpages.ubuntu.com/manpages/trusty/en/man1/xfce4-terminal.1.html
Review of attachment 300093 [details] [review]: The code looks good, but the formatting isn't right. Spaces should be used for indentation, not tabs. ::: src/file_browser.vala @@ +52,3 @@ private GLib.Settings _settings; private GLib.Settings _latex_settings; + private GLib.Settings _terminal_settings; If the GSettings is used only in one function it can be created in the function instead. In latexila it's not always done like that, due to old code etc. @@ +306,3 @@ + new Gtk.MenuItem.with_label (_("Open directory")); + open_directory.tooltip_text = + _("Open the directory in a file manager"); I think I changed this string with "current directory". Because when a directory is selected in the file browser, is it this directory that is opened or the current one displayed? @@ +315,3 @@ { + Latexila.utils_show_uri(this.get_screen (), + _current_directory.get_uri (), Gdk.CURRENT_TIME); In Vala (in latexila) the indentation is generally not aligned on the parenthesis. Just one more indentation level than the previous line.
Created attachment 300256 [details] [review] A second path Here is a new patch. I carefully looked at the indentation (normally only spaces are used now). I modified the string to use "current directory" instead of "directory" as it should be.
Commit pushed with a few changes: https://git.gnome.org/browse/latexila/commit/?h=wip/latexila-next&id=ae10f09380f8c9505133407158b55fa50873294e This will be really useful, thanks!