qulogic/libgnt
Clone
Summary
Browse
Changes
Graph
Deprecate gnt_widget_bindings_view.
release-2.x.y
2019-04-20, Elliott Sales de Andrade
1fecc17b2bb5
Parents
9cc02e895ebc
Children
77ea217eb3b9
Deprecate gnt_widget_bindings_view.
Use gnt_bindable_bindings_view instead.
2 files changed, 6 insertions(+), 45 deletions(-)
+1
-44
gntutils.c
+5
-1
gntutils.h
--- a/gntutils.c Sat Apr 20 02:17:13 2019 -0400
+++ b/gntutils.c Sat Apr 20 22:51:41 2019 -0400
@@ -186,52 +186,9 @@
return continue_emission;
}
-typedef struct {
- GHashTable *hash;
- GntTree *tree;
-} BindingView;
-
-static void
-add_binding(gpointer key, gpointer value, gpointer data)
-{
- BindingView *bv = data;
- GntBindableActionParam *act = value;
- const char *name = g_hash_table_lookup(bv->hash, act->action);
- if (name && *name) {
- const char *k = gnt_key_lookup(key);
- if (!k)
- k = key;
- gnt_tree_add_row_after(bv->tree, (gpointer)k,
- gnt_tree_create_row(bv->tree, k, name), NULL, NULL);
- }
-}
-
-static void
-add_action(gpointer key, gpointer value, gpointer data)
-{
- BindingView *bv = data;
- g_hash_table_insert(bv->hash, value, key);
-}
-
GntWidget *gnt_widget_bindings_view(GntWidget *widget)
{
- GntBindable *bind = GNT_BINDABLE(widget);
- GntWidget *tree = gnt_tree_new_with_columns(2);
- GntBindableClass *klass = GNT_BINDABLE_CLASS(GNT_BINDABLE_GET_CLASS(bind));
- GHashTable *hash = g_hash_table_new(g_direct_hash, g_direct_equal);
- BindingView bv = {hash, GNT_TREE(tree)};
-
- gnt_tree_set_compare_func(bv.tree, (GCompareFunc)g_utf8_collate);
- g_hash_table_foreach(klass->actions, add_action, &bv);
- g_hash_table_foreach(klass->bindings, add_binding, &bv);
- if (GNT_TREE(tree)->list == NULL) {
- gnt_widget_destroy(tree);
- tree = NULL;
- } else
- gnt_tree_adjust_columns(bv.tree);
- g_hash_table_destroy(hash);
-
- return tree;
+ return GNT_WIDGET(gnt_bindable_bindings_view(GNT_BINDABLE(widget)));
}
#ifndef NO_LIBXML
--- a/gntutils.h Sat Apr 20 02:17:13 2019 -0400
+++ b/gntutils.h Sat Apr 20 22:51:41 2019 -0400
@@ -118,8 +118,12 @@
*
* Returns: (transfer full): Returns a GntTree populated with "key" -> "binding"
* for the widget.
+ *
+ * Deprecated: 2.14.0: Use gnt_bindable_bindings_view() instead.
*/
-GntWidget * gnt_widget_bindings_view(GntWidget *widget);
+#ifndef GNT_DISABLE_DEPRECATED
+GntWidget *gnt_widget_bindings_view(GntWidget *widget) G_GNUC_DEPRECATED;
+#endif
/**
* gnt_util_parse_widgets: