Skip to content

Commit 6b4a6f5

Browse files
committed
fixing some app store issues
1 parent 86b8168 commit 6b4a6f5

476 files changed

Lines changed: 5729 additions & 39 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
public class Tempo : Gtk.Application {
2+
3+
public Tempo () {
4+
5+
Object (
6+
application_id: "com.github.dcharles525.tempo",
7+
flags: ApplicationFlags.FLAGS_NONE
8+
);
9+
10+
}
11+
12+
protected override void activate () {
13+
14+
GLib.Settings settings = new GLib.Settings (
15+
"com.github.dcharles525.tempo"
16+
);
17+
Gtk.CssProvider cssProvider = new Gtk.CssProvider ();
18+
19+
Gtk.Settings.get_default ().set (
20+
"gtk-application-prefer-dark-theme",
21+
true
22+
);
23+
24+
try {
25+
26+
cssProvider.load_from_resource ("/com/github/dcharles525/Tempo/stylesheet");
27+
Gtk.StyleContext.add_provider_for_screen (
28+
Gdk.Screen.get_default (),
29+
cssProvider,
30+
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
31+
);
32+
33+
} catch (Error e) {
34+
35+
error ("Cannot load CSS stylesheet: %s", e.message);
36+
37+
}
38+
39+
Gtk.HeaderBar headerbar = new Gtk.HeaderBar () {
40+
title = "Tempo"
41+
};
42+
43+
var headerContext = headerbar.get_style_context ();
44+
headerContext.add_class (Gtk.STYLE_CLASS_FLAT);
45+
46+
Gtk.ApplicationWindow mainWindow = new Gtk.ApplicationWindow (this) {
47+
default_height = 200,
48+
default_width = 200,
49+
title = _("Tempo"),
50+
resizable = false
51+
};
52+
53+
TempText tempText = new TempText ();
54+
55+
mainWindow.set_titlebar (headerbar);
56+
mainWindow.add (tempText.get_box ());
57+
mainWindow.move (
58+
settings.get_value ("x").get_int32 (),
59+
settings.get_value ("y").get_int32 ()
60+
);
61+
mainWindow.show_all ();
62+
mainWindow.set_keep_above (true);
63+
mainWindow.configure_event.connect(() => {
64+
65+
int x, y;
66+
mainWindow.get_position (out x, out y);
67+
settings.set_value ("x", x);
68+
settings.set_value ("y", y);
69+
return false;
70+
71+
});
72+
73+
}
74+
75+
public static int main (string[] args) {
76+
77+
return new Tempo ().run (args);
78+
79+
}
80+
81+
}

0 commit comments

Comments
 (0)