aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c96
1 files changed, 70 insertions, 26 deletions
diff --git a/src/main.c b/src/main.c
index 70343d2..2119aea 100644
--- a/src/main.c
+++ b/src/main.c
@@ -52,32 +52,76 @@ on_shortcuts_action(GSimpleAction *action,
GtkApplication *app = GTK_APPLICATION(user_data);
GtkWindow *win = gtk_application_get_active_window(app);
- AdwShortcutsDialog *dialog = ADW_SHORTCUTS_DIALOG(
- adw_shortcuts_dialog_new());
-
- /* ── Stream section ─── */
- AdwShortcutsSection *stream_sec = adw_shortcuts_section_new(_("Stream"));
- adw_shortcuts_section_add(stream_sec,
- adw_shortcuts_item_new(_("Start / Stop streaming"), "<Alt>1"));
- adw_shortcuts_dialog_add(dialog, stream_sec);
-
- /* ── Record section ─── */
- AdwShortcutsSection *record_sec = adw_shortcuts_section_new(_("Record"));
- adw_shortcuts_section_add(record_sec,
- adw_shortcuts_item_new(_("Start / Stop recording"), "<Alt>1"));
- adw_shortcuts_section_add(record_sec,
- adw_shortcuts_item_new(_("Pause / Unpause recording"), "<Alt>2"));
- adw_shortcuts_dialog_add(dialog, record_sec);
-
- /* ── Replay section ─── */
- AdwShortcutsSection *replay_sec = adw_shortcuts_section_new(_("Replay"));
- adw_shortcuts_section_add(replay_sec,
- adw_shortcuts_item_new(_("Start / Stop replay"), "<Alt>1"));
- adw_shortcuts_section_add(replay_sec,
- adw_shortcuts_item_new(_("Save replay"), "<Alt>2"));
- adw_shortcuts_dialog_add(dialog, replay_sec);
-
- adw_dialog_present(ADW_DIALOG(dialog), GTK_WIDGET(win));
+ GtkShortcutsWindow *dialog = GTK_SHORTCUTS_WINDOW(
+ g_object_new(GTK_TYPE_SHORTCUTS_WINDOW,
+ "transient-for", win,
+ "modal", TRUE, NULL));
+
+ GtkShortcutsSection *section = GTK_SHORTCUTS_SECTION(
+ g_object_new(GTK_TYPE_SHORTCUTS_SECTION,
+ "visible", TRUE, NULL));
+
+ /* ── Stream group ─── */
+ GtkShortcutsGroup *stream = GTK_SHORTCUTS_GROUP(
+ g_object_new(GTK_TYPE_SHORTCUTS_GROUP,
+ "title", _("Stream"),
+ "visible", TRUE, NULL));
+
+ GtkShortcutsShortcut *stream1 = GTK_SHORTCUTS_SHORTCUT(
+ g_object_new(GTK_TYPE_SHORTCUTS_SHORTCUT,
+ "title", _("Start / Stop streaming"),
+ "accelerator", "<Alt>1",
+ "visible", TRUE, NULL));
+ gtk_shortcuts_group_add_shortcut(stream, stream1);
+
+ gtk_shortcuts_section_add_group(section, stream);
+
+ /* ── Record group ─── */
+ GtkShortcutsGroup *record = GTK_SHORTCUTS_GROUP(
+ g_object_new(GTK_TYPE_SHORTCUTS_GROUP,
+ "title", _("Record"),
+ "visible", TRUE, NULL));
+
+ GtkShortcutsShortcut *record1 = GTK_SHORTCUTS_SHORTCUT(
+ g_object_new(GTK_TYPE_SHORTCUTS_SHORTCUT,
+ "title", _("Start / Stop recording"),
+ "accelerator", "<Alt>1",
+ "visible", TRUE, NULL));
+ gtk_shortcuts_group_add_shortcut(record, record1);
+
+ GtkShortcutsShortcut *record2 = GTK_SHORTCUTS_SHORTCUT(
+ g_object_new(GTK_TYPE_SHORTCUTS_SHORTCUT,
+ "title", _("Pause / Unpause recording"),
+ "accelerator", "<Alt>2",
+ "visible", TRUE, NULL));
+ gtk_shortcuts_group_add_shortcut(record, record2);
+
+ gtk_shortcuts_section_add_group(section, record);
+
+ /* ── Replay group ─── */
+ GtkShortcutsGroup *replay = GTK_SHORTCUTS_GROUP(
+ g_object_new(GTK_TYPE_SHORTCUTS_GROUP,
+ "title", _("Replay"),
+ "visible", TRUE, NULL));
+
+ GtkShortcutsShortcut *replay1 = GTK_SHORTCUTS_SHORTCUT(
+ g_object_new(GTK_TYPE_SHORTCUTS_SHORTCUT,
+ "title", _("Start / Stop replay"),
+ "accelerator", "<Alt>1",
+ "visible", TRUE, NULL));
+ gtk_shortcuts_group_add_shortcut(replay, replay1);
+
+ GtkShortcutsShortcut *replay2 = GTK_SHORTCUTS_SHORTCUT(
+ g_object_new(GTK_TYPE_SHORTCUTS_SHORTCUT,
+ "title", _("Save replay"),
+ "accelerator", "<Alt>2",
+ "visible", TRUE, NULL));
+ gtk_shortcuts_group_add_shortcut(replay, replay2);
+
+ gtk_shortcuts_section_add_group(section, replay);
+
+ gtk_shortcuts_window_add_section(dialog, section);
+ gtk_window_present(GTK_WINDOW(dialog));
}
/* ── Open containing folder (from "Recording saved" notification) ──── */