ui_parse.h
2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef UIPARSER_H_INCLUDED
#define UIPARSER_H_INCLUDED 1
/**
* List of special widgets on UI.
*
* Usually used for populating special menu entryes like input-method list.
*
*/
struct ui_menu_setup_table
{
const gchar *name; /**< Menu item name */
void (*setup)(GtkWidget *widget); /**< Setup callback */
};
/**
* Create a toplevel window based on the XML files.
*
* @param path Folder to search for .xml files.
* @param app_widget Main application widget.
* @param setup Callback table for populating dinamic sub-menus
*
* @return Created toplevel window.
*
*/
LOCAL_EXTERN GtkWidget * create_window_from_ui_files(const gchar *path, GtkWidget *app_widget, const struct ui_menu_setup_table *setup_table);
/**
* Get an attribute from xml list.
*
* @param names List of attribute names
* @param values List of attribute values
* @param key Attribute name to get
*
* @return Attribute value, or NULL.
*
*/
LOCAL_EXTERN const gchar * get_xml_attribute(const gchar **names, const gchar **values, const gchar *key);
/**
* Setup action attributes.
*
* Set action properties based on the xml descriptor. This function will be called for every
* entry of the action in the xml files but, the callback will be set only in the first call.
*
* @param action Action object to setup.
* @param name Action callback name.
* @param connect Connect signals.
* @param names Attribute names.
* @param values Atrribute values.
* @param error Pointer to the error object.
*
* @return 0 if the action is valid, non zero if not
*
*/
LOCAL_EXTERN int action_setup_default(GtkAction *action, const gchar *name, gboolean connect, const gchar **names, const gchar **values, GError **error);
LOCAL_EXTERN int action_setup_toggle(GtkAction *action, const gchar *name, gboolean connect, const gchar **names, const gchar **values, GError **error);
LOCAL_EXTERN int action_setup_toggleset(GtkAction *action, const gchar *name, gboolean connect, const gchar **names, const gchar **values, GError **error);
LOCAL_EXTERN int action_setup_togglereset(GtkAction *action, const gchar *name, gboolean connect, const gchar **names, const gchar **values, GError **error);
LOCAL_EXTERN int action_setup_pfkey(GtkAction *action, const gchar *name, gboolean connect, const gchar **names, const gchar **values, GError **error);
LOCAL_EXTERN int action_setup_pakey(GtkAction *action, const gchar *name, gboolean connect, const gchar **names, const gchar **values, GError **error);
#endif // UIPARSER_H_INCLUDED