[gnome-software/1111-version-history-box] fixup! Add version history to app details pages



commit 91bc303197b3f28dae59c4a0bcba4acab1276ce6
Author: Phaedrus Leeds <mwleeds endlessos org>
Date:   Wed Feb 10 10:59:26 2021 -0800

    fixup! Add version history to app details pages

 src/gs-app-version-history-dialog.c  | 10 +++++++++-
 src/gs-app-version-history-dialog.ui |  4 +++-
 src/gs-app-version-history-row.c     |  7 ++++---
 src/gs-details-page.c                |  1 -
 4 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/src/gs-app-version-history-dialog.c b/src/gs-app-version-history-dialog.c
index 2d0af40b3..62d86de6c 100644
--- a/src/gs-app-version-history-dialog.c
+++ b/src/gs-app-version-history-dialog.c
@@ -34,8 +34,16 @@ populate_version_history (GsAppVersionHistoryDialog *dialog,
        gs_container_remove_all (GTK_CONTAINER (dialog->listbox));
 
        version_history = gs_app_get_version_history (app);
-       if (version_history == NULL)
+       if (version_history == NULL) {
+               GtkWidget *row;
+               row = gs_app_version_history_row_new ();
+               gs_app_version_history_row_set_info (GS_APP_VERSION_HISTORY_ROW (row),
+                                                    gs_app_get_version (app),
+                                                    gs_app_get_release_date (app), NULL);
+               gtk_list_box_insert (GTK_LIST_BOX (dialog->listbox), row, -1);
+               gtk_widget_show (row);
                return;
+       }
 
        /* add each */
        for (guint i = 0; i < version_history->len; i++) {
diff --git a/src/gs-app-version-history-dialog.ui b/src/gs-app-version-history-dialog.ui
index e476ae904..b604f8b27 100644
--- a/src/gs-app-version-history-dialog.ui
+++ b/src/gs-app-version-history-dialog.ui
@@ -31,7 +31,9 @@
         <child>
           <object class="GtkScrolledWindow" id="scrolledwindow">
             <property name="visible">True</property>
-            <property name="margin">6</property>
+            <property name="margin_top">6</property>
+            <property name="margin_left">6</property>
+            <property name="margin_right">6</property>
             <property name="can_focus">True</property>
             <property name="hscrollbar_policy">never</property>
             <property name="vscrollbar_policy">automatic</property>
diff --git a/src/gs-app-version-history-row.c b/src/gs-app-version-history-row.c
index 8c2346718..74048b179 100644
--- a/src/gs-app-version-history-row.c
+++ b/src/gs-app-version-history-row.c
@@ -61,19 +61,20 @@ gs_app_version_history_row_set_info (GsAppVersionHistoryRow *row,
                version_tmp = g_strdup_printf (_("New in Version %s"), version_number);
                gtk_label_set_label (GTK_LABEL (row->version_number_label), version_tmp);
                gtk_label_set_label (GTK_LABEL (row->version_description_label), version_description);
-               gtk_widget_set_visible (row->version_description_label, TRUE);
        } else {
                g_autofree char *version_tmp = NULL;
+               const gchar *version_description_fallback;
                version_tmp = g_strdup_printf (_("Version %s"), version_number);
                gtk_label_set_label (GTK_LABEL (row->version_number_label), version_tmp);
-               gtk_widget_set_visible (row->version_description_label, FALSE);
+               version_description_fallback = _("No details for this release");
+               gtk_label_set_label (GTK_LABEL (row->version_description_label), 
version_description_fallback);
        }
 
        if (version_date != 0) {
                g_autoptr(GDateTime) date_time = NULL;
                const gchar *format_string;
 
-               /* this is the date in the form of "x weeks ago" */
+               /* this is the date in the form of "x weeks ago" or "y months ago" */
                version_date_string = gs_utils_time_to_string ((gint64) version_date);
 
                /* TRANSLATORS: This is the date string with: day number, month name, year.
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index dccb8fab3..995774b08 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -1208,7 +1208,6 @@ gs_details_page_refresh_all (GsDetailsPage *self)
        version_history = gs_app_get_version_history (self->app);
        if (version_history == NULL) {
                const char *version = gs_app_get_version (self->app);
-               gtk_widget_set_visible (self->version_history_button, FALSE);
                if (version == NULL || *version == '\0')
                        gtk_widget_set_visible (self->box_version_history_frame, FALSE);
                else


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