[gnome-software: 37/110] gs-license-tile: Subclass GtkWidget
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software: 37/110] gs-license-tile: Subclass GtkWidget
- Date: Tue, 5 Oct 2021 20:32:36 +0000 (UTC)
commit 11bea9002f73fecb96549dbb7336a4950b03eb4f
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Mon Aug 23 10:24:19 2021 -0300
gs-license-tile: Subclass GtkWidget
GtkListBox is not derivable anymore, so subclass GtkWidget and let
the listbox be the only child. Use GtkBinLayout to layout this
listbox.
src/gs-license-tile.c | 6 +-
src/gs-license-tile.h | 2 +-
src/gs-license-tile.ui | 205 +++++++++++++++++++++++++------------------------
3 files changed, 110 insertions(+), 103 deletions(-)
---
diff --git a/src/gs-license-tile.c b/src/gs-license-tile.c
index 0b9d64e47..30a65fb94 100644
--- a/src/gs-license-tile.c
+++ b/src/gs-license-tile.c
@@ -33,7 +33,7 @@
struct _GsLicenseTile
{
- GtkListBox parent_instance;
+ GtkWidget parent_instance;
GsApp *app; /* (nullable) (owned) */
gulong notify_license_handler;
@@ -46,7 +46,7 @@ struct _GsLicenseTile
GtkListBoxRow *get_involved_row;
};
-G_DEFINE_TYPE (GsLicenseTile, gs_license_tile, GTK_TYPE_LIST_BOX)
+G_DEFINE_TYPE (GsLicenseTile, gs_license_tile, GTK_TYPE_WIDGET)
typedef enum {
PROP_APP = 1,
@@ -240,6 +240,8 @@ gs_license_tile_class_init (GsLicenseTileClass *klass)
gtk_widget_class_bind_template_child (widget_class, GsLicenseTile, get_involved_row);
gtk_widget_class_bind_template_callback (widget_class, gs_license_tile_row_activated_cb);
+
+ gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
}
/**
diff --git a/src/gs-license-tile.h b/src/gs-license-tile.h
index b8d82a71d..11f42e119 100644
--- a/src/gs-license-tile.h
+++ b/src/gs-license-tile.h
@@ -20,7 +20,7 @@ G_BEGIN_DECLS
#define GS_TYPE_LICENSE_TILE (gs_license_tile_get_type ())
-G_DECLARE_FINAL_TYPE (GsLicenseTile, gs_license_tile, GS, LICENSE_TILE, GtkListBox)
+G_DECLARE_FINAL_TYPE (GsLicenseTile, gs_license_tile, GS, LICENSE_TILE, GtkWidget)
GtkWidget *gs_license_tile_new (GsApp *app);
diff --git a/src/gs-license-tile.ui b/src/gs-license-tile.ui
index 1ea8d1684..7f7595b54 100644
--- a/src/gs-license-tile.ui
+++ b/src/gs-license-tile.ui
@@ -1,143 +1,148 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.10"/>
- <template class="GsLicenseTile" parent="GtkListBox">
- <property name="selection_mode">none</property>
- <signal name="row-activated" handler="gs_license_tile_row_activated_cb"/>
- <style>
- <class name="content"/>
- </style>
-
+ <template class="GsLicenseTile" parent="GtkWidget">
+ <property name="visible">False</property>
<child>
- <object class="GtkListBoxRow">
- <property name="activatable">False</property>
- <property name="visible">True</property>
- <property name="can-focus">True</property>
+ <object class="GtkListBox">
+ <property name="selection_mode">none</property>
+ <signal name="row-activated" handler="gs_license_tile_row_activated_cb"/>
+ <style>
+ <class name="content"/>
+ </style>
+
<child>
- <object class="GtkBox">
+ <object class="GtkListBoxRow">
+ <property name="activatable">False</property>
<property name="visible">True</property>
- <property name="orientation">vertical</property>
- <property name="spacing">8</property>
- <property name="margin">14</property>
-
+ <property name="can-focus">True</property>
<child>
<object class="GtkBox">
- <property name="halign">center</property>
<property name="visible">True</property>
- <property name="orientation">horizontal</property>
+ <property name="orientation">vertical</property>
<property name="spacing">8</property>
+ <property name="margin">14</property>
<child>
- <object class="GtkBox" id="lozenge0">
+ <object class="GtkBox">
<property name="halign">center</property>
<property name="visible">True</property>
- <style>
- <class name="context-tile-lozenge"/>
- <class name="green"/>
- </style>
+ <property name="orientation">horizontal</property>
+ <property name="spacing">8</property>
+
<child>
- <object class="GtkImage" id="lozenge0_image">
+ <object class="GtkBox" id="lozenge0">
<property name="halign">center</property>
- <property name="icon-name">heart-filled-symbolic</property>
<property name="visible">True</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="icon-name">heart-filled-symbolic</property>
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ </packing>
+ </child>
</object>
- <packing>
- <property name="expand">True</property>
- </packing>
</child>
- </object>
- </child>
- <child>
- <object class="GtkBox" id="lozenge1">
- <property name="halign">center</property>
- <property name="visible">True</property>
- <style>
- <class name="context-tile-lozenge"/>
- <class name="green"/>
- </style>
<child>
- <object class="GtkImage" id="lozenge1_image">
+ <object class="GtkBox" id="lozenge1">
<property name="halign">center</property>
- <property name="icon-name">system-users-symbolic</property>
<property name="visible">True</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="icon-name">system-users-symbolic</property>
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ </packing>
+ </child>
</object>
- <packing>
- <property name="expand">True</property>
- </packing>
</child>
- </object>
- </child>
- <child>
- <object class="GtkBox" id="lozenge2">
- <property name="halign">center</property>
- <property name="visible">True</property>
- <style>
- <class name="context-tile-lozenge"/>
- <class name="green"/>
- </style>
<child>
- <object class="GtkImage" id="lozenge2_image">
+ <object class="GtkBox" id="lozenge2">
<property name="halign">center</property>
- <property name="icon-name">sign-language-symbolic</property>
<property name="visible">True</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="icon-name">sign-language-symbolic</property>
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ </packing>
+ </child>
</object>
- <packing>
- <property name="expand">True</property>
- </packing>
</child>
</object>
</child>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="title_label">
- <property name="visible">True</property>
- <!-- This text is a placeholder and will be set dynamically -->
- <property name="label">Community Built</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="description_label">
- <property name="visible">True</property>
- <!-- This text is a placeholder and will be set dynamically -->
- <property name="label">This software is developed in the open by a community of volunteers,
and released under the GNU GPL v3 license.\n\nYou can contribute and help make it even better.</property>
- <property name="wrap">True</property>
+ <child>
+ <object class="GtkLabel" id="title_label">
+ <property name="visible">True</property>
+ <!-- This text is a placeholder and will be set dynamically -->
+ <property name="label">Community Built</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="description_label">
+ <property name="visible">True</property>
+ <!-- This text is a placeholder and will be set dynamically -->
+ <property name="label">This software is developed in the open by a community of
volunteers, and released under the GNU GPL v3 license.\n\nYou can contribute and help make it even
better.</property>
+ <property name="wrap">True</property>
+ </object>
+ </child>
</object>
</child>
</object>
</child>
- </object>
- </child>
- <child>
- <object class="GtkListBoxRow" id="get_involved_row">
- <property name="activatable">True</property>
- <property name="visible">True</property>
- <property name="can-focus">True</property>
<child>
- <object class="GtkBox">
+ <object class="GtkListBoxRow" id="get_involved_row">
+ <property name="activatable">True</property>
<property name="visible">True</property>
- <property name="orientation">horizontal</property>
- <property name="halign">center</property>
- <property name="margin-top">12</property>
- <property name="margin-bottom">12</property>
+ <property name="can-focus">True</property>
<child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="label" translatable="yes">_Get Involved</property>
- <property name="use-underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkImage">
+ <object class="GtkBox">
<property name="visible">True</property>
- <property name="icon-name">external-link-symbolic</property>
- <property name="margin-start">6</property>
+ <property name="orientation">horizontal</property>
+ <property name="halign">center</property>
+ <property name="margin-top">12</property>
+ <property name="margin-bottom">12</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="label" translatable="yes">_Get Involved</property>
+ <property name="use-underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="icon-name">external-link-symbolic</property>
+ <property name="margin-start">6</property>
+ </object>
+ </child>
</object>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]