[gnome-software/1392-unify-lozenge-styling: 81/85] gs-storage-context-dialog: Use GsLozenge




commit aee3f66506f44e65f2b750ce88e5977d36b5e015
Author: Milan Crha <mcrha redhat com>
Date:   Mon May 16 14:43:29 2022 +0200

    gs-storage-context-dialog: Use GsLozenge

 src/gs-storage-context-dialog.c  | 10 +++++-----
 src/gs-storage-context-dialog.ui | 20 +++++---------------
 2 files changed, 10 insertions(+), 20 deletions(-)
---
diff --git a/src/gs-storage-context-dialog.c b/src/gs-storage-context-dialog.c
index c8df3db72..5a4f8ae72 100644
--- a/src/gs-storage-context-dialog.c
+++ b/src/gs-storage-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-storage-context-dialog.h"
 
 struct _GsStorageContextDialog
@@ -48,7 +49,6 @@ struct _GsStorageContextDialog
        gulong                   app_notify_handler;
 
        GtkSizeGroup            *lozenge_size_group;
-       GtkLabel                *lozenge_content;
        GtkWidget               *lozenge;
        GtkLabel                *title;
        GtkListBox              *sizes_list;
@@ -97,7 +97,8 @@ add_size_row (GtkListBox   *list_box,
 
        row = gs_context_dialog_row_new_text (size_bytes_str, GS_CONTEXT_DIALOG_ROW_IMPORTANCE_NEUTRAL,
                                              title, description);
-       gs_context_dialog_row_set_content_is_markup (GS_CONTEXT_DIALOG_ROW (row), is_markup);
+       if (is_markup)
+               gs_context_dialog_row_set_content_markup (GS_CONTEXT_DIALOG_ROW (row), size_bytes_str);
        gs_context_dialog_row_set_size_groups (GS_CONTEXT_DIALOG_ROW (row), lozenge_size_group, NULL, NULL);
        gtk_list_box_append (list_box, GTK_WIDGET (row));
 }
@@ -175,9 +176,9 @@ update_sizes_list (GsStorageContextDialog *self)
 
        title_size_bytes_str = gs_utils_format_size (title_size_bytes, &is_markup);
        if (is_markup)
-               gtk_label_set_markup (self->lozenge_content, title_size_bytes_str);
+               gs_lozenge_set_markup (GS_LOZENGE (self->lozenge), title_size_bytes_str);
        else
-               gtk_label_set_text (self->lozenge_content, title_size_bytes_str);
+               gs_lozenge_set_text (GS_LOZENGE (self->lozenge), title_size_bytes_str);
        gtk_label_set_text (self->title, title);
 
        /* Update the Manage Storage label. */
@@ -319,7 +320,6 @@ gs_storage_context_dialog_class_init (GsStorageContextDialogClass *klass)
        gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/Software/gs-storage-context-dialog.ui");
 
        gtk_widget_class_bind_template_child (widget_class, GsStorageContextDialog, lozenge_size_group);
-       gtk_widget_class_bind_template_child (widget_class, GsStorageContextDialog, lozenge_content);
        gtk_widget_class_bind_template_child (widget_class, GsStorageContextDialog, lozenge);
        gtk_widget_class_bind_template_child (widget_class, GsStorageContextDialog, title);
        gtk_widget_class_bind_template_child (widget_class, GsStorageContextDialog, sizes_list);
diff --git a/src/gs-storage-context-dialog.ui b/src/gs-storage-context-dialog.ui
index 4b3de96c0..de2f589c8 100644
--- a/src/gs-storage-context-dialog.ui
+++ b/src/gs-storage-context-dialog.ui
@@ -23,25 +23,15 @@
                     <property name="spacing">12</property>
 
                     <child>
-                      <object class="GtkBox" id="lozenge">
-                        <property name="halign">center</property>
+                      <object class="GsLozenge" id="lozenge">
+                        <property name="circular">False</property>
                         <style>
-                          <class name="context-tile-lozenge"/>
                           <class name="large"/>
                           <class name="grey"/>
                         </style>
-                        <child>
-                          <object class="GtkLabel" id="lozenge_content">
-                            <property name="halign">center</property>
-                            <property name="hexpand">True</property>
-                            <!-- this is a placeholder: the text is actually set in code -->
-                            <property name="label">20 MB</property>
-                            <property name="xalign">0.5</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]