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
f35f9618
Commit
f35f9618
authored
Feb 25, 2023
by
Bilal Elmoussaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move more actions to window
parent
3b28bd39
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
40 deletions
+24
-40
paginator.ui
data/resources/ui/paginator.ui
+3
-3
application.rs
src/application.rs
+2
-32
paginator.rs
src/widgets/paginator.rs
+1
-1
window.rs
src/widgets/window.rs
+18
-4
No files found.
data/resources/ui/paginator.ui
View file @
f35f9618
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
<property
name=
"icon-name"
>
left-large-symbolic
</property>
<property
name=
"icon-name"
>
left-large-symbolic
</property>
<property
name=
"halign"
>
start
</property>
<property
name=
"halign"
>
start
</property>
<property
name=
"valign"
>
center
</property>
<property
name=
"valign"
>
center
</property>
<property
name=
"action-name"
>
app
.previous-page
</property>
<property
name=
"action-name"
>
win
.previous-page
</property>
<property
name=
"tooltip-text"
translatable=
"yes"
>
Previous
</property>
<property
name=
"tooltip-text"
translatable=
"yes"
>
Previous
</property>
<style>
<style>
<class
name=
"circular"
/>
<class
name=
"circular"
/>
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
<property
name=
"icon-name"
>
right-large-symbolic
</property>
<property
name=
"icon-name"
>
right-large-symbolic
</property>
<property
name=
"halign"
>
end
</property>
<property
name=
"halign"
>
end
</property>
<property
name=
"valign"
>
center
</property>
<property
name=
"valign"
>
center
</property>
<property
name=
"action-name"
>
app
.next-page
</property>
<property
name=
"action-name"
>
win
.next-page
</property>
<property
name=
"tooltip-text"
translatable=
"yes"
>
Next
</property>
<property
name=
"tooltip-text"
translatable=
"yes"
>
Next
</property>
<style>
<style>
<class
name=
"circular"
/>
<class
name=
"circular"
/>
...
@@ -49,7 +49,7 @@
...
@@ -49,7 +49,7 @@
<property
name=
"icon-name"
>
right-large-symbolic
</property>
<property
name=
"icon-name"
>
right-large-symbolic
</property>
<property
name=
"halign"
>
end
</property>
<property
name=
"halign"
>
end
</property>
<property
name=
"valign"
>
center
</property>
<property
name=
"valign"
>
center
</property>
<property
name=
"action-name"
>
app
.start-tour
</property>
<property
name=
"action-name"
>
win
.start-tour
</property>
<property
name=
"tooltip-text"
translatable=
"yes"
>
Start
</property>
<property
name=
"tooltip-text"
translatable=
"yes"
>
Start
</property>
<style>
<style>
<class
name=
"suggested-action"
/>
<class
name=
"suggested-action"
/>
...
...
src/application.rs
View file @
f35f9618
...
@@ -39,36 +39,10 @@ mod imp {
...
@@ -39,36 +39,10 @@ mod imp {
let
quit
=
gio
::
ActionEntry
::
builder
(
"quit"
)
let
quit
=
gio
::
ActionEntry
::
builder
(
"quit"
)
.activate
(
move
|
app
:
&
Self
::
Type
,
_
,
_
|
app
.quit
())
.activate
(
move
|
app
:
&
Self
::
Type
,
_
,
_
|
app
.quit
())
.build
();
.build
();
// Start Tour
application
.add_action_entries
([
quit
]);
let
start_tour
=
gio
::
ActionEntry
::
builder
(
"start-tour"
)
.activate
(
move
|
app
:
&
Self
::
Type
,
_
,
_
|
app
.window
()
.start_tour
())
.build
();
// Skip Tour
let
skip_tour
=
gio
::
ActionEntry
::
builder
(
"skip-tour"
)
.activate
(
move
|
app
:
&
Self
::
Type
,
_
,
_
|
app
.quit
())
.build
();
// Next page
let
next_page
=
gio
::
ActionEntry
::
builder
(
"next-page"
)
.activate
(
move
|
app
:
&
Self
::
Type
,
_
,
_
|
{
let
window
=
app
.window
();
if
window
.paginator
()
.try_next
()
.is_none
()
{
window
.close
();
}
})
.build
();
// Previous page
let
previous_page
=
gio
::
ActionEntry
::
builder
(
"previous-page"
)
.activate
(
move
|
app
:
&
Self
::
Type
,
_
,
_
|
{
let
window
=
app
.window
();
if
window
.paginator
()
.try_previous
()
.is_none
()
{
window
.reset_tour
();
}
})
.build
();
application
.add_action_entries
([
quit
,
start_tour
,
skip_tour
,
next_page
,
previous_page
]);
application
.set_accels_for_action
(
"app.quit"
,
&
[
"<Control>q"
]);
application
.set_accels_for_action
(
"app.quit"
,
&
[
"<Control>q"
]);
application
.set_accels_for_action
(
"
app
.skip-tour"
,
&
[
"Escape"
]);
application
.set_accels_for_action
(
"
win
.skip-tour"
,
&
[
"Escape"
]);
}
}
}
}
impl
GtkApplicationImpl
for
Application
{}
impl
GtkApplicationImpl
for
Application
{}
...
@@ -82,10 +56,6 @@ glib::wrapper! {
...
@@ -82,10 +56,6 @@ glib::wrapper! {
}
}
impl
Application
{
impl
Application
{
fn
window
(
&
self
)
->
Window
{
self
.imp
()
.window
.get
()
.and_then
(|
w
|
w
.upgrade
())
.unwrap
()
}
pub
fn
run
()
->
glib
::
ExitCode
{
pub
fn
run
()
->
glib
::
ExitCode
{
log
::
info!
(
"GNOME Tour ({})"
,
config
::
APP_ID
);
log
::
info!
(
"GNOME Tour ({})"
,
config
::
APP_ID
);
log
::
info!
(
"Version: {} ({})"
,
config
::
VERSION
,
config
::
PROFILE
);
log
::
info!
(
"Version: {} ({})"
,
config
::
VERSION
,
config
::
PROFILE
);
...
...
src/widgets/paginator.rs
View file @
f35f9618
...
@@ -110,7 +110,7 @@ impl PaginatorWidget {
...
@@ -110,7 +110,7 @@ impl PaginatorWidget {
Some
(())
Some
(())
}
}
pub
fn
add_page
(
&
self
,
page
:
impl
IsA
<
gtk
::
Widget
>
)
{
fn
add_page
(
&
self
,
page
:
impl
IsA
<
gtk
::
Widget
>
)
{
let
imp
=
self
.imp
();
let
imp
=
self
.imp
();
let
page_nr
=
imp
.pages
.borrow
()
.len
();
let
page_nr
=
imp
.pages
.borrow
()
.len
();
imp
.carousel
.insert
(
&
page
,
page_nr
as
i32
);
imp
.carousel
.insert
(
&
page
,
page_nr
as
i32
);
...
...
src/widgets/window.rs
View file @
f35f9618
...
@@ -29,6 +29,24 @@ mod imp {
...
@@ -29,6 +29,24 @@ mod imp {
fn
class_init
(
klass
:
&
mut
Self
::
Class
)
{
fn
class_init
(
klass
:
&
mut
Self
::
Class
)
{
klass
.bind_template
();
klass
.bind_template
();
// Start Tour
klass
.install_action
(
"win.start-tour"
,
None
,
|
win
,
_
,
_
|
win
.start_tour
());
// Skip Tour
klass
.install_action
(
"win.skip-tour"
,
None
,
|
win
,
_
,
_
|
{
win
.application
()
.unwrap
()
.quit
();
});
// Next page
klass
.install_action
(
"win.next-page"
,
None
,
|
win
,
_
,
_
|
{
if
win
.imp
()
.paginator
.try_next
()
.is_none
()
{
win
.close
();
}
});
// Previous page
klass
.install_action
(
"win.previous-page"
,
None
,
|
win
,
_
,
_
|
{
if
win
.imp
()
.paginator
.try_previous
()
.is_none
()
{
win
.reset_tour
();
}
});
}
}
fn
instance_init
(
obj
:
&
glib
::
subclass
::
InitializingObject
<
Self
>
)
{
fn
instance_init
(
obj
:
&
glib
::
subclass
::
InitializingObject
<
Self
>
)
{
...
@@ -74,10 +92,6 @@ impl Window {
...
@@ -74,10 +92,6 @@ impl Window {
glib
::
Object
::
builder
()
.property
(
"application"
,
app
)
.build
()
glib
::
Object
::
builder
()
.property
(
"application"
,
app
)
.build
()
}
}
pub
fn
paginator
(
&
self
)
->
PaginatorWidget
{
self
.imp
()
.paginator
.clone
()
}
pub
fn
start_tour
(
&
self
)
{
pub
fn
start_tour
(
&
self
)
{
self
.imp
()
.paginator
.set_page
(
1
);
self
.imp
()
.paginator
.set_page
(
1
);
}
}
...
...
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