diff options
author | Victor Kareh <[email protected]> | 2019-07-07 07:00:00 -0400 |
---|---|---|
committer | raveit65 <[email protected]> | 2022-07-20 18:49:02 +0200 |
commit | 0124edc9296b9f0a942053d9f1ae1c778ca79185 (patch) | |
tree | 5a3befc27e69d776b93314e1e01f5be0dd2ca19d | |
parent | 9f8ed147f39096125cd29a838ad0ccbbcfa7e8e5 (diff) | |
download | caja-0124edc9296b9f0a942053d9f1ae1c778ca79185.tar.bz2 caja-0124edc9296b9f0a942053d9f1ae1c778ca79185.tar.xz |
Replace gdkpixbuf with cairo_surfaces in a few more places
-rw-r--r-- | eel/eel-gtk-extensions.c | 8 | ||||
-rw-r--r-- | eel/eel-gtk-extensions.h | 3 | ||||
-rw-r--r-- | libcaja-private/caja-file.c | 21 | ||||
-rw-r--r-- | libcaja-private/caja-file.h | 5 | ||||
-rw-r--r-- | src/caja-spatial-window.c | 55 | ||||
-rw-r--r-- | src/file-manager/fm-empty-view.c | 6 |
6 files changed, 35 insertions, 63 deletions
diff --git a/eel/eel-gtk-extensions.c b/eel/eel-gtk-extensions.c index 3a98c7d2..f460e24d 100644 --- a/eel/eel-gtk-extensions.c +++ b/eel/eel-gtk-extensions.c @@ -480,15 +480,15 @@ eel_image_menu_item_new_from_icon (const gchar *icon_name, } GtkWidget * -eel_image_menu_item_new_from_pixbuf (GdkPixbuf *icon_pixbuf, - const gchar *label_name) +eel_image_menu_item_new_from_surface (cairo_surface_t *icon_surface, + const gchar *label_name) { gchar *concat; GtkWidget *icon; GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); - if (icon_pixbuf) - icon = gtk_image_new_from_pixbuf (icon_pixbuf); + if (icon_surface) + icon = gtk_image_new_from_surface (icon_surface); else icon = gtk_image_new (); diff --git a/eel/eel-gtk-extensions.h b/eel/eel-gtk-extensions.h index bc02da69..c3be8940 100644 --- a/eel/eel-gtk-extensions.h +++ b/eel/eel-gtk-extensions.h @@ -28,7 +28,6 @@ #ifndef EEL_GTK_EXTENSIONS_H #define EEL_GTK_EXTENSIONS_H -#include <gdk-pixbuf/gdk-pixbuf.h> #include <gtk/gtk.h> #include "eel-gdk-extensions.h" @@ -71,7 +70,7 @@ void eel_gtk_message_dialog_set_details_label (GtkMessag GtkWidget * eel_image_menu_item_new_from_icon (const gchar *icon_name, const gchar *label_name); -GtkWidget * eel_image_menu_item_new_from_pixbuf (GdkPixbuf *icon_pixbuf, +GtkWidget * eel_image_menu_item_new_from_surface (cairo_surface_t *icon_surface, const gchar *label_name); gboolean eel_dialog_page_scroll_event_callback (GtkWidget *widget, diff --git a/libcaja-private/caja-file.c b/libcaja-private/caja-file.c index 55112de9..71b21216 100644 --- a/libcaja-private/caja-file.c +++ b/libcaja-private/caja-file.c @@ -4660,27 +4660,6 @@ caja_file_get_icon (CajaFile *file, } } -GdkPixbuf * -caja_file_get_icon_pixbuf (CajaFile *file, - int size, - gboolean force_size, - int scale, - CajaFileIconFlags flags) -{ - CajaIconInfo *info; - GdkPixbuf *pixbuf; - - info = caja_file_get_icon (file, size, scale, flags); - if (force_size) { - pixbuf = caja_icon_info_get_pixbuf_at_size (info, size); - } else { - pixbuf = caja_icon_info_get_pixbuf (info); - } - g_object_unref (info); - - return pixbuf; -} - cairo_surface_t * caja_file_get_icon_surface (CajaFile *file, int size, diff --git a/libcaja-private/caja-file.h b/libcaja-private/caja-file.h index e458582b..eb57599c 100644 --- a/libcaja-private/caja-file.h +++ b/libcaja-private/caja-file.h @@ -466,11 +466,6 @@ CajaIconInfo *caja_file_get_icon (CajaFile *file, int size, int scale, CajaFileIconFlags flags); -GdkPixbuf *caja_file_get_icon_pixbuf (CajaFile *file, - int size, - gboolean force_size, - int scale, - CajaFileIconFlags flags); cairo_surface_t *caja_file_get_icon_surface (CajaFile *file, int size, gboolean force_size, diff --git a/src/caja-spatial-window.c b/src/caja-spatial-window.c index c4c04983..52bd6d39 100644 --- a/src/caja-spatial-window.c +++ b/src/caja-spatial-window.c @@ -29,7 +29,6 @@ #include <config.h> -#include <gdk-pixbuf/gdk-pixbuf.h> #include <gdk/gdkkeysyms.h> #include <gdk/gdkx.h> #include <gtk/gtk.h> @@ -653,7 +652,7 @@ location_button_clicked_callback (GtkWidget *widget, { CajaWindowSlot *slot; GtkWidget *popup, *menu_item, *first_item = NULL; - GdkPixbuf *pixbuf = NULL; + cairo_surface_t *surface = NULL; GFile *location; GFile *child_location; GMainLoop *loop; @@ -678,18 +677,18 @@ location_button_clicked_callback (GtkWidget *widget, name = caja_file_get_display_name (file); - pixbuf = NULL; + surface = NULL; - pixbuf = caja_file_get_icon_pixbuf (file, - caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU), - TRUE, - gtk_widget_get_scale_factor (widget), - CAJA_FILE_ICON_FLAGS_IGNORE_VISITING); + surface = caja_file_get_icon_surface (file, + caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU), + TRUE, + gtk_widget_get_scale_factor (widget), + CAJA_FILE_ICON_FLAGS_IGNORE_VISITING); - if (pixbuf != NULL) + if (surface != NULL) { - menu_item = eel_image_menu_item_new_from_pixbuf (pixbuf, name); - g_object_unref (pixbuf); + menu_item = eel_image_menu_item_new_from_surface (surface, name); + cairo_surface_destroy (surface); } else { @@ -778,19 +777,19 @@ location_button_drag_begin_callback (GtkWidget *widget, CajaSpatialWindow *window) { CajaWindowSlot *slot; - GdkPixbuf *pixbuf; + cairo_surface_t *surface; slot = CAJA_WINDOW (window)->details->active_pane->active_slot; - pixbuf = caja_file_get_icon_pixbuf (slot->viewed_file, - get_dnd_icon_size (window), - FALSE, - gtk_widget_get_scale_factor (widget), - CAJA_FILE_ICON_FLAGS_IGNORE_VISITING | CAJA_FILE_ICON_FLAGS_FOR_DRAG_ACCEPT); + surface = caja_file_get_icon_surface (slot->viewed_file, + get_dnd_icon_size (window), + FALSE, + gtk_widget_get_scale_factor (widget), + CAJA_FILE_ICON_FLAGS_IGNORE_VISITING | CAJA_FILE_ICON_FLAGS_FOR_DRAG_ACCEPT); - gtk_drag_set_icon_pixbuf (context, pixbuf, 0, 0); + gtk_drag_set_icon_surface (context, surface); - g_object_unref (pixbuf); + cairo_surface_destroy (surface); } /* build MATE icon list, which only contains the window's URI. @@ -858,18 +857,18 @@ caja_spatial_window_set_location_button (CajaSpatialWindow *window, error = caja_file_get_file_info_error (file); if (error == NULL) { - GdkPixbuf *pixbuf; + cairo_surface_t *surface; - pixbuf = caja_file_get_icon_pixbuf (file, - caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU), - TRUE, - gtk_widget_get_scale_factor (window->details->location_button), - CAJA_FILE_ICON_FLAGS_IGNORE_VISITING); + surface = caja_file_get_icon_surface (file, + caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU), + TRUE, + gtk_widget_get_scale_factor (window->details->location_button), + CAJA_FILE_ICON_FLAGS_IGNORE_VISITING); - if (pixbuf != NULL) + if (surface != NULL) { - gtk_image_set_from_pixbuf (GTK_IMAGE (window->details->location_icon), pixbuf); - g_object_unref (pixbuf); + gtk_image_set_from_surface (GTK_IMAGE (window->details->location_icon), surface); + cairo_surface_destroy (surface); } else { diff --git a/src/file-manager/fm-empty-view.c b/src/file-manager/fm-empty-view.c index 9380a6b1..513c2605 100644 --- a/src/file-manager/fm-empty-view.c +++ b/src/file-manager/fm-empty-view.c @@ -59,17 +59,17 @@ fm_empty_view_add_file (FMDirectoryView *view, CajaFile *file, CajaDirectory *di static GTimer *timer = NULL; static gdouble cumu = 0, elaps; FM_EMPTY_VIEW (view)->details->number_of_files++; - GdkPixbuf *icon; + cairo_surface_t *icon; if (!timer) timer = g_timer_new (); g_timer_start (timer); - icon = caja_file_get_icon_pixbuf (file, caja_get_icon_size_for_zoom_level (CAJA_ZOOM_LEVEL_STANDARD), TRUE, 0); + icon = caja_file_get_icon_surface (file, caja_get_icon_size_for_zoom_level (CAJA_ZOOM_LEVEL_STANDARD), TRUE, 0); elaps = g_timer_elapsed (timer, NULL); g_timer_stop (timer); - g_object_unref (icon); + cairo_surface_destroy (icon); cumu += elaps; g_message ("entire loading: %.3f, cumulative %.3f", elaps, cumu); |