Skip to content

Commit 7778602

Browse files
committed
overhaul. New storage, nimbler theming
1 parent 73268a5 commit 7778602

File tree

10 files changed

+361
-352
lines changed

10 files changed

+361
-352
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ flatpak-builder --force-clean --user --install-deps-from=appcenter --install bui
9191

9292
## 💾 Notes Storage
9393

94-
Notes are stored in `~/.var/app/io.github.ellie_commons.jorts/`
94+
Notes are stored in `~/.var/app/io.github.ellie_commons.jorts/data`
9595

96-
locate the saved_state.json
96+
You can get it all by
97+
98+
```bash
99+
cp ~/.var/app/io.github.ellie_commons.jorts/data .
100+
```

data/Application.css

Lines changed: 39 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ window {
44
transition: background-color 800ms cubic-bezier(0.4, 0, 0.2, 1);
55
}
66

7+
window decoration {
8+
transition: border-color 800ms cubic-bezier(0.4, 0, 0.2, 1);
9+
}
10+
11+
712
undershoot.top {
813
transition: background 800ms cubic-bezier(0.4, 0, 0.2, 1);
914
}
@@ -12,32 +17,34 @@ undershoot.bottom {
1217
transition: background 800ms cubic-bezier(0.4, 0, 0.2, 1);
1318
}
1419

15-
.jorts-view text selection {
20+
.sourceview text selection {
1621
transition: color 800ms cubic-bezier(0.4, 0, 0.2, 1);
1722
transition: background-color 800ms cubic-bezier(0.4, 0, 0.2, 1);
1823
}
1924

20-
.jorts-title image,
21-
.jorts-label {
25+
.titlebar image,
26+
.editablelabel {
2227
box-shadow: none;
2328
transition: color 800ms cubic-bezier(0.4, 0, 0.2, 1);
2429
}
2530

26-
.jorts-bar {
31+
.actionbar {
32+
transition: color 800ms cubic-bezier(0.4, 0, 0.2, 1);
2733
box-shadow: none;
2834
background: transparent;
2935
padding: 3px;
3036
}
3137

32-
.jorts-bar image {
33-
padding: 3px;
38+
.actionbar image {
39+
transition: color 800ms cubic-bezier(0.4, 0, 0.2, 1);
3440
box-shadow: none;
3541
background-image: none;
42+
padding: 3px;
3643
}
3744

38-
.jorts-view,
39-
.jorts-view text,
40-
.jorts-title {
45+
.sourceview,
46+
.sourceview text,
47+
.titlebar {
4148
background-image: none;
4249
font-weight: 500;
4350
font-size: 1.2em;
@@ -60,48 +67,38 @@ entry.flat {
6067
0 1px 0 0 alpha (@bg_highlight_color, 0.3);
6168
}
6269

63-
.color-button:hover,
64-
.color-button:focus {
65-
border: 1px solid @inset_dark_color;
66-
}
70+
.color-button.strawberry {background-color: @STRAWBERRY_100;}
71+
.color-button.strawberry:hover {border: 1px solid @STRAWBERRY_500;}
72+
.color-button.orange {background-color: @ORANGE_100;}
73+
.color-button.orange:hover {border: 1px solid @ORANGE_500;}
6774

68-
.color-button.slate {
69-
background-color: @SLATE_100;
70-
}
75+
.color-button.banana {background-color: @BANANA_100;}
76+
.color-button.banana:hover {border: 1px solid @BANANA_500;}
7177

72-
.color-button.silver {
73-
background-color: @SILVER_100;
74-
}
78+
.color-button.lime {background-color: @LIME_100;}
79+
.color-button.lime:hover {border: 1px solid @LIME_500;}
7580

76-
.color-button.strawberry {
77-
background-color: @STRAWBERRY_100;
78-
}
81+
.color-button.blueberry {background-color: @BLUEBERRY_100;}
82+
.color-button.blueberry:hover {border: 1px solid @BLUEBERRY_500;}
7983

80-
.color-button.orange {
81-
background-color: @ORANGE_100;
82-
}
84+
.color-button.bubblegum {background-color: @BUBBLEGUM_100;}
85+
.color-button.bubblegum:hover {border: 1px solid @BUBBLEGUM_500;}
8386

84-
.color-button.banana {
85-
background-color: @BANANA_100;
86-
}
87+
.color-button.grape {background-color: @GRAPE_100;}
88+
.color-button.grape:hover {border: 1px solid @GRAPE_500;}
8789

88-
.color-button.lime {
89-
background-color: @LIME_100;
90-
}
90+
.color-button.cocoa {background-color: @COCOA_100;}
91+
.color-button.cocoa {border: 1px solid @COCOA_500;}
9192

92-
.color-button.blueberry {
93-
background-color: @BLUEBERRY_100;
94-
}
93+
.color-button.slate {background-color: @SLATE_100;}
94+
.color-button.slate:hover {border: 1px solid @SLATE_500;}
95+
96+
.color-button.silver {background-color: @SILVER_100;}
97+
.color-button.silver:hover {border: 1px solid @SILVER_500;}
9598

96-
.color-button.grape {
97-
background-color: @GRAPE_100;
98-
}
9999

100-
.color-button.cocoa {
101-
background-color: @COCOA_100;
102-
}
103100

104-
.jorts-bar box {
101+
.actionbar box {
105102
border: none;
106103
}
107104

@@ -124,7 +121,7 @@ entry.flat {
124121
box-shadow: none;
125122
}
126123

127-
.jorts-label {
124+
.editablelabel {
128125
font-weight: 700;
129126
font-size: 0.88em;
130127
}

meson.build

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,13 @@ cc = meson.get_compiler('c')
5656
executable(
5757
meson.project_name(),
5858
gresource,
59-
'src/Widgets/EditableLabel.vala',
59+
'src/noteData.vala',
60+
'src/Services/Stash.vala',
6061
'src/Services/NoteManager.vala',
6162
'src/Services/Storage.vala',
6263
'src/Services/Themer.vala',
6364
'src/Services/Utils.vala',
65+
'src/Widgets/EditableLabel.vala',
6466
'src/Application.vala',
6567
'src/MainWindow.vala',
6668
c_args: c_args,

src/Application.vala

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,17 @@ namespace jorts {
3131
public override void startup () {
3232
base.startup ();
3333

34+
// Ok first check if we have a directory to store data
35+
var data_directory = File.new_for_path(Environment.get_user_data_dir ());
36+
try {
37+
if (!data_directory.query_exists()) {
38+
data_directory.make_directory();
39+
print("Prepared target data directory");
40+
}
41+
} catch (Error e) {
42+
warning ("Failed to prepare target data directory %s\n", e.message);
43+
}
44+
3445
// This is automatic in GTK4, so can be removed after porting
3546
var app_provider = new Gtk.CssProvider ();
3647
app_provider.load_from_resource ("/io/github/ellie_commons/jorts/Application.css");
@@ -41,16 +52,16 @@ namespace jorts {
4152
);
4253

4354
string[] themes = {
55+
"STRAWBERRY",
56+
"ORANGE",
4457
"BANANA",
58+
"LIME",
4559
"BLUEBERRY",
4660
"BUBBLEGUM",
47-
"COCOA",
4861
"GRAPE",
49-
"LIME",
50-
"ORANGE",
62+
"COCOA",
5163
"SILVER",
52-
"SLATE",
53-
"STRAWBERRY"
64+
"SLATE"
5465
};
5566

5667
foreach (unowned var theme in themes) {

src/MainWindow.vala

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,8 @@ namespace jorts {
8585
}
8686

8787
// add required base classes
88-
//this.get_style_context().add_class(this.uid.to_string ());
8988
this.get_style_context().add_class("rounded");
90-
this.get_style_context().add_class("default-decoration");
91-
this.get_style_context().add_class("jorts-window");
89+
9290
this.uid = uid_counter++;
9391

9492
// Rebuild the whole theming
@@ -99,7 +97,7 @@ namespace jorts {
9997
// Define the header
10098
header = new Gtk.HeaderBar();
10199
header.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT);
102-
header.get_style_context().add_class("jorts-title");
100+
//header.get_style_context().add_class("jorts-title");
103101
header.has_subtitle = false;
104102
header.set_show_close_button (true);
105103
header.decoration_layout = "close:";
@@ -113,7 +111,7 @@ namespace jorts {
113111

114112
// Bar at the bottom
115113
actionbar = new Gtk.ActionBar ();
116-
actionbar.get_style_context().add_class("jorts-bar");
114+
actionbar.get_style_context().add_class("actionbar");
117115
create_actionbar ();
118116
create_app_menu ();
119117

@@ -188,8 +186,16 @@ namespace jorts {
188186

189187
// Save everything
190188
private void update_storage () {
189+
int width, height;
190+
191191
get_storage_note();
192192
((Application)this.application).update_storage();
193+
194+
this.get_size (out width, out height);
195+
196+
var everythingnote = new noteData(this.uid, this.title, this.theme, this.content, 0, width, height);
197+
198+
save_to_stash(everythingnote);
193199
}
194200

195201

@@ -292,7 +298,7 @@ namespace jorts {
292298
color_button_bubblegum.width_request = 24;
293299
color_button_bubblegum.tooltip_text = _("Bubblegum");
294300

295-
var color_button_bubblegum_context = color_button_blueberry.get_style_context ();
301+
var color_button_bubblegum_context = color_button_bubblegum.get_style_context ();
296302
color_button_bubblegum_context.add_class ("color-button");
297303
color_button_bubblegum_context.add_class ("bubblegum");
298304

@@ -350,6 +356,7 @@ namespace jorts {
350356
color_button_box.pack_start (color_button_banana, false, true, 0);
351357
color_button_box.pack_start (color_button_lime, false, true, 0);
352358
color_button_box.pack_start (color_button_blueberry, false, true, 0);
359+
color_button_box.pack_start (color_button_bubblegum, false, true, 0);
353360
color_button_box.pack_start (color_button_grape, false, true, 0);
354361
color_button_box.pack_start (color_button_cocoa, false, true, 0);
355362
color_button_box.pack_start (color_button_silver, false, true, 0);
@@ -518,13 +525,6 @@ namespace jorts {
518525
}
519526

520527

521-
522-
523-
524-
// TODO: A theming service or something. Something cleaner than this in all cases
525-
// Basically the menu button defines two public variables
526-
// And then this reconstructs a whole ass theme out of these two
527-
// Either it can be a service, or just all defined in CSS and add/remove css
528528
private void update_theme(string theme) {
529529

530530
// in GTK4 we can replace this with setting css_classes

0 commit comments

Comments
 (0)