diff --git a/data/icons/meson.build b/data/icons/meson.build index a22357aa..1faaca9c 100644 --- a/data/icons/meson.build +++ b/data/icons/meson.build @@ -3,7 +3,7 @@ # # Override only default -if profile == 'development' and icon_variant == 'default' +if development and icon_variant == 'default' icon_variant = 'devel' endif diff --git a/data/meson.build b/data/meson.build index 1c87e869..2ddcd896 100644 --- a/data/meson.build +++ b/data/meson.build @@ -38,7 +38,7 @@ endif #======================== # metainfo confuses windows, and icons are handled differently there -if not windows_build +if not windows diff --git a/meson.build b/meson.build index 3d6837bc..1c2ae937 100644 --- a/meson.build +++ b/meson.build @@ -15,9 +15,11 @@ legacy_app_id = 'io.github.ellie_commons.' + app_name legacy_app_path = '/io/github/ellie_commons/' + app_name vala_flags = [] -profile = get_option('profile') +development = get_option('development') +legacy_rdnn = get_option('legacy-rdnn') +windows = get_option('windows') -if profile == 'legacy-rdnn' +if legacy_rdnn app_id = legacy_app_id alternate_app_id = correct_app_id app_path = legacy_app_path @@ -30,7 +32,7 @@ else app_path = correct_app_path endif -if profile == 'development' +if development app_id += '.devel' vala_flags += ['--define', 'DEVEL'] vala_flags += ['--define', 'LATTE'] @@ -40,9 +42,7 @@ endif # Cool icon variants icon_variant = get_option('icon-variant') -if icon_variant == 'pride' - vala_flags += ['--define', 'PRIDE'] -elif icon_variant == 'halloween' +if icon_variant == 'halloween' vala_flags += ['--define', 'HALLOWEEN'] else vala_flags += ['--define', 'DEFAULT'] @@ -53,12 +53,12 @@ gnome = import('gnome') i18n = import('i18n') # Windows needs icons, special arguments, and skip libportal -windows_build = get_option('windows_build') +windows = get_option('windows') if build_machine.system() == 'windows' - windows_build = true + windows = true endif -if windows_build +if windows vala_flags += ['--define', 'WINDOWS'] endif @@ -84,7 +84,7 @@ subdir('po') subdir('data') subdir('src') -if windows_build +if windows subdir('windows') endif @@ -94,11 +94,14 @@ gnome.post_install( update_desktop_database: true ) -if profile == 'development' +if development message(''' - + +---------------------------------------- You now have a development version installed. Here be dragons. +Tread carefully. +---------------------------------------- ''') endif \ No newline at end of file diff --git a/meson_options.txt b/meson_options.txt index 4548492e..d428918c 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,13 +1,9 @@ -option('profile', - type : 'combo', - choices : ['release', 'development', 'legacy-rdnn'], - value : 'release', - description : 'Which profile to use for the app' -) option('icon-variant', type : 'combo', choices : ['default', 'classic', 'pride', 'halloween', 'devel'], value : 'default', description : 'The name of the seasonal icon and style to use' ) -option('windows_build', type: 'boolean', value: false, description: 'If this is a windows build. Switched on automatically on windows machines') \ No newline at end of file +option('development', type: 'boolean', value: false, description: 'If this is a dev build') +option('windows', type: 'boolean', value: false, description: 'If this is a windows build. Switched on automatically on windows machines') +option('legacy-rdnn', type: 'boolean', value: false, description: 'If this uses old rdnn') \ No newline at end of file diff --git a/po/meson.build b/po/meson.build index 846259ff..7b2b22ca 100644 --- a/po/meson.build +++ b/po/meson.build @@ -3,6 +3,6 @@ i18n.gettext(app_name, preset: 'glib' ) -if not windows_build +if not windows subdir('extra') endif diff --git a/src/Application.vala b/src/Application.vala index 0ad8ca53..8335cd1e 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -78,7 +78,7 @@ public class Jorts.Application : Gtk.Application { application_id: APP_ID); } - /*************************************************/ + /*************************************************/ static construct { gsettings = new GLib.Settings (APP_ID); } @@ -121,9 +121,9 @@ public class Jorts.Application : Gtk.Application { // Also follow dark if system is dark lIke mY sOul. gtk_settings.gtk_application_prefer_dark_theme = ( - granite_settings.prefers_color_scheme == DARK + granite_settings.prefers_color_scheme == DARK ); - + granite_settings.notify["prefers-color-scheme"].connect (() => { gtk_settings.gtk_application_prefer_dark_theme = ( granite_settings.prefers_color_scheme == DARK @@ -137,7 +137,7 @@ Your Notes are all belong to us! (\o/) (\o/) <--- Tiny electric angels working in the background /_\ /_\ -Please wait while the app remembers all the things... +Please wait while the app remembers all the things… """); /* Quit if all sticky notes are closed and preferences arent shown */ @@ -235,9 +235,9 @@ Please wait while the app remembers all the things... } public override int command_line (ApplicationCommandLine command_line) { - debug ("Parsing commandline arguments..."); + debug ("Parsing commandline arguments"); - OptionEntry[] CMD_OPTION_ENTRIES = { + OptionEntry[] cmd_option_entries = { {"new-note", 'n', OptionFlags.NONE, OptionArg.NONE, ref new_note, _("Create a new note"), null}, {"preferences", 'p', OptionFlags.NONE, OptionArg.NONE, ref show_pref, _("Show preferences"), null} }; @@ -253,7 +253,7 @@ Please wait while the app remembers all the things... try { var ctx = new OptionContext (); ctx.set_help_enabled (true); - ctx.add_main_entries (CMD_OPTION_ENTRIES, null); + ctx.add_main_entries (cmd_option_entries, null); unowned string[] tmp = _args; ctx.parse (ref tmp); diff --git a/src/Objects/NoteData.vala b/src/Objects/NoteData.vala index 58f297b5..2ba3e233 100644 --- a/src/Objects/NoteData.vala +++ b/src/Objects/NoteData.vala @@ -48,7 +48,7 @@ public class Jorts.NoteData : Object { // Translators: "Forgot title!" is optional. It never happened for me when testing, and may appear only if users tampered with the savefile title = node.get_string_member_with_default ("title", (_("Forgot title!"))); theme = (Jorts.Themes)node.get_int_member_with_default ("color", Jorts.Themes.random_theme ()); - content = node.get_string_member_with_default ("content",""); + content = node.get_string_member_with_default ("content", ""); monospace = node.get_boolean_member_with_default ("monospace", DEFAULT_MONO); zoom = (int)node.get_int_member_with_default ("zoom", DEFAULT_ZOOM); @@ -67,7 +67,7 @@ public class Jorts.NoteData : Object { public Json.Object to_json () { var builder = new Json.Builder (); - // Lets fkin gooo + // Lets fkin gooo builder.begin_object (); builder.set_member_name ("title"); builder.add_string_value (title); @@ -77,7 +77,7 @@ public class Jorts.NoteData : Object { builder.add_string_value (content); builder.set_member_name ("monospace"); builder.add_boolean_value (monospace); - builder.set_member_name ("zoom"); + builder.set_member_name ("zoom"); builder.add_int_value (zoom); builder.set_member_name ("width"); builder.add_int_value (width); diff --git a/src/Objects/Zoom.vala b/src/Objects/Zoom.vala index 65562d06..61813f70 100644 --- a/src/Objects/Zoom.vala +++ b/src/Objects/Zoom.vala @@ -108,4 +108,4 @@ public enum Jorts.Zoom { default: return 32; } } -} \ No newline at end of file +} diff --git a/src/Objects/ZoomType.vala b/src/Objects/ZoomType.vala index 28a2ee55..724721bd 100644 --- a/src/Objects/ZoomType.vala +++ b/src/Objects/ZoomType.vala @@ -19,12 +19,11 @@ if (delta == 0) {return NONE;} - if (delta > 0) - { + if (delta > 0) { return ZOOM_OUT; } else { return ZOOM_IN; } } -} \ No newline at end of file +} diff --git a/src/Services/NoteManager.vala b/src/Services/NoteManager.vala index e5272b8f..3ae52008 100644 --- a/src/Services/NoteManager.vala +++ b/src/Services/NoteManager.vala @@ -34,7 +34,7 @@ public class Jorts.NoteManager : Object { * Keep an active list of Windows. * We do not do this at construct time so we stay flexible whenever we want to init * NoteManager is also created too early by the app for new windows - */ + */ public void init () { debug ("Opening all sticky notes now!"); Json.Array loaded_data = storage.load (); @@ -45,7 +45,7 @@ public class Jorts.NoteManager : Object { create_note (note_data); } else { - foreach (var json_data in loaded_data.get_elements()) { + foreach (var json_data in loaded_data.get_elements ()) { var json_obj = json_data.dup_object (); var note_data = new NoteData.from_json (json_obj); @@ -74,18 +74,18 @@ public class Jorts.NoteManager : Object { } else { var random_data = new NoteData (); - + // One chance at the golden sticky random_data = Jorts.Utils.golden_sticky (random_data); note = new StickyNoteWindow (application, random_data); } - + /* LETSGO */ open_notes.add (note); note.show (); note.present (); - } + } /*************************************************/ /** @@ -107,7 +107,7 @@ public class Jorts.NoteManager : Object { note.destroy (); immediately_save (); - } + } /*************************************************/ /** @@ -116,7 +116,7 @@ public class Jorts.NoteManager : Object { public void save_all () { debug ("Save the stickies!"); if (saving_lock) {return;} - + if (debounce_timer_id != 0) { GLib.Source.remove (debounce_timer_id); } @@ -139,7 +139,7 @@ public class Jorts.NoteManager : Object { array.add_object_element (object); }; - storage.save (array); + storage.save (array); } /*************************************************/ diff --git a/src/Services/Storage.vala b/src/Services/Storage.vala index 21a94381..11620474 100644 --- a/src/Services/Storage.vala +++ b/src/Services/Storage.vala @@ -37,7 +37,7 @@ public class Jorts.Storage : Object { ensure_datadir (); // TODO: Remove the below cruft after a while - var old_storage_path = GLib.Path.build_path (Path.DIR_SEPARATOR_S, Environment.get_user_data_dir (), FILENAME); + var old_storage_path = GLib.Path.build_path (Path.DIR_SEPARATOR_S, Environment.get_user_data_dir (), FILENAME); var old_storage_file = File.new_for_path (old_storage_path); var savefile = File.new_for_path (savefile_path); @@ -64,13 +64,13 @@ public class Jorts.Storage : Object { } try { - datadir.make_directory_with_parents (); - debug ("yes we do now"); + datadir.make_directory_with_parents (); + debug ("yes we do now"); } catch (Error e) { - warning ("Failed to prepare target data directory %s", e.message); - } - } + warning ("Failed to prepare target data directory %s", e.message); + } + } /*************************************************/ /** @@ -78,7 +78,7 @@ public class Jorts.Storage : Object { */ public void save (Json.Array json_data) { ensure_datadir (); - debug("Writing %u elements... (Should be same number as sticky notes)", json_data.get_length ()); + debug ("Writing %u elements (Should be same number as sticky notes)", json_data.get_length ()); try { var generator = new Json.Generator (); @@ -86,7 +86,7 @@ public class Jorts.Storage : Object { node.set_array (json_data); generator.set_root (node); generator.to_file (savefile_path); - + } catch (Error e) { warning ("Failed to save notes %s", e.message); } @@ -112,7 +112,7 @@ public class Jorts.Storage : Object { warning ("Failed to load from storage %s", e.message); } - + debug ("Retrieved %ui elements", array.get_length ()); return array; } diff --git a/src/Utils/Autostart.vala b/src/Utils/Autostart.vala index 32a7e080..e2072108 100644 --- a/src/Utils/Autostart.vala +++ b/src/Utils/Autostart.vala @@ -27,7 +27,7 @@ public class Jorts.Autostart { Xdp.BackgroundFlags.AUTOSTART, null); - print ("Autostart set: %b",result); + print ("Autostart set: %b", result); } catch (Error e) { warning (e.message); @@ -44,7 +44,7 @@ public class Jorts.Autostart { Xdp.BackgroundFlags.NONE, null); - print ("Autostart remove: %b",result); + print ("Autostart remove: %b", result); } catch (Error e) { warning (e.message); diff --git a/src/Widgets/Popover.vala b/src/Widgets/Popover.vala index 8dd1787d..9cb0c162 100644 --- a/src/Widgets/Popover.vala +++ b/src/Widgets/Popover.vala @@ -40,8 +40,8 @@ public class Jorts.Popover : Gtk.Popover { static construct { add_binding_action (Gdk.Key.plus, Gdk.ModifierType.CONTROL_MASK, ZoomController.ACTION_PREFIX + ZoomController.ACTION_ZOOM_IN, null); - add_binding_action (Gdk.Key.equal, Gdk.ModifierType.CONTROL_MASK, ZoomController.ACTION_PREFIX + ZoomController.ACTION_ZOOM_DEFAULT, null); - add_binding_action (48, Gdk.ModifierType.CONTROL_MASK, ZoomController.ACTION_PREFIX + ZoomController.ACTION_ZOOM_DEFAULT, null); + add_binding_action (Gdk.Key.equal, Gdk.ModifierType.CONTROL_MASK, ZoomController.ACTION_PREFIX + ZoomController.ACTION_ZOOM_DEFAULT, null); + add_binding_action (48, Gdk.ModifierType.CONTROL_MASK, ZoomController.ACTION_PREFIX + ZoomController.ACTION_ZOOM_DEFAULT, null); add_binding_action (Gdk.Key.minus, Gdk.ModifierType.CONTROL_MASK, ZoomController.ACTION_PREFIX + ZoomController.ACTION_ZOOM_OUT, null); add_binding_action (Gdk.Key.n, Gdk.ModifierType.CONTROL_MASK, Application.ACTION_PREFIX + Application.ACTION_NEW, null); @@ -49,7 +49,7 @@ public class Jorts.Popover : Gtk.Popover { add_binding_action (Gdk.Key.l, Gdk.ModifierType.CONTROL_MASK, NoteView.ACTION_PREFIX + NoteView.ACTION_FOCUS_TITLE, null); add_binding_action (Gdk.Key.g, Gdk.ModifierType.CONTROL_MASK, NoteView.ACTION_PREFIX + NoteView.ACTION_SHOW_MENU, null); add_binding_action (Gdk.Key.o, Gdk.ModifierType.CONTROL_MASK, NoteView.ACTION_PREFIX + NoteView.ACTION_SHOW_MENU, null); - add_binding_action (Gdk.Key.m, Gdk.ModifierType.CONTROL_MASK, NoteView.ACTION_PREFIX + NoteView.ACTION_TOGGLE_MONO, null); + add_binding_action (Gdk.Key.m, Gdk.ModifierType.CONTROL_MASK, NoteView.ACTION_PREFIX + NoteView.ACTION_TOGGLE_MONO, null); add_binding_action (Gdk.Key.F12, Gdk.ModifierType.SHIFT_MASK, TextView.ACTION_PREFIX + TextView.ACTION_TOGGLE_LIST, null); } diff --git a/src/meson.build b/src/meson.build index 010f3b60..6276d8bc 100644 --- a/src/meson.build +++ b/src/meson.build @@ -63,7 +63,7 @@ sources = files ( # So AFAIK ico.rc just point to an ico file in the same folder it is, so this is like gresource # No libportal on windows -if windows_build +if windows dependencies += dependency('gio-windows-2.0') ico_src = import('windows').compile_resources('../windows/icons/ico.rc') sources += ico_src diff --git a/tests/meson.build b/tests/meson.build new file mode 100644 index 00000000..c7d8aaac --- /dev/null +++ b/tests/meson.build @@ -0,0 +1,22 @@ + +########### META: +# Linter +# Appstream files and co +# Storage: Load and save + +### Services + +# Build some services and enums. Do random manipulations and compare + + +#### UI +# build specific widgets: + +# Textview +# Add initial text. Activate lists on a sentence. Compare with reference. Change lists. Compare with reference + +# preferences dialog +# show the window. No binds. + +# notes +# show window. No storage. \ No newline at end of file