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
e5d70d9c
Commit
e5d70d9c
authored
Jul 14, 2020
by
Bilal Elmoussaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update labels & set a smaller size by default
parent
6579f486
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
3 deletions
+25
-3
application.rs
src/application.rs
+3
-0
utils.rs
src/utils.rs
+13
-0
image.rs
src/widgets/pages/image.rs
+4
-1
window.rs
src/widgets/window.rs
+5
-2
No files found.
src/application.rs
View file @
e5d70d9c
...
...
@@ -33,6 +33,7 @@ impl Application {
app
.quit
();
}),
);
// Start Tour
utils
::
action
(
&
self
.app
,
...
...
@@ -64,6 +65,7 @@ impl Application {
}
}),
);
utils
::
action
(
&
self
.app
,
"previous-page"
,
...
...
@@ -75,6 +77,7 @@ impl Application {
}
}),
);
self
.app
.set_accels_for_action
(
"app.quit"
,
&
[
"<primary>q"
]);
}
...
...
src/utils.rs
View file @
e5d70d9c
// based on https://gitlab.gnome.org/World/podcasts/-/blob/master/podcasts-gtk/src/i18n|utils.rs
use
gettextrs
::
gettext
;
pub
fn
action
<
T
,
F
>
(
thing
:
&
T
,
name
:
&
str
,
action
:
F
)
where
T
:
gio
::
ActionMapExt
,
...
...
@@ -10,3 +13,13 @@ where
// Add it to the map
thing
.add_action
(
&
act
);
}
pub
fn
i18n_f
(
format
:
&
str
,
args
:
&
[
&
str
])
->
String
{
let
s
=
gettext
(
format
);
let
mut
parts
=
s
.split
(
"{}"
);
let
mut
output
=
parts
.next
()
.unwrap_or
(
""
)
.to_string
();
for
(
p
,
a
)
in
parts
.zip
(
args
.iter
())
{
output
+=
&
(
a
.to_string
()
+
&
p
.to_string
());
}
output
}
src/widgets/pages/image.rs
View file @
e5d70d9c
...
...
@@ -34,7 +34,10 @@ impl ImagePageWidget {
let
container
=
gtk
::
Box
::
new
(
gtk
::
Orientation
::
Vertical
,
12
);
container
.set_halign
(
gtk
::
Align
::
Center
);
container
.set_valign
(
gtk
::
Align
::
Center
);
container
.set_property_margin
(
48
);
container
.set_margin_bottom
(
48
);
container
.set_margin_top
(
12
);
container
.set_margin_start
(
12
);
container
.set_margin_end
(
12
);
let
image
=
gtk
::
Image
::
from_resource
(
&
resource_uri
);
image
.set_valign
(
gtk
::
Align
::
Start
);
...
...
src/widgets/window.rs
View file @
e5d70d9c
use
crate
::
utils
;
use
gettextrs
::
gettext
;
use
gtk
::
prelude
::
*
;
use
std
::
cell
::
RefCell
;
...
...
@@ -34,7 +35,7 @@ impl Window {
}
fn
init
(
&
mut
self
)
{
self
.widget
.set_default_size
(
920
,
64
0
);
self
.widget
.set_default_size
(
720
,
50
0
);
self
.widget
.set_icon_name
(
Some
(
APP_ID
));
// Devel Profile
...
...
@@ -71,6 +72,7 @@ impl Window {
gettext
(
"View system information and settings"
),
gettext
(
"Get an overview of the system status and quickly change settings."
),
)));
self
.paginator
.borrow_mut
()
.add_page
(
Box
::
new
(
ImagePageWidget
::
new
(
"/org/gnome/Tour/software.svg"
,
gettext
(
"Software"
),
...
...
@@ -78,10 +80,11 @@ impl Window {
gettext
(
"Discover great apps through search, browsing and our recommendations."
),
)));
let
name
=
glib
::
get_os_info
(
"NAME"
)
.unwrap_or
(
"GNOME"
.into
());
let
last_page
=
ImagePageWidget
::
new
(
"/org/gnome/Tour/ready-to-go.svg"
,
gettext
(
"Tour Completed"
),
gettext
(
"That's it! We hope that you enjoy NAME OF DISTRO."
),
utils
::
i18n_f
(
"That's it! We hope that you enjoy {}."
,
&
[
&
name
]
),
gettext
(
"To get more advice and tips, see the Help app."
),
);
last_page
.widget
.get_style_context
()
.add_class
(
"last-page"
);
...
...
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