From baf0d0f4d5ca94871682174262d69b1792a84714 Mon Sep 17 00:00:00 2001 From: teamcons Date: Wed, 29 Apr 2026 13:09:47 +0200 Subject: [PATCH 1/7] Start with a tag --- src/Widgets/TextView.vala | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Widgets/TextView.vala b/src/Widgets/TextView.vala index 119e9699..377ca587 100644 --- a/src/Widgets/TextView.vala +++ b/src/Widgets/TextView.vala @@ -6,8 +6,9 @@ */ /** -* A textview incorporating detecting links and emails -* Fairly vanilla but having a definition allows to easily extend it +* A textview subclassing {@link Granite.HyperTextView}, allowing it to do clickable links and emails +* +* Extended with bullet lists that follows user settings */ public class Jorts.TextView : Granite.HyperTextView { @@ -28,6 +29,9 @@ public class Jorts.TextView : Granite.HyperTextView { { ACTION_TOGGLE_LIST, toggle_list}, }; + + + construct { wrap_mode = Gtk.WrapMode.WORD_CHAR; buffer = new Gtk.TextBuffer (null); @@ -67,6 +71,9 @@ public class Jorts.TextView : Granite.HyperTextView { extra.append_section (null, section); extra_menu = extra; + var list_tag = buffer.create_tag ("list"); + list_tag.indent = 5; + /***************************************************/ /* CONNECTS AND BINDS */ From 765369fe76bb71a7ee0625827ba8aa15a1c5c1c8 Mon Sep 17 00:00:00 2001 From: teamcons Date: Wed, 29 Apr 2026 14:30:55 +0200 Subject: [PATCH 2/7] prototype --- src/Widgets/TextView.vala | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/Widgets/TextView.vala b/src/Widgets/TextView.vala index 9d57ecac..06b4ba95 100644 --- a/src/Widgets/TextView.vala +++ b/src/Widgets/TextView.vala @@ -21,6 +21,9 @@ public class Jorts.TextView : Granite.HyperTextView { set {buffer.text = value;} } + Gtk.TextTag tag_list; + private const string TAG_LIST = "list"; + public SimpleActionGroup actions {get; construct;} public const string ACTION_PREFIX = "textview."; public const string ACTION_TOGGLE_LIST = "action_toggle_list"; @@ -32,7 +35,6 @@ public class Jorts.TextView : Granite.HyperTextView { public TextView () { Object ( wrap_mode: Gtk.WrapMode.WORD_CHAR, - buffer: new Gtk.TextBuffer (null), bottom_margin: SPACING_DOUBLE, left_margin: SPACING_DOUBLE, right_margin: SPACING_DOUBLE, @@ -71,8 +73,14 @@ public class Jorts.TextView : Granite.HyperTextView { extra.append_section (null, section); extra_menu = extra; - var list_tag = buffer.create_tag ("list"); - list_tag.indent = 5; + + + var tag_table = new Gtk.TextTagTable (); + buffer = new Gtk.TextBuffer (tag_table); + + + tag_list = buffer.create_tag (TAG_LIST); + tag_list.indent = -24; /***************************************************/ @@ -150,8 +158,15 @@ public class Jorts.TextView : Granite.HyperTextView { if (!this.has_prefix (line_number)) { buffer.get_iter_at_line_offset (out line_start, line_number, 0); buffer.insert (ref line_start, list_item_start, -1); + + buffer.get_iter_at_line_offset (out line_start, line_number, 0); + + var line_end = line_start.copy (); + line_end.forward_to_line_end (); + buffer.apply_tag (tag_list, line_start, line_end); } } + } /** @@ -174,6 +189,10 @@ public class Jorts.TextView : Granite.HyperTextView { buffer.get_iter_at_line_offset (out line_start, line_number, 0); buffer.get_iter_at_line_offset (out prefix_end, line_number, remove_range); buffer.delete (ref line_start, ref prefix_end); + + var line_end = line_start.copy (); + line_end.forward_to_line_end (); + buffer.remove_tag (tag_list, line_start, line_end); } /** From ffb2483f89c32ee0859d8367b5b365d6000277cb Mon Sep 17 00:00:00 2001 From: teamcons Date: Wed, 29 Apr 2026 15:39:34 +0200 Subject: [PATCH 3/7] proto --- src/Widgets/TextView.vala | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/Widgets/TextView.vala b/src/Widgets/TextView.vala index 06b4ba95..375d6c11 100644 --- a/src/Widgets/TextView.vala +++ b/src/Widgets/TextView.vala @@ -22,7 +22,7 @@ public class Jorts.TextView : Granite.HyperTextView { } Gtk.TextTag tag_list; - private const string TAG_LIST = "list"; + private const string TAG_LIST = "list_item"; public SimpleActionGroup actions {get; construct;} public const string ACTION_PREFIX = "textview."; @@ -34,7 +34,7 @@ public class Jorts.TextView : Granite.HyperTextView { public TextView () { Object ( - wrap_mode: Gtk.WrapMode.WORD_CHAR, + wrap_mode: Gtk.WrapMode.WORD, bottom_margin: SPACING_DOUBLE, left_margin: SPACING_DOUBLE, right_margin: SPACING_DOUBLE, @@ -79,10 +79,18 @@ public class Jorts.TextView : Granite.HyperTextView { buffer = new Gtk.TextBuffer (tag_table); - tag_list = buffer.create_tag (TAG_LIST); - tag_list.indent = -24; + var a = new Pango.TabArray (2, true); + a.set_tab (0, Pango.TabAlign.LEFT, 0); + a.set_tab (1, Pango.TabAlign.LEFT, 14); + + tag_list = buffer.create_tag (TAG_LIST); + tag_list.indent = -14; + tag_list.left_margin = 14; + tag_list.wrap_mode = Gtk.WrapMode.WORD; + tag_list.tabs = a; + /***************************************************/ /* CONNECTS AND BINDS */ /***************************************************/ @@ -156,14 +164,14 @@ public class Jorts.TextView : Granite.HyperTextView { debug ("doing line " + line_number.to_string ()); if (!this.has_prefix (line_number)) { - buffer.get_iter_at_line_offset (out line_start, line_number, 0); - buffer.insert (ref line_start, list_item_start, -1); - buffer.get_iter_at_line_offset (out line_start, line_number, 0); var line_end = line_start.copy (); line_end.forward_to_line_end (); buffer.apply_tag (tag_list, line_start, line_end); + + buffer.insert (ref line_start, "%s\t".printf (list_item_start), -1); + } } From 9d79dcb06bcc83aa9aac7bf4891af1e3a3fd6995 Mon Sep 17 00:00:00 2001 From: teamcons Date: Wed, 29 Apr 2026 16:11:48 +0200 Subject: [PATCH 4/7] add granularity --- src/Widgets/TextView.vala | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/Widgets/TextView.vala b/src/Widgets/TextView.vala index 375d6c11..fcc172e4 100644 --- a/src/Widgets/TextView.vala +++ b/src/Widgets/TextView.vala @@ -177,6 +177,33 @@ public class Jorts.TextView : Granite.HyperTextView { } + /** + * Add the list prefix only to lines who hasnt it already + */ + private void set_list_at (int line) { + Gtk.TextIter line_start; + + buffer.get_iter_at_line_offset (out line_start, line, 0); + var line_end = line_start.copy (); + line_end.forward_to_line_end (); + buffer.apply_tag (tag_list, line_start, line_end); + + buffer.insert (ref line_start, "%s\t".printf (list_item_start), -1); + } + + + + private void remove_list_at (int line) { + if (!has_prefix (line)) { + return; + } + + Gtk.TextIter line_start; + remove_prefix (line); + } + + + /** * Remove list prefix from line x to line y. Presuppose it is there */ From 8ff79f482a16d002a00dbb0320c063c59b970880 Mon Sep 17 00:00:00 2001 From: teamcons Date: Fri, 1 May 2026 20:05:34 +0200 Subject: [PATCH 5/7] proto --- src/Widgets/TextView.vala | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Widgets/TextView.vala b/src/Widgets/TextView.vala index fcc172e4..0921de9c 100644 --- a/src/Widgets/TextView.vala +++ b/src/Widgets/TextView.vala @@ -78,9 +78,6 @@ public class Jorts.TextView : Granite.HyperTextView { var tag_table = new Gtk.TextTagTable (); buffer = new Gtk.TextBuffer (tag_table); - - - var a = new Pango.TabArray (2, true); a.set_tab (0, Pango.TabAlign.LEFT, 0); a.set_tab (1, Pango.TabAlign.LEFT, 14); @@ -166,12 +163,13 @@ public class Jorts.TextView : Granite.HyperTextView { if (!this.has_prefix (line_number)) { buffer.get_iter_at_line_offset (out line_start, line_number, 0); + buffer.insert (ref line_start, "%s\t".printf (list_item_start), -1); + + buffer.get_iter_at_line_offset (out line_start, line_number, 0); var line_end = line_start.copy (); line_end.forward_to_line_end (); - buffer.apply_tag (tag_list, line_start, line_end); - - buffer.insert (ref line_start, "%s\t".printf (list_item_start), -1); + buffer.apply_tag (tag_list, line_start, line_end); } } From 2b8a8108ce5f9a5a911392072073eb5b2164b773 Mon Sep 17 00:00:00 2001 From: teamcons Date: Sat, 2 May 2026 17:50:45 +0200 Subject: [PATCH 6/7] do not build latte in appcenter --- meson.build | 11 ++++++----- src/Objects/Themes.vala | 8 ++++++++ src/Widgets/Popover.vala | 3 --- src/Widgets/PopoverWidgets/ColorBox.vala | 4 ++++ 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/meson.build b/meson.build index a9d65e49..77f075fe 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project( 'jorts', 'vala', 'c', - version: '4.1.0', + version: '4.1.1', license: 'GPL-3.0-or-later' ) @@ -15,25 +15,26 @@ legacy_app_id = 'io.github.ellie_commons.' + app_name legacy_app_path = '/io/github/ellie_commons/' + app_name +vala_flags = [] + if get_option('legacy-rdnn') app_id = legacy_app_id alternate_app_id = correct_app_id app_path = legacy_app_path + #TODO: Remove once appcenter has latte + vala_flags += ['--define', 'LATTE'] else app_id = correct_app_id alternate_app_id = legacy_app_id app_path = correct_app_path - endif - -vala_flags = [] - development_build = get_option('development') if development_build app_id += '.devel' vala_flags += ['--define', 'DEVEL'] + vala_flags += ['--define', 'LATTE'] endif #================================ diff --git a/src/Objects/Themes.vala b/src/Objects/Themes.vala index d92284d3..9bf0c63f 100644 --- a/src/Objects/Themes.vala +++ b/src/Objects/Themes.vala @@ -81,7 +81,11 @@ public enum Jorts.Themes { * convenient list of all supported themes */ public static Themes[] all () { +#if LATTE return {BLUEBERRY, MINT, LIME, BANANA, ORANGE, STRAWBERRY, BUBBLEGUM, GRAPE, COCOA, SLATE, LATTE}; +#else + return {BLUEBERRY, MINT, LIME, BANANA, ORANGE, STRAWBERRY, BUBBLEGUM, GRAPE, COCOA, SLATE}; +#endif } /*************************************************/ @@ -89,7 +93,11 @@ public enum Jorts.Themes { * convenient list of all supported themes */ public static string[] all_string () { +#if LATTE return {"BLUEBERRY", "MINT", "LIME", "BANANA", "ORANGE", "STRAWBERRY", "BUBBLEGUM", "GRAPE", "COCOA", "SLATE", "LATTE"}; +#else + return {"BLUEBERRY", "MINT", "LIME", "BANANA", "ORANGE", "STRAWBERRY", "BUBBLEGUM", "GRAPE", "COCOA", "SLATE"}; +#endif } /*************************************************/ diff --git a/src/Widgets/Popover.vala b/src/Widgets/Popover.vala index 6ea37c13..5e4224f0 100644 --- a/src/Widgets/Popover.vala +++ b/src/Widgets/Popover.vala @@ -55,9 +55,6 @@ public class Jorts.Popover : Gtk.Popover { } construct { -#if DEVEL - autohide = false; -#endif var view = new Gtk.Box (VERTICAL, SPACING_DOUBLE) { margin_top = SPACING_DOUBLE, margin_bottom = SPACING_DOUBLE diff --git a/src/Widgets/PopoverWidgets/ColorBox.vala b/src/Widgets/PopoverWidgets/ColorBox.vala index 7ee63303..725d51af 100644 --- a/src/Widgets/PopoverWidgets/ColorBox.vala +++ b/src/Widgets/PopoverWidgets/ColorBox.vala @@ -56,7 +56,11 @@ public class Jorts.ColorBox : Gtk.Box { append (grape_button); append (cocoa_button); append (slate_button); + +#if LATTE append (latte_button); +#endif + //append (auto_button); accent_color_action = new SimpleAction.stateful ("prefers-accent-color", GLib.VariantType.INT32, new Variant.int32 (Themes.IDK)); From bee959631f29c80e8c527e4bd2d3d3a060125bfc Mon Sep 17 00:00:00 2001 From: teamcons Date: Sat, 2 May 2026 17:53:23 +0200 Subject: [PATCH 7/7] Revert "do not build latte in appcenter" This reverts commit 2b8a8108ce5f9a5a911392072073eb5b2164b773. undo wrong branch merge --- meson.build | 11 +++++------ src/Objects/Themes.vala | 8 -------- src/Widgets/Popover.vala | 3 +++ src/Widgets/PopoverWidgets/ColorBox.vala | 4 ---- 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/meson.build b/meson.build index 77f075fe..a9d65e49 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project( 'jorts', 'vala', 'c', - version: '4.1.1', + version: '4.1.0', license: 'GPL-3.0-or-later' ) @@ -15,26 +15,25 @@ legacy_app_id = 'io.github.ellie_commons.' + app_name legacy_app_path = '/io/github/ellie_commons/' + app_name -vala_flags = [] - if get_option('legacy-rdnn') app_id = legacy_app_id alternate_app_id = correct_app_id app_path = legacy_app_path - #TODO: Remove once appcenter has latte - vala_flags += ['--define', 'LATTE'] else app_id = correct_app_id alternate_app_id = legacy_app_id app_path = correct_app_path + endif + +vala_flags = [] + development_build = get_option('development') if development_build app_id += '.devel' vala_flags += ['--define', 'DEVEL'] - vala_flags += ['--define', 'LATTE'] endif #================================ diff --git a/src/Objects/Themes.vala b/src/Objects/Themes.vala index 9bf0c63f..d92284d3 100644 --- a/src/Objects/Themes.vala +++ b/src/Objects/Themes.vala @@ -81,11 +81,7 @@ public enum Jorts.Themes { * convenient list of all supported themes */ public static Themes[] all () { -#if LATTE return {BLUEBERRY, MINT, LIME, BANANA, ORANGE, STRAWBERRY, BUBBLEGUM, GRAPE, COCOA, SLATE, LATTE}; -#else - return {BLUEBERRY, MINT, LIME, BANANA, ORANGE, STRAWBERRY, BUBBLEGUM, GRAPE, COCOA, SLATE}; -#endif } /*************************************************/ @@ -93,11 +89,7 @@ public enum Jorts.Themes { * convenient list of all supported themes */ public static string[] all_string () { -#if LATTE return {"BLUEBERRY", "MINT", "LIME", "BANANA", "ORANGE", "STRAWBERRY", "BUBBLEGUM", "GRAPE", "COCOA", "SLATE", "LATTE"}; -#else - return {"BLUEBERRY", "MINT", "LIME", "BANANA", "ORANGE", "STRAWBERRY", "BUBBLEGUM", "GRAPE", "COCOA", "SLATE"}; -#endif } /*************************************************/ diff --git a/src/Widgets/Popover.vala b/src/Widgets/Popover.vala index 5e4224f0..6ea37c13 100644 --- a/src/Widgets/Popover.vala +++ b/src/Widgets/Popover.vala @@ -55,6 +55,9 @@ public class Jorts.Popover : Gtk.Popover { } construct { +#if DEVEL + autohide = false; +#endif var view = new Gtk.Box (VERTICAL, SPACING_DOUBLE) { margin_top = SPACING_DOUBLE, margin_bottom = SPACING_DOUBLE diff --git a/src/Widgets/PopoverWidgets/ColorBox.vala b/src/Widgets/PopoverWidgets/ColorBox.vala index 725d51af..7ee63303 100644 --- a/src/Widgets/PopoverWidgets/ColorBox.vala +++ b/src/Widgets/PopoverWidgets/ColorBox.vala @@ -56,11 +56,7 @@ public class Jorts.ColorBox : Gtk.Box { append (grape_button); append (cocoa_button); append (slate_button); - -#if LATTE append (latte_button); -#endif - //append (auto_button); accent_color_action = new SimpleAction.stateful ("prefers-accent-color", GLib.VariantType.INT32, new Variant.int32 (Themes.IDK));