--- a/gntmain.c Sat May 11 01:00:16 2019 +0000
+++ b/gntmain.c Fri May 10 20:33:50 2019 -0400
@@ -241,7 +241,7 @@
} else if (event == GNT_MOUSE_UP) {
if (button == MOUSE_NONE && y == getmaxy(stdscr) - 1) {
/* Clicked on the taskbar */
- int n = g_list_length(gnt_ws_get_list(
+ int n = g_list_length(gnt_ws_get_widgets( gnt_wm_get_current_workspace(wm)));
int width = getmaxx(stdscr) / n;
--- a/gntwm.c Sat May 11 01:00:16 2019 +0000
+++ b/gntwm.c Fri May 10 20:33:50 2019 -0400
@@ -477,7 +477,7 @@
w = gnt_ws_get_top_widget(priv->cws);
- list = gnt_ws_get_list(priv->cws);
+ list = gnt_ws_get_widgets(priv->cws); orgpos = pos = g_list_index(list, w);
g_return_if_fail(pos >= 0);
@@ -531,7 +531,7 @@
- if ((l = g_list_nth(gnt_ws_get_list(priv->cws), n)) != NULL) {
+ if ((l = g_list_nth(gnt_ws_get_widgets(priv->cws), n)) != NULL) { gnt_wm_raise_window(wm, l->data);
@@ -659,7 +659,8 @@
GntTree *tree = GNT_TREE(priv->windows->tree);
- for (iter = gnt_ws_get_list(priv->cws); iter; iter = iter->next) {
+ for (iter = gnt_ws_get_widgets(priv->cws); iter; GntBox *box = GNT_BOX(iter->data);
@@ -674,7 +675,7 @@
for (; ws; ws = ws->next) {
gnt_tree_add_row_last(tree, ws->data,
gnt_tree_create_row(tree, gnt_ws_get_name(GNT_WS(ws->data))), NULL);
- for (iter = gnt_ws_get_list(GNT_WS(ws->data)); iter;
+ for (iter = gnt_ws_get_widgets(GNT_WS(ws->data)); iter; GntBox *box = GNT_BOX(iter->data);
@@ -940,7 +941,7 @@
shift_window(GntWMPrivate *priv, GntWidget *widget, int dir)
- GList *all = gnt_ws_get_list(priv->cws);
+ GList *all = gnt_ws_get_widgets(priv->cws); GList *list = g_list_find(all, widget);
@@ -1828,7 +1829,7 @@
static gint widget_in_workspace(gconstpointer workspace, gconstpointer wid)
GntWS *s = (GntWS *)workspace;
- GList *list = gnt_ws_get_list(s);
+ GList *list = gnt_ws_get_widgets(s); if (list && g_list_find(list, wid)) {
@@ -2063,7 +2064,7 @@
- pos = g_list_index(gnt_ws_get_list(s), widget);
+ pos = g_list_index(gnt_ws_get_widgets(s), widget); gnt_ws_remove_widget(s, widget);
--- a/gntws.c Sat May 11 01:00:16 2019 +0000
+++ b/gntws.c Fri May 10 20:33:50 2019 -0400
@@ -148,6 +148,15 @@
+gnt_ws_is_empty(GntWS *ws) + GntWSPrivate *priv = NULL; + g_return_val_if_fail(GNT_IS_WS(ws), TRUE); + priv = gnt_ws_get_instance_private(ws); + return priv->ordered == NULL; void gnt_ws_add_widget(GntWS *ws, GntWidget* wid)
GntWSPrivate *priv = NULL;
@@ -174,6 +183,28 @@
priv->ordered = g_list_remove(priv->ordered, wid);
+gnt_ws_get_top_widget(GntWS *ws) + GntWSPrivate *priv = NULL; + g_return_val_if_fail(GNT_IS_WS(ws), NULL); + priv = gnt_ws_get_instance_private(ws); + return priv->ordered ? priv->ordered->data : NULL; +gnt_ws_get_widgets(GntWS *ws) + GntWSPrivate *priv = NULL; + g_return_val_if_fail(GNT_IS_WS(ws), NULL); + priv = gnt_ws_get_instance_private(ws); gnt_ws_set_name(GntWS *ws, const gchar *name)
@@ -254,26 +285,6 @@
-gnt_ws_get_list(GntWS *ws)
- GntWSPrivate *priv = NULL;
- g_return_val_if_fail(GNT_IS_WS(ws), NULL);
- priv = gnt_ws_get_instance_private(ws);
-gnt_ws_is_empty(GntWS *ws)
- GntWSPrivate *priv = NULL;
- g_return_val_if_fail(GNT_IS_WS(ws), TRUE);
- priv = gnt_ws_get_instance_private(ws);
- return priv->ordered == NULL;
gnt_ws_is_single(GntWS *ws)
@@ -284,16 +295,6 @@
-gnt_ws_get_top_widget(GntWS *ws)
- GntWSPrivate *priv = NULL;
- g_return_val_if_fail(GNT_IS_WS(ws), NULL);
- priv = gnt_ws_get_instance_private(ws);
- return priv->ordered ? priv->ordered->data : NULL;
gnt_ws_is_top_widget(GntWS *ws, GntWidget *widget)
--- a/gntws.h Sat May 11 01:00:16 2019 +0000
+++ b/gntws.h Fri May 10 20:33:50 2019 -0400
@@ -83,6 +83,18 @@
void gnt_ws_set_name(GntWS *ws, const gchar *name);
+ * Gets whether the workspace contains no widgets. + * Returns: %TRUE if the workspace is empty, %FALSE otherwise. +gboolean gnt_ws_is_empty(GntWS *ws); * @widget: The widget to add.
@@ -105,6 +117,32 @@
void gnt_ws_remove_widget(GntWS *ws, GntWidget *widget);
+ * gnt_ws_get_top_widget: + * Gets the widget that is at the top of the workspace. + * Returns: (transfer none): The widget at the top of the workspace. +GntWidget *gnt_ws_get_top_widget(GntWS *ws); + * Gets all widgets contained in the workspace. This is probably only useful + * for implementing #GntWM subclasses. + * Returns: (transfer none) (element-type GntWidget): The list of widgets in +GList *gnt_ws_get_widgets(GntWS *ws); * @widget: The widget to hide.
* @nodes: A hashtable containing information about the widgets.
--- a/gntwsprivate.h Sat May 11 01:00:16 2019 +0000
+++ b/gntwsprivate.h Fri May 10 20:33:50 2019 -0400
@@ -29,16 +29,13 @@
/* Private access to some internals. Contact us if you need these. */
-gboolean gnt_ws_is_empty(GntWS *ws);
gboolean gnt_ws_is_single(GntWS *ws);
-GntWidget *gnt_ws_get_top_widget(GntWS *ws);
gboolean gnt_ws_is_top_widget(GntWS *ws, GntWidget *widget);
GList *gnt_ws_get_last(GntWS *ws);
void gnt_ws_append_widget(GntWS *ws, GntWidget *widget);
void gnt_ws_bring_to_front(GntWS *ws, GntWidget *widget);
void gnt_ws_set_list(GntWS *ws, GList *list);
-GList *gnt_ws_get_list(GntWS *ws);
--- a/wms/irssi.c Sat May 11 01:00:16 2019 +0000
+++ b/wms/irssi.c Fri May 10 20:33:50 2019 -0400
@@ -43,8 +43,6 @@
-#include "gntwsprivate.h"
#define GNT_TYPE_IRSSI_WM gnt_irssi_wm_get_type()
G_DECLARE_FINAL_TYPE(GntIrssiWM, gnt_irssi_wm, GNT, IRSSI_WM, GntWM)
@@ -246,7 +244,7 @@
G_OBJECT(win), "irssi-index",
GINT_TO_POINTER(g_list_index(
- gnt_ws_get_list(gnt_wm_get_current_workspace(wm)),
+ gnt_ws_get_widgets(gnt_wm_get_current_workspace(wm)), g_timeout_add(0, (GSourceFunc)update_conv_window_title, node);
--- a/wms/s.c Sat May 11 01:00:16 2019 +0000
+++ b/wms/s.c Fri May 10 20:33:50 2019 -0400
@@ -33,8 +33,6 @@
-#include "gntwsprivate.h"
#define GNT_TYPE_S_WM gnt_s_wm_get_type()
G_DECLARE_FINAL_TYPE(GntSWM, gnt_s_wm, GNT, S_WM, GntWM)
@@ -148,7 +146,7 @@
find_widget(GntWM *wm, const char *wname)
- GList *iter = gnt_ws_get_list(gnt_wm_get_current_workspace(wm));
+ GList *iter = gnt_ws_get_widgets(gnt_wm_get_current_workspace(wm)); for (; iter; iter = iter->next) {
GntWidget *widget = iter->data;
const char *name = gnt_widget_get_name(widget);