Commit 1bdc4ba9 authored by Dan Winship's avatar Dan Winship
Browse files

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).
parent d0c380ea
......@@ -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
......
......@@ -132,6 +132,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
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment