summaryrefslogtreecommitdiff
path: root/libcaja-private
diff options
context:
space:
mode:
authorWolfgang Ulbrich <[email protected]>2016-01-13 15:15:35 +0100
committerWolfgang Ulbrich <[email protected]>2016-01-13 15:15:35 +0100
commit3b7b4cfa969402c5cc9e45369f552729f2b65308 (patch)
tree610589db57c82fb63f5984d28b3009eb2c0cbb5a /libcaja-private
parent3c5a4ef68906a73850fa2ffe403cfcd37dc31ff9 (diff)
parent1befe8ddf08c12b5c926d269b31d270fb94b9c3e (diff)
downloadcaja-3b7b4cfa969402c5cc9e45369f552729f2b65308.tar.bz2
caja-3b7b4cfa969402c5cc9e45369f552729f2b65308.tar.xz
Merge pull request #498 from mate-desktop/dev-GtkStyleContext
port to gtk_style_context and other fixes
Diffstat (limited to 'libcaja-private')
-rw-r--r--libcaja-private/caja-file-conflict-dialog.c28
-rw-r--r--libcaja-private/caja-icon-canvas-item.c399
-rw-r--r--libcaja-private/caja-icon-container.c170
-rw-r--r--libcaja-private/caja-icon-dnd.c35
-rw-r--r--libcaja-private/caja-icon-info.c8
-rw-r--r--libcaja-private/caja-icon-private.h4
-rw-r--r--libcaja-private/caja-tree-view-drag-dest.c19
7 files changed, 534 insertions, 129 deletions
diff --git a/libcaja-private/caja-file-conflict-dialog.c b/libcaja-private/caja-file-conflict-dialog.c
index cda3069b..300543b3 100644
--- a/libcaja-private/caja-file-conflict-dialog.c
+++ b/libcaja-private/caja-file-conflict-dialog.c
@@ -115,7 +115,11 @@ file_list_ready_cb (GList *files,
GdkPixbuf *pixbuf;
GtkWidget *label;
GString *str;
+#if GTK_CHECK_VERSION(3,0,0)
+ PangoAttrList *attr_list;
+#else
PangoFontDescription *desc;
+#endif
details = fcd->details;
@@ -216,15 +220,28 @@ file_list_ready_cb (GList *files,
label = gtk_label_new (primary_text);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_line_wrap_mode (GTK_LABEL (label), PANGO_WRAP_WORD_CHAR);
- gtk_widget_set_size_request (label, 350, -1);
-#if GTK_CHECK_VERSION (3, 14, 0)
+#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_box_pack_start (GTK_BOX (details->titles_vbox),
+ label, FALSE, FALSE, 0);
+ gtk_widget_show (label);
+
+ attr_list = pango_attr_list_new ();
+ pango_attr_list_insert (attr_list, pango_attr_weight_new (PANGO_WEIGHT_BOLD));
+ pango_attr_list_insert (attr_list, pango_attr_scale_new (PANGO_SCALE_LARGE));
+ g_object_set (label,
+ "attributes", attr_list,
+ NULL);
+
+ pango_attr_list_unref (attr_list);
#else
+ gtk_widget_set_size_request (label, 350, -1);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-#endif
gtk_box_pack_start (GTK_BOX (details->titles_vbox),
label, FALSE, FALSE, 0);
+
gtk_widget_modify_font (label, NULL);
+
desc = pango_font_description_new ();
pango_font_description_set_weight (desc, PANGO_WEIGHT_BOLD);
pango_font_description_set_size (desc,
@@ -232,13 +249,14 @@ file_list_ready_cb (GList *files,
gtk_widget_modify_font (label, desc);
pango_font_description_free (desc);
gtk_widget_show (label);
+#endif
label = gtk_label_new (secondary_text);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
- gtk_widget_set_size_request (label, 350, -1);
-#if GTK_CHECK_VERSION (3, 14, 0)
+#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (label, GTK_ALIGN_START);
#else
+ gtk_widget_set_size_request (label, 350, -1);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
#endif
gtk_box_pack_start (GTK_BOX (details->titles_vbox),
diff --git a/libcaja-private/caja-icon-canvas-item.c b/libcaja-private/caja-icon-canvas-item.c
index fe44b9b2..803cde76 100644
--- a/libcaja-private/caja-icon-canvas-item.c
+++ b/libcaja-private/caja-icon-canvas-item.c
@@ -224,17 +224,15 @@ static void draw_pixbuf (GdkPixbuf
static PangoLayout *get_label_layout (PangoLayout **layout,
CajaIconCanvasItem *item,
const char *text);
+#if !GTK_CHECK_VERSION(3,0,0)
static void draw_label_layout (CajaIconCanvasItem *item,
-#if GTK_CHECK_VERSION(3,0,0)
- cairo_t *cr,
-#else
GdkDrawable *drawable,
-#endif
PangoLayout *layout,
gboolean highlight,
GdkColor *label_color,
int x,
int y);
+#endif
static gboolean hit_test_stretch_handle (CajaIconCanvasItem *item,
EelIRect canvas_rect,
GtkCornerType *corner);
@@ -542,12 +540,19 @@ caja_icon_canvas_item_get_image (CajaIconCanvasItem *item,
double item_x, item_y;
gboolean is_rtl;
cairo_t *cr;
+#if GTK_CHECK_VERSION(3,0,0)
+ GtkStyleContext *context;
+#endif
g_return_val_if_fail (CAJA_IS_ICON_CANVAS_ITEM (item), NULL);
canvas = EEL_CANVAS_ITEM (item)->canvas;
#if GTK_CHECK_VERSION(3,0,0)
screen = gtk_widget_get_screen (GTK_WIDGET (canvas));
+ context = gtk_widget_get_style_context (GTK_WIDGET (canvas));
+
+ gtk_style_context_save (context);
+ gtk_style_context_add_class (context, "caja-canvas-item");
#else
screen = gdk_colormap_get_screen (colormap);
#endif
@@ -573,12 +578,9 @@ caja_icon_canvas_item_get_image (CajaIconCanvasItem *item,
width, height);
cr = cairo_create (surface);
- gdk_cairo_set_source_pixbuf (cr, item->details->pixbuf,
+
+ gtk_render_icon (context, cr, item->details->pixbuf,
item_offset_x, item_offset_y);
- cairo_rectangle (cr, item_offset_x, item_offset_y,
- gdk_pixbuf_get_width (item->details->pixbuf),
- gdk_pixbuf_get_height (item->details->pixbuf));
- cairo_fill (cr);
#else
pixmap = gdk_pixmap_new (gdk_screen_get_root_window (screen),
width, height,
@@ -622,6 +624,8 @@ caja_icon_canvas_item_get_image (CajaIconCanvasItem *item,
draw_label_text (item, cr, FALSE, icon_rect);
cairo_destroy (cr);
+ gtk_style_context_restore (context);
+
return surface;
#else
while (emblem_layout_next (&emblem_layout, &emblem_pixbuf, &emblem_rect, is_rtl))
@@ -993,7 +997,7 @@ in_single_click_mode (void)
return click_policy_auto_value == CAJA_CLICK_POLICY_SINGLE;
}
-
+#if !GTK_CHECK_VERSION(3,0,0)
/* Utility routine to create a rectangle with rounded corners.
* This could possibly move to Eel as a general purpose routine.
*/
@@ -1037,11 +1041,7 @@ make_round_rect (cairo_t *cr,
static void
draw_frame (CajaIconCanvasItem *item,
-#if GTK_CHECK_VERSION(3,0,0)
- cairo_t *cr,
-#else
GdkDrawable *drawable,
-#endif
guint color,
gboolean create_mask,
int x,
@@ -1049,11 +1049,7 @@ draw_frame (CajaIconCanvasItem *item,
int width,
int height)
{
-#if GTK_CHECK_VERSION(3,0,0)
- cairo_save (cr);
-#else
cairo_t *cr = gdk_cairo_create (drawable);
-#endif
/* Set the rounded rect clip region. Magic rounding value taken
* from old code.
@@ -1077,13 +1073,9 @@ draw_frame (CajaIconCanvasItem *item,
/* Paint into drawable now that we have set up the color and opacity */
cairo_fill (cr);
-#if GTK_CHECK_VERSION(3,0,0)
- cairo_restore (cr);
-#else
cairo_destroy (cr);
-#endif
}
-
+#endif
/* Keep these for a bit while we work on performance of draw_or_measure_label_text. */
/*
#define PERFORMANCE_TEST_DRAW_DISABLE
@@ -1384,9 +1376,185 @@ static void
draw_label_text (CajaIconCanvasItem *item,
#if GTK_CHECK_VERSION(3,0,0)
cairo_t *cr,
+ gboolean create_mask,
+ EelIRect icon_rect)
+{
+ CajaIconCanvasItemDetails *details;
+ CajaIconContainer *container;
+ PangoLayout *editable_layout;
+ PangoLayout *additional_layout;
+ GtkStyleContext *context;
+ GtkStateFlags state, base_state;
+ gboolean have_editable, have_additional;
+ gboolean needs_highlight, prelight_label, is_rtl_label_beside;
+ EelIRect text_rect;
+ int x;
+ int max_text_width;
+ gdouble frame_w, frame_h, frame_x, frame_y;
+ gboolean draw_frame = TRUE;
+
+#ifdef PERFORMANCE_TEST_DRAW_DISABLE
+ return;
+#endif
+
+ details = item->details;
+
+ measure_label_text (item);
+ if (details->text_height == 0 ||
+ details->text_width == 0)
+ {
+ return;
+ }
+
+ container = CAJA_ICON_CONTAINER (EEL_CANVAS_ITEM (item)->canvas);
+ context = gtk_widget_get_style_context (GTK_WIDGET (container));
+
+ text_rect = compute_text_rectangle (item, icon_rect, TRUE, BOUNDS_USAGE_FOR_DISPLAY);
+
+ needs_highlight = details->is_highlighted_for_selection || details->is_highlighted_for_drop;
+ is_rtl_label_beside = caja_icon_container_is_layout_rtl (container) &&
+ container->details->label_position == CAJA_ICON_LABEL_POSITION_BESIDE;
+
+ editable_layout = NULL;
+ additional_layout = NULL;
+
+ have_editable = details->editable_text != NULL && details->editable_text[0] != '\0';
+ have_additional = details->additional_text != NULL && details->additional_text[0] != '\0';
+ g_assert (have_editable || have_additional);
+
+ max_text_width = floor (caja_icon_canvas_item_get_max_text_width (item));
+
+ base_state = gtk_widget_get_state_flags (GTK_WIDGET (container));
+ base_state &= ~(GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_PRELIGHT);
+ state = base_state;
+
+ gtk_widget_style_get (GTK_WIDGET (container),
+ "activate_prelight_icon_label", &prelight_label,
+ NULL);
+
+ /* if the icon is highlighted, do some set-up */
+ if (needs_highlight &&
+ !details->is_renaming) {
+ state |= GTK_STATE_FLAG_SELECTED;
+
+ frame_x = is_rtl_label_beside ? text_rect.x0 + item->details->text_dx : text_rect.x0;
+ frame_y = text_rect.y0;
+ frame_w = is_rtl_label_beside ? text_rect.x1 - text_rect.x0 - item->details->text_dx : text_rect.x1 - text_rect.x0;
+ frame_h = text_rect.y1 - text_rect.y0;
+ } else if (!needs_highlight && have_editable &&
+ details->text_width > 0 && details->text_height > 0 &&
+ prelight_label && item->details->is_prelit) {
+ state |= GTK_STATE_FLAG_PRELIGHT;
+
+ frame_x = text_rect.x0;
+ frame_y = text_rect.y0;
+ frame_w = text_rect.x1 - text_rect.x0;
+ frame_h = text_rect.y1 - text_rect.y0;
+ } else {
+ draw_frame = FALSE;
+ }
+
+ if (draw_frame) {
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, state);
+
+ gtk_render_frame (context, cr,
+ frame_x, frame_y,
+ frame_w, frame_h);
+ gtk_render_background (context, cr,
+ frame_x, frame_y,
+ frame_w, frame_h);
+
+ gtk_style_context_restore (context);
+ }
+
+ if (container->details->label_position == CAJA_ICON_LABEL_POSITION_BESIDE)
+ {
+ x = text_rect.x0 + 2;
+ }
+ else
+ {
+ x = text_rect.x0 + ((text_rect.x1 - text_rect.x0) - max_text_width) / 2;
+ }
+
+ if (have_editable &&
+ !details->is_renaming)
+ {
+ state = base_state;
+
+ if (prelight_label && item->details->is_prelit) {
+ state |= GTK_STATE_FLAG_PRELIGHT;
+ }
+
+ if (needs_highlight) {
+ state |= GTK_STATE_FLAG_SELECTED;
+ }
+
+ editable_layout = get_label_layout (&item->details->editable_text_layout, item, item->details->editable_text);
+ prepare_pango_layout_for_draw (item, editable_layout);
+
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, state);
+
+ gtk_render_layout (context, cr,
+ x, text_rect.y0 + TEXT_BACK_PADDING_Y,
+ editable_layout);
+
+ gtk_style_context_restore (context);
+ }
+
+ if (have_additional &&
+ !details->is_renaming)
+ {
+ state = base_state;
+
+ if (needs_highlight) {
+ state |= GTK_STATE_FLAG_SELECTED;
+ }
+
+ additional_layout = get_label_layout (&item->details->additional_text_layout, item, item->details->additional_text);
+ prepare_pango_layout_for_draw (item, additional_layout);
+
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, state);
+ gtk_style_context_add_class (context, "dim-label");
+
+ gtk_render_layout (context, cr,
+ x, text_rect.y0 + details->editable_text_height + LABEL_LINE_SPACING + TEXT_BACK_PADDING_Y,
+ additional_layout);
+ }
+
+ if (!create_mask && item->details->is_highlighted_as_keyboard_focus)
+ {
+ if (needs_highlight) {
+ state = GTK_STATE_FLAG_SELECTED;
+ }
+
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, state);
+
+ gtk_render_focus (context,
+ cr,
+ text_rect.x0,
+ text_rect.y0,
+ text_rect.x1 - text_rect.x0,
+ text_rect.y1 - text_rect.y0);
+
+ gtk_style_context_restore (context);
+ }
+
+ if (editable_layout != NULL)
+ {
+ g_object_unref (editable_layout);
+ }
+
+ if (additional_layout != NULL)
+ {
+ g_object_unref (additional_layout);
+ }
+}
#else
GdkDrawable *drawable,
-#endif
gboolean create_mask,
EelIRect icon_rect)
{
@@ -1406,7 +1574,6 @@ draw_label_text (CajaIconCanvasItem *item,
return;
#endif
- canvas_item = EEL_CANVAS_ITEM (item);
details = item->details;
measure_label_text (item);
@@ -1417,6 +1584,7 @@ draw_label_text (CajaIconCanvasItem *item,
}
container = CAJA_ICON_CONTAINER (EEL_CANVAS_ITEM (item)->canvas);
+ canvas_item = EEL_CANVAS_ITEM (item);
text_rect = compute_text_rectangle (item, icon_rect, TRUE, BOUNDS_USAGE_FOR_DISPLAY);
@@ -1433,15 +1601,10 @@ draw_label_text (CajaIconCanvasItem *item,
max_text_width = floor (caja_icon_canvas_item_get_max_text_width (item));
- /* if the icon is highlighted, do some set-up */
if (needs_highlight && !details->is_renaming)
{
draw_frame (item,
-#if GTK_CHECK_VERSION(3,0,0)
- cr,
-#else
drawable,
-#endif
gtk_widget_has_focus (GTK_WIDGET (container)) ? container->details->highlight_color_rgba : container->details->active_color_rgba,
create_mask,
is_rtl_label_beside ? text_rect.x0 + item->details->text_dx : text_rect.x0,
@@ -1454,23 +1617,11 @@ draw_label_text (CajaIconCanvasItem *item,
details->is_highlighted_as_keyboard_focus))
{
/* clear the underlying icons, where the text or overlaps them. */
-#if GTK_CHECK_VERSION(3,0,0)
- cairo_save (cr);
- cairo_set_source_rgba (cr, 0, 0, 0, 0);
- cairo_rectangle (cr,
- text_rect.x0,
- text_rect.y0,
- text_rect.x1 - text_rect.x0,
- text_rect.y1 - text_rect.y0);
- cairo_fill (cr);
- cairo_restore (cr);
-#else
gdk_window_clear_area (gtk_layout_get_bin_window (&EEL_CANVAS (container)->layout),
text_rect.x0,
text_rect.y0,
text_rect.x1 - text_rect.x0,
text_rect.y1 - text_rect.y0);
-#endif
}
if (container->details->label_position == CAJA_ICON_LABEL_POSITION_BESIDE)
@@ -1496,11 +1647,7 @@ draw_label_text (CajaIconCanvasItem *item,
if (!(prelight_label && item->details->is_prelit))
{
draw_frame (item,
-#if GTK_CHECK_VERSION(3,0,0)
- cr,
-#else
drawable,
-#endif
container->details->normal_color_rgba,
create_mask,
text_rect.x0,
@@ -1511,11 +1658,7 @@ draw_label_text (CajaIconCanvasItem *item,
else
{
draw_frame (item,
-#if GTK_CHECK_VERSION(3,0,0)
- cr,
-#else
drawable,
-#endif
container->details->prelight_color_rgba,
create_mask,
text_rect.x0,
@@ -1531,11 +1674,7 @@ draw_label_text (CajaIconCanvasItem *item,
prelight_label & item->details->is_prelit);
draw_label_layout (item,
-#if GTK_CHECK_VERSION(3,0,0)
- cr,
-#else
drawable,
-#endif
editable_layout, needs_highlight,
label_color,
x,
@@ -1553,11 +1692,7 @@ draw_label_text (CajaIconCanvasItem *item,
FALSE);
draw_label_layout (item,
-#if GTK_CHECK_VERSION(3,0,0)
- cr,
-#else
drawable,
-#endif
additional_layout, needs_highlight,
label_color,
x,
@@ -1567,15 +1702,9 @@ draw_label_text (CajaIconCanvasItem *item,
if (!create_mask && item->details->is_highlighted_as_keyboard_focus)
{
gtk_paint_focus (gtk_widget_get_style (GTK_WIDGET (EEL_CANVAS_ITEM (item)->canvas)),
-#if GTK_CHECK_VERSION(3,0,0)
- cr,
-#else
drawable,
-#endif
needs_highlight ? GTK_STATE_SELECTED : GTK_STATE_NORMAL,
-#if !GTK_CHECK_VERSION(3,0,0)
NULL,
-#endif
GTK_WIDGET (EEL_CANVAS_ITEM (item)->canvas),
"icon-container",
text_rect.x0,
@@ -1594,6 +1723,7 @@ draw_label_text (CajaIconCanvasItem *item,
g_object_unref (additional_layout);
}
}
+#endif
void
caja_icon_canvas_item_set_is_visible (CajaIconCanvasItem *item,
@@ -1667,6 +1797,10 @@ draw_stretch_handles (CajaIconCanvasItem *item,
GdkPixbuf *knob_pixbuf;
int knob_width, knob_height;
double dash = { 2.0 };
+#if GTK_CHECK_VERSION(3,0,0)
+ GtkStyleContext *style;
+ GdkRGBA color;
+#endif
if (!item->details->show_stretch_handles)
{
@@ -1674,6 +1808,9 @@ draw_stretch_handles (CajaIconCanvasItem *item,
}
widget = GTK_WIDGET (EEL_CANVAS_ITEM (item)->canvas);
+#if GTK_CHECK_VERSION(3,0,0)
+ style = gtk_widget_get_style_context (widget);
+#endif
#if GTK_CHECK_VERSION(3,0,0)
cairo_save (cr);
@@ -1685,7 +1822,12 @@ draw_stretch_handles (CajaIconCanvasItem *item,
knob_height = gdk_pixbuf_get_height (knob_pixbuf);
/* first draw the box */
+#if GTK_CHECK_VERSION(3,0,0)
+ gtk_style_context_get_color (style, GTK_STATE_FLAG_SELECTED, &color);
+ gdk_cairo_set_source_rgba (cr, &color);
+#else
cairo_set_source_rgb (cr, 0, 0, 0);
+#endif
cairo_set_dash (cr, &dash, 1, 0);
cairo_set_line_width (cr, 1.0);
cairo_rectangle (cr,
@@ -1902,7 +2044,12 @@ real_map_pixbuf (CajaIconCanvasItem *icon_item)
CajaIconContainer *container;
GdkPixbuf *temp_pixbuf, *old_pixbuf, *audio_pixbuf;
int emblem_size;
+#if GTK_CHECK_VERSION(3,0,0)
+ GtkStyleContext *style;
+ GdkRGBA color;
+#else
guint render_mode, saturation, brightness, lighten;
+#endif
temp_pixbuf = icon_item->details->pixbuf;
canvas = EEL_CANVAS_ITEM(icon_item)->canvas;
@@ -1915,6 +2062,10 @@ real_map_pixbuf (CajaIconCanvasItem *icon_item)
{
old_pixbuf = temp_pixbuf;
+#if GTK_CHECK_VERSION(3,0,0)
+ temp_pixbuf = eel_create_spotlight_pixbuf (temp_pixbuf);
+ g_object_unref (old_pixbuf);
+#else
gtk_widget_style_get (GTK_WIDGET (container),
"prelight_icon_render_mode", &render_mode,
"prelight_icon_saturation", &saturation,
@@ -1932,8 +2083,7 @@ real_map_pixbuf (CajaIconCanvasItem *icon_item)
container->details->prelight_icon_color_rgba);
g_object_unref (old_pixbuf);
}
-
-
+#endif
/* FIXME bugzilla.gnome.org 42471: This hard-wired image is inappropriate to
* this level of code, which shouldn't know that the
@@ -1983,6 +2133,18 @@ real_map_pixbuf (CajaIconCanvasItem *icon_item)
if (icon_item->details->is_highlighted_for_selection
|| icon_item->details->is_highlighted_for_drop)
{
+#if GTK_CHECK_VERSION(3,0,0)
+ style = gtk_widget_get_style_context (GTK_WIDGET (canvas));
+
+ if (gtk_widget_has_focus (GTK_WIDGET (canvas))) {
+ gtk_style_context_get_background_color (style, GTK_STATE_FLAG_SELECTED, &color);
+ } else {
+ gtk_style_context_get_background_color (style, GTK_STATE_FLAG_ACTIVE, &color);
+ }
+
+ old_pixbuf = temp_pixbuf;
+ temp_pixbuf = eel_create_colorized_pixbuf (temp_pixbuf, &color);
+#else
guint color;
old_pixbuf = temp_pixbuf;
@@ -1993,10 +2155,12 @@ real_map_pixbuf (CajaIconCanvasItem *icon_item)
EEL_RGBA_COLOR_GET_R (color),
EEL_RGBA_COLOR_GET_G (color),
EEL_RGBA_COLOR_GET_B (color));
+#endif
g_object_unref (old_pixbuf);
}
+#if !GTK_CHECK_VERSION(3,0,0)
if (!icon_item->details->is_active
&& !icon_item->details->is_prelit
&& !icon_item->details->is_highlighted_for_selection
@@ -2022,6 +2186,7 @@ real_map_pixbuf (CajaIconCanvasItem *icon_item)
g_object_unref (old_pixbuf);
}
}
+#endif
return temp_pixbuf;
}
@@ -2067,6 +2232,10 @@ draw_embedded_text (CajaIconCanvasItem *item,
PangoLayout *layout;
PangoContext *context;
PangoFontDescription *desc;
+#if GTK_CHECK_VERSION(3,0,0)
+ GtkWidget *widget;
+ GtkStyleContext *style_context;
+#endif
if (item->details->embedded_text == NULL ||
item->details->embedded_text_rect.width == 0 ||
@@ -2075,13 +2244,21 @@ draw_embedded_text (CajaIconCanvasItem *item,
return;
}
+#if GTK_CHECK_VERSION(3,0,0)
+ widget = GTK_WIDGET (EEL_CANVAS_ITEM (item)->canvas);
+#endif
+
if (item->details->embedded_text_layout != NULL)
{
layout = g_object_ref (item->details->embedded_text_layout);
}
else
{
+#if GTK_CHECK_VERSION(3,0,0)
+ context = gtk_widget_get_pango_context (widget);
+#else
context = gtk_widget_get_pango_context (GTK_WIDGET (EEL_CANVAS_ITEM (item)->canvas));
+#endif
layout = pango_layout_new (context);
pango_layout_set_text (layout, item->details->embedded_text, -1);
@@ -2096,10 +2273,28 @@ draw_embedded_text (CajaIconCanvasItem *item,
}
#if GTK_CHECK_VERSION(3,0,0)
+ style_context = gtk_widget_get_style_context (widget);
+ gtk_style_context_save (style_context);
+ gtk_style_context_add_class (style_context, "icon-embedded-text");
+
cairo_save (cr);
+
+ cairo_rectangle (cr,
+ x + item->details->embedded_text_rect.x,
+ y + item->details->embedded_text_rect.y,
+ item->details->embedded_text_rect.width,
+ item->details->embedded_text_rect.height);
+ cairo_clip (cr);
+
+ gtk_render_layout (style_context, cr,
+ x + item->details->embedded_text_rect.x,
+ y + item->details->embedded_text_rect.y,
+ layout);
+
+ gtk_style_context_restore (style_context);
+ cairo_restore (cr);
#else
cairo_t *cr = gdk_cairo_create (drawable);
-#endif
cairo_rectangle (cr,
x + item->details->embedded_text_rect.x,
@@ -2114,9 +2309,6 @@ draw_embedded_text (CajaIconCanvasItem *item,
y + item->details->embedded_text_rect.y);
pango_cairo_show_layout (cr, layout);
-#if GTK_CHECK_VERSION(3,0,0)
- cairo_restore (cr);
-#else
cairo_destroy (cr);
#endif
}
@@ -2127,19 +2319,28 @@ static void
caja_icon_canvas_item_draw (EelCanvasItem *item,
cairo_t *cr,
cairo_region_t *region)
+{
+ CajaIconContainer *container;
#else
caja_icon_canvas_item_draw (EelCanvasItem *item, GdkDrawable *drawable,
GdkEventExpose *expose)
-#endif
{
+#endif
CajaIconCanvasItem *icon_item;
CajaIconCanvasItemDetails *details;
EelIRect icon_rect, emblem_rect;
EmblemLayout emblem_layout;
GdkPixbuf *emblem_pixbuf, *temp_pixbuf;
+#if GTK_CHECK_VERSION(3,0,0)
+ GtkStyleContext *context;
+
+ container = CAJA_ICON_CONTAINER (item->canvas);
+ gboolean is_rtl;
+#else
GdkRectangle pixbuf_rect;
gboolean is_rtl;
+#endif
icon_item = CAJA_ICON_CANVAS_ITEM (item);
details = icon_item->details;
@@ -2149,8 +2350,23 @@ caja_icon_canvas_item_draw (EelCanvasItem *item, GdkDrawable *drawable,
return;
}
+#if GTK_CHECK_VERSION(3,0,0)
+ context = gtk_widget_get_style_context (GTK_WIDGET (container));
+ gtk_style_context_save (context);
+ gtk_style_context_add_class (context, "caja-canvas-item");
+
+#endif
icon_rect = icon_item->details->canvas_rect;
+#if GTK_CHECK_VERSION(3,0,0)
+ temp_pixbuf = map_pixbuf (icon_item);
+
+ gtk_render_icon (context, cr,
+ temp_pixbuf,
+ icon_rect.x0, icon_rect.y0);
+ g_object_unref (temp_pixbuf);
+ draw_embedded_text (icon_item, cr, icon_rect.x0, icon_rect.y0);
+#else
/* if the pre-lit or selection flag is set, make a pre-lit or darkened pixbuf and draw that instead */
/* and colorize normal pixbuf if rc wants that */
temp_pixbuf = map_pixbuf (icon_item);
@@ -2159,26 +2375,15 @@ caja_icon_canvas_item_draw (EelCanvasItem *item, GdkDrawable *drawable,
pixbuf_rect.width = gdk_pixbuf_get_width (temp_pixbuf);
pixbuf_rect.height = gdk_pixbuf_get_height (temp_pixbuf);
-#if GTK_CHECK_VERSION(3,0,0)
- cairo_save (cr);
-#else
cairo_t *cr = gdk_cairo_create (drawable);
gdk_cairo_rectangle (cr, &expose->area);
cairo_clip (cr);
-#endif
gdk_cairo_set_source_pixbuf (cr, temp_pixbuf, pixbuf_rect.x, pixbuf_rect.y);
gdk_cairo_rectangle (cr, &pixbuf_rect);
cairo_fill (cr);
-#if GTK_CHECK_VERSION(3,0,0)
- cairo_restore (cr);
-#else
cairo_destroy (cr);
-#endif
g_object_unref (temp_pixbuf);
-#if GTK_CHECK_VERSION(3,0,0)
- draw_embedded_text (icon_item, cr, icon_rect.x0, icon_rect.y0);
-#else
draw_embedded_text (icon_item, drawable, icon_rect.x0, icon_rect.y0);
#endif
@@ -2190,18 +2395,19 @@ caja_icon_canvas_item_draw (EelCanvasItem *item, GdkDrawable *drawable,
{
#if GTK_CHECK_VERSION(3,0,0)
draw_pixbuf (emblem_pixbuf, cr, emblem_rect.x0, emblem_rect.y0);
-#else
- draw_pixbuf (emblem_pixbuf, drawable, emblem_rect.x0, emblem_rect.y0);
-#endif
}
-#if GTK_CHECK_VERSION(3,0,0)
/* Draw stretching handles (if necessary). */
draw_stretch_handles (icon_item, cr, &icon_rect);
/* Draw the label text. */
draw_label_text (icon_item, cr, FALSE, icon_rect);
+
+ gtk_style_context_restore (context);
#else
+ draw_pixbuf (emblem_pixbuf, drawable, emblem_rect.x0, emblem_rect.y0);
+ }
+
draw_stretch_handles (icon_item, drawable, &icon_rect);
draw_label_text (icon_item, drawable, FALSE, icon_rect);
#endif
@@ -2320,22 +2526,17 @@ get_label_layout (PangoLayout **layout_cache,
return layout;
}
+#if !GTK_CHECK_VERSION(3,0,0)
static void
draw_label_layout (CajaIconCanvasItem *item,
-#if GTK_CHECK_VERSION(3,0,0)
- cairo_t *cr,
-#else
GdkDrawable *drawable,
-#endif
PangoLayout *layout,
gboolean highlight,
GdkColor *label_color,
int x,
int y)
{
-#if !GTK_CHECK_VERSION(3,0,0)
g_return_if_fail (drawable != NULL);
-#endif
if (item->details->is_renaming)
{
@@ -2345,11 +2546,7 @@ draw_label_layout (CajaIconCanvasItem *item,
if (!highlight && (CAJA_ICON_CONTAINER (EEL_CANVAS_ITEM (item)->canvas)->details->use_drop_shadows))
{
/* draw a drop shadow */
-#if GTK_CHECK_VERSION(3,0,0)
- eel_cairo_draw_layout_with_drop_shadow (cr,
-#else
eel_gdk_draw_layout_with_drop_shadow (drawable,
-#endif
label_color,
&gtk_widget_get_style (GTK_WIDGET (EEL_CANVAS_ITEM (item)->canvas))->black,
x, y,
@@ -2357,22 +2554,14 @@ draw_label_layout (CajaIconCanvasItem *item,
}
else
{
-#if GTK_CHECK_VERSION(3,0,0)
- cairo_save (cr);
-#else
cairo_t *cr = gdk_cairo_create (drawable);
-#endif
-
gdk_cairo_set_source_color (cr, label_color);
cairo_move_to (cr, x, y);
pango_cairo_show_layout (cr, layout);
-#if GTK_CHECK_VERSION(3,0,0)
- cairo_restore (cr);
-#else
cairo_destroy (cr);
-#endif
}
}
+#endif
/* handle events */
diff --git a/libcaja-private/caja-icon-container.c b/libcaja-private/caja-icon-container.c
index 8e89ce62..2cec67a5 100644
--- a/libcaja-private/caja-icon-container.c
+++ b/libcaja-private/caja-icon-container.c
@@ -120,6 +120,10 @@
#define DEFAULT_HIGHLIGHT_ALPHA 0xff
#define DEFAULT_NORMAL_ALPHA 0xff
#define DEFAULT_PRELIGHT_ALPHA 0xff
+#if GTK_CHECK_VERSION(3,0,0)
+#define DEFAULT_LIGHT_INFO_COLOR "#AAAAFD"
+#define DEFAULT_DARK_INFO_COLOR "#33337F"
+#else
#define DEFAULT_LIGHT_INFO_COLOR 0xAAAAFD
#define DEFAULT_DARK_INFO_COLOR 0x33337F
@@ -131,6 +135,7 @@
#define DEFAULT_PRELIGHT_ICON_BRIGHTNESS 255
#define DEFAULT_NORMAL_ICON_LIGHTEN 0
#define DEFAULT_PRELIGHT_ICON_LIGHTEN 0
+#endif
#define MINIMUM_EMBEDDED_TEXT_RECT_WIDTH 20
#define MINIMUM_EMBEDDED_TEXT_RECT_HEIGHT 20
@@ -176,7 +181,9 @@ static GType caja_icon_container_accessible_get_type (void);
static void activate_selected_items (CajaIconContainer *container);
static void activate_selected_items_alternate (CajaIconContainer *container,
CajaIcon *icon);
+#if !GTK_CHECK_VERSION(3, 0, 0)
static void caja_icon_container_theme_changed (gpointer user_data);
+#endif
static void compute_stretch (StretchState *start,
StretchState *current);
static CajaIcon *get_first_selected_icon (CajaIconContainer *container);
@@ -202,7 +209,9 @@ static inline void icon_get_bounding_box (CajaIcon
static gboolean is_renaming (CajaIconContainer *container);
static gboolean is_renaming_pending (CajaIconContainer *container);
static void process_pending_icon_to_rename (CajaIconContainer *container);
+#if !GTK_CHECK_VERSION(3, 0, 0)
static void setup_label_gcs (CajaIconContainer *container);
+#endif
static void caja_icon_container_stop_monitor_top_left (CajaIconContainer *container,
CajaIconData *data,
gconstpointer client);
@@ -2871,6 +2880,83 @@ rubberband_timeout_callback (gpointer data)
return TRUE;
}
+#if GTK_CHECK_VERSION(3,0,0)
+/*borrowed from Nemo, makes Caja rubberbanding follow same selectors as Nemo and presumably Nautilus */
+static void
+start_rubberbanding (CajaIconContainer *container,
+ GdkEventButton *event)
+{
+ AtkObject *accessible;
+ CajaIconContainerDetails *details;
+ CajaIconRubberbandInfo *band_info;
+ GdkRGBA bg_color, border_color;
+ GList *p;
+ CajaIcon *icon;
+ GtkStyleContext *context;
+
+ details = container->details;
+ band_info = &details->rubberband_info;
+
+ g_signal_emit (container,
+ signals[BAND_SELECT_STARTED], 0);
+
+ for (p = details->icons; p != NULL; p = p->next) {
+ icon = p->data;
+ icon->was_selected_before_rubberband = icon->is_selected;
+ }
+
+ eel_canvas_window_to_world
+ (EEL_CANVAS (container), event->x, event->y,
+ &band_info->start_x, &band_info->start_y);
+
+ context = gtk_widget_get_style_context (GTK_WIDGET (container));
+ gtk_style_context_save (context);
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_RUBBERBAND);
+
+ gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &bg_color);
+ gtk_style_context_get_border_color (context, GTK_STATE_FLAG_NORMAL, &border_color);
+
+ gtk_style_context_restore (context);
+
+ band_info->selection_rectangle = eel_canvas_item_new
+ (eel_canvas_root
+ (EEL_CANVAS (container)),
+ EEL_TYPE_CANVAS_RECT,
+ "x1", band_info->start_x,
+ "y1", band_info->start_y,
+ "x2", band_info->start_x,
+ "y2", band_info->start_y,
+ "fill_color_rgba", &bg_color,
+ "outline_color_rgba", &border_color,
+ "width_pixels", 1,
+ NULL);
+
+ accessible = atk_gobject_accessible_for_object
+ (G_OBJECT (band_info->selection_rectangle));
+ atk_object_set_name (accessible, "selection");
+ atk_object_set_description (accessible, _("The selection rectangle"));
+
+ band_info->prev_x = event->x - gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container)));
+ band_info->prev_y = event->y - gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container)));
+
+ band_info->active = TRUE;
+
+ if (band_info->timer_id == 0) {
+ band_info->timer_id = g_timeout_add
+ (RUBBERBAND_TIMEOUT_INTERVAL,
+ rubberband_timeout_callback,
+ container);
+ }
+
+ eel_canvas_item_grab (band_info->selection_rectangle,
+ (GDK_POINTER_MOTION_MASK
+ | GDK_BUTTON_RELEASE_MASK
+ | GDK_SCROLL_MASK),
+ NULL, event->time);
+}
+
+
+#else
static void
start_rubberbanding (CajaIconContainer *container,
GdkEventButton *event)
@@ -2955,6 +3041,7 @@ start_rubberbanding (CajaIconContainer *container,
| GDK_SCROLL_MASK),
NULL, event->time);
}
+#endif
static void
stop_rubberbanding (CajaIconContainer *container,
@@ -4564,7 +4651,9 @@ realize (GtkWidget *widget)
/* Set up DnD. */
caja_icon_dnd_init (container);
+#if !GTK_CHECK_VERSION(3, 0, 0)
setup_label_gcs (container);
+#endif
hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (widget));
g_signal_connect (hadj, "value_changed",
@@ -4595,6 +4684,27 @@ unrealize (GtkWidget *widget)
}
static void
+#if GTK_CHECK_VERSION(3,0,0)
+style_updated (GtkWidget *widget)
+{
+ CajaIconContainer *container;
+
+ container = CAJA_ICON_CONTAINER (widget);
+ container->details->use_drop_shadows = container->details->drop_shadows_requested;
+
+ /* Don't chain up to parent, if this is a desktop container,
+ * because that resets the background of the window.
+ */
+ if (!caja_icon_container_get_is_desktop (container)) {
+ GTK_WIDGET_CLASS (caja_icon_container_parent_class)->style_updated (widget);
+ }
+
+ if (gtk_widget_get_realized (widget))
+ {
+ invalidate_labels (container);
+ caja_icon_container_request_update_all (container);
+ }
+#else
style_set (GtkWidget *widget,
GtkStyle *previous_style)
{
@@ -4619,6 +4729,7 @@ style_set (GtkWidget *widget,
/* Don't chain up to parent, because that sets the background of the window and we're doing
that ourself with some delay, so this would cause flickering */
+#endif
}
static gboolean
@@ -6568,8 +6679,10 @@ caja_icon_container_class_init (CajaIconContainerClass *class)
widget_class->key_press_event = key_press_event;
widget_class->popup_menu = popup_menu;
widget_class->get_accessible = get_accessible;
+#if GTK_CHECK_VERSION(3,0,0)
+ widget_class->style_updated = style_updated;
+#else
widget_class->style_set = style_set;
-#if !GTK_CHECK_VERSION(3,0,0)
widget_class->expose_event = expose_event;
#endif
widget_class->grab_notify = grab_notify_cb;
@@ -6579,13 +6692,32 @@ caja_icon_container_class_init (CajaIconContainerClass *class)
class->start_interactive_search = caja_icon_container_start_interactive_search;
+#if GTK_CHECK_VERSION(3,0,0)
+ gtk_widget_class_install_style_property (widget_class,
+ g_param_spec_boxed ("selection_box_rgba",
+ "Selection Box RGBA",
+ "Color of the selection box",
+ GDK_TYPE_RGBA,
+ G_PARAM_READABLE));
+ gtk_widget_class_install_style_property (widget_class,
+ g_param_spec_boxed ("light_info_rgba",
+ "Light Info RGBA",
+ "Color used for information text against a dark background",
+ GDK_TYPE_RGBA,
+ G_PARAM_READABLE));
+ gtk_widget_class_install_style_property (widget_class,
+ g_param_spec_boxed ("dark_info_rgba",
+ "Dark Info RGBA",
+ "Color used for information text against a light background",
+ GDK_TYPE_RGBA,
+ G_PARAM_READABLE));
+#else
gtk_widget_class_install_style_property (widget_class,
g_param_spec_boolean ("frame_text",
"Frame Text",
"Draw a frame around unselected text",
FALSE,
G_PARAM_READABLE));
-
gtk_widget_class_install_style_property (widget_class,
g_param_spec_boxed ("selection_box_color",
"Selection Box Color",
@@ -6702,6 +6834,7 @@ caja_icon_container_class_init (CajaIconContainerClass *class)
0, 255,
DEFAULT_PRELIGHT_ICON_LIGHTEN,
G_PARAM_READABLE));
+#endif
gtk_widget_class_install_style_property (widget_class,
g_param_spec_boolean ("activate_prelight_icon_label",
"Activate Prelight Icon Label",
@@ -6867,8 +7000,10 @@ caja_icon_container_init (CajaIconContainer *container)
/* when the background changes, we must set up the label text color */
background = eel_get_widget_background (GTK_WIDGET (container));
+#if !GTK_CHECK_VERSION(3,0,0)
g_signal_connect_object (background, "appearance_changed",
G_CALLBACK (update_label_color), container, 0);
+#endif
g_signal_connect (container, "focus-in-event",
G_CALLBACK (handle_focus_in_event), NULL);
@@ -6877,8 +7012,10 @@ caja_icon_container_init (CajaIconContainer *container)
eel_background_set_use_base (background, TRUE);
+#if !GTK_CHECK_VERSION(3,0,0)
/* read in theme-dependent data */
caja_icon_container_theme_changed (container);
+#endif
if (!setup_prefs)
{
@@ -9170,12 +9307,20 @@ caja_icon_container_start_renaming_selected_item (CajaIconContainer *container,
{
eel_filename_get_rename_region (editable_text, &start_offset, &end_offset);
}
+
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_show (details->rename_widget);
+ gtk_widget_grab_focus (details->rename_widget);
+#endif
+
eel_editable_label_select_region (EEL_EDITABLE_LABEL (details->rename_widget),
start_offset,
end_offset);
- gtk_widget_show (details->rename_widget);
+#if !GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_show (details->rename_widget);
gtk_widget_grab_focus (details->rename_widget);
+#endif
g_signal_emit (container,
signals[RENAMING_ICON], 0,
@@ -9291,15 +9436,15 @@ caja_icon_container_set_single_click_mode (CajaIconContainer *container,
container->details->single_click_mode = single_click_mode;
}
-
+#if !GTK_CHECK_VERSION(3,0,0)
/* update the label color when the background changes */
void
caja_icon_container_get_label_color (CajaIconContainer *container,
GdkColor **color,
- gboolean is_name,
- gboolean is_highlight,
- gboolean is_prelit)
+ gboolean is_name,
+ gboolean is_highlight,
+ gboolean is_prelit)
{
int idx;
@@ -9458,7 +9603,7 @@ update_label_color (EelBackground *background,
setup_label_gcs (container);
}
-
+#endif
/* Return if the icon container is a fixed size */
gboolean
@@ -9518,11 +9663,13 @@ void
caja_icon_container_set_use_drop_shadows (CajaIconContainer *container,
gboolean use_drop_shadows)
{
+#if !GTK_CHECK_VERSION(3,0,0)
gboolean frame_text;
gtk_widget_style_get (GTK_WIDGET (container),
"frame_text", &frame_text,
NULL);
+#endif
if (container->details->drop_shadows_requested == use_drop_shadows)
{
@@ -9530,12 +9677,17 @@ caja_icon_container_set_use_drop_shadows (CajaIconContainer *container,
}
container->details->drop_shadows_requested = use_drop_shadows;
+#if GTK_CHECK_VERSION(3,0,0)
+ container->details->use_drop_shadows = use_drop_shadows;
+#else
container->details->use_drop_shadows = use_drop_shadows && !frame_text;
+#endif
gtk_widget_queue_draw (GTK_WIDGET (container));
}
/* handle theme changes */
+#if !GTK_CHECK_VERSION(3,0,0)
static void
caja_icon_container_theme_changed (gpointer user_data)
{
@@ -9633,9 +9785,9 @@ caja_icon_container_theme_changed (gpointer user_data)
style->base[GTK_STATE_PRELIGHT].blue >> 8,
prelight_alpha);
-
setup_label_gcs (container);
}
+#endif
void
caja_icon_container_set_font (CajaIconContainer *container,
diff --git a/libcaja-private/caja-icon-dnd.c b/libcaja-private/caja-icon-dnd.c
index 376490dc..82707150 100644
--- a/libcaja-private/caja-icon-dnd.c
+++ b/libcaja-private/caja-icon-dnd.c
@@ -144,6 +144,9 @@ create_selection_shadow (CajaIconContainer *container,
{
CajaDragSelectionItem *item;
int x1, y1, x2, y2;
+#if GTK_CHECK_VERSION(3,0,0)
+ GdkRGBA black = { 0, 0, 0, 1 };
+#endif
item = p->data;
@@ -165,7 +168,11 @@ create_selection_shadow (CajaIconContainer *container,
"y1", (double) y1,
"x2", (double) x2,
"y2", (double) y2,
- "outline_color", "black",
+#if GTK_CHECK_VERSION(3,0,0)
+ "outline-color-rgba", &black,
+#else
+ "outline_color", "black",
+#endif
"outline-stippling", TRUE,
"width_pixels", 1,
NULL);
@@ -1611,22 +1618,36 @@ drag_highlight_expose (GtkWidget *widget,
gpointer data)
#endif
{
+#if GTK_CHECK_VERSION(3,0,0)
+ gint width, height;
+ GdkWindow *window;
+ GtkStyleContext *style;
+#else
gint x, y, width, height;
GdkWindow *window;
+#endif
+#if !GTK_CHECK_VERSION(3,0,0)
x = gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (widget)));
y = gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (widget)));
+#endif
window = gtk_widget_get_window (widget);
width = gdk_window_get_width (window);
height = gdk_window_get_height (window);
#if GTK_CHECK_VERSION (3, 0, 0)
- gtk_paint_shadow (gtk_widget_get_style (widget),
+ style = gtk_widget_get_style_context (widget);
+
+ gtk_style_context_save (style);
+ gtk_style_context_add_class (style, "dnd");
+ gtk_style_context_set_state (style, GTK_STATE_FLAG_FOCUSED);
+
+ gtk_render_frame (style,
cr,
- GTK_STATE_NORMAL, GTK_SHADOW_OUT,
- widget, "dnd",
- x, y, width, height);
+ 0, 0, width, height);
+
+ gtk_style_context_restore (style);
#else
gtk_paint_shadow (gtk_widget_get_style (widget), window,
GTK_STATE_NORMAL, GTK_SHADOW_OUT,
@@ -1638,7 +1659,11 @@ drag_highlight_expose (GtkWidget *widget,
cairo_set_line_width (cr, 1.0);
cairo_set_source_rgb (cr, 0, 0, 0);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ cairo_rectangle (cr, 0.5, 0.5, width - 1, height - 1);
+#else
cairo_rectangle (cr, x + 0.5, y + 0.5, width - 1, height - 1);
+#endif
cairo_stroke (cr);
#if !GTK_CHECK_VERSION(3,0,0)
cairo_destroy (cr);
diff --git a/libcaja-private/caja-icon-info.c b/libcaja-private/caja-icon-info.c
index 3a63bb44..d5bd542e 100644
--- a/libcaja-private/caja-icon-info.c
+++ b/libcaja-private/caja-icon-info.c
@@ -472,7 +472,13 @@ caja_icon_info_lookup (GIcon *icon,
pixbuf = NULL;
}
- return caja_icon_info_new_for_pixbuf (pixbuf);
+ icon_info = caja_icon_info_new_for_pixbuf (pixbuf);
+
+ if (pixbuf != NULL) {
+ g_object_unref (pixbuf);
+ }
+
+ return icon_info;
}
}
diff --git a/libcaja-private/caja-icon-private.h b/libcaja-private/caja-icon-private.h
index cf7ef592..9364bab7 100644
--- a/libcaja-private/caja-icon-private.h
+++ b/libcaja-private/caja-icon-private.h
@@ -211,6 +211,7 @@ struct CajaIconContainerDetails
int font_size_table[CAJA_ZOOM_LEVEL_LARGEST + 1];
/* pixbuf and color for label highlighting */
+#if !GTK_CHECK_VERSION(3,0,0)
guint32 highlight_color_rgba;
guint32 active_color_rgba;
guint32 normal_color_rgba;
@@ -220,6 +221,7 @@ struct CajaIconContainerDetails
/* colors for text labels */
GdkColor label_colors [LAST_LABEL_COLOR];
+#endif
/* State used so arrow keys don't wander if icons aren't lined up.
*/
@@ -325,11 +327,13 @@ gboolean caja_icon_container_scroll (CajaIconContainer
int delta_y);
void caja_icon_container_update_scroll_region (CajaIconContainer *container);
+#if !GTK_CHECK_VERSION(3,0,0)
/* label color for items */
void caja_icon_container_get_label_color (CajaIconContainer *container,
GdkColor **color,
gboolean first_line,
gboolean needs_highlight,
gboolean is_prelit);
+#endif
#endif /* CAJA_ICON_CONTAINER_PRIVATE_H */
diff --git a/libcaja-private/caja-tree-view-drag-dest.c b/libcaja-private/caja-tree-view-drag-dest.c
index 22a5cc51..accf7bb5 100644
--- a/libcaja-private/caja-tree-view-drag-dest.c
+++ b/libcaja-private/caja-tree-view-drag-dest.c
@@ -199,6 +199,9 @@ highlight_expose (GtkWidget *widget,
GdkWindow *bin_window;
int width;
int height;
+#if GTK_CHECK_VERSION(3,0,0)
+ GtkStyleContext *style;
+#endif
/* FIXMEchpe: is bin window right here??? */
bin_window = gtk_tree_view_get_bin_window (GTK_TREE_VIEW (widget));
@@ -206,18 +209,26 @@ highlight_expose (GtkWidget *widget,
width = gdk_window_get_width(bin_window);
height = gdk_window_get_height(bin_window);
- gtk_paint_focus (gtk_widget_get_style (widget),
#if GTK_CHECK_VERSION(3,0,0)
- cr,
- gtk_widget_get_state (widget),
+ style = gtk_widget_get_style_context (widget);
+
+ gtk_style_context_save (style);
+ gtk_style_context_add_class (style, "treeview-drop-indicator");
+
+ gtk_render_focus (style,
+ cr,
+ 0, 0, width, height);
+
+ gtk_style_context_restore (style);
#else
+ gtk_paint_focus (gtk_widget_get_style (widget),
bin_window,
gtk_widget_get_state (widget),
NULL,
-#endif
widget,
"treeview-drop-indicator",
0, 0, width, height);
+#endif
return FALSE;
}