[gnome-boxes/port-assistant-widgets-to-hdy: 6/10] assistant, index-page: Port rows to HdyActionRow
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/port-assistant-widgets-to-hdy: 6/10] assistant, index-page: Port rows to HdyActionRow
- Date: Thu, 9 Dec 2021 13:49:38 +0000 (UTC)
commit 29b9006c3063f5dca61866501a810de6591acec6
Author: Felipe Borges <felipeborges gnome org>
Date: Thu Dec 9 14:04:03 2021 +0100
assistant, index-page: Port rows to HdyActionRow
yay! More code deleted!
data/ui/assistant/pages/index-page.ui | 238 +++++-----------------------------
src/assistant/index-page.vala | 26 ++--
2 files changed, 47 insertions(+), 217 deletions(-)
---
diff --git a/data/ui/assistant/pages/index-page.ui b/data/ui/assistant/pages/index-page.ui
index 0f000dbd..ba0405a5 100644
--- a/data/ui/assistant/pages/index-page.ui
+++ b/data/ui/assistant/pages/index-page.ui
@@ -37,249 +37,75 @@
</child>
<child>
- <object class="GtkBox" id="detected_sources_section">
+ <object class="HdyPreferencesGroup" id="detected_sources_section">
<property name="visible">True</property>
- <property name="spacing">10</property>
- <property name="orientation">vertical</property>
+ <property name="title" translatable="yes">Detected Sources</property>
<child>
- <object class="GtkLabel">
+ <object class="GtkListBox" id="source_medias">
<property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Detected Sources</property>
+ <property name="selection-mode">none</property>
+ <signal name="row-activated" handler="on_source_media_selected"/>
<style>
- <class name="bold-label"/>
+ <class name="content"/>
</style>
</object>
</child>
-
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="orientation">vertical</property>
- <style>
- <class name="linked"/>
- <class name="frame"/>
- <class name="sources-list"/>
- </style>
-
- <child>
- <object class="GtkListBox" id="source_medias">
- <property name="visible">True</property>
- <signal name="row-activated" handler="on_source_media_selected"/>
- <style>
- <class name="sources-list"/>
- </style>
- </object>
- </child>
-
- <child>
- <object class="GtkButton" id="expand_detected_sources_list_button">
- <property name="visible">True</property>
- <signal name="clicked" handler="on_expand_detected_sources_list"/>
- <style>
- <class name="flat"/>
- <class name="list-expand-button"/>
- <class name="boxes-menu-row"/>
- </style>
-
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="icon-name">view-more-symbolic</property>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
</object>
</child>
<child>
- <object class="GtkBox">
+ <object class="HdyPreferencesGroup">
<property name="visible">True</property>
- <property name="spacing">10</property>
- <property name="orientation">vertical</property>
-
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Featured Downloads</property>
- <style>
- <class name="bold-label"/>
- </style>
- </object>
- </child>
-
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">You will be notified when the download has
completed.</property>
- </object>
- </child>
+ <property name="title" translatable="yes">Featured Downloads</property>
+ <property name="description" translatable="yes">You will be notified when the download
has completed.</property>
<child>
<object class="GtkListBox" id="featured_medias">
<property name="visible">True</property>
<signal name="row-activated" handler="on_featured_media_selected"/>
<style>
- <class name="frame"/>
- <class name="sources-list"/>
+ <class name="content"/>
</style>
</object>
</child>
</object>
- </child>
+ </child>
<child>
- <object class="GtkBox">
+ <object class="HdyPreferencesGroup">
<property name="visible">True</property>
- <property name="spacing">10</property>
- <property name="orientation">vertical</property>
+ <property name="title" translatable="yes">Select an OS Source</property>
<child>
- <object class="GtkLabel">
+ <object class="HdyActionRow">
<property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Select an OS Source</property>
- <style>
- <class name="bold-label"/>
- </style>
+ <property name="activatable">True</property>
+ <property name="title" translatable="yes">Operating System Download</property>
+ <property name="subtitle" translatable="yes">Browse and search for operating systems
to install.</property>
+ <signal name="activated" handler="on_download_an_os_button_clicked"/>
+
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="icon-name">go-next-symbolic</property>
+ </object>
+ </child>
</object>
</child>
<child>
- <object class="GtkBox">
+ <object class="HdyActionRow">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
- <style>
- <class name="linked"/>
- </style>
+ <property name="activatable">True</property>
+ <property name="title" translatable="yes">Operating System Image File</property>
+ <property name="subtitle" translatable="yes">Select a file to install a virtual
machine.</property>
+ <signal name="activated" handler="on_select_file_button_clicked"/>
<child>
- <object class="GtkButton">
+ <object class="GtkImage">
<property name="visible">True</property>
- <signal name="clicked" handler="on_download_an_os_button_clicked"/>
- <style>
- <class name="boxes-menu-row"/>
- </style>
-
- <child>
- <object class="GtkGrid">
- <property name="visible">True</property>
- <property name="border-width">10</property>
-
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes">Operating System
Download</property>
- <style>
- <class name="bold-label"/>
- </style>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">0</property>
- </packing>
- </child>
-
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes">Browse and search for
operating systems to install.</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
-
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="icon-name">go-next-symbolic</property>
- </object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">0</property>
- <property name="height">2</property>
- </packing>
- </child>
- </object>
- </child>
-
- </object>
- </child>
-
- <child>
- <object class="GtkButton">
- <property name="visible">True</property>
- <signal name="clicked" handler="on_select_file_button_clicked"/>
- <style>
- <class name="boxes-menu-row"/>
- </style>
-
- <child>
- <object class="GtkGrid">
- <property name="visible">True</property>
- <property name="border-width">10</property>
-
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes">Operating System Image
File</property>
- <style>
- <class name="bold-label"/>
- </style>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">0</property>
- </packing>
- </child>
-
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes">Select a file to install a
virtual machine.</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
-
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="icon-name">go-next-symbolic</property>
- </object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">0</property>
- <property name="height">2</property>
- </packing>
- </child>
- </object>
- </child>
-
+ <property name="icon-name">go-next-symbolic</property>
</object>
</child>
</object>
diff --git a/src/assistant/index-page.vala b/src/assistant/index-page.vala
index 4ccf8775..9c4a31af 100644
--- a/src/assistant/index-page.vala
+++ b/src/assistant/index-page.vala
@@ -17,15 +17,14 @@
private unowned AssistantDownloadsPage recommended_downloads_page;
[GtkChild]
private unowned ScrolledWindow home_page;
-
[GtkChild]
- private unowned Box detected_sources_section;
+ private unowned Hdy.PreferencesGroup detected_sources_section;
[GtkChild]
private unowned ListBox source_medias;
[GtkChild]
private unowned ListBox featured_medias;
- [GtkChild]
- private unowned Button expand_detected_sources_list_button;
+
+ private Gtk.Button view_more_medias_button;
private GLib.Cancellable cancellable = new GLib.Cancellable ();
@@ -35,8 +34,16 @@
source_medias.bind_model (source_model, add_media_entry);
featured_medias.bind_model (featured_model, add_featured_media_entry);
- source_medias.set_header_func (use_list_box_separator);
- featured_medias.set_header_func (use_list_box_separator);
+ view_more_medias_button = new Gtk.Button () {
+ visible = true,
+ image = new Gtk.Image () {
+ visible = true,
+ icon_name = "view-more-symbolic"
+ }
+ };
+ view_more_medias_button.clicked.connect (on_expand_detected_sources_list);
+ view_more_medias_button.get_style_context ().add_class ("flat");
+ source_medias.add (view_more_medias_button);
}
public void setup (VMAssistant dialog) {
@@ -69,15 +76,13 @@ private async void populate_media_lists () {
}
private void populate_detected_sources_list (int? number_of_items = null) {
- var number_of_available_medias = installer_medias.length ();
+ var number_of_available_medias = installer_medias.length ();
detected_sources_section.visible = (number_of_available_medias > 0);
source_model.remove_all ();
if (number_of_available_medias == 0)
return;
- expand_detected_sources_list_button.visible = (number_of_available_medias > MAX_MEDIA_ENTRIES);
-
foreach (var media in installer_medias) {
source_model.append (media);
@@ -106,11 +111,10 @@ private void update_topbar () {
}
}
- [GtkCallback]
private void on_expand_detected_sources_list () {
populate_detected_sources_list ();
- expand_detected_sources_list_button.hide ();
+ view_more_medias_button.get_parent ().destroy ();
}
[GtkCallback]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]