[gnome-software/1392-unify-lozenge-styling: 11/13] gs-safety-context-dialog: Use GsLozenge




commit 63d64dc17e353fb16a44eded3d4e70fbf61fccee
Author: Milan Crha <mcrha redhat com>
Date:   Tue May 3 20:51:22 2022 +0200

    gs-safety-context-dialog: Use GsLozenge

 src/gs-safety-context-dialog.c  |  5 ++---
 src/gs-safety-context-dialog.ui | 23 ++++++++---------------
 2 files changed, 10 insertions(+), 18 deletions(-)
---
diff --git a/src/gs-safety-context-dialog.c b/src/gs-safety-context-dialog.c
index 1cb955f1c..a05a3543b 100644
--- a/src/gs-safety-context-dialog.c
+++ b/src/gs-safety-context-dialog.c
@@ -38,6 +38,7 @@
 #include "gs-app.h"
 #include "gs-common.h"
 #include "gs-context-dialog-row.h"
+#include "gs-lozenge.h"
 #include "gs-safety-context-dialog.h"
 
 struct _GsSafetyContextDialog
@@ -51,7 +52,6 @@ struct _GsSafetyContextDialog
        gulong                   app_notify_handler_license;
        gulong                   app_notify_handler_related;
 
-       GtkImage                *icon;
        GtkWidget               *lozenge;
        GtkLabel                *title;
        GtkListBox              *permissions_list;
@@ -374,7 +374,7 @@ update_permissions_list (GsSafetyContextDialog *self)
                g_assert_not_reached ();
        }
 
-       gtk_image_set_from_icon_name (GTK_IMAGE (self->icon), icon_name);
+       gs_lozenge_set_icon_name (GS_LOZENGE (self->lozenge), icon_name);
        gtk_label_set_text (self->title, title);
 
        context = gtk_widget_get_style_context (self->lozenge);
@@ -533,7 +533,6 @@ gs_safety_context_dialog_class_init (GsSafetyContextDialogClass *klass)
 
        gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/Software/gs-safety-context-dialog.ui");
 
-       gtk_widget_class_bind_template_child (widget_class, GsSafetyContextDialog, icon);
        gtk_widget_class_bind_template_child (widget_class, GsSafetyContextDialog, lozenge);
        gtk_widget_class_bind_template_child (widget_class, GsSafetyContextDialog, title);
        gtk_widget_class_bind_template_child (widget_class, GsSafetyContextDialog, permissions_list);
diff --git a/src/gs-safety-context-dialog.ui b/src/gs-safety-context-dialog.ui
index 6d35151c1..836a7c49d 100644
--- a/src/gs-safety-context-dialog.ui
+++ b/src/gs-safety-context-dialog.ui
@@ -23,25 +23,18 @@
                     <property name="spacing">12</property>
 
                     <child>
-                      <object class="GtkBox" id="lozenge">
-                        <property name="halign">center</property>
+                      <object class="GsLozenge" id="lozenge">
+                        <property name="circular">True</property>
+                        <!-- this is a placeholder: the icon is actually set in code -->
+                        <property name="icon-name">safety-symbolic</property>
+                        <property name="pixel-size">24</property>
                         <style>
-                          <class name="context-tile-lozenge"/>
                           <class name="large"/>
                           <class name="grey"/>
                         </style>
-                        <child>
-                          <object class="GtkImage" id="icon">
-                            <property name="halign">center</property>
-                            <property name="hexpand">True</property>
-                            <!-- this is a placeholder: the icon is actually set in code -->
-                            <property name="icon-name">safety-symbolic</property>
-                            <property name="pixel-size">24</property>
-                            <accessibility>
-                              <relation name="labelled-by">title</relation>
-                            </accessibility>
-                          </object>
-                        </child>
+                        <accessibility>
+                          <relation name="labelled-by">title</relation>
+                        </accessibility>
                       </object>
                     </child>
 


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