Merge lp:~jeremywootten/pantheon-files/fix-1585736-empty-trash-subfolder-message into lp:~elementary-apps/pantheon-files/trunk

Proposed by Jeremy Wootten
Status: Merged
Merged at revision: 2172
Proposed branch: lp:~jeremywootten/pantheon-files/fix-1585736-empty-trash-subfolder-message
Merge into: lp:~elementary-apps/pantheon-files/trunk
Diff against target: 75 lines (+18/-23)
2 files modified
src/View/AbstractDirectoryView.vala (+1/-10)
src/View/Slot.vala (+17/-13)
To merge this branch: bzr merge lp:~jeremywootten/pantheon-files/fix-1585736-empty-trash-subfolder-message
Reviewer Review Type Date Requested Status
elementary Apps team Pending
Review via email: mp+296004@code.launchpad.net

Commit message

Correct empty message for trash subfolder (lp 1585736)

Description of the change

Give correct empty message when in a trash sub-folder.
Remove code duplication in determining correct empty message.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/View/AbstractDirectoryView.vala'
2--- src/View/AbstractDirectoryView.vala 2016-05-27 16:29:19 +0000
3+++ src/View/AbstractDirectoryView.vala 2016-05-29 14:58:50 +0000
4@@ -2990,16 +2990,7 @@
5 if (!style_context.has_class (MESSAGE_CLASS))
6 style_context.add_class (MESSAGE_CLASS);
7
8-
9- if (slot.directory.permission_denied) {
10- layout.set_markup (slot.denied_message, -1);
11- } else if (slot.directory.is_trash) {
12- layout.set_markup (slot.empty_trash_message, -1);
13- } else if (slot.directory.is_recent) {
14- layout.set_markup (slot.empty_recents_message, -1);
15- } else {
16- layout.set_markup (slot.empty_message, -1);
17- }
18+ layout.set_markup (slot.get_empty_message (), -1);
19
20 Pango.Rectangle? extents = null;
21 layout.get_extents (null, out extents);
22
23=== modified file 'src/View/Slot.vala'
24--- src/View/Slot.vala 2016-05-13 19:51:34 +0000
25+++ src/View/Slot.vala 2016-05-29 14:58:50 +0000
26@@ -36,10 +36,10 @@
27 get {return ctab.window;}
28 }
29
30- public string empty_message = _("This Folder Is Empty");
31- public string empty_trash_message = _("Trash Is Empty");
32- public string empty_recents_message = _("There Are No Recent Files");
33- public string denied_message = _("Access Denied");
34+ private const string EMPTY_MESSAGE = _("This Folder Is Empty");
35+ private const string EMPTY_TRASH_MESSAGE = _("Trash Is Empty");
36+ private const string EMPTY_RECENT_MESSAGE = _("There Are No Recent Files");
37+ private const string DENIED_MESSAGE = _("Access Denied");
38
39 public override bool locked_focus {
40 get {
41@@ -222,15 +222,7 @@
42 Pango.Layout layout = dir_view.create_pango_layout (null);
43
44 if (directory.is_empty ()) { /* No files in the file cache */
45- if (directory.permission_denied) {
46- layout.set_markup (denied_message, -1);
47- } else if (directory.is_trash) {
48- layout.set_markup (empty_trash_message, -1);
49- } else if (directory.is_recent) {
50- layout.set_markup (empty_recents_message, -1);
51- } else {
52- layout.set_markup (empty_message, -1);
53- }
54+ layout.set_markup (get_empty_message (), -1);
55 } else {
56 layout.set_markup (GLib.Markup.escape_text (directory.longest_file_name), -1);
57 }
58@@ -426,5 +418,17 @@
59 id = 0;
60 }
61 }
62+
63+ public string get_empty_message () {
64+ string msg = EMPTY_MESSAGE;
65+ if (directory.is_recent) {
66+ msg = EMPTY_RECENT_MESSAGE;
67+ } else if (directory.is_trash && (uri == Marlin.TRASH_URI + Path.DIR_SEPARATOR_S)) {
68+ msg = EMPTY_TRASH_MESSAGE;
69+ } else if (directory.permission_denied) {
70+ msg = DENIED_MESSAGE;
71+ }
72+ return msg;
73+ }
74 }
75 }

Subscribers

People subscribed via source and target branches

to all changes: