diff options
Diffstat (limited to 'libcaja-private')
-rw-r--r-- | libcaja-private/caja-autorun.c | 122 | ||||
-rw-r--r-- | libcaja-private/caja-bookmark.c | 22 | ||||
-rw-r--r-- | libcaja-private/caja-bookmark.h | 2 | ||||
-rw-r--r-- | libcaja-private/caja-icon-canvas-item.c | 4 | ||||
-rw-r--r-- | libcaja-private/caja-icon-info.c | 55 | ||||
-rw-r--r-- | libcaja-private/caja-icon-info.h | 6 | ||||
-rw-r--r-- | libcaja-private/caja-open-with-dialog.c | 54 | ||||
-rw-r--r-- | libcaja-private/caja-ui-utilities.c | 36 |
8 files changed, 195 insertions, 106 deletions
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); } } |