st-util

st-util — miscellaneous utility functions.

Synopsis




#define     ST_NUMERIC
char*       st_format_bitrate               (int bitrate);
char*       st_format_samplerate            (int samplerate);
char*       st_format_channels              (int channels);
char*       st_format_audio_properties      (int bitrate,
                                             int samplerate,
                                             int channels);
char*       st_strchr_span                  (const char *str,
                                             int c);
char*       st_strstr_span                  (const char *big,
                                             const char *little);
char*       st_str_has_prefix_span          (const char *str,
                                             const char *prefix);
gboolean    st_str_like                     (const char *str,
                                             const char *charset);
GdkPixbuf*  st_pixbuf_new_from_file         (const char *filename);
GtkWidget*  st_hig_section_new              (const char *title,
                                             GtkWidget *contents);
void        st_set_tooltip                  (GtkWidget *widget,
                                             const char *tooltip);

Description

Details

ST_NUMERIC

#define ST_NUMERIC			"0123456789"


st_format_bitrate ()

char*       st_format_bitrate               (int bitrate);

Formats bitrate as a string.

bitrate : a bitrate to format, expressed in kilobits per seconds.
Returns : bitrate formatted as a string, which should be freed when no longer needed.

st_format_samplerate ()

char*       st_format_samplerate            (int samplerate);

Formats samplerate as a string.

samplerate : a samplerate to format, expressed in Hz.
Returns : samplerate formatted as a string, which should be freed when no longer needed.

st_format_channels ()

char*       st_format_channels              (int channels);

Formats channels as a string.

channels : a number of audio channels, which must be greater than 0.
Returns : channels formatted as a string, which should be freed when no longer needed.

st_format_audio_properties ()

char*       st_format_audio_properties      (int bitrate,
                                             int samplerate,
                                             int channels);

Formats bitrate, samplerate and channels as a string.

bitrate : a bitrate expressed in kbps, or 0.
samplerate : a samplerate expressed in kbps, or 0.
channels : a number of audio channels, or 0.
Returns : a formatted string, which should be freed when no longer needed.

st_strchr_span ()

char*       st_strchr_span                  (const char *str,
                                             int c);

Locates the first occurrence of c (converted to a char) in str.

str : a string.
c : a character to locate, which must not be 0.
Returns : a pointer to the character following the first occurrence of c in str, or NULL if c does not appear in str.

st_strstr_span ()

char*       st_strstr_span                  (const char *big,
                                             const char *little);

Locates the first occurrence of little in big.

big : a string.
little : a string to search for in big.
Returns : a pointer to the character following the first occurrence of little in big, or NULL if little does not appear in big.

st_str_has_prefix_span ()

char*       st_str_has_prefix_span          (const char *str,
                                             const char *prefix);

Checks if str begins with prefix.

str : a string.
prefix : the prefix to look for.
Returns : a pointer to the character following prefix in str, or NULL if str does not begin with prefix.

st_str_like ()

gboolean    st_str_like                     (const char *str,
                                             const char *charset);

Checks if all the characters of str are members of charset.

str : a string.
charset : a set of characters.
Returns : TRUE if all the characters of str are members of charset.

st_pixbuf_new_from_file ()

GdkPixbuf*  st_pixbuf_new_from_file         (const char *filename);

Creates a new pixbuf by loading an image from a file. If the file cannot be loaded, st_notice() will be used to print the error.

filename : the name of the file to load.
Returns : a new GdkPixbuf, or NULL on error.

st_hig_section_new ()

GtkWidget*  st_hig_section_new              (const char *title,
                                             GtkWidget *contents);

Creates a new HIG-compliant section, as defined by Window Layout.

title : the section title.
contents : the widget to use as section contents.
Returns : a new GtkVBox containing title and contents.

st_set_tooltip ()

void        st_set_tooltip                  (GtkWidget *widget,
                                             const char *tooltip);

Sets the tooltip of widget using the global GtkTooltips object used by streamtuner.

widget : a widget.
tooltip : a tooltip text.