tui: don't expand editor form to fullscreen horizontally

The form doesn't make use of the extra horizontal space, so it looks
bad to expand it rather than centering it.
This commit is contained in:
Dan Winship 2014-02-06 16:01:14 +01:00
parent 6ee48dc964
commit fae47c1916
2 changed files with 45 additions and 1 deletions

View file

@ -62,6 +62,8 @@ enum {
PROP_0,
PROP_TITLE,
PROP_FULLSCREEN,
PROP_FULLSCREEN_VERTICAL,
PROP_FULLSCREEN_HORIZONTAL,
PROP_X,
PROP_Y,
PROP_WIDTH,
@ -471,6 +473,24 @@ nmt_newt_form_set_property (GObject *object,
priv->fixed_width = priv->fixed_height = TRUE;
}
break;
case PROP_FULLSCREEN_VERTICAL:
if (g_value_get_boolean (value)) {
newtGetScreenSize (&screen_width, &screen_height);
priv->y = 2;
priv->fixed_y = TRUE;
priv->height = screen_height - 4;
priv->fixed_height = TRUE;
}
break;
case PROP_FULLSCREEN_HORIZONTAL:
if (g_value_get_boolean (value)) {
newtGetScreenSize (&screen_width, &screen_height);
priv->x = 2;
priv->fixed_x = TRUE;
priv->width = screen_width - 4;
priv->fixed_width = TRUE;
}
break;
case PROP_X:
if (g_value_get_uint (value)) {
priv->x = g_value_get_uint (value);
@ -606,6 +626,30 @@ nmt_newt_form_class_init (NmtNewtFormClass *form_class)
G_PARAM_WRITABLE |
G_PARAM_STATIC_STRINGS |
G_PARAM_CONSTRUCT_ONLY));
/**
* NmtNewtForm:fullscreen-vertical:
*
* If %TRUE, the form will fill the entire "screen" (ie, terminal
* window) vertically, but not necessarily horizontally.
*/
g_object_class_install_property (object_class, PROP_FULLSCREEN_VERTICAL,
g_param_spec_boolean ("fullscreen-vertical", "", "",
FALSE,
G_PARAM_WRITABLE |
G_PARAM_STATIC_STRINGS |
G_PARAM_CONSTRUCT_ONLY));
/**
* NmtNewtForm:fullscreen-horizontal:
*
* If %TRUE, the form will fill the entire "screen" (ie, terminal
* window) horizontally, but not necessarily vertically.
*/
g_object_class_install_property (object_class, PROP_FULLSCREEN_HORIZONTAL,
g_param_spec_boolean ("fullscreen-horizontal", "", "",
FALSE,
G_PARAM_WRITABLE |
G_PARAM_STATIC_STRINGS |
G_PARAM_CONSTRUCT_ONLY));
/**
* NmtNewtForm:x:
*

View file

@ -93,7 +93,7 @@ nmt_editor_new (NMConnection *connection)
"connection", connection,
"type-data", type_data,
"title", _("Edit connection"),
"fullscreen", TRUE,
"fullscreen-vertical", TRUE,
NULL);
}