Skip to content

Commit

Permalink
style: Use AdwApplication
Browse files Browse the repository at this point in the history
  • Loading branch information
SeaDve committed Aug 5, 2021
1 parent a95ea14 commit 9fa460e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
2 changes: 1 addition & 1 deletion data/breathing.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
<file compressed="true" preprocess="xml-stripblanks">icons/scalable/status/circle-solid-symbolic.svg</file>
<file compressed="true" preprocess="xml-stripblanks">icons/scalable/status/dark-mode-symbolic.svg</file>
<file compressed="true" preprocess="xml-stripblanks">icons/scalable/status/light-mode-symbolic.svg</file>
<file compressed="true">ui/style.css</file>
<file compressed="true" alias="style.css">ui/style.css</file>
</gresource>
</gresources>
16 changes: 3 additions & 13 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,19 @@
import gi
gi.require_version('Gtk', '4.0')
gi.require_version('Adw', '1')
from gi.repository import Gtk, Gio, Gdk, GLib, Adw
from gi.repository import Gtk, Gio, GLib, Adw

from breathing.window import BreathingWindow


class Application(Gtk.Application):
class Application(Adw.Application):
def __init__(self, version):
super().__init__(application_id='io.github.seadve.Breathing',
flags=Gio.ApplicationFlags.FLAGS_NONE)

self.version = version

GLib.set_application_name("Breathing")
GLib.set_prgname('io.github.seadve.Breathing')

def do_activate(self):
win = self.props.active_window
Expand All @@ -28,20 +27,11 @@ def do_activate(self):
win.present()

def do_startup(self):
Gtk.Application.do_startup(self)

css_provider = Gtk.CssProvider()
css_provider.load_from_resource('/io/github/seadve/Breathing/ui/style.css')
display = Gdk.Display.get_default()
Gtk.StyleContext.add_provider_for_display(
display, css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION,
)
Adw.Application.do_startup(self)

self.settings = Gio.Settings.new('io.github.seadve.Breathing')
self.setup_actions()

Adw.init()

def setup_actions(self):
simple_action = Gio.SimpleAction.new("toggle-breathing", None)
simple_action.connect("activate", self.window_toggle_breathing)
Expand Down

0 comments on commit 9fa460e

Please sign in to comment.