Skip to content

Commit c03c312

Browse files
teamconsyournamem
andauthored
Working branch (#97)
* Make absolutely super sure the window is deleted (some of it stays in memory urg) * add more specific class * use more specific class naming, and use % instead of em * Forgot this * Programmatical to_class * forgot comma * metainfo * Trim README * sweep out deprecated theme * retire from_string * move libportal out * Correct wrong zoom class name * forgor semicolons * oops * bin unused function, make random the default * bin static functions, use an enum for zoom * Introduce a ZoomController to deal with this shit * Retire old now unused zomconvert * use static stylesheets * DRY and future proof by making a custom widget * do not keep hidden preferences * retire old themer service as we now statically do the stylesheets * move debounce to the manager * Avoid agressively theming everything * Fully clickable editablelabel * update PO * remove unused * Restore padding * Add a ctrl+scroll thingy * LETS GOOOOO * woops * hmmmm * try make it build * handler * introduce a scribblycontroller * Cast as widget * fix build mistake * skip the on focus gtk settings bullshit * Zoom which now functions * Update PO and restore some theming bullshit * this should be a debug * remove old strings * remove unused * this one too * Rebuild * updated size and branding * auto version * Avoid not being allowed to keep writing * fix some pissy bug where ctrl blocks text editing * fix menus changing size and line spacing * rename window specific actions and make them available for the popover as well * update metainfo * emojichooser causes issue from popover --------- Co-authored-by: yournamem <[email protected]>
1 parent 421a1d6 commit c03c312

File tree

5 files changed

+74
-43
lines changed

5 files changed

+74
-43
lines changed

data/jorts.metainfo.xml.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
<li>Version 4 to align with Gtk version</li>
102102
<li>Ctrl+Scroll to zoom-in, zoom-out</li>
103103
<li>More zoom options</li>
104+
<li>Keyboard shortcuts work from popover now</li>
104105
<li>A couple visual bugfixes as well!</li>
105106
<li>Various under the hood performance improvements</li>
106107
</ul>

src/Application.vala

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ public class Jorts.Application : Gtk.Application {
5757
public const string ACTION_PREFIX = "app.";
5858
public const string ACTION_QUIT = "action_quit";
5959
public const string ACTION_NEW = "action_new";
60-
public const string ACTION_DELETE = "action_delete";
6160
public const string ACTION_TOGGLE_SCRIBBLY = "action_toggle_scribbly";
6261
public const string ACTION_TOGGLE_ACTIONBAR = "action_toggle_actionbar";
6362
public const string ACTION_SHOW_PREFERENCES = "action_show_preferences";
@@ -89,29 +88,30 @@ public class Jorts.Application : Gtk.Application {
8988
add_action_entries (ACTION_ENTRIES, this);
9089
set_accels_for_action ("app.action_quit", {"<Control>Q"});
9190
set_accels_for_action ("app.action_new", {"<Control>N"});
92-
set_accels_for_action ("app.action_delete", {"<Control>W"});
9391
set_accels_for_action ("app.action_save", {"<Control>S"});
94-
set_accels_for_action ("app.action_zoom_out", {"<Control>minus", "<Control>KP_Subtract"});
95-
set_accels_for_action ("app.action_zoom_default", {"<Control>equal", "<Control>0", "<Control>KP_0"});
96-
set_accels_for_action ("app.action_zoom_in", {"<Control>plus", "<Control>KP_Add"});
97-
set_accels_for_action ("app.action_toggle_scribbly", {"<Control>H"});
98-
set_accels_for_action ("app.action_toggle_mono", {"<Control>m"});
9992
set_accels_for_action ("app.action_toggle_actionbar", {"<Control>T"});
10093
set_accels_for_action ("app.action_show_preferences", {"<Control>P"});
101-
set_accels_for_action ("app.action_focus_title", {"<Control>L"});
102-
set_accels_for_action ("app.action_show_emoji", {"<Control>period"});
103-
set_accels_for_action ("app.action_show_menu", {"<Control>G", "<Control>O"});
104-
105-
set_accels_for_action ("app.action_theme_1", {"<Alt>1"});
106-
set_accels_for_action ("app.action_theme_2", {"<Alt>2"});
107-
set_accels_for_action ("app.action_theme_3", {"<Alt>3"});
108-
set_accels_for_action ("app.action_theme_4", {"<Alt>4"});
109-
set_accels_for_action ("app.action_theme_5", {"<Alt>5"});
110-
set_accels_for_action ("app.action_theme_6", {"<Alt>6"});
111-
set_accels_for_action ("app.action_theme_7", {"<Alt>7"});
112-
set_accels_for_action ("app.action_theme_8", {"<Alt>8"});
113-
set_accels_for_action ("app.action_theme_9", {"<Alt>9"});
114-
set_accels_for_action ("app.action_theme_0", {"<Alt>0", "<Alt>KP_0"});
94+
set_accels_for_action ("app.action_toggle_scribbly", {"<Control>H"});
95+
96+
set_accels_for_action ("win.action_delete", {"<Control>W"});
97+
set_accels_for_action ("win.action_zoom_out", {"<Control>minus", "<Control>KP_Subtract"});
98+
set_accels_for_action ("win.action_zoom_default", {"<Control>equal", "<Control>0", "<Control>KP_0"});
99+
set_accels_for_action ("win.action_zoom_in", {"<Control>plus", "<Control>KP_Add"});
100+
set_accels_for_action ("win.action_toggle_mono", {"<Control>m"});
101+
set_accels_for_action ("win.action_focus_title", {"<Control>L"});
102+
set_accels_for_action ("win.action_show_emoji", {"<Control>period"});
103+
set_accels_for_action ("win.action_show_menu", {"<Control>G", "<Control>O"});
104+
105+
set_accels_for_action ("win.action_theme_1", {"<Alt>1"});
106+
set_accels_for_action ("win.action_theme_2", {"<Alt>2"});
107+
set_accels_for_action ("win.action_theme_3", {"<Alt>3"});
108+
set_accels_for_action ("win.action_theme_4", {"<Alt>4"});
109+
set_accels_for_action ("win.action_theme_5", {"<Alt>5"});
110+
set_accels_for_action ("win.action_theme_6", {"<Alt>6"});
111+
set_accels_for_action ("win.action_theme_7", {"<Alt>7"});
112+
set_accels_for_action ("win.action_theme_8", {"<Alt>8"});
113+
set_accels_for_action ("win.action_theme_9", {"<Alt>9"});
114+
set_accels_for_action ("win.action_theme_0", {"<Alt>0", "<Alt>KP_0"});
115115

116116

117117
// Force the eOS icon theme, and set the blueberry as fallback, if for some reason it fails for individual notes

src/Views/PopoverView.vala

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,35 @@ public class Jorts.PopoverView : Gtk.Popover {
3232
public signal void zoom_changed (Jorts.Zoomkind zoomkind);
3333
public signal void monospace_changed (bool if_monospace);
3434

35+
static construct
36+
{
37+
add_binding_action(Gdk.Key.plus, Gdk.ModifierType.CONTROL_MASK, StickyNoteWindow.ACTION_PREFIX + StickyNoteWindow.ACTION_ZOOM_IN, null);
38+
add_binding_action(Gdk.Key.equal, Gdk.ModifierType.CONTROL_MASK, StickyNoteWindow.ACTION_PREFIX + StickyNoteWindow.ACTION_ZOOM_DEFAULT, null);
39+
add_binding_action(48, Gdk.ModifierType.CONTROL_MASK, StickyNoteWindow.ACTION_PREFIX + StickyNoteWindow.ACTION_ZOOM_DEFAULT, null);
40+
add_binding_action(Gdk.Key.minus, Gdk.ModifierType.CONTROL_MASK, StickyNoteWindow.ACTION_PREFIX + StickyNoteWindow.ACTION_ZOOM_OUT, null);
41+
42+
add_binding_action(Gdk.Key.w, Gdk.ModifierType.CONTROL_MASK, Application.ACTION_PREFIX + Application.ACTION_NEW, null);
43+
add_binding_action(Gdk.Key.w, Gdk.ModifierType.CONTROL_MASK, StickyNoteWindow.ACTION_PREFIX + StickyNoteWindow.ACTION_DELETE, null);
44+
add_binding_action(Gdk.Key.m, Gdk.ModifierType.CONTROL_MASK, StickyNoteWindow.ACTION_PREFIX + StickyNoteWindow.ACTION_TOGGLE_MONO, null);
45+
add_binding_action(Gdk.Key.g, Gdk.ModifierType.CONTROL_MASK, StickyNoteWindow.ACTION_PREFIX + StickyNoteWindow.ACTION_SHOW_MENU, null);
46+
add_binding_action(Gdk.Key.o, Gdk.ModifierType.CONTROL_MASK, StickyNoteWindow.ACTION_PREFIX + StickyNoteWindow.ACTION_SHOW_MENU, null);
47+
add_binding_action(Gdk.Key.l, Gdk.ModifierType.CONTROL_MASK, StickyNoteWindow.ACTION_PREFIX + StickyNoteWindow.ACTION_FOCUS_TITLE, null);
48+
49+
// Compiler whines about Gdk.Key.1 because name is a number so it doesnt see it.
50+
// So we use magic numbers
51+
add_binding_action(49, Gdk.ModifierType.ALT_MASK, StickyNoteWindow.ACTION_PREFIX + StickyNoteWindow.ACTION_THEME_1, null);
52+
add_binding_action(50, Gdk.ModifierType.ALT_MASK, StickyNoteWindow.ACTION_PREFIX + StickyNoteWindow.ACTION_THEME_2, null);
53+
add_binding_action(51, Gdk.ModifierType.ALT_MASK, StickyNoteWindow.ACTION_PREFIX + StickyNoteWindow.ACTION_THEME_3, null);
54+
add_binding_action(52, Gdk.ModifierType.ALT_MASK, StickyNoteWindow.ACTION_PREFIX + StickyNoteWindow.ACTION_THEME_4, null);
55+
add_binding_action(53, Gdk.ModifierType.ALT_MASK, StickyNoteWindow.ACTION_PREFIX + StickyNoteWindow.ACTION_THEME_5, null);
56+
add_binding_action(54, Gdk.ModifierType.ALT_MASK, StickyNoteWindow.ACTION_PREFIX + StickyNoteWindow.ACTION_THEME_6, null);
57+
add_binding_action(55, Gdk.ModifierType.ALT_MASK, StickyNoteWindow.ACTION_PREFIX + StickyNoteWindow.ACTION_THEME_7, null);
58+
add_binding_action(56, Gdk.ModifierType.ALT_MASK, StickyNoteWindow.ACTION_PREFIX + StickyNoteWindow.ACTION_THEME_8, null);
59+
add_binding_action(57, Gdk.ModifierType.ALT_MASK, StickyNoteWindow.ACTION_PREFIX + StickyNoteWindow.ACTION_THEME_9, null);
60+
add_binding_action(48, Gdk.ModifierType.ALT_MASK, StickyNoteWindow.ACTION_PREFIX + StickyNoteWindow.ACTION_THEME_0, null);
61+
}
62+
63+
3564
/****************/
3665
public PopoverView (Jorts.StickyNoteWindow window) {
3766
position = Gtk.PositionType.TOP;

src/Widgets/ActionBar.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
)
4343
};
4444
delete_item.add_css_class ("themedbutton");
45-
delete_item.action_name = Application.ACTION_PREFIX + Application.ACTION_DELETE;
45+
delete_item.action_name = StickyNoteWindow.ACTION_PREFIX + StickyNoteWindow.ACTION_DELETE;
4646

4747
/* **** RIGHT **** */
4848
emojichooser_popover = new Gtk.EmojiChooser ();

src/Windows/StickyNoteWindow.vala

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,30 +32,31 @@ public class Jorts.StickyNoteWindow : Gtk.Window {
3232
private Gtk.EventControllerKey keypress_controller;
3333
private Gtk.EventControllerScroll scroll_controller;
3434

35-
private const string ACTION_PREFIX = "app.";
36-
private const string ACTION_SHOW_EMOJI = "action_show_emoji";
37-
private const string ACTION_SHOW_MENU = "action_show_menu";
38-
private const string ACTION_FOCUS_TITLE = "action_focus_title";
39-
private const string ACTION_ZOOM_OUT = "action_zoom_out";
40-
private const string ACTION_ZOOM_DEFAULT = "action_zoom_default";
41-
private const string ACTION_ZOOM_IN = "action_zoom_in";
42-
private const string ACTION_TOGGLE_MONO = "action_toggle_mono";
43-
44-
private const string ACTION_THEME_1 = "action_theme_1";
45-
private const string ACTION_THEME_2 = "action_theme_2";
46-
private const string ACTION_THEME_3 = "action_theme_3";
47-
private const string ACTION_THEME_4 = "action_theme_4";
48-
private const string ACTION_THEME_5 = "action_theme_5";
49-
private const string ACTION_THEME_6 = "action_theme_6";
50-
private const string ACTION_THEME_7 = "action_theme_7";
51-
private const string ACTION_THEME_8 = "action_theme_8";
52-
private const string ACTION_THEME_9 = "action_theme_9";
53-
private const string ACTION_THEME_0 = "action_theme_0";
35+
public const string ACTION_PREFIX = "win.";
36+
public const string ACTION_SHOW_EMOJI = "action_show_emoji";
37+
public const string ACTION_SHOW_MENU = "action_show_menu";
38+
public const string ACTION_FOCUS_TITLE = "action_focus_title";
39+
public const string ACTION_ZOOM_OUT = "action_zoom_out";
40+
public const string ACTION_ZOOM_DEFAULT = "action_zoom_default";
41+
public const string ACTION_ZOOM_IN = "action_zoom_in";
42+
public const string ACTION_TOGGLE_MONO = "action_toggle_mono";
43+
public const string ACTION_DELETE = "action_delete";
44+
45+
public const string ACTION_THEME_1 = "action_theme_1";
46+
public const string ACTION_THEME_2 = "action_theme_2";
47+
public const string ACTION_THEME_3 = "action_theme_3";
48+
public const string ACTION_THEME_4 = "action_theme_4";
49+
public const string ACTION_THEME_5 = "action_theme_5";
50+
public const string ACTION_THEME_6 = "action_theme_6";
51+
public const string ACTION_THEME_7 = "action_theme_7";
52+
public const string ACTION_THEME_8 = "action_theme_8";
53+
public const string ACTION_THEME_9 = "action_theme_9";
54+
public const string ACTION_THEME_0 = "action_theme_0";
5455

5556
public static Gee.MultiMap<string, string> action_accelerators;
5657

5758
private const GLib.ActionEntry[] ACTION_ENTRIES = {
58-
{ Application.ACTION_DELETE, action_delete},
59+
{ ACTION_DELETE, action_delete},
5960
{ ACTION_SHOW_EMOJI, action_show_emoji},
6061
{ ACTION_SHOW_MENU, action_show_menu},
6162
{ ACTION_FOCUS_TITLE, action_focus_title},
@@ -82,7 +83,7 @@ public class Jorts.StickyNoteWindow : Gtk.Window {
8283

8384
var actions = new SimpleActionGroup ();
8485
actions.add_action_entries (ACTION_ENTRIES, this);
85-
insert_action_group ("app", actions);
86+
insert_action_group ("win", actions);
8687

8788

8889
zoomcontroller = new Jorts.ZoomController (this);

0 commit comments

Comments
 (0)