From fae47c19169309bbce7d05e82a25c88635c0b307 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Thu, 6 Feb 2014 16:01:14 +0100 Subject: [PATCH] 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. --- tui/newt/nmt-newt-form.c | 44 ++++++++++++++++++++++++++++++++++++++++ tui/nmt-editor.c | 2 +- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/tui/newt/nmt-newt-form.c b/tui/newt/nmt-newt-form.c index 8191c75ea4..4b02003e73 100644 --- a/tui/newt/nmt-newt-form.c +++ b/tui/newt/nmt-newt-form.c @@ -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: * diff --git a/tui/nmt-editor.c b/tui/nmt-editor.c index aa46cc1a8b..c570842a42 100644 --- a/tui/nmt-editor.c +++ b/tui/nmt-editor.c @@ -93,7 +93,7 @@ nmt_editor_new (NMConnection *connection) "connection", connection, "type-data", type_data, "title", _("Edit connection"), - "fullscreen", TRUE, + "fullscreen-vertical", TRUE, NULL); }