changeset 1272:f2c6be1c2b1a

Hide GntWM->acts.
author Elliott Sales de Andrade <quantum.analyst@gmail.com>
date Fri, 10 May 2019 01:00:51 -0400
parents 3790af6c87e7
children c4d01f7c0271
files gntmain.c gntwm.c gntwm.h gntwmprivate.h
diffstat 4 files changed, 21 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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 */