lainsce / quilter

[DEPRECATED] Focus on your writing.
GNU General Public License v3.0
289 stars 36 forks source link

3.0.1: data files install path issue #360

Closed kloczek closed 3 years ago

kloczek commented 3 years ago

In https://github.com/lainsce/quilter/blob/master/data/meson.build#L2

configdir = fs.expanduser('~/.local/share/io.github.lainsce.Quilter')

Which is causig that data files are installed in wrong place.

lainsce commented 3 years ago

How so? They're there because it's a convenient place to store those extension files that shouldn't go away from the xdg-data directory.

darkshram commented 3 years ago

@lainsce That works only if the system has a single user and this user executes the installation or if it's a Flatpak-only package. That does not work for system-wide installations with native packages. Example: I'm trying to create RPM packages using mock, based on Fedora spec file, and files install as /buildroot/.local/share/io.github.lainsce.Quilter, which is a wrong path for a system-wide installation. I'm pretty sure anyone trying to create *.deb or other format of packages for other distributions [are|will-be] having the same issue.

kloczek commented 3 years ago

Here is proposed patch:

--- a/data/meson.build~ 2021-01-20 02:07:17.000000000 +0000
+++ b/data/meson.build  2021-01-20 03:51:15.606236092 +0000
@@ -1,5 +1,5 @@
 fs = import('fs')
-configdir = fs.expanduser('~/.local/share/io.github.lainsce.Quilter')
+configdir = fs.expanduser(join_paths(get_option('datadir'), 'quilter'))

 install_data(
     join_paths('icons', '128', 'io.github.lainsce.Quilter.svg'),
--- a/data/app.gresource.xml    2021-01-20 02:07:17.000000000 +0000
+++ b/data/app.gresource.xml    2021-01-20 04:01:13.262548823 +0000
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gresources>
-    <gresource prefix="/io/github/lainsce/Quilter">
+    <gresource prefix="/quilter/">
         <file alias="app-main-stylesheet.css" compressed="true">styles/app-main-stylesheet.css</file>
         <file alias="app-font-stylesheet.css" compressed="true">styles/app-font-stylesheet.css</file>
         <file alias="app-stylesheet.css" compressed="true">styles/app-stylesheet.css</file>
--- a/src/MainWindow.vala       2021-01-20 02:07:17.000000000 +0000
+++ b/src/MainWindow.vala       2021-01-20 04:01:13.263548823 +0000
@@ -141,7 +141,7 @@
             );

             weak Gtk.IconTheme default_theme = Gtk.IconTheme.get_default ();
-            default_theme.add_resource_path ("/io/github/lainsce/Quilter");
+            default_theme.add_resource_path ("/quilter");

             // Ensure the file used in the init is cache and exists
             Services.FileManager.get_cache_path ();
@@ -324,10 +324,10 @@
             }

             var provider = new Gtk.CssProvider ();
-            provider.load_from_resource ("/io/github/lainsce/Quilter/app-main-stylesheet.css");
+            provider.load_from_resource ("/quilter/app-main-stylesheet.css");
             Gtk.StyleContext.add_provider_for_screen (Gdk.Screen.get_default (), provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
             var provider2 = new Gtk.CssProvider ();
-            provider2.load_from_resource ("/io/github/lainsce/Quilter/app-font-stylesheet.css");
+            provider2.load_from_resource ("/quilter/app-font-stylesheet.css");
             Gtk.StyleContext.add_provider_for_screen (Gdk.Screen.get_default (), provider2, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
             var provider3 = new Gtk.CssProvider ();

@@ -383,7 +383,7 @@
             welcome_title.get_style_context ().add_class ("title-1");
             welcome_title.margin_bottom = 24;

-            var welcome_image = new Gtk.Image.from_resource ("/io/github/lainsce/Quilter/welcome.png");
+            var welcome_image = new Gtk.Image.from_resource ("/quilter/welcome.png");
             welcome_image.margin_bottom = 24;

             var welcome_new_button = new Gtk.Button ();
--- a/src/Widgets/HeaderBarButton.vala  2021-01-20 02:07:17.000000000 +0000
+++ b/src/Widgets/HeaderBarButton.vala  2021-01-20 04:01:13.264548824 +0000
@@ -17,7 +17,7 @@
 * Boston, MA 02110-1301 USA
 */
 namespace Quilter.Widgets {
-    [GtkTemplate (ui = "/io/github/lainsce/Quilter/header_button.ui")]
+    [GtkTemplate (ui = "/quilter/header_button.ui")]
     public class HeaderBarButton : Gtk.Bin {
         public signal void clicked ();
         public string? title { get; set; }
--- a/src/Widgets/SourceView.vala       2021-01-20 02:07:17.000000000 +0000
+++ b/src/Widgets/SourceView.vala       2021-01-20 04:01:13.265548824 +0000
@@ -258,7 +258,7 @@
             buffer.get_bounds (out start, out end);

             if (Quilter.Application.gsettings.get_string("visual-mode") == "dark") {
-                provider.load_from_resource ("/io/github/lainsce/Quilter/app-stylesheet-dark.css");
+                provider.load_from_resource ("/quilter/app-stylesheet-dark.css");
                 Gtk.StyleContext.add_provider_for_screen (Gdk.Screen.get_default (), provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
                 Gtk.Settings.get_default ().gtk_application_prefer_dark_theme = true;
                 buffer.remove_tag(lightsepiafont, start, end);
@@ -266,14 +266,14 @@
                 buffer.remove_tag(blackfont, start, end);
                 return "quilter-dark";
             } else if (Quilter.Application.gsettings.get_string("visual-mode") == "sepia") {
-                provider.load_from_resource ("/io/github/lainsce/Quilter/app-stylesheet-sepia.css");
+                provider.load_from_resource ("/quilter/app-stylesheet-sepia.css");
                 Gtk.StyleContext.add_provider_for_screen (Gdk.Screen.get_default (), provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
                 Gtk.Settings.get_default ().gtk_application_prefer_dark_theme = false;
                 buffer.remove_tag(whitefont, start, end);
                 buffer.remove_tag(blackfont, start, end);
                 return "quilter-sepia";
             } else if (Quilter.Application.gsettings.get_string("visual-mode") == "light") {
-                provider.load_from_resource ("/io/github/lainsce/Quilter/app-stylesheet.css");
+                provider.load_from_resource ("/quilter/app-stylesheet.css");
                 Gtk.StyleContext.add_provider_for_screen (Gdk.Screen.get_default (), provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
                 Gtk.Settings.get_default ().gtk_application_prefer_dark_theme = false;
                 buffer.remove_tag(whitefont, start, end);

If you want I can create PR with that patch. Creating wole direcrory strucrures few levels deep is really pointess ..

lainsce commented 3 years ago

Feel free to make PRs to help me up with it, but these aren't directories, they're gresource paths RDNN'd to avoid colision with another app.

kloczek commented 3 years ago

And it is yet another small issue. Compile time warning:

[6/35] valac -C --target-glib=2.40 --pkg gtkspell3-3.0 --pkg webkit2gtk-4.0 --pkg gtksourceview-4 --pkg libhandy-1 --pkg gee-0.8 --pkg gobject-2.0 --pkg glib-2.0 --pkg gtk+-3.0 --pkg gio-2.0 --color=always --directory io.github.lainsce.Quilter.p --basedir ../ --gresources=../data/app.gresource.xml /home/tkloczko/rpmbuild/BUILD/quilter-3.0.1/vapi/libmarkdown.vapi /home/tkloczko/rpmbuild/BUILD/quilter-3.0.1/src/Config.vapi ../src/Application.vala ../src/MainWindow.vala ../src/Widgets/HeaderBar.vala ../src/Widgets/HeaderBarButton.vala ../src/Widgets/SourceView.vala ../src/Widgets/WebView.vala ../src/Widgets/StatusBar.vala ../src/Widgets/SearchBar.vala ../src/Widgets/SideBar.vala ../src/Widgets/SideBarBox.vala ../src/Widgets/Preferences.vala ../src/Widgets/Cheatsheet.vala ../src/Plugins/PluginManager.vala ../src/Plugins/Plugin.vala ../src/Plugins/Image.vala ../src/Plugins/Filep.vala ../src/Plugins/Checkbox.vala ../src/Plugins/CheckboxChecked.vala ../src/Plugins/Highlighter.vala ../src/Plugins/Superscript.vala ../src/Plugins/Subscript.vala ../src/Styles/quilter.vala ../src/Styles/quilterdark.vala ../src/Styles/quiltersepia.vala ../src/Constants/AppSettings.vala ../src/Services/FileManager.vala ../src/Services/ExportUtils.vala ../src/Services/DialogUtils.vala
../src/Widgets/HeaderBar.vala:384.17-384.73: warning: unhandled error `GLib.Error'
                foreach (var child in win.sidebar.column.get_children ()) {
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../src/Widgets/WebView.vala:173.17-173.29: warning: switch does not handle `NAVIGATION_ACTION' of enum `WebKit.PolicyDecisionType'
                switch (type) {
                ^^^^^^^^^^^^^
Compilation succeeded - 2 warning(s)
kloczek commented 3 years ago

Feel free to make PRs to help me up with it, but these aren't directories, they're gresource paths RDNN'd to avoid colision with another app.

So why not just change that to plain opening files in exact paths? What is the pointo add additional complexity layer?

lainsce commented 3 years ago

It's necessary complexity to make the app more cohesive and less files scattered about in the filesystem since they get to be part of the app's binary this way.

lainsce commented 3 years ago

I don't understand why not to do it, to be honest.

lainsce commented 3 years ago

@lainsce That works only if the system has a single user and this user executes the installation or if it's a Flatpak-only package. That does not work for system-wide installations with native packages. Example: I'm trying to create RPM packages using mock, based on Fedora spec file, and files install as /buildroot/.local/share/io.github.lainsce.Quilter, which is a wrong path for a system-wide installation. I'm pretty sure anyone trying to create *.deb or other format of packages for other distributions [are|will-be] having the same issue.

I want Quilter to be flatpak-only going forward, as it's an excellent way to ship the app without the dependency/packaging hell of distros while also preserving the way I intended the app to run and display.

lainsce commented 3 years ago

Anyways, seems like it's a non-issue, mostly questions, right?

kloczek commented 3 years ago

I want Quilter to be flatpak-only going forward, as it's an excellent way to ship the app without the dependency/packaging hell of distros while also preserving the way I intended the app to run and display.

So you do not understand that some oher OSess do not need user space prostetics like linux flatpack bnecause they have properly implemented RBACs (in kernel space) and sooner otr later Linux developer will (re)discocer that they can do the same? I have my Linux distro without even single trace trace of flatpack. I have now impression that I'm wastering my time trying to package your project to provide it on Linux and Solaris building from exactly the same rpm spec file (yes .. on Solaris there is no flatpak).

darkshram commented 3 years ago

It's an issue for anyone not using Elementary Linux, because quilter is now no longer able to install system wide. You won't see any Linux distros (besides Elementary Linux) or any BSDs packaging and distributing Quilter beyond 2.5.4 version, if that's what you really wish.

darkshram commented 3 years ago

Flatpak is a nice thing for applications not included in OS software repositories or 'hard-to-satisfy-dependencies' applications like the ones using Nodejs modules or Electron, but is pointless if the OS has all dependencies satisfied in their software repositories. In this last case, using Flatpak applications instead of native packaged applications is a waste of space. I don't see where is the hell of dependencies for Quilter. AppCenter, GNOME Software, Discover, apt-get, yum, dnf, pkcon, emerge, etc., take care of whatever is needed to install an application.

kloczek commented 3 years ago

OK, so what kind of "hard-to-satisfy-dependencies" is usig quilter?

lainsce commented 3 years ago

Ok, so, when I was saying package/dependency hell, it was in a broad stroke. Not only for Quilter's case (With libmarkdown, for example; some distros package it as discount, others as discount and libmarkdown, and then others as just libmarkdown. As an example.)

Anyways, seeing as this is quickly devolving into a fight against Flatpak with long overused FUD and not a civil discussion, I'm going to lock this issue.

lainsce commented 3 years ago

Just going to leave this here: If the Fedorians could package the app, why can't a Solarisian or a BSD Daemon?