mirror of
https://github.com/morgan9e/warehouse
synced 2026-04-15 00:34:42 +09:00
Fix some UI issues
This commit is contained in:
@@ -23,19 +23,32 @@ template $AddRemoteDialog : Adw.Dialog {
|
||||
}
|
||||
}
|
||||
}
|
||||
Adw.PreferencesPage {
|
||||
Adw.PreferencesGroup {
|
||||
Adw.EntryRow title_row {
|
||||
title: _("Enter Title");
|
||||
Adw.ToastOverlay toast_overlay {
|
||||
Stack stack {
|
||||
Adw.PreferencesPage content_page {
|
||||
Adw.PreferencesGroup {
|
||||
Adw.EntryRow title_row {
|
||||
title: _("Enter Title");
|
||||
}
|
||||
Adw.EntryRow name_row {
|
||||
title: _("Enter Name");
|
||||
}
|
||||
Adw.EntryRow url_row {
|
||||
title: _("Enter Repo URL");
|
||||
}
|
||||
Adw.ComboRow installation_row {
|
||||
title: _("Installation");
|
||||
}
|
||||
}
|
||||
}
|
||||
Adw.EntryRow name_row {
|
||||
title: _("Enter Name");
|
||||
}
|
||||
Adw.EntryRow url_row {
|
||||
title: _("Enter Repo URL");
|
||||
}
|
||||
Adw.ComboRow installation_row {
|
||||
title: _("Installation");
|
||||
Adw.StatusPage loading_page {
|
||||
title: _("Adding Remote");
|
||||
description: _("This should only take a moment");
|
||||
child:
|
||||
Spinner {
|
||||
spinning: true;
|
||||
}
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,15 +8,21 @@ class AddRemoteDialog(Adw.Dialog):
|
||||
__gtype_name__ = "AddRemoteDialog"
|
||||
gtc = Gtk.Template.Child
|
||||
|
||||
action_bar = gtc()
|
||||
toast_overlay = gtc()
|
||||
stack = gtc()
|
||||
apply_button = gtc()
|
||||
content_page = gtc()
|
||||
title_row = gtc()
|
||||
name_row = gtc()
|
||||
url_row = gtc()
|
||||
installation_row = gtc()
|
||||
loading_page = gtc()
|
||||
|
||||
def on_apply(self, *args):
|
||||
self.close()
|
||||
self.parent_page.stack.set_visible_child(self.parent_page.loading_remotes)
|
||||
self.stack.set_visible_child(self.loading_page)
|
||||
self.apply_button.set_sensitive(False)
|
||||
self.action_bar.set_revealed(False)
|
||||
error = [None]
|
||||
def thread(*args):
|
||||
cmd = [
|
||||
@@ -41,10 +47,14 @@ class AddRemoteDialog(Adw.Dialog):
|
||||
|
||||
def callback(*args):
|
||||
if error[0]:
|
||||
self.parent_page.toast_overlay.add_toast(ErrorToast(_("Could not add remote"), str(error[0])))
|
||||
self.stack.set_visible_child(self.content_page)
|
||||
self.action_bar.set_revealed(True)
|
||||
self.apply_button.set_sensitive(True)
|
||||
self.toast_overlay.add_toast(ErrorToast(_("Could not add remote"), str(error[0])).toast)
|
||||
else:
|
||||
self.close()
|
||||
self.main_window.refresh_handler()
|
||||
self.parent_page.toast_overlay.add_toast(Adw.Toast(title=_("Added {}").format(self.name_row.get_text())))
|
||||
self.parent_page.toast_overlay.add_toast(Adw.Toast(title=_("Added {}").format(self.title_row.get_text())))
|
||||
|
||||
Gio.Task.new(None, None, callback).run_in_thread(thread)
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ class RemotesPage(Adw.NavigationPage):
|
||||
self.toast_overlay.add_toast(ErrorToast(_("Could not remove remote"), str(error[0])).toast)
|
||||
else:
|
||||
self.main_window.refresh_handler()
|
||||
self.toast_overlay.add_toast(Adw.Toast(title=_("Removed remote")))
|
||||
self.toast_overlay.add_toast(Adw.Toast(title=_("Removed {}").format(row.remote.title)))
|
||||
|
||||
def on_response(_, response):
|
||||
if response != "continue":
|
||||
|
||||
Reference in New Issue
Block a user