Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
ximper-welcome
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
ximper-welcome
Commits
b876e4e4
Commit
b876e4e4
authored
Oct 04, 2020
by
Julian Hofer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove anyhow and adapt paginator
Anyhow was only used for paginator and Option makes arguably more sense here than Result
parent
dab65490
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
11 deletions
+8
-11
Cargo.lock
Cargo.lock
+0
-1
Cargo.toml
Cargo.toml
+0
-1
application.rs
src/application.rs
+2
-2
paginator.rs
src/widgets/paginator.rs
+6
-7
No files found.
Cargo.lock
View file @
b876e4e4
...
...
@@ -382,7 +382,6 @@ dependencies = [
name = "gnome-tour"
version = "3.38.0"
dependencies = [
"anyhow",
"gdk",
"gettext-rs",
"gio",
...
...
Cargo.toml
View file @
b876e4e4
...
...
@@ -16,7 +16,6 @@ log = "0.4"
gettext-rs
=
{
version
=
"0.4"
,
features
=
["gettext-system"]
}
libhandy
=
"0.7"
pretty_env_logger
=
"0.4"
anyhow
=
"1.0"
[dependencies.gst_player]
version
=
"0.16"
...
...
src/application.rs
View file @
b876e4e4
...
...
@@ -61,7 +61,7 @@ impl Application {
"next-page"
,
clone!
(
@
strong
application
=>
move
|
_
,
_
|
{
if
let
Some
(
window
)
=
&*
application
.window
.borrow
()
.clone
()
{
if
window
.paginator
.borrow_mut
()
.
next
()
.is_err
()
{
if
window
.paginator
.borrow_mut
()
.
try_next
()
.is_none
()
{
window
.widget
.close
();
}
}
...
...
@@ -73,7 +73,7 @@ impl Application {
"previous-page"
,
clone!
(
@
strong
application
=>
move
|
_
,
_
|
{
if
let
Some
(
window
)
=
&*
application
.window
.borrow
()
.clone
()
{
if
window
.paginator
.borrow_mut
()
.
previous
()
.is_err
()
{
if
window
.paginator
.borrow_mut
()
.
try_previous
()
.is_none
()
{
window
.reset_tour
();
}
}
...
...
src/widgets/paginator.rs
View file @
b876e4e4
use
anyhow
::
Result
;
use
gettextrs
::
gettext
;
use
glib
::
clone
;
use
gtk
::
prelude
::
*
;
...
...
@@ -38,22 +37,22 @@ impl PaginatorWidget {
paginator
}
pub
fn
next
(
&
self
)
->
Result
<
()
>
{
pub
fn
try_next
(
&
self
)
->
Option
<
()
>
{
let
p
=
*
self
.current_page
.borrow
()
+
1
;
if
p
==
self
.carousel
.get_n_pages
()
{
anyhow
::
bail!
(
"Already at the latest page"
)
;
return
None
;
}
self
.set_page
(
p
);
Ok
(())
Some
(())
}
pub
fn
previous
(
&
self
)
->
Result
<
()
>
{
pub
fn
try_previous
(
&
self
)
->
Option
<
()
>
{
let
p
=
*
self
.current_page
.borrow
();
if
p
==
0
{
anyhow
::
bail!
(
"Already at the first page"
)
;
return
None
;
}
self
.set_page
(
p
-
1
);
Ok
(())
Some
(())
}
pub
fn
add_page
(
&
self
,
page
:
gtk
::
Widget
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment