[gnome-boxes/port-assistant-widgets-to-hdy: 2/8] assistant: Port AssistantMediaEntry rows to Hdy.ActionRow
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/port-assistant-widgets-to-hdy: 2/8] assistant: Port AssistantMediaEntry rows to Hdy.ActionRow
- Date: Thu, 9 Dec 2021 13:48:10 +0000 (UTC)
commit 31360a26887928e4839887966eaca9001041b331
Author: Felipe Borges <felipeborges gnome org>
Date: Thu Dec 9 11:07:50 2021 +0100
assistant: Port AssistantMediaEntry rows to Hdy.ActionRow
So we can drop our custom CSS.
data/ui/assistant/media-entry.ui | 75 ++++++----------------------------------
src/assistant/media-entry.vala | 14 +++-----
2 files changed, 16 insertions(+), 73 deletions(-)
---
diff --git a/data/ui/assistant/media-entry.ui b/data/ui/assistant/media-entry.ui
index 6b04b2ae..c01db59c 100644
--- a/data/ui/assistant/media-entry.ui
+++ b/data/ui/assistant/media-entry.ui
@@ -1,72 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.9 -->
- <template class="BoxesAssistantMediaEntry" parent="GtkListBoxRow">
- <style>
- <class name="entry-row"/>
- </style>
-
+ <template class="BoxesAssistantMediaEntry" parent="HdyActionRow">
<property name="visible">True</property>
- <child>
- <object class="GtkBox" id="hbox">
+ <property name="activatable">True</property>
+ <property name="can-focus">True</property>
+ <property name="subtitle" translatable="yes">Unknown media</property>
+
+ <child type="prefix">
+ <object class="GtkImage" id="media_image">
<property name="visible">True</property>
- <property name="margin-start">15</property>
- <property name="margin-end">15</property>
- <property name="spacing">20</property>
- <property name="orientation">horizontal</property>
- <child>
- <object class="GtkImage" id="media_image">
- <property name="visible">True</property>
- <property name="icon-name">media-optical</property>
- <property name="icon-size">0</property>
- <property name="pixel-size">64</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="vbox">
- <property name="visible">True</property>
- <property name="homogeneous">True</property>
- <property name="spacing">0</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkLabel" id="title_label">
- <property name="visible">True</property>
- <property name="ellipsize">end</property>
- <property name="halign">start</property>
- <property name="valign">end</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="details_label">
- <property name="visible">True</property>
- <property name="ellipsize">end</property>
- <property name="halign">start</property>
- <property name="valign">start</property>
- <property name="label" translatable="yes">Unknown media</property>
- <style>
- <class name="boxes-step-label"/>
- <class name="dim-label"/>
- </style>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
+ <property name="valign">center</property>
+ <property name="icon-name">media-optical</property>
+ <property name="icon-size">0</property>
+ <property name="pixel-size">64</property>
</object>
</child>
</template>
diff --git a/src/assistant/media-entry.vala b/src/assistant/media-entry.vala
index ce4ac898..0ca36c18 100644
--- a/src/assistant/media-entry.vala
+++ b/src/assistant/media-entry.vala
@@ -1,13 +1,9 @@
[GtkTemplate (ui = "/org/gnome/Boxes/ui/assistant/media-entry.ui")]
-private class Boxes.AssistantMediaEntry : Gtk.ListBoxRow {
+private class Boxes.AssistantMediaEntry : Hdy.ActionRow {
public InstallerMedia media;
[GtkChild]
private unowned Gtk.Image media_image;
- [GtkChild]
- private unowned Gtk.Label title_label;
- [GtkChild]
- private unowned Gtk.Label details_label;
public AssistantMediaEntry (InstallerMedia media) {
this.media = media;
@@ -15,22 +11,22 @@ public AssistantMediaEntry (InstallerMedia media) {
if (media.os != null)
Downloader.fetch_os_logo.begin (media_image, media.os, 64);
- title_label.label = media.label;
+ title = media.label;
if (media.os_media != null && media.os_media.live)
// Translators: We show 'Live' tag next or below the name of live OS media or box based on such
media.
// http://en.wikipedia.org/wiki/Live_CD
- title_label.label += " (" + _("Live") + ")";
+ title += " (" + _("Live") + ")";
set_tooltip_text (media.device_file);
if (media.os_media != null) {
var architecture = (media.os_media.architecture == "i386" || media.os_media.architecture ==
"i686") ?
_("32-bit x86 system") :
_("64-bit x86 system");
- details_label.label = architecture;
+ subtitle = architecture;
if (media.os.vendor != null)
// Translator comment: %s is name of vendor here (e.g Canonical Ltd or Red Hat Inc)
- details_label.label += _(" from %s").printf (media.os.vendor);
+ subtitle += _(" from %s").printf (media.os.vendor);
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]