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
faa5f3c9
Commit
faa5f3c9
authored
Aug 07, 2020
by
Bilal Elmoussaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove uncessary title prop
parent
298f0bfa
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
59 deletions
+39
-59
image.rs
src/widgets/pages/image.rs
+2
-14
mod.rs
src/widgets/pages/mod.rs
+0
-2
page.rs
src/widgets/pages/page.rs
+0
-4
welcome.rs
src/widgets/pages/welcome.rs
+1
-16
paginator.rs
src/widgets/paginator.rs
+4
-5
window.rs
src/widgets/window.rs
+32
-18
No files found.
src/widgets/pages/image.rs
View file @
faa5f3c9
use
super
::
page
::
Pageable
;
use
gtk
::
prelude
::
*
;
pub
struct
ImagePageWidget
{
pub
widget
:
gtk
::
Box
,
pub
title
:
String
,
}
impl
Pageable
for
ImagePageWidget
{
fn
get_widget
(
&
self
)
->
gtk
::
Widget
{
self
.widget
.clone
()
.upcast
::
<
gtk
::
Widget
>
()
}
fn
get_title
(
&
self
)
->
String
{
self
.title
.clone
()
}
}
impl
ImagePageWidget
{
pub
fn
new
(
resource_uri
:
&
str
,
title
:
String
,
head
:
String
,
body
:
String
)
->
Self
{
pub
fn
new
(
resource_uri
:
&
str
,
head
:
String
,
body
:
String
)
->
Self
{
let
widget
=
gtk
::
Box
::
new
(
gtk
::
Orientation
::
Vertical
,
0
);
let
image_page
=
Self
{
widget
,
title
};
let
image_page
=
Self
{
widget
};
image_page
.init
(
resource_uri
,
head
,
body
);
image_page
...
...
src/widgets/pages/mod.rs
View file @
faa5f3c9
mod
image
;
mod
page
;
mod
welcome
;
pub
use
image
::
ImagePageWidget
;
pub
use
page
::
Pageable
;
pub
use
welcome
::
WelcomePageWidget
;
src/widgets/pages/page.rs
deleted
100644 → 0
View file @
298f0bfa
pub
trait
Pageable
{
fn
get_widget
(
&
self
)
->
gtk
::
Widget
;
fn
get_title
(
&
self
)
->
String
;
}
src/widgets/pages/welcome.rs
View file @
faa5f3c9
use
super
::
page
::
Pageable
;
use
gettextrs
::
gettext
;
use
gtk
::
prelude
::
*
;
pub
struct
WelcomePageWidget
{
pub
widget
:
gtk
::
Box
,
pub
title
:
String
,
}
impl
Pageable
for
WelcomePageWidget
{
fn
get_widget
(
&
self
)
->
gtk
::
Widget
{
self
.widget
.clone
()
.upcast
::
<
gtk
::
Widget
>
()
}
fn
get_title
(
&
self
)
->
String
{
self
.title
.clone
()
}
}
impl
WelcomePageWidget
{
pub
fn
new
()
->
Self
{
let
widget
=
gtk
::
Box
::
new
(
gtk
::
Orientation
::
Vertical
,
0
);
let
welcome_page
=
Self
{
widget
,
title
:
gettext
(
"Welcome Tour"
),
};
let
welcome_page
=
Self
{
widget
};
welcome_page
.init
();
welcome_page
...
...
src/widgets/paginator.rs
View file @
faa5f3c9
...
...
@@ -5,7 +5,6 @@ use gtk::prelude::*;
use
std
::
cell
::
RefCell
;
use
std
::
rc
::
Rc
;
use
super
::
pages
::
Pageable
;
use
libhandy
::
prelude
::{
CarouselExt
,
CarouselIndicatorDotsExt
,
HeaderBarExt
};
pub
struct
PaginatorWidget
{
...
...
@@ -13,7 +12,7 @@ pub struct PaginatorWidget {
carousel
:
libhandy
::
Carousel
,
carousel_dots
:
libhandy
::
CarouselIndicatorDots
,
headerbar
:
libhandy
::
HeaderBar
,
pages
:
RefCell
<
Vec
<
Box
<
dyn
Pageable
>
>>
,
pages
:
RefCell
<
Vec
<
gtk
::
Widget
>>
,
current_page
:
RefCell
<
u32
>
,
next_btn
:
gtk
::
Button
,
close_btn
:
gtk
::
Button
,
...
...
@@ -57,9 +56,9 @@ impl PaginatorWidget {
Ok
(())
}
pub
fn
add_page
(
&
self
,
page
:
Box
<
dyn
Pageable
>
)
{
pub
fn
add_page
(
&
self
,
page
:
gtk
::
Widget
)
{
let
page_nr
=
self
.pages
.borrow
()
.len
();
self
.carousel
.insert
(
&
page
.get_widget
()
,
page_nr
as
i32
);
self
.carousel
.insert
(
&
page
,
page_nr
as
i32
);
self
.pages
.borrow_mut
()
.push
(
page
);
self
.update_position
();
...
...
@@ -135,7 +134,7 @@ impl PaginatorWidget {
if
page_nr
<
self
.carousel
.get_n_pages
()
{
let
pages
=
&
self
.pages
.borrow
();
let
page
=
pages
.get
(
page_nr
as
usize
)
.unwrap
();
self
.carousel
.scroll_to
(
&
page
.get_widget
()
);
self
.carousel
.scroll_to
(
page
);
}
}
}
src/widgets/window.rs
View file @
faa5f3c9
...
...
@@ -42,52 +42,66 @@ impl Window {
if
PROFILE
==
"Devel"
{
self
.widget
.get_style_context
()
.add_class
(
"devel"
);
}
self
.paginator
.borrow_mut
()
.add_page
(
Box
::
new
(
WelcomePageWidget
::
new
()
));
self
.paginator
.borrow_mut
()
.add_page
(
WelcomePageWidget
::
new
()
.widget.upcast
::
<
gtk
::
Widget
>
(
));
self
.paginator
.borrow_mut
()
.add_page
(
Box
::
new
(
ImagePageWidget
::
new
(
self
.paginator
.borrow_mut
()
.add_page
(
ImagePageWidget
::
new
(
"/org/gnome/Tour/activities.svg"
,
gettext
(
"Activities Overview"
),
gettext
(
"Open Activities to launch apps"
),
gettext
(
"The activities view can also be used to switch windows and search."
),
)));
)
.widget
.upcast
::
<
gtk
::
Widget
>
(),
);
self
.paginator
.borrow_mut
()
.add_page
(
Box
::
new
(
ImagePageWidget
::
new
(
self
.paginator
.borrow_mut
()
.add_page
(
ImagePageWidget
::
new
(
"/org/gnome/Tour/search.svg"
,
gettext
(
"Search"
),
gettext
(
"Just type to search"
),
gettext
(
"In the activities view, just start typing to search for apps, settings and more."
),
)));
)
.widget
.upcast
::
<
gtk
::
Widget
>
(),
);
self
.paginator
.borrow_mut
()
.add_page
(
Box
::
new
(
ImagePageWidget
::
new
(
self
.paginator
.borrow_mut
()
.add_page
(
ImagePageWidget
::
new
(
"/org/gnome/Tour/calendar.svg"
,
gettext
(
"Date & Time"
),
gettext
(
"Click the time to see notifications"
),
gettext
(
"The notifications popover also includes personal planning tools."
),
)));
)
.widget
.upcast
::
<
gtk
::
Widget
>
(),
);
self
.paginator
.borrow_mut
()
.add_page
(
Box
::
new
(
ImagePageWidget
::
new
(
self
.paginator
.borrow_mut
()
.add_page
(
ImagePageWidget
::
new
(
"/org/gnome/Tour/status-menu.svg"
,
gettext
(
"System Menu"
),
gettext
(
"View system information and settings"
),
gettext
(
"Get an overview of the system status and quickly change settings."
),
)));
)
.widget
.upcast
::
<
gtk
::
Widget
>
(),
);
self
.paginator
.borrow_mut
()
.add_page
(
Box
::
new
(
ImagePageWidget
::
new
(
self
.paginator
.borrow_mut
()
.add_page
(
ImagePageWidget
::
new
(
"/org/gnome/Tour/software.svg"
,
gettext
(
"Software"
),
gettext
(
"Use Software to find and install apps"
),
gettext
(
"Discover great apps through search, browsing and our recommendations."
),
)));
)
.widget
.upcast
::
<
gtk
::
Widget
>
(),
);
let
name
=
glib
::
get_os_info
(
"NAME"
)
.unwrap_or_else
(||
"GNOME"
.into
());
let
last_page
=
ImagePageWidget
::
new
(
"/org/gnome/Tour/ready-to-go.svg"
,
gettext
(
"Tour Completed"
),
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"
);
self
.paginator
.borrow_mut
()
.add_page
(
Box
::
new
(
last_page
));
self
.paginator
.borrow_mut
()
.add_page
(
last_page
.widget.upcast
::
<
gtk
::
Widget
>
(
));
self
.widget
.add
(
&
self
.paginator
.borrow
()
.widget
);
}
...
...
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