Skip to content

Commit b100b5d

Browse files
authored
Add a list feature
* Add a list feature * expose list customization in settings * change spacing * Expand list function * reactive buffer to user inputs in regards to lists * hide button if no prefix * refine hide button thingy * More elegant and snappy list expand * attempt at a dynamic togglebutton
1 parent 82f289f commit b100b5d

File tree

11 files changed

+284
-36
lines changed

11 files changed

+284
-36
lines changed

data/jorts.gschema.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,10 @@
1111
<summary>Hide actionbar</summary>
1212
<description>Whether to hide the actionbar and its buttons</description>
1313
</key>
14+
<key name="list-item-start" type="s">
15+
<default>" - "</default>
16+
<summary>Hide actionbar</summary>
17+
<description>Whether to hide the actionbar and its buttons</description>
18+
</key>
1419
</schema>
1520
</schemalist>

data/jorts.metainfo.xml.in

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
<p>🚀 4.0.0 Jorts of Hyperspace!</p>
100100
<ul>
101101
<li>Version 4 to align with Gtk version</li>
102+
<li>Added button to toggle lists, and ability to customize them</li>
102103
<li>Ctrl+Scroll to zoom-in, zoom-out</li>
103104
<li>More zoom options</li>
104105
<li>Keyboard shortcuts work from popover now</li>
@@ -114,7 +115,8 @@
114115
<issues>
115116
<issue url="https://github.com/ellie-commons/jorts/issues/79">Fixed zoom impacting emojichooser and context menu</issue>
116117
<issue url="https://github.com/ellie-commons/jorts/issues/95">Fixed coloring bleeding into icons in emojichooser and context menu</issue>
117-
<issue url="https://github.com/ellie-commons/jorts/issues/78">Fixed absence of Ctrl+scroll</issue>
118+
<issue url="https://github.com/ellie-commons/jorts/issues/78">Added Ctrl+scroll</issue>
119+
<issue url="https://github.com/ellie-commons/jorts/issues/63">Added list feature</issue>
118120
</issues>
119121
</release>
120122
<release version="3.5.0" date="2025-11-06">

src/Application.vala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ public class Jorts.Application : Gtk.Application {
100100
set_accels_for_action ("win.action_toggle_mono", {"<Control>m"});
101101
set_accels_for_action ("win.action_focus_title", {"<Control>L"});
102102
set_accels_for_action ("win.action_show_emoji", {"<Control>period"});
103+
set_accels_for_action ("win.action_toggle_list", {"<Shift>F12"});
103104
set_accels_for_action ("win.action_show_menu", {"<Control>G", "<Control>O"});
104105

105106
set_accels_for_action ("win.action_theme_1", {"<Alt>1"});

src/Services/Constants.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ namespace Jorts.Constants {
3636

3737
// New preference window
3838
const int DEFAULT_PREF_WIDTH = 550;
39-
const int DEFAULT_PREF_HEIGHT = 290;
39+
const int DEFAULT_PREF_HEIGHT = 310;
4040

4141
/*************************************************/
4242
// Shortcuts

src/Views/NoteView.vala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@
6868
emojichooser_popover.show.connect (randomize_emote_button);
6969
emojichooser_popover.emoji_picked.connect (on_emoji_picked);
7070
//Application.gsettings.bind ("hide-bar", actionbar, "revealed", SettingsBindFlags.INVERT_BOOLEAN);
71+
72+
//textview.bind_property ("on_list_item", actionbar.list_button, "active", GLib.BindingFlags.DEFAULT);
7173
}
7274

7375
// Randomize the button emoji when clicked

src/Views/PreferencesView.vala

Lines changed: 74 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212

1313
construct {
1414
orientation = VERTICAL;
15-
margin_top = 12;
16-
margin_bottom = 12;
17-
margin_start = 12;
18-
margin_end = 12;
15+
margin_top = 10;
16+
margin_bottom = 10;
17+
margin_start = 10;
18+
margin_end = 10;
1919

2020
var overlay = new Gtk.Overlay ();
2121
append (overlay);
@@ -24,15 +24,48 @@
2424
overlay.add_overlay (toast);
2525

2626
// the box with all the settings
27-
var settingsbox = new Gtk.Box (VERTICAL, 24) {
28-
margin_top = 6,
29-
margin_start = 6,
30-
margin_end = 6,
27+
var settingsbox = new Gtk.Box (VERTICAL, 20) {
28+
margin_top = 5,
29+
margin_start = 5,
30+
margin_end = 5,
3131
hexpand = true,
3232
vexpand = true,
3333
valign = Gtk.Align.START
3434
};
3535

36+
37+
/***************************************/
38+
/* lists */
39+
/***************************************/
40+
41+
var lists_box = new Gtk.Box (HORIZONTAL, 5);
42+
43+
var list_entry = new Gtk.Entry () {
44+
halign = Gtk.Align.END,
45+
hexpand = false,
46+
valign = Gtk.Align.CENTER,
47+
max_length = 5,
48+
max_width_chars = 5
49+
};
50+
51+
var list_label = new Granite.HeaderLabel (_("List item symbol")) {
52+
mnemonic_widget = list_entry,
53+
secondary_text = _("Prefix by which to begin each item in a list. If there is no prefix, the toggle list button will be hidden"),
54+
hexpand = true
55+
};
56+
57+
lists_box.append (list_label);
58+
lists_box.append (list_entry);
59+
60+
Application.gsettings.bind (
61+
"list-item-start",
62+
list_entry, "text",
63+
SettingsBindFlags.DEFAULT);
64+
65+
66+
settingsbox.append (lists_box);
67+
68+
3669
/*************************************************/
3770
/* scribbly Toggle */
3871
/*************************************************/
@@ -63,13 +96,13 @@
6396
/* Autostart Request */
6497
/****************************************************/
6598
#if !WINDOWS
66-
var both_buttons = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6) {
99+
var both_buttons = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 5) {
67100
halign = Gtk.Align.FILL
68101
};
69102

70103
///TRANSLATORS: Button to autostart the application
71104
var set_autostart = new Gtk.Button () {
72-
label = _("Set autostart"),
105+
label = _("Autostart"),
73106
valign = Gtk.Align.CENTER
74107
};
75108

@@ -94,7 +127,7 @@
94127
both_buttons.append (set_autostart);
95128
both_buttons.append (remove_autostart);
96129

97-
var autostart_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6);
130+
var autostart_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 5);
98131

99132
var autostart_label = new Granite.HeaderLabel (_("Allow to start at login")) {
100133
mnemonic_widget = both_buttons,
@@ -109,12 +142,12 @@
109142
/*************************************************/
110143
// Bar at the bottom
111144
var actionbar = new Gtk.CenterBox () {
112-
margin_start = 6,
113-
margin_end = 6,
114-
valign = Gtk.Align.END
145+
margin_start = 5,
146+
margin_end = 5,
147+
valign = Gtk.Align.END,
148+
hexpand = true,
149+
vexpand = false
115150
};
116-
actionbar.set_hexpand (true);
117-
actionbar.set_vexpand (false);
118151

119152
// Monies?
120153
var support_button = new Gtk.LinkButton.with_label (
@@ -123,12 +156,6 @@
123156
);
124157
actionbar.start_widget = support_button;
125158

126-
// Reset
127-
//reset_button = new Gtk.Button ();
128-
//reset_button.set_label ( _("Reset to Default"));
129-
//reset_button.tooltip_markup = (_("Reset all settings to defaults"));
130-
//actionbar.pack_end (reset_button);
131-
132159
close_button = new Gtk.Button () {
133160
width_request = 96,
134161
label = _("Close"),
@@ -137,9 +164,33 @@
137164
_("Close preferences")
138165
)
139166
};
140-
actionbar.end_widget = close_button;
167+
168+
var reset = new Gtk.Button.from_icon_name ("system-reboot-symbolic") {
169+
tooltip_markup = _("Reset all settings to defaults"),
170+
valign = Gtk.Align.CENTER
171+
};
172+
reset.clicked.connect (on_reset);
173+
174+
var end_box = new Gtk.Box (HORIZONTAL, 5);
175+
end_box.append (reset);
176+
end_box.append (close_button);
177+
actionbar.end_widget = end_box;
141178

142179
append (settingsbox);
143180
append (actionbar);
144181
}
182+
183+
private void on_reset () {
184+
debug ("Resetting settings…");
185+
186+
string[] keys = {"scribbly-mode-active", "hide-bar", "list-item-start"};
187+
foreach (var key in keys) {
188+
Application.gsettings.reset (key);
189+
}
190+
191+
#if !WINDOWS
192+
Jorts.Utils.autostart_remove ();
193+
toast.send_notification ();
194+
#endif
195+
}
145196
}

src/Widgets/ActionBar.vala

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
public class Jorts.ActionBar : Granite.Bin {
1313

1414
public Gtk.ActionBar actionbar;
15+
public Gtk.Button list_button;
1516
public Gtk.MenuButton emoji_button;
1617
public Gtk.EmojiChooser emojichooser_popover;
1718
public Gtk.MenuButton menu_button;
@@ -45,6 +46,18 @@
4546
delete_item.action_name = StickyNoteWindow.ACTION_PREFIX + StickyNoteWindow.ACTION_DELETE;
4647

4748
/* **** RIGHT **** */
49+
list_button = new Gtk.Button () {
50+
icon_name = "view-list-symbolic",
51+
width_request = 32,
52+
height_request = 32,
53+
tooltip_markup = Granite.markup_accel_tooltip (
54+
{"<Shift>F12"},
55+
_("Toggle list")
56+
)
57+
};
58+
list_button.add_css_class ("themedbutton");
59+
list_button.action_name = StickyNoteWindow.ACTION_PREFIX + StickyNoteWindow.ACTION_TOGGLE_LIST;
60+
4861
emojichooser_popover = new Gtk.EmojiChooser ();
4962

5063
emoji_button = new Gtk.MenuButton () {
@@ -80,6 +93,7 @@
8093
actionbar.pack_start (delete_item);
8194
actionbar.pack_end (menu_button);
8295
actionbar.pack_end (emoji_button);
96+
actionbar.pack_end (list_button);
8397

8498
handle = new Gtk.WindowHandle () {
8599
child = actionbar
@@ -89,6 +103,11 @@
89103

90104
// Randomize-skip emoji icon
91105
emojichooser_popover.show.connect (on_emoji_popover);
106+
107+
// Hide the list button if user has specified no list item symbol
108+
on_prefix_changed ();
109+
Application.gsettings.changed["list-item-start"].connect (on_prefix_changed);
110+
92111
}
93112

94113
/**
@@ -109,4 +128,8 @@
109128
)
110129
);
111130
}
131+
132+
private void on_prefix_changed () {
133+
list_button.visible = (Application.gsettings.get_string ("list-item-start") != "");
134+
}
112135
}

src/Widgets/PreferencesWidgets/SettingsSwitch.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class Jorts.SettingsSwitch : Gtk.Box {
1212

1313
public SettingsSwitch (string name, string explanation, string key) {
1414
orientation = Gtk.Orientation.HORIZONTAL;
15-
spacing = 6;
15+
spacing = 5;
1616

1717
var toggle = new Gtk.Switch () {
1818
halign = Gtk.Align.END,

0 commit comments

Comments
 (0)