st/icon-theme: Standard types
The GTK code dates back to a time when "gchar" and friends were still considered a good idea. Replace them with standard types except for "guint" (I'm lazy) and GtkIconCache code that relies on glib's byte order macros. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2620>
This commit is contained in:
parent
3dc3170f92
commit
88b26996ec
@ -49,10 +49,10 @@
|
||||
|
||||
|
||||
struct _GtkIconCache {
|
||||
gint ref_count;
|
||||
int ref_count;
|
||||
|
||||
GMappedFile *map;
|
||||
gchar *buffer;
|
||||
char *buffer;
|
||||
|
||||
guint32 last_chain_offset;
|
||||
};
|
||||
@ -80,13 +80,13 @@ _gtk_icon_cache_unref (GtkIconCache *cache)
|
||||
}
|
||||
|
||||
GtkIconCache *
|
||||
_gtk_icon_cache_new_for_path (const gchar *path)
|
||||
_gtk_icon_cache_new_for_path (const char *path)
|
||||
{
|
||||
GtkIconCache *cache = NULL;
|
||||
GMappedFile *map;
|
||||
|
||||
gchar *cache_filename;
|
||||
gint fd = -1;
|
||||
char *cache_filename;
|
||||
int fd = -1;
|
||||
GStatBuf st;
|
||||
GStatBuf path_st;
|
||||
|
||||
@ -169,25 +169,25 @@ _gtk_icon_cache_new_for_path (const gchar *path)
|
||||
}
|
||||
|
||||
GtkIconCache *
|
||||
_gtk_icon_cache_new (const gchar *data)
|
||||
_gtk_icon_cache_new (const char *data)
|
||||
{
|
||||
GtkIconCache *cache;
|
||||
|
||||
cache = g_new0 (GtkIconCache, 1);
|
||||
cache->ref_count = 1;
|
||||
cache->map = NULL;
|
||||
cache->buffer = (gchar *)data;
|
||||
cache->buffer = (char *)data;
|
||||
|
||||
return cache;
|
||||
}
|
||||
|
||||
static gint
|
||||
static int
|
||||
get_directory_index (GtkIconCache *cache,
|
||||
const gchar *directory)
|
||||
const char *directory)
|
||||
{
|
||||
guint32 dir_list_offset;
|
||||
gint n_dirs;
|
||||
gint i;
|
||||
int n_dirs;
|
||||
int i;
|
||||
|
||||
dir_list_offset = GET_UINT32 (cache->buffer, 8);
|
||||
|
||||
@ -196,7 +196,7 @@ get_directory_index (GtkIconCache *cache,
|
||||
for (i = 0; i < n_dirs; i++)
|
||||
{
|
||||
guint32 name_offset = GET_UINT32 (cache->buffer, dir_list_offset + 4 + 4 * i);
|
||||
gchar *name = cache->buffer + name_offset;
|
||||
char *name = cache->buffer + name_offset;
|
||||
if (strcmp (name, directory) == 0)
|
||||
return i;
|
||||
}
|
||||
@ -204,9 +204,9 @@ get_directory_index (GtkIconCache *cache,
|
||||
return -1;
|
||||
}
|
||||
|
||||
gint
|
||||
int
|
||||
_gtk_icon_cache_get_directory_index (GtkIconCache *cache,
|
||||
const gchar *directory)
|
||||
const char *directory)
|
||||
{
|
||||
return get_directory_index (cache, directory);
|
||||
}
|
||||
@ -224,10 +224,10 @@ icon_name_hash (gconstpointer key)
|
||||
return h;
|
||||
}
|
||||
|
||||
static gint
|
||||
static int
|
||||
find_image_offset (GtkIconCache *cache,
|
||||
const gchar *icon_name,
|
||||
gint directory_index)
|
||||
const char *icon_name,
|
||||
int directory_index)
|
||||
{
|
||||
guint32 hash_offset;
|
||||
guint32 n_buckets;
|
||||
@ -243,7 +243,7 @@ find_image_offset (GtkIconCache *cache,
|
||||
if (chain_offset)
|
||||
{
|
||||
guint32 name_offset = GET_UINT32 (cache->buffer, chain_offset + 4);
|
||||
gchar *name = cache->buffer + name_offset;
|
||||
char *name = cache->buffer + name_offset;
|
||||
|
||||
if (strcmp (name, icon_name) == 0)
|
||||
goto find_dir;
|
||||
@ -257,7 +257,7 @@ find_image_offset (GtkIconCache *cache,
|
||||
while (chain_offset != 0xffffffff)
|
||||
{
|
||||
guint32 name_offset = GET_UINT32 (cache->buffer, chain_offset + 4);
|
||||
gchar *name = cache->buffer + name_offset;
|
||||
char *name = cache->buffer + name_offset;
|
||||
|
||||
if (strcmp (name, icon_name) == 0)
|
||||
{
|
||||
@ -286,10 +286,10 @@ find_dir:
|
||||
return 0;
|
||||
}
|
||||
|
||||
gint
|
||||
int
|
||||
_gtk_icon_cache_get_icon_flags (GtkIconCache *cache,
|
||||
const gchar *icon_name,
|
||||
gint directory_index)
|
||||
const char *icon_name,
|
||||
int directory_index)
|
||||
{
|
||||
guint32 image_offset;
|
||||
|
||||
@ -303,7 +303,7 @@ _gtk_icon_cache_get_icon_flags (GtkIconCache *cache,
|
||||
|
||||
gboolean
|
||||
_gtk_icon_cache_has_icons (GtkIconCache *cache,
|
||||
const gchar *directory)
|
||||
const char *directory)
|
||||
{
|
||||
int directory_index;
|
||||
guint32 hash_offset, n_buckets;
|
||||
@ -343,7 +343,7 @@ _gtk_icon_cache_has_icons (GtkIconCache *cache,
|
||||
|
||||
void
|
||||
_gtk_icon_cache_add_icons (GtkIconCache *cache,
|
||||
const gchar *directory,
|
||||
const char *directory,
|
||||
GHashTable *hash_table)
|
||||
{
|
||||
int directory_index;
|
||||
@ -366,7 +366,7 @@ _gtk_icon_cache_add_icons (GtkIconCache *cache,
|
||||
while (chain_offset != 0xffffffff)
|
||||
{
|
||||
guint32 name_offset = GET_UINT32 (cache->buffer, chain_offset + 4);
|
||||
gchar *name = cache->buffer + name_offset;
|
||||
char *name = cache->buffer + name_offset;
|
||||
|
||||
image_list_offset = GET_UINT32 (cache->buffer, chain_offset + 8);
|
||||
n_images = GET_UINT32 (cache->buffer, image_list_offset);
|
||||
@ -385,12 +385,12 @@ _gtk_icon_cache_add_icons (GtkIconCache *cache,
|
||||
|
||||
gboolean
|
||||
_gtk_icon_cache_has_icon (GtkIconCache *cache,
|
||||
const gchar *icon_name)
|
||||
const char *icon_name)
|
||||
{
|
||||
guint32 hash_offset;
|
||||
guint32 n_buckets;
|
||||
guint32 chain_offset;
|
||||
gint hash;
|
||||
int hash;
|
||||
|
||||
hash_offset = GET_UINT32 (cache->buffer, 4);
|
||||
n_buckets = GET_UINT32 (cache->buffer, hash_offset);
|
||||
@ -401,7 +401,7 @@ _gtk_icon_cache_has_icon (GtkIconCache *cache,
|
||||
while (chain_offset != 0xffffffff)
|
||||
{
|
||||
guint32 name_offset = GET_UINT32 (cache->buffer, chain_offset + 4);
|
||||
gchar *name = cache->buffer + name_offset;
|
||||
char *name = cache->buffer + name_offset;
|
||||
|
||||
if (strcmp (name, icon_name) == 0)
|
||||
return TRUE;
|
||||
@ -414,15 +414,15 @@ _gtk_icon_cache_has_icon (GtkIconCache *cache,
|
||||
|
||||
gboolean
|
||||
_gtk_icon_cache_has_icon_in_directory (GtkIconCache *cache,
|
||||
const gchar *icon_name,
|
||||
const gchar *directory)
|
||||
const char *icon_name,
|
||||
const char *directory)
|
||||
{
|
||||
guint32 hash_offset;
|
||||
guint32 n_buckets;
|
||||
guint32 chain_offset;
|
||||
gint hash;
|
||||
int hash;
|
||||
gboolean found_icon = FALSE;
|
||||
gint directory_index;
|
||||
int directory_index;
|
||||
|
||||
directory_index = get_directory_index (cache, directory);
|
||||
|
||||
@ -438,7 +438,7 @@ _gtk_icon_cache_has_icon_in_directory (GtkIconCache *cache,
|
||||
while (chain_offset != 0xffffffff)
|
||||
{
|
||||
guint32 name_offset = GET_UINT32 (cache->buffer, chain_offset + 4);
|
||||
gchar *name = cache->buffer + name_offset;
|
||||
char *name = cache->buffer + name_offset;
|
||||
|
||||
if (strcmp (name, icon_name) == 0)
|
||||
{
|
||||
@ -454,7 +454,7 @@ _gtk_icon_cache_has_icon_in_directory (GtkIconCache *cache,
|
||||
guint32 image_list_offset = GET_UINT32 (cache->buffer, chain_offset + 8);
|
||||
guint32 n_images = GET_UINT32 (cache->buffer, image_list_offset);
|
||||
guint32 image_offset = image_list_offset + 4;
|
||||
gint i;
|
||||
int i;
|
||||
for (i = 0; i < n_images; i++)
|
||||
{
|
||||
guint16 index = GET_UINT16 (cache->buffer, image_offset);
|
||||
@ -479,8 +479,8 @@ pixbuf_destroy_cb (guchar *pixels,
|
||||
|
||||
GdkPixbuf *
|
||||
_gtk_icon_cache_get_icon (GtkIconCache *cache,
|
||||
const gchar *icon_name,
|
||||
gint directory_index)
|
||||
const char *icon_name,
|
||||
int directory_index)
|
||||
{
|
||||
guint32 offset, image_data_offset, pixel_data_offset;
|
||||
guint32 length, type;
|
||||
|
@ -22,27 +22,27 @@
|
||||
|
||||
typedef struct _GtkIconCache GtkIconCache;
|
||||
|
||||
GtkIconCache *_gtk_icon_cache_new (const gchar *data);
|
||||
GtkIconCache *_gtk_icon_cache_new_for_path (const gchar *path);
|
||||
gint _gtk_icon_cache_get_directory_index (GtkIconCache *cache,
|
||||
const gchar *directory);
|
||||
GtkIconCache *_gtk_icon_cache_new (const char *data);
|
||||
GtkIconCache *_gtk_icon_cache_new_for_path (const char *path);
|
||||
int _gtk_icon_cache_get_directory_index (GtkIconCache *cache,
|
||||
const char *directory);
|
||||
gboolean _gtk_icon_cache_has_icon (GtkIconCache *cache,
|
||||
const gchar *icon_name);
|
||||
const char *icon_name);
|
||||
gboolean _gtk_icon_cache_has_icon_in_directory (GtkIconCache *cache,
|
||||
const gchar *icon_name,
|
||||
const gchar *directory);
|
||||
const char *icon_name,
|
||||
const char *directory);
|
||||
gboolean _gtk_icon_cache_has_icons (GtkIconCache *cache,
|
||||
const gchar *directory);
|
||||
const char *directory);
|
||||
void _gtk_icon_cache_add_icons (GtkIconCache *cache,
|
||||
const gchar *directory,
|
||||
const char *directory,
|
||||
GHashTable *hash_table);
|
||||
|
||||
gint _gtk_icon_cache_get_icon_flags (GtkIconCache *cache,
|
||||
const gchar *icon_name,
|
||||
gint directory_index);
|
||||
int _gtk_icon_cache_get_icon_flags (GtkIconCache *cache,
|
||||
const char *icon_name,
|
||||
int directory_index);
|
||||
GdkPixbuf *_gtk_icon_cache_get_icon (GtkIconCache *cache,
|
||||
const gchar *icon_name,
|
||||
gint directory_index);
|
||||
const char *icon_name,
|
||||
int directory_index);
|
||||
|
||||
GtkIconCache *_gtk_icon_cache_ref (GtkIconCache *cache);
|
||||
void _gtk_icon_cache_unref (GtkIconCache *cache);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -175,74 +175,74 @@ void gtk_icon_theme_set_screen (GtkIconTheme
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_theme_set_search_path (GtkIconTheme *icon_theme,
|
||||
const gchar *path[],
|
||||
gint n_elements);
|
||||
const char *path[],
|
||||
int n_elements);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_theme_get_search_path (GtkIconTheme *icon_theme,
|
||||
gchar **path[],
|
||||
gint *n_elements);
|
||||
char **path[],
|
||||
int *n_elements);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_theme_append_search_path (GtkIconTheme *icon_theme,
|
||||
const gchar *path);
|
||||
const char *path);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_theme_prepend_search_path (GtkIconTheme *icon_theme,
|
||||
const gchar *path);
|
||||
const char *path);
|
||||
|
||||
GDK_AVAILABLE_IN_3_14
|
||||
void gtk_icon_theme_add_resource_path (GtkIconTheme *icon_theme,
|
||||
const gchar *path);
|
||||
const char *path);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_theme_set_custom_theme (GtkIconTheme *icon_theme,
|
||||
const gchar *theme_name);
|
||||
const char *theme_name);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_icon_theme_has_icon (GtkIconTheme *icon_theme,
|
||||
const gchar *icon_name);
|
||||
const char *icon_name);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gint *gtk_icon_theme_get_icon_sizes (GtkIconTheme *icon_theme,
|
||||
const gchar *icon_name);
|
||||
int *gtk_icon_theme_get_icon_sizes (GtkIconTheme *icon_theme,
|
||||
const char *icon_name);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkIconInfo * gtk_icon_theme_lookup_icon (GtkIconTheme *icon_theme,
|
||||
const gchar *icon_name,
|
||||
gint size,
|
||||
const char *icon_name,
|
||||
int size,
|
||||
GtkIconLookupFlags flags);
|
||||
GDK_AVAILABLE_IN_3_10
|
||||
GtkIconInfo * gtk_icon_theme_lookup_icon_for_scale (GtkIconTheme *icon_theme,
|
||||
const gchar *icon_name,
|
||||
gint size,
|
||||
gint scale,
|
||||
const char *icon_name,
|
||||
int size,
|
||||
int scale,
|
||||
GtkIconLookupFlags flags);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkIconInfo * gtk_icon_theme_choose_icon (GtkIconTheme *icon_theme,
|
||||
const gchar *icon_names[],
|
||||
gint size,
|
||||
const char *icon_names[],
|
||||
int size,
|
||||
GtkIconLookupFlags flags);
|
||||
GDK_AVAILABLE_IN_3_10
|
||||
GtkIconInfo * gtk_icon_theme_choose_icon_for_scale (GtkIconTheme *icon_theme,
|
||||
const gchar *icon_names[],
|
||||
gint size,
|
||||
gint scale,
|
||||
const char *icon_names[],
|
||||
int size,
|
||||
int scale,
|
||||
GtkIconLookupFlags flags);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkPixbuf * gtk_icon_theme_load_icon (GtkIconTheme *icon_theme,
|
||||
const gchar *icon_name,
|
||||
gint size,
|
||||
const char *icon_name,
|
||||
int size,
|
||||
GtkIconLookupFlags flags,
|
||||
GError **error);
|
||||
GDK_AVAILABLE_IN_3_10
|
||||
GdkPixbuf * gtk_icon_theme_load_icon_for_scale (GtkIconTheme *icon_theme,
|
||||
const gchar *icon_name,
|
||||
gint size,
|
||||
gint scale,
|
||||
const char *icon_name,
|
||||
int size,
|
||||
int scale,
|
||||
GtkIconLookupFlags flags,
|
||||
GError **error);
|
||||
GDK_AVAILABLE_IN_3_10
|
||||
cairo_surface_t * gtk_icon_theme_load_surface (GtkIconTheme *icon_theme,
|
||||
const gchar *icon_name,
|
||||
gint size,
|
||||
gint scale,
|
||||
const char *icon_name,
|
||||
int size,
|
||||
int scale,
|
||||
GdkWindow *for_window,
|
||||
GtkIconLookupFlags flags,
|
||||
GError **error);
|
||||
@ -250,19 +250,19 @@ cairo_surface_t * gtk_icon_theme_load_surface (GtkIconTheme *icon_th
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkIconInfo * gtk_icon_theme_lookup_by_gicon (GtkIconTheme *icon_theme,
|
||||
GIcon *icon,
|
||||
gint size,
|
||||
int size,
|
||||
GtkIconLookupFlags flags);
|
||||
GDK_AVAILABLE_IN_3_10
|
||||
GtkIconInfo * gtk_icon_theme_lookup_by_gicon_for_scale (GtkIconTheme *icon_theme,
|
||||
GIcon *icon,
|
||||
gint size,
|
||||
gint scale,
|
||||
int size,
|
||||
int scale,
|
||||
GtkIconLookupFlags flags);
|
||||
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GList * gtk_icon_theme_list_icons (GtkIconTheme *icon_theme,
|
||||
const gchar *context);
|
||||
const char *context);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GList * gtk_icon_theme_list_contexts (GtkIconTheme *icon_theme);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
@ -272,8 +272,8 @@ GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_icon_theme_rescan_if_needed (GtkIconTheme *icon_theme);
|
||||
|
||||
GDK_DEPRECATED_IN_3_14_FOR(gtk_icon_theme_add_resource_path)
|
||||
void gtk_icon_theme_add_builtin_icon (const gchar *icon_name,
|
||||
gint size,
|
||||
void gtk_icon_theme_add_builtin_icon (const char *icon_name,
|
||||
int size,
|
||||
GdkPixbuf *pixbuf);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
@ -288,11 +288,11 @@ GtkIconInfo * gtk_icon_info_new_for_pixbuf (GtkIconTheme *icon_them
|
||||
GdkPixbuf *pixbuf);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gint gtk_icon_info_get_base_size (GtkIconInfo *icon_info);
|
||||
int gtk_icon_info_get_base_size (GtkIconInfo *icon_info);
|
||||
GDK_AVAILABLE_IN_3_10
|
||||
gint gtk_icon_info_get_base_scale (GtkIconInfo *icon_info);
|
||||
int gtk_icon_info_get_base_scale (GtkIconInfo *icon_info);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
const gchar * gtk_icon_info_get_filename (GtkIconInfo *icon_info);
|
||||
const char * gtk_icon_info_get_filename (GtkIconInfo *icon_info);
|
||||
GDK_DEPRECATED_IN_3_14
|
||||
GdkPixbuf * gtk_icon_info_get_builtin_pixbuf (GtkIconInfo *icon_info);
|
||||
GDK_AVAILABLE_IN_3_12
|
||||
@ -367,9 +367,9 @@ gboolean gtk_icon_info_get_embedded_rect (GtkIconInfo *icon_info
|
||||
GDK_DEPRECATED_IN_3_14
|
||||
gboolean gtk_icon_info_get_attach_points (GtkIconInfo *icon_info,
|
||||
GdkPoint **points,
|
||||
gint *n_points);
|
||||
int *n_points);
|
||||
GDK_DEPRECATED_IN_3_14
|
||||
const gchar * gtk_icon_info_get_display_name (GtkIconInfo *icon_info);
|
||||
const char * gtk_icon_info_get_display_name (GtkIconInfo *icon_info);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user