Skip to content

Commit

Permalink
Delay settings (#70)
Browse files Browse the repository at this point in the history
* Test with Houston CI

* update with Blake's recommendation

* Add settings for delay
  • Loading branch information
danirabbit committed May 31, 2018
1 parent e56f2ce commit d056e8a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
11 changes: 11 additions & 0 deletions data/io.elementary.camera.gschema.xml
@@ -1,9 +1,20 @@
<schemalist>
<enum id="io.elementary.camera.settings.delay">
<value nick="DISABLED" value="0" />
<value nick="3_SEC" value="3" />
<value nick="5_SEC" value="5" />
<value nick="10_SEC" value="10" />
</enum>
<enum id="io.elementary.camera.settings.mode">
<value nick="photo" value="0" />
<value nick="video" value="1" />
</enum>
<schema path="/io/elementary/camera/settings/" id="io.elementary.camera.settings">
<key name="delay" enum="io.elementary.camera.settings.delay">
<default>"DISABLED"</default>
<summary>The timed delay before taking a photo</summary>
<description>The timed delay before taking a photo</description>
</key>
<key name="mode" enum="io.elementary.camera.settings.mode">
<default>"photo"</default>
<summary>The mode of the camera, photo or video</summary>
Expand Down
5 changes: 5 additions & 0 deletions src/Application.vala
Expand Up @@ -20,8 +20,13 @@
*/

public class Camera.Application : Gtk.Application {
public static GLib.Settings settings;
public MainWindow? main_window = null;

static construct {
settings = new Settings ("io.elementary.camera.settings");
}

construct {
Intl.setlocale (LocaleCategory.ALL, "");
application_id = "io.elementary.camera";
Expand Down
5 changes: 4 additions & 1 deletion src/Widgets/TimerButton.vala
Expand Up @@ -47,14 +47,17 @@ public class Camera.Widgets.TimerButton : Gtk.Button {
}
}

public Delay delay = Delay.DISABLED;
public Delay delay;

construct {
delay = (Delay) Camera.Application.settings.get_enum ("delay");

var timer_image = new Gtk.Image.from_icon_name ("timer-symbolic", Gtk.IconSize.SMALL_TOOLBAR);
var timer_label = new Gtk.Label (delay.to_string ());

this.clicked.connect (() => {
delay = delay.next ();
Camera.Application.settings.set_enum ("delay", delay);
timer_label.label = delay.to_string ();
});

Expand Down

0 comments on commit d056e8a

Please sign in to comment.