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
aa06f0f6
Commit
aa06f0f6
authored
Dec 31, 2021
by
Bilal Elmoussaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
subclass PaginatorWidget
parent
8f181ddc
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
17 deletions
+12
-17
application.rs
src/application.rs
+2
-2
paginator.rs
src/widgets/paginator.rs
+0
-0
window.rs
src/widgets/window.rs
+10
-15
No files found.
src/application.rs
View file @
aa06f0f6
...
...
@@ -68,7 +68,7 @@ mod imp {
"next-page"
,
clone!
(
@
weak
application
=>
move
|
_
,
_
|
{
let
window
=
application
.window
();
if
window
.paginator
.
borrow_mut
()
.
try_next
()
.is_none
()
{
if
window
.paginator
.try_next
()
.is_none
()
{
window
.widget
.close
();
}
}),
...
...
@@ -79,7 +79,7 @@ mod imp {
"previous-page"
,
clone!
(
@
weak
application
=>
move
|
_
,
_
|
{
let
window
=
application
.window
();
if
window
.paginator
.
borrow_mut
()
.
try_previous
()
.is_none
()
{
if
window
.paginator
.try_previous
()
.is_none
()
{
window
.reset_tour
();
}
}),
...
...
src/widgets/paginator.rs
View file @
aa06f0f6
This diff is collapsed.
Click to expand it.
src/widgets/window.rs
View file @
aa06f0f6
use
adw
::
prelude
::
*
;
use
gettextrs
::
gettext
;
use
std
::
cell
::
RefCell
;
use
std
::
rc
::
Rc
;
use
super
::
pages
::{
ImagePageWidget
,
WelcomePageWidget
};
use
super
::
paginator
::
PaginatorWidget
;
...
...
@@ -11,14 +9,14 @@ use crate::Application;
#[derive(Debug)]
pub
struct
Window
{
pub
widget
:
adw
::
ApplicationWindow
,
pub
paginator
:
RefCell
<
Rc
<
PaginatorWidget
>>
,
pub
paginator
:
PaginatorWidget
,
}
impl
Window
{
pub
fn
new
(
app
:
&
Application
)
->
Self
{
let
widget
=
adw
::
ApplicationWindow
::
new
(
app
);
let
paginator
=
RefCell
::
new
(
PaginatorWidget
::
new
()
);
let
paginator
=
PaginatorWidget
::
new
(
);
let
mut
window_widget
=
Window
{
widget
,
paginator
};
...
...
@@ -27,11 +25,11 @@ impl Window {
}
pub
fn
start_tour
(
&
self
)
{
self
.paginator
.
borrow_mut
()
.
set_page
(
1
);
self
.paginator
.set_page
(
1
);
}
pub
fn
reset_tour
(
&
self
)
{
self
.paginator
.
borrow_mut
()
.
set_page
(
0
);
self
.paginator
.set_page
(
0
);
}
fn
init
(
&
mut
self
)
{
...
...
@@ -43,9 +41,8 @@ impl Window {
self
.widget
.add_css_class
(
"devel"
);
}
self
.paginator
.borrow_mut
()
.add_page
(
WelcomePageWidget
::
new
()
.widget.upcast
::
<
gtk
::
Widget
>
());
self
.paginator
.
borrow_mut
()
.
add_page
(
self
.paginator
.add_page
(
ImagePageWidget
::
new
(
"/org/gnome/Tour/overview.svg"
,
gettext
(
"Get an Overview"
),
...
...
@@ -55,7 +52,7 @@ impl Window {
.upcast
::
<
gtk
::
Widget
>
(),
);
self
.paginator
.
borrow_mut
()
.
add_page
(
self
.paginator
.add_page
(
ImagePageWidget
::
new
(
"/org/gnome/Tour/search.svg"
,
gettext
(
"Just Type to Search"
),
...
...
@@ -65,7 +62,7 @@ impl Window {
.upcast
::
<
gtk
::
Widget
>
(),
);
self
.paginator
.
borrow_mut
()
.
add_page
(
self
.paginator
.add_page
(
ImagePageWidget
::
new
(
"/org/gnome/Tour/workspaces.svg"
,
gettext
(
"Keep on Top with Workspaces"
),
...
...
@@ -75,7 +72,7 @@ impl Window {
.upcast
::
<
gtk
::
Widget
>
(),
);
self
.paginator
.
borrow_mut
()
.
add_page
(
self
.paginator
.add_page
(
ImagePageWidget
::
new
(
"/org/gnome/Tour/blank.svg"
,
gettext
(
"Up/Down for the Overview"
),
...
...
@@ -85,7 +82,7 @@ impl Window {
.upcast
::
<
gtk
::
Widget
>
(),
);
self
.paginator
.
borrow_mut
()
.
add_page
(
self
.paginator
.add_page
(
ImagePageWidget
::
new
(
"/org/gnome/Tour/blank.svg"
,
gettext
(
"Left/Right for Workspaces"
),
...
...
@@ -102,10 +99,8 @@ impl Window {
);
last_page
.widget
.add_css_class
(
"last-page"
);
self
.paginator
.borrow_mut
()
.add_page
(
last_page
.widget.upcast
::
<
gtk
::
Widget
>
());
self
.widget
.set_content
(
Some
(
&
self
.paginator
.borrow
()
.widget
));
self
.widget
.set_content
(
Some
(
&
self
.paginator
));
}
}
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