feat: flat
This commit is contained in:
19
src/main.py
19
src/main.py
@@ -19,6 +19,12 @@ class LemonadeWindow(Gtk.ApplicationWindow):
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<menu id="app-menu">
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="action">win.login</attribute>
|
||||
<attribute name="label" translatable="yes">_Log in</attribute>
|
||||
</item>
|
||||
</section>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="action">win.about</attribute>
|
||||
@@ -35,7 +41,7 @@ class LemonadeWindow(Gtk.ApplicationWindow):
|
||||
"""
|
||||
|
||||
try:
|
||||
os.mkdir(os.path.join(f"{os.environ['XDG_RUNTIME_DIR']}/app/{os.environ['FLATPAK_ID']}", "cache"))
|
||||
os.mkdir(os.path.join(f"{os.environ['XDG_RUNTIME_DIR']}/app/ml.mdwalters.Lemonade", "cache"))
|
||||
except FileExistsError as e:
|
||||
print(e)
|
||||
|
||||
@@ -44,6 +50,7 @@ class LemonadeWindow(Gtk.ApplicationWindow):
|
||||
stack.set_transition_duration(1000)
|
||||
|
||||
self.headerbar = Adw.HeaderBar.new()
|
||||
self.headerbar.get_style_context().add_class("flat")
|
||||
self.set_titlebar(self.headerbar)
|
||||
|
||||
home_button = Gtk.Button()
|
||||
@@ -70,6 +77,10 @@ class LemonadeWindow(Gtk.ApplicationWindow):
|
||||
about_action.connect("activate", self.on_about)
|
||||
self.add_action(about_action) # (self window) == win in MENU_XML
|
||||
|
||||
login_action = Gio.SimpleAction.new("login", None) # look at MENU_XML win.about
|
||||
login_action.connect("activate", self.on_login)
|
||||
self.add_action(login_action) # (self window) == win in MENU_XML
|
||||
|
||||
self.menu_button = Gtk.MenuButton.new()
|
||||
self.headerbar.pack_end(self.menu_button) # or pack_start
|
||||
menu = Gtk.Builder.new_from_string(MENU_XML, -1).get_object("app-menu")
|
||||
@@ -177,6 +188,12 @@ class LemonadeWindow(Gtk.ApplicationWindow):
|
||||
|
||||
self.about.show()
|
||||
|
||||
def on_login(self, action, param=None):
|
||||
status = Adw.StatusPage().new()
|
||||
status.set_icon_name("arrow-into-box-symbolic")
|
||||
status.set_title("Log in")
|
||||
status.show()
|
||||
|
||||
class Lemonade(Adw.Application):
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
|
Reference in New Issue
Block a user