summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2018-04-02 22:02:39 -0400
committerraveit65 <[email protected]>2018-04-05 09:09:50 +0200
commitdade92d4f1edb6f47933e77229801971cb458ef1 (patch)
treedb2545721a093328979a305a2c92e428ad65e230
parent556663ac4b8eb03b86fa70eeb6b959e1d27281e2 (diff)
downloadcaja-dade92d4f1edb6f47933e77229801971cb458ef1.tar.bz2
caja-dade92d4f1edb6f47933e77229801971cb458ef1.tar.xz
HiDPI: Convert Pixbufs to Cairo Surfaces
This allows icons in most places to scale up properly for HiDPI displays.
-rw-r--r--eel/eel-graphic-effects.c14
-rw-r--r--eel/eel-graphic-effects.h3
-rw-r--r--libcaja-private/caja-autorun.c122
-rw-r--r--libcaja-private/caja-bookmark.c22
-rw-r--r--libcaja-private/caja-bookmark.h2
-rw-r--r--libcaja-private/caja-icon-canvas-item.c4
-rw-r--r--libcaja-private/caja-icon-info.c55
-rw-r--r--libcaja-private/caja-icon-info.h6
-rw-r--r--libcaja-private/caja-open-with-dialog.c54
-rw-r--r--libcaja-private/caja-ui-utilities.c36
-rw-r--r--src/caja-bookmarks-window.c21
-rw-r--r--src/caja-emblem-sidebar.c10
-rw-r--r--src/caja-history-sidebar.c17
-rw-r--r--src/caja-pathbar.c28
-rw-r--r--src/caja-places-sidebar.c52
-rw-r--r--src/caja-property-browser.c8
-rw-r--r--src/caja-window-menus.c20
-rw-r--r--src/file-manager/fm-directory-view.c78
-rw-r--r--src/file-manager/fm-tree-model.c110
-rw-r--r--src/file-manager/fm-tree-model.h4
-rw-r--r--src/file-manager/fm-tree-view.c5
21 files changed, 395 insertions, 276 deletions
diff --git a/eel/eel-graphic-effects.c b/eel/eel-graphic-effects.c
index f25cbb6f..2405a296 100644
--- a/eel/eel-graphic-effects.c
+++ b/eel/eel-graphic-effects.c
@@ -108,6 +108,20 @@ eel_create_spotlight_pixbuf (GdkPixbuf* src)
return dest;
}
+cairo_surface_t *
+eel_create_spotlight_surface (cairo_surface_t* src, int scale)
+{
+ GdkPixbuf *pixbuf;
+ cairo_surface_t *dest;
+
+ pixbuf = gdk_pixbuf_get_from_surface (src, 0, 0,
+ cairo_image_surface_get_width (src),
+ cairo_image_surface_get_height (src));
+ dest = gdk_cairo_surface_create_from_pixbuf (pixbuf, scale, NULL);
+ g_object_unref (pixbuf);
+
+ return dest;
+}
/* the following routine was stolen from the panel to darken a pixbuf, by manipulating the saturation */
diff --git a/eel/eel-graphic-effects.h b/eel/eel-graphic-effects.h
index 3a9027fe..d71fffcb 100644
--- a/eel/eel-graphic-effects.h
+++ b/eel/eel-graphic-effects.h
@@ -32,6 +32,9 @@
/* return a lightened pixbuf for pre-lighting */
GdkPixbuf *eel_create_spotlight_pixbuf (GdkPixbuf *source_pixbuf);
+/* return a lightened surface for pre-lighting */
+cairo_surface_t *eel_create_spotlight_surface (cairo_surface_t *source_surface,
+ int scale);
/* return a darkened pixbuf for selection hiliting */
GdkPixbuf *eel_create_darkened_pixbuf (GdkPixbuf *source_pixbuf,
diff --git a/libcaja-private/caja-autorun.c b/libcaja-private/caja-autorun.c
index f0a36b4d..08ded8fc 100644
--- a/libcaja-private/caja-autorun.c
+++ b/libcaja-private/caja-autorun.c
@@ -31,6 +31,7 @@
#include <gio/gdesktopappinfo.h>
#include <X11/XKBlib.h>
#include <gdk/gdkkeysyms.h>
+#include <cairo-gobject.h>
#include <eel/eel-glib-extensions.h>
@@ -54,7 +55,7 @@ enum
};
enum
{
- COLUMN_AUTORUN_PIXBUF,
+ COLUMN_AUTORUN_SURFACE,
COLUMN_AUTORUN_NAME,
COLUMN_AUTORUN_APP_INFO,
COLUMN_AUTORUN_X_CONTENT_TYPE,
@@ -467,7 +468,7 @@ caja_autorun_prepare_combo_box (GtkWidget *combo_box,
GAppInfo *default_app_info;
GtkListStore *list_store;
GtkTreeIter iter;
- GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
int icon_size, icon_scale;
int set_active;
int n;
@@ -495,7 +496,7 @@ caja_autorun_prepare_combo_box (GtkWidget *combo_box,
num_apps = g_list_length (app_info_list);
list_store = gtk_list_store_new (5,
- GDK_TYPE_PIXBUF,
+ CAIRO_GOBJECT_TYPE_SURFACE,
G_TYPE_STRING,
G_TYPE_APP_INFO,
G_TYPE_STRING,
@@ -505,76 +506,84 @@ caja_autorun_prepare_combo_box (GtkWidget *combo_box,
if (num_apps == 0)
{
gtk_list_store_append (list_store, &iter);
- pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
- "dialog-error",
- icon_size,
- 0,
- NULL);
+ surface = gtk_icon_theme_load_surface (gtk_icon_theme_get_default (),
+ "dialog-error",
+ icon_size,
+ icon_scale,
+ NULL,
+ 0,
+ NULL);
/* TODO: integrate with PackageKit-mate to find applications */
gtk_list_store_set (list_store, &iter,
- COLUMN_AUTORUN_PIXBUF, pixbuf,
+ COLUMN_AUTORUN_SURFACE, surface,
COLUMN_AUTORUN_NAME, _("No applications found"),
COLUMN_AUTORUN_APP_INFO, NULL,
COLUMN_AUTORUN_X_CONTENT_TYPE, x_content_type,
COLUMN_AUTORUN_ITEM_TYPE, AUTORUN_ASK,
-1);
- g_object_unref (pixbuf);
+ cairo_surface_destroy (surface);
}
else
{
if (include_ask)
{
gtk_list_store_append (list_store, &iter);
- pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
- "dialog-question",
- icon_size,
- 0,
- NULL);
+ surface = gtk_icon_theme_load_surface (gtk_icon_theme_get_default (),
+ "dialog-question",
+ icon_size,
+ icon_scale,
+ NULL,
+ 0,
+ NULL);
gtk_list_store_set (list_store, &iter,
- COLUMN_AUTORUN_PIXBUF, pixbuf,
+ COLUMN_AUTORUN_SURFACE, surface,
COLUMN_AUTORUN_NAME, _("Ask what to do"),
COLUMN_AUTORUN_APP_INFO, NULL,
COLUMN_AUTORUN_X_CONTENT_TYPE, x_content_type,
COLUMN_AUTORUN_ITEM_TYPE, AUTORUN_ASK,
-1);
- g_object_unref (pixbuf);
+ cairo_surface_destroy (surface);
}
gtk_list_store_append (list_store, &iter);
- pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
- "window-close",
- icon_size,
- 0,
- NULL);
+ surface = gtk_icon_theme_load_surface (gtk_icon_theme_get_default (),
+ "window-close",
+ icon_size,
+ icon_scale,
+ NULL,
+ 0,
+ NULL);
gtk_list_store_set (list_store, &iter,
- COLUMN_AUTORUN_PIXBUF, pixbuf,
+ COLUMN_AUTORUN_SURFACE, surface,
COLUMN_AUTORUN_NAME, _("Do Nothing"),
COLUMN_AUTORUN_APP_INFO, NULL,
COLUMN_AUTORUN_X_CONTENT_TYPE, x_content_type,
COLUMN_AUTORUN_ITEM_TYPE, AUTORUN_IGNORE,
-1);
- g_object_unref (pixbuf);
+ cairo_surface_destroy (surface);
gtk_list_store_append (list_store, &iter);
- pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
- "folder-open",
- icon_size,
- 0,
- NULL);
+ surface = gtk_icon_theme_load_surface (gtk_icon_theme_get_default (),
+ "folder-open",
+ icon_size,
+ icon_scale,
+ NULL,
+ 0,
+ NULL);
gtk_list_store_set (list_store, &iter,
- COLUMN_AUTORUN_PIXBUF, pixbuf,
+ COLUMN_AUTORUN_SURFACE, surface,
COLUMN_AUTORUN_NAME, _("Open Folder"),
COLUMN_AUTORUN_APP_INFO, NULL,
COLUMN_AUTORUN_X_CONTENT_TYPE, x_content_type,
COLUMN_AUTORUN_ITEM_TYPE, AUTORUN_OPEN_FOLDER,
-1);
- g_object_unref (pixbuf);
+ cairo_surface_destroy (surface);
gtk_list_store_append (list_store, &iter);
gtk_list_store_set (list_store, &iter,
- COLUMN_AUTORUN_PIXBUF, NULL,
+ COLUMN_AUTORUN_SURFACE, NULL,
COLUMN_AUTORUN_NAME, NULL,
COLUMN_AUTORUN_APP_INFO, NULL,
COLUMN_AUTORUN_X_CONTENT_TYPE, NULL,
@@ -595,22 +604,22 @@ caja_autorun_prepare_combo_box (GtkWidget *combo_box,
icon = g_app_info_get_icon (app_info);
icon_info = caja_icon_info_lookup (icon, icon_size, icon_scale);
- pixbuf = caja_icon_info_get_pixbuf_at_size (icon_info, icon_size);
+ surface = caja_icon_info_get_surface_at_size (icon_info, icon_size);
g_object_unref (icon_info);
open_string = g_strdup_printf (_("Open %s"), g_app_info_get_display_name (app_info));
gtk_list_store_append (list_store, &iter);
gtk_list_store_set (list_store, &iter,
- COLUMN_AUTORUN_PIXBUF, pixbuf,
+ COLUMN_AUTORUN_SURFACE, surface,
COLUMN_AUTORUN_NAME, open_string,
COLUMN_AUTORUN_APP_INFO, app_info,
COLUMN_AUTORUN_X_CONTENT_TYPE, x_content_type,
COLUMN_AUTORUN_ITEM_TYPE, AUTORUN_APP,
-1);
- if (pixbuf != NULL)
+ if (surface != NULL)
{
- g_object_unref (pixbuf);
+ cairo_surface_destroy (surface);
}
g_free (open_string);
@@ -625,7 +634,7 @@ caja_autorun_prepare_combo_box (GtkWidget *combo_box,
{
gtk_list_store_append (list_store, &iter);
gtk_list_store_set (list_store, &iter,
- COLUMN_AUTORUN_PIXBUF, NULL,
+ COLUMN_AUTORUN_SURFACE, NULL,
COLUMN_AUTORUN_NAME, NULL,
COLUMN_AUTORUN_APP_INFO, NULL,
COLUMN_AUTORUN_X_CONTENT_TYPE, NULL,
@@ -633,19 +642,21 @@ caja_autorun_prepare_combo_box (GtkWidget *combo_box,
-1);
gtk_list_store_append (list_store, &iter);
- pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
- "application-x-executable",
- icon_size,
- 0,
- NULL);
+ surface = gtk_icon_theme_load_surface (gtk_icon_theme_get_default (),
+ "application-x-executable",
+ icon_size,
+ icon_scale,
+ NULL,
+ 0,
+ NULL);
gtk_list_store_set (list_store, &iter,
- COLUMN_AUTORUN_PIXBUF, pixbuf,
+ COLUMN_AUTORUN_SURFACE, surface,
COLUMN_AUTORUN_NAME, _("Open with other Application..."),
COLUMN_AUTORUN_APP_INFO, NULL,
COLUMN_AUTORUN_X_CONTENT_TYPE, x_content_type,
COLUMN_AUTORUN_ITEM_TYPE, AUTORUN_OTHER_APP,
-1);
- g_object_unref (pixbuf);
+ cairo_surface_destroy (surface);
}
if (default_app_info != NULL)
@@ -662,7 +673,7 @@ caja_autorun_prepare_combo_box (GtkWidget *combo_box,
renderer = gtk_cell_renderer_pixbuf_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), renderer, FALSE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), renderer,
- "pixbuf", COLUMN_AUTORUN_PIXBUF,
+ "surface", COLUMN_AUTORUN_SURFACE,
NULL);
renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), renderer, TRUE);
@@ -934,6 +945,7 @@ do_autorun_for_content_type (GMount *mount, const char *x_content_type, CajaAuto
char *mount_name;
GIcon *icon;
GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
CajaIconInfo *icon_info;
int icon_size, icon_scale;
gboolean user_forced_dialog;
@@ -1002,9 +1014,10 @@ show_dialog:
icon_scale = gtk_widget_get_scale_factor (dialog);
icon_info = caja_icon_info_lookup (icon, icon_size, icon_scale);
pixbuf = caja_icon_info_get_pixbuf_at_size (icon_info, icon_size);
+ surface = caja_icon_info_get_surface_at_size (icon_info, icon_size);
g_object_unref (icon_info);
g_object_unref (icon);
- image = gtk_image_new_from_pixbuf (pixbuf);
+ image = gtk_image_new_from_surface (surface);
gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
gtk_widget_set_valign (image, GTK_ALIGN_START);
gtk_box_pack_start (GTK_BOX (hbox), image, TRUE, TRUE, 0);
@@ -1013,6 +1026,7 @@ show_dialog:
gtk_window_set_icon (GTK_WINDOW (dialog), pixbuf);
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
g_object_unref (pixbuf);
+ cairo_surface_destroy (surface);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
@@ -1138,13 +1152,15 @@ show_dialog:
{
GtkWidget *eject_image;
eject_button = gtk_button_new_with_mnemonic (_("_Eject"));
- pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
- "media-eject",
- caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_BUTTON),
- 0,
- NULL);
- eject_image = gtk_image_new_from_pixbuf (pixbuf);
- g_object_unref (pixbuf);
+ surface = gtk_icon_theme_load_surface (gtk_icon_theme_get_default (),
+ "media-eject",
+ caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_BUTTON),
+ icon_scale,
+ NULL,
+ 0,
+ NULL);
+ eject_image = gtk_image_new_from_surface (surface);
+ cairo_surface_destroy (surface);
gtk_button_set_image (GTK_BUTTON (eject_button), eject_image);
data->should_eject = TRUE;
}
diff --git a/libcaja-private/caja-bookmark.c b/libcaja-private/caja-bookmark.c
index d4c25939..572d7a68 100644
--- a/libcaja-private/caja-bookmark.c
+++ b/libcaja-private/caja-bookmark.c
@@ -212,17 +212,15 @@ caja_bookmark_get_has_custom_name (CajaBookmark *bookmark)
return (bookmark->details->has_custom_name);
}
-
-GdkPixbuf *
-caja_bookmark_get_pixbuf (CajaBookmark *bookmark,
- GtkIconSize stock_size)
+cairo_surface_t *
+caja_bookmark_get_surface (CajaBookmark *bookmark,
+ GtkIconSize stock_size)
{
- GdkPixbuf *result;
+ cairo_surface_t *result;
GIcon *icon;
CajaIconInfo *info;
int pixel_size, pixel_scale;
-
g_return_val_if_fail (CAJA_IS_BOOKMARK (bookmark), NULL);
icon = caja_bookmark_get_icon (bookmark);
@@ -234,7 +232,7 @@ caja_bookmark_get_pixbuf (CajaBookmark *bookmark,
pixel_size = caja_get_icon_size_for_stock_size (stock_size);
pixel_scale = gdk_window_get_scale_factor (gdk_get_default_root_window ());
info = caja_icon_info_lookup (icon, pixel_size, pixel_scale);
- result = caja_icon_info_get_pixbuf_at_size (info, pixel_size);
+ result = caja_icon_info_get_surface_at_size (info, pixel_size);
g_object_unref (info);
g_object_unref (icon);
@@ -590,18 +588,18 @@ caja_bookmark_new (GFile *location, const char *name, gboolean has_custom_name,
static GtkWidget *
create_image_widget_for_bookmark (CajaBookmark *bookmark)
{
- GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
GtkWidget *widget;
- pixbuf = caja_bookmark_get_pixbuf (bookmark, GTK_ICON_SIZE_MENU);
- if (pixbuf == NULL)
+ surface = caja_bookmark_get_surface (bookmark, GTK_ICON_SIZE_MENU);
+ if (surface == NULL)
{
return NULL;
}
- widget = gtk_image_new_from_pixbuf (pixbuf);
+ widget = gtk_image_new_from_surface (surface);
- g_object_unref (pixbuf);
+ cairo_surface_destroy (surface);
return widget;
}
diff --git a/libcaja-private/caja-bookmark.h b/libcaja-private/caja-bookmark.h
index 3aa99645..e8c09149 100644
--- a/libcaja-private/caja-bookmark.h
+++ b/libcaja-private/caja-bookmark.h
@@ -93,7 +93,7 @@ char * caja_bookmark_get_scroll_pos (CajaBookmark *b
/* Helper functions for displaying bookmarks */
-GdkPixbuf * caja_bookmark_get_pixbuf (CajaBookmark *bookmark,
+cairo_surface_t * caja_bookmark_get_surface (CajaBookmark *bookmark,
GtkIconSize icon_size);
GtkWidget * caja_bookmark_menu_item_new (CajaBookmark *bookmark);
diff --git a/libcaja-private/caja-icon-canvas-item.c b/libcaja-private/caja-icon-canvas-item.c
index 98551be4..162fb338 100644
--- a/libcaja-private/caja-icon-canvas-item.c
+++ b/libcaja-private/caja-icon-canvas-item.c
@@ -525,7 +525,6 @@ caja_icon_canvas_item_get_drag_surface (CajaIconCanvasItem *item)
cairo_surface_t *surface;
EelCanvas *canvas;
- GdkScreen *screen;
int width, height;
int pix_width, pix_height;
int item_offset_x, item_offset_y;
@@ -542,7 +541,6 @@ caja_icon_canvas_item_get_drag_surface (CajaIconCanvasItem *item)
g_return_val_if_fail (CAJA_IS_ICON_CANVAS_ITEM (item), NULL);
canvas = EEL_CANVAS_ITEM (item)->canvas;
- screen = gtk_widget_get_screen (GTK_WIDGET (canvas));
context = gtk_widget_get_style_context (GTK_WIDGET (canvas));
gtk_style_context_save (context);
@@ -2462,7 +2460,7 @@ caja_icon_canvas_item_get_icon_rectangle (const CajaIconCanvasItem *item)
rectangle.y0 = item->details->y;
pixels_per_unit = EEL_CANVAS_ITEM (item)->canvas->pixels_per_unit;
- get_scaled_icon_size (EEL_CANVAS_ITEM (item), &width, &height);
+ get_scaled_icon_size (CAJA_ICON_CANVAS_ITEM (item), &width, &height);
rectangle.x1 = rectangle.x0 + width / pixels_per_unit;
rectangle.y1 = rectangle.y0 + height / pixels_per_unit;
diff --git a/libcaja-private/caja-icon-info.c b/libcaja-private/caja-icon-info.c
index 70b75ecb..75c3330c 100644
--- a/libcaja-private/caja-icon-info.c
+++ b/libcaja-private/caja-icon-info.c
@@ -558,6 +558,18 @@ caja_icon_info_get_pixbuf_nodefault (CajaIconInfo *icon)
return res;
}
+cairo_surface_t *
+caja_icon_info_get_surface_nodefault (CajaIconInfo *icon)
+{
+ GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
+
+ pixbuf = caja_icon_info_get_pixbuf_nodefault (icon);
+ surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, icon->orig_scale, NULL);
+ g_object_unref (pixbuf);
+
+ return surface;
+}
GdkPixbuf *
caja_icon_info_get_pixbuf (CajaIconInfo *icon)
@@ -581,6 +593,19 @@ caja_icon_info_get_pixbuf (CajaIconInfo *icon)
return res;
}
+cairo_surface_t *
+caja_icon_info_get_surface (CajaIconInfo *icon)
+{
+ GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
+
+ pixbuf = caja_icon_info_get_pixbuf (icon);
+ surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, icon->orig_scale, NULL);
+ g_object_unref (pixbuf);
+
+ return surface;
+}
+
GdkPixbuf *
caja_icon_info_get_pixbuf_nodefault_at_size (CajaIconInfo *icon,
gsize forced_size)
@@ -610,6 +635,19 @@ caja_icon_info_get_pixbuf_nodefault_at_size (CajaIconInfo *icon,
return scaled_pixbuf;
}
+cairo_surface_t *
+caja_icon_info_get_surface_nodefault_at_size (CajaIconInfo *icon,
+ gsize forced_size)
+{
+ GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
+
+ pixbuf = caja_icon_info_get_pixbuf_nodefault_at_size (icon, forced_size);
+ surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, icon->orig_scale, NULL);
+ g_object_unref (pixbuf);
+
+ return surface;
+}
GdkPixbuf *
caja_icon_info_get_pixbuf_at_size (CajaIconInfo *icon,
@@ -621,6 +659,9 @@ caja_icon_info_get_pixbuf_at_size (CajaIconInfo *icon,
pixbuf = caja_icon_info_get_pixbuf (icon);
+ if (pixbuf == NULL)
+ return NULL;
+
w = gdk_pixbuf_get_width (pixbuf) / icon->orig_scale;
h = gdk_pixbuf_get_height (pixbuf) / icon->orig_scale;
s = MAX (w, h);
@@ -637,6 +678,20 @@ caja_icon_info_get_pixbuf_at_size (CajaIconInfo *icon,
return scaled_pixbuf;
}
+cairo_surface_t *
+caja_icon_info_get_surface_at_size (CajaIconInfo *icon,
+ gsize forced_size)
+{
+ GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
+
+ pixbuf = caja_icon_info_get_pixbuf_at_size (icon, forced_size);
+ surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, icon->orig_scale, NULL);
+ g_object_unref (pixbuf);
+
+ return surface;
+}
+
gboolean
caja_icon_info_get_embedded_rect (CajaIconInfo *icon,
GdkRectangle *rectangle)
diff --git a/libcaja-private/caja-icon-info.h b/libcaja-private/caja-icon-info.h
index d456e575..10c62b4b 100644
--- a/libcaja-private/caja-icon-info.h
+++ b/libcaja-private/caja-icon-info.h
@@ -69,11 +69,17 @@ extern "C" {
int scale);
gboolean caja_icon_info_is_fallback (CajaIconInfo *icon);
GdkPixbuf * caja_icon_info_get_pixbuf (CajaIconInfo *icon);
+ cairo_surface_t * caja_icon_info_get_surface (CajaIconInfo *icon);
GdkPixbuf * caja_icon_info_get_pixbuf_nodefault (CajaIconInfo *icon);
+ cairo_surface_t * caja_icon_info_get_surface_nodefault (CajaIconInfo *icon);
GdkPixbuf * caja_icon_info_get_pixbuf_nodefault_at_size (CajaIconInfo *icon,
gsize forced_size);
+ cairo_surface_t * caja_icon_info_get_surface_nodefault_at_size(CajaIconInfo *icon,
+ gsize forced_size);
GdkPixbuf * caja_icon_info_get_pixbuf_at_size (CajaIconInfo *icon,
gsize forced_size);
+ cairo_surface_t * caja_icon_info_get_surface_at_size(CajaIconInfo *icon,
+ gsize forced_size);
gboolean caja_icon_info_get_embedded_rect (CajaIconInfo *icon,
GdkRectangle *rectangle);
gboolean caja_icon_info_get_attach_points (CajaIconInfo *icon,
diff --git a/libcaja-private/caja-open-with-dialog.c b/libcaja-private/caja-open-with-dialog.c
index bbbdcf34..3f93d219 100644
--- a/libcaja-private/caja-open-with-dialog.c
+++ b/libcaja-private/caja-open-with-dialog.c
@@ -35,6 +35,7 @@
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
+#include <cairo-gobject.h>
#define sure_string(s) ((const char *)((s)!=NULL?(s):""))
#define DESKTOP_ENTRY_GROUP "Desktop Entry"
@@ -490,19 +491,29 @@ entry_changed_cb (GtkWidget *entry,
}
}
-static GdkPixbuf *
-get_pixbuf_for_icon (GIcon *icon)
+#define CAJA_OPEN_WITH_DIALOG_ICON_SIZE 24
+static cairo_surface_t *
+get_surface_for_icon (GIcon *icon)
{
- GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
char *filename;
+ gint icon_scale;
+
+ surface = NULL;
+ icon_scale = gdk_window_get_scale_factor (gdk_get_default_root_window ());
- pixbuf = NULL;
if (G_IS_FILE_ICON (icon))
{
filename = g_file_get_path (g_file_icon_get_file (G_FILE_ICON (icon)));
if (filename)
{
- pixbuf = gdk_pixbuf_new_from_file_at_size (filename, 24, 24, NULL);
+ GdkPixbuf *pixbuf;
+ pixbuf = gdk_pixbuf_new_from_file_at_size (filename,
+ CAJA_OPEN_WITH_DIALOG_ICON_SIZE * icon_scale,
+ CAJA_OPEN_WITH_DIALOG_ICON_SIZE * icon_scale,
+ NULL);
+ surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, icon_scale, NULL);
+ g_object_unref (pixbuf);
}
g_free (filename);
}
@@ -525,22 +536,27 @@ get_pixbuf_for_icon (GIcon *icon)
{
*p = 0;
}
- pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
- icon_no_extension, 24, GTK_ICON_LOOKUP_FORCE_SIZE, NULL);
+ surface = gtk_icon_theme_load_surface (gtk_icon_theme_get_default (),
+ icon_no_extension,
+ CAJA_OPEN_WITH_DIALOG_ICON_SIZE,
+ icon_scale,
+ NULL,
+ GTK_ICON_LOOKUP_FORCE_SIZE,
+ NULL);
g_free (icon_no_extension);
}
}
- return pixbuf;
+ return surface;
}
static gboolean
caja_open_with_dialog_add_icon_idle (CajaOpenWithDialog *dialog)
{
- GtkTreeIter iter;
- GtkTreePath *path;
- GdkPixbuf *pixbuf;
- GIcon *icon;
- gboolean long_operation;
+ GtkTreeIter iter;
+ GtkTreePath *path;
+ cairo_surface_t *surface;
+ GIcon *icon;
+ gboolean long_operation;
long_operation = FALSE;
do
@@ -573,12 +589,12 @@ caja_open_with_dialog_add_icon_idle (CajaOpenWithDialog *dialog)
continue;
}
- pixbuf = get_pixbuf_for_icon (icon);
- if (pixbuf)
+ surface = get_surface_for_icon (icon);
+ if (surface)
{
long_operation = TRUE;
- gtk_list_store_set (dialog->details->program_list_store, &iter, COLUMN_ICON, pixbuf, -1);
- g_object_unref (pixbuf);
+ gtk_list_store_set (dialog->details->program_list_store, &iter, COLUMN_ICON, surface, -1);
+ cairo_surface_destroy (surface);
}
/* don't go back into the main loop if this wasn't very hard to do */
@@ -675,7 +691,7 @@ caja_open_with_dialog_add_items_idle (CajaOpenWithDialog *dialog)
/* create list store */
dialog->details->program_list_store = gtk_list_store_new (NUM_COLUMNS,
G_TYPE_APP_INFO,
- GDK_TYPE_PIXBUF,
+ CAIRO_GOBJECT_TYPE_SURFACE,
G_TYPE_ICON,
G_TYPE_STRING,
G_TYPE_STRING,
@@ -723,7 +739,7 @@ caja_open_with_dialog_add_items_idle (CajaOpenWithDialog *dialog)
column = gtk_tree_view_column_new ();
gtk_tree_view_column_pack_start (column, renderer, FALSE);
gtk_tree_view_column_set_attributes (column, renderer,
- "pixbuf", COLUMN_ICON,
+ "surface", COLUMN_ICON,
NULL);
renderer = gtk_cell_renderer_text_new ();
diff --git a/libcaja-private/caja-ui-utilities.c b/libcaja-private/caja-ui-utilities.c
index 0bd096e1..3ae1225b 100644
--- a/libcaja-private/caja-ui-utilities.c
+++ b/libcaja-private/caja-ui-utilities.c
@@ -137,13 +137,13 @@ extension_action_sensitive_callback (CajaMenuItem *item,
gtk_action_set_sensitive (GTK_ACTION (user_data), value);
}
-static GdkPixbuf *
+static cairo_surface_t *
get_action_icon (const char *icon_name,
int size,
GtkWidget *parent_widget)
{
CajaIconInfo *info;
- GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
int scale;
scale = gtk_widget_get_scale_factor (parent_widget);
@@ -156,10 +156,10 @@ get_action_icon (const char *icon_name,
{
info = caja_icon_info_lookup_from_name (icon_name, size, scale);
}
- pixbuf = caja_icon_info_get_pixbuf_nodefault_at_size (info, size);
+ surface = caja_icon_info_get_surface_nodefault_at_size (info, size);
g_object_unref (info);
- return pixbuf;
+ return surface;
}
GtkAction *
@@ -169,7 +169,7 @@ caja_action_from_menu_item (CajaMenuItem *item,
char *name, *label, *tip, *icon_name;
gboolean sensitive, priority;
GtkAction *action;
- GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
g_object_get (G_OBJECT (item),
"name", &name, "label", &label,
@@ -185,14 +185,14 @@ caja_action_from_menu_item (CajaMenuItem *item,
if (icon_name != NULL)
{
- pixbuf = get_action_icon (icon_name,
- caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU),
- parent_widget);
- if (pixbuf != NULL)
+ surface = get_action_icon (icon_name,
+ caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU),
+ parent_widget);
+ if (surface != NULL)
{
g_object_set_data_full (G_OBJECT (action), "menu-icon",
- pixbuf,
- g_object_unref);
+ surface,
+ cairo_surface_destroy);
}
}
@@ -218,7 +218,7 @@ caja_toolbar_action_from_menu_item (CajaMenuItem *item, GtkWidget *parent_widget
char *name, *label, *tip, *icon_name;
gboolean sensitive, priority;
GtkAction *action;
- GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
g_object_get (G_OBJECT (item),
"name", &name, "label", &label,
@@ -234,14 +234,14 @@ caja_toolbar_action_from_menu_item (CajaMenuItem *item, GtkWidget *parent_widget
if (icon_name != NULL)
{
- pixbuf = get_action_icon (icon_name,
- caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_LARGE_TOOLBAR),
- parent_widget);
- if (pixbuf != NULL)
+ surface = get_action_icon (icon_name,
+ caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_LARGE_TOOLBAR),
+ parent_widget);
+ if (surface != NULL)
{
g_object_set_data_full (G_OBJECT (action), "toolbar-icon",
- pixbuf,
- g_object_unref);
+ surface,
+ cairo_surface_destroy);
}
}
diff --git a/src/caja-bookmarks-window.c b/src/caja-bookmarks-window.c
index 60254cfd..e94ce944 100644
--- a/src/caja-bookmarks-window.c
+++ b/src/caja-bookmarks-window.c
@@ -35,6 +35,7 @@
#include <eel/eel-mate-extensions.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
+#include <cairo-gobject.h>
/* Static variables to keep track of window state. If there were
* more than one bookmark-editing window, these would be struct or
@@ -176,7 +177,7 @@ static GtkListStore *
create_bookmark_store (void)
{
return gtk_list_store_new (BOOKMARK_LIST_COLUMN_COUNT,
- GDK_TYPE_PIXBUF,
+ CAIRO_GOBJECT_TYPE_SURFACE,
G_TYPE_STRING,
G_TYPE_OBJECT,
PANGO_TYPE_STYLE);
@@ -296,7 +297,7 @@ create_bookmarks_window (CajaBookmarkList *list, CajaWindow *window_source)
rend = gtk_cell_renderer_pixbuf_new ();
col = gtk_tree_view_column_new_with_attributes ("Icon",
rend,
- "pixbuf",
+ "surface",
BOOKMARK_LIST_COLUMN_ICON,
NULL);
gtk_tree_view_append_column (bookmark_list_widget,
@@ -839,7 +840,7 @@ update_bookmark_from_text (void)
{
CajaBookmark *bookmark, *bookmark_in_list;
char *name;
- GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
guint selected_row;
GtkTreeIter iter;
GFile *location;
@@ -885,17 +886,17 @@ update_bookmark_from_text (void)
name = caja_bookmark_get_name (bookmark_in_list);
- pixbuf = caja_bookmark_get_pixbuf (bookmark_in_list, GTK_ICON_SIZE_MENU);
+ surface = caja_bookmark_get_surface (bookmark_in_list, GTK_ICON_SIZE_MENU);
gtk_list_store_set (bookmark_list_store, &iter,
BOOKMARK_LIST_COLUMN_BOOKMARK, bookmark_in_list,
BOOKMARK_LIST_COLUMN_NAME, name,
- BOOKMARK_LIST_COLUMN_ICON, pixbuf,
+ BOOKMARK_LIST_COLUMN_ICON, surface,
-1);
g_signal_handler_unblock (bookmark_list_store,
row_changed_signal_id);
- g_object_unref (pixbuf);
+ cairo_surface_destroy (surface);
g_free (name);
}
}
@@ -1018,16 +1019,16 @@ repopulate (void)
{
CajaBookmark *bookmark;
char *bookmark_name;
- GdkPixbuf *bookmark_pixbuf;
+ cairo_surface_t *bookmark_surface;
GtkTreeIter iter;
bookmark = caja_bookmark_list_item_at (bookmarks, index);
bookmark_name = caja_bookmark_get_name (bookmark);
- bookmark_pixbuf = caja_bookmark_get_pixbuf (bookmark, GTK_ICON_SIZE_MENU);
+ bookmark_surface = caja_bookmark_get_surface (bookmark, GTK_ICON_SIZE_MENU);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
- BOOKMARK_LIST_COLUMN_ICON, bookmark_pixbuf,
+ BOOKMARK_LIST_COLUMN_ICON, bookmark_surface,
BOOKMARK_LIST_COLUMN_NAME, bookmark_name,
BOOKMARK_LIST_COLUMN_BOOKMARK, bookmark,
BOOKMARK_LIST_COLUMN_STYLE, PANGO_STYLE_NORMAL,
@@ -1044,7 +1045,7 @@ repopulate (void)
}
g_free (bookmark_name);
- g_object_unref (bookmark_pixbuf);
+ cairo_surface_destroy (bookmark_surface);
}
g_signal_handler_unblock (store, row_changed_signal_id);
diff --git a/src/caja-emblem-sidebar.c b/src/caja-emblem-sidebar.c
index a1c7f573..c0842355 100644
--- a/src/caja-emblem-sidebar.c
+++ b/src/caja-emblem-sidebar.c
@@ -386,15 +386,13 @@ create_emblem_widget_with_pixbuf (CajaEmblemSidebar *emblem_sidebar,
{
GtkWidget *image, *event_box;
GdkPixbuf *prelight_pixbuf;
- gint scale;
image = eel_labeled_image_new (display_name, pixbuf);
- scale = gtk_widget_get_scale_factor (image);
eel_labeled_image_set_fixed_image_height (EEL_LABELED_IMAGE (image),
- STANDARD_EMBLEM_HEIGHT * scale);
+ STANDARD_EMBLEM_HEIGHT);
eel_labeled_image_set_spacing (EEL_LABELED_IMAGE (image),
- EMBLEM_LABEL_SPACING * scale);
+ EMBLEM_LABEL_SPACING);
event_box = gtk_event_box_new ();
gtk_container_add (GTK_CONTAINER (event_box), image);
@@ -450,10 +448,8 @@ create_emblem_widget (CajaEmblemSidebar *emblem_sidebar,
char *keyword;
GdkPixbuf *pixbuf;
CajaIconInfo *info;
- gint scale;
- scale = gtk_widget_get_scale_factor (GTK_WIDGET (emblem_sidebar->details->emblems_table));
- info = caja_icon_info_lookup_from_name (name, CAJA_ICON_SIZE_STANDARD, scale);
+ info = caja_icon_info_lookup_from_name (name, CAJA_ICON_SIZE_STANDARD, 1);
pixbuf = caja_icon_info_get_pixbuf_at_size (info, CAJA_ICON_SIZE_STANDARD);
diff --git a/src/caja-history-sidebar.c b/src/caja-history-sidebar.c
index de4e71dc..2b6ddd92 100644
--- a/src/caja-history-sidebar.c
+++ b/src/caja-history-sidebar.c
@@ -30,6 +30,7 @@
#include <eel/eel-gtk-extensions.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
+#include <cairo-gobject.h>
#include <libcaja-private/caja-bookmark.h>
#include <libcaja-private/caja-global-preferences.h>
#include <libcaja-private/caja-sidebar-provider.h>
@@ -89,8 +90,8 @@ update_history (CajaHistorySidebar *sidebar)
{
GtkListStore *store;
GtkTreeSelection *selection;
- CajaBookmark *bookmark;
- GdkPixbuf *pixbuf;
+ CajaBookmark *bookmark;
+ cairo_surface_t *surface;
GtkTreeIter iter;
char *name;
GList *l, *history;
@@ -104,19 +105,19 @@ update_history (CajaHistorySidebar *sidebar)
{
bookmark = caja_bookmark_copy (l->data);
- pixbuf = caja_bookmark_get_pixbuf (bookmark, GTK_ICON_SIZE_MENU);
+ surface = caja_bookmark_get_surface (bookmark, GTK_ICON_SIZE_MENU);
name = caja_bookmark_get_name (bookmark);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
- HISTORY_SIDEBAR_COLUMN_ICON, pixbuf,
+ HISTORY_SIDEBAR_COLUMN_ICON, surface,
HISTORY_SIDEBAR_COLUMN_NAME, name,
HISTORY_SIDEBAR_COLUMN_BOOKMARK, bookmark,
-1);
g_object_unref (bookmark);
- if (pixbuf != NULL)
+ if (surface != NULL)
{
- g_object_unref (pixbuf);
+ cairo_surface_destroy (surface);
}
g_free (name);
}
@@ -249,7 +250,7 @@ caja_history_sidebar_init (CajaHistorySidebar *sidebar)
cell = gtk_cell_renderer_pixbuf_new ();
gtk_tree_view_column_pack_start (col, cell, FALSE);
gtk_tree_view_column_set_attributes (col, cell,
- "pixbuf", HISTORY_SIDEBAR_COLUMN_ICON,
+ "surface", HISTORY_SIDEBAR_COLUMN_ICON,
NULL);
cell = gtk_cell_renderer_text_new ();
@@ -262,7 +263,7 @@ caja_history_sidebar_init (CajaHistorySidebar *sidebar)
gtk_tree_view_append_column (tree_view, col);
store = gtk_list_store_new (HISTORY_SIDEBAR_COLUMN_COUNT,
- GDK_TYPE_PIXBUF,
+ CAIRO_GOBJECT_TYPE_SURFACE,
G_TYPE_STRING,
CAJA_TYPE_BOOKMARK);
diff --git a/src/caja-pathbar.c b/src/caja-pathbar.c
index 533f2f7f..fe0a0590 100644
--- a/src/caja-pathbar.c
+++ b/src/caja-pathbar.c
@@ -75,7 +75,7 @@ struct _ButtonData
unsigned int file_changed_signal_id;
/* custom icon */
- GdkPixbuf *custom_icon;
+ cairo_surface_t *custom_icon;
/* flag to indicate its the base folder in the URI */
gboolean is_base_dir;
@@ -218,12 +218,12 @@ trash_state_changed_cb (CajaTrashMonitor *monitor,
{
GIcon *icon;
CajaIconInfo *icon_info;
- GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
icon = caja_trash_monitor_get_icon ();
icon_info = caja_icon_info_lookup (icon, CAJA_PATH_BAR_ICON_SIZE, scale);
- pixbuf = caja_icon_info_get_pixbuf_at_size (icon_info, CAJA_PATH_BAR_ICON_SIZE);
- gtk_image_set_from_pixbuf (GTK_IMAGE (button_data->image), pixbuf);
+ surface = caja_icon_info_get_surface_at_size (icon_info, CAJA_PATH_BAR_ICON_SIZE);
+ gtk_image_set_from_surface (GTK_IMAGE (button_data->image), surface);
}
}
g_object_unref (file);
@@ -1382,7 +1382,7 @@ button_data_free (ButtonData *button_data)
g_free (button_data->dir_name);
if (button_data->custom_icon)
{
- g_object_unref (button_data->custom_icon);
+ cairo_surface_destroy (button_data->custom_icon);
}
if (button_data->file != NULL)
{
@@ -1447,7 +1447,7 @@ static void
caja_path_bar_update_button_appearance (ButtonData *button_data)
{
CajaIconInfo *icon_info;
- GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
const gchar *dir_name = get_dir_name (button_data);
if (button_data->label != NULL)
@@ -1474,27 +1474,27 @@ caja_path_bar_update_button_appearance (ButtonData *button_data)
{
if (button_data->custom_icon)
{
- gtk_image_set_from_pixbuf (GTK_IMAGE (button_data->image), button_data->custom_icon);
+ gtk_image_set_from_surface (GTK_IMAGE (button_data->image), button_data->custom_icon);
gtk_widget_show (GTK_WIDGET (button_data->image));
}
else
{
icon_info = get_type_icon_info (button_data);
- pixbuf = NULL;
+ surface = NULL;
if (icon_info != NULL)
{
- pixbuf = caja_icon_info_get_pixbuf_at_size (icon_info, CAJA_PATH_BAR_ICON_SIZE);
+ surface = caja_icon_info_get_surface_at_size (icon_info, CAJA_PATH_BAR_ICON_SIZE);
g_object_unref (icon_info);
}
- if (pixbuf != NULL)
+ if (surface != NULL)
{
- gtk_image_set_from_pixbuf (GTK_IMAGE (button_data->image), pixbuf);
+ gtk_image_set_from_surface (GTK_IMAGE (button_data->image), surface);
gtk_style_context_add_class (gtk_widget_get_style_context (button_data->button),
"image-button");
gtk_widget_show (GTK_WIDGET (button_data->image));
- g_object_unref (pixbuf);
+ cairo_surface_destroy (surface);
}
else
{
@@ -1567,7 +1567,7 @@ setup_file_path_mounted_mount (GFile *location, ButtonData *button_data)
}
info = caja_icon_info_lookup (icon, CAJA_PATH_BAR_ICON_SIZE, scale);
g_object_unref (icon);
- button_data->custom_icon = caja_icon_info_get_pixbuf_at_size (info, CAJA_PATH_BAR_ICON_SIZE);
+ button_data->custom_icon = caja_icon_info_get_surface_at_size (info, CAJA_PATH_BAR_ICON_SIZE);
g_object_unref (info);
button_data->dir_name = g_mount_get_name (mount);
button_data->type = MOUNT_BUTTON;
@@ -1591,7 +1591,7 @@ setup_file_path_mounted_mount (GFile *location, ButtonData *button_data)
}
info = caja_icon_info_lookup (icon, CAJA_PATH_BAR_ICON_SIZE, scale);
g_object_unref (icon);
- button_data->custom_icon = caja_icon_info_get_pixbuf_at_size (info, CAJA_PATH_BAR_ICON_SIZE);
+ button_data->custom_icon = caja_icon_info_get_surface_at_size (info, CAJA_PATH_BAR_ICON_SIZE);
g_object_unref (info);
button_data->type = DEFAULT_LOCATION_BUTTON;
button_data->fake_root = TRUE;
diff --git a/src/caja-places-sidebar.c b/src/caja-places-sidebar.c
index 49ca3e56..2b1ade5a 100644
--- a/src/caja-places-sidebar.c
+++ b/src/caja-places-sidebar.c
@@ -49,6 +49,7 @@
#include <libcaja-private/caja-window-slot-info.h>
#include <gio/gio.h>
#include <libnotify/notify.h>
+#include <cairo-gobject.h>
#include "caja-bookmark-list.h"
#include "caja-places-sidebar.h"
@@ -228,10 +229,11 @@ G_DEFINE_TYPE_WITH_CODE (CajaPlacesSidebarProvider, caja_places_sidebar_provider
G_IMPLEMENT_INTERFACE (CAJA_TYPE_SIDEBAR_PROVIDER,
sidebar_provider_iface_init));
-static GdkPixbuf *
+static cairo_surface_t *
get_eject_icon (gboolean highlighted)
{
GdkPixbuf *eject;
+ cairo_surface_t *eject_surface;
CajaIconInfo *eject_icon_info;
int icon_size, icon_scale;
@@ -248,9 +250,12 @@ get_eject_icon (gboolean highlighted)
eject = high;
}
+ eject_surface = gdk_cairo_surface_create_from_pixbuf (eject, icon_scale, NULL);
+
g_object_unref (eject_icon_info);
+ g_object_unref (eject);
- return eject;
+ return eject_surface;
}
static gboolean
@@ -338,15 +343,16 @@ add_place (CajaPlacesSidebar *sidebar,
const int index,
const char *tooltip)
{
- GdkPixbuf *pixbuf;
- GtkTreeIter iter, child_iter;
- GdkPixbuf *eject;
- CajaIconInfo *icon_info;
- int icon_size;
- int icon_scale;
- gboolean show_eject;
- gboolean show_unmount;
- gboolean show_eject_button;
+ GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
+ GtkTreeIter iter, child_iter;
+ cairo_surface_t *eject;
+ CajaIconInfo *icon_info;
+ int icon_size;
+ int icon_scale;
+ gboolean show_eject;
+ gboolean show_unmount;
+ gboolean show_eject_button;
check_heading_for_section (sidebar, section_type);
@@ -357,6 +363,16 @@ add_place (CajaPlacesSidebar *sidebar,
pixbuf = caja_icon_info_get_pixbuf_at_size (icon_info, icon_size);
g_object_unref (icon_info);
+ if (pixbuf != NULL)
+ {
+ surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, icon_scale, NULL);
+ g_object_unref (pixbuf);
+ }
+ else
+ {
+ surface = NULL;
+ }
+
check_unmount_and_eject (mount, volume, drive,
&show_unmount, &show_eject);
@@ -382,7 +398,7 @@ add_place (CajaPlacesSidebar *sidebar,
gtk_list_store_append (sidebar->store, &iter);
gtk_list_store_set (sidebar->store, &iter,
- PLACES_SIDEBAR_COLUMN_ICON, pixbuf,
+ PLACES_SIDEBAR_COLUMN_ICON, surface,
PLACES_SIDEBAR_COLUMN_NAME, name,
PLACES_SIDEBAR_COLUMN_URI, uri,
PLACES_SIDEBAR_COLUMN_DRIVE, drive,
@@ -398,9 +414,9 @@ add_place (CajaPlacesSidebar *sidebar,
PLACES_SIDEBAR_COLUMN_SECTION_TYPE, section_type,
-1);
- if (pixbuf != NULL)
+ if (surface != NULL)
{
- g_object_unref (pixbuf);
+ cairo_surface_destroy (surface);
}
gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (sidebar->filter_model));
gtk_tree_model_filter_convert_child_iter_to_iter (GTK_TREE_MODEL_FILTER (sidebar->filter_model),
@@ -3187,7 +3203,7 @@ caja_places_sidebar_init (CajaPlacesSidebar *sidebar)
cell = gtk_cell_renderer_pixbuf_new ();
gtk_tree_view_column_pack_start (col, cell, FALSE);
gtk_tree_view_column_set_attributes (col, cell,
- "pixbuf", PLACES_SIDEBAR_COLUMN_ICON,
+ "surface", PLACES_SIDEBAR_COLUMN_ICON,
NULL);
gtk_tree_view_column_set_cell_data_func (col, cell,
icon_cell_renderer_func,
@@ -3219,7 +3235,7 @@ caja_places_sidebar_init (CajaPlacesSidebar *sidebar)
gtk_tree_view_column_pack_start (col, cell, FALSE);
gtk_tree_view_column_set_attributes (col, cell,
"visible", PLACES_SIDEBAR_COLUMN_EJECT,
- "pixbuf", PLACES_SIDEBAR_COLUMN_EJECT_ICON,
+ "surface", PLACES_SIDEBAR_COLUMN_EJECT_ICON,
NULL);
/* normal text renderer */
@@ -3252,13 +3268,13 @@ caja_places_sidebar_init (CajaPlacesSidebar *sidebar)
G_TYPE_VOLUME,
G_TYPE_MOUNT,
G_TYPE_STRING,
- GDK_TYPE_PIXBUF,
+ CAIRO_GOBJECT_TYPE_SURFACE,
G_TYPE_INT,
G_TYPE_BOOLEAN,
G_TYPE_BOOLEAN,
G_TYPE_BOOLEAN,
G_TYPE_STRING,
- GDK_TYPE_PIXBUF,
+ CAIRO_GOBJECT_TYPE_SURFACE,
G_TYPE_INT,
G_TYPE_STRING);
diff --git a/src/caja-property-browser.c b/src/caja-property-browser.c
index 90bcff16..15cfc169 100644
--- a/src/caja-property-browser.c
+++ b/src/caja-property-browser.c
@@ -722,7 +722,6 @@ make_drag_image (CajaPropertyBrowser *property_browser, const char* file_name)
char *icon_name;
gboolean is_reset;
CajaIconInfo *info;
- gint icon_scale;
if (property_browser->details->category_type == CAJA_PROPERTY_EMBLEM)
{
@@ -740,8 +739,7 @@ make_drag_image (CajaPropertyBrowser *property_browser, const char* file_name)
else
{
icon_name = caja_emblem_get_icon_name_from_keyword (file_name);
- icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (property_browser->details->content_table));
- info = caja_icon_info_lookup_from_name (icon_name, CAJA_ICON_SIZE_STANDARD, icon_scale);
+ info = caja_icon_info_lookup_from_name (icon_name, CAJA_ICON_SIZE_STANDARD, 1);
pixbuf = caja_icon_info_get_pixbuf_at_size (info, CAJA_ICON_SIZE_STANDARD);
g_object_unref (info);
g_free (icon_name);
@@ -1797,7 +1795,6 @@ make_properties_from_directories (CajaPropertyBrowser *property_browser)
guint num_images;
char *path;
CajaIconInfo *info;
- gint icon_scale;
g_return_if_fail (CAJA_IS_PROPERTY_BROWSER (property_browser));
g_return_if_fail (EEL_IS_IMAGE_TABLE (property_browser->details->content_table));
@@ -1810,7 +1807,6 @@ make_properties_from_directories (CajaPropertyBrowser *property_browser)
property_browser->details->keywords = NULL;
icons = caja_emblem_list_available ();
- icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (property_browser->details->content_table));
property_browser->details->has_local = FALSE;
l = icons;
@@ -1834,7 +1830,7 @@ make_properties_from_directories (CajaPropertyBrowser *property_browser)
g_free (object_name);
continue;
}
- info = caja_icon_info_lookup_from_name (icon_name, CAJA_ICON_SIZE_STANDARD, icon_scale);
+ info = caja_icon_info_lookup_from_name (icon_name, CAJA_ICON_SIZE_STANDARD, 1);
object_pixbuf = caja_icon_info_get_pixbuf_at_size (info, CAJA_ICON_SIZE_STANDARD);
object_label = g_strdup (caja_icon_info_get_display_name (info));
g_object_unref (info);
diff --git a/src/caja-window-menus.c b/src/caja-window-menus.c
index 0cf325dc..e5b462c7 100644
--- a/src/caja-window-menus.c
+++ b/src/caja-window-menus.c
@@ -175,7 +175,7 @@ caja_menus_append_bookmark_to_menu (CajaWindow *window,
char action_name[128];
char *name;
char *path;
- GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
GtkAction *action;
GtkWidget *menuitem;
@@ -185,8 +185,8 @@ caja_menus_append_bookmark_to_menu (CajaWindow *window,
bookmark_holder = bookmark_holder_new (bookmark, window, refresh_callback, failed_callback);
name = caja_bookmark_get_name (bookmark);
- /* Create menu item with pixbuf */
- pixbuf = caja_bookmark_get_pixbuf (bookmark, GTK_ICON_SIZE_MENU);
+ /* Create menu item with surface */
+ surface = caja_bookmark_get_surface (bookmark, GTK_ICON_SIZE_MENU);
g_snprintf (action_name, sizeof (action_name), "%s%d", parent_id, index_in_parent);
@@ -196,8 +196,8 @@ caja_menus_append_bookmark_to_menu (CajaWindow *window,
NULL);
g_object_set_data_full (G_OBJECT (action), "menu-icon",
- g_object_ref (pixbuf),
- g_object_unref);
+ cairo_surface_reference (surface),
+ cairo_surface_destroy);
g_signal_connect_data (action, "activate",
G_CALLBACK (activate_bookmark_in_menu_item),
@@ -223,7 +223,7 @@ caja_menus_append_bookmark_to_menu (CajaWindow *window,
gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (menuitem),
TRUE);
- g_object_unref (pixbuf);
+ cairo_surface_destroy (surface);
g_free (path);
g_free (name);
}
@@ -724,7 +724,7 @@ connect_proxy_cb (GtkUIManager *manager,
GtkWidget *proxy,
CajaWindow *window)
{
- GdkPixbuf *icon;
+ cairo_surface_t *icon;
GtkWidget *widget;
if (GTK_IS_MENU_ITEM (proxy))
@@ -735,12 +735,12 @@ connect_proxy_cb (GtkUIManager *manager,
G_CALLBACK (menu_item_deselect_cb), window);
- /* This is a way to easily get pixbufs into the menu items */
+ /* This is a way to easily get surfaces into the menu items */
icon = g_object_get_data (G_OBJECT (action), "menu-icon");
if (icon != NULL)
{
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (proxy),
- gtk_image_new_from_pixbuf (icon));
+ gtk_image_new_from_surface (icon));
}
}
if (GTK_IS_TOOL_BUTTON (proxy))
@@ -748,7 +748,7 @@ connect_proxy_cb (GtkUIManager *manager,
icon = g_object_get_data (G_OBJECT (action), "toolbar-icon");
if (icon != NULL)
{
- widget = gtk_image_new_from_pixbuf (icon);
+ widget = gtk_image_new_from_surface (icon);
gtk_widget_show (widget);
gtk_tool_button_set_icon_widget (GTK_TOOL_BUTTON (proxy),
widget);
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index 62d4fec1..d753cb68 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -4389,7 +4389,7 @@ add_submenu (GtkUIManager *ui_manager,
const char *parent_path,
const char *uri,
const char *label,
- GdkPixbuf *pixbuf,
+ cairo_surface_t *surface,
gboolean add_action)
{
char *escaped_label;
@@ -4409,10 +4409,10 @@ add_submenu (GtkUIManager *ui_manager,
escaped_label,
NULL,
NULL);
- if (pixbuf != NULL) {
+ if (surface != NULL) {
g_object_set_data_full (G_OBJECT (action), "menu-icon",
- g_object_ref (pixbuf),
- g_object_unref);
+ cairo_surface_reference (surface),
+ cairo_surface_destroy);
}
g_object_set (action, "hide-if-empty", FALSE, NULL);
@@ -4887,12 +4887,12 @@ extension_action_callback (GtkAction *action,
}
}
-static GdkPixbuf *
+static cairo_surface_t *
get_menu_icon (const char *icon_name,
GtkWidget *widget)
{
CajaIconInfo *info;
- GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
int size, scale;
size = caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU);
@@ -4903,28 +4903,28 @@ get_menu_icon (const char *icon_name,
} else {
info = caja_icon_info_lookup_from_name (icon_name, size, scale);
}
- pixbuf = caja_icon_info_get_pixbuf_nodefault_at_size (info, size);
+ surface = caja_icon_info_get_surface_nodefault_at_size (info, size);
g_object_unref (info);
- return pixbuf;
+ return surface;
}
-static GdkPixbuf *
+static cairo_surface_t *
get_menu_icon_for_file (CajaFile *file,
GtkWidget *widget)
{
CajaIconInfo *info;
- GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
int size, scale;
size = caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU);
scale = gtk_widget_get_scale_factor (widget);
info = caja_file_get_icon (file, size, scale, 0);
- pixbuf = caja_icon_info_get_pixbuf_nodefault_at_size (info, size);
+ surface = caja_icon_info_get_surface_nodefault_at_size (info, size);
g_object_unref (info);
- return pixbuf;
+ return surface;
}
static GtkAction *
@@ -4935,7 +4935,7 @@ add_extension_action_for_files (FMDirectoryView *view,
char *name, *label, *tip, *icon;
gboolean sensitive, priority;
GtkAction *action;
- GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
ExtensionActionCallbackData *data;
g_object_get (G_OBJECT (item),
@@ -4951,11 +4951,11 @@ add_extension_action_for_files (FMDirectoryView *view,
icon);
if (icon != NULL) {
- pixbuf = get_menu_icon (icon, GTK_WIDGET (view));
- if (pixbuf != NULL) {
+ surface = get_menu_icon (icon, GTK_WIDGET (view));
+ if (surface != NULL) {
g_object_set_data_full (G_OBJECT (action), "menu-icon",
- pixbuf,
- g_object_unref);
+ surface,
+ cairo_surface_destroy);
}
}
@@ -5400,7 +5400,7 @@ add_script_to_scripts_menus (FMDirectoryView *directory_view,
char *uri;
char *action_name;
char *escaped_label;
- GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
GtkUIManager *ui_manager;
GtkAction *action;
@@ -5418,11 +5418,11 @@ add_script_to_scripts_menus (FMDirectoryView *directory_view,
tip,
NULL);
- pixbuf = get_menu_icon_for_file (file, GTK_WIDGET (directory_view));
- if (pixbuf != NULL) {
+ surface = get_menu_icon_for_file (file, GTK_WIDGET (directory_view));
+ if (surface != NULL) {
g_object_set_data_full (G_OBJECT (action), "menu-icon",
- pixbuf,
- g_object_unref);
+ surface,
+ cairo_surface_destroy);
}
g_signal_connect_data (action, "activate",
@@ -5475,19 +5475,19 @@ add_submenu_to_directory_menus (FMDirectoryView *directory_view,
const char *popup_bg_path)
{
char *name;
- GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
char *uri;
GtkUIManager *ui_manager;
ui_manager = caja_window_info_get_ui_manager (directory_view->details->window);
uri = caja_file_get_uri (file);
name = caja_file_get_display_name (file);
- pixbuf = get_menu_icon_for_file (file, GTK_WIDGET (directory_view));
- add_submenu (ui_manager, action_group, merge_id, menu_path, uri, name, pixbuf, TRUE);
- add_submenu (ui_manager, action_group, merge_id, popup_path, uri, name, pixbuf, FALSE);
- add_submenu (ui_manager, action_group, merge_id, popup_bg_path, uri, name, pixbuf, FALSE);
- if (pixbuf) {
- g_object_unref (pixbuf);
+ surface = get_menu_icon_for_file (file, GTK_WIDGET (directory_view));
+ add_submenu (ui_manager, action_group, merge_id, menu_path, uri, name, surface, TRUE);
+ add_submenu (ui_manager, action_group, merge_id, popup_path, uri, name, surface, FALSE);
+ add_submenu (ui_manager, action_group, merge_id, popup_bg_path, uri, name, surface, FALSE);
+ if (surface) {
+ cairo_surface_destroy (surface);
}
g_free (name);
g_free (uri);
@@ -5646,7 +5646,7 @@ add_template_to_templates_menus (FMDirectoryView *directory_view,
{
char *tmp, *tip, *uri, *name;
char *escaped_label;
- GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
char *action_name;
CreateTemplateParameters *parameters;
GtkUIManager *ui_manager;
@@ -5669,11 +5669,11 @@ add_template_to_templates_menus (FMDirectoryView *directory_view,
tip,
NULL);
- pixbuf = get_menu_icon_for_file (file, GTK_WIDGET (directory_view));
- if (pixbuf != NULL) {
+ surface = get_menu_icon_for_file (file, GTK_WIDGET (directory_view));
+ if (surface != NULL) {
g_object_set_data_full (G_OBJECT (action), "menu-icon",
- pixbuf,
- g_object_unref);
+ surface,
+ cairo_surface_destroy);
}
g_signal_connect_data (action, "activate",
@@ -7562,17 +7562,17 @@ connect_proxy (FMDirectoryView *view,
GtkWidget *proxy,
GtkActionGroup *action_group)
{
- GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
GtkWidget *image;
if (strcmp (gtk_action_get_name (action), FM_ACTION_NEW_EMPTY_FILE) == 0 &&
GTK_IS_IMAGE_MENU_ITEM (proxy)) {
- pixbuf = get_menu_icon ("text-x-generic", GTK_WIDGET (view));
- if (pixbuf != NULL) {
- image = gtk_image_new_from_pixbuf (pixbuf);
+ surface = get_menu_icon ("text-x-generic", GTK_WIDGET (view));
+ if (surface != NULL) {
+ image = gtk_image_new_from_surface (surface);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (proxy), image);
- g_object_unref (pixbuf);
+ cairo_surface_destroy (surface);
}
}
}
diff --git a/src/file-manager/fm-tree-model.c b/src/file-manager/fm-tree-model.c
index e3bcfd3c..fd9bf074 100644
--- a/src/file-manager/fm-tree-model.c
+++ b/src/file-manager/fm-tree-model.c
@@ -36,6 +36,7 @@
#include <libcaja-private/caja-file.h>
#include <gtk/gtk.h>
#include <string.h>
+#include <cairo-gobject.h>
enum
{
@@ -64,8 +65,8 @@ struct TreeNode
char *display_name;
GIcon *icon;
GMount *mount;
- GdkPixbuf *closed_pixbuf;
- GdkPixbuf *open_pixbuf;
+ cairo_surface_t *closed_surface;
+ cairo_surface_t *open_surface;
FMTreeModelRoot *root;
@@ -217,8 +218,11 @@ tree_node_destroy (FMTreeModel *model, TreeNode *node)
g_object_unref (node->file);
g_free (node->display_name);
object_unref_if_not_NULL (node->icon);
- object_unref_if_not_NULL (node->closed_pixbuf);
- object_unref_if_not_NULL (node->open_pixbuf);
+
+ if (node->closed_surface != NULL)
+ cairo_surface_destroy (node->closed_surface);
+ if (node->open_surface)
+ cairo_surface_destroy (node->open_surface);
g_assert (node->done_loading_id == 0);
g_assert (node->files_added_id == 0);
@@ -253,24 +257,24 @@ tree_node_parent (TreeNode *node, TreeNode *parent)
parent->first_child = node;
}
-static GdkPixbuf *
+static cairo_surface_t *
get_menu_icon (GIcon *icon)
{
CajaIconInfo *info;
- GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
int size, scale;
size = caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU);
scale = gdk_window_get_scale_factor (gdk_get_default_root_window ());
info = caja_icon_info_lookup (icon, size, scale);
- pixbuf = caja_icon_info_get_pixbuf_nodefault_at_size (info, size);
+ surface = caja_icon_info_get_surface_nodefault_at_size (info, size);
g_object_unref (info);
- return pixbuf;
+ return surface;
}
-static GdkPixbuf *
+static cairo_surface_t *
get_menu_icon_for_file (TreeNode *node,
CajaFile *file,
CajaFileIconFlags flags)
@@ -278,7 +282,7 @@ get_menu_icon_for_file (TreeNode *node,
CajaIconInfo *info;
GIcon *gicon, *emblem_icon, *emblemed_icon;
GEmblem *emblem;
- GdkPixbuf *pixbuf, *retval;
+ cairo_surface_t *surface, *retval;
gboolean highlight;
int size, scale;
FMTreeModel *model;
@@ -324,7 +328,7 @@ get_menu_icon_for_file (TreeNode *node,
g_list_free_full (emblem_icons, g_object_unref);
info = caja_icon_info_lookup (gicon, size, scale);
- retval = caja_icon_info_get_pixbuf_nodefault_at_size (info, size);
+ retval = caja_icon_info_get_surface_nodefault_at_size (info, size);
model = node->root->model;
g_object_unref (gicon);
@@ -334,12 +338,12 @@ get_menu_icon_for_file (TreeNode *node,
if (highlight)
{
- pixbuf = eel_create_spotlight_pixbuf (retval);
+ surface = eel_create_spotlight_surface (retval, scale);
- if (pixbuf != NULL)
+ if (surface != NULL)
{
- g_object_unref (retval);
- retval = pixbuf;
+ cairo_surface_destroy (retval);
+ retval = surface;
}
}
@@ -348,9 +352,9 @@ get_menu_icon_for_file (TreeNode *node,
return retval;
}
-static GdkPixbuf *
-tree_node_get_pixbuf (TreeNode *node,
- CajaFileIconFlags flags)
+static cairo_surface_t *
+tree_node_get_surface (TreeNode *node,
+ CajaFileIconFlags flags)
{
if (node->parent == NULL)
{
@@ -360,37 +364,37 @@ tree_node_get_pixbuf (TreeNode *node,
}
static gboolean
-tree_node_update_pixbuf (TreeNode *node,
- GdkPixbuf **pixbuf_storage,
+tree_node_update_surface (TreeNode *node,
+ cairo_surface_t **surface_storage,
CajaFileIconFlags flags)
{
- GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
- if (*pixbuf_storage == NULL)
+ if (*surface_storage == NULL)
{
return FALSE;
}
- pixbuf = tree_node_get_pixbuf (node, flags);
- if (pixbuf == *pixbuf_storage)
+ surface = tree_node_get_surface (node, flags);
+ if (surface == *surface_storage)
{
- g_object_unref (pixbuf);
+ cairo_surface_destroy (surface);
return FALSE;
}
- g_object_unref (*pixbuf_storage);
- *pixbuf_storage = pixbuf;
+ cairo_surface_destroy (*surface_storage);
+ *surface_storage = surface;
return TRUE;
}
static gboolean
-tree_node_update_closed_pixbuf (TreeNode *node)
+tree_node_update_closed_surface (TreeNode *node)
{
- return tree_node_update_pixbuf (node, &node->closed_pixbuf, 0);
+ return tree_node_update_surface (node, &node->closed_surface, 0);
}
static gboolean
-tree_node_update_open_pixbuf (TreeNode *node)
+tree_node_update_open_surface (TreeNode *node)
{
- return tree_node_update_pixbuf (node, &node->open_pixbuf, CAJA_FILE_ICON_FLAGS_FOR_OPEN_FOLDER);
+ return tree_node_update_surface (node, &node->open_surface, CAJA_FILE_ICON_FLAGS_FOR_OPEN_FOLDER);
}
static gboolean
@@ -418,24 +422,24 @@ tree_node_update_display_name (TreeNode *node)
return TRUE;
}
-static GdkPixbuf *
-tree_node_get_closed_pixbuf (TreeNode *node)
+static cairo_surface_t *
+tree_node_get_closed_surface (TreeNode *node)
{
- if (node->closed_pixbuf == NULL)
+ if (node->closed_surface == NULL)
{
- node->closed_pixbuf = tree_node_get_pixbuf (node, 0);
+ node->closed_surface = tree_node_get_surface (node, 0);
}
- return node->closed_pixbuf;
+ return node->closed_surface;
}
-static GdkPixbuf *
-tree_node_get_open_pixbuf (TreeNode *node)
+static cairo_surface_t *
+tree_node_get_open_surface (TreeNode *node)
{
- if (node->open_pixbuf == NULL)
+ if (node->open_surface == NULL)
{
- node->open_pixbuf = tree_node_get_pixbuf (node, CAJA_FILE_ICON_FLAGS_FOR_OPEN_FOLDER);
+ node->open_surface = tree_node_get_surface (node, CAJA_FILE_ICON_FLAGS_FOR_OPEN_FOLDER);
}
- return node->open_pixbuf;
+ return node->open_surface;
}
static const char *
@@ -882,8 +886,8 @@ update_node_without_reporting (FMTreeModel *model, TreeNode *node)
}
changed |= tree_node_update_display_name (node);
- changed |= tree_node_update_closed_pixbuf (node);
- changed |= tree_node_update_open_pixbuf (node);
+ changed |= tree_node_update_closed_surface (node);
+ changed |= tree_node_update_open_surface (node);
return changed;
}
@@ -1204,10 +1208,10 @@ fm_tree_model_get_column_type (GtkTreeModel *model, int index)
{
case FM_TREE_MODEL_DISPLAY_NAME_COLUMN:
return G_TYPE_STRING;
- case FM_TREE_MODEL_CLOSED_PIXBUF_COLUMN:
- return GDK_TYPE_PIXBUF;
- case FM_TREE_MODEL_OPEN_PIXBUF_COLUMN:
- return GDK_TYPE_PIXBUF;
+ case FM_TREE_MODEL_CLOSED_SURFACE_COLUMN:
+ return CAIRO_GOBJECT_TYPE_SURFACE;
+ case FM_TREE_MODEL_OPEN_SURFACE_COLUMN:
+ return CAIRO_GOBJECT_TYPE_SURFACE;
case FM_TREE_MODEL_FONT_STYLE_COLUMN:
return PANGO_TYPE_STYLE;
default:
@@ -1364,13 +1368,13 @@ fm_tree_model_get_value (GtkTreeModel *model, GtkTreeIter *iter, int column, GVa
g_value_set_string (value, tree_node_get_display_name (node));
}
break;
- case FM_TREE_MODEL_CLOSED_PIXBUF_COLUMN:
- g_value_init (value, GDK_TYPE_PIXBUF);
- g_value_set_object (value, node == NULL ? NULL : tree_node_get_closed_pixbuf (node));
+ case FM_TREE_MODEL_CLOSED_SURFACE_COLUMN:
+ g_value_init (value, CAIRO_GOBJECT_TYPE_SURFACE);
+ g_value_set_boxed (value, node == NULL ? NULL : tree_node_get_closed_surface (node));
break;
- case FM_TREE_MODEL_OPEN_PIXBUF_COLUMN:
- g_value_init (value, GDK_TYPE_PIXBUF);
- g_value_set_object (value, node == NULL ? NULL : tree_node_get_open_pixbuf (node));
+ case FM_TREE_MODEL_OPEN_SURFACE_COLUMN:
+ g_value_init (value, CAIRO_GOBJECT_TYPE_SURFACE);
+ g_value_set_boxed (value, node == NULL ? NULL : tree_node_get_open_surface (node));
break;
case FM_TREE_MODEL_FONT_STYLE_COLUMN:
g_value_init (value, PANGO_TYPE_STYLE);
diff --git a/src/file-manager/fm-tree-model.h b/src/file-manager/fm-tree-model.h
index 2e459392..a5d05862 100644
--- a/src/file-manager/fm-tree-model.h
+++ b/src/file-manager/fm-tree-model.h
@@ -47,8 +47,8 @@
enum
{
FM_TREE_MODEL_DISPLAY_NAME_COLUMN,
- FM_TREE_MODEL_CLOSED_PIXBUF_COLUMN,
- FM_TREE_MODEL_OPEN_PIXBUF_COLUMN,
+ FM_TREE_MODEL_CLOSED_SURFACE_COLUMN,
+ FM_TREE_MODEL_OPEN_SURFACE_COLUMN,
FM_TREE_MODEL_FONT_STYLE_COLUMN,
FM_TREE_MODEL_NUM_COLUMNS
};
diff --git a/src/file-manager/fm-tree-view.c b/src/file-manager/fm-tree-view.c
index 643ae185..5d4e2b7a 100644
--- a/src/file-manager/fm-tree-view.c
+++ b/src/file-manager/fm-tree-view.c
@@ -39,6 +39,7 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <gio/gio.h>
+#include <cairo-gobject.h>
#include <libcaja-private/caja-clipboard.h>
#include <libcaja-private/caja-clipboard-monitor.h>
#include <libcaja-private/caja-desktop-icon-file.h>
@@ -1482,9 +1483,7 @@ create_tree (FMTreeView *view)
cell = gtk_cell_renderer_pixbuf_new ();
gtk_tree_view_column_pack_start (column, cell, FALSE);
gtk_tree_view_column_set_attributes (column, cell,
- "pixbuf", FM_TREE_MODEL_CLOSED_PIXBUF_COLUMN,
- "pixbuf_expander_closed", FM_TREE_MODEL_CLOSED_PIXBUF_COLUMN,
- "pixbuf_expander_open", FM_TREE_MODEL_OPEN_PIXBUF_COLUMN,
+ "surface", FM_TREE_MODEL_CLOSED_SURFACE_COLUMN,
NULL);
cell = gtk_cell_renderer_text_new ();