]> git.scottworley.com Git - nix-env-apps/blobdiff - apps.py
Release 1.0.1
[nix-env-apps] / apps.py
diff --git a/apps.py b/apps.py
index 959c14893af48934260d651d2851b96c29083bdf..44dd9bb887ddb3ee73b038ba7580d721239988b1 100644 (file)
--- a/apps.py
+++ b/apps.py
@@ -1,6 +1,12 @@
+# nix-env-apps: Manage declarative nix-env with a GUI
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, version 3.
+
 import os
 import subprocess
-from typing import Any
+from typing import Any, Callable
 
 import gi
 gi.require_version("Gtk", "4.0")
@@ -80,14 +86,23 @@ def on_apply(_: Any) -> None:
         os.execvp(command[0], command)
 
 
+def make_button(label: str, action: Callable[[Any], None]) -> Gtk.Button:
+    button = Gtk.Button(label=label)
+    button.connect('clicked', action)
+    button.set_margin_top(10)
+    button.set_margin_start(10)
+    button.set_margin_end(10)
+    button.set_margin_bottom(10)
+    return button
+
+
 def on_activate(app: Gtk.Application) -> None:
     win = Gtk.ApplicationWindow(application=app)
+    win.set_title('Apps')
     box = Gtk.Box()
     box.set_orientation(Gtk.Orientation.VERTICAL)
-    edit = Gtk.Button(label="Edit Configuration")
-    apply = Gtk.Button(label="Apply Configuration")
-    edit.connect('clicked', on_edit)
-    apply.connect('clicked', on_apply)
+    edit = make_button("Edit Configuration", on_edit)
+    apply = make_button("Apply Configuration", on_apply)
     box.append(edit)
     box.append(apply)
     win.set_child(box)