Merge lp:~arayaq/pantheon-terminal/fix-1351898 into lp:~elementary-apps/pantheon-terminal/trunk

Proposed by Angel Araya
Status: Merged
Approved by: Cody Garver
Approved revision: 616
Merged at revision: 621
Proposed branch: lp:~arayaq/pantheon-terminal/fix-1351898
Merge into: lp:~elementary-apps/pantheon-terminal/trunk
Diff against target: 32 lines (+20/-1)
1 file modified
src/PantheonTerminalWindow.vala (+20/-1)
To merge this branch: bzr merge lp:~arayaq/pantheon-terminal/fix-1351898
Reviewer Review Type Date Requested Status
David Gomes (community) Needs Fixing
Review via email: mp+231493@code.launchpad.net

Commit message

Don't restore tabs with nonexistent paths (lp:1351898)

Description of the change

When restoring the tabs checks which paths does exist and add them, the rest goes omitted. If all the paths are nonexistent creates a single tab at HOME.

To post a comment you must log in.
Revision history for this message
Akshay Shekher (voldyman) wrote :

Good work Araya.
You should change the code style (placement of `{`) to the elementary
coding standard. It can be found on the website, opening braces are not on
a new line etc.
On Aug 20, 2014 8:42 AM, "Angel Araya" <email address hidden> wrote:

> Angel Araya has proposed merging lp:~arayaq/pantheon-terminal/fix-1351898
> into lp:pantheon-terminal.
>
> Requested reviews:
> elementary Apps team (elementary-apps)
>
> For more details, see:
>
> https://code.launchpad.net/~arayaq/pantheon-terminal/fix-1351898/+merge/231493
>
> When restoring the tabs checks which paths does exist and add them, the
> rest goes omitted. If all the paths are nonexistent creates a single tab at
> HOME.
> --
>
> https://code.launchpad.net/~arayaq/pantheon-terminal/fix-1351898/+merge/231493
> Your team elementary Apps team is requested to review the proposed merge
> of lp:~arayaq/pantheon-terminal/fix-1351898 into lp:pantheon-terminal.
>
> === modified file 'src/PantheonTerminalWindow.vala'
> --- src/PantheonTerminalWindow.vala 2014-08-09 17:05:43 +0000
> +++ src/PantheonTerminalWindow.vala 2014-08-20 03:11:15 +0000
> @@ -407,8 +407,35 @@
> if (tabs.length == 0) {
> new_tab ();
> } else {
> - foreach (string loc in tabs) {
> - new_tab (loc);
> +
> + /* Check wether the dir exists (LP #1351898) */
> + int null_dirs = 0;
> + for (int i = 0; i < tabs.length; i++)
> + {
> + File file = File.new_for_path (tabs[i]);
> + if (file.query_exists () == false)
> + {
> + null_dirs++;
> + tabs[i] = "";
> + }
> +
> + if (null_dirs == tabs.length)
> + {
> + tabs[0] = "~";
> + }
> + }
> +
> + foreach (string loc in tabs)
> + {
> +
> + if (loc == "")
> + {
> + continue;
> + }
> + else
> + {
> + new_tab (loc);
> + }
> }
> }
> } else {
>
>
>

615. By Angel Araya

Fixed code style

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

Remove diff line number 29 as well as the Launchpad reference on that comment.

review: Needs Fixing
616. By Angel Araya

More code style fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/PantheonTerminalWindow.vala'
2--- src/PantheonTerminalWindow.vala 2014-08-09 17:05:43 +0000
3+++ src/PantheonTerminalWindow.vala 2014-08-20 14:43:39 +0000
4@@ -407,8 +407,27 @@
5 if (tabs.length == 0) {
6 new_tab ();
7 } else {
8+
9+ int null_dirs = 0;
10+ for (int i = 0; i < tabs.length; i++) {
11+ File file = File.new_for_path (tabs[i]);
12+
13+ if (file.query_exists () == false) {
14+ null_dirs++;
15+ tabs[i] = "";
16+ }
17+
18+ if (null_dirs == tabs.length) {
19+ tabs[0] = "~";
20+ }
21+ }
22+
23 foreach (string loc in tabs) {
24- new_tab (loc);
25+
26+ if (loc == "")
27+ continue;
28+ else
29+ new_tab (loc);
30 }
31 }
32 } else {

Subscribers

People subscribed via source and target branches