-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In the newer versions of GTK v4, new dialogs were introduced and the old ones were deprecated, including GtkDialog and GtkMessageDialog. There isn't much difference in user-facing behavior, but since the old ones were deprecated it's less likely bugs will be fixed. This PR migrates to the new dialogs and cleans up our API a little. I left the file dialogs alone after looking in the C code and realizing that the new dialogs are based on GtkFileChooserNative, like the old code.
- Loading branch information
1 parent
836be5e
commit 3f03536
Showing
20 changed files
with
1,070 additions
and
538 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,6 @@ jobs: | |
fail-fast: false | ||
matrix: | ||
julia-version: | ||
- "1.6" | ||
- "1" | ||
#- "nightly" | ||
os: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,47 @@ | ||
GtkAdjustment(spinButton::GtkSpinButton) = G_.get_adjustment(spinButton) | ||
GtkAdjustment(range::GtkRange) = G_.get_adjustment(range) | ||
GtkAdjustment(scale::GtkScaleButton) = G_.get_adjustment(scale) | ||
@deprecate GtkAdjustment(spinButton::GtkSpinButton) adjustment(spinButton::GtkSpinButton) | ||
@deprecate GtkAdjustment(range::GtkRange) adjustment(range::GtkRange) | ||
@deprecate GtkAdjustment(scale::GtkScaleButton) adjustment(scale::GtkScaleButton) | ||
|
||
setindex!(buffer::GtkEntryBuffer, content::String, ::Type{String}) = | ||
G_.set_text(buffer, content, -1) | ||
|
||
## GtkDialog | ||
|
||
function push!(d::GtkDialog, s::AbstractString, response) | ||
G_.add_button(d, s, Int32(response)) | ||
d | ||
end | ||
|
||
function response(widget::GtkDialog, response_id) | ||
G_.response(widget, Int32(response_id)) | ||
end | ||
|
||
function GtkDialog(title::AbstractString, buttons, flags, parent = nothing; kwargs...) | ||
parent = (parent === nothing ? C_NULL : parent) | ||
w = GtkDialogLeaf(ccall((:gtk_dialog_new_with_buttons, libgtk4), Ptr{GObject}, | ||
(Ptr{UInt8}, Ptr{GObject}, Cint, Ptr{Nothing}), | ||
title, parent, flags, C_NULL)) | ||
GLib.setproperties!(w; kwargs...) | ||
for (k, v) in buttons | ||
push!(w, k, v) | ||
end | ||
w | ||
end | ||
|
||
function GtkMessageDialog(message::AbstractString, buttons, flags, typ, parent = nothing; kwargs...) | ||
parent = (parent === nothing ? C_NULL : parent) | ||
w = GtkMessageDialogLeaf(ccall((:gtk_message_dialog_new, libgtk4), Ptr{GObject}, | ||
(Ptr{GObject}, Cuint, Cint, Cint, Ptr{UInt8}), | ||
parent, flags, typ, ButtonsType_NONE, message)) | ||
GLib.setproperties!(w; kwargs...) | ||
for (k, v) in buttons | ||
push!(w, k, v) | ||
end | ||
w | ||
end | ||
|
||
warn_dialog(callback::Function, message::AbstractString, parent = nothing; timeout = -1) = info_dialog(callback, message, parent; timeout = -1) | ||
error_dialog(callback::Function, message::AbstractString, parent = nothing; timeout = -1) = info_dialog(callback, message, parent; timeout = -1) | ||
|
||
@deprecate warn_dialog info_dialog | ||
@deprecate error_dialog info_dialog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.