-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
42188ab
commit 4614609
Showing
1 changed file
with
28 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env -S vala workbench.vala --pkg gtk4 --pkg libadwaita-1 | ||
|
||
public void main() { | ||
Gtk.init(); | ||
|
||
var box_menu_parent = | ||
workbench.builder.get_object("box_menu_parent") as Gtk.Box; | ||
var label_emoji = | ||
workbench.builder.get_object("label_emoji") as Gtk.Label; | ||
var gesture_click = | ||
workbench.builder.get_object("gesture_click") as Gtk.GestureClick; | ||
var popover_menu = | ||
workbench.builder.get_object("popover_menu") as Gtk.PopoverMenu; | ||
|
||
gesture_click.pressed.connect((_gesture, _n_press, x, y) => { | ||
var position = Gdk.Rectangle() { x = (int)x, y = (int)y }; | ||
popover_menu.set_pointing_to(position); | ||
popover_menu.popup(); | ||
}); | ||
|
||
var mood_group = new SimpleActionGroup(); | ||
box_menu_parent.insert_action_group("mood", mood_group); | ||
|
||
var emoji_action = new SimpleAction("emoji", new GLib.VariantType("s")); | ||
|
||
emoji_action.activate.connect((_action, parameter) => { label_emoji.label = parameter.get_string(); }); | ||
mood_group.add_action(emoji_action); | ||
} |