Top | ![]() |
![]() |
![]() |
![]() |
GdkPixbuf * | (*AdwAvatarImageLoadFunc) () |
GtkWidget * | adw_avatar_new () |
const char * | adw_avatar_get_icon_name () |
void | adw_avatar_set_icon_name () |
const char * | adw_avatar_get_text () |
void | adw_avatar_set_text () |
gboolean | adw_avatar_get_show_initials () |
void | adw_avatar_set_show_initials () |
void | adw_avatar_set_image_load_func () |
int | adw_avatar_get_size () |
void | adw_avatar_set_size () |
GdkPixbuf * | adw_avatar_draw_to_pixbuf () |
char * | icon-name | Read / Write |
gboolean | show-initials | Read / Write |
int | size | Read / Write |
char * | text | Read / Write |
GdkPixbuf * (*AdwAvatarImageLoadFunc) (int size
,gpointer user_data
);
The returned GdkPixbuf is expected to be square with width and height set
to size
. The image is cropped to a circle without any scaling or transformation.
GtkWidget * adw_avatar_new (int size
,const char *text
,gboolean show_initials
);
Creates a new AdwAvatar.
size |
The size of the avatar |
|
text |
The text used to generate the color and initials if
|
[nullable] |
show_initials |
whether to show the initials or the fallback icon on
top of the color generated based on |
Since: 1.0
const char *
adw_avatar_get_icon_name (AdwAvatar *self
);
Gets the name of the icon in the icon theme to use when the icon should be displayed.
Since: 1.0
void adw_avatar_set_icon_name (AdwAvatar *self
,const char *icon_name
);
Sets the name of the icon in the icon theme to use when the icon should be displayed. If no name is set, the avatar-default-symbolic icon will be used. If the name doesn't match a valid icon, it is an error and no icon will be displayed. If the icon theme is changed, the image will be updated automatically.
Since: 1.0
const char *
adw_avatar_get_text (AdwAvatar *self
);
Get the text used to generate the fallback initials and color
returns the text used to generate the fallback initials. This is the internal string used by the AdwAvatar, and must not be modified.
[nullable][transfer none]
Since: 1.0
void adw_avatar_set_text (AdwAvatar *self
,const char *text
);
Set the text used to generate the fallback initials color
Since: 1.0
gboolean
adw_avatar_get_show_initials (AdwAvatar *self
);
Returns whether initials are used for the fallback or the icon.
Since: 1.0
void adw_avatar_set_show_initials (AdwAvatar *self
,gboolean show_initials
);
Sets whether the initials should be shown on the fallback avatar or the icon.
self |
||
show_initials |
whether the initials should be shown on the fallback avatar or the icon. |
Since: 1.0
void adw_avatar_set_image_load_func (AdwAvatar *self
,AdwAvatarImageLoadFunc load_image
,gpointer user_data
,GDestroyNotify destroy
);
A callback which is called when the custom image need to be reloaded for some reason (e.g. scale-factor changes).
self |
||
load_image |
callback to set a custom image. |
[closure user_data][nullable] |
user_data |
user data passed to |
[nullable] |
destroy |
destroy notifier for |
[nullable] |
Since: 1.0
int
adw_avatar_get_size (AdwAvatar *self
);
Returns the size of the avatar.
Since: 1.0
void adw_avatar_set_size (AdwAvatar *self
,int size
);
Sets the size of the avatar.
Since: 1.0
“icon-name”
property “icon-name” char *
The name of the icon in the icon theme to use when the icon should be displayed. If no name is set, the avatar-default-symbolic icon will be used. If the name doesn't match a valid icon, it is an error and no icon will be displayed. If the icon theme is changed, the image will be updated automatically.
Owner: AdwAvatar
Flags: Read / Write
Default value: NULL
Since: 1.0
“show-initials”
property “show-initials” gboolean
Whether to show the initials.
Owner: AdwAvatar
Flags: Read / Write
Default value: FALSE
“size”
property “size” int
The avatar size of the avatar.
Owner: AdwAvatar
Flags: Read / Write
Allowed values: >= -1
Default value: -1
Since: 1.0
“text”
property “text” char *
The text used for the initials and for generating the color.
If “show-initials” is FALSE
it's only used to generate the color.
Owner: AdwAvatar
Flags: Read / Write
Default value: NULL
Since: 1.0