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
9f3dc653
Commit
9f3dc653
authored
Jan 26, 2022
by
Bilal Elmoussaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop the custom WelcomePage
It is nowadays similar to the ImagePageWidget, so let us just use that
parent
a849b33d
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
20 additions
and
100 deletions
+20
-100
window.ui
data/resources/ui/window.ui
+0
-3
image_page.rs
src/widgets/image_page.rs
+0
-0
mod.rs
src/widgets/mod.rs
+3
-2
mod.rs
src/widgets/pages/mod.rs
+0
-5
welcome.rs
src/widgets/pages/welcome.rs
+0
-85
paginator.rs
src/widgets/paginator.rs
+16
-3
window.rs
src/widgets/window.rs
+1
-2
No files found.
data/resources/ui/window.ui
View file @
9f3dc653
...
...
@@ -6,9 +6,6 @@
<property
name=
"content"
>
<object
class=
"PaginatorWidget"
id=
"paginator"
>
<child>
<object
class=
"WelcomePageWidget"
/>
</child>
<child>
<object
class=
"ImagePageWidget"
>
<property
name=
"resource-uri"
>
/org/gnome/Tour/overview.svg
</property>
<property
name=
"head"
translatable=
"yes"
>
Get an Overview
</property>
...
...
src/widgets/
pages/im
age.rs
→
src/widgets/
image_p
age.rs
View file @
9f3dc653
File moved
src/widgets/mod.rs
View file @
9f3dc653
mod
pages
;
mod
image_page
;
mod
paginator
;
mod
window
;
mod
window
;
pub
use
image_page
::
ImagePageWidget
;
pub
use
window
::
Window
;
src/widgets/pages/mod.rs
deleted
100644 → 0
View file @
a849b33d
mod
image
;
mod
welcome
;
pub
use
image
::
ImagePageWidget
;
pub
use
welcome
::
WelcomePageWidget
;
src/widgets/pages/welcome.rs
deleted
100644 → 0
View file @
a849b33d
use
crate
::
utils
::
i18n_f
;
use
gettextrs
::
gettext
;
use
gtk
::
glib
;
use
gtk
::
prelude
::
*
;
use
gtk
::
subclass
::
prelude
::
*
;
mod
imp
{
use
super
::
*
;
#[derive(Default,
Debug)]
pub
struct
WelcomePageWidget
{}
#[glib
::
object_subclass]
impl
ObjectSubclass
for
WelcomePageWidget
{
const
NAME
:
&
'static
str
=
"WelcomePageWidget"
;
type
ParentType
=
gtk
::
Box
;
type
Type
=
super
::
WelcomePageWidget
;
}
impl
ObjectImpl
for
WelcomePageWidget
{
fn
constructed
(
&
self
,
widget
:
&
Self
::
Type
)
{
let
layout_manager
=
widget
.layout_manager
()
.map
(|
l
|
l
.downcast
::
<
gtk
::
BoxLayout
>
()
.unwrap
())
.unwrap
();
layout_manager
.set_orientation
(
gtk
::
Orientation
::
Vertical
);
let
container
=
gtk
::
Box
::
builder
()
.orientation
(
gtk
::
Orientation
::
Vertical
)
.spacing
(
0
)
.hexpand
(
true
)
.vexpand
(
true
)
.valign
(
gtk
::
Align
::
Center
)
.halign
(
gtk
::
Align
::
Center
)
.margin_top
(
24
)
.margin_bottom
(
24
)
.build
();
widget
.add_css_class
(
"page"
);
widget
.add_css_class
(
"welcome-page"
);
let
clamp
=
adw
::
Clamp
::
new
();
clamp
.set_child
(
Some
(
&
container
));
let
logo
=
gtk
::
Picture
::
builder
()
.can_shrink
(
false
)
.keep_aspect_ratio
(
true
)
.build
();
logo
.set_resource
(
Some
(
"/org/gnome/Tour/welcome.svg"
));
container
.append
(
&
logo
);
let
title
=
gtk
::
Label
::
new
(
Some
(
&
gettext
(
"Start the Tour"
)));
title
.set_margin_top
(
36
);
title
.add_css_class
(
"title-1"
);
container
.append
(
&
title
);
let
name
=
glib
::
os_info
(
"NAME"
)
.unwrap_or_else
(||
"GNOME"
.into
());
let
version
=
glib
::
os_info
(
"VERSION"
)
.unwrap_or_else
(||
""
.into
());
// Translators: The following string is formated as "Learn about new and essential features in GNOME 3.36" for example
let
text
=
gtk
::
Label
::
new
(
Some
(
&
i18n_f
(
"Learn about the key features in {} {}."
,
&
[
&
name
,
&
version
],
)));
text
.add_css_class
(
"body"
);
text
.set_margin_top
(
12
);
container
.append
(
&
text
);
widget
.append
(
&
clamp
);
self
.parent_constructed
(
widget
);
}
}
impl
WidgetImpl
for
WelcomePageWidget
{}
impl
BoxImpl
for
WelcomePageWidget
{}
}
glib
::
wrapper!
{
pub
struct
WelcomePageWidget
(
ObjectSubclass
<
imp
::
WelcomePageWidget
>
)
@
extends
gtk
::
Widget
,
gtk
::
Box
;
}
impl
WelcomePageWidget
{
#[allow(clippy
::
new_without_default)]
pub
fn
new
()
->
Self
{
glib
::
Object
::
new
(
&
[])
.unwrap
()
}
}
src/widgets/paginator.rs
View file @
9f3dc653
use
crate
::{
utils
::
i18n_f
,
widgets
::
ImagePageWidget
};
use
gettextrs
::
gettext
;
use
gtk
::
prelude
::
*
;
use
gtk
::{
gdk
,
...
...
@@ -70,6 +72,17 @@ mod imp {
obj
.update_position
();
}));
let
name
=
glib
::
os_info
(
"NAME"
)
.unwrap_or_else
(||
"GNOME"
.into
());
let
version
=
glib
::
os_info
(
"VERSION"
)
.unwrap_or_else
(||
""
.into
());
// Translators: The following string is formated as "Learn about new and essential features in GNOME 3.36" for example
let
body
=
i18n_f
(
"Learn about the key features in {} {}."
,
&
[
&
name
,
&
version
]);
let
welcome_page
=
ImagePageWidget
::
new
(
"/org/gnome/Tour/welcome.svg"
,
gettext
(
"Start the Tour"
),
body
,
);
obj
.add_page
(
Some
(
-
1
),
welcome_page
);
let
controller
=
gtk
::
EventControllerKey
::
new
();
controller
.connect_key_pressed
(
clone!
(
@
weak
obj
=>
@
default
-
return
gtk
::
Inhibit
(
true
),
move
|
_controller
,
keyval
,
_keycode
,
_state
|
{
if
keyval
==
gdk
::
Key
::
Right
{
...
...
@@ -98,7 +111,7 @@ mod imp {
if
!
self
.carousel
.is_bound
()
{
self
.parent_add_child
(
buildable
,
builder
,
child
,
type_
);
}
else
{
buildable
.add_page
(
child
.clone
()
.downcast
::
<
gtk
::
Widget
>
()
.unwrap
());
buildable
.add_page
(
None
,
child
.clone
()
.downcast
::
<
gtk
::
Widget
>
()
.unwrap
());
}
}
}
...
...
@@ -134,10 +147,10 @@ impl PaginatorWidget {
Some
(())
}
pub
fn
add_page
(
&
self
,
page
:
impl
IsA
<
gtk
::
Widget
>
)
{
pub
fn
add_page
(
&
self
,
at
:
Option
<
i32
>
,
page
:
impl
IsA
<
gtk
::
Widget
>
)
{
let
imp
=
self
.imp
();
let
page_nr
=
imp
.pages
.borrow
()
.len
();
imp
.carousel
.insert
(
&
page
,
page_nr
as
i32
);
imp
.carousel
.insert
(
&
page
,
at
.unwrap_or
(
page_nr
as
i32
)
);
imp
.pages
.borrow_mut
()
.push
(
page
.upcast
());
self
.update_position
();
...
...
src/widgets/window.rs
View file @
9f3dc653
...
...
@@ -8,7 +8,7 @@ use crate::Application;
mod
imp
{
use
super
::
*
;
use
crate
::
config
;
use
crate
::
widgets
::
pages
::{
ImagePageWidget
,
WelcomePageWidget
}
;
use
crate
::
widgets
::
ImagePageWidget
;
use
adw
::
subclass
::
prelude
::
*
;
#[derive(Debug,
Default,
gtk
::
CompositeTemplate)]
...
...
@@ -25,7 +25,6 @@ mod imp {
type
ParentType
=
adw
::
ApplicationWindow
;
fn
class_init
(
klass
:
&
mut
Self
::
Class
)
{
WelcomePageWidget
::
static_type
();
ImagePageWidget
::
static_type
();
Self
::
bind_template
(
klass
);
}
...
...
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