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
6926f744
Commit
6926f744
authored
Feb 05, 2021
by
Bilal Elmoussaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
welcome page: always how a headerbar
fixes #30
parent
241993e7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
62 deletions
+34
-62
welcome.rs
src/widgets/pages/welcome.rs
+0
-35
paginator.rs
src/widgets/paginator.rs
+34
-27
No files found.
src/widgets/pages/welcome.rs
View file @
6926f744
...
...
@@ -167,41 +167,6 @@ impl WelcomePageWidget {
text
.show
();
container
.add
(
&
text
);
let
actions_container
=
gtk
::
BoxBuilder
::
new
()
.orientation
(
gtk
::
Orientation
::
Horizontal
)
.spacing
(
12
)
.halign
(
gtk
::
Align
::
Center
)
.margin_top
(
36
)
.build
();
let
skip_tour_btn
=
gtk
::
ButtonBuilder
::
new
()
.label
(
&
gettext
(
"_No Thanks"
))
.height_request
(
40
)
.width_request
(
180
)
.use_underline
(
true
)
.action_name
(
"app.skip-tour"
)
.build
();
skip_tour_btn
.show
();
actions_container
.add
(
&
skip_tour_btn
);
let
start_tour_btn
=
gtk
::
ButtonBuilder
::
new
()
.label
(
&
gettext
(
"_Start Tour"
))
.height_request
(
40
)
.width_request
(
180
)
.use_underline
(
true
)
.action_name
(
"app.start-tour"
)
.build
();
start_tour_btn
.get_style_context
()
.add_class
(
"suggested-action"
);
start_tour_btn
.show
();
actions_container
.add
(
&
start_tour_btn
);
actions_container
.set_focus_child
(
Some
(
&
start_tour_btn
));
actions_container
.show
();
container
.add
(
&
actions_container
);
container
.show
();
self
.widget
.add
(
&
container
);
self
.widget
.show
();
...
...
src/widgets/paginator.rs
View file @
6926f744
...
...
@@ -14,6 +14,7 @@ pub struct PaginatorWidget {
pages
:
RefCell
<
Vec
<
gtk
::
Widget
>>
,
current_page
:
RefCell
<
u32
>
,
next_btn
:
gtk
::
Button
,
finish_btn
:
gtk
::
Button
,
close_btn
:
gtk
::
Button
,
previous_btn
:
gtk
::
Button
,
}
...
...
@@ -28,6 +29,7 @@ impl PaginatorWidget {
carousel_dots
:
libhandy
::
CarouselIndicatorDots
::
new
(),
headerbar
:
libhandy
::
HeaderBar
::
new
(),
next_btn
:
gtk
::
Button
::
with_label
(
&
gettext
(
"_Next"
)),
finish_btn
:
gtk
::
Button
::
with_label
(
&
gettext
(
"_Close"
)),
close_btn
:
gtk
::
Button
::
with_label
(
&
gettext
(
"_Close"
)),
previous_btn
:
gtk
::
Button
::
with_label
(
&
gettext
(
"_Previous"
)),
pages
:
RefCell
::
new
(
Vec
::
new
()),
...
...
@@ -71,27 +73,22 @@ impl PaginatorWidget {
let
forelast_page
=
n_pages
-
2.0
;
let
last_page
=
n_pages
-
1.0
;
let
(
opacity_close
,
opacity_previous
,
opacity_next
)
=
if
(
0.0
<=
position
)
&&
(
position
<
1.0
)
{
(
0.0
,
position
,
position
)
}
else
if
(
1.0
<=
position
)
&&
(
position
<=
forelast_page
)
{
(
0.0
,
1.0
,
1.0
)
}
else
if
(
forelast_page
<
position
)
&&
(
position
<=
last_page
)
{
(
position
-
forelast_page
,
1.0
,
1.0
)
}
else
{
panic!
(
"Position of the carousel is outside the allowed range"
);
};
let
(
opacity_finish
,
opacity_previous
)
=
if
(
0.0
<=
position
)
&&
(
position
<
1.0
)
{
(
0.0
,
position
)
}
else
if
(
0.0
<=
position
)
&&
(
position
<=
forelast_page
)
{
(
0.0
,
1.0
)
}
else
if
(
forelast_page
<
position
)
&&
(
position
<=
last_page
)
{
(
position
-
forelast_page
,
1.0
)
}
else
{
panic!
(
"Position of the carousel is outside the allowed range"
);
};
self
.
close_btn
.set_opacity
(
opacity_close
);
self
.
close_btn
.set_visible
(
opacity_close
>
0
_f64
);
self
.
finish_btn
.set_opacity
(
opacity_finish
);
self
.
finish_btn
.set_visible
(
opacity_finish
>
0
_f64
);
self
.previous_btn
.set_opacity
(
opacity_previous
);
self
.previous_btn
.set_visible
(
opacity_previous
>
0
_f64
);
self
.next_btn
.set_opacity
(
opacity_next
);
self
.next_btn
.set_visible
(
opacity_next
>
0
_f64
);
self
.headerbar
.set_opacity
(
opacity_next
);
self
.current_page
.replace
(
page_nr
);
}
...
...
@@ -107,36 +104,46 @@ impl PaginatorWidget {
p
.update_position
();
}));
let
btn_size_group
=
gtk
::
SizeGroup
::
new
(
gtk
::
SizeGroupMode
::
Horizontal
);
btn_size_group
.add_widget
(
&
self
.previous_btn
);
btn_size_group
.add_widget
(
&
self
.next_btn
);
btn_size_group
.add_widget
(
&
self
.close_btn
);
self
.next_btn
.get_style_context
()
.add_class
(
"suggested-action"
);
self
.next_btn
.set_use_underline
(
true
);
self
.next_btn
.set_action_name
(
Some
(
"app.next-page"
));
self
.next_btn
.show
();
self
.close_btn
.get_style_context
()
.add_class
(
"suggested-action"
);
self
.close_btn
.set_use_underline
(
true
);
self
.close_btn
.set_action_name
(
Some
(
"app.quit"
));
self
.close_btn
.show
();
self
.finish_btn
.get_style_context
()
.add_class
(
"suggested-action"
);
self
.finish_btn
.set_use_underline
(
true
);
self
.finish_btn
.set_action_name
(
Some
(
"app.quit"
));
self
.previous_btn
.set_use_underline
(
true
);
self
.previous_btn
.set_action_name
(
Some
(
"app.previous-page"
));
let
previous_overlay
=
gtk
::
Overlay
::
new
();
previous_overlay
.add
(
&
self
.close_btn
);
previous_overlay
.add_overlay
(
&
self
.previous_btn
);
previous_overlay
.show
();
let
next_overlay
=
gtk
::
Overlay
::
new
();
next_overlay
.add
(
&
self
.next_btn
);
next_overlay
.add_overlay
(
&
self
.
close
_btn
);
next_overlay
.add_overlay
(
&
self
.
finish
_btn
);
next_overlay
.show
();
let
btn_size_group
=
gtk
::
SizeGroup
::
new
(
gtk
::
SizeGroupMode
::
Horizontal
);
btn_size_group
.add_widget
(
&
self
.previous_btn
);
btn_size_group
.add_widget
(
&
self
.close_btn
);
btn_size_group
.add_widget
(
&
self
.next_btn
);
btn_size_group
.add_widget
(
&
self
.finish_btn
);
self
.headerbar
.set_custom_title
(
Some
(
&
self
.carousel_dots
));
self
.headerbar
.pack_start
(
&
self
.previous_btn
);
self
.headerbar
.pack_start
(
&
previous_overlay
);
self
.headerbar
.pack_end
(
&
next_overlay
);
self
.headerbar
.set_show_close_button
(
false
);
self
.headerbar
.set_opacity
(
0
_f64
);
self
.headerbar
.show
();
self
.widget
.add
(
&
self
.headerbar
);
...
...
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