Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
World
Design Tooling
Contrast
Commits
f86014cc
Commit
f86014cc
authored
Aug 06, 2019
by
Bilal Elmoussaoui
Browse files
i18n: mark some files as translatable
parent
0bce0d72
Pipeline
#102177
passed with stages
in 13 minutes and 39 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
po/POTFILES.in
View file @
f86014cc
...
...
@@ -5,3 +5,6 @@ data/resources/ui/about_dialog.ui.in
data/resources/ui/menu.ui
data/resources/ui/shortcuts.ui
data/resources/ui/window.ui.in
src/contrast_level.rs
src/contrast_preview.rs
src/window.rs
src/application.rs
View file @
f86014cc
...
...
@@ -88,7 +88,6 @@ impl Application {
about_dialog
.show
();
});
self
.app
.add_action
(
&
simple_action
);
self
.app
.set_accels_for_action
(
"app.about"
,
&
[
"<primary>comma"
]);
}
pub
fn
setup_signals
(
&
self
)
{
...
...
src/colour_entry.rs
View file @
f86014cc
...
...
@@ -27,6 +27,7 @@ impl ColourEntry {
self
.widget
.set_valign
(
gtk
::
Align
::
Center
);
self
.widget
.get_style_context
()
.add_class
(
"linked"
);
self
.widget
.set_hexpand
(
true
);
self
.widget
.set_tooltip_text
(
Some
(
&
label
));
self
.entry
.set_placeholder_text
(
Some
(
label
.as_str
()));
self
.entry
.set_halign
(
gtk
::
Align
::
Center
);
...
...
src/contrast_level.rs
View file @
f86014cc
use
crate
::
glib
::
Cast
;
use
crate
::
gtk
::{
BoxExt
,
ContainerExt
,
LabelExt
,
OverlayExt
,
StyleContextExt
,
WidgetExt
};
use
gettextrs
::
gettext
;
use
libhandy
::{
Column
,
ColumnExt
};
use
std
::{
cell
::
RefCell
,
rc
::
Rc
};
...
...
@@ -96,7 +97,7 @@ impl ChartBarWidget {
column
.show
();
let
weak_instance
=
Rc
::
downgrade
(
&
s
)
.clone
();
container
.connect_size_allocate
(
move
|
_
,
allocation
|
{
container
.connect_size_allocate
(
move
|
_
,
_
|
{
if
let
Some
(
instance
)
=
weak_instance
.upgrade
()
{
instance
.borrow
()
.reallocate
();
}
...
...
@@ -184,7 +185,7 @@ impl ContrastLevelBar {
pub
fn
set_contrast_level
(
&
mut
self
,
contrast_level
:
f64
)
{
self
.chartbar
.borrow_mut
()
.set_value
(
contrast_level
);
let
level_label
=
format!
(
"{:.1} out of 21"
,
contrast_level
);
let
level_label
=
gettext
(
format!
(
"{:.1} out of 21"
,
contrast_level
)
)
;
self
.level_label
.set_text
(
&
level_label
);
}
}
src/contrast_preview.rs
View file @
f86014cc
use
crate
::
gtk
::{
BoxExt
,
LabelExt
,
StyleContextExt
,
WidgetExt
};
use
gettextrs
::
gettext
;
pub
struct
ContrastPreview
{
pub
widget
:
gtk
::
Box
,
...
...
@@ -41,17 +42,17 @@ impl ContrastPreview {
pub
fn
set_contrast_level
(
&
self
,
contrast_level
:
f64
)
{
if
0.0
<=
contrast_level
&&
contrast_level
<
3.0
{
self
.head_label
.set_text
(
"Nope"
);
self
.comment_label
.set_text
(
"This color combination doesn't have enough contrast to be legible."
);
self
.head_label
.set_text
(
&
gettext
(
"Nope"
)
)
;
self
.comment_label
.set_text
(
&
gettext
(
"This color combination doesn't have enough contrast to be legible."
)
)
;
}
else
if
3.0
<=
contrast_level
&&
contrast_level
<
4.5
{
self
.head_label
.set_text
(
"Not bad"
);
self
.comment_label
.set_text
(
"This color combination can work, but only at large text sizes."
);
self
.head_label
.set_text
(
&
gettext
(
"Not bad"
)
)
;
self
.comment_label
.set_text
(
&
gettext
(
"This color combination can work, but only at large text sizes."
)
)
;
}
else
if
4.5
<=
contrast_level
&&
contrast_level
<
7.0
{
self
.head_label
.set_text
(
"Pretty good"
);
self
.comment_label
.set_text
(
"This color combination should work ok in most cases."
);
self
.head_label
.set_text
(
&
gettext
(
"Pretty good"
)
)
;
self
.comment_label
.set_text
(
&
gettext
(
"This color combination should work ok in most cases."
)
)
;
}
else
if
7.0
<=
contrast_level
&&
contrast_level
<=
21.0
{
self
.head_label
.set_text
(
"Awesome"
);
self
.comment_label
.set_text
(
"This color combination has great contrast."
);
self
.head_label
.set_text
(
&
gettext
(
"Awesome"
)
)
;
self
.comment_label
.set_text
(
&
gettext
(
"This color combination has great contrast."
)
)
;
}
}
}
src/window.rs
View file @
f86014cc
...
...
@@ -4,8 +4,8 @@ use crate::config::{APP_ID, PROFILE};
use
crate
::
contrast_level
::
ContrastLevelBar
;
use
crate
::
contrast_preview
::
ContrastPreview
;
use
crate
::
libhandy
::
HeaderBarExt
;
use
crate
::
window_state
::
WindowState
;
use
gettextrs
::
gettext
;
use
glib
::
ObjectExt
;
use
gtk
::
prelude
::{
BoxExt
,
BuilderExtManual
,
ButtonExt
,
ContainerExt
,
EditableSignals
,
MenuButtonExt
,
StyleContextExt
,
WidgetExt
};
use
gtk
::
Inhibit
;
...
...
@@ -33,8 +33,8 @@ impl Window {
let
headerbar
:
libhandy
::
HeaderBar
=
builder
.get_object
(
"headerbar"
)
.unwrap
();
let
appmenu_button
:
gtk
::
MenuButton
=
builder
.get_object
(
"appmenu_button"
)
.unwrap
();
let
bg_entry
=
ColourEntry
::
new
(
"Background Colour"
.to_string
(
));
let
fg_entry
=
ColourEntry
::
new
(
"Foreground Colour"
.to_string
(
));
let
bg_entry
=
ColourEntry
::
new
(
gettext
(
"Background Colour"
));
let
fg_entry
=
ColourEntry
::
new
(
gettext
(
"Foreground Colour"
));
let
reverse_btn
=
gtk
::
Button
::
new
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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