Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/icons/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#

# Override only default
if profile == 'development' and icon_variant == 'default'
if development and icon_variant == 'default'
icon_variant = 'devel'
endif

Expand Down
2 changes: 1 addition & 1 deletion data/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ endif

#========================
# metainfo confuses windows, and icons are handled differently there
if not windows_build
if not windows



Expand Down
27 changes: 15 additions & 12 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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']
Expand All @@ -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']
Expand All @@ -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

Expand All @@ -84,7 +84,7 @@ subdir('po')
subdir('data')
subdir('src')

if windows_build
if windows
subdir('windows')
endif

Expand All @@ -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
10 changes: 3 additions & 7 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -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')
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')
2 changes: 1 addition & 1 deletion po/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ i18n.gettext(app_name,
preset: 'glib'
)

if not windows_build
if not windows
subdir('extra')
endif
14 changes: 7 additions & 7 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public class Jorts.Application : Gtk.Application {
application_id: APP_ID);
}

/*************************************************/
/*************************************************/
static construct {
gsettings = new GLib.Settings (APP_ID);
}
Expand Down Expand Up @@ -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
Expand All @@ -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 */
Expand Down Expand Up @@ -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}
};
Expand All @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions src/Objects/NoteData.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/Objects/Zoom.vala
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,4 @@ public enum Jorts.Zoom {
default: return 32;
}
}
}
}
5 changes: 2 additions & 3 deletions src/Objects/ZoomType.vala
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@

if (delta == 0) {return NONE;}

if (delta > 0)
{
if (delta > 0) {
return ZOOM_OUT;

} else {
return ZOOM_IN;
}
}
}
}
16 changes: 8 additions & 8 deletions src/Services/NoteManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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 ();
Expand All @@ -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);

Expand Down Expand Up @@ -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 ();
}
}

/*************************************************/
/**
Expand All @@ -107,7 +107,7 @@ public class Jorts.NoteManager : Object {
note.destroy ();

immediately_save ();
}
}

/*************************************************/
/**
Expand All @@ -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);
}
Expand All @@ -139,7 +139,7 @@ public class Jorts.NoteManager : Object {
array.add_object_element (object);
};

storage.save (array);
storage.save (array);
}

/*************************************************/
Expand Down
18 changes: 9 additions & 9 deletions src/Services/Storage.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -64,29 +64,29 @@ 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);
}
}

/*************************************************/
/**
* Converts a Json.Node into a string and take care of saving it
*/
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 ();
var node = new Json.Node (Json.NodeType.ARRAY);
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);
}
Expand All @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Utils/Autostart.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/Widgets/Popover.vala
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ 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);
add_binding_action (Gdk.Key.w, Gdk.ModifierType.CONTROL_MASK, StickyNoteWindow.ACTION_PREFIX + StickyNoteWindow.ACTION_DELETE, null);
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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading
Loading