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
dbb6cbe0
Commit
dbb6cbe0
authored
Sep 30, 2020
by
Julian Hofer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use the builder-pattern for various widgets
parent
a37f7b95
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
39 deletions
+55
-39
image.rs
src/widgets/pages/image.rs
+25
-18
welcome.rs
src/widgets/pages/welcome.rs
+30
-21
No files found.
src/widgets/pages/image.rs
View file @
dbb6cbe0
...
...
@@ -19,34 +19,41 @@ impl ImagePageWidget {
self
.widget
.set_halign
(
gtk
::
Align
::
Fill
);
self
.widget
.set_valign
(
gtk
::
Align
::
Fill
);
let
container
=
gtk
::
Box
::
new
(
gtk
::
Orientation
::
Vertical
,
12
);
container
.set_halign
(
gtk
::
Align
::
Center
);
container
.set_valign
(
gtk
::
Align
::
Center
);
container
.set_vexpand
(
true
);
container
.set_margin_bottom
(
48
);
container
.set_margin_top
(
12
);
container
.set_margin_start
(
12
);
container
.set_margin_end
(
12
);
let
container
=
gtk
::
BoxBuilder
::
new
()
.orientation
(
gtk
::
Orientation
::
Vertical
)
.spacing
(
12
)
.halign
(
gtk
::
Align
::
Center
)
.valign
(
gtk
::
Align
::
Center
)
.vexpand
(
true
)
.margin_bottom
(
48
)
.margin_top
(
12
)
.margin_start
(
12
)
.margin_end
(
12
)
.build
();
let
image
=
gtk
::
Image
::
from_resource
(
&
resource_uri
);
image
.set_valign
(
gtk
::
Align
::
Start
);
image
.show
();
container
.add
(
&
image
);
let
head_label
=
gtk
::
Label
::
new
(
Some
(
&
head
));
head_label
.set_justify
(
gtk
::
Justification
::
Center
);
head_label
.set_valign
(
gtk
::
Align
::
Center
);
head_label
.set_margin_top
(
36
);
let
head_label
=
gtk
::
LabelBuilder
::
new
()
.label
(
&
head
)
.justify
(
gtk
::
Justification
::
Center
)
.valign
(
gtk
::
Align
::
Center
)
.margin_top
(
36
)
.build
();
head_label
.get_style_context
()
.add_class
(
"page-title"
);
head_label
.show
();
container
.add
(
&
head_label
);
let
body_label
=
gtk
::
Label
::
new
(
Some
(
&
body
));
body_label
.set_lines
(
2
);
body_label
.set_property_wrap
(
true
);
body_label
.set_justify
(
gtk
::
Justification
::
Center
);
body_label
.set_valign
(
gtk
::
Align
::
Center
);
body_label
.set_margin_top
(
12
);
let
body_label
=
gtk
::
LabelBuilder
::
new
()
.label
(
&
body
)
.lines
(
2
)
.wrap
(
true
)
.justify
(
gtk
::
Justification
::
Center
)
.valign
(
gtk
::
Align
::
Center
)
.margin_top
(
12
)
.build
();
body_label
.get_style_context
()
.add_class
(
"page-body"
);
body_label
.show
();
container
.add
(
&
body_label
);
...
...
src/widgets/pages/welcome.rs
View file @
dbb6cbe0
...
...
@@ -60,13 +60,15 @@ impl WelcomePageWidget {
}
fn
init
(
&
self
)
{
let
container
=
gtk
::
Box
::
new
(
gtk
::
Orientation
::
Vertical
,
0
);
container
.set_property_expand
(
true
);
container
.set_valign
(
gtk
::
Align
::
Center
);
container
.set_halign
(
gtk
::
Align
::
Center
);
container
.set_margin_top
(
24
);
container
.set_margin_bottom
(
24
);
let
container
=
gtk
::
BoxBuilder
::
new
()
.orientation
(
gtk
::
Orientation
::
Vertical
)
.spacing
(
0
)
.expand
(
true
)
.valign
(
gtk
::
Align
::
Center
)
.halign
(
gtk
::
Align
::
Center
)
.margin_top
(
24
)
.margin_bottom
(
24
)
.build
();
#[cfg(not(feature
=
"video"
))]
let
header
=
{
...
...
@@ -154,23 +156,30 @@ impl WelcomePageWidget {
text
.show
();
container
.add
(
&
text
);
let
actions_container
=
gtk
::
Box
::
new
(
gtk
::
Orientation
::
Horizontal
,
12
);
actions_container
.set_halign
(
gtk
::
Align
::
Center
);
actions_container
.set_margin_top
(
36
);
let
skip_tour_btn
=
gtk
::
Button
::
with_label
(
&
gettext
(
"_No Thanks"
));
skip_tour_btn
.set_property_height_request
(
40
);
skip_tour_btn
.set_property_width_request
(
180
);
skip_tour_btn
.set_use_underline
(
true
);
skip_tour_btn
.set_action_name
(
Some
(
"app.skip-tour"
));
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
::
Button
::
with_label
(
&
gettext
(
"_Start Tour"
));
start_tour_btn
.set_property_height_request
(
40
);
start_tour_btn
.set_property_width_request
(
180
);
start_tour_btn
.set_use_underline
(
true
);
start_tour_btn
.set_action_name
(
Some
(
"app.start-tour"
));
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
);
...
...
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