Merge lp:~kamstrup/unity-lens-files/bookmarks-handling into lp:unity-lens-files

Proposed by Mikkel Kamstrup Erlandsen
Status: Merged
Merged at revision: 194
Proposed branch: lp:~kamstrup/unity-lens-files/bookmarks-handling
Merge into: lp:unity-lens-files
Diff against target: 73 lines (+29/-4)
2 files modified
src/daemon.vala (+3/-2)
src/folder.vala (+26/-2)
To merge this branch: bzr merge lp:~kamstrup/unity-lens-files/bookmarks-handling
Reviewer Review Type Date Requested Status
Michal Hruby (community) Approve
Review via email: mp+77508@code.launchpad.net

Description of the change

Open FTP bookmarks in the default handler for inode/directory. This makes FTP bookmarks open in Nautilus. Note this only applies on *bookmarks*. Incidentally this also fixes automounting of remote shares (except in the cases where GIO b0rks it (FTP works well, SSH not so much))

To post a comment you must log in.
Revision history for this message
Michal Hruby (mhr3) wrote :

> if (launcher == null)

I think we should fallback here to opening it via default handler for the uri scheme.

review: Needs Fixing
Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

Fallback is handled in:

18 + if (!bookmarks.launch_if_bookmark (uri))
19 + AppInfo.launch_default_for_uri (uri, null);

194. By Mikkel Kamstrup Erlandsen

Let errors from bookmark launching bubble up to the main activation handler

Revision history for this message
Michal Hruby (mhr3) wrote :

Very well then, let's have some error dialogs :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/daemon.vala'
--- src/daemon.vala 2011-09-29 11:44:16 +0000
+++ src/daemon.vala 2011-09-29 12:09:23 +0000
@@ -650,7 +650,7 @@
650 {650 {
651 results_model.append (bookmark.uri, bookmark.icon, category,651 results_model.append (bookmark.uri, bookmark.icon, category,
652 bookmark.mimetype, bookmark.display_name,652 bookmark.mimetype, bookmark.display_name,
653 bookmark.uri);653 bookmark.dnd_uri);
654 }654 }
655 }655 }
656656
@@ -713,7 +713,8 @@
713 {713 {
714 debug (@"Activating: $uri");714 debug (@"Activating: $uri");
715 try {715 try {
716 AppInfo.launch_default_for_uri (uri, null);716 if (!bookmarks.launch_if_bookmark (uri))
717 AppInfo.launch_default_for_uri (uri, null);
717 return new Unity.ActivationResponse(Unity.HandledType.HIDE_DASH);718 return new Unity.ActivationResponse(Unity.HandledType.HIDE_DASH);
718 } catch (GLib.Error error) {719 } catch (GLib.Error error) {
719 warning ("Failed to launch URI %s", uri);720 warning ("Failed to launch URI %s", uri);
720721
=== modified file 'src/folder.vala'
--- src/folder.vala 2011-09-22 08:49:28 +0000
+++ src/folder.vala 2011-09-29 12:09:23 +0000
@@ -168,6 +168,29 @@
168 168
169 return filter_bookmarks (matches);169 return filter_bookmarks (matches);
170 }170 }
171
172 public bool launch_if_bookmark (string uri) throws Error
173 {
174 if (!uri.has_prefix ("bookmark:"))
175 return false;
176
177 var launcher = AppInfo.get_default_for_type ("inode/directory", true);
178
179 uri = uri.offset (9); // Remove "bookmark:" prefix from uri
180
181 if (launcher == null)
182 {
183 warning ("No default handler for inode/directory. Unable to open bookmark '%s'", uri);
184 throw new IOError.FAILED ("No default handler for inode/directory. Unable to open bookmark '%s'", uri);
185 }
186
187 var uris = new List<string> ();
188 uris.append (uri);
189
190 launcher.launch_uris (uris, new AppLaunchContext());
191
192 return true;
193 }
171 194
172 }195 }
173 196
@@ -177,13 +200,14 @@
177 public string icon { get; set construct; }200 public string icon { get; set construct; }
178 public string mimetype { get; set construct; }201 public string mimetype { get; set construct; }
179 public string display_name { get; set construct; }202 public string display_name { get; set construct; }
203 public string dnd_uri { get; set construct; }
180 204
181 private List<string> index_terms;205 private List<string> index_terms;
182 206
183 public Bookmark (string uri, string mimetype, string display_name)207 public Bookmark (string uri, string mimetype, string display_name)
184 {208 {
185 Object (uri:uri, icon:Utils.get_icon_for_uri (uri, mimetype),209 Object (uri:"bookmark:"+uri, icon:Utils.get_icon_for_uri (uri, mimetype),
186 mimetype:mimetype, display_name:display_name);210 mimetype:mimetype, display_name:display_name, dnd_uri:uri);
187 211
188 index_terms = new List<string> ();212 index_terms = new List<string> ();
189 index_terms.append (Utils.normalize_string (Path.get_basename (uri)));213 index_terms.append (Utils.normalize_string (Path.get_basename (uri)));

Subscribers

People subscribed via source and target branches

to all changes: