rofi 1.7.9
rofi-icon-fetcher.c File Reference
#include "config.h"
#include <stdlib.h>
#include <xcb/xproto.h>
#include "helper.h"
#include "rofi-icon-fetcher.h"
#include "rofi-types.h"
#include "settings.h"
#include <cairo.h>
#include <pango/pangocairo.h>
#include "keyb.h"
#include "view.h"
#include "xcb.h"
#include "nkutils-enum.h"
#include "nkutils-xdg-theme.h"
#include <stdint.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
Include dependency graph for rofi-icon-fetcher.c:

Go to the source code of this file.

Data Structures

struct  IconFetcher
 
struct  IconFetcherNameEntry
 
struct  IconFetcherEntry
 

Macros

#define G_LOG_DOMAIN   "Helpers.IconFetcher"
 
#define THUMBNAILER_ENTRY_GROUP   "Thumbnailer Entry"
 
#define THUMBNAILER_EXTENSION   ".thumbnailer"
 
#define RED_BYTE   2
 
#define GREEN_BYTE   1
 
#define BLUE_BYTE   0
 
#define ALPHA_BYTE   3
 

Functions

static void rofi_icon_fetch_entry_free (gpointer data)
 
static void rofi_icon_fetcher_load_thumbnailers (const gchar *path)
 
static gchar ** setup_thumbnailer_command (const gchar *command, const gchar *filename, const gchar *encoded_uri, const gchar *output_path, int size)
 
static gboolean exec_thumbnailer_command (gchar **command_args)
 
static gboolean rofi_icon_fetcher_create_thumbnail (const gchar *mime_type, const gchar *filename, const gchar *encoded_uri, const gchar *output_path, int size)
 
static void rofi_icon_fetch_thread_pool_entry_remove (gpointer data)
 
void rofi_icon_fetcher_init (void)
 
static void free_wrapper (gpointer data, G_GNUC_UNUSED gpointer user_data)
 
void rofi_icon_fetcher_destroy (void)
 
static guchar alpha_mult (guchar c, guchar a)
 
static cairo_surface_t * rofi_icon_fetcher_get_surface_from_pixbuf (GdkPixbuf *pixbuf)
 
gboolean rofi_icon_fetcher_file_is_image (const char *const path)
 
static gchar * rofi_icon_fetcher_get_thumbnail (gchar *name, int requested_size, int *thumb_size)
 
static gchar * rofi_icon_fetcher_get_desktop_icon (const gchar *file_path)
 
static void rofi_icon_fetcher_worker (thread_state *sdata, G_GNUC_UNUSED gpointer user_data)
 
uint32_t rofi_icon_fetcher_query_advanced (const char *name, const int wsize, const int hsize)
 
uint32_t rofi_icon_fetcher_query (const char *name, const int size)
 
cairo_surface_t * rofi_icon_fetcher_get (const uint32_t uid)
 
gboolean rofi_icon_fetcher_get_ex (const uint32_t uid, cairo_surface_t **surface)
 

Variables

IconFetcherrofi_icon_fetcher_data = NULL
 

Macro Definition Documentation

◆ ALPHA_BYTE

#define ALPHA_BYTE   3

Location of alpha byte

Definition at line 357 of file rofi-icon-fetcher.c.

Referenced by rofi_icon_fetcher_get_surface_from_pixbuf().

◆ BLUE_BYTE

#define BLUE_BYTE   0

Location of blue byte

Definition at line 355 of file rofi-icon-fetcher.c.

Referenced by rofi_icon_fetcher_get_surface_from_pixbuf().

◆ G_LOG_DOMAIN

#define G_LOG_DOMAIN   "Helpers.IconFetcher"

The log domain of this Helper.

Definition at line 29 of file rofi-icon-fetcher.c.

◆ GREEN_BYTE

#define GREEN_BYTE   1

Location of green byte

Definition at line 353 of file rofi-icon-fetcher.c.

Referenced by rofi_icon_fetcher_get_surface_from_pixbuf().

◆ RED_BYTE

#define RED_BYTE   2

Location of red byte

Definition at line 351 of file rofi-icon-fetcher.c.

Referenced by rofi_icon_fetcher_get_surface_from_pixbuf().

◆ THUMBNAILER_ENTRY_GROUP

#define THUMBNAILER_ENTRY_GROUP   "Thumbnailer Entry"

Desktop entry specifying the thumbnailer.

Definition at line 55 of file rofi-icon-fetcher.c.

Referenced by rofi_icon_fetcher_load_thumbnailers().

◆ THUMBNAILER_EXTENSION

#define THUMBNAILER_EXTENSION   ".thumbnailer"

Extension used for the thumbnailer.

Definition at line 57 of file rofi-icon-fetcher.c.

Referenced by rofi_icon_fetcher_load_thumbnailers().

Function Documentation

◆ alpha_mult()

static guchar alpha_mult ( guchar c,
guchar a )
inlinestatic

Definition at line 369 of file rofi-icon-fetcher.c.

Referenced by rofi_icon_fetcher_get_surface_from_pixbuf().

Here is the caller graph for this function:

◆ exec_thumbnailer_command()

static gboolean exec_thumbnailer_command ( gchar ** command_args)
static

Definition at line 204 of file rofi-icon-fetcher.c.

Referenced by rofi_icon_fetcher_create_thumbnail(), and rofi_icon_fetcher_worker().

Here is the caller graph for this function:

◆ free_wrapper()

static void free_wrapper ( gpointer data,
G_GNUC_UNUSED gpointer user_data )
static

Definition at line 321 of file rofi-icon-fetcher.c.

Referenced by rofi_icon_fetcher_destroy().

Here is the caller graph for this function:

◆ rofi_icon_fetch_entry_free()

static void rofi_icon_fetch_entry_free ( gpointer data)
static

Definition at line 255 of file rofi-icon-fetcher.c.

References IconFetcherNameEntry::name, IconFetcherNameEntry::sizes, and IconFetcherEntry::surface.

Referenced by rofi_icon_fetcher_init().

Here is the caller graph for this function:

◆ rofi_icon_fetch_thread_pool_entry_remove()

static void rofi_icon_fetch_thread_pool_entry_remove ( gpointer data)
static

Definition at line 249 of file rofi-icon-fetcher.c.

References IconFetcherEntry::query_started.

Referenced by rofi_icon_fetcher_query(), and rofi_icon_fetcher_query_advanced().

Here is the caller graph for this function:

◆ rofi_icon_fetcher_create_thumbnail()

static gboolean rofi_icon_fetcher_create_thumbnail ( const gchar * mime_type,
const gchar * filename,
const gchar * encoded_uri,
const gchar * output_path,
int size )
static

Definition at line 223 of file rofi-icon-fetcher.c.

References exec_thumbnailer_command(), rofi_icon_fetcher_data, and setup_thumbnailer_command().

Referenced by rofi_icon_fetcher_worker().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rofi_icon_fetcher_get_desktop_icon()

static gchar * rofi_icon_fetcher_get_desktop_icon ( const gchar * file_path)
static

Definition at line 507 of file rofi-icon-fetcher.c.

Referenced by rofi_icon_fetcher_worker().

Here is the caller graph for this function:

◆ rofi_icon_fetcher_get_surface_from_pixbuf()

static cairo_surface_t * rofi_icon_fetcher_get_surface_from_pixbuf ( GdkPixbuf * pixbuf)
static

Definition at line 383 of file rofi-icon-fetcher.c.

References ALPHA_BYTE, alpha_mult(), BLUE_BYTE, GREEN_BYTE, and RED_BYTE.

Referenced by rofi_icon_fetcher_worker().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rofi_icon_fetcher_get_thumbnail()

static gchar * rofi_icon_fetcher_get_thumbnail ( gchar * name,
int requested_size,
int * thumb_size )
static

Definition at line 463 of file rofi-icon-fetcher.c.

References cache_dir.

Referenced by rofi_icon_fetcher_worker().

Here is the caller graph for this function:

◆ rofi_icon_fetcher_load_thumbnailers()

static void rofi_icon_fetcher_load_thumbnailers ( const gchar * path)
static

Definition at line 105 of file rofi-icon-fetcher.c.

References rofi_icon_fetcher_data, THUMBNAILER_ENTRY_GROUP, and THUMBNAILER_EXTENSION.

Referenced by rofi_icon_fetcher_init().

Here is the caller graph for this function:

◆ rofi_icon_fetcher_worker()

◆ setup_thumbnailer_command()

static gchar ** setup_thumbnailer_command ( const gchar * command,
const gchar * filename,
const gchar * encoded_uri,
const gchar * output_path,
int size )
static

Definition at line 161 of file rofi-icon-fetcher.c.

Referenced by rofi_icon_fetcher_create_thumbnail().

Here is the caller graph for this function:

Variable Documentation

◆ rofi_icon_fetcher_data