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
86aa9043
Commit
86aa9043
authored
3 years ago
by
Bilal Elmoussaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make PaginatorWidget implement Buildable
This allow us to simplify the changes on the UI part
parent
609731d6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
52 deletions
+78
-52
window.ui
data/resources/ui/window.ui
+50
-1
image.rs
src/widgets/pages/image.rs
+7
-7
paginator.rs
src/widgets/paginator.rs
+18
-2
window.rs
src/widgets/window.rs
+3
-42
No files found.
data/resources/ui/window.ui
View file @
86aa9043
...
...
@@ -4,7 +4,56 @@
<property
name=
"default-width"
>
960
</property>
<property
name=
"default-height"
>
720
</property>
<property
name=
"content"
>
<object
class=
"PaginatorWidget"
id=
"paginator"
/>
<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>
<property
name=
"body"
translatable=
"yes"
>
Press the Super key to see open windows and apps.
</property>
</object>
</child>
<child>
<object
class=
"ImagePageWidget"
>
<property
name=
"resource-uri"
>
/org/gnome/Tour/search.svg
</property>
<property
name=
"head"
translatable=
"yes"
>
Just Type to Search
</property>
<property
name=
"body"
translatable=
"yes"
>
Type in the overview to search. Launch apps, find things.
</property>
</object>
</child>
<child>
<object
class=
"ImagePageWidget"
>
<property
name=
"resource-uri"
>
/org/gnome/Tour/workspaces.svg
</property>
<property
name=
"head"
translatable=
"yes"
>
Keep on Top with Workspaces
</property>
<property
name=
"body"
translatable=
"yes"
>
Easily organize windows with the workspaces view.
</property>
</object>
</child>
<child>
<object
class=
"ImagePageWidget"
>
<property
name=
"resource-uri"
>
/org/gnome/Tour/blank.svg
</property>
<property
name=
"head"
translatable=
"yes"
>
Up/Down for the Overview
</property>
<property
name=
"body"
translatable=
"yes"
>
On a touchpad, use three-finger vertical swipes. Try it!
</property>
</object>
</child>
<child>
<object
class=
"ImagePageWidget"
>
<property
name=
"resource-uri"
>
/org/gnome/Tour/blank.svg
</property>
<property
name=
"head"
translatable=
"yes"
>
Left/Right for Workspaces
</property>
<property
name=
"body"
translatable=
"yes"
>
On a touchpad, use three-finger horizontal swipes. Try it!
</property>
</object>
</child>
<child>
<object
class=
"ImagePageWidget"
>
<property
name=
"resource-uri"
>
/org/gnome/Tour/ready-to-go.svg
</property>
<property
name=
"head"
translatable=
"yes"
>
That's it. Have a nice day!
</property>
<property
name=
"body"
translatable=
"yes"
>
To get more advice and tips, see the Help app.
</property>
<style>
<class
name=
"last-page"
/>
</style>
</object>
</child>
</object>
</property>
</template>
</interface>
This diff is collapsed.
Click to expand it.
src/widgets/pages/image.rs
View file @
86aa9043
...
...
@@ -32,6 +32,11 @@ mod imp {
layout_manager
.set_orientation
(
gtk
::
Orientation
::
Vertical
);
obj
.add_css_class
(
"page"
);
obj
.set_hexpand
(
true
);
obj
.set_vexpand
(
true
);
obj
.set_halign
(
gtk
::
Align
::
Fill
);
obj
.set_valign
(
gtk
::
Align
::
Fill
);
let
container
=
gtk
::
Box
::
builder
()
.orientation
(
gtk
::
Orientation
::
Vertical
)
.spacing
(
12
)
...
...
@@ -146,16 +151,11 @@ glib::wrapper! {
impl
ImagePageWidget
{
pub
fn
new
(
resource_uri
:
&
str
,
head
:
String
,
body
:
String
)
->
Self
{
let
image_page
=
glib
::
Object
::
new
::
<
Self
>
(
&
[
(
"hexpand"
,
&
true
),
(
"vexpand"
,
&
true
),
(
"halign"
,
&
gtk
::
Align
::
Fill
),
(
"valign"
,
&
gtk
::
Align
::
Fill
),
glib
::
Object
::
new
::
<
Self
>
(
&
[
(
"resource-uri"
,
&
resource_uri
),
(
"head"
,
&
head
),
(
"body"
,
&
body
),
])
.unwrap
();
image_page
.unwrap
()
}
}
This diff is collapsed.
Click to expand it.
src/widgets/paginator.rs
View file @
86aa9043
...
...
@@ -45,6 +45,7 @@ mod imp {
const
NAME
:
&
'static
str
=
"PaginatorWidget"
;
type
ParentType
=
gtk
::
Box
;
type
Type
=
super
::
PaginatorWidget
;
type
Interfaces
=
(
gtk
::
Buildable
,);
fn
class_init
(
klass
:
&
mut
Self
::
Class
)
{
Self
::
bind_template
(
klass
);
...
...
@@ -73,12 +74,27 @@ mod imp {
}
impl
WidgetImpl
for
PaginatorWidget
{}
impl
BoxImpl
for
PaginatorWidget
{}
impl
BuildableImpl
for
PaginatorWidget
{
fn
add_child
(
&
self
,
buildable
:
&
Self
::
Type
,
builder
:
&
gtk
::
Builder
,
child
:
&
glib
::
Object
,
type_
:
Option
<&
str
>
,
)
{
if
!
self
.carousel
.is_bound
()
{
self
.parent_add_child
(
buildable
,
builder
,
child
,
type_
);
}
else
{
buildable
.add_page
(
child
.clone
()
.downcast
::
<
gtk
::
Widget
>
()
.unwrap
());
}
}
}
}
glib
::
wrapper!
{
pub
struct
PaginatorWidget
(
ObjectSubclass
<
imp
::
PaginatorWidget
>
)
@
extends
gtk
::
Widget
,
gtk
::
Box
;
@
extends
gtk
::
Widget
,
gtk
::
Box
,
@
implements
gtk
::
Buildable
;
}
impl
PaginatorWidget
{
...
...
This diff is collapsed.
Click to expand it.
src/widgets/window.rs
View file @
86aa9043
use
adw
::
prelude
::
*
;
use
gettextrs
::
gettext
;
use
gtk
::
subclass
::
prelude
::
*
;
use
gtk
::{
gio
,
glib
};
use
super
::
pages
::{
ImagePageWidget
,
WelcomePageWidget
};
use
super
::
paginator
::
PaginatorWidget
;
use
crate
::
Application
;
mod
imp
{
use
super
::
*
;
use
crate
::
config
;
use
crate
::
widgets
::
pages
::{
ImagePageWidget
,
WelcomePageWidget
};
use
adw
::
subclass
::
prelude
::
*
;
#[derive(Debug,
Default,
gtk
::
CompositeTemplate)]
...
...
@@ -26,6 +25,8 @@ mod imp {
type
ParentType
=
adw
::
ApplicationWindow
;
fn
class_init
(
klass
:
&
mut
Self
::
Class
)
{
WelcomePageWidget
::
static_type
();
ImagePageWidget
::
static_type
();
Self
::
bind_template
(
klass
);
}
...
...
@@ -42,46 +43,6 @@ mod imp {
if
config
::
PROFILE
==
"Devel"
{
widget
.add_css_class
(
"devel"
);
}
self
.paginator
.add_page
(
WelcomePageWidget
::
new
());
self
.paginator
.add_page
(
ImagePageWidget
::
new
(
"/org/gnome/Tour/overview.svg"
,
gettext
(
"Get an Overview"
),
gettext
(
"Press the Super key to see open windows and apps."
),
));
self
.paginator
.add_page
(
ImagePageWidget
::
new
(
"/org/gnome/Tour/search.svg"
,
gettext
(
"Just Type to Search"
),
gettext
(
"Type in the overview to search. Launch apps, find things."
),
));
self
.paginator
.add_page
(
ImagePageWidget
::
new
(
"/org/gnome/Tour/workspaces.svg"
,
gettext
(
"Keep on Top with Workspaces"
),
gettext
(
"Easily organize windows with the workspaces view."
),
));
self
.paginator
.add_page
(
ImagePageWidget
::
new
(
"/org/gnome/Tour/blank.svg"
,
gettext
(
"Up/Down for the Overview"
),
gettext
(
"On a touchpad, use three-finger vertical swipes. Try it!"
),
));
self
.paginator
.add_page
(
ImagePageWidget
::
new
(
"/org/gnome/Tour/blank.svg"
,
gettext
(
"Left/Right for Workspaces"
),
gettext
(
"On a touchpad, use three-finger horizontal swipes. Try it!"
),
));
let
last_page
=
ImagePageWidget
::
new
(
"/org/gnome/Tour/ready-to-go.svg"
,
gettext
(
"That's it. Have a nice day!"
),
gettext
(
"To get more advice and tips, see the Help app."
),
);
last_page
.add_css_class
(
"last-page"
);
self
.paginator
.add_page
(
last_page
);
self
.parent_constructed
(
widget
);
}
}
...
...
This diff is collapsed.
Click to expand it.
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