[gnome-software/1392-unify-lozenge-styling: 15/18] gs-license-tile: Use GsLozenge
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/1392-unify-lozenge-styling: 15/18] gs-license-tile: Use GsLozenge
- Date: Tue, 17 May 2022 09:41:39 +0000 (UTC)
commit 4c7d593b24ee1900a7449e1e8d617bba1e694cc8
Author: Milan Crha <mcrha redhat com>
Date: Tue May 3 20:50:22 2022 +0200
gs-license-tile: Use GsLozenge
src/gs-license-tile.c | 9 ++-------
src/gs-license-tile.ui | 39 +++++++++------------------------------
2 files changed, 11 insertions(+), 37 deletions(-)
---
diff --git a/src/gs-license-tile.c b/src/gs-license-tile.c
index a5fb8e994..a68326573 100644
--- a/src/gs-license-tile.c
+++ b/src/gs-license-tile.c
@@ -30,6 +30,7 @@
#include "gs-common.h"
#include "gs-license-tile.h"
+#include "gs-lozenge.h"
struct _GsLicenseTile
{
@@ -40,7 +41,6 @@ struct _GsLicenseTile
gulong notify_urls_handler;
GtkWidget *lozenges[3];
- GtkImage *lozenge_images[3];
GtkLabel *title_label;
GtkLabel *description_label;
GtkListBoxRow *get_involved_row;
@@ -125,11 +125,9 @@ gs_license_tile_refresh (GsLicenseTile *self)
gtk_style_context_remove_class (context, "green");
gtk_style_context_remove_class (context, "grey");
gtk_style_context_add_class (context, css_class);
+ gs_lozenge_set_icon_name (GS_LOZENGE (self->lozenges[i]), lozenge_icon_names[i]);
}
- for (gsize i = 0; i < G_N_ELEMENTS (self->lozenge_images); i++)
- gtk_image_set_from_icon_name (self->lozenge_images[i], lozenge_icon_names[i]);
-
gtk_label_set_label (self->title_label, title);
gtk_label_set_label (self->description_label, description);
gtk_widget_set_visible (GTK_WIDGET (self->get_involved_row), get_involved_visible);
@@ -236,11 +234,8 @@ gs_license_tile_class_init (GsLicenseTileClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/Software/gs-license-tile.ui");
gtk_widget_class_bind_template_child_full (widget_class, "lozenge0", FALSE, G_STRUCT_OFFSET
(GsLicenseTile, lozenges[0]));
- gtk_widget_class_bind_template_child_full (widget_class, "lozenge0_image", FALSE, G_STRUCT_OFFSET
(GsLicenseTile, lozenge_images[0]));
gtk_widget_class_bind_template_child_full (widget_class, "lozenge1", FALSE, G_STRUCT_OFFSET
(GsLicenseTile, lozenges[1]));
- gtk_widget_class_bind_template_child_full (widget_class, "lozenge1_image", FALSE, G_STRUCT_OFFSET
(GsLicenseTile, lozenge_images[1]));
gtk_widget_class_bind_template_child_full (widget_class, "lozenge2", FALSE, G_STRUCT_OFFSET
(GsLicenseTile, lozenges[2]));
- gtk_widget_class_bind_template_child_full (widget_class, "lozenge2_image", FALSE, G_STRUCT_OFFSET
(GsLicenseTile, lozenge_images[2]));
gtk_widget_class_bind_template_child (widget_class, GsLicenseTile, title_label);
gtk_widget_class_bind_template_child (widget_class, GsLicenseTile, description_label);
gtk_widget_class_bind_template_child (widget_class, GsLicenseTile, get_involved_row);
diff --git a/src/gs-license-tile.ui b/src/gs-license-tile.ui
index ec8a43c9c..3ef3075d4 100644
--- a/src/gs-license-tile.ui
+++ b/src/gs-license-tile.ui
@@ -31,51 +31,30 @@
<property name="spacing">8</property>
<child>
- <object class="GtkBox" id="lozenge0">
- <property name="halign">center</property>
+ <object class="GsLozenge" id="lozenge0">
+ <property name="circular">True</property>
+ <property name="icon-name">heart-filled-symbolic</property>
<style>
- <class name="context-tile-lozenge"/>
<class name="green"/>
</style>
- <child>
- <object class="GtkImage" id="lozenge0_image">
- <property name="halign">center</property>
- <property name="hexpand">True</property>
- <property name="icon-name">heart-filled-symbolic</property>
- </object>
- </child>
</object>
</child>
<child>
- <object class="GtkBox" id="lozenge1">
- <property name="halign">center</property>
+ <object class="GsLozenge" id="lozenge1">
+ <property name="circular">True</property>
+ <property name="icon-name">community-symbolic</property>
<style>
- <class name="context-tile-lozenge"/>
<class name="green"/>
</style>
- <child>
- <object class="GtkImage" id="lozenge1_image">
- <property name="halign">center</property>
- <property name="hexpand">True</property>
- <property name="icon-name">community-symbolic</property>
- </object>
- </child>
</object>
</child>
<child>
- <object class="GtkBox" id="lozenge2">
- <property name="halign">center</property>
+ <object class="GsLozenge" id="lozenge2">
+ <property name="circular">True</property>
+ <property name="icon-name">sign-language-symbolic</property>
<style>
- <class name="context-tile-lozenge"/>
<class name="green"/>
</style>
- <child>
- <object class="GtkImage" id="lozenge2_image">
- <property name="halign">center</property>
- <property name="hexpand">True</property>
- <property name="icon-name">sign-language-symbolic</property>
- </object>
- </child>
</object>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]