-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Leo <[email protected]> Co-authored-by: Ryan Kornheisl <[email protected]>
- Loading branch information
1 parent
0125900
commit 47c02f8
Showing
7 changed files
with
393 additions
and
4 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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* SPDX-License-Identifier: GPL-3.0 | ||
* SPDX-FileCopyrightText: 2023 elementary, Inc. (https://elementary.io) | ||
*/ | ||
|
||
public class Dock.PoofPopover : Gtk.Popover { | ||
private Gtk.Adjustment vadjustment; | ||
private int poof_frames; | ||
|
||
construct { | ||
var texture = Gdk.Texture.from_resource ("/io/elementary/dock/poof.svg"); | ||
|
||
var poof_size = texture.width; | ||
poof_frames = (int) Math.floor (texture.height / poof_size); | ||
|
||
var picture = new Gtk.Picture.for_paintable (texture) { | ||
width_request = poof_size, | ||
height_request = poof_size * poof_frames, | ||
keep_aspect_ratio = true | ||
}; | ||
|
||
var scrolled_window = new Gtk.ScrolledWindow () { | ||
hexpand = true, | ||
vexpand = true, | ||
child = picture, | ||
vscrollbar_policy = EXTERNAL | ||
}; | ||
|
||
vadjustment = scrolled_window.get_vadjustment (); | ||
|
||
height_request = poof_size; | ||
width_request = poof_size; | ||
has_arrow = false; | ||
remove_css_class ("background"); | ||
child = scrolled_window; | ||
} | ||
|
||
public void start_animation () { | ||
var frame = 0; | ||
Timeout.add (30, () => { | ||
var adjustment_step = (int) vadjustment.get_upper () / poof_frames; | ||
vadjustment.value = vadjustment.value + adjustment_step; | ||
if (frame < poof_frames) { | ||
frame++; | ||
return Source.CONTINUE; | ||
} else { | ||
popdown (); | ||
Idle.add (() => { | ||
unparent (); | ||
return Source.REMOVE; | ||
}); | ||
return Source.REMOVE; | ||
} | ||
}); | ||
} | ||
} |
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