From f608c40f5b8256aea281804369760a1eb2696be2 Mon Sep 17 00:00:00 2001 From: zhu yaliang Date: Thu, 28 Dec 2023 10:00:31 +0800 Subject: Update opacity when changed gsettings color value --- mate-panel/panel-properties-dialog.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/mate-panel/panel-properties-dialog.c b/mate-panel/panel-properties-dialog.c index b37cc778..24642a91 100644 --- a/mate-panel/panel-properties-dialog.c +++ b/mate-panel/panel-properties-dialog.c @@ -736,6 +736,21 @@ panel_properties_dialog_update_background_image (PanelPropertiesDialog *dialog, g_free (old_text); } +static void +panel_properties_dialog_update_opacity (PanelPropertiesDialog *dialog, + gdouble percentage) +{ + gboolean slider_active; + + slider_active = gdk_screen_is_composited (gdk_screen_get_default ()); + + if (!slider_active) { + percentage = 100.0; + } + + gtk_range_set_value (GTK_RANGE (dialog->opacity_scale), percentage); +} + static void panel_properties_dialog_background_notify (GSettings *settings, gchar *key, @@ -750,6 +765,8 @@ panel_properties_dialog_background_notify (GSettings *settings, { char *color = g_settings_get_string (settings, key); panel_properties_dialog_update_background_color (dialog, color); + gdouble percentage = panel_profile_get_background_opacity (dialog->toplevel); + panel_properties_dialog_update_opacity (dialog, percentage); g_free (color); } else if (!strcmp (key, "image")) -- cgit v1.2.1