[gnome-software/1690-button-to-go-back-is-missing-in-os-updates-page-opened-from-installed-updates-window] gs-update-dialog: Special-case when showing Installed updates



commit 0cf56f0940a607f4ab6910a40e0224663b7ba239
Author: Milan Crha <mcrha redhat com>
Date:   Mon Mar 28 16:54:17 2022 +0200

    gs-update-dialog: Special-case when showing Installed updates
    
    Since the installed updates can show also system updates, which are another
    list of respective apps, then show also the Back button for these, thus it's
    possible to move back to the list of all updated apps.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1690

 src/gs-update-dialog.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-update-dialog.c b/src/gs-update-dialog.c
index 22d5654be..64a28da3b 100644
--- a/src/gs-update-dialog.c
+++ b/src/gs-update-dialog.c
@@ -30,6 +30,7 @@ struct _GsUpdateDialog
        GtkWidget       *spinner;
        GtkWidget       *stack;
        AdwWindowTitle  *window_title;
+       gboolean         showing_installed_updates;
 };
 
 G_DEFINE_TYPE (GsUpdateDialog, gs_update_dialog, ADW_TYPE_WINDOW)
@@ -60,6 +61,8 @@ leaflet_child_transition_cb (AdwLeaflet *leaflet, GParamSpec *pspec, GsUpdateDia
                g_autofree gchar *title = NULL;
                g_object_get (G_OBJECT (child), "title", &title, NULL);
                gtk_window_set_title (GTK_WINDOW (dialog), title);
+       } else if (dialog->showing_installed_updates) {
+               gtk_window_set_title (GTK_WINDOW (dialog), _("Installed Updates"));
        } else {
                gtk_window_set_title (GTK_WINDOW (dialog), "");
        }
@@ -143,6 +146,8 @@ gs_update_dialog_show_installed_updates (GsUpdateDialog *dialog)
 {
        g_autoptr(GsPluginJob) plugin_job = NULL;
 
+       dialog->showing_installed_updates = TRUE;
+
        /* TRANSLATORS: this is the title of the installed updates dialog window */
        gtk_window_set_title (GTK_WINDOW (dialog), _("Installed Updates"));
 
@@ -205,13 +210,15 @@ gs_update_dialog_show_update_details (GsUpdateDialog *dialog, GsApp *app)
                gs_os_update_page_set_app (GS_OS_UPDATE_PAGE (page), app);
                g_signal_connect (page, "app-activated",
                                  G_CALLBACK (app_activated_cb), dialog);
+               gs_os_update_page_set_show_back_button (GS_OS_UPDATE_PAGE (page), 
dialog->showing_installed_updates);
        } else {
                page = gs_app_details_page_new ();
                gs_app_details_page_set_app (GS_APP_DETAILS_PAGE (page), app);
-               g_signal_connect (page, "back-clicked",
-                                 G_CALLBACK (back_clicked_cb), dialog);
        }
 
+       g_signal_connect (page, "back-clicked",
+                         G_CALLBACK (back_clicked_cb), dialog);
+
        gtk_widget_show (page);
 
        adw_leaflet_append (ADW_LEAFLET (dialog->leaflet), page);


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