[gnome-software] All labels reworked



commit af86231ada75d41d4c0daeed373d4e541cfb1bc1
Author: Rafal Luzynski <digitalfreak lingonborough com>
Date:   Mon Nov 23 23:55:25 2015 +0100

    All labels reworked
    
    The general rule should be that all labels should be:
    - wrapping (the best choice),
    - or ellipsizing,
    - or both above,
    - or one should be able to explain why this will never ever
      cause the window grow too much horizontally.
    
    Also when wrapping we should not hesitate to set max-width-chars
    to even unreasonably small positive value because despite its name
    this is the default width of the label rather than maximum and
    the label will be larger if its parent is wide enough.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=735994
    https://bugzilla.redhat.com/show_bug.cgi?id=1282610
    
    Signed-off-by: Richard Hughes <richard hughsie com>

 src/gnome-software.ui        |    1 +
 src/gs-app-addon-row.ui      |    4 +++-
 src/gs-app-folder-dialog.c   |    1 +
 src/gs-app-row.ui            |    2 ++
 src/gs-history-dialog.c      |    2 ++
 src/gs-shell-details.c       |    4 +++-
 src/gs-shell-details.ui      |   13 +++++++++----
 src/gs-sources-dialog-row.ui |    1 +
 src/gs-sources-dialog.c      |    1 +
 src/gs-update-dialog.c       |    6 ++++--
 10 files changed, 27 insertions(+), 8 deletions(-)
---
diff --git a/src/gnome-software.ui b/src/gnome-software.ui
index 5fbb8b5..c647f8e 100644
--- a/src/gnome-software.ui
+++ b/src/gnome-software.ui
@@ -209,6 +209,7 @@
                     <property name="can_focus">False</property>
                     <property name="label">GNU Image Manipulation Program</property>
                     <property name="selectable">False</property>
+                    <property name="ellipsize">end</property>
                     <style>
                       <class name="title"/>
                     </style>
diff --git a/src/gs-app-addon-row.ui b/src/gs-app-addon-row.ui
index 9f1a71c..0eb451f 100644
--- a/src/gs-app-addon-row.ui
+++ b/src/gs-app-addon-row.ui
@@ -30,6 +30,7 @@
             <child>
               <object class="GtkLabel" id="name_label">
                 <property name="visible">True</property>
+                <property name="wrap">True</property>
                 <property name="max_width_chars">20</property>
                 <property name="xalign">0.0</property>
                 <property name="yalign">0.5</property>
@@ -42,9 +43,10 @@
             <child>
               <object class="GtkLabel" id="description_label">
                 <property name="visible">True</property>
+                <property name="wrap">True</property>
+                <property name="max_width_chars">20</property>
                 <property name="xalign">0</property>
                 <property name="yalign">0.5</property>
-                <property name="ellipsize">end</property>
                 <style>
                   <class name="dim-label"/>
                 </style>
diff --git a/src/gs-app-folder-dialog.c b/src/gs-app-folder-dialog.c
index 6bf12e8..2b55179 100644
--- a/src/gs-app-folder-dialog.c
+++ b/src/gs-app-folder-dialog.c
@@ -168,6 +168,7 @@ create_row (GsAppFolderDialog *dialog, const gchar *folder)
                      "margin-end", 20,
                      "margin-top", 10,
                      "margin-bottom", 10,
+                     "ellipsize", PANGO_ELLIPSIZE_END,
                      NULL);
        gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
        gtk_widget_set_halign (label, GTK_ALIGN_START);
diff --git a/src/gs-app-row.ui b/src/gs-app-row.ui
index b4f0645..a81bb26 100644
--- a/src/gs-app-row.ui
+++ b/src/gs-app-row.ui
@@ -59,6 +59,7 @@
                 <property name="visible">True</property>
                 <property name="xalign">0.0</property>
                 <property name="yalign">0.5</property>
+                <property name="ellipsize">end</property>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -81,6 +82,7 @@
                 <property name="xalign">0.0</property>
                 <property name="yalign">0.5</property>
                 <property name="halign">start</property>
+                <property name="ellipsize">end</property>
                 <style>
                   <class name="folder-label"/>
                 </style>
diff --git a/src/gs-history-dialog.c b/src/gs-history-dialog.c
index 074614a..194c1e6 100644
--- a/src/gs-history-dialog.c
+++ b/src/gs-history-dialog.c
@@ -139,6 +139,8 @@ gs_history_dialog_set_app (GsHistoryDialog *dialog, GsApp *app)
                              "margin-top", 6,
                              "margin-bottom", 6,
                              "xalign", 1.0,
+                             "ellipsize", PANGO_ELLIPSIZE_END,
+                             "width-chars", 10,
                              NULL);
                gtk_size_group_add_widget (dialog->sizegroup_version, widget);
                gtk_box_pack_start (box, widget, TRUE, TRUE, 0);
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 421c4f8..b77420f 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -413,6 +413,8 @@ gs_shell_details_refresh_screenshots (GsShellDetails *self)
                        label = gtk_label_new (as_screenshot_get_caption (ss, NULL));
                        g_object_set (label,
                                      "xalign", 0.0,
+                                     "max-width-chars", 10,
+                                     "wrap", TRUE,
                                      NULL);
                        gtk_box_pack_start (GTK_BOX (self->box_details_screenshot_main), label, FALSE, FALSE, 
0);
                        gtk_widget_set_visible (label, TRUE);
@@ -529,7 +531,7 @@ gs_shell_details_set_description (GsShellDetails *self, const gchar *tmp)
        for (i = 0; split[i] != NULL; i++) {
                para = gtk_label_new (split[i]);
                gtk_label_set_line_wrap (GTK_LABEL (para), TRUE);
-               gtk_label_set_max_width_chars (GTK_LABEL (para), 80);
+               gtk_label_set_max_width_chars (GTK_LABEL (para), 40);
                gtk_label_set_selectable (GTK_LABEL (para), TRUE);
                gtk_widget_set_visible (para, TRUE);
                gtk_widget_set_can_focus (para, FALSE);
diff --git a/src/gs-shell-details.ui b/src/gs-shell-details.ui
index b7253c4..b117d21 100644
--- a/src/gs-shell-details.ui
+++ b/src/gs-shell-details.ui
@@ -86,7 +86,7 @@
                             <property name="orientation">vertical</property>
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="halign">start</property>
+                            <property name="halign">fill</property>
                             <property name="valign">start</property>
                             <property name="margin_start">24</property>
                             <property name="margin_end">24</property>
@@ -95,12 +95,14 @@
                               <object class="GtkLabel" id="application_details_title">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="halign">start</property>
+                                <property name="halign">fill</property>
                                 <property name="valign">start</property>
                                 <property name="hexpand">True</property>
                                 <property name="margin_bottom">4</property>
                                 <property name="xalign">0</property>
                                 <property name="selectable">True</property>
+                                <property name="wrap">True</property>
+                                <property name="max_width_chars">20</property>
                                 <style>
                                   <class name="application-details-title"/>
                                 </style>
@@ -115,7 +117,7 @@
                               <object class="GtkLabel" id="application_details_summary">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="halign">start</property>
+                                <property name="halign">fill</property>
                                 <property name="valign">start</property>
                                 <property name="hexpand">True</property>
                                 <property name="margin_bottom">16</property>
@@ -653,6 +655,7 @@
                             <property name="hexpand">True</property>
                             <property name="xalign">0</property>
                             <property name="label">0.12.3</property>
+                            <property name="ellipsize">end</property>
                             <property name="selectable">True</property>
                             <accessibility>
                               <relation target="label_details_version_title" type="labelled-by"/>
@@ -801,7 +804,7 @@
                             <property name="label">GPL</property>
                             <property name="ellipsize">none</property>
                             <property name="wrap">True</property>
-                            <property name="max-width-chars">40</property>
+                            <property name="max-width-chars">10</property>
                             <property name="selectable">True</property>
                             <accessibility>
                               <relation target="label_details_licence_title" type="labelled-by"/>
@@ -925,6 +928,8 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="xalign">0</property>
+                                <property name="wrap">True</property>
+                                <property name="max-width-chars">40</property>
                                 <property name="label" translatable="yes">Selected add-ons will be installed 
with the application.</property>
                               </object>
                             </child>
diff --git a/src/gs-sources-dialog-row.ui b/src/gs-sources-dialog-row.ui
index 405f239..fc30790 100644
--- a/src/gs-sources-dialog-row.ui
+++ b/src/gs-sources-dialog-row.ui
@@ -14,6 +14,7 @@
           <object class="GtkLabel" id="name_label">
             <property name="visible">True</property>
             <property name="halign">start</property>
+            <property name="ellipsize">end</property>
           </object>
           <packing>
             <property name="expand">False</property>
diff --git a/src/gs-sources-dialog.c b/src/gs-sources-dialog.c
index 8bbd9f6..9e0714c 100644
--- a/src/gs-sources-dialog.c
+++ b/src/gs-sources-dialog.c
@@ -238,6 +238,7 @@ add_app (GtkListBox *listbox, GsApp *app)
 
        widget = gtk_label_new (gs_app_get_name (app));
        gtk_widget_set_halign (widget, GTK_ALIGN_START);
+       gtk_label_set_ellipsize (GTK_LABEL (widget), PANGO_ELLIPSIZE_END);
        gtk_box_pack_start (GTK_BOX (box), widget, FALSE, FALSE, 0);
 
        g_object_set_data_full (G_OBJECT (box),
diff --git a/src/gs-update-dialog.c b/src/gs-update-dialog.c
index 4b04643..b2a99cd 100644
--- a/src/gs-update-dialog.c
+++ b/src/gs-update-dialog.c
@@ -304,21 +304,23 @@ gs_update_dialog_show_update_details (GsUpdateDialog *dialog, GsApp *app)
                        label = gtk_label_new (gs_app_get_source_default (app_related));
                        g_object_set (label,
                                      "margin-start", 20,
-                                     "margin-end", 20,
+                                     "margin-end", 0,
                                      "margin-top", 6,
                                      "margin-bottom", 6,
                                      "xalign", 0.0,
+                                     "ellipsize", PANGO_ELLIPSIZE_END,
                                      NULL);
                        gtk_widget_set_halign (label, GTK_ALIGN_START);
                        gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
                        gtk_box_pack_start (GTK_BOX (row), label, TRUE, TRUE, 0);
                        label = gtk_label_new (gs_app_get_update_version (app_related));
                        g_object_set (label,
-                                     "margin-start", 20,
+                                     "margin-start", 0,
                                      "margin-end", 20,
                                      "margin-top", 6,
                                      "margin-bottom", 6,
                                      "xalign", 1.0,
+                                     "ellipsize", PANGO_ELLIPSIZE_END,
                                      NULL);
                        gtk_widget_set_halign (label, GTK_ALIGN_END);
                        gtk_widget_set_valign (label, GTK_ALIGN_CENTER);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]