diff --git a/src/install_page/file_install_dialog.blp b/src/install_page/file_install_dialog.blp new file mode 100644 index 0000000..12f5bcd --- /dev/null +++ b/src/install_page/file_install_dialog.blp @@ -0,0 +1,40 @@ +using Gtk 4.0; +using Adw 1; + +template $FileInstallDialog : Adw.Dialog { + title: _("Install Local Files"); + follows-content-size: true; + Adw.ToolbarView { + [top] + Adw.HeaderBar { + show-start-title-buttons: false; + show-end-title-buttons: false; + [start] + Button cancel_button { + label: _("Cancel"); + } + [end] + Button apply_button { + styles ["suggested-action"] + label: _("Add"); + } + } + Adw.ToastOverlay toast_overlay { + ScrolledWindow content_page { + propagate-natural-height: true; + propagate-natural-width: true; + Adw.Clamp { + ListBox list_box { + margin-start: 12; + margin-end: 12; + margin-top: 12; + margin-bottom: 12; + selection-mode: none; + valign: start; + styles ["boxed-list"] + } + } + } + } + } +} diff --git a/src/install_page/file_install_dialog.py b/src/install_page/file_install_dialog.py new file mode 100644 index 0000000..0cbae71 --- /dev/null +++ b/src/install_page/file_install_dialog.py @@ -0,0 +1,31 @@ +from gi.repository import Adw, Gtk, GLib, Gio +from .host_info import HostInfo +from .error_toast import error_toast + +@Gtk.Template(resource_path="/io/github/flattool/Warehouse/install_page/file_install_dialog.ui") +class FileInstallDialog(Adw.Dialog): + __gtype_name__ = "FileInstallDialog" + gtc = Gtk.Template.Child + + cancel_button = gtc() + apply_button = gtc() + toast_overlay = gtc() + content_page = gtc() + list_box = gtc() + + def generate_list(self): + for file in self.files: + row = Adw.ActionRow(title=file.get_basename()) + self.list_box.append(row) + + def __init__(self, parent_page, files, **kwargs): + super().__init__(**kwargs) + + # Extra Object Creation + self.parent_page = parent_page + self.files = files + + # Apply + self.generate_list() + + # Connections diff --git a/src/meson.build b/src/meson.build index 1063bf1..5fe39b6 100644 --- a/src/meson.build +++ b/src/meson.build @@ -23,6 +23,7 @@ blueprints = custom_target('blueprints', 'snapshot_page/snapshots_list_page.blp', 'snapshot_page/snapshot_box.blp', 'snapshot_page/new_snapshot_dialog.blp', + 'install_page/file_install_dialog.blp', 'install_page/install_page.blp', 'install_page/result_row.blp', 'install_page/select_page.blp', @@ -92,6 +93,7 @@ warehouse_sources = [ 'snapshot_page/snapshots_list_page.py', 'snapshot_page/snapshot_box.py', 'snapshot_page/new_snapshot_dialog.py', + 'install_page/file_install_dialog.py', 'install_page/install_page.py', 'install_page/result_row.py', 'install_page/select_page.py', diff --git a/src/warehouse.gresource.xml b/src/warehouse.gresource.xml index 3ac514e..2b730dd 100644 --- a/src/warehouse.gresource.xml +++ b/src/warehouse.gresource.xml @@ -21,6 +21,7 @@ snapshot_page/snapshots_list_page.ui snapshot_page/snapshot_box.ui snapshot_page/new_snapshot_dialog.ui + install_page/file_install_dialog.ui install_page/install_page.ui install_page/result_row.ui install_page/select_page.ui