Skip to content

Commit

Permalink
gui: Fix window resize due to long strings
Browse files Browse the repository at this point in the history
Fixes clearlinux#455

Signed-off-by: Reagan Lopez <[email protected]>
  • Loading branch information
reaganlo committed Jul 13, 2019
1 parent 05a0fde commit 979afce
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 8 deletions.
11 changes: 9 additions & 2 deletions gui/pages/swupd_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ func NewSwupdConfigPage(controller Controller, model *model.SystemInstall) (Page
return nil, err
}
page.mirrorDesc.SetMarginStart(common.StartEndMargin)
page.mirrorDesc.SetMaxWidthChars(1) // The value does not matter but its required for LineWrap to work
page.mirrorDesc.SetLineWrap(true)
page.box.PackStart(page.mirrorDesc, false, false, 10)

page.mirrorEntry, err = setEntry("entry-no-top-margin")
Expand All @@ -83,6 +85,8 @@ func NewSwupdConfigPage(controller Controller, model *model.SystemInstall) (Page
}
page.mirrorWarning.SetMarginStart(common.StartEndMargin)
page.mirrorWarning.SetMarginBottom(common.TopBottomMargin)
page.mirrorWarning.SetMaxWidthChars(1) // The value does not matter but its required for LineWrap to work
page.mirrorWarning.SetLineWrap(true)
page.box.PackStart(page.mirrorWarning, false, false, 0)
if _, err := page.mirrorEntry.Connect("changed", page.onMirrorChange); err != nil {
return nil, err
Expand Down Expand Up @@ -111,6 +115,8 @@ func NewSwupdConfigPage(controller Controller, model *model.SystemInstall) (Page
}
page.autoUpdateDesc.SetMarginStart(common.StartEndMargin)
page.autoUpdateDesc.SetMarginTop(common.TopBottomMargin)
page.autoUpdateDesc.SetMaxWidthChars(1) // The value does not matter but its required for LineWrap to work
page.autoUpdateDesc.SetLineWrap(true)
page.autoUpdateDesc.SetSelectable(true)
page.box.PackStart(page.autoUpdateDesc, false, false, 0)

Expand Down Expand Up @@ -139,7 +145,8 @@ func NewSwupdConfigPage(controller Controller, model *model.SystemInstall) (Page
return nil, err
}
page.autoUpdateWarning.SetMarginStart(common.StartEndMargin)
page.autoUpdateWarning.SetSelectable(true)
page.autoUpdateWarning.SetMaxWidthChars(1) // The value does not matter but its required for LineWrap to work
page.autoUpdateWarning.SetLineWrap(true)
page.box.PackStart(page.autoUpdateWarning, false, false, 0)

return page, nil
Expand Down Expand Up @@ -277,7 +284,7 @@ func (page *SwupdConfigPage) GetConfiguredValue() string {
}

if page.model.SwupdMirror != "" {
ret += utils.Locale.Get(". Custom mirror set.")
ret += utils.Locale.Get(".") + " " + utils.Locale.Get("Custom mirror set.")
}

return ret
Expand Down
8 changes: 8 additions & 0 deletions gui/pages/user_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,8 @@ func (page *UserAddPage) setSimilarWidgets(entryText, rulesText string, maxSize
return nil, nil, err
}
rulesLabel.SetMarginStart(CommonSetting + common.StartEndMargin)
rulesLabel.SetMaxWidthChars(1) // The value does not matter but its required for LineWrap to work
rulesLabel.SetLineWrap(true)
page.box.PackStart(rulesLabel, false, false, 0)

// Warning
Expand All @@ -446,6 +448,8 @@ func (page *UserAddPage) setSimilarWidgets(entryText, rulesText string, maxSize
return nil, nil, err
}
warningLabel.SetMarginStart(CommonSetting + common.StartEndMargin)
warningLabel.SetMaxWidthChars(1) // The value does not matter but its required for LineWrap to work
warningLabel.SetLineWrap(true)
page.box.PackStart(warningLabel, false, false, 0)

return entry, warningLabel, err
Expand All @@ -467,6 +471,8 @@ func (page *UserAddPage) setPasswordWidgets(rulesText string, maxSize int) (*gtk
return nil, nil, nil, err
}
rulesLabel.SetMarginStart(CommonSetting + common.StartEndMargin)
rulesLabel.SetMaxWidthChars(1) // The value does not matter but its required for LineWrap to work
rulesLabel.SetLineWrap(true)
page.box.PackStart(rulesLabel, false, false, 0)

boxPasswordConfirm, passwordConfirm, err := setLabelAndEntry(utils.Locale.Get("Confirm")+" *", maxSize)
Expand All @@ -484,6 +490,8 @@ func (page *UserAddPage) setPasswordWidgets(rulesText string, maxSize int) (*gtk
return nil, nil, nil, err
}
warningLabel.SetMarginStart(CommonSetting + common.StartEndMargin)
warningLabel.SetMaxWidthChars(1) // The value does not matter but its required for LineWrap to work
warningLabel.SetLineWrap(true)
page.box.PackStart(warningLabel, false, false, 0)

return password, passwordConfirm, warningLabel, err
Expand Down
7 changes: 5 additions & 2 deletions locale/en_US/LC_MESSAGES/clr-installer.po
Original file line number Diff line number Diff line change
Expand Up @@ -670,8 +670,8 @@ msgstr "Auto updates enabled"
msgid "Auto updates disabled"
msgstr "Auto updates disabled"

msgid ". Custom mirror set."
msgstr ". Custom mirror set."
msgid "Custom mirror set."
msgstr "Custom mirror set."

msgid "Server not responding"
msgstr "Server not responding"
Expand All @@ -681,3 +681,6 @@ msgstr "Server does not report any version"

msgid "Version URL of mirror not found"
msgstr "Version URL of mirror not found"

msgid "."
msgstr "."
7 changes: 5 additions & 2 deletions locale/es_MX/LC_MESSAGES/clr-installer.po
Original file line number Diff line number Diff line change
Expand Up @@ -670,8 +670,8 @@ msgstr "Actualizaciones automáticas habilitadas"
msgid "Auto updates disabled"
msgstr "Actualizaciones automáticas desactivadas"

msgid ". Custom mirror set."
msgstr ". Conjunto de espejos personalizado."
msgid "Custom mirror set."
msgstr "Conjunto de espejos personalizado."

msgid "Server not responding"
msgstr "Servidor que no responde"
Expand All @@ -681,3 +681,6 @@ msgstr "El servidor no informa de ninguna versión"

msgid "Version URL of mirror not found"
msgstr "Versión URL del espejo no encontrada"

msgid "."
msgstr "."
7 changes: 5 additions & 2 deletions locale/zh_CN/LC_MESSAGES/clr-installer.po
Original file line number Diff line number Diff line change
Expand Up @@ -670,8 +670,8 @@ msgstr "启用自动更新"
msgid "Auto updates disabled"
msgstr "已禁用自动更新"

msgid ". Custom mirror set."
msgstr ".自定义镜像集。"
msgid "Custom mirror set."
msgstr "自定义镜像集。"

msgid "Server not responding"
msgstr "服务器未响应"
Expand All @@ -681,3 +681,6 @@ msgstr "服务器不报告任何版本"

msgid "Version URL of mirror not found"
msgstr "未找到镜像的版本 URL"

msgid "."
msgstr "。"

0 comments on commit 979afce

Please sign in to comment.