Merge lp:~voldyman/pantheon-terminal/opt-e-fix into lp:~elementary-apps/pantheon-terminal/trunk

Proposed by Akshay Shekher
Status: Merged
Approved by: David Gomes
Approved revision: 458
Merged at revision: 459
Proposed branch: lp:~voldyman/pantheon-terminal/opt-e-fix
Merge into: lp:~elementary-apps/pantheon-terminal/trunk
Diff against target: 91 lines (+36/-20)
1 file modified
src/PantheonTerminal.vala (+36/-20)
To merge this branch: bzr merge lp:~voldyman/pantheon-terminal/opt-e-fix
Reviewer Review Type Date Requested Status
David Gomes (community) Approve
Raphael Isemann (community) Approve
Review via email: mp+152558@code.launchpad.net

Description of the change

the old implementation of terminal caused an error, when the terminal was running and another terminal was launched using any parameter, terminal ignored it but this branch fixes that.

To post a comment you must log in.
Revision history for this message
David Gomes (davidgomes) wrote :

It didn't work for me. I merged, built and installed. I launched pantheon-terminal.

From inside pantheon-terminal I ran "pantheon-terminal -e chromium" and it didn't work. So, without an already-opened instance, I tried (from another terminal emulator) the same thing and it didn't work either.

So I re-branched pantheon-terminal from trunk and tried "pantheon-terminal -e chromium" from another terminal emulator and it also didn't work.

Very, very strange behavior, I remember this working perfectly.

Revision history for this message
Raphael Isemann (teemperor) wrote :

Fix works here. Feel free to merge it.

review: Approve
Revision history for this message
David Gomes (davidgomes) wrote :

Sorry that it took so long, but only now did I manage to test it.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/PantheonTerminal.vala'
2--- src/PantheonTerminal.vala 2013-03-04 17:26:46 +0000
3+++ src/PantheonTerminal.vala 2013-03-09 12:42:22 +0000
4@@ -44,6 +44,7 @@
5 public int minimum_height;
6
7 construct {
8+ flags |= ApplicationFlags.HANDLES_COMMAND_LINE;
9 print_version = false;
10 build_data_dir = Constants.DATADIR;
11 build_pkg_data_dir = Constants.PKGDATADIR;
12@@ -90,13 +91,44 @@
13 warning (e.message);
14 }
15 }
16-
17+ }
18+
19+ private int _command_line (ApplicationCommandLine command_line) {
20+ var context = new OptionContext ("File");
21+ context.add_main_entries (entries, "pantheon-terminal");
22+ context.add_group (Gtk.get_option_group (true));
23+
24+ string[] args = command_line.get_arguments ();
25+
26+ try {
27+ unowned string[] tmp = args;
28+ context.parse (ref tmp);
29+ } catch (Error e) {
30+ stdout.printf ("pantheon-terminal: ERROR: " + e.message + "\n");
31+ return 0;
32+ }
33+
34+ if (print_version) {
35+ stdout.printf ("Pantheon Terminal %s\n", Constants.VERSION);
36+ stdout.printf ("Copyright 2011-2012 Terminal Developers.\n");
37+ return 0;
38+ }
39 if (command_e != null) {
40 new_window_with_programs (command_e);
41- return;
42+ return 0;
43 }
44 new_window ();
45- }
46+ return 0;
47+ }
48+
49+ public override int command_line (ApplicationCommandLine command_line) {
50+ // keep the application running until we are done with this commandline
51+ this.hold ();
52+ int res = _command_line (command_line);
53+ this.release ();
54+ return res;
55+ }
56+
57
58 public void new_window () {
59 var window = new PantheonTerminalWindow (this);
60@@ -135,6 +167,7 @@
61 }
62 return null;
63 }
64+
65 static const OptionEntry[] entries = {
66 { "shell", 's', 0, OptionArg.STRING, ref app_shell_name, N_("Set shell at launch"), "" },
67 { "version", 'v', 0, OptionArg.NONE, out print_version, N_("Print version info and exit"), null },
68@@ -144,23 +177,6 @@
69
70 public static int main (string[] args) {
71 app_cmd_name = "Pantheon Terminal";
72-
73- var context = new OptionContext ("File");
74- context.add_main_entries (entries, "pantheon-terminal");
75- context.add_group (Gtk.get_option_group (true));
76-
77- try {
78- context.parse (ref args);
79- } catch (Error e) {
80- stdout.printf ("pantheon-terminal: ERROR: " + e.message + "\n");
81- return 0;
82- }
83-
84- if (print_version) {
85- stdout.printf ("Pantheon Terminal %s\n", Constants.VERSION);
86- stdout.printf ("Copyright 2011-2012 Terminal Developers.\n");
87- return 0;
88- }
89 var app = new PantheonTerminalApp ();
90 return app.run (args);
91 }

Subscribers

People subscribed via source and target branches