summaryrefslogtreecommitdiff
path: root/src/file-manager
diff options
context:
space:
mode:
Diffstat (limited to 'src/file-manager')
-rw-r--r--src/file-manager/fm-list-model.c8
-rw-r--r--src/file-manager/fm-list-view.c15
-rw-r--r--src/file-manager/fm-properties-window.c84
-rw-r--r--src/file-manager/fm-tree-model.c8
4 files changed, 111 insertions, 4 deletions
diff --git a/src/file-manager/fm-list-model.c b/src/file-manager/fm-list-model.c
index 6a1692f4..1bf2d599 100644
--- a/src/file-manager/fm-list-model.c
+++ b/src/file-manager/fm-list-model.c
@@ -29,7 +29,11 @@
#include <libegg/eggtreemultidnd.h>
#include <string.h>
+#if GTK_CHECK_VERSION(3,0,0)
+#include <eel/eel-graphic-effects.h>
+#else
#include <eel/eel-gdk-pixbuf-extensions.h>
+#endif
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <libcaja-private/caja-dnd.h>
@@ -386,7 +390,11 @@ fm_list_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, int column
g_list_find_custom (model->details->highlight_files,
file, (GCompareFunc) caja_file_compare_location))
{
+#if GTK_CHECK_VERSION(3,0,0)
+ rendered_icon = eel_create_spotlight_pixbuf (icon);
+#else
rendered_icon = eel_gdk_pixbuf_render (icon, 1, 255, 255, 0, 0);
+#endif
if (rendered_icon != NULL)
{
diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c
index dc9bc20b..56ff9b17 100644
--- a/src/file-manager/fm-list-view.c
+++ b/src/file-manager/fm-list-view.c
@@ -3262,20 +3262,35 @@ real_set_is_active (FMDirectoryView *view,
gboolean is_active)
{
GtkWidget *tree_view;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GtkStyleContext *style;
+ GdkRGBA color;
+#else
GtkStyle *style;
GdkColor color;
+#endif
tree_view = GTK_WIDGET (fm_list_view_get_tree_view (FM_LIST_VIEW (view)));
if (is_active)
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_override_background_color (tree_view, GTK_STATE_FLAG_NORMAL, NULL);
+#else
gtk_widget_modify_base (tree_view, GTK_STATE_NORMAL, NULL);
+#endif
}
else
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ style = gtk_widget_get_style_context (tree_view);
+ gtk_style_context_get_background_color (style, GTK_STATE_FLAG_INSENSITIVE, &color);
+ gtk_widget_override_background_color (tree_view, GTK_STATE_FLAG_NORMAL, &color);
+#else
style = gtk_widget_get_style (tree_view);
color = style->base[GTK_STATE_INSENSITIVE];
gtk_widget_modify_base (tree_view, GTK_STATE_NORMAL, &color);
+#endif
}
EEL_CALL_PARENT (FM_DIRECTORY_VIEW_CLASS,
diff --git a/src/file-manager/fm-properties-window.c b/src/file-manager/fm-properties-window.c
index 42b30a9a..87b75a6d 100644
--- a/src/file-manager/fm-properties-window.c
+++ b/src/file-manager/fm-properties-window.c
@@ -68,6 +68,15 @@
#include <sys/mount.h>
#endif
+#if GTK_CHECK_VERSION (3, 0, 0)
+#define USED_FILL_R 0.988235294
+#define USED_FILL_G 0.91372549
+#define USED_FILL_B 0.309803922
+
+#define FREE_FILL_R 0.447058824
+#define FREE_FILL_G 0.623529412
+#define FREE_FILL_B 0.811764706
+#else
#define USED_FILL_R (0.988235294 * 65535)
#define USED_FILL_G (0.91372549 * 65535)
#define USED_FILL_B (0.309803922 * 65535)
@@ -75,6 +84,7 @@
#define FREE_FILL_R (0.447058824 * 65535)
#define FREE_FILL_G (0.623529412 * 65535)
#define FREE_FILL_B (0.811764706 * 65535)
+#endif
#define PREVIEW_IMAGE_WIDTH 96
@@ -148,10 +158,17 @@ struct FMPropertiesWindowDetails {
guint64 volume_capacity;
guint64 volume_free;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GdkRGBA used_color;
+ GdkRGBA free_color;
+ GdkRGBA used_stroke_color;
+ GdkRGBA free_stroke_color;
+#else
GdkColor used_color;
GdkColor free_color;
GdkColor used_stroke_color;
GdkColor free_stroke_color;
+#endif
};
#if GTK_CHECK_VERSION (3, 0, 0)
@@ -3045,6 +3062,13 @@ paint_used_legend (GtkWidget *widget,
width - 4,
height - 4);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gdk_cairo_set_source_rgba (cr, &window->details->used_color);
+ cairo_fill_preserve (cr);
+
+ gdk_cairo_set_source_rgba (cr, &window->details->used_stroke_color);
+ cairo_stroke (cr);
+#else
cairo_set_source_rgb (cr,
(double) window->details->used_color.red / 65535,
(double) window->details->used_color.green / 65535,
@@ -3057,7 +3081,6 @@ paint_used_legend (GtkWidget *widget,
(double) window->details->used_stroke_color.blue / 65535);
cairo_stroke (cr);
-#if !GTK_CHECK_VERSION(3,0,0)
cairo_destroy (cr);
#endif
}
@@ -3089,6 +3112,13 @@ paint_free_legend (GtkWidget *widget,
width - 4,
height - 4);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gdk_cairo_set_source_rgba (cr, &window->details->free_color);
+ cairo_fill_preserve(cr);
+
+ gdk_cairo_set_source_rgba (cr, &window->details->free_stroke_color);
+ cairo_stroke (cr);
+#else
cairo_set_source_rgb (cr,
(double) window->details->free_color.red / 65535,
(double) window->details->free_color.green / 65535,
@@ -3101,7 +3131,6 @@ paint_free_legend (GtkWidget *widget,
(double) window->details->free_stroke_color.blue / 65535);
cairo_stroke (cr);
-#if !GTK_CHECK_VERSION(3,0,0)
cairo_destroy (cr);
#endif
}
@@ -3167,6 +3196,12 @@ paint_pie_chart (GtkWidget *widget,
cairo_line_to (cr,xc,yc);
}
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gdk_cairo_set_source_rgba (cr, &window->details->used_color);
+ cairo_fill_preserve (cr);
+
+ gdk_cairo_set_source_rgba (cr, &window->details->used_stroke_color);
+#else
cairo_set_source_rgb (cr,
(double) window->details->used_color.red / 65535,
(double) window->details->used_color.green / 65535,
@@ -3177,6 +3212,7 @@ paint_pie_chart (GtkWidget *widget,
(double) window->details->used_stroke_color.red / 65535,
(double) window->details->used_stroke_color.green / 65535,
(double) window->details->used_stroke_color.blue / 65535);
+#endif
cairo_stroke (cr);
}
@@ -3191,6 +3227,12 @@ paint_pie_chart (GtkWidget *widget,
cairo_line_to (cr,xc,yc);
}
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gdk_cairo_set_source_rgba (cr, &window->details->free_color);
+ cairo_fill_preserve(cr);
+
+ gdk_cairo_set_source_rgba (cr, &window->details->free_stroke_color);
+#else
cairo_set_source_rgb (cr,
(double) window->details->free_color.red / 65535,
(double) window->details->free_color.green / 65535,
@@ -3201,6 +3243,7 @@ paint_pie_chart (GtkWidget *widget,
(double) window->details->free_stroke_color.red / 65535,
(double) window->details->free_stroke_color.green / 65535,
(double) window->details->free_stroke_color.blue / 65535);
+#endif
cairo_stroke (cr);
}
@@ -3362,17 +3405,28 @@ hls_to_rgb (gdouble *h,
}
}
static void
+#if GTK_CHECK_VERSION (3, 0, 0)
+_pie_style_shade (GdkRGBA *a,
+ GdkRGBA *b,
+#else
_pie_style_shade (GdkColor *a,
GdkColor *b,
+#endif
gdouble k)
{
gdouble red;
gdouble green;
gdouble blue;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ red = a->red;
+ green = a->green;
+ blue = a->blue;
+#else
red = (gdouble) a->red / 65535.0;
green = (gdouble) a->green / 65535.0;
blue = (gdouble) a->blue / 65535.0;
+#endif
rgb_to_hls (&red, &green, &blue);
@@ -3390,9 +3444,16 @@ _pie_style_shade (GdkColor *a,
hls_to_rgb (&red, &green, &blue);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ b->red = red;
+ b->green = green;
+ b->blue = blue;
+ b->alpha = a->alpha;
+#else
b->red = red * 65535.0;
b->green = green * 65535.0;
b->blue = blue * 65535.0;
+#endif
}
@@ -3402,10 +3463,11 @@ create_pie_widget (FMPropertiesWindow *window)
CajaFile *file;
#if GTK_CHECK_VERSION (3, 0, 0)
GtkGrid *grid;
+ GtkStyleContext *style;
#else
GtkTable *table;
-#endif
GtkStyle *style;
+#endif
GtkWidget *pie_canvas;
GtkWidget *used_canvas;
GtkWidget *used_label;
@@ -3441,22 +3503,34 @@ create_pie_widget (FMPropertiesWindow *window)
gtk_container_set_border_width (GTK_CONTAINER (grid), 5);
gtk_grid_set_column_spacing (GTK_GRID (grid), 5);
style = gtk_widget_get_style_context (GTK_WIDGET (grid));
+
+ if (!gtk_style_context_lookup_color (style, "chart_rgba_1", &window->details->used_color)) {
#else
table = GTK_TABLE (gtk_table_new (4, 3, FALSE));
style = gtk_rc_get_style (GTK_WIDGET(table));
-#endif
if (!gtk_style_lookup_color (style, "chart_color_1", &window->details->used_color)) {
+#endif
window->details->used_color.red = USED_FILL_R;
window->details->used_color.green = USED_FILL_G;
window->details->used_color.blue = USED_FILL_B;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ window->details->used_color.alpha = 1;
+#endif
}
+#if GTK_CHECK_VERSION (3, 0, 0)
+ if (!gtk_style_context_lookup_color (style, "chart_rgba_2", &window->details->free_color)) {
+#else
if (!gtk_style_lookup_color (style, "chart_color_2", &window->details->free_color)) {
+#endif
window->details->free_color.red = FREE_FILL_R;
window->details->free_color.green = FREE_FILL_G;
window->details->free_color.blue = FREE_FILL_B;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ window->details->free_color.alpha = 1;
+#endif
}
_pie_style_shade (&window->details->used_color, &window->details->used_stroke_color, 0.7);
@@ -6152,7 +6226,9 @@ create_properties_window (StartupData *startup_data)
NULL);
/* FIXME - HIGificiation, should be done inside GTK+ */
+#if !GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_ensure_style (GTK_WIDGET (window));
+#endif
gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (window))), 12);
gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_action_area (GTK_DIALOG (window))), 0);
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (window))), 12);
diff --git a/src/file-manager/fm-tree-model.c b/src/file-manager/fm-tree-model.c
index 504dd89a..039a1ef8 100644
--- a/src/file-manager/fm-tree-model.c
+++ b/src/file-manager/fm-tree-model.c
@@ -29,7 +29,11 @@
#include <config.h>
#include "fm-tree-model.h"
+#if GTK_CHECK_VERSION(3,0,0)
+#include <eel/eel-graphic-effects.h>
+#else
#include <eel/eel-gdk-pixbuf-extensions.h>
+#endif
#include <glib/gi18n.h>
#include <libcaja-private/caja-directory.h>
#include <libcaja-private/caja-file-attributes.h>
@@ -332,7 +336,11 @@ get_menu_icon_for_file (TreeNode *node,
if (highlight)
{
+#if GTK_CHECK_VERSION(3,0,0)
+ pixbuf = eel_create_spotlight_pixbuf (retval);
+#else
pixbuf = eel_gdk_pixbuf_render (retval, 1, 255, 255, 0, 0);
+#endif
if (pixbuf != NULL)
{