Skip to content

Commit 8b68b6b

Browse files
committed
Linting
1 parent 3c6295f commit 8b68b6b

File tree

15 files changed

+207
-223
lines changed

15 files changed

+207
-223
lines changed

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ executable(
3636
meson.project_name(),
3737
gresource,
3838
config_file,
39-
'src/Objects/noteData.vala',
39+
'src/Objects/NoteData.vala',
4040

4141
'src/Services/Constants.vala',
4242
'src/Services/Jason.vala',

src/Application.vala

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ At some point i may move this in its own file
2626
2727
*/
2828

29-
namespace jorts {
29+
namespace Jorts {
3030
public class Application : Gtk.Application {
3131
public Gee.ArrayList<StickyNoteWindow> open_notes = new Gee.ArrayList<StickyNoteWindow>();
3232
public static GLib.Settings gsettings;
3333

3434
public Application () {
3535
Object (flags: ApplicationFlags.HANDLES_COMMAND_LINE,
36-
application_id: jorts.Constants.RDNN);
36+
application_id: Jorts.Constants.RDNN);
3737
}
3838

3939
// Changed whenever a note changes zoom
@@ -54,7 +54,7 @@ namespace jorts {
5454
var granite_settings = Granite.Settings.get_default ();
5555
var gtk_settings = Gtk.Settings.get_default ();
5656
gtk_settings.gtk_icon_theme_name = "elementary";
57-
gtk_settings.gtk_theme_name = "io.elementary.stylesheet." + jorts.Constants.DEFAULT_THEME.ascii_down();
57+
gtk_settings.gtk_theme_name = "io.elementary.stylesheet." + Jorts.Constants.DEFAULT_THEME.ascii_down();
5858

5959
// Also follow dark if system is dark lIke mY sOul.
6060
gtk_settings.gtk_application_prefer_dark_theme = (
@@ -79,13 +79,13 @@ namespace jorts {
7979
// null);
8080

8181
// build all the stylesheets
82-
jorts.Themer.init_all_themes();
82+
Jorts.Themer.init_all_themes();
8383
}
8484

8585

8686
/*************************************************/
8787
static construct {
88-
gsettings = new GLib.Settings (jorts.Constants.RDNN);
88+
gsettings = new GLib.Settings (Jorts.Constants.RDNN);
8989
}
9090

9191
/*************************************************/
@@ -153,7 +153,7 @@ namespace jorts {
153153
// Create new instances of StickyNoteWindow
154154
// If we have data, nice, just load it into a new instance
155155
// Else we do a lil new note
156-
public void create_note(noteData? data) {
156+
public void create_note(NoteData? data) {
157157
StickyNoteWindow note;
158158
if (data != null) {
159159
note = new StickyNoteWindow(this, data);
@@ -163,10 +163,10 @@ namespace jorts {
163163
// Skip theme from previous window, but use same text zoom
164164
StickyNoteWindow last_note = this.open_notes.last ();
165165
string skip_theme = last_note.theme;
166-
var random_data = jorts.Utils.random_note(skip_theme);
166+
var random_data = Jorts.Utils.random_note(skip_theme);
167167

168168
// A chance at pulling the Golden Sticky
169-
random_data = jorts.Utils.golden_sticky(random_data);
169+
random_data = Jorts.Utils.golden_sticky(random_data);
170170

171171
random_data.zoom = this.latest_zoom;
172172
note = new StickyNoteWindow(this, random_data);
@@ -183,9 +183,9 @@ namespace jorts {
183183
}
184184

185185
public void save_to_stash() {
186-
jorts.Stash.check_if_stash ();
187-
string json_data = jorts.Jason.jsonify (open_notes);
188-
jorts.Stash.overwrite_stash (json_data, jorts.Constants.FILENAME_STASH);
186+
Jorts.Stash.check_if_stash ();
187+
string json_data = Jorts.Jason.jsonify (open_notes);
188+
Jorts.Stash.overwrite_stash (json_data, Jorts.Constants.FILENAME_STASH);
189189
print("Saved " + open_notes.size.to_string() + "!\n");
190190
}
191191

@@ -221,21 +221,21 @@ namespace jorts {
221221

222222
/*************************************************/
223223
public void init_all_notes() {
224-
Gee.ArrayList<noteData> loaded_data = jorts.Stash.load_from_stash();
224+
Gee.ArrayList<NoteData> loaded_data = Jorts.Stash.load_from_stash();
225225

226226
// Load everything we have
227-
foreach (noteData data in loaded_data) {
227+
foreach (NoteData data in loaded_data) {
228228
debug("Loaded: " + data.title + "\n");
229229
this.create_note(data);
230230
}
231231

232232

233-
if (jorts.Stash.need_backup(gsettings.get_string("last-backup"))) {
233+
if (Jorts.Stash.need_backup(gsettings.get_string("last-backup"))) {
234234
print("Doing a backup! :)");
235235

236-
jorts.Stash.check_if_stash ();
237-
string json_data = jorts.Jason.jsonify (this.open_notes);
238-
jorts.Stash.overwrite_stash (json_data, jorts.Constants.FILENAME_BACKUP);
236+
Jorts.Stash.check_if_stash ();
237+
string json_data = Jorts.Jason.jsonify (this.open_notes);
238+
Jorts.Stash.overwrite_stash (json_data, Jorts.Constants.FILENAME_BACKUP);
239239

240240
var now = new DateTime.now_utc ().to_string() ;
241241
gsettings.set_string("last-backup", now);
@@ -264,7 +264,7 @@ namespace jorts {
264264
break;
265265

266266
case "--dump":
267-
print(jorts.Jason.jsonify (open_notes));
267+
print(Jorts.Jason.jsonify (open_notes));
268268
break;
269269

270270
default:

src/Objects/NoteData.vala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@
1818
* Boston, MA 02110-1301 USA
1919
*/
2020

21-
// The noteData object is just packaging to pass off data from and to storage
22-
namespace jorts {
21+
// The NoteData object is just packaging to pass off data from and to storage
22+
namespace Jorts {
2323

24-
public class noteData : Object {
24+
public class NoteData : Object {
2525
public string title;
2626
public string theme;
2727
public string content;
2828
public int zoom;
2929
public int width;
3030
public int height;
3131

32-
public noteData(string title, string theme, string content, int zoom, int width, int height )
32+
public NoteData (string title, string theme, string content, int zoom, int width, int height)
3333
{
3434
this.title = title;
3535
this.theme = theme;

src/Preferences.vala

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -28,36 +28,36 @@ the innerbox has widgets for settings.
2828
the actionbar has a donate me and a set back to defaults just like elementaryOS
2929
3030
*/
31-
namespace jorts {
32-
public class PreferenceWindow : Gtk.Window {
31+
namespace Jorts {
32+
public class PreferenceWindow : Gtk.Window {
3333

34-
public const string ACTION_PREFIX = "app.";
35-
public const string ACTION_NEW = "action_new";
34+
public const string ACTION_PREFIX = "app.";
35+
public const string ACTION_NEW = "action_new";
3636

3737
public static Gee.MultiMap<string, string> action_accelerators;
3838

39-
private const GLib.ActionEntry[] action_entries = {
40-
{ ACTION_NEW, action_new }
39+
private const GLib.ActionEntry[] ACTION_ENTRIES = {
40+
{ ACTION_NEW, action_new }
4141
};
4242

4343
public PreferenceWindow (Gtk.Application app) {
44-
debug("Showing preference window");
44+
debug ("Showing preference window");
4545

4646
Object (application: app);
4747
Intl.setlocale ();
4848

4949
var actions = new SimpleActionGroup ();
50-
actions.add_action_entries (action_entries, this);
50+
actions.add_action_entries (ACTION_ENTRIES, this);
5151
insert_action_group ("app", actions);
5252

5353
var gtk_settings = Gtk.Settings.get_default ();
5454

5555
// Since each sticky note adopts a different accent color
5656
// we have to revert to default when this one is focused
57-
this.notify["is-active"].connect(() => {
57+
this.notify["is-active"].connect (() => {
5858
if (this.is_active) {
5959
//gtk_settings.gtk_theme_name = Application.system_accent;
60-
gtk_settings.gtk_theme_name = "io.elementary.stylesheet." + jorts.Constants.DEFAULT_THEME.ascii_down();
60+
gtk_settings.gtk_theme_name = "io.elementary.stylesheet.blueberry";
6161
}
6262
});
6363

@@ -68,15 +68,15 @@ namespace jorts {
6868
var titlelabel = new Gtk.Label (_("Preferences for your Jorts"));
6969
titlelabel.add_css_class (Granite.STYLE_CLASS_TITLE_LABEL);
7070
set_title (titlelabel.get_text ());
71-
71+
7272
var headerbar = new Gtk.HeaderBar () {
7373
title_widget = titlelabel,
7474
show_title_buttons = true
7575
};
7676

7777
set_titlebar (headerbar);
78-
set_size_request (jorts.Constants.DEFAULT_PREF_WIDTH, jorts.Constants.DEFAULT_PREF_HEIGHT);
79-
set_default_size (jorts.Constants.DEFAULT_PREF_WIDTH, jorts.Constants.DEFAULT_PREF_HEIGHT);
78+
set_size_request (Jorts.Constants.DEFAULT_PREF_WIDTH, Jorts.Constants.DEFAULT_PREF_HEIGHT);
79+
set_default_size (Jorts.Constants.DEFAULT_PREF_WIDTH, Jorts.Constants.DEFAULT_PREF_HEIGHT);
8080

8181
add_css_class ("dialog");
8282
add_css_class (Granite.STYLE_CLASS_MESSAGE_DIALOG);
@@ -119,7 +119,7 @@ namespace jorts {
119119

120120
scribbly_box.append (scribbly_label);
121121
scribbly_box.append (scribbly_toggle);
122-
settingsbox.append (scribbly_box);
122+
settingsbox.append (scribbly_box);
123123

124124
Application.gsettings.bind (
125125
"scribbly-mode-active",
@@ -149,7 +149,7 @@ namespace jorts {
149149
settingsbox.append (hidebar_box);
150150

151151
Application.gsettings.bind (
152-
"hide-bar",
152+
"hide-bar",
153153
hidebar_toggle, "active",
154154
SettingsBindFlags.DEFAULT);
155155

@@ -158,14 +158,14 @@ namespace jorts {
158158
/*************************************************/
159159

160160
string desktop_environment = Environment.get_variable ("XDG_CURRENT_DESKTOP");
161-
print(desktop_environment + " detected!");
161+
print (desktop_environment + " detected!");
162162

163163
// Show only in Pantheon because others do not have an autostart panel
164164
if (desktop_environment == "Pantheon") {
165-
165+
166166
var link = Granite.SettingsUri.PERMISSIONS ;
167167
var linkname = _("Permissions") ;
168-
168+
169169
var permissions_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6);
170170
var permissions_link = new Gtk.LinkButton.with_label (
171171
link,
@@ -175,17 +175,17 @@ namespace jorts {
175175
// _("Applications → Permissions")
176176
permissions_link.tooltip_text = link;
177177
permissions_link.halign = Gtk.Align.END;
178-
178+
179179
var permissions_label = new Granite.HeaderLabel (_("Allow to start at login")) {
180180
mnemonic_widget = permissions_link,
181181
secondary_text = _("You can set the sticky notes to appear when you log in by adding Jorts to autostart")
182182
};
183183
permissions_label.set_hexpand (true);
184-
184+
185185
permissions_box.append (permissions_label);
186186
permissions_box.append (permissions_link);
187-
settingsbox.append(permissions_box);
188-
187+
settingsbox.append (permissions_box);
188+
189189
// Not Pantheon, not the Windows port. Must be a rando DE
190190
} else {
191191

@@ -197,20 +197,20 @@ namespace jorts {
197197
link,
198198
linkname
199199
);
200-
200+
201201
// _("Applications → Permissions")
202202
permissions_link.tooltip_text = link;
203203
permissions_link.halign = Gtk.Align.END;
204-
204+
205205
var permissions_label = new Granite.HeaderLabel (_("Allow to start at login")) {
206206
mnemonic_widget = permissions_link,
207207
secondary_text = _("You can set the sticky notes to appear when you log in by adding Jorts to autostart")
208208
};
209209
permissions_label.set_hexpand (true);
210-
210+
211211
permissions_box.append (permissions_label);
212212
permissions_box.append (permissions_link);
213-
settingsbox.append(permissions_box);
213+
settingsbox.append (permissions_box);
214214

215215
}
216216

@@ -222,26 +222,26 @@ namespace jorts {
222222

223223
// Monies?
224224
var support_button = new Gtk.LinkButton.with_label (
225-
jorts.Constants.DONATE_LINK,
225+
Jorts.Constants.DONATE_LINK,
226226
_("Support us!")
227227
);
228228
actionbar.pack_start (support_button);
229229

230230
// Reset
231-
var reset_button = new Gtk.Button();
232-
reset_button.set_label( _("Reset to Default"));
231+
var reset_button = new Gtk.Button ();
232+
reset_button.set_label ( _("Reset to Default"));
233233
reset_button.tooltip_markup = (_("Reset all settings to defaults"));
234234
actionbar.pack_end (reset_button);
235235

236-
reset_button.clicked.connect(on_reset);
236+
reset_button.clicked.connect (on_reset);
237237

238238
// var close_button = new Gtk.Button();
239239
// close_button.set_label( _("Close"));
240240
// close_button.clicked.connect(() => {this.close();});
241241
// actionbar.pack_end (close_button);
242242

243243
mainbox.append (settingsbox);
244-
mainbox.append(actionbar);
244+
mainbox.append (actionbar);
245245

246246
// Make the whole window grabbable
247247
var handle = new Gtk.WindowHandle () {
@@ -254,17 +254,15 @@ namespace jorts {
254254
}
255255

256256
private void action_new () {
257-
((Application)this.application).create_note(null);
257+
((Application)this.application).create_note (null);
258258
}
259259

260-
private void on_reset() {
261-
string[] keys = {"scribbly-mode-active","hide-bar"};
260+
private void on_reset () {
261+
string[] keys = {"scribbly-mode-active", "hide-bar"};
262262
foreach (var key in keys) {
263263
Application.gsettings.reset (key);
264264
}
265265
}
266-
267-
268266
}
269267
}
270268

src/Services/Constants.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Just Dump constants here
2525
2626
*/
2727

28-
namespace jorts.Constants {
28+
namespace Jorts.Constants {
2929

3030

3131

0 commit comments

Comments
 (0)