Merge lp:~darcy-develin/scratch/fix-1046534 into lp:~elementary-apps/scratch/scratch

Proposed by Darcy Luís Neves Brás da Silva
Status: Merged
Merged at revision: 867
Proposed branch: lp:~darcy-develin/scratch/fix-1046534
Merge into: lp:~elementary-apps/scratch/scratch
Diff against target: 30 lines (+12/-2)
1 file modified
src/Scratch.vala (+12/-2)
To merge this branch: bzr merge lp:~darcy-develin/scratch/fix-1046534
Reviewer Review Type Date Requested Status
Cody Garver (community) Approve
Review via email: mp+123164@code.launchpad.net

Description of the change

fix bug #1046534 by using a File to get a display_name that is appropriate for presentation opposed to the original one that is still encoded as uri

To post a comment you must log in.
Revision history for this message
Cody Garver (codygarver) wrote :

Approved on the ML by mefrio.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Scratch.vala'
2--- src/Scratch.vala 2012-08-07 14:20:48 +0000
3+++ src/Scratch.vala 2012-09-06 20:39:21 +0000
4@@ -127,14 +127,24 @@
5 }
6 }
7
8+ /* Is not open
9+ * filename is still encoded as uri, so a file is created
10+ * to extract a decoded version/display_name
11+ */
12+
13+ var f = File.new_for_uri(filename);
14+ string decoded_filename = f.query_info(FileAttribute.STANDARD_DISPLAY_NAME, FileQueryInfoFlags.NONE).get_display_name();
15+ f.unref();
16+
17 current_directory = Path.get_dirname (filename);
18- var document = new Document(filename, window);
19+ /* use the decoded version for presentation */
20+ var document = new Document(decoded_filename, window);
21 document.create_sourceview ();
22 documents.append (document);
23 document.closed.connect( (doc) => { documents.remove(doc); });
24 document.tab.make_backup ();
25 window.current_notebook.set_tab ();
26- window.set_window_title (filename);
27+ window.set_window_title (decoded_filename);
28 return document;
29
30 }

Subscribers

People subscribed via source and target branches