Skip to content

Commit

Permalink
gtkui: use a different folder icon and size for medialib viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksiy-Yakovenko committed Nov 18, 2023
1 parent ebc525f commit deaa1be
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
12 changes: 5 additions & 7 deletions plugins/gtkui/medialib/medialibwidget.c
Original file line number Diff line number Diff line change
Expand Up @@ -735,8 +735,8 @@ _receive_cover (w_medialib_viewer_t *mlv, GtkTreePath *path, GdkPixbuf *img) {
GtkAllocation a;
a.x = 0;
a.y = 0;
a.width = 16;
a.height = 16;
a.width = ML_CELL_RENDERER_PIXBUF_SIZE;
a.height = ML_CELL_RENDERER_PIXBUF_SIZE;
GdkPixbuf *scaled_img = covermanager_create_scaled_image (covermanager_shared (), img, a);

GtkTreeStore *store = mlv->store;
Expand Down Expand Up @@ -870,11 +870,9 @@ w_medialib_viewer_create (void) {
gtk_container_add (GTK_CONTAINER (scroll), GTK_WIDGET (w->tree));

GtkIconTheme *icon_theme = gtk_icon_theme_get_default ();
#if GTK_CHECK_VERSION(3, 0, 0)
w->folder_icon = gtk_icon_theme_load_icon (icon_theme, "folder-music", 16, 0, NULL);
#else
w->folder_icon = gtk_icon_theme_load_icon (icon_theme, "folder", 16, 0, NULL);
#endif
// NOTE: using "folder-music" icon doesn't yield a good result,
// since it doesn't look like a folder across the icon themes.
w->folder_icon = gtk_icon_theme_load_icon (icon_theme, "folder", ML_CELL_RENDERER_PIXBUF_SIZE, 0, NULL);
ddb_artwork_plugin_t *artwork_plugin = (ddb_artwork_plugin_t *)deadbeef->plug_get_for_id ("artwork2");
if (artwork_plugin != NULL) {
w->artwork_source_id = artwork_plugin->allocate_source_id ();
Expand Down
8 changes: 4 additions & 4 deletions plugins/gtkui/medialib/mlcellrendererpixbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ static void
_get_size (GtkCellRenderer *cell, GtkWidget *widget, const GdkRectangle *cell_area, gint *x_offset, gint *y_offset, gint *width, gint *height) {
#endif
if (width != NULL) {
*width = 16;
*width = ML_CELL_RENDERER_PIXBUF_SIZE;
}
if (height != NULL) {
*height = 16;
*height = ML_CELL_RENDERER_PIXBUF_SIZE;
}
}

Expand All @@ -153,8 +153,8 @@ _render (
GdkRectangle pix_rect;
pix_rect.x = cell_area->x;
pix_rect.y = cell_area->y;
pix_rect.width = 16;
pix_rect.height = 16;
pix_rect.width = ML_CELL_RENDERER_PIXBUF_SIZE;
pix_rect.height = ML_CELL_RENDERER_PIXBUF_SIZE;

GdkRectangle draw_rect;
if (!gdk_rectangle_intersect (cell_area, &pix_rect, &draw_rect)) {
Expand Down
2 changes: 2 additions & 0 deletions plugins/gtkui/medialib/mlcellrendererpixbuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

G_BEGIN_DECLS

#define ML_CELL_RENDERER_PIXBUF_SIZE 24

typedef struct {
void *ctx;
GdkPixbuf *(*cell_did_became_visible) (void *ctx, const char *path);
Expand Down

0 comments on commit deaa1be

Please sign in to comment.