summaryrefslogtreecommitdiff
path: root/eel
diff options
context:
space:
mode:
authorJasmine Hassan <[email protected]>2012-11-21 12:55:15 +0200
committerJasmine Hassan <[email protected]>2012-11-21 12:55:15 +0200
commit3ba2c5e4fada787852a0b7db4722b578fa297aa8 (patch)
treef8c558a001b3c4e72eb919fbcbf12988e8ba9744 /eel
parent55f7b8caf97f3eb0da4dcc1a36e4c0ba0ed200d2 (diff)
downloadcaja-3ba2c5e4fada787852a0b7db4722b578fa297aa8.tar.bz2
caja-3ba2c5e4fada787852a0b7db4722b578fa297aa8.tar.xz
[eel-background] use GtkStyle's bg color when no custom one is set
this fixes #49 "Gradients-support of color-drops broken since 1.2"
Diffstat (limited to 'eel')
-rw-r--r--eel/eel-background.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/eel/eel-background.c b/eel/eel-background.c
index 80f0e90c..fba4f70d 100644
--- a/eel/eel-background.c
+++ b/eel/eel-background.c
@@ -1103,7 +1103,7 @@ eel_background_receive_dropped_color (EelBackground *background,
const GtkSelectionData *selection_data)
{
guint16 *channels;
- char *color_spec;
+ char *color_spec, *gradient_spec;
char *new_gradient_spec;
int left_border, right_border, top_border, bottom_border;
GtkAllocation allocation;
@@ -1134,21 +1134,32 @@ eel_background_receive_dropped_color (EelBackground *background,
right_border = allocation.width - 32;
top_border = 32;
bottom_border = allocation.height - 32;
+
+ /* If a custom background color isn't set, get the GtkStyle's bg color. */
+ if (!background->details->color)
+ {
+ gradient_spec = gdk_color_to_string (&gtk_widget_get_style (widget)->bg[GTK_STATE_NORMAL]);
+ }
+ else
+ {
+ gradient_spec = background->details->color;
+ }
+
if (drop_location_x < left_border && drop_location_x <= right_border)
{
- new_gradient_spec = eel_gradient_set_left_color_spec (background->details->color, color_spec);
+ new_gradient_spec = eel_gradient_set_left_color_spec (gradient_spec, color_spec);
}
else if (drop_location_x >= left_border && drop_location_x > right_border)
{
- new_gradient_spec = eel_gradient_set_right_color_spec (background->details->color, color_spec);
+ new_gradient_spec = eel_gradient_set_right_color_spec (gradient_spec, color_spec);
}
else if (drop_location_y < top_border && drop_location_y <= bottom_border)
{
- new_gradient_spec = eel_gradient_set_top_color_spec (background->details->color, color_spec);
+ new_gradient_spec = eel_gradient_set_top_color_spec (gradient_spec, color_spec);
}
else if (drop_location_y >= top_border && drop_location_y > bottom_border)
{
- new_gradient_spec = eel_gradient_set_bottom_color_spec (background->details->color, color_spec);
+ new_gradient_spec = eel_gradient_set_bottom_color_spec (gradient_spec, color_spec);
}
else
{
@@ -1156,6 +1167,7 @@ eel_background_receive_dropped_color (EelBackground *background,
}
g_free (color_spec);
+ g_free (gradient_spec);
eel_background_set_image_uri_and_color (background, action, NULL, new_gradient_spec);