summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2014-03-24 13:15:33 -0400
committerDan Winship <danw@gnome.org>2014-03-24 13:16:12 -0400
commit1bdc4ba9483acadc5141029f79b6b76b5cf51eba (patch)
treea3d2c35bcef42599202080d38426b44873ac3367
parentd0c380ea684951a9e328bea6e4c019cf23840256 (diff)
downloadNetworkManager-1bdc4ba9483acadc5141029f79b6b76b5cf51eba.tar.gz
tui: add nmt_newt_widget_get_realized(), realize forms properly
NmtNewtForm is an NmtNewtWidget, but previously it was only realizing its child, not itself, which is technically wrong (though it had no noticeable effect until get_realized() was added).
-rw-r--r--tui/newt/nmt-newt-form.c4
-rw-r--r--tui/newt/nmt-newt-widget.c16
-rw-r--r--tui/newt/nmt-newt-widget.h1
3 files changed, 19 insertions, 2 deletions
diff --git a/tui/newt/nmt-newt-form.c b/tui/newt/nmt-newt-form.c
index dec3d9a62a..0c2063be7a 100644
--- a/tui/newt/nmt-newt-form.c
+++ b/tui/newt/nmt-newt-form.c
@@ -199,7 +199,7 @@ nmt_newt_form_build (NmtNewtForm *form)
int i;
priv->dirty = FALSE;
- nmt_newt_widget_realize (priv->content);
+ nmt_newt_widget_realize (NMT_NEWT_WIDGET (form));
nmt_newt_widget_size_request (priv->content, &form_width, &form_height);
newtGetScreenSize (&screen_width, &screen_height);
@@ -268,7 +268,7 @@ nmt_newt_form_destroy (NmtNewtForm *form)
priv->form = NULL;
newtPopWindowNoRefresh ();
- nmt_newt_widget_unrealize (priv->content);
+ nmt_newt_widget_unrealize (NMT_NEWT_WIDGET (form));
}
/* A "normal" newt program would call newtFormRun() to run newt's main loop
diff --git a/tui/newt/nmt-newt-widget.c b/tui/newt/nmt-newt-widget.c
index ba37f173fe..24ee8b0a61 100644
--- a/tui/newt/nmt-newt-widget.c
+++ b/tui/newt/nmt-newt-widget.c
@@ -133,6 +133,22 @@ nmt_newt_widget_unrealize (NmtNewtWidget *widget)
}
/**
+ * nmt_newt_widget_get_realized:
+ * @widget: an #NmtNewtWidget
+ *
+ * Checks if @widget is realized or not.
+ *
+ * Returns: whether @widget is realized.
+ */
+gboolean
+nmt_newt_widget_get_realized (NmtNewtWidget *widget)
+{
+ NmtNewtWidgetPrivate *priv = NMT_NEWT_WIDGET_GET_PRIVATE (widget);
+
+ return priv->realized;
+}
+
+/**
* nmt_newt_widget_get_components:
* @widget: an #NmtNewtWidget
*
diff --git a/tui/newt/nmt-newt-widget.h b/tui/newt/nmt-newt-widget.h
index 265f2455d1..a526a674c3 100644
--- a/tui/newt/nmt-newt-widget.h
+++ b/tui/newt/nmt-newt-widget.h
@@ -67,6 +67,7 @@ GType nmt_newt_widget_get_type (void);
void nmt_newt_widget_realize (NmtNewtWidget *widget);
void nmt_newt_widget_unrealize (NmtNewtWidget *widget);
+gboolean nmt_newt_widget_get_realized (NmtNewtWidget *widget);
newtComponent *nmt_newt_widget_get_components (NmtNewtWidget *widget);