From 0e5b4c34960f3481d1e2e74a73f0f876bf49e354 Mon Sep 17 00:00:00 2001 From: Corey Berla Date: Mon, 24 Apr 2023 08:36:13 -0700 Subject: [PATCH] general: Use GtkSwitch active property consistently app-chooser sets the state instead of active property. Similar to d7af60161d30c885ebab69c58b346896f1565387, we really meant to set active (whether the switch is toggled) and not the state (i.e. the color of the switch). Use gtk_switch_set_active() In properties we've already fixed this, but there's a lingering call to gtk_switch_get_state(). This is probably fine because state is in sync with active when the default handler is used, but let's get :active, to be consistent and safe. --- src/nautilus-app-chooser.c | 2 +- src/nautilus-properties-window.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nautilus-app-chooser.c b/src/nautilus-app-chooser.c index 579ba1e1bc..9e4e1dcebb 100644 --- a/src/nautilus-app-chooser.c +++ b/src/nautilus-app-chooser.c @@ -105,7 +105,7 @@ on_application_selected (GtkAppChooserWidget *widget, default_app = g_app_info_get_default_for_type (self->content_type, FALSE); is_default = default_app != NULL && g_app_info_equal (info, default_app); - gtk_switch_set_state (GTK_SWITCH (self->set_as_default_switch), is_default); + gtk_switch_set_active (GTK_SWITCH (self->set_as_default_switch), is_default); gtk_widget_set_sensitive (GTK_WIDGET (self->set_as_default_switch), !is_default); } diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c index 98fae514c8..529abfa1cb 100644 --- a/src/nautilus-properties-window.c +++ b/src/nautilus-properties-window.c @@ -2961,7 +2961,7 @@ execution_bit_changed (NautilusPropertiesWindow *self, const FilterType filter_type = FILES_ONLY; /* if activated from switch, switch state is already toggled, thus invert value via XOR. */ - gboolean active = gtk_switch_get_state (self->execution_switch) ^ GTK_IS_SWITCH (widget); + gboolean active = gtk_switch_get_active (self->execution_switch) ^ GTK_IS_SWITCH (widget); gboolean set_executable = !active; update_permissions (self, -- GitLab