[gnome-software/1385-version-history-dialog-has-non-rounded-corners: 126/126] gs-app-version-history-dialog: Turn it to GsInfoWindow descendant




commit 68749a7b42de007e715b92ab5fd29914210a5f32
Author: Milan Crha <mcrha redhat com>
Date:   Wed Sep 29 13:58:08 2021 +0200

    gs-app-version-history-dialog: Turn it to GsInfoWindow descendant
    
    This will present the window consistently with the other similar windows
    in the Software.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1385

 src/gs-app-version-history-dialog.c  |  5 ++---
 src/gs-app-version-history-dialog.h  |  3 ++-
 src/gs-app-version-history-dialog.ui | 20 ++++++++++----------
 src/gs-details-page.c                |  4 ----
 4 files changed, 14 insertions(+), 18 deletions(-)
---
diff --git a/src/gs-app-version-history-dialog.c b/src/gs-app-version-history-dialog.c
index 8b61b7c2b..9a6934a08 100644
--- a/src/gs-app-version-history-dialog.c
+++ b/src/gs-app-version-history-dialog.c
@@ -17,12 +17,12 @@
 
 struct _GsAppVersionHistoryDialog
 {
-       GtkDialog        parent_instance;
+       GsInfoWindow     parent_instance;
        GsApp           *app;
        GtkWidget       *listbox;
 };
 
-G_DEFINE_TYPE (GsAppVersionHistoryDialog, gs_app_version_history_dialog, GTK_TYPE_DIALOG)
+G_DEFINE_TYPE (GsAppVersionHistoryDialog, gs_app_version_history_dialog, GS_TYPE_INFO_WINDOW)
 
 static void
 populate_version_history (GsAppVersionHistoryDialog *dialog,
@@ -83,7 +83,6 @@ gs_app_version_history_dialog_new (GtkWindow *parent, GsApp *app)
        GsAppVersionHistoryDialog *dialog;
 
        dialog = g_object_new (GS_TYPE_APP_VERSION_HISTORY_DIALOG,
-                              "use-header-bar", TRUE,
                               "transient-for", parent,
                               "modal", TRUE,
                               NULL);
diff --git a/src/gs-app-version-history-dialog.h b/src/gs-app-version-history-dialog.h
index 6abed18e2..bfeeb17e6 100644
--- a/src/gs-app-version-history-dialog.h
+++ b/src/gs-app-version-history-dialog.h
@@ -11,12 +11,13 @@
 #include <gtk/gtk.h>
 
 #include "gnome-software-private.h"
+#include "gs-info-window.h"
 
 G_BEGIN_DECLS
 
 #define GS_TYPE_APP_VERSION_HISTORY_DIALOG (gs_app_version_history_dialog_get_type ())
 
-G_DECLARE_FINAL_TYPE (GsAppVersionHistoryDialog, gs_app_version_history_dialog, GS, 
APP_VERSION_HISTORY_DIALOG, GtkDialog)
+G_DECLARE_FINAL_TYPE (GsAppVersionHistoryDialog, gs_app_version_history_dialog, GS, 
APP_VERSION_HISTORY_DIALOG, GsInfoWindow)
 
 GtkWidget      *gs_app_version_history_dialog_new      (GtkWindow      *parent,
                                                         GsApp          *app);
diff --git a/src/gs-app-version-history-dialog.ui b/src/gs-app-version-history-dialog.ui
index ede850ad2..fcbcd33f3 100644
--- a/src/gs-app-version-history-dialog.ui
+++ b/src/gs-app-version-history-dialog.ui
@@ -2,21 +2,21 @@
 <interface>
   <requires lib="gtk+" version="3.10"/>
   <requires lib="handy" version="1.0"/>
-  <template class="GsAppVersionHistoryDialog" parent="GtkDialog">
+  <template class="GsAppVersionHistoryDialog" parent="GsInfoWindow">
     <property name="title" translatable="yes">Version History</property>
-    <property name="default_width">550</property>
-    <property name="default_height">600</property>
-    <property name="width_request">360</property>
-    <property name="height_request">400</property>
-    <property name="use_header_bar">1</property>
-    <child internal-child="headerbar">
-      <object class="HdyHeaderBar"/>
-    </child>
-    <child internal-child="vbox">
+    <child>
       <object class="GtkBox">
         <property name="visible">True</property>
         <property name="orientation">vertical</property>
         <property name="border_width">0</property>
+        <child>
+          <object class="HdyHeaderBar">
+            <property name="show_close_button">True</property>
+            <property name="visible">True</property>
+            <property name="valign">start</property>
+            <property name="title" bind-source="GsAppVersionHistoryDialog" bind-property="title" 
bind-flags="sync-create"/>
+          </object>
+        </child>
         <child>
           <object class="GtkScrolledWindow">
             <property name="visible">True</property>
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index 9fa7b1848..7c01df917 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -1187,10 +1187,6 @@ version_history_list_row_activated_cb (GtkListBox *list_box,
        dialog = gs_app_version_history_dialog_new (GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET 
(list_box), GTK_TYPE_WINDOW)),
                                                    self->app);
        gs_shell_modal_dialog_present (self->shell, GTK_WINDOW (dialog));
-
-       /* just destroy */
-       g_signal_connect_swapped (dialog, "response",
-                                 G_CALLBACK (gtk_widget_destroy), dialog);
 }
 
 static void gs_details_page_addon_selected_cb (GsAppAddonRow *row, GParamSpec *pspec, GsDetailsPage *self);


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