|
|
|
@ -8,6 +8,7 @@ use \GtkButtonsType;
@@ -8,6 +8,7 @@ use \GtkButtonsType;
|
|
|
|
|
use \GtkDialogFlags; |
|
|
|
|
use \GtkMessageDialog; |
|
|
|
|
use \GtkMessageType; |
|
|
|
|
use \GtkRadioButton; |
|
|
|
|
use \GtkResponseType; |
|
|
|
|
|
|
|
|
|
use \Yggverse\Yoda\Entity\Browser\Container\Page; |
|
|
|
@ -21,8 +22,12 @@ class Auth
@@ -21,8 +22,12 @@ class Auth
|
|
|
|
|
public Page $page; |
|
|
|
|
|
|
|
|
|
// Defaults |
|
|
|
|
public const DIALOG_MESSAGE_FORMAT = 'Authorization'; |
|
|
|
|
public const DIALOG_DEFAULT_RESPONSE = GtkResponseType::CANCEL; |
|
|
|
|
public const DIALOG_FORMAT_SECONDARY_TEXT = 'Select identity'; |
|
|
|
|
public const DIALOG_MESSAGE_FORMAT = 'Authorization'; |
|
|
|
|
public const DIALOG_CONTENT_OPTION_LABEL_CREATE = 'Create new for this resource'; |
|
|
|
|
public const DIALOG_CONTENT_OPTION_MARGIN = 8; |
|
|
|
|
public const DIALOG_CONTENT_SPACING = 8; |
|
|
|
|
|
|
|
|
|
public function __construct( |
|
|
|
|
Page $page, |
|
|
|
@ -33,6 +38,7 @@ class Auth
@@ -33,6 +38,7 @@ class Auth
|
|
|
|
|
|
|
|
|
|
public function dialog(): bool |
|
|
|
|
{ |
|
|
|
|
// Init dialog |
|
|
|
|
$this->gtk = new GtkMessageDialog( |
|
|
|
|
$this->page->container->browser->gtk, |
|
|
|
|
GtkDialogFlags::MODAL, |
|
|
|
@ -41,10 +47,31 @@ class Auth
@@ -41,10 +47,31 @@ class Auth
|
|
|
|
|
_($this::DIALOG_MESSAGE_FORMAT) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$this->gtk->format_secondary_text( |
|
|
|
|
_($this::DIALOG_FORMAT_SECONDARY_TEXT) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$this->gtk->set_default_response( |
|
|
|
|
$this::DIALOG_DEFAULT_RESPONSE |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// Init content |
|
|
|
|
$content = $this->gtk->get_content_area(); |
|
|
|
|
|
|
|
|
|
$content->set_spacing( |
|
|
|
|
$this::DIALOG_CONTENT_SPACING |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$content->add( |
|
|
|
|
$this->_option( |
|
|
|
|
_($this::DIALOG_CONTENT_OPTION_LABEL_CREATE) |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// Render |
|
|
|
|
$this->gtk->show_all(); |
|
|
|
|
|
|
|
|
|
// Listen for chose |
|
|
|
|
if (GtkResponseType::OK == $this->gtk->run()) |
|
|
|
|
{ |
|
|
|
|
// @TODO |
|
|
|
@ -58,4 +85,34 @@ class Auth
@@ -58,4 +85,34 @@ class Auth
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private function _option( |
|
|
|
|
string $label, |
|
|
|
|
int $margin = self::DIALOG_CONTENT_OPTION_MARGIN |
|
|
|
|
): GtkRadioButton |
|
|
|
|
{ |
|
|
|
|
$option = GtkRadioButton::new_with_label( |
|
|
|
|
$label |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$option->set_margin_start( |
|
|
|
|
$margin |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$option->set_margin_start( |
|
|
|
|
$margin |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$option->set_margin_end( |
|
|
|
|
$margin |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$option->set_margin_bottom( |
|
|
|
|
$margin |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// @TODO connect signals? |
|
|
|
|
|
|
|
|
|
return $option; |
|
|
|
|
} |
|
|
|
|
} |