summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Zesch <stevezesch2@gmail.com>2012-11-21 06:49:13 -0800
committerSteve Zesch <stevezesch2@gmail.com>2012-11-21 06:49:13 -0800
commit7abcfff070982c49c554749d28706f58c7fde948 (patch)
treef8c558a001b3c4e72eb919fbcbf12988e8ba9744
parent4f762cdecf92c6391b27930456e40a703ea880f8 (diff)
parent3ba2c5e4fada787852a0b7db4722b578fa297aa8 (diff)
downloadcaja-7abcfff070982c49c554749d28706f58c7fde948.tar.bz2
caja-7abcfff070982c49c554749d28706f58c7fde948.tar.xz
Merge pull request #51 from jasmineaura/develop
[eel-background] fix gradient support of color-drops (#49)
-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);