Merge lp:~ivanfateev/pantheon-files/fix-1380139 into lp:~elementary-apps/pantheon-files/trunk

Proposed by Ivan Fateev
Status: Rejected
Rejected by: Jeremy Wootten
Proposed branch: lp:~ivanfateev/pantheon-files/fix-1380139
Merge into: lp:~elementary-apps/pantheon-files/trunk
Diff against target: 153 lines (+70/-20)
2 files modified
src/CMakeLists.txt (+2/-0)
src/View/AbstractDirectoryView.vala (+68/-20)
To merge this branch: bzr merge lp:~ivanfateev/pantheon-files/fix-1380139
Reviewer Review Type Date Requested Status
Jeremy Wootten Disapprove
Review via email: mp+257797@code.launchpad.net

Description of the change

Added support for gnome-sushi previewer according to this bug
https://bugs.launchpad.net/pantheon-files/+bug/1380139

How to test:
- install gnome-sushi. Select file, hit space, previewer should open
- remove gnome-sushi. Select file, hit space, pantheon-files should behave as was designed before, open select file

To post a comment you must log in.
1814. By Ivan Fateev

- added full support for previewer gnome-sushi
- added enum PreviewerType - maybe files will support more previewers
- if gnome-sushi is not installed - behaviour is default (open selected file)

1815. By Ivan Fateev

removed debug messages about previewer

Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

The problem with this is that installing gnome-sushi also installs Nautilus, which does not seem desirable. Is it possible to remove this dependency on Nautilus?

Revision history for this message
Jeremy Wootten (jeremywootten) :
review: Needs Fixing
Revision history for this message
Ivan Fateev (ivanfateev) wrote :

gnome-sushi works fine without nautilus. How we can get rid of this dependency?
Unfortunately I don't have experience with packaging. Should we file a bug? If so then for which version?

Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

I'll ask Cody. Possibly we could build our own gnome-sushi package which doesn't depend on Nautilus, instead of the Ubuntu one and have the pantheon-files package recommend it.

I'll continue the review on the assumption that this issue is not a merge blocker.

Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

After discussion with some of the other developers, it has been decided to reject this branch for the following reasons:

1) It would bring in unwanted dependencies e.g. on gjs and X11
2) It is an elementary design decision not support a previewer in Files; there is little difference in time for the file to open in the default app compared to the previewer and the intention is to reduce any time difference further.

Thank you for your work; I am sorry we cannot accept it.

review: Disapprove

Unmerged revisions

1815. By Ivan Fateev

removed debug messages about previewer

1814. By Ivan Fateev

- added full support for previewer gnome-sushi
- added enum PreviewerType - maybe files will support more previewers
- if gnome-sushi is not installed - behaviour is default (open selected file)

1813. By Ivan Fateev

integrated gnome-sushi previewer via dbus. TODO: check whether gnome-sushi is installed. Added gdk-x11-3.0 as dependency

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 2015-01-18 20:46:03 +0000
+++ src/CMakeLists.txt 2015-04-30 17:08:23 +0000
@@ -20,6 +20,7 @@
20 gio-unix-2.020 gio-unix-2.0
21 pango>=1.1.221 pango>=1.1.2
22 gtk+-3.0>=3.1022 gtk+-3.0>=3.10
23 gdk-x11-3.0
23 gmodule-2.024 gmodule-2.0
24 gail-3.025 gail-3.0
25 gee-0.826 gee-0.8
@@ -87,6 +88,7 @@
87 View/Chrome/ImgEventBox.vala88 View/Chrome/ImgEventBox.vala
88 PACKAGES89 PACKAGES
89 gtk+-3.090 gtk+-3.0
91 gdk-x11-3.0
90 gio-2.092 gio-2.0
91 posix93 posix
92 gee-0.894 gee-0.8
9395
=== modified file 'src/View/AbstractDirectoryView.vala'
--- src/View/AbstractDirectoryView.vala 2015-04-18 12:10:52 +0000
+++ src/View/AbstractDirectoryView.vala 2015-04-30 17:08:23 +0000
@@ -25,6 +25,11 @@
25namespace FM {25namespace FM {
26 public abstract class AbstractDirectoryView : Gtk.ScrolledWindow {26 public abstract class AbstractDirectoryView : Gtk.ScrolledWindow {
2727
28 public enum PreviewerType {
29 NONE,
30 GNOME_SUSHI
31 }
32
28 public enum TargetType {33 public enum TargetType {
29 STRING,34 STRING,
30 TEXT_URI_LIST,35 TEXT_URI_LIST,
@@ -44,6 +49,12 @@
4449
45 const int MAX_TEMPLATES = 32;50 const int MAX_TEMPLATES = 32;
4651
52 const string GNOME_SUSHI_DBUS_NAME = "org.gnome.NautilusPreviewer";
53 const string GNOME_SUSHI_DBUS_IFACE = "org.gnome.NautilusPreviewer";
54 const string GNOME_SUSHI_DBUS_PATH = "/org/gnome/NautilusPreviewer";
55 const string GNOME_SUSHI_PACKAGE_NAME = "gnome-sushi";
56 const string DPKG_COMMAND_FORMAT = "dpkg --get-selections %s";
57
47 const Gtk.TargetEntry [] drag_targets = {58 const Gtk.TargetEntry [] drag_targets = {
48 {"text/plain", 0, TargetType.STRING},59 {"text/plain", 0, TargetType.STRING},
49 {"text/uri-list", 0, TargetType.TEXT_URI_LIST}60 {"text/uri-list", 0, TargetType.TEXT_URI_LIST}
@@ -164,7 +175,7 @@
164 Marlin.Thumbnailer thumbnailer = null;175 Marlin.Thumbnailer thumbnailer = null;
165176
166 /* TODO Support for preview see bug #1380139 */177 /* TODO Support for preview see bug #1380139 */
167 private string? previewer = null;178 private PreviewerType previewer_type = PreviewerType.NONE;
168179
169 /* Rename support */180 /* Rename support */
170 protected Marlin.TextRenderer? name_renderer = null;181 protected Marlin.TextRenderer? name_renderer = null;
@@ -285,6 +296,7 @@
285 freeze_tree (); /* speed up loading of icon view. Thawed when directory loaded */296 freeze_tree (); /* speed up loading of icon view. Thawed when directory loaded */
286 set_up_zoom_level ();297 set_up_zoom_level ();
287 change_zoom_level ();298 change_zoom_level ();
299 set_up_previewer.begin ();
288 }300 }
289301
290 ~AbstractDirectoryView () {302 ~AbstractDirectoryView () {
@@ -532,25 +544,40 @@
532 }544 }
533545
534 protected void preview_selected_items () {546 protected void preview_selected_items () {
535 if (previewer == null) /* At present this is the case! */547 unowned GLib.List<unowned GOF.File>? selection = get_selected_files ();
536 activate_selected_items (Marlin.OpenFlag.DEFAULT);548
537 else {549 if (selection == null)
538 unowned GLib.List<unowned GOF.File>? selection = get_selected_files ();550 return;
539551
540 if (selection == null)552 switch (previewer_type) {
541 return;553 case PreviewerType.NONE:
542554 activate_selected_items (Marlin.OpenFlag.DEFAULT);
543 Gdk.Screen screen = Eel.gtk_widget_get_screen (this);555 break;
544 GLib.List<GLib.File> location_list = null;556 case PreviewerType.GNOME_SUSHI:
545 GOF.File file = selection.data;557 var dbus = window.application.get_dbus_connection ();
546 location_list.prepend (file.location);558 GOF.File file = selection.data;
547 Gdk.AppLaunchContext context = screen.get_display ().get_app_launch_context ();559 var xid = ((Gdk.X11.Window)get_window ()).get_xid ();
548 try {560 var params = new GLib.Variant ("(sib)", file.uri, xid, true);
549 GLib.AppInfo previewer_app = GLib.AppInfo.create_from_commandline (previewer, null, 0);561 dbus.call.begin (
550 previewer_app.launch (location_list, context as GLib.AppLaunchContext);562 GNOME_SUSHI_DBUS_NAME,
551 } catch (GLib.Error error) {563 GNOME_SUSHI_DBUS_PATH,
552 Eel.show_error_dialog (_("Failed to preview"), error.message, null);564 GNOME_SUSHI_DBUS_IFACE,
553 }565 "ShowFile",
566 params,
567 null,
568 GLib.DBusCallFlags.NONE,
569 -1,
570 null,
571 (obj, res) => {
572 try {
573 dbus.call.end(res);
574 } catch (GLib.Error error) {
575 Eel.show_error_dialog (_("Failed to preview"), error.message, null);
576 }
577 }
578 );
579 break;
580
554 }581 }
555 }582 }
556583
@@ -3045,6 +3072,27 @@
3045 }3072 }
3046 }3073 }
30473074
3075 /** Previewer **/
3076 private async void set_up_previewer () {
3077 string cmd_stdout;
3078 string cmd_stderr;
3079 int cmd_status;
3080 try {
3081 Process.spawn_command_line_sync (
3082 DPKG_COMMAND_FORMAT.printf (GNOME_SUSHI_PACKAGE_NAME),
3083 out cmd_stdout,
3084 out cmd_stderr,
3085 out cmd_status
3086 );
3087
3088 if (cmd_stdout.index_of ("install") > 0) {
3089 previewer_type = PreviewerType.GNOME_SUSHI;
3090 }
3091 } catch (SpawnError e) {
3092 error ("Failed to launch dpkg");
3093 }
3094 }
3095
3048 public virtual void sync_selection () {}3096 public virtual void sync_selection () {}
3049 public virtual void highlight_path (Gtk.TreePath? path) {}3097 public virtual void highlight_path (Gtk.TreePath? path) {}
3050 protected virtual void add_subdirectory (GOF.Directory.Async dir) {}3098 protected virtual void add_subdirectory (GOF.Directory.Async dir) {}

Subscribers

People subscribed via source and target branches

to all changes: