Skip to content

Commit

Permalink
Move to gsettings
Browse files Browse the repository at this point in the history
  • Loading branch information
bgamari committed Nov 2, 2019
1 parent dc2230c commit afc18a2
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 283 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pgrep -af hamster
###### Ubuntu (tested in 19.04 and 18.04)

```bash
sudo apt install gettext intltool gconf2 gir1.2-gconf-2.0 python3-gi-cairo python3-distutils python3-dbus python3-xdg
sudo apt install gettext intltool python3-gi-cairo python3-distutils python3-dbus python3-xdg
# and for documentation
sudo apt install gnome-doc-utils yelp
```
Expand All @@ -70,7 +70,7 @@ sudo zypper install gnome-doc-utils xml2po yelp

*RPM-based instructions below should be updated for python3 (issue [#369](https://github.com/projecthamster/hamster/issues/369)).*

`yum install gettext intltool gnome-python2-gconf dbus-python`
`yum install gettext intltool dbus-python`

If the hamster help pages are not accessible ("unable to open `help:hamster-time-tracker`"),
then a [Mallard](https://en.wikipedia.org/wiki/Mallard_(documentation))-capable help reader is required,
Expand Down
88 changes: 88 additions & 0 deletions data/apps.hamster-time-tracker.gschema.xml.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<schemalist>
<schema path="/apps/hamster-time-tracker/" id="apps.HamsterTimeTracker">
<key type="b" name="enable-timeout">
<default>true</default>
<summary>Stop tracking on idle</summary>
<description>
Stop tracking current activity when computer becomes idle
</description>
</key>

<key type="b" name="stop-on-shutdown">
<default>false</default>
<summary>Stop tracking on shutdown</summary>
<description>
Stop tracking current activity on shutdown
</description>
</key>

<key type="u" name="notify-interval">
<default>27</default>
<summary>Remind of current task every x minutes</summary>
<description>
Remind of current task every specified amount of minutes.
Set to 0 or greater than 120 to disable reminder.
</description>
</key>

<key type="b" name="notify-on-idle">
<default>false</default>
<summary>Also remind when no activity is set</summary>
<description>
Also remind every notify_interval minutes if no activity
has been started.
</description>
</key>

<key type="u" name="day-start-minutes">
<default>330</default>
<summary>At what time does the day start (defaults to 5:30AM)</summary>
<description>
Activities will be counted as to bedescription to yesterday if
the current time is less than the specified day start; and
today, if it is over the time.
Activities that span two days, will tip over to the side
where the largest part of the activity is.
</description>
</key>

<key type="as" name="workspace-tracking">
<default>[]</default>
<summary>Should workspace switch trigger activity switch</summary>
<description>
List of enabled tracking methods. "name" will enable
switching activities by name defined in workspace_mapping.
"memory" will enable switching to the last activity when
returning to a previous workspace.
</description>
</key>

<key type="as" name="workspace-mapping">
<default>[]</default>
<summary>Switch activity on workspace change</summary>
<description>
If switching by name is enabled, this list sets the activity
names that should be switched to, workspaces represented by
the index of item.
</description>
</key>

<key type="s" name="active-hamster-window">
<default>""</default>
<summary>Show / hide Time Tracker Window</summary>
<description>Keyboard summarycut for showing / hiding the Time Tracker window.</description>
</key>

<key type="s" name="action">
<default>"hamster-time-tracker toggle"</default>
<summary>Toggle hamster application window action</summary>
<description>Command for toggling visibility of the hamster application window.</description>
</key>

<key type="s" name="name">
<default>"Toggle hamster application window"</default>
<summary>Toggle hamster application window</summary>
<description>Toggle visibility of the hamster application window.</description>
</key>
</schema>
</schemalist>
143 changes: 0 additions & 143 deletions data/hamster-time-tracker.schemas.in

This file was deleted.

4 changes: 2 additions & 2 deletions data/wscript_build
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ bld.add_group()

# process .in files with intl_tool
bld(features = 'intltool_in',
source = 'hamster-time-tracker.schemas.in',
target = 'hamster-time-tracker.schemas',
source = 'apps.hamster-time-tracker.gschema.xml.in',
target = 'apps.hamster-time-tracker.gschema.xml',
install_path = bld.env.schemas_destination,
podir = '../po',
flags = ['-s', '-u'])
Expand Down
9 changes: 4 additions & 5 deletions src/hamster/idle.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@

from dbus.lowlevel import Message

gi.require_version('GConf', '2.0')
from gi.repository import GConf as gconf
from gi.repository import Gio as gio
from gi.repository import GObject as gobject

class DbusIdleListener(gobject.GObject):
Expand All @@ -37,7 +36,7 @@ class DbusIdleListener(gobject.GObject):
Monitors org.gnome.ScreenSaver for idleness. There are two types,
implicit (due to inactivity) and explicit (lock screen), that need to be
handled differently. An implicit idle state should subtract the
time-to-become-idle (as specified in the gconf) from the last activity,
time-to-become-idle (as specified in GSettings) from the last activity,
but an explicit idle state should not.
The signals are inspected for the "ActiveChanged" and "Lock"
Expand Down Expand Up @@ -102,8 +101,8 @@ def bus_inspector(self, bus, message):
else:
delay_key = "/desktop/gnome/session/idle_delay"

client = gconf.Client.get_default()
self.timeout_minutes = client.get_int(delay_key)
settings = gio.Settings()
self.timeout_minutes = client.get_value(delay_key)

else:
self.screen_locked = False
Expand Down
Loading

0 comments on commit afc18a2

Please sign in to comment.