[gnome-boxes/some-assistant-refactoring: 1/5] assistant: Split AssistantMediaEntry into its own files
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/some-assistant-refactoring: 1/5] assistant: Split AssistantMediaEntry into its own files
- Date: Tue, 13 Apr 2021 13:42:07 +0000 (UTC)
commit 8d942200e96aa5c4aa4d0d49a9e8cfd74d17af94
Author: Felipe Borges <felipeborges gnome org>
Date: Tue Apr 13 15:00:34 2021 +0200
assistant: Split AssistantMediaEntry into its own files
data/gnome-boxes.gresource.xml | 3 +-
.../media-entry.ui} | 2 +-
src/assistant/index-page.vala | 41 ++--------------------
src/assistant/media-entry.vala | 36 +++++++++++++++++++
src/meson.build | 1 +
5 files changed, 42 insertions(+), 41 deletions(-)
---
diff --git a/data/gnome-boxes.gresource.xml b/data/gnome-boxes.gresource.xml
index 66528948..48a2b00f 100644
--- a/data/gnome-boxes.gresource.xml
+++ b/data/gnome-boxes.gresource.xml
@@ -45,13 +45,14 @@
<file preprocess="xml-stripblanks">ui/wizard.ui</file>
<file preprocess="xml-stripblanks">ui/wizard-downloads-page.ui</file>
<file preprocess="xml-stripblanks">ui/wizard-downloadable-entry.ui</file>
- <file preprocess="xml-stripblanks">ui/wizard-media-entry.ui</file>
<file preprocess="xml-stripblanks">ui/wizard-scrolled.ui</file>
<file preprocess="xml-stripblanks">ui/wizard-source.ui</file>
<file preprocess="xml-stripblanks">ui/wizard-summary.ui</file>
<file preprocess="xml-stripblanks">ui/wizard-toolbar.ui</file>
<file preprocess="xml-stripblanks">ui/wizard-web-view.ui</file>
<file preprocess="xml-stripblanks">ui/wizard-window.ui</file>
+ <!-- VM Creation Assistant -->
+ <file preprocess="xml-stripblanks">ui/assistant/media-entry.ui</file>
<file preprocess="xml-stripblanks">ui/assistant/vm-assistant.ui</file>
<file preprocess="xml-stripblanks">ui/assistant/rhel-download-dialog.ui</file>
<file preprocess="xml-stripblanks">ui/assistant/pages/identify-os-page.ui</file>
diff --git a/data/ui/wizard-media-entry.ui b/data/ui/assistant/media-entry.ui
similarity index 97%
rename from data/ui/wizard-media-entry.ui
rename to data/ui/assistant/media-entry.ui
index 050e3415..6b04b2ae 100644
--- a/data/ui/wizard-media-entry.ui
+++ b/data/ui/assistant/media-entry.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.9 -->
- <template class="BoxesWizardMediaEntry" parent="GtkListBoxRow">
+ <template class="BoxesAssistantMediaEntry" parent="GtkListBoxRow">
<style>
<class name="entry-row"/>
</style>
diff --git a/src/assistant/index-page.vala b/src/assistant/index-page.vala
index 14109f3c..24454c25 100644
--- a/src/assistant/index-page.vala
+++ b/src/assistant/index-page.vala
@@ -87,7 +87,7 @@ private void populate_detected_sources_list (int? number_of_items = null) {
}
private Gtk.Widget add_media_entry (GLib.Object object) {
- return new WizardMediaEntry (object as InstallerMedia);
+ return new AssistantMediaEntry (object as InstallerMedia);
}
private Gtk.Widget add_featured_media_entry (GLib.Object object) {
@@ -115,7 +115,7 @@ private void on_expand_detected_sources_list () {
[GtkCallback]
private void on_source_media_selected (Gtk.ListBoxRow row) {
- var entry = row as WizardMediaEntry;
+ var entry = row as AssistantMediaEntry;
if (entry.media != null)
done (entry.media);
@@ -206,40 +206,3 @@ public WizardDownloadableEntry (Osinfo.Media media) {
this.os = os;
}
}
-
-[GtkTemplate (ui = "/org/gnome/Boxes/ui/wizard-media-entry.ui")]
-private class Boxes.WizardMediaEntry : Gtk.ListBoxRow {
- 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 WizardMediaEntry (InstallerMedia media) {
- this.media = media;
-
- if (media.os != null)
- Downloader.fetch_os_logo.begin (media_image, media.os, 64);
-
- title_label.label = 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") + ")";
- set_tooltip_text (title_label.label);
-
- 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;
-
- 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);
- }
- }
-}
diff --git a/src/assistant/media-entry.vala b/src/assistant/media-entry.vala
new file mode 100644
index 00000000..fdd90b3f
--- /dev/null
+++ b/src/assistant/media-entry.vala
@@ -0,0 +1,36 @@
+[GtkTemplate (ui = "/org/gnome/Boxes/ui/assistant/media-entry.ui")]
+private class Boxes.AssistantMediaEntry : Gtk.ListBoxRow {
+ 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;
+
+ if (media.os != null)
+ Downloader.fetch_os_logo.begin (media_image, media.os, 64);
+
+ title_label.label = 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") + ")";
+ set_tooltip_text (title_label.label);
+
+ 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;
+
+ 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);
+ }
+ }
+}
diff --git a/src/meson.build b/src/meson.build
index 07a1932e..29a9c7a0 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -114,6 +114,7 @@ vala_sources = [
'troubleshoot-log.vala',
'snapshot-list-row.vala',
'snapshots-property.vala',
+ 'assistant/media-entry.vala',
'assistant/rhel-download-dialog.vala',
'assistant/vm-assistant.vala',
'assistant/assistant-page.vala',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]