![]() |
![]() |
![]() |
Glade UI Builder Reference Manual | ![]() |
---|---|---|---|---|
#include <glade.h> void glade_util_widget_set_tooltip (GtkWidget *widget, const gchar *str); GType glade_util_get_type_from_name (const gchar *name, gboolean have_func); GParamSpec* glade_utils_get_pspec_from_funcname (const gchar *funcname); enum GladeUIMessageType; gboolean glade_util_ui_message (GtkWidget *parent, GladeUIMessageType type, const gchar *format, ...); void glade_util_flash_message (GtkWidget *statusbar, guint context_id, gchar *format, ...); gint glade_util_compare_stock_labels (gconstpointer a, gconstpointer b); void glade_util_hide_window (GtkWindow *window); gchar* glade_util_gtk_combo_func (gpointer data); gpointer glade_util_gtk_combo_find (GtkCombo *combo); GtkWidget* glade_util_file_dialog_new (const gchar *title, GtkWindow *parent, GladeUtilFileDialogType action); void glade_util_replace (gchar *str, gchar a, gchar b); gchar* glade_util_read_prop_name (const gchar *str); gchar* glade_util_duplicate_underscores (const gchar *name); void glade_util_add_selection (GtkWidget *widget); void glade_util_remove_selection (GtkWidget *widget); gboolean glade_util_has_selection (GtkWidget *widget); void glade_util_clear_selection (void); GList* glade_util_get_selection (void); void glade_util_queue_draw_nodes (GdkWindow *window); GladeWidget* glade_util_get_parent (GtkWidget *w); GList* glade_util_container_get_all_children (GtkContainer *container); gint glade_util_count_placeholders (GladeWidget *parent); GtkTreeIter* glade_util_find_iter_by_widget (GtkTreeModel *model, GladeWidget *findme, gint column); gboolean glade_util_basenames_match (const gchar *path1, const gchar *path2); GList* glade_util_purify_list (GList *list); GList* glade_util_removed_from_list (GList *old_list, GList *new_list); GList* glade_util_added_in_list (GList *old_list, GList *new_list); gchar* glade_util_canonical_path (const gchar *path); gboolean glade_util_copy_file (const gchar *src_path, const gchar *dest_path); gboolean glade_util_file_is_writeable (const gchar *path); GModule* glade_util_load_library (const gchar *library_name); gboolean glade_util_class_implements_interface (GType class_type, GType iface_type); gboolean glade_util_have_devhelp (void); void glade_util_search_devhelp (const gchar *book, const gchar *page, const gchar *search); gboolean glade_util_deep_fixed_event (GtkWidget *widget, GdkEvent *event, GladeWidget *gwidget);
void glade_util_widget_set_tooltip (GtkWidget *widget, const gchar *str);
Creates a new tooltip from str
and sets widget
to use it.
widget : |
a GtkWidget |
str : |
a string |
GType glade_util_get_type_from_name (const gchar *name, gboolean have_func);
Returns the type using the "get type" function name based on name
.
If the have_func
flag is true,name
is used directly, otherwise the get-type
function is contrived from name
then used.
GParamSpec* glade_utils_get_pspec_from_funcname (const gchar *funcname);
funcname : |
the symbol name of a function to generate a GParamSpec |
Returns : | A GParamSpec created by the delagate function
specified by funcname
|
typedef enum { GLADE_UI_INFO, GLADE_UI_WARN, GLADE_UI_ERROR, GLADE_UI_ARE_YOU_SURE, GLADE_UI_YES_OR_NO } GladeUIMessageType;
gboolean glade_util_ui_message (GtkWidget *parent, GladeUIMessageType type, const gchar *format, ...);
Creates a new warning dialog window as a child of parent
containing
the text of format
, runs it, then destroys it on close. Depending
on type
, a cancel button may apear or the icon may change.
parent : |
a GtkWindow cast as a GtkWidget |
type : |
a GladeUIMessageType |
format : |
a printf style format string |
... : |
args for the format. |
Returns : | True if the type was GLADE_UI_ARE_YOU_SURE and the user
selected "OK", True if the type was GLADE_UI_YES_OR_NO and
the user selected "YES"; False otherwise.
|
void glade_util_flash_message (GtkWidget *statusbar, guint context_id, gchar *format, ...);
statusbar : |
|
context_id : |
|
format : |
|
... : |
gint glade_util_compare_stock_labels (gconstpointer a, gconstpointer b);
This is a GCompareFunc that compares the labels of two stock items, ignoring any '_' characters. It isn't particularly efficient.
a : |
a gconstpointer to a GtkStockItem |
b : |
a gconstpointer to a GtkStockItem |
Returns : | negative value if a < b ; zero if a = b ;
positive value if a > b
|
void glade_util_hide_window (GtkWindow *window);
If you use this function to handle the delete_event of a window, when it will be shown again it will appear in the position where it was before beeing hidden.
window : |
a GtkWindow |
gchar* glade_util_gtk_combo_func (gpointer data);
TODO: write me
data : |
|
Returns : |
gpointer glade_util_gtk_combo_find (GtkCombo *combo);
TODO: write me
combo : |
|
Returns : |
GtkWidget* glade_util_file_dialog_new (const gchar *title, GtkWindow *parent, GladeUtilFileDialogType action);
title : |
dialog title |
parent : |
the parent GtkWindow for the dialog |
action : |
a GladeUtilFileDialogType to say if the dialog will open or save |
Returns : | a "glade file" file chooser dialog. The caller is responsible for showing the dialog |
void glade_util_replace (gchar *str, gchar a, gchar b);
Replaces each occurance of the character a
in str
to b
.
gchar* glade_util_read_prop_name (const gchar *str);
Return a usable version of a property identifier as found in a freshly parserd GladeInterface
str : |
a string |
Returns : |
gchar* glade_util_duplicate_underscores (const gchar *name);
Duplicates name
, but the copy has two underscores in place of any single
underscore in the original.
name : |
a string |
Returns : | a newly allocated string |
void glade_util_add_selection (GtkWidget *widget);
Add visual selection to this GtkWidget
widget : |
a GtkWidget |
void glade_util_remove_selection (GtkWidget *widget);
Remove visual selection from this GtkWidget
widget : |
a GtkWidget |
void glade_util_queue_draw_nodes (GdkWindow *window);
This function should be called whenever a widget in the interface receives an expose event. It sets up an idle function which will redraw any selection nodes that intersect the the exposed window.
window : |
A GdkWindow |
GList* glade_util_container_get_all_children (GtkContainer *container);
Use this to itterate over all children in a GtkContainer,
as it used _forall()
instead of _foreach()
(and the GTK+ version
of this function is simply not exposed).
Note that glade_widget_class_get_children()
is the high-level
abstraction and will usually end up calling this function.
container : |
a GtkContainer |
Returns : | a GList giving the contents of container
|
gint glade_util_count_placeholders (GladeWidget *parent);
parent : |
a GladeWidget |
Returns : | the amount of GladePlaceholders parented by parent
|
GtkTreeIter* glade_util_find_iter_by_widget (GtkTreeModel *model, GladeWidget *findme, gint column);
Looks through model
for the GtkTreeIter corresponding to
findme
under column
.
model : |
a GtkTreeModel |
findme : |
a GladeWidget |
column : |
a gint |
Returns : | a newly allocated GtkTreeIter from model corresponding
to findme which should be freed with gtk_tree_iter_free()
|
gboolean glade_util_basenames_match (const gchar *path1, const gchar *path2);
path1 : |
|
path2 : |
|
Returns : |
GList* glade_util_purify_list (GList *list);
list : |
A GList |
Returns : | A newly allocated version of list with no
duplicate data entries
|
GList* glade_util_removed_from_list (GList *old_list, GList *new_list);
old_list : |
|
new_list : |
|
Returns : | A newly allocated GList of elements that
are in old no longer in new
|
GList* glade_util_added_in_list (GList *old_list, GList *new_list);
old_list : |
|
new_list : |
|
Returns : | A newly allocated GList of elements that
are in new but not in old
|
gchar* glade_util_canonical_path (const gchar *path);
path : |
any path that may contain ".." or "." components |
Returns : | an absolute path to the specified file or directory
that contains no ".." or "." components (this does
not call readlink like realpath() does).
Note: on some systems; I think its possible that we dont have
permission to execute in the directory in which the glade
file resides; I decided finally to do it this way anyway
since libc's realpath() does exactly the same.
|
gboolean glade_util_copy_file (const gchar *src_path, const gchar *dest_path);
Copies a file from src
to dest
, queries the user
if it involves overwriting the target and displays an
error message upon failure.
src_path : |
the path to the source file |
dest_path : |
the path to the destination file to create or overwrite. |
Returns : | True if the copy was successfull. |
gboolean glade_util_file_is_writeable (const gchar *path);
Checks whether the file at path
is writeable
path : |
the path to the file |
Returns : | TRUE if file is writeable |
GModule* glade_util_load_library (const gchar *library_name);
Loads the named library from the Glade modules directory, or failing that from the standard platform specific directories.
The library_name
should not include any platform specifix prefix or suffix,
those are automatically added, if needed, by g_module_build_path()
gboolean glade_util_class_implements_interface (GType class_type, GType iface_type);
gboolean glade_util_have_devhelp (void);
Returns : | whether the devhelp module is loaded |
void glade_util_search_devhelp (const gchar *book, const gchar *page, const gchar *search);
book : |
|
page : |
|
search : |
gboolean glade_util_deep_fixed_event (GtkWidget *widget, GdkEvent *event, GladeWidget *gwidget);
widget : |
|
event : |
|
gwidget : |
|
Returns : |