From 36dd4356f3cb4038fab807a066f0db94d8b313fb Mon Sep 17 00:00:00 2001 From: ilhooq Date: Tue, 22 Mar 2022 21:36:17 +0100 Subject: [PATCH 1/6] Share build variables with the src code This fix locale dir on custom install prefix --- data/meson.build | 10 +++++----- ...t.notes-up.desktop.in => notes-up.desktop.in} | 0 meson.build | 7 +++++-- src/Application.vala | 6 +++--- src/Constants.vala.in | 10 ++++++++++ src/Main.vala | 14 +++++++------- src/meson.build | 16 ++++++++++++++++ 7 files changed, 46 insertions(+), 17 deletions(-) rename data/{com.github.philip_scott.notes-up.desktop.in => notes-up.desktop.in} (100%) create mode 100644 src/Constants.vala.in diff --git a/data/meson.build b/data/meson.build index 6fcc43cd..4fc61d4d 100644 --- a/data/meson.build +++ b/data/meson.build @@ -2,17 +2,17 @@ icon_sizes = ['48', '64'] foreach i : icon_sizes install_data( - join_paths('icons', i, meson.project_name() + '.svg'), + join_paths('icons', i, APP_ID + '.svg'), install_dir: join_paths(get_option('datadir'), 'icons', 'hicolor', i + 'x' + i, 'apps') ) install_data( - join_paths('icons', i, meson.project_name() + '.svg'), + join_paths('icons', i, APP_ID + '.svg'), install_dir: join_paths(get_option('datadir'), 'icons', 'hicolor', i + 'x' + i, '@2', 'apps') ) endforeach install_data( - meson.project_name() + '.gschema.xml', + APP_ID + '.gschema.xml', install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas') ) @@ -26,8 +26,8 @@ i18n.merge_file( ) i18n.merge_file( - input: meson.project_name() + '.appdata.xml.in', - output: meson.project_name() + '.appdata.xml', + input: APP_ID + '.appdata.xml.in', + output: APP_ID + '.appdata.xml', po_dir: join_paths(meson.source_root(), 'po', 'extra'), install: true, install_dir: join_paths(get_option('datadir'), 'metainfo') diff --git a/data/com.github.philip_scott.notes-up.desktop.in b/data/notes-up.desktop.in similarity index 100% rename from data/com.github.philip_scott.notes-up.desktop.in rename to data/notes-up.desktop.in diff --git a/meson.build b/meson.build index e96a615f..f9082120 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,6 @@ -project('com.github.philip_scott.notes-up','vala', 'c', version: '2.7.0') +project('notes-up','vala', 'c', version: '2.7.0') + +APP_ID = 'com.github.philip_scott.@0@'.format (meson.project_name()) gnome = import('gnome') i18n = import('i18n') @@ -9,7 +11,7 @@ add_global_arguments( ) asresources = gnome.compile_resources( - 'as-resources', join_paths('data', meson.project_name() + '.gresource.xml'), + 'as-resources', join_paths('data', APP_ID + '.gresource.xml'), source_dir: 'data', c_name: 'as' ) @@ -19,6 +21,7 @@ subdir('src') executable( meson.project_name(), sources, + config, asresources, dependencies: [ dependency('granite'), diff --git a/src/Application.vala b/src/Application.vala index b6864cd0..9e52e3a3 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -77,10 +77,10 @@ public class ENotes.Application : Granite.Application { construct { flags |= ApplicationFlags.HANDLES_OPEN; - application_id = "com.github.philip_scott.notes-up"; + application_id = Constants.APP_ID; program_name = PROGRAM_NAME; - exec_name = TERMINAL_NAME; - app_launcher = "com.github.philip_scott.notes-up"; + exec_name = Constants.PROJECT_NAME; + app_launcher = Constants.APP_ID; state = new State (); } diff --git a/src/Constants.vala.in b/src/Constants.vala.in new file mode 100644 index 00000000..d94ddaf6 --- /dev/null +++ b/src/Constants.vala.in @@ -0,0 +1,10 @@ + +namespace Constants { + public const string GETTEXT_PACKAGE = @GETTEXT_PACKAGE@; + public const string PROJECT_NAME = @PROJECT_NAME@; + public const string APP_ID = @APP_ID@; + public const string VERSION = @VERSION@; + public const string INSTALL_PREFIX = @PREFIX@; + public const string DATADIR = @DATADIR@; + public const string LOCALEDIR = @LOCALEDIR@; +} diff --git a/src/Main.vala b/src/Main.vala index ee1952c7..2235b026 100644 --- a/src/Main.vala +++ b/src/Main.vala @@ -19,19 +19,19 @@ * Authored by: Felipe Escoto */ -public const string APP_NAME = "Notes-Up"; -public const string TERMINAL_NAME = "notes-up"; public static int main (string[] args) { - /* Initiliaze gettext support */ - Intl.setlocale (LocaleCategory.ALL, Intl.get_language_names ()[0]); + /* Initialize gettext support */ + GLib.Intl.setlocale (LocaleCategory.ALL, ""); + GLib.Intl.bindtextdomain (Constants.GETTEXT_PACKAGE, Constants.LOCALEDIR); + GLib.Intl.bind_textdomain_codeset (Constants.GETTEXT_PACKAGE, "UTF-8"); + GLib.Intl.textdomain (Constants.GETTEXT_PACKAGE); - Environment.set_application_name (APP_NAME); - Environment.set_prgname (APP_NAME); + // Environment.set_application_name (Constants.PROJECT_NAME); + // Environment.set_prgname (Constants.PROJECT_NAME); var application = new ENotes.Application (); return application.run (args); } - diff --git a/src/meson.build b/src/meson.build index d3aaeac0..99d187cb 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,3 +1,19 @@ + +conf = configuration_data() +conf.set_quoted('PROJECT_NAME', meson.project_name()) +conf.set_quoted('APP_ID', APP_ID) +conf.set_quoted('GETTEXT_PACKAGE', meson.project_name()) +conf.set_quoted('VERSION', meson.project_version()) +conf.set_quoted('PREFIX', get_option('prefix')) +conf.set_quoted('DATADIR', join_paths (get_option('prefix'), get_option('datadir'))) +conf.set_quoted('LOCALEDIR', join_paths (get_option('prefix'), get_option('localedir'))) +config = configure_file( + input : 'Constants.vala.in', + output : 'Constants.vala', + configuration : conf +) + + sources = files( 'Main.vala', 'Application.vala', From e84e421ba73ea32ade416c2f54dec8dc04796808 Mon Sep 17 00:00:00 2001 From: ilhooq Date: Wed, 23 Mar 2022 10:59:21 +0100 Subject: [PATCH 2/6] Update french translation --- po/fr.po | 62 ++++++++++++++++++++------------------------------------ 1 file changed, 22 insertions(+), 40 deletions(-) diff --git a/po/fr.po b/po/fr.po index 0bd5283f..9be709ff 100644 --- a/po/fr.po +++ b/po/fr.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: com.github.philip_scott.notes-up\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-30 15:38+0100\n" -"PO-Revision-Date: 2019-04-02 18:31+0200\n" +"PO-Revision-Date: 2022-03-23 10:56+0100\n" "Last-Translator: NathanBnm\n" "Language-Team: Français\n" "Language: fr\n" @@ -16,6 +16,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +"X-Generator: Poedit 2.3\n" #: src/Plugins/Break.vala:28 msgid "Page break when exporting to PDF: " @@ -27,7 +28,7 @@ msgstr "Saut de page" #: src/Plugins/Break.vala:47 msgid "Page break on export: " -msgstr "Saut de page en export : " +msgstr "Saut de page à l'export : " #: src/Plugins/Color.vala:35 msgid "" @@ -43,11 +44,11 @@ msgstr "Couleur de police" #: src/Plugins/Highlight.vala:28 src/Widgets/HelpBox.vala:62 msgid "Enable Syntax Highlighting" -msgstr "Mise en surbrillance" +msgstr "Activer la coloration syntaxtique" #: src/Plugins/Highlight.vala:32 msgid "Syntax Highlighing" -msgstr "Surbrillance" +msgstr "Coloration syntaxtique" #: src/Plugins/Image.vala:28 msgid "Load an embeded image" @@ -229,20 +230,19 @@ msgstr "Supprimer" #: src/Widgets/Sidebar/NotebookItem.vala:53 msgid "Edit Section" -msgstr "" +msgstr "Modifier la section" #: src/Widgets/Sidebar/NotebookItem.vala:54 src/Widgets/Headerbar.vala:354 msgid "New Section" -msgstr "" +msgstr "Nouvelle section" #: src/Widgets/Sidebar/NotebookItem.vala:55 -#, fuzzy msgid "Delete Section" -msgstr "Supprimer la Page" +msgstr "Supprimer la section" #: src/Widgets/Sidebar/NotebookItem.vala:56 msgid "Move Section" -msgstr "" +msgstr "Déplacer la section" #: src/Widgets/Sidebar/NotebookList.vala:32 msgid "New Notebook" @@ -262,7 +262,7 @@ msgstr "Étiquettes" #: src/Widgets/Sidebar/Sidebar.vala:33 msgid "Sections" -msgstr "" +msgstr "Sections" #: src/Widgets/Sidebar/Sidebar.vala:54 msgid "All Notes" @@ -273,9 +273,8 @@ msgid "Not in a Notebook" msgstr "Pas dans un Carnet de Notes" #: src/Widgets/Sidebar/Sidebar.vala:260 -#, fuzzy msgid "My Notes" -msgstr "Toutes les Notes" +msgstr "Mes notes" #: src/Widgets/Sidebar/TrashItem.vala:28 msgid "Restore" @@ -347,23 +346,23 @@ msgstr "Changer de thème" #: src/Widgets/Headerbar.vala:233 msgid "Show All" -msgstr "" +msgstr "Afficher tout" #: src/Widgets/Headerbar.vala:234 msgid "Show Sections and Pages" -msgstr "" +msgstr "Afficher les sections et les pages" #: src/Widgets/Headerbar.vala:235 msgid "Show Only Pages" -msgstr "" +msgstr "Afficher seulement les pages" #: src/Widgets/Headerbar.vala:236 msgid "Hide All" -msgstr "" +msgstr "Masquer tout" #: src/Widgets/Headerbar.vala:263 msgid "Panel Options" -msgstr "" +msgstr "Options des panneaux" #: src/Widgets/Headerbar.vala:327 msgid "High Contrast" @@ -484,12 +483,12 @@ msgstr "Couleur" #: src/Widgets/PageInfoEditor.vala:71 #, c-format msgid "Created: %s" -msgstr "Créé : %s" +msgstr "Créé le : %s" #: src/Widgets/PageInfoEditor.vala:78 #, c-format msgid "Updated: %s" -msgstr "Mis à jour : %s" +msgstr "Mis à jour le : %s" #: src/Widgets/PageInfoEditor.vala:100 msgid "Not in Notebook" @@ -544,7 +543,7 @@ msgstr "Q" #: src/Application.vala:42 msgid "N" -msgstr "N" +msgstr "N" #: src/Application.vala:43 msgid "F" @@ -568,17 +567,15 @@ msgstr "T" #: src/Application.vala:48 msgid "I" -msgstr "I" +msgstr "I" #: src/Application.vala:49 -#, fuzzy msgid "P" -msgstr "M" +msgstr "P" #: src/Application.vala:50 -#, fuzzy msgid "P" -msgstr "N" +msgstr "N" #: src/Application.vala:66 msgid "Notes-Up" @@ -591,18 +588,3 @@ msgstr "Votre Carnet de Notes en Markdown." #: src/Application.vala:68 msgid "About Notes" msgstr "À Propos" - -#~ msgid "Keep Sidebar Visible:" -#~ msgstr "Garder la barre latérale visible :" - -#~ msgid "Edit Notebook" -#~ msgstr "Éditer le Carnet de Notes" - -#~ msgid "Delete Notebook" -#~ msgstr "Supprimer le Carnet" - -#~ msgid "Notebooks" -#~ msgstr "Carnets de Notes" - -#~ msgid "My First Notebook" -#~ msgstr "Mon premier Carnet de Notes" From 764f4e5330f1755b01d490d69d6113ee1b92e98a Mon Sep 17 00:00:00 2001 From: ilhooq Date: Thu, 24 Mar 2022 14:08:08 +0100 Subject: [PATCH 3/6] Fix command name --- com.github.philip_scott.notes-up.yml | 4 ++-- data/notes-up.desktop.in | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/com.github.philip_scott.notes-up.yml b/com.github.philip_scott.notes-up.yml index a951518d..18487fed 100644 --- a/com.github.philip_scott.notes-up.yml +++ b/com.github.philip_scott.notes-up.yml @@ -10,7 +10,7 @@ sdk: io.elementary.Sdk # This should match the exec line in your .desktop file and usually is the same # as your app ID -command: com.github.philip_scott.notes-up +command: notes-up # Here we can specify the kinds of permissions our app needs to run. Since we're # not using hardware like webcams, making sound, or reading external files, we @@ -61,4 +61,4 @@ modules: buildsystem: meson sources: - type: dir - path: . \ No newline at end of file + path: . diff --git a/data/notes-up.desktop.in b/data/notes-up.desktop.in index 9f70ceb0..a7d71b24 100644 --- a/data/notes-up.desktop.in +++ b/data/notes-up.desktop.in @@ -1,10 +1,10 @@ [Desktop Entry] Name=Notes-Up Comment=Your markdown notebook -Exec=com.github.philip_scott.notes-up %u +Exec=notes-up %u Icon=com.github.philip_scott.notes-up Terminal=false Type=Application StartupNotify=true Categories=Office;WordProcessor; -MimeType=application/x-notesup; \ No newline at end of file +MimeType=application/x-notesup; From 864f9b4abe9c83676009b8de12dc655b4f67e9b3 Mon Sep 17 00:00:00 2001 From: ilhooq Date: Thu, 24 Mar 2022 18:23:43 +0100 Subject: [PATCH 4/6] Revert : set app id as app name --- ....in => com.github.philip_scott.notes-up.desktop.in} | 2 +- data/meson.build | 10 +++++----- meson.build | 6 ++---- src/Application.vala | 4 ++-- src/Constants.vala.in | 1 - src/meson.build | 1 - 6 files changed, 10 insertions(+), 14 deletions(-) rename data/{notes-up.desktop.in => com.github.philip_scott.notes-up.desktop.in} (83%) diff --git a/data/notes-up.desktop.in b/data/com.github.philip_scott.notes-up.desktop.in similarity index 83% rename from data/notes-up.desktop.in rename to data/com.github.philip_scott.notes-up.desktop.in index a7d71b24..18601c7a 100644 --- a/data/notes-up.desktop.in +++ b/data/com.github.philip_scott.notes-up.desktop.in @@ -1,7 +1,7 @@ [Desktop Entry] Name=Notes-Up Comment=Your markdown notebook -Exec=notes-up %u +Exec=com.github.philip_scott.notes-up %u Icon=com.github.philip_scott.notes-up Terminal=false Type=Application diff --git a/data/meson.build b/data/meson.build index 4fc61d4d..6fcc43cd 100644 --- a/data/meson.build +++ b/data/meson.build @@ -2,17 +2,17 @@ icon_sizes = ['48', '64'] foreach i : icon_sizes install_data( - join_paths('icons', i, APP_ID + '.svg'), + join_paths('icons', i, meson.project_name() + '.svg'), install_dir: join_paths(get_option('datadir'), 'icons', 'hicolor', i + 'x' + i, 'apps') ) install_data( - join_paths('icons', i, APP_ID + '.svg'), + join_paths('icons', i, meson.project_name() + '.svg'), install_dir: join_paths(get_option('datadir'), 'icons', 'hicolor', i + 'x' + i, '@2', 'apps') ) endforeach install_data( - APP_ID + '.gschema.xml', + meson.project_name() + '.gschema.xml', install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas') ) @@ -26,8 +26,8 @@ i18n.merge_file( ) i18n.merge_file( - input: APP_ID + '.appdata.xml.in', - output: APP_ID + '.appdata.xml', + input: meson.project_name() + '.appdata.xml.in', + output: meson.project_name() + '.appdata.xml', po_dir: join_paths(meson.source_root(), 'po', 'extra'), install: true, install_dir: join_paths(get_option('datadir'), 'metainfo') diff --git a/meson.build b/meson.build index f9082120..fb348f1f 100644 --- a/meson.build +++ b/meson.build @@ -1,6 +1,4 @@ -project('notes-up','vala', 'c', version: '2.7.0') - -APP_ID = 'com.github.philip_scott.@0@'.format (meson.project_name()) +project('com.github.philip_scott.notes-up','vala', 'c', version: '2.7.0') gnome = import('gnome') i18n = import('i18n') @@ -11,7 +9,7 @@ add_global_arguments( ) asresources = gnome.compile_resources( - 'as-resources', join_paths('data', APP_ID + '.gresource.xml'), + 'as-resources', join_paths('data', meson.project_name() + '.gresource.xml'), source_dir: 'data', c_name: 'as' ) diff --git a/src/Application.vala b/src/Application.vala index 9e52e3a3..39d28cc6 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -77,10 +77,10 @@ public class ENotes.Application : Granite.Application { construct { flags |= ApplicationFlags.HANDLES_OPEN; - application_id = Constants.APP_ID; + application_id = Constants.PROJECT_NAME; program_name = PROGRAM_NAME; exec_name = Constants.PROJECT_NAME; - app_launcher = Constants.APP_ID; + app_launcher = Constants.PROJECT_NAME; state = new State (); } diff --git a/src/Constants.vala.in b/src/Constants.vala.in index d94ddaf6..ecb5c90a 100644 --- a/src/Constants.vala.in +++ b/src/Constants.vala.in @@ -2,7 +2,6 @@ namespace Constants { public const string GETTEXT_PACKAGE = @GETTEXT_PACKAGE@; public const string PROJECT_NAME = @PROJECT_NAME@; - public const string APP_ID = @APP_ID@; public const string VERSION = @VERSION@; public const string INSTALL_PREFIX = @PREFIX@; public const string DATADIR = @DATADIR@; diff --git a/src/meson.build b/src/meson.build index 99d187cb..9493310b 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,7 +1,6 @@ conf = configuration_data() conf.set_quoted('PROJECT_NAME', meson.project_name()) -conf.set_quoted('APP_ID', APP_ID) conf.set_quoted('GETTEXT_PACKAGE', meson.project_name()) conf.set_quoted('VERSION', meson.project_version()) conf.set_quoted('PREFIX', get_option('prefix')) From 44b4652403cc368ceb3773603c1f0cccf020ed12 Mon Sep 17 00:00:00 2001 From: ilhooq Date: Thu, 24 Mar 2022 18:42:34 +0100 Subject: [PATCH 5/6] Revert : set the environment application name See https://valadoc.org/glib-2.0/GLib.Environment.set_application_name.html --- src/Main.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Main.vala b/src/Main.vala index 2235b026..25019d10 100644 --- a/src/Main.vala +++ b/src/Main.vala @@ -27,8 +27,8 @@ public static int main (string[] args) { GLib.Intl.bind_textdomain_codeset (Constants.GETTEXT_PACKAGE, "UTF-8"); GLib.Intl.textdomain (Constants.GETTEXT_PACKAGE); - // Environment.set_application_name (Constants.PROJECT_NAME); - // Environment.set_prgname (Constants.PROJECT_NAME); + Environment.set_application_name (N_("Notes-Up")); + Environment.set_prgname (Constants.PROJECT_NAME); var application = new ENotes.Application (); From c082a176e10321da9d4c76ad134aef319b31a6e3 Mon Sep 17 00:00:00 2001 From: ilhooq Date: Thu, 24 Mar 2022 19:23:16 +0100 Subject: [PATCH 6/6] Revert to app id --- com.github.philip_scott.notes-up.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.github.philip_scott.notes-up.yml b/com.github.philip_scott.notes-up.yml index 18487fed..22dc68d5 100644 --- a/com.github.philip_scott.notes-up.yml +++ b/com.github.philip_scott.notes-up.yml @@ -10,7 +10,7 @@ sdk: io.elementary.Sdk # This should match the exec line in your .desktop file and usually is the same # as your app ID -command: notes-up +command: com.github.philip_scott.notes-up # Here we can specify the kinds of permissions our app needs to run. Since we're # not using hardware like webcams, making sound, or reading external files, we