Skip to content
This repository was archived by the owner on Jun 23, 2025. It is now read-only.

Commit 2b3d1b7

Browse files
committed
initialise appcache on first run - fixes #24
1 parent c6b107c commit 2b3d1b7

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

data/com.github.mdh34.quickdocs.gschema.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,10 @@
1313
<summary>Last opened tab</summary>
1414
<description>Saves the last opened tab</description>
1515
</key>
16+
<key name="first" type="i">
17+
<default>0</default>
18+
<summary>First run</summary>
19+
<description>Sets if the application has been initialised yet</description>
20+
</key>
1621
</schema>
1722
</schemalist>

src/quickDocs.vala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public class App : Gtk.Application {
6464

6565

6666
var dev = new WebView.with_context (context);
67+
first_run(dev);
6768
set_appcache (dev, online);
6869
dev.load_uri ("https://devdocs.io");
6970

@@ -145,6 +146,14 @@ public class App : Gtk.Application {
145146
}
146147
}
147148

149+
private void first_run (WebView view) {
150+
var user_settings = new GLib.Settings ("com.github.mdh34.quickdocs");
151+
if (user_settings.get_int("first") == 0) {
152+
view.load_uri("https://devdocs.io");
153+
user_settings.set_int ("first", 1);
154+
}
155+
}
156+
148157
private void set_appcache (WebView view, bool online) {
149158
var settings = view.get_settings ();
150159
if (online) {

0 commit comments

Comments
 (0)