Skip to content

Commit

Permalink
feat: remove gvfs use and bump to tracker-sparql-3
Browse files Browse the repository at this point in the history
Fixes #19
  • Loading branch information
birros committed Apr 21, 2021
1 parent 8c3cda0 commit 5c9052b
Show file tree
Hide file tree
Showing 12 changed files with 81 additions and 228 deletions.
7 changes: 0 additions & 7 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,6 @@ You can run it directly using the app launcher or using this command :

## Todo

- __CRITICAL__ : Handle the absence of system services such as Tracker or GVFS's
http backend :
1. use D-Bus to test whether the service is available or not
2. on the application's homepage, use a banner to indicate the absence of
services
3. display instructions in a modal window, depending on the system used, to
install them
- Propose ZIM format recognition for GNU/Linux distributions (mimetype)
- Refactoring the settings : maximize, window size, night mode
- Write help manual
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,17 @@ application appear in your launcher. It can also be executed from a terminal :
Some __problems__ may occur when running the application, especially if your
desktop environment does not use [GTK+], such as __[Kde]__.

The installation of __two additional services__ is then required on the system
The installation of __tracker service__ is then required on the system
side to solve these problems, requiring the execution of one of these commands
depending on your distribution :

__Debian & Ubuntu__ :

apt install tracker gvfs-backends
apt install tracker

__Fedora__ :

dnf install tracker gvfs
dnf install tracker

### Other installation methods

Expand Down
38 changes: 3 additions & 35 deletions build-aux/flatpak/com.github.birros.WebArchives.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,9 @@ finish-args:
- --socket=pulseaudio
# Used to list automatically indexed local files
- --filesystem=home
- --talk-name=org.freedesktop.Tracker1
- --env=TRACKER_SPARQL_BACKEND=bus
# Used to access gvfs's http backend to download files
- --talk-name=org.freedesktop.Tracker3.Miner.Files
# Used to download files
- --share=network
- --talk-name=org.gtk.vfs
- --talk-name=org.gtk.vfs.*
# Dconf migration (TODO: to remove around 2020)
- --metadata=X-DConf=migrate-path=/com/github/birros/WebArchives/
modules:
- name: xapian-core
config-opts:
Expand Down Expand Up @@ -89,33 +84,6 @@ modules:
url: https://github.com/birros/libzim-glib/archive/v3.2.0.tar.gz
sha256: 89cbc55254d90c70de2de8ee7f2b4aff97f582ae7f495ddfee518ef136de9357

- name: tracker
buildsystem: meson
builddir: true
cleanup:
- /bin
- /etc
- /include
- /lib/libtracker-control*
- /lib/libtracker-mine*
- /lib/*.la
- /lib/tracker-2.0/*.la
- /lib/girepository-1.0
- /lib/pkgconfig
- /lib/systemd
- /libexec
- /share/bash-completion
- /share/dbus-1
- /share/gir-1.0
- /share/gtk-doc
- /share/man
- /share/runtime
- /share/vala
sources:
- type: archive
url: https://ftp.gnome.org/pub/GNOME/sources/tracker/2.3/tracker-2.3.6.tar.xz
sha256: bd1eb4122135296fa7b57b1c3fa0ed602cf7d06c0b8e534d0bd17ff5f97feef2

- name: libgee
build-options:
env:
Expand Down Expand Up @@ -173,7 +141,7 @@ modules:

#
# require
# libzim-glib, tracker, libisocodes, libhandy
# libzim-glib, libisocodes, libhandy
# subprojects/darkreader require
# nodejs
#
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ sqlite_dep = dependency('sqlite3')
webkit_dep = dependency('webkit2gtk-4.0')
soup_dep = dependency('libsoup-2.4')
webkit_web_extension_dep = dependency('webkit2gtk-web-extension-4.0')
tracker_dep = dependency('tracker-sparql-2.0')
tracker_dep = dependency('tracker-sparql-3.0')
xml_dep = dependency('libxml-2.0')
isocodes_dep = dependency('libisocodes')
handy_dep = dependency('libhandy-1', version : '>=1.0.0')
Expand Down
16 changes: 0 additions & 16 deletions po/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -492,22 +492,6 @@ msgstr ""
"No hay ningún archivador descargable disponible. <b>Por favor, actualice esta "
"lista usando el botón apropiado.</b>"

#: src/app/ui/content/home-view.vala:39
msgid ""
"<span weight=\"bold\" foreground=\"#f57900\">It seems that a GVFS component "
"is not installed on your system.</span> WebArchives cannot list downloadable "
"archives.\n"
"\n"
"<b>Please install this component using your package manager, then restart "
"your session.</b>\n"
"\n"
"&#8226; Debian or Ubuntu:\n"
" <tt># apt install gvfs-backends</tt>\n"
"\n"
"&#8226; Fedora:\n"
" <tt># dnf install gvfs</tt>"
msgstr ""

#: src/app/ui/content/home-view.vala:63
msgid "Cannot open the archive file"
msgstr "No se puede abrir el archivador"
Expand Down
28 changes: 0 additions & 28 deletions po/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -506,34 +506,6 @@ msgstr ""
"Aucune archive disponible en téléchargement. <b>Veuillez rafraîchir cette "
"liste à l'aide du bouton approprié.</b>"

#: src/app/ui/content/home-view.vala:39
msgid ""
"<span weight=\"bold\" foreground=\"#f57900\">It seems that a GVFS component "
"is not installed on your system.</span> WebArchives cannot list downloadable "
"archives.\n"
"\n"
"<b>Please install this component using your package manager, then restart "
"your session.</b>\n"
"\n"
"&#8226; Debian or Ubuntu:\n"
" <tt># apt install gvfs-backends</tt>\n"
"\n"
"&#8226; Fedora:\n"
" <tt># dnf install gvfs</tt>"
msgstr ""
"<span weight=\"bold\" foreground=\"#f57900\">Il semble qu'un composant GVFS "
"n'est pas installé sur votre système.</span> WebArchives ne peut pas lister "
"les archives téléchargeables.\n"
"\n"
"<b>Veuillez installer ce composant à l'aide de votre gestionnaire de "
"paquets, puis redémarrez votre session.</b>\n"
"\n"
"&#8226; Debian ou Ubuntu:\n"
" <tt># apt install gvfs-backends</tt>\n"
"\n"
"&#8226; Fedora:\n"
" <tt># dnf install gvfs</tt>"

#: src/app/ui/content/home-view.vala:63
msgid "Cannot open the archive file"
msgstr "Impossible d'ouvrir l'archive"
Expand Down
16 changes: 0 additions & 16 deletions po/nl.po
Original file line number Diff line number Diff line change
Expand Up @@ -491,22 +491,6 @@ msgstr ""
"Geen archief beschikbaar om te downloaden. <b>Vernieuw deze lijst met de "
"juiste knop.</b>"

#: src/app/ui/content/home-view.vala:39
msgid ""
"<span weight=\"bold\" foreground=\"#f57900\">It seems that a GVFS component "
"is not installed on your system.</span> WebArchives cannot list downloadable "
"archives.\n"
"\n"
"<b>Please install this component using your package manager, then restart "
"your session.</b>\n"
"\n"
"&#8226; Debian or Ubuntu:\n"
" <tt># apt install gvfs-backends</tt>\n"
"\n"
"&#8226; Fedora:\n"
" <tt># dnf install gvfs</tt>"
msgstr ""

#: src/app/ui/content/home-view.vala:63
msgid "Cannot open the archive file"
msgstr "Kan het archiefbestand niet openen"
Expand Down
16 changes: 0 additions & 16 deletions src/app/services/remote.vala
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,10 @@ public class WebArchives.Remote : Object {
public int64 timestamp {get; set; default = 0; }
public bool downloading {get; private set; default = false;}
public double progress {get; private set; default = 0; }
public bool enabled {get; private set; default = false;}

public Remote (ArchiveStore archive_store) {
this.archive_store = archive_store;

if (
DBusUtils.is_name_activatable ("org.gtk.vfs.Daemon") &&
DBusUtils.is_gvfs_backend_supported ("http")
) {
enabled = true;
info ("HTTP GVFS backend is present");
} else {
enabled = false;
info ("HTTP GVFS backend is not present");
}

// build library path
string cache_dir = Environment.get_user_cache_dir ();
string files_folder = Path.build_filename (
Expand All @@ -31,10 +19,6 @@ public class WebArchives.Remote : Object {
}

public void refresh () {
if (!enabled) {
return;
}

FileDownloader library_downloader = new FileDownloader ();
library_downloader.download_file (LIBRARY_URL, library_path);
library_downloader.complete.connect (() => {
Expand Down
10 changes: 8 additions & 2 deletions src/app/services/tracker-service.vala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ public class WebArchives.TrackerService : Object {
public TrackerService (ArchiveStore archive_store) {
this.archive_store = archive_store;

if (DBusUtils.is_name_activatable ("org.freedesktop.Tracker1")) {
if (DBusUtils.is_name_activatable (
"org.freedesktop.Tracker3.Miner.Files"
)) {
enabled = true;
info ("Tracker is present");
} else {
Expand All @@ -28,7 +30,11 @@ public class WebArchives.TrackerService : Object {
// build tracker list
try {
Tracker.Sparql.Connection connection =
Tracker.Sparql.Connection.@get ();
Tracker.Sparql.Connection.bus_new(
"org.freedesktop.Tracker3.Miner.Files",
null,
null
);
Tracker.Sparql.Cursor cursor = connection.query (
"""
SELECT nie:url(?f)
Expand Down
29 changes: 2 additions & 27 deletions src/app/ui/content/home-view.vala
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,6 @@ public class WebArchives.HomeView : Gtk.Overlay {
"""No archive available for download. <b>Please refresh this list using the appropriate button.</b>"""
);

private const string REMOTE_WARNING_MESSAGE = _(
"""<span weight="bold" foreground="#f57900">It seems that a GVFS component is not installed on your system.</span> WebArchives cannot list downloadable archives.

<b>Please install this component using your package manager, then restart your session.</b>

&#8226; Debian or Ubuntu:
<tt># apt install gvfs-backends</tt>

&#8226; Fedora:
<tt># dnf install gvfs</tt>"""
);

public HomeView (Context context) {
this.context = context;

Expand Down Expand Up @@ -225,9 +213,6 @@ public class WebArchives.HomeView : Gtk.Overlay {
remote_header_comboboxtext.changed.connect (() => {
language_changed ();
});
if (!context.remote.enabled) {
remote_header_comboboxtext.sensitive = false;
}
remote_header_box.add (remote_header_comboboxtext);

StatusLabel remote_last_refreshed = new StatusLabel ();
Expand All @@ -254,9 +239,6 @@ public class WebArchives.HomeView : Gtk.Overlay {
remote_header_button.clicked.connect (() => {
context.remote.refresh ();
});
if (!context.remote.enabled) {
remote_header_button.sensitive = false;
}
remote_header_box.add (remote_header_button);

Gtk.Frame remote_frame = new Gtk.Frame (null);
Expand All @@ -270,12 +252,7 @@ public class WebArchives.HomeView : Gtk.Overlay {
remote_frame.add (remote_list_box);

Gtk.Label remote_placeholder;
if (context.remote.enabled) {
remote_placeholder = new Gtk.Label (REMOTE_INFO_MESSAGE);
} else {
remote_placeholder = new Gtk.Label (REMOTE_WARNING_MESSAGE);
remote_placeholder.selectable = true;
}
remote_placeholder = new Gtk.Label (REMOTE_INFO_MESSAGE);
remote_placeholder.use_markup = true;
remote_placeholder.margin = 12;
remote_placeholder.wrap = true;
Expand All @@ -293,9 +270,7 @@ public class WebArchives.HomeView : Gtk.Overlay {
}

remote_model = null;
if (context.remote.enabled) {
language_changed ();
}
language_changed ();

show_all ();
}
Expand Down
20 changes: 0 additions & 20 deletions src/app/utils/dbus-utils.vala
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,4 @@ public class WebArchives.DBusUtils : Object {
}
return false;
}

public static bool is_gvfs_backend_supported (string protocol) {
try {
MountTracker interface = Bus.get_proxy_sync (
BusType.SESSION, "org.gtk.vfs.Daemon",
"/org/gtk/vfs/mounttracker"
);

string[] types = interface.list_mount_types ();

if (array_contains (types, protocol)) {
return true;
} else {
return false;
}
} catch (Error e) {
warning (e.message);
}
return false;
}
}
Loading

0 comments on commit 5c9052b

Please sign in to comment.