Skip to content

Commit

Permalink
Support 0 minutes interval to enable manually switch wallpapers only
Browse files Browse the repository at this point in the history
  • Loading branch information
rodakorn authored and rodakorn committed Jan 9, 2017
1 parent e382c6a commit ff4715a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
14 changes: 9 additions & 5 deletions Random_Walls@Antares/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const _ = Gettext.gettext;
const SETTINGS_FOLDER_LIST = "folder-list";
const SETTINGS_CHANGE_MODE = "change-mode";
const SETTINGS_HIDE_ICON = "hide-icon";

const SETTINGS_TIMEOUT = "change-time";

const CURRENT_DESK = 0;
const CURRENT_LOCK = 1;
Expand Down Expand Up @@ -316,9 +316,13 @@ function init(metadata) {
if(!wallUtils.isEmpty()) {
this.MyTimer = new Interval.MyTimer();
this.MyTimer.setCallback(function() {
wallUtils.changeWallpapers();
// WARNING! Without the return true the timer will stop after the first run
return true;
// WARNING! Without the return true the timer will stop after the first run
if(_settings.get_int(SETTINGS_TIMEOUT) != 0) {
wallUtils.changeWallpapers();
return true;
}
else
return false;
});
}
let theme = imports.gi.Gtk.IconTheme.get_default();
Expand All @@ -331,7 +335,7 @@ let _settings;
function enable() {
_indicator = new RandWallMenu(_settings);
wallUtils.setIndicator(_indicator);
if(!wallUtils.isEmpty() && this.MyTimer) {
if(!wallUtils.isEmpty() && this.MyTimer && _settings.get_int(SETTINGS_TIMEOUT) != 0) {
wallUtils.changeWallpapers();
this.MyTimer.start();
}
Expand Down
2 changes: 1 addition & 1 deletion Random_Walls@Antares/prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const RandWallSettingsWidget = new GObject.Class({
let gHBoxTimer = new Gtk.HBox({margin:10, spacing: 20, hexpand: true});
let gLabelTimer = new Gtk.Label({label: _("Interval (in minutes)"),halign: Gtk.Align.START});
gHBoxTimer.add(gLabelTimer);
this._interval = Gtk.SpinButton.new_with_range (1, 3000, 1);
this._interval = Gtk.SpinButton.new_with_range (0, 3000, 1);
gHBoxTimer.add(this._interval);
this._interval.connect('changed',Lang.bind(this,this._changeInterval));
this.add(gHBoxTimer);
Expand Down
Binary file modified Random_Walls@Antares/schemas/gschemas.compiled
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
</key>

<key name="change-time" type="i">
<range min="1" max="3000" />
<range min="0" max="3000" />
<default>60</default>
<summary>How often are the wallpapers changed (in minutes)</summary>
<description>Set how often are the wallpapers changed (min 1 min. max 3000 min)</description>
<description>Set how often are the wallpapers changed (min 0 min. max 3000 min)</description>
</key>

<key name="hide-icon" type="b">
Expand Down

0 comments on commit ff4715a

Please sign in to comment.