diff options
author | Jasmine Hassan <jasmine.aura@gmail.com> | 2012-11-21 12:55:15 +0200 |
---|---|---|
committer | Jasmine Hassan <jasmine.aura@gmail.com> | 2012-11-21 12:55:15 +0200 |
commit | 3ba2c5e4fada787852a0b7db4722b578fa297aa8 (patch) | |
tree | f8c558a001b3c4e72eb919fbcbf12988e8ba9744 /eel | |
parent | 55f7b8caf97f3eb0da4dcc1a36e4c0ba0ed200d2 (diff) | |
download | caja-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.c | 22 |
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 (>k_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); |