From ebe9cf2a7c0262eb638487938a78830d2b86d27c Mon Sep 17 00:00:00 2001 From: Michael Webster Date: Tue, 26 Apr 2022 14:08:22 -0400 Subject: [PATCH] nemo-preview.c: Require gtk3 for all js imports. Move gtk before any other gtk/gdk imports to make sure they end up the proper versions as well. Ref: #449 --- nemo-preview/src/js/ui/application.js | 4 +++- nemo-preview/src/js/ui/fallbackRenderer.js | 2 +- nemo-preview/src/js/ui/main.js | 2 +- nemo-preview/src/js/ui/mainWindow.js | 3 ++- nemo-preview/src/js/ui/spinnerBox.js | 3 ++- nemo-preview/src/js/ui/utils.js | 4 +++- nemo-preview/src/js/viewers/audio.js | 4 +++- nemo-preview/src/js/viewers/font.js | 4 +++- nemo-preview/src/js/viewers/gst.js | 2 +- nemo-preview/src/js/viewers/html.js | 3 ++- nemo-preview/src/js/viewers/image.js | 3 ++- nemo-preview/src/js/viewers/text.js | 3 ++- nemo-preview/src/js/viewers/xreader.js | 3 ++- 13 files changed, 27 insertions(+), 13 deletions(-) diff --git a/nemo-preview/src/js/ui/application.js b/nemo-preview/src/js/ui/application.js index 35bbce03..ed1c1a4b 100644 --- a/nemo-preview/src/js/ui/application.js +++ b/nemo-preview/src/js/ui/application.js @@ -25,6 +25,9 @@ * */ +imports.gi.versions.Gtk = '3.0'; +const Gtk = imports.gi.Gtk; + const Lang = imports.lang; // util imports @@ -32,7 +35,6 @@ const Path = imports.util.path; // gi imports const GLib = imports.gi.GLib; -const Gtk = imports.gi.Gtk; const Gdk = imports.gi.Gdk; const Gio = imports.gi.Gio; diff --git a/nemo-preview/src/js/ui/fallbackRenderer.js b/nemo-preview/src/js/ui/fallbackRenderer.js index 6350333b..68fd3ee4 100644 --- a/nemo-preview/src/js/ui/fallbackRenderer.js +++ b/nemo-preview/src/js/ui/fallbackRenderer.js @@ -26,9 +26,9 @@ */ imports.gi.versions.Gtk = '3.0'; +const Gtk = imports.gi.Gtk; const Gio = imports.gi.Gio; -const Gtk = imports.gi.Gtk; const GtkClutter = imports.gi.GtkClutter; const NemoPreview = imports.gi.NemoPreview; diff --git a/nemo-preview/src/js/ui/main.js b/nemo-preview/src/js/ui/main.js index 8badc675..ed239423 100644 --- a/nemo-preview/src/js/ui/main.js +++ b/nemo-preview/src/js/ui/main.js @@ -26,12 +26,12 @@ */ imports.gi.versions.Gtk = '3.0'; +const Gtk = imports.gi.Gtk; const Format = imports.format; const Gettext = imports.gettext; const GLib = imports.gi.GLib; -const Gtk = imports.gi.Gtk; const Application = imports.ui.application; const Path = imports.util.path; diff --git a/nemo-preview/src/js/ui/mainWindow.js b/nemo-preview/src/js/ui/mainWindow.js index f70c3060..797ea6f3 100644 --- a/nemo-preview/src/js/ui/mainWindow.js +++ b/nemo-preview/src/js/ui/mainWindow.js @@ -25,7 +25,9 @@ * */ +imports.gi.versions.Gtk = '3.0'; imports.gi.versions.GdkX11 = '3.0'; +const Gtk = imports.gi.Gtk; const Gio = imports.gi.Gio; const GLib = imports.gi.GLib; @@ -42,7 +44,6 @@ GLib.setenv("CLUTTER_SCALE", Math.max(s, 1).toString(), true); const GdkX11 = imports.gi.GdkX11; const GdkPixbuf = imports.gi.GdkPixbuf; -const Gtk = imports.gi.Gtk; const GtkClutter = imports.gi.GtkClutter; const Clutter = imports.gi.Clutter; const Pango = imports.gi.Pango; diff --git a/nemo-preview/src/js/ui/spinnerBox.js b/nemo-preview/src/js/ui/spinnerBox.js index dc29c94b..783e6056 100644 --- a/nemo-preview/src/js/ui/spinnerBox.js +++ b/nemo-preview/src/js/ui/spinnerBox.js @@ -24,10 +24,11 @@ * Authors: Cosimo Cecchi * */ +imports.gi.versions.Gtk = '3.0'; +const Gtk = imports.gi.Gtk; const Gettext = imports.gettext.domain('nemo-extensions'); const _ = Gettext.gettext; -const Gtk = imports.gi.Gtk; const GtkClutter = imports.gi.GtkClutter; const Tweener = imports.ui.tweener; diff --git a/nemo-preview/src/js/ui/utils.js b/nemo-preview/src/js/ui/utils.js index dec34c68..2a4e2d04 100644 --- a/nemo-preview/src/js/ui/utils.js +++ b/nemo-preview/src/js/ui/utils.js @@ -25,8 +25,10 @@ * */ -const Gdk = imports.gi.Gdk; +imports.gi.versions.Gtk = '3.0'; + const Gtk = imports.gi.Gtk; +const Gdk = imports.gi.Gdk; const Lang = imports.lang; diff --git a/nemo-preview/src/js/viewers/audio.js b/nemo-preview/src/js/viewers/audio.js index eb2b5414..bb589eee 100644 --- a/nemo-preview/src/js/viewers/audio.js +++ b/nemo-preview/src/js/viewers/audio.js @@ -25,11 +25,13 @@ * */ +imports.gi.versions.Gtk = '3.0'; imports.gi.versions.ClutterGst = '3.0'; + +const Gtk = imports.gi.Gtk; const GdkPixbuf = imports.gi.GdkPixbuf; const Gio = imports.gi.Gio; const Gst = imports.gi.Gst; -const Gtk = imports.gi.Gtk; const GtkClutter = imports.gi.GtkClutter; const NemoPreview = imports.gi.NemoPreview; diff --git a/nemo-preview/src/js/viewers/font.js b/nemo-preview/src/js/viewers/font.js index 9b4d6517..19e0a4d2 100644 --- a/nemo-preview/src/js/viewers/font.js +++ b/nemo-preview/src/js/viewers/font.js @@ -25,13 +25,15 @@ * */ +imports.gi.versions.Gtk = '3.0'; +const Gtk = imports.gi.Gtk; + const MimeHandler = imports.ui.mimeHandler; const Utils = imports.ui.utils; const Lang = imports.lang; const GtkClutter = imports.gi.GtkClutter; -const Gtk = imports.gi.Gtk; const GLib = imports.gi.GLib; const NemoPreview = imports.gi.NemoPreview; diff --git a/nemo-preview/src/js/viewers/gst.js b/nemo-preview/src/js/viewers/gst.js index 33216cc5..f403fa6f 100644 --- a/nemo-preview/src/js/viewers/gst.js +++ b/nemo-preview/src/js/viewers/gst.js @@ -28,11 +28,11 @@ imports.gi.versions.ClutterGst = '3.0'; imports.gi.versions.Gtk = '3.0'; imports.gi.versions.Gdk = '3.0'; +const Gtk = imports.gi.Gtk; const ClutterGst = imports.gi.ClutterGst; const Clutter = imports.gi.Clutter; const Gdk = imports.gi.Gdk; const GObject = imports.gi.GObject; -const Gtk = imports.gi.Gtk; const GtkClutter = imports.gi.GtkClutter; const Lang = imports.lang; diff --git a/nemo-preview/src/js/viewers/html.js b/nemo-preview/src/js/viewers/html.js index 4b133b9b..753fc98d 100644 --- a/nemo-preview/src/js/viewers/html.js +++ b/nemo-preview/src/js/viewers/html.js @@ -25,10 +25,11 @@ * */ +imports.gi.versions.Gtk = '3.0'; imports.gi.versions.WebKit2 = '4.0'; -const GtkClutter = imports.gi.GtkClutter; const Gtk = imports.gi.Gtk; const GLib = imports.gi.GLib; +const GtkClutter = imports.gi.GtkClutter; const WebKit = imports.gi.WebKit2; const NemoPreview = imports.gi.NemoPreview; diff --git a/nemo-preview/src/js/viewers/image.js b/nemo-preview/src/js/viewers/image.js index 08aacde7..4dc45968 100644 --- a/nemo-preview/src/js/viewers/image.js +++ b/nemo-preview/src/js/viewers/image.js @@ -25,9 +25,10 @@ * */ +imports.gi.versions.Gtk = '3.0'; +const Gtk = imports.gi.Gtk; const GdkPixbuf = imports.gi.GdkPixbuf; const GtkClutter = imports.gi.GtkClutter; -const Gtk = imports.gi.Gtk; const GLib = imports.gi.GLib; const Gettext = imports.gettext.domain('nemo-extensions'); diff --git a/nemo-preview/src/js/viewers/text.js b/nemo-preview/src/js/viewers/text.js index 8b2baf94..73f4ad9d 100644 --- a/nemo-preview/src/js/viewers/text.js +++ b/nemo-preview/src/js/viewers/text.js @@ -25,10 +25,11 @@ * */ +imports.gi.versions.Gtk = '3.0'; imports.gi.versions.GtkSource = '4'; -const GtkClutter = imports.gi.GtkClutter; const Gtk = imports.gi.Gtk; +const GtkClutter = imports.gi.GtkClutter; const GLib = imports.gi.GLib; const GtkSource = imports.gi.GtkSource; const Gio = imports.gi.Gio; diff --git a/nemo-preview/src/js/viewers/xreader.js b/nemo-preview/src/js/viewers/xreader.js index 5875db88..27b3b62d 100644 --- a/nemo-preview/src/js/viewers/xreader.js +++ b/nemo-preview/src/js/viewers/xreader.js @@ -25,9 +25,10 @@ * */ +imports.gi.versions.Gtk = '3.0'; +const Gtk = imports.gi.Gtk; const EvDoc = imports.gi.XreaderDocument; const EvView = imports.gi.XreaderView; -const Gtk = imports.gi.Gtk; const GtkClutter = imports.gi.GtkClutter; const NemoPreview = imports.gi.NemoPreview;