diff options
author | zhu yaliang <[email protected]> | 2023-12-28 10:00:31 +0800 |
---|---|---|
committer | Luke from DC <[email protected]> | 2024-01-06 23:43:18 +0000 |
commit | f608c40f5b8256aea281804369760a1eb2696be2 (patch) | |
tree | 5a32b31cb810a7589cf0c4a0fc877f1597140616 | |
parent | cb1a440f1f3f740bbaeb9577465c999c67f5c80a (diff) | |
download | mate-panel-f608c40f5b8256aea281804369760a1eb2696be2.tar.bz2 mate-panel-f608c40f5b8256aea281804369760a1eb2696be2.tar.xz |
Update opacity when changed gsettings color value
-rw-r--r-- | mate-panel/panel-properties-dialog.c | 17 |
1 files changed, 17 insertions, 0 deletions
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 @@ -737,6 +737,21 @@ panel_properties_dialog_update_background_image (PanelPropertiesDialog *dialog, } 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, PanelPropertiesDialog *dialog) @@ -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")) |