qulogic/libgnt

Merged in default (pull request #37)

2019-04-21, Gary Kramlich
f217525f2e75
Merged in default (pull request #37)

Drop duplicated util code

Approved-by: Gary Kramlich
  • +3 -0
    ChangeLog.API
  • +0 -64
    gntutils.c
  • +0 -19
    gntutils.h
  • +3 -3
    gntwidget.c
  • +3 -3
    gntwm.c
  • --- a/ChangeLog.API Sat Apr 20 19:58:58 2019 -0400
    +++ b/ChangeLog.API Sun Apr 21 04:56:08 2019 +0000
    @@ -27,6 +27,9 @@
    * _GntProgressBarOrientation
    * _GntTreeColumnFlag
    * _GntWidgetFlags
    + * gnt_boolean_handled_accumulator; use
    + g_signal_accumulator_true_handled instead.
    + * gnt_widget_bindings_view; use gnt_bindable_bindings_view instead.
    version 2.13.0 (2018/03/08):
    No changes.
    --- a/gntutils.c Sat Apr 20 19:58:58 2019 -0400
    +++ b/gntutils.c Sun Apr 21 04:56:08 2019 +0000
    @@ -169,70 +169,6 @@
    return dest;
    }
    -gboolean
    -gnt_boolean_handled_accumulator(G_GNUC_UNUSED GSignalInvocationHint *ihint,
    - GValue *return_accu,
    - const GValue *handler_return,
    - G_GNUC_UNUSED gpointer dummy)
    -{
    - gboolean continue_emission;
    - gboolean signal_handled;
    -
    - signal_handled = g_value_get_boolean (handler_return);
    - g_value_set_boolean (return_accu, signal_handled);
    - continue_emission = !signal_handled;
    -
    - 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;
    -}
    -
    #ifndef NO_LIBXML
    static GntWidget *
    gnt_widget_from_xmlnode(xmlNode *node, GntWidget **data[], int max)
    --- a/gntutils.h Sat Apr 20 19:58:58 2019 -0400
    +++ b/gntutils.h Sun Apr 21 04:56:08 2019 +0000
    @@ -103,25 +103,6 @@
    GHashTable * gnt_hash_table_duplicate(GHashTable *src, GHashFunc hash, GEqualFunc equal, GDestroyNotify key_d, GDestroyNotify value_d, GntDuplicateFunc key_dup, GntDuplicateFunc value_dup);
    /**
    - * gnt_boolean_handled_accumulator:
    - *
    - * To be used with g_signal_new. Look in the key_pressed signal-definition in
    - * gntwidget.c for usage.
    - */
    -gboolean gnt_boolean_handled_accumulator(GSignalInvocationHint *ihint, GValue *return_accu, const GValue *handler_return, gpointer dummy);
    -
    -/**
    - * gnt_widget_bindings_view:
    - * @widget: The widget to get bindings for.
    - *
    - * Get a helpful display about the bindings of a widget.
    - *
    - * Returns: (transfer full): Returns a GntTree populated with "key" -> "binding"
    - * for the widget.
    - */
    -GntWidget * gnt_widget_bindings_view(GntWidget *widget);
    -
    -/**
    * gnt_util_parse_widgets:
    * @string: The XML string.
    * @num: The number of widgets to return, followed by 'num' GntWidget **
    --- a/gntwidget.c Sat Apr 20 19:58:58 2019 -0400
    +++ b/gntwidget.c Sun Apr 21 04:56:08 2019 +0000
    @@ -236,7 +236,7 @@
    G_TYPE_FROM_CLASS(klass),
    G_SIGNAL_RUN_LAST,
    G_STRUCT_OFFSET(GntWidgetClass, key_pressed),
    - gnt_boolean_handled_accumulator, NULL, NULL,
    + g_signal_accumulator_true_handled, NULL, NULL,
    G_TYPE_BOOLEAN, 1, G_TYPE_STRING);
    signals[SIG_CLICKED] =
    @@ -244,7 +244,7 @@
    G_TYPE_FROM_CLASS(klass),
    G_SIGNAL_RUN_LAST,
    G_STRUCT_OFFSET(GntWidgetClass, clicked),
    - gnt_boolean_handled_accumulator, NULL, NULL,
    + g_signal_accumulator_true_handled, NULL, NULL,
    G_TYPE_BOOLEAN, 3, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT);
    signals[SIG_CONTEXT_MENU] =
    @@ -252,7 +252,7 @@
    G_TYPE_FROM_CLASS(klass),
    G_SIGNAL_RUN_LAST,
    0,
    - gnt_boolean_handled_accumulator, NULL, NULL,
    + g_signal_accumulator_true_handled, NULL, NULL,
    G_TYPE_BOOLEAN, 0);
    /* This is relevant for all widgets */
    --- a/gntwm.c Sat Apr 20 19:58:58 2019 -0400
    +++ b/gntwm.c Sun Apr 21 04:56:08 2019 +0000
    @@ -1443,7 +1443,7 @@
    G_TYPE_FROM_CLASS(klass),
    G_SIGNAL_RUN_LAST,
    G_STRUCT_OFFSET(GntWMClass, window_resize_confirm),
    - gnt_boolean_handled_accumulator, NULL, NULL,
    + g_signal_accumulator_true_handled, NULL, NULL,
    G_TYPE_BOOLEAN, 3, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER);
    signals[SIG_CONFIRM_MOVE] =
    @@ -1451,7 +1451,7 @@
    G_TYPE_FROM_CLASS(klass),
    G_SIGNAL_RUN_LAST,
    G_STRUCT_OFFSET(GntWMClass, window_move_confirm),
    - gnt_boolean_handled_accumulator, NULL, NULL,
    + g_signal_accumulator_true_handled, NULL, NULL,
    G_TYPE_BOOLEAN, 3, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER);
    signals[SIG_RESIZED] =
    @@ -1489,7 +1489,7 @@
    G_TYPE_FROM_CLASS(klass),
    G_SIGNAL_RUN_LAST,
    G_STRUCT_OFFSET(GntWMClass, mouse_clicked),
    - gnt_boolean_handled_accumulator, NULL, NULL,
    + g_signal_accumulator_true_handled, NULL, NULL,
    G_TYPE_BOOLEAN, 4, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_POINTER);
    signals[SIG_TERMINAL_REFRESH] =