After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 746615 - Add a button in the file browsing panel to open a terminal
Add a button in the file browsing panel to open a terminal
Status: RESOLVED FIXED
Product: gnome-latex
Classification: Other
Component: general
3.15.x
Other Linux
: Normal enhancement
: unspecified
Assigned To: LaTeXila maintainer(s)
LaTeXila maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2015-03-22 18:21 UTC by arno_b
Modified: 2015-03-25 19:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
A first patch (3.60 KB, patch)
2015-03-22 21:19 UTC, arno_b
none Details | Review
A second path (3.00 KB, patch)
2015-03-25 08:00 UTC, arno_b
none Details | Review

Description arno_b 2015-03-22 18:21:43 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
Comment 1 Sébastien Wilmet 2015-03-22 20:18:24 UTC
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.
Comment 2 arno_b 2015-03-22 21:19:07 UTC
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)
Comment 3 arno_b 2015-03-22 21:21:18 UTC
The patch is against origin/wip/latexila-next
Comment 4 Sébastien Wilmet 2015-03-24 19:42:23 UTC
--working-directory for xfce4-terminal too:
http://manpages.ubuntu.com/manpages/trusty/en/man1/xfce4-terminal.1.html
Comment 5 Sébastien Wilmet 2015-03-24 19:53:44 UTC
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.
Comment 6 arno_b 2015-03-25 08:00:20 UTC
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.
Comment 7 Sébastien Wilmet 2015-03-25 19:38:02 UTC
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!