qulogic/libgnt

Hide GntWM->acts.

2019-05-10, Elliott Sales de Andrade
f2c6be1c2b1a
Parents 3790af6c87e7
Children c4d01f7c0271
Hide GntWM->acts.
  • +1 -1
    gntmain.c
  • +18 -3
    gntwm.c
  • +0 -3
    gntwm.h
  • +2 -0
    gntwmprivate.h
  • --- a/gntmain.c Fri May 10 00:50:32 2019 -0400
    +++ b/gntmain.c Fri May 10 01:00:51 2019 -0400
    @@ -815,7 +815,7 @@
    action->label = g_strdup(label);
    action->callback = callback;
    - wm->acts = g_list_append(wm->acts, action);
    + gnt_wm_add_action(wm, action);
    }
    static void
    --- a/gntwm.c Fri May 10 00:50:32 2019 -0400
    +++ b/gntwm.c Fri May 10 01:00:51 2019 -0400
    @@ -82,6 +82,8 @@
    GntListWindow list;
    GntListWindow *windows; /* Window-list window */
    GntListWindow *actions; /* Action-list window */
    +
    + GList *acts; /* List of actions */
    } GntWMPrivate;
    enum
    @@ -1008,8 +1010,9 @@
    return TRUE;
    }
    - if (wm->acts == NULL)
    + if (priv->acts == NULL) {
    return TRUE;
    + }
    setup__list(wm);
    priv->actions = &priv->list;
    @@ -1022,13 +1025,13 @@
    /* XXX: Do we really want this? */
    gnt_tree_set_compare_func(GNT_TREE(tree), compare_action);
    - for (iter = wm->acts; iter; iter = iter->next) {
    + for (iter = priv->acts; iter; iter = iter->next) {
    GntAction *action = iter->data;
    gnt_tree_add_row_last(GNT_TREE(tree), action,
    gnt_tree_create_row(GNT_TREE(tree), action->label), NULL);
    }
    g_signal_connect(G_OBJECT(tree), "activate", G_CALLBACK(action_list_activate), wm);
    - n = g_list_length(wm->acts);
    + n = g_list_length(priv->acts);
    gnt_widget_set_size(tree, 0, n);
    gnt_widget_set_position(win, 0, getmaxy(stdscr) - 3 - n);
    @@ -2359,6 +2362,18 @@
    return priv->list.window == widget;
    }
    +/* Private. */
    +void
    +gnt_wm_add_action(GntWM *wm, GntAction *action)
    +{
    + GntWMPrivate *priv = NULL;
    +
    + g_return_if_fail(GNT_IS_WM(wm));
    + priv = gnt_wm_get_instance_private(wm);
    +
    + priv->acts = g_list_append(priv->acts, action);
    +}
    +
    void gnt_wm_set_event_stack(GntWM *wm, gboolean set)
    {
    wm->event_stack = set;
    --- a/gntwm.h Fri May 10 00:50:32 2019 -0400
    +++ b/gntwm.h Fri May 10 01:00:51 2019 -0400
    @@ -85,7 +85,6 @@
    /**
    * GntWM:
    - * @acts: List of actions
    * @menu: Currently active menu. There can be at most one menu at a time on the
    * screen. If there is a menu being displayed, then all the keystrokes
    * will be sent to the menu until it is closed, either when the user
    @@ -110,8 +109,6 @@
    GHashTable *GNTSEAL(name_places); /* window name -> ws*/
    GHashTable *GNTSEAL(title_places); /* window title -> ws */
    - GList *GNTSEAL(acts);
    -
    GntMenu *GNTSEAL(menu);
    gboolean GNTSEAL(event_stack);
    --- a/gntwmprivate.h Fri May 10 00:50:32 2019 -0400
    +++ b/gntwmprivate.h Fri May 10 01:00:51 2019 -0400
    @@ -40,6 +40,8 @@
    */
    gboolean gnt_wm_is_list_window(GntWM *wm, GntWidget *widget);
    +void gnt_wm_add_action(GntWM *wm, GntAction *action);
    +
    G_END_DECLS
    #endif /* GNT_WM_PRIVATE_H */