Helper Functions

Helper Functions — A collection of useful utilities and functions.

Synopsis

gulong              hildon_helper_set_logical_font      (GtkWidget *widget,
                                                         const gchar *logicalfontname);
gulong              hildon_helper_set_logical_color     (GtkWidget *widget,
                                                         GtkRcFlags rcflags,
                                                         GtkStateType state,
                                                         const gchar *logicalcolorname);
gboolean            hildon_helper_event_button_is_finger
                                                        (GdkEventButton *event);
void                hildon_helper_set_insensitive_message
                                                        (GtkWidget *widget,
                                                         const gchar *message);
void                hildon_helper_set_insensitive_messagef
                                                        (GtkWidget *widget,
                                                         const gchar *format,
                                                         ...);
void                hildon_helper_set_thumb_scrollbar   (GtkScrolledWindow *win,
                                                         gboolean thumb);
gchar*              hildon_format_file_size_for_display (goffset size);

Description

Hildon provides some helper functions that can be used for commonly performed tasks and functionality blocks. This includes operations on widget styles and probing functions for touch events.

Details

hildon_helper_set_logical_font ()

gulong              hildon_helper_set_logical_font      (GtkWidget *widget,
                                                         const gchar *logicalfontname);

This function assigns a defined logical font to the widget and all its child widgets. it also connects to the "style_set" signal which will retrieve & assign the new font for the given logical name each time the theme is changed The returned signal id can be used to disconnect the signal. When calling multiple times the previous signal (obtained by calling this function) is disconnected automatically and should not be used.

widget : a GtkWidget to assign this logical font for.
logicalfontname : a gchar* with the logical font name to assign to the widget.
Returns : the signal id that is triggered every time theme is changed. 0 if font set failed.

hildon_helper_set_logical_color ()

gulong              hildon_helper_set_logical_color     (GtkWidget *widget,
                                                         GtkRcFlags rcflags,
                                                         GtkStateType state,
                                                         const gchar *logicalcolorname);

This function assigns a defined logical color to the widget and all it's child widgets. It also connects to the "style_set" signal which will retrieve & assign the new color for the given logical name each time the theme is changed. The returned signal id can be used to disconnect the signal. When calling multiple times the previous signal (obtained by calling this function) is disconnected automatically and should not be used.

Example : If the style you want to modify is bg[NORMAL] then set rcflags to GTK_RC_BG and state to GTK_STATE_NORMAL.

widget : A GtkWidget to assign this logical font for.
rcflags : GtkRcFlags enumeration defining whether to assign to FG, BG, TEXT or BASE style.
state : GtkStateType indicating to which state to assign the logical color
logicalcolorname : A gchar* with the logical font name to assign to the widget.
Returns : The signal id that is triggered every time theme is changed. 0 if color set failed.

hildon_helper_event_button_is_finger ()

gboolean            hildon_helper_event_button_is_finger
                                                        (GdkEventButton *event);

Checks if the given button event is a finger event.

event : A GtkEventButton to check
Returns : TRUE if the event is a finger event.

hildon_helper_set_insensitive_message ()

void                hildon_helper_set_insensitive_message
                                                        (GtkWidget *widget,
                                                         const gchar *message);

Warning

hildon_helper_set_insensitive_message is deprecated and should not be used in newly-written code. As of hildon 2.2, it is strongly discouraged to use insensitive messages.

This function assigns an insensitive message to a widget. When the widget is in an insensitive state and the user activates it, the message will be displayed using a standard HildonBanner.

widget : A GtkWidget to assign a banner to
message : A message to display to the user

hildon_helper_set_insensitive_messagef ()

void                hildon_helper_set_insensitive_messagef
                                                        (GtkWidget *widget,
                                                         const gchar *format,
                                                         ...);

Warning

hildon_helper_set_insensitive_messagef is deprecated and should not be used in newly-written code. As of hildon 2.2, it is strongly discouraged to use insensitive messages.

A version of hildon_helper_set_insensitive_message with string formatting.

widget : A GtkWidget to assign a banner to
format : a printf-like format string
... : arguments for the format string

hildon_helper_set_thumb_scrollbar ()

void                hildon_helper_set_thumb_scrollbar   (GtkScrolledWindow *win,
                                                         gboolean thumb);

This function enables a thumb scrollbar on a given scrolled window. It'll convert the existing normal scrollbar into a larger, finger-usable scrollbar that works without a stylus. As fingerable list rows are fairly high, consider using the whole available vertical space of your application for the content in order to have as many rows as possible visible on the screen at once.

Finger-Sized scrollbar should always be used together with finger-sized content.

win : A GtkScrolledWindow to use as target
thumb : TRUE to enable the thumb scrollbar, FALSE to disable

hildon_format_file_size_for_display ()

gchar*              hildon_format_file_size_for_display (goffset size);

Formats a file size in bytes for display in applications.

This function is similar to g_format_file_size_for_display() but the translations are from Maemo so might differ slightly.

size : a size in bytes
Returns :

Since 2.2