changeset 1278:df3ccd076dbe

Hide GntWM->loop.
author Elliott Sales de Andrade <quantum.analyst@gmail.com>
date Fri, 10 May 2019 02:39:07 -0400
parents f520becefaca
children 21693d24a116
files gntmain.c gntwm.c gntwm.h gntwmprivate.h
diffstat 4 files changed, 22 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/gntmain.c	Fri May 10 02:09:50 2019 -0400
+++ b/gntmain.c	Fri May 10 02:39:07 2019 -0400
@@ -701,8 +701,9 @@
 
 void gnt_main()
 {
-	wm->loop = g_main_loop_new(NULL, FALSE);
-	g_main_loop_run(wm->loop);
+	GMainLoop *loop = g_main_loop_new(NULL, FALSE);
+	gnt_wm_set_mainloop(wm, loop);
+	g_main_loop_run(loop);
 }
 
 /*********************************
--- a/gntwm.c	Fri May 10 02:09:50 2019 -0400
+++ b/gntwm.c	Fri May 10 02:39:07 2019 -0400
@@ -76,6 +76,8 @@
 
 typedef struct
 {
+	GMainLoop *loop;
+
 	GList *workspaces;
 	GList *tagged; /* tagged windows */
 	GntWS *cws;
@@ -1190,9 +1192,11 @@
 wm_quit(GntBindable *bindable, G_GNUC_UNUSED GList *params)
 {
 	GntWM *wm = GNT_WM(bindable);
+	GntWMPrivate *priv = gnt_wm_get_instance_private(wm);
+
 	if (write_timeout)
 		write_already(wm);
-	g_main_loop_quit(wm->loop);
+	g_main_loop_quit(priv->loop);
 	return TRUE;
 }
 
@@ -2407,6 +2411,18 @@
 }
 
 /* Private. */
+void
+gnt_wm_set_mainloop(GntWM *wm, GMainLoop *loop)
+{
+	GntWMPrivate *priv = NULL;
+
+	g_return_if_fail(GNT_IS_WM(wm));
+	priv = gnt_wm_get_instance_private(wm);
+
+	priv->loop = loop;
+}
+
+/* Private. */
 gboolean
 gnt_wm_is_list_window(GntWM *wm, GntWidget *widget)
 {
--- a/gntwm.h	Fri May 10 02:09:50 2019 -0400
+++ b/gntwm.h	Fri May 10 02:39:07 2019 -0400
@@ -86,8 +86,6 @@
 	GntBindable inherit;
 
 	/*< public >*/
-	GMainLoop *GNTSEAL(loop);
-
 	GHashTable *GNTSEAL(nodes);    /* GntWidget -> GntNode */
 	GHashTable *GNTSEAL(name_places);    /* window name -> ws*/
 	GHashTable *GNTSEAL(title_places);    /* window title -> ws */
--- a/gntwmprivate.h	Fri May 10 02:09:50 2019 -0400
+++ b/gntwmprivate.h	Fri May 10 02:39:07 2019 -0400
@@ -39,6 +39,8 @@
 
 void gnt_wm_copy_win(GntWidget *widget, GntNode *node);
 
+void gnt_wm_set_mainloop(GntWM *wm, GMainLoop *loop);
+
 /*
  * gnt_wm_is_list_window:
  * @wm:     The window-manager.