Skip to content

Commit

Permalink
player widget: use concrete type in structs
Browse files Browse the repository at this point in the history
  • Loading branch information
jwahlstrand committed May 26, 2024
1 parent 1d0a994 commit 4dc755b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "GtkObservables"
uuid = "8710efd8-4ad6-11eb-33ea-2d5ceb25a41c"
version = "2.1.0"
version = "2.1.1"

[deps]
Cairo = "159f3aea-2a34-519c-b102-8c37f9878175"
Expand Down
7 changes: 2 additions & 5 deletions src/extrawidgets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct PlayerWithTextbox
range::UnitRange{Int} # valid values for index
direction::Observable{Int8} # +1 = forward, -1 = backward, 0 = not playing
# GUI elements
frame::GtkFrame
frame::GtkFrameLeaf
scale::Slider{Int}
entry::Textbox
play_back::Button
Expand All @@ -55,9 +55,6 @@ function PlayerWithTextbox(builder, index::Observable{Int}, range::UnitRange{Int
step_forward = button(; widget=builder["step_forward$id"]::Gtk4.GtkButton)
play_forward = button(; widget=builder["play_forward$id"]::Gtk4.GtkButton)

# Fix up widget properties
set_gtk_property!(scale.widget, "round-digits", 0) # glade/gtkbuilder bug that I have to set this here?

# Link the buttons
clampindex(i) = clamp(i, minimum(range), maximum(range))
preserved = Any[on(play_back; weak=true) do _ direction[] = -1 end,
Expand Down Expand Up @@ -130,7 +127,7 @@ Base.unsafe_convert(::Type{Ptr{Gtk4.GLib.GObject}}, p::PlayerWithTextbox) =

struct TimeWidget{T <: Dates.TimeType} <: InputWidget{T}
observable::Observable{T}
widget::GtkFrame
widget::GtkFrameLeaf
end

"""
Expand Down
4 changes: 2 additions & 2 deletions src/player.ui
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<property name="spacing">1</property>
<child>
<object class="GtkScale" id="index_scale1">
<property name="round-digits">6</property>
<property name="round-digits">0</property>
</object>
</child>
<child>
Expand Down Expand Up @@ -68,7 +68,7 @@
<property name="spacing">1</property>
<child>
<object class="GtkScale" id="index_scale2">
<property name="round-digits">6</property>
<property name="round-digits">0</property>
</object>
</child>
<child>
Expand Down

0 comments on commit 4dc755b

Please sign in to comment.