Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Podcasts
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
41
Issues
41
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
World
Podcasts
Commits
18602a6b
Verified
Commit
18602a6b
authored
Apr 16, 2018
by
Jordan Petridis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ShowWidget: Add a proggress_bar to indicate loading status of episode widgets
parent
9f841781
Pipeline
#9033
passed with stages
in 10 minutes and 48 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
6 deletions
+30
-6
show_widget.ui
hammond-gtk/resources/gtk/show_widget.ui
+13
-1
app.rs
hammond-gtk/src/app.rs
+2
-3
show.rs
hammond-gtk/src/stacks/show.rs
+0
-1
show.rs
hammond-gtk/src/widgets/show.rs
+15
-1
No files found.
hammond-gtk/resources/gtk/show_widget.ui
View file @
18602a6b
...
...
@@ -34,6 +34,18 @@ Tobias Bernard
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"orientation"
>
vertical
</property>
<child>
<object
class=
"GtkProgressBar"
id=
"progress_bar"
>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"no_show_all"
>
True
</property>
</object>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"pack_type"
>
end
</property>
<property
name=
"position"
>
0
</property>
</packing>
</child>
<child>
<object
class=
"GtkScrolledWindow"
id=
"scrolled_window"
>
<property
name=
"name"
>
scrolled_window
</property>
...
...
@@ -277,7 +289,7 @@ Tobias Bernard
<packing>
<property
name=
"expand"
>
True
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"position"
>
0
</property>
<property
name=
"position"
>
2
</property>
</packing>
</child>
</object>
...
...
hammond-gtk/src/app.rs
View file @
18602a6b
...
...
@@ -151,7 +151,6 @@ impl App {
WindowGeometry
::
from_settings
(
&
self
.settings
)
.apply
(
&
self
.window
);
let
window
=
self
.window
.clone
();
self
.app_instance
.connect_startup
(
move
|
app
|
{
build_ui
(
&
window
,
app
);
});
...
...
@@ -175,8 +174,8 @@ impl App {
content
.get_shows
()
.replace_widget
(
pd
.clone
())
.map_err
(|
err
|
error!
(
"
Failed to update ShowWidget
: {}"
,
err
))
.map_err
(|
_
|
error!
(
"Failed
ot update ShowWidget
{}"
,
pd
.title
()))
.map_err
(|
err
|
error!
(
"
Error
: {}"
,
err
))
.map_err
(|
_
|
error!
(
"Failed
to update ShowWidget of
{}"
,
pd
.title
()))
.ok
();
}
Ok
(
Action
::
ShowWidgetAnimated
)
=>
content
.get_shows
()
.switch_widget_animated
(),
...
...
hammond-gtk/src/stacks/show.rs
View file @
18602a6b
...
...
@@ -69,7 +69,6 @@ impl ShowStack {
.downcast
::
<
gtk
::
Box
>
()
.map_err
(|
_
|
format_err!
(
"Failed to downcast stack child to a Box."
))
?
;
debug!
(
"Name: {:?}"
,
WidgetExt
::
get_name
(
&
old
));
let
scrolled_window
=
old
.get_children
()
.first
()
.ok_or_else
(||
format_err!
(
"Box container has no childs."
))
?
...
...
hammond-gtk/src/widgets/show.rs
View file @
18602a6b
...
...
@@ -29,6 +29,7 @@ pub struct ShowWidget {
settings
:
gtk
::
MenuButton
,
unsub
:
gtk
::
Button
,
episodes
:
gtk
::
ListBox
,
progress_bar
:
gtk
::
ProgressBar
,
}
impl
Default
for
ShowWidget
{
...
...
@@ -43,6 +44,7 @@ impl Default for ShowWidget {
let
unsub
:
gtk
::
Button
=
builder
.get_object
(
"unsub_button"
)
.unwrap
();
let
link
:
gtk
::
Button
=
builder
.get_object
(
"link_button"
)
.unwrap
();
let
settings
:
gtk
::
MenuButton
=
builder
.get_object
(
"settings_button"
)
.unwrap
();
let
progress_bar
=
builder
.get_object
(
"progress_bar"
)
.unwrap
();
ShowWidget
{
container
,
...
...
@@ -53,6 +55,7 @@ impl Default for ShowWidget {
link
,
settings
,
episodes
,
progress_bar
,
}
}
}
...
...
@@ -147,6 +150,7 @@ impl ShowWidget {
}
let
list
=
self
.episodes
.clone
();
let
bar
=
self
.progress_bar
.clone
();
gtk
::
idle_add
(
move
||
{
let
episodes
=
match
receiver
.try_recv
()
{
Ok
(
e
)
=>
e
,
...
...
@@ -154,7 +158,16 @@ impl ShowWidget {
Err
(
Disconnected
)
=>
return
glib
::
Continue
(
false
),
};
let
constructor
=
clone!
(
sender
=>
move
|
ep
|
{
let
mut
done
=
0
;
let
constructor
=
clone!
(
sender
,
bar
=>
move
|
ep
|
{
done
+=
1
;
if
done
>=
count
{
bar
.hide
()
}
let
fraction
=
done
as
f64
/
count
as
f64
;
bar
.set_fraction
(
fraction
);
EpisodeWidget
::
new
(
ep
,
sender
.clone
())
.container
});
...
...
@@ -164,6 +177,7 @@ impl ShowWidget {
.ok
();
});
bar
.show
();
lazy_load
(
episodes
,
list
.clone
(),
constructor
,
callback
);
glib
::
Continue
(
false
)
...
...
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