grim/libgnt
Clone
Summary
Browse
Changes
Graph
Add docs for callback prototypes.
2019-08-28, Elliott Sales de Andrade
30bca5cf8435
Parents
1d54c0fddb2c
Children
238eca118966
Add docs for callback prototypes.
4 files changed, 49 insertions(+), 11 deletions(-)
+17
-3
gntbindable.h
+8
-1
gntmenuitem.h
+17
-7
gnttree.h
+7
-0
gntutils.h
--- a/gntbindable.h Wed Aug 28 17:25:18 2019 -0400
+++ b/gntbindable.h Wed Aug 28 21:10:11 2019 -0400
@@ -74,10 +74,24 @@
/******************/
const char * gnt_bindable_remap_keys(GntBindable *bindable, const char *text);
-/******************/
+/********************/
/* Bindable Actions */
-/******************/
-typedef gboolean (*GntBindableActionCallback) (GntBindable *bindable, GList *params);
+/********************/
+/**
+ * GntBindableActionCallback:
+ * @bindable: A bindable object.
+ * @params: Parameters passed to gnt_bindable_class_register_action().
+ *
+ * A callback for an action registered by gnt_bindable_class_register_action().
+ */
+typedef gboolean (*GntBindableActionCallback)(GntBindable *bindable,
+ GList *params);
+/**
+ * GntBindableActionCallbackNoParam:
+ * @bindable: A bindable object.
+ *
+ * A callback for an action with no parameters.
+ */
typedef gboolean (*GntBindableActionCallbackNoParam)(GntBindable *bindable);
/**
--- a/gntmenuitem.h Wed Aug 28 17:25:18 2019 -0400
+++ b/gntmenuitem.h Wed Aug 28 21:10:11 2019 -0400
@@ -39,6 +39,13 @@
#define GNT_TYPE_MENU_ITEM gnt_menuitem_get_type()
+/**
+ * GntMenuItemCallback:
+ * @item: The menu item which was activated.
+ * @data: The user data specified in gnt_menuitem_set_callback().
+ *
+ * A callback for when a menu item is activated.
+ */
typedef void (*GntMenuItemCallback)(GntMenuItem *item, gpointer data);
/**
@@ -77,7 +84,7 @@
/**
* gnt_menuitem_set_callback:
* @item: The menuitem.
- * @callback: (scope call): The callback function.
+ * @callback: (scope async): The callback function.
* @data: Data to send to the callback function.
*
* Set a callback function for a menuitem.
--- a/gnttree.h Wed Aug 28 17:25:18 2019 -0400
+++ b/gnttree.h Wed Aug 28 21:10:11 2019 -0400
@@ -75,6 +75,21 @@
};
/**
+ * GntTreeSearchFunc:
+ * @tree: The tree being searched.
+ * @key: The key of a row.
+ * @search: The search string.
+ * @current: The content of row in the search column.
+ *
+ * A custom tree search function.
+ *
+ * Returns: If %TRUE, the row should be displayed, otherwise it's not.
+ */
+typedef gboolean (*GntTreeSearchFunc)(GntTree *tree, gpointer key,
+ const gchar *search,
+ const gchar *current);
+
+/**
* gnt_tree_row_get_type:
*
* Returns: The #GType for the #GntTreeRow boxed structure.
@@ -640,18 +655,13 @@
/**
* gnt_tree_set_search_function:
* @tree: The tree
- * @func: The custom search function. The search function is
- * sent the tree itself, the key of a row, the search
- * string and the content of row in the search column.
- * If the function returns %TRUE, the row is dislayed,
- * otherwise it's not.
+ * @func: The custom search function.
*
* Set a custom search function.
*
* Since: 2.1.0
*/
-void gnt_tree_set_search_function(GntTree *tree,
- gboolean (*func)(GntTree *tree, gpointer key, const char *search, const char *current));
+void gnt_tree_set_search_function(GntTree *tree, GntTreeSearchFunc func);
/**
* gnt_tree_get_parent_key:
--- a/gntutils.h Wed Aug 28 17:25:18 2019 -0400
+++ b/gntutils.h Wed Aug 28 21:10:11 2019 -0400
@@ -35,6 +35,13 @@
#include "gnttextview.h"
#include "gntwidget.h"
+/**
+ * GntDuplicateFunc:
+ * @data: The data to be copied.
+ *
+ * A function used to duplicate some data in a hash table. See
+ * gnt_hash_table_duplicate().
+ */
typedef gpointer (*GntDuplicateFunc)(gconstpointer data);
/**