[gnome-panel/gtk3] panel: Fix changing background color having side-effect on opacity



commit 1def05b1b87adf59769d5758f3f1a672b402ad01
Author: Vincent Untz <vuntz gnome org>
Date:   Mon Jan 31 15:25:40 2011 +0100

    panel: Fix changing background color having side-effect on opacity
    
    We were just losing the opacity setting. When the color or the opacity
    is changed, base the new RGBA setting on the old setting so we don't
    lose the previous state.

 gnome-panel/panel-properties-dialog.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/gnome-panel/panel-properties-dialog.c b/gnome-panel/panel-properties-dialog.c
index 7d4ff56..8133d1d 100644
--- a/gnome-panel/panel-properties-dialog.c
+++ b/gnome-panel/panel-properties-dialog.c
@@ -316,11 +316,15 @@ static void
 panel_properties_dialog_color_changed (PanelPropertiesDialog *dialog,
 				       GtkColorButton        *color_button)
 {
+	GdkRGBA previous_color;
 	GdkRGBA color;
 
 	g_assert (dialog->color_button == GTK_WIDGET (color_button));
 
 	gtk_color_button_get_rgba (color_button, &color);
+	panel_profile_get_background_color (dialog->toplevel, &previous_color);
+	color.alpha = previous_color.alpha;
+
 	panel_profile_set_background_color (dialog->toplevel, &color);
 }
 
@@ -413,8 +417,9 @@ panel_properties_dialog_opacity_changed (PanelPropertiesDialog *dialog)
 	else if (percentage <= 2)
 		percentage = 0;
 
-        gtk_color_button_get_rgba (GTK_COLOR_BUTTON (dialog->color_button), &color);
-	color.alpha = (percentage / 100);
+	panel_profile_get_background_color (dialog->toplevel, &color);
+	color.alpha = (percentage / 100.);
+
 	panel_profile_set_background_color (dialog->toplevel, &color);
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]