mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 09:05:27 +00:00
update title setters API
This commit is contained in:
parent
20f71fcdcf
commit
52ade7be77
2 changed files with 34 additions and 25 deletions
|
|
@ -79,7 +79,7 @@ class Content
|
|||
);
|
||||
|
||||
// Init new title
|
||||
$this->page->title->setValue(
|
||||
$this->page->title->set(
|
||||
$address->getHost(),
|
||||
'loading...'
|
||||
);
|
||||
|
|
@ -126,7 +126,7 @@ class Content
|
|||
|
||||
if ($title) // detect title by document h1
|
||||
{
|
||||
$this->page->title->setValue(
|
||||
$this->page->title->set(
|
||||
$title,
|
||||
$this->page->title->getSubtitle()
|
||||
);
|
||||
|
|
@ -136,7 +136,7 @@ class Content
|
|||
|
||||
default:
|
||||
|
||||
$this->page->title->setValue(
|
||||
$this->page->title->set(
|
||||
'Oops!',
|
||||
'file extension not supported'
|
||||
);
|
||||
|
|
@ -149,7 +149,7 @@ class Content
|
|||
|
||||
else
|
||||
{
|
||||
$this->page->title->setValue(
|
||||
$this->page->title->set(
|
||||
'Failure',
|
||||
'resource not found or not readable'
|
||||
);
|
||||
|
|
@ -190,7 +190,7 @@ class Content
|
|||
$title
|
||||
);
|
||||
|
||||
$this->page->title->setValue(
|
||||
$this->page->title->set(
|
||||
$title ? sprintf(
|
||||
'%s - %s',
|
||||
$title,
|
||||
|
|
@ -206,7 +206,7 @@ class Content
|
|||
$response
|
||||
);
|
||||
|
||||
$this->page->title->setValue(
|
||||
$this->page->title->set(
|
||||
$address->getHost()
|
||||
);
|
||||
}
|
||||
|
|
@ -214,7 +214,7 @@ class Content
|
|||
|
||||
else
|
||||
{
|
||||
$this->page->title->setValue(
|
||||
$this->page->title->set(
|
||||
'Failure',
|
||||
'could not open resource'
|
||||
);
|
||||
|
|
@ -243,7 +243,7 @@ class Content
|
|||
case 10: // response expected
|
||||
case 11: // sensitive input
|
||||
|
||||
$this->page->title->setValue(
|
||||
$this->page->title->set(
|
||||
$address->getHost(),
|
||||
$response->getMeta() ? $response->getMeta() : 'response expected'
|
||||
);
|
||||
|
|
@ -285,7 +285,7 @@ class Content
|
|||
$title
|
||||
);
|
||||
|
||||
$this->page->title->setValue(
|
||||
$this->page->title->set(
|
||||
$title ? sprintf(
|
||||
'%s - %s',
|
||||
$title,
|
||||
|
|
@ -302,7 +302,7 @@ class Content
|
|||
$response->getBody()
|
||||
);
|
||||
|
||||
$this->page->title->setValue(
|
||||
$this->page->title->set(
|
||||
$address->getHost()
|
||||
);
|
||||
}
|
||||
|
|
@ -318,7 +318,7 @@ class Content
|
|||
)
|
||||
);
|
||||
|
||||
$this->page->title->setValue(
|
||||
$this->page->title->set(
|
||||
$address->getHost(),
|
||||
sprintf(
|
||||
'redirect (code %d)',
|
||||
|
|
@ -332,7 +332,7 @@ class Content
|
|||
|
||||
default:
|
||||
|
||||
$this->page->title->setValue(
|
||||
$this->page->title->set(
|
||||
'Failure',
|
||||
sprintf(
|
||||
'%s (code %d)',
|
||||
|
|
@ -391,7 +391,7 @@ class Content
|
|||
|
||||
default:
|
||||
|
||||
$this->page->title->setValue(
|
||||
$this->page->title->set(
|
||||
'Oops!',
|
||||
'protocol not supported!'
|
||||
);
|
||||
|
|
|
|||
|
|
@ -40,10 +40,28 @@ class Title
|
|||
);
|
||||
}
|
||||
|
||||
public function setValue(
|
||||
public function set(
|
||||
?string $value = null,
|
||||
?string $subtitle = null,
|
||||
?string $tooltip = null,
|
||||
?string $tooltip = null
|
||||
): void
|
||||
{
|
||||
$this->setValue(
|
||||
$value
|
||||
);
|
||||
|
||||
$this->setSubtitle(
|
||||
$subtitle
|
||||
);
|
||||
|
||||
$this->setTooltip(
|
||||
is_null($tooltip) ? (mb_strlen(strval($value)) > $this->_length ? $value : null)
|
||||
: $tooltip
|
||||
);
|
||||
}
|
||||
|
||||
public function setValue(
|
||||
?string $value = null
|
||||
): void
|
||||
{
|
||||
$this->gtk->set_text(
|
||||
|
|
@ -51,15 +69,6 @@ class Title
|
|||
$value
|
||||
)
|
||||
);
|
||||
|
||||
$this->gtk->set_tooltip_text(
|
||||
is_null($tooltip) ? (mb_strlen(strval($value)) > $this->_length ? $value : null)
|
||||
: trim($tooltip)
|
||||
);
|
||||
|
||||
$this->setSubtitle(
|
||||
$subtitle
|
||||
);
|
||||
}
|
||||
|
||||
public function setSubtitle(
|
||||
|
|
@ -79,7 +88,7 @@ class Title
|
|||
?string $tooltip = null
|
||||
): void
|
||||
{
|
||||
$this->gtk->set_subtitle(
|
||||
$this->gtk->set_tooltip_text(
|
||||
is_null($tooltip) ? $this->_tooltip : trim(
|
||||
$tooltip
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue