1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-12-12 15:47:35 +00:00

application: disable dial action when making calls isn't possible

Fixes: https://source.puri.sm/Librem5/calls/-/issues/109
This commit is contained in:
Julian Sparber 2021-01-20 16:58:42 +01:00 committed by Evangelos Ribeiro Tzaras
parent 4ebea1a27c
commit dc0242eda5

View file

@ -281,6 +281,15 @@ copy_number (GSimpleAction *action,
g_debug ("Copied `%s' to clipboard", number);
}
static void
manager_state_changed_cb (GApplication *application)
{
GAction* dial_action = g_action_map_lookup_action (G_ACTION_MAP (application), "dial");
CallsManagerState state = calls_manager_get_state (calls_manager_get_default ());
g_simple_action_set_enabled (G_SIMPLE_ACTION (dial_action), state == CALLS_MANAGER_STATE_READY);
}
static const GActionEntry actions[] =
{
{ "set-provider-name", set_provider_name_action, "s" },
@ -317,6 +326,13 @@ startup (GApplication *application)
G_N_ELEMENTS (actions),
application);
g_signal_connect_swapped (calls_manager_get_default (),
"notify::state",
G_CALLBACK (manager_state_changed_cb),
application);
manager_state_changed_cb (application);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_resource (provider, "/sm/puri/calls/style.css");
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),