support gsettings

gh-pages
somas95 2018-04-13 20:17:32 +02:00
parent 9166b89fea
commit 86ec754e4b
4 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<schemalist>
<schema path="/org/gnome/UberWriter/" id="de.wolfvollprecht.UberWriter.gschema">
<key name='dark-mode' type='b'>
<default>false</default>
<summary>Dark mode</summary>
<description>
If enabled, the window will be dark themed
If disabled, the window will be light themed
asked to install them manually.
</description>
</key>
</schema>
</schemalist>

View File

@ -76,6 +76,7 @@ setup(
data_files=[
(app_prefix + '/bin/', ['bin/uberwriter']),
(app_prefix + '/share/glib-2.0/schemas', ['data/glib-2.0/schemas/net.launchpad.uberwriter.gschema.xml']),
(app_prefix + '/share/glib-2.0/schemas', ['data/de.wolfvollprecht.UberWriter']),
(app_prefix + '/share/icons/hicolor/scalable/apps', ['data/media/uberwriter.svg']),
(app_prefix + '/share/applications', ['de.wolfvollprecht.UberWriter.desktop']),
(app_prefix + '/opt/uberwriter/data/ui', extra_files_ui),

View File

@ -0,0 +1,38 @@
### BEGIN LICENSE
# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
### END LICENSE
from gi.repository import Gtk, Gdk, GLib, Gio
from gettext import gettext as _
class Settings(Gio.Settings):
"""
UberWriter Settings
"""
def __init__(self):
"""
Init Settings
"""
Gio.Settings.__init__(self)
def new():
"""
Return a new Settings object
"""
settings = Gio.Settings.new("de.wolfvollprecht.UberWriter")
settings.__class__ = Settings
return settings

View File

@ -22,6 +22,7 @@ from gi.repository import GLib, Gio, Gtk, GdkPixbuf
from . helpers import get_builder, show_uri, get_help_uri, get_media_path
from uberwriter import UberwriterWindow
from uberwriter.Settings import Settings
from uberwriter_lib import set_up_logging
from gettext import gettext as _
@ -104,6 +105,7 @@ class Application(Gtk.Application):
flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE,
**kwargs)
self.window = None
self.settings = Settings.new()
def do_startup(self):
Gtk.Application.do_startup(self)