Skip to content

Commit

Permalink
Add set-controls-visible and set-playlist-visible GActions
Browse files Browse the repository at this point in the history
  • Loading branch information
gnome-mpv committed Nov 3, 2024
1 parent 3f2aef9 commit 5a700b3
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/celluloid-controller-actions.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,17 @@ toggle_controls_handler( GSimpleAction *action,
GVariant *param,
gpointer data );

static void
set_controls_visible_handler( GSimpleAction *action,
GVariant *param,
gpointer data );

static void
toggle_playlist_handler(GSimpleAction *action, GVariant *param, gpointer data);

static void
set_playlist_visible_handler(GSimpleAction *action, GVariant *param, gpointer data);

static void
save_playlist_handler(GSimpleAction *action, GVariant *param, gpointer data);

Expand Down Expand Up @@ -370,6 +378,16 @@ toggle_controls_handler(GSimpleAction *action, GVariant *param, gpointer data)
celluloid_view_set_controls_visible(view, !visible);
}

static void
set_controls_visible_handler(GSimpleAction *action, GVariant *param, gpointer data)
{
CelluloidView *view = celluloid_controller_get_view(data);
gboolean visible = TRUE;

g_variant_get(param, "b", &visible);
celluloid_view_set_controls_visible(view, visible);
}

static void
toggle_playlist_handler(GSimpleAction *action, GVariant *param, gpointer data)
{
Expand All @@ -379,6 +397,16 @@ toggle_playlist_handler(GSimpleAction *action, GVariant *param, gpointer data)
celluloid_view_set_playlist_visible(view, !visible);
}

static void
set_playlist_visible_handler(GSimpleAction *action, GVariant *param, gpointer data)
{
CelluloidView *view = celluloid_controller_get_view(data);
gboolean visible = FALSE;

g_variant_get(param, "b", &visible);
celluloid_view_set_playlist_visible(view, visible);
}

static void
save_playlist_handler(GSimpleAction *action, GVariant *param, gpointer data)
{
Expand Down Expand Up @@ -585,8 +613,16 @@ celluloid_controller_action_register_actions(CelluloidController *controller)
.activate = show_shortcuts_dialog_handler},
{.name = "toggle-controls",
.activate = toggle_controls_handler},
{.name = "set-controls-visible",
.state = "true",
.parameter_type = "b",
.change_state = set_controls_visible_handler},
{.name = "toggle-playlist",
.activate = toggle_playlist_handler},
{.name = "set-playlist-visible",
.state = "false",
.parameter_type = "b",
.change_state = set_playlist_visible_handler},
{.name = "save-playlist",
.activate = save_playlist_handler},
{.name = "search-playlist",
Expand Down

0 comments on commit 5a700b3

Please sign in to comment.