Skip to content

Commit

Permalink
AppInfoView: Change app description to Gtk.Label (#1723)
Browse files Browse the repository at this point in the history
* fix(AppInfoView): Change app description to Gtk.Label

This was originally a Gtk.Label in the very beginning, but early on
was changed to be a Gtk.TextView in
e37fc74

While working on changes to make AppCenter function at narrow window
widths, I noticed that some applications (Notably Veloren in Flathub)
had description widgets that prevented the window from shrinking
below a minimum width which was very wide and unsuitable for narrow
windows. Changing the App description to a label seems to prevent
this, however, I was unsure of the original reasons for the change
to a TextView

* fix(style): minor code style fix

* Update AppData with fix description.

* Update src/Views/AppInfoView.vala

Updates based on feedback in PR

Co-authored-by: Cassidy James Blaede <cassidy@elementary.io>

* Update src/Views/AppInfoView.vala

Set description text property directly instead of using setter

Co-authored-by: Cassidy James Blaede <cassidy@elementary.io>

* Set correct property for label text

* fix: remove extra git file

Co-authored-by: Cassidy James Blaede <cassidy@elementary.io>
  • Loading branch information
isantop and cassidyjames committed Nov 3, 2021
1 parent 0b70ac5 commit 825bd4c
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/Views/AppInfoView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace AppCenter.Views {
private Gtk.Revealer origin_combo_revealer;
private Hdy.Carousel app_screenshots;
private Gtk.Stack screenshot_stack;
private Gtk.TextView app_description;
private Gtk.Label app_description;
private Widgets.ReleaseListBox release_list_box;
private Widgets.SizeLabel size_label;
private Hdy.CarouselIndicatorDots screenshot_switcher;
Expand Down Expand Up @@ -445,13 +445,11 @@ namespace AppCenter.Views {
};
package_summary.get_style_context ().add_class (Granite.STYLE_CLASS_H2_LABEL);

app_description = new Gtk.TextView () {
cursor_visible = false,
editable = false,
expand = true,
pixels_below_lines = 3,
pixels_inside_wrap = 3,
wrap_mode = Gtk.WrapMode.WORD_CHAR
app_description = new Gtk.Label (null) {
// Allow wrapping but prevent expanding the parent
width_request = 1,
wrap = true,
xalign = 0
};
app_description.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL);

Expand Down Expand Up @@ -959,7 +957,7 @@ namespace AppCenter.Views {
// This method may be called in a thread, pass back to GTK thread
Idle.add (() => {
try {
app_description.buffer.text = AppStream.markup_convert_simple (stripped_description);
app_description.label = AppStream.markup_convert_simple (stripped_description);
} catch (Error e) {
warning ("Failed to parse appstream description: %s", e.message);
}
Expand Down

0 comments on commit 825bd4c

Please sign in to comment.