Skip to content

Commit d056e8a

Browse files
authored
Delay settings (#70)
* Test with Houston CI * update with Blake's recommendation * Add settings for delay
1 parent e56f2ce commit d056e8a

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

data/io.elementary.camera.gschema.xml

+11
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
<schemalist>
2+
<enum id="io.elementary.camera.settings.delay">
3+
<value nick="DISABLED" value="0" />
4+
<value nick="3_SEC" value="3" />
5+
<value nick="5_SEC" value="5" />
6+
<value nick="10_SEC" value="10" />
7+
</enum>
28
<enum id="io.elementary.camera.settings.mode">
39
<value nick="photo" value="0" />
410
<value nick="video" value="1" />
511
</enum>
612
<schema path="/io/elementary/camera/settings/" id="io.elementary.camera.settings">
13+
<key name="delay" enum="io.elementary.camera.settings.delay">
14+
<default>"DISABLED"</default>
15+
<summary>The timed delay before taking a photo</summary>
16+
<description>The timed delay before taking a photo</description>
17+
</key>
718
<key name="mode" enum="io.elementary.camera.settings.mode">
819
<default>"photo"</default>
920
<summary>The mode of the camera, photo or video</summary>

src/Application.vala

+5
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,13 @@
2020
*/
2121

2222
public class Camera.Application : Gtk.Application {
23+
public static GLib.Settings settings;
2324
public MainWindow? main_window = null;
2425

26+
static construct {
27+
settings = new Settings ("io.elementary.camera.settings");
28+
}
29+
2530
construct {
2631
Intl.setlocale (LocaleCategory.ALL, "");
2732
application_id = "io.elementary.camera";

src/Widgets/TimerButton.vala

+4-1
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,17 @@ public class Camera.Widgets.TimerButton : Gtk.Button {
4747
}
4848
}
4949

50-
public Delay delay = Delay.DISABLED;
50+
public Delay delay;
5151

5252
construct {
53+
delay = (Delay) Camera.Application.settings.get_enum ("delay");
54+
5355
var timer_image = new Gtk.Image.from_icon_name ("timer-symbolic", Gtk.IconSize.SMALL_TOOLBAR);
5456
var timer_label = new Gtk.Label (delay.to_string ());
5557

5658
this.clicked.connect (() => {
5759
delay = delay.next ();
60+
Camera.Application.settings.set_enum ("delay", delay);
5861
timer_label.label = delay.to_string ();
5962
});
6063

0 commit comments

Comments
 (0)