[gnome-music/wip/cdavis/hdywindow-hdyviewswitcher] emptyview: Use HdyStatusPage
- From: Christopher Davis <christopherdavis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/cdavis/hdywindow-hdyviewswitcher] emptyview: Use HdyStatusPage
- Date: Thu, 4 Feb 2021 08:54:46 +0000 (UTC)
commit 47e46f81a41a887c5d23f7cfef860a63fc5a5cf1
Author: Christopher Davis <brainblasted disroot org>
Date: Thu Feb 4 00:53:51 2021 -0800
emptyview: Use HdyStatusPage
HdyStatusPage is a built in widget for empty/status
views. We want to use it here instead of implementing
our own.
data/ui/EmptyView.ui | 66 ++-----------------------------------------
gnomemusic/views/emptyview.py | 40 +++++++++-----------------
2 files changed, 17 insertions(+), 89 deletions(-)
---
diff --git a/data/ui/EmptyView.ui b/data/ui/EmptyView.ui
index 3c7856f7b..c05893f5f 100644
--- a/data/ui/EmptyView.ui
+++ b/data/ui/EmptyView.ui
@@ -3,73 +3,13 @@
<!-- interface-requires gtk+ 3.0 -->
<template class="EmptyView" parent="GtkStack">
<property name="transition_type">crossfade</property>
- <property name="visible">False</property>
+ <property name="visible">True</property>
<child>
- <object class="GtkBox" id="_container">
+ <object class="HdyStatusPage" id="_status_page">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
- <property name="can_focus">False</property>
- <property name="halign">center</property>
- <property name="valign">center</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <child>
- <object class="GtkImage" id="_icon">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="valign">center</property>
- <property name="pixel_size">128</property>
- <property name="icon_name">emblem-music-symbolic</property>
- <property name="icon_size">0</property>
- <property name="margin_bottom">18</property>
- <style>
- <class name="grey-image"/>
- </style>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="box">
- <property name="orientation">vertical</property>
- <property name="visible">True</property>
- <child>
- <object class="GtkLabel" id="_main_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">center</property>
- <property name="xalign">0</property>
- <property name="margin_bottom">12</property>
- <style>
- <class name="no-music-found-label"/>
- <class name="dim-label"/>
- </style>
-
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="_information_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="justify">left</property>
- <property name="use_markup">true</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
+ <property name="icon_name">emblem-music-symbolic</property>
</object>
</child>
</template>
diff --git a/gnomemusic/views/emptyview.py b/gnomemusic/views/emptyview.py
index 52418f74d..66661ebf3 100644
--- a/gnomemusic/views/emptyview.py
+++ b/gnomemusic/views/emptyview.py
@@ -51,9 +51,7 @@ class EmptyView(Gtk.Stack):
__gtype_name__ = "EmptyView"
- _information_label = Gtk.Template.Child()
- _main_label = Gtk.Template.Child()
- _icon = Gtk.Template.Child()
+ _status_page = Gtk.Template.Child()
def __init__(self):
super().__init__()
@@ -108,44 +106,34 @@ class EmptyView(Gtk.Stack):
self._set_tracker_outdated_state()
def _set_initial_state(self):
- self._information_label.props.label = self._content_text
- self._main_label.props.label = _("Hey DJ")
- self._main_label.props.margin_bottom = 18
+ self._status_page.props.title = _("Hey DJ")
+ self._status_page.props.description = self._content_text
- self._icon.props.resource = "/org/gnome/Music/icons/initial-state.png"
- self._icon.props.margin_bottom = 32
- self._icon.props.height_request = ArtSize.LARGE.height
- self._icon.props.width_request = ArtSize.LARGE.width
+ self._status_page.props.icon_name = "initial-state"
def _set_empty_state(self):
- self._main_label.props.label = _("No music found")
- self._information_label.props.label = self._content_text
+ self._status_page.props.title = _("No Music Found")
+ self._status_page.props.description = self._content_text
def _set_search_state(self):
- self._main_label.props.margin_bottom = 12
- self._main_label.props.label = _("No music found")
- self._icon.props.margin_bottom = 18
- self._information_label.props.label = _("Try a different search")
+ self._status_page.props.title = _("No Music Found")
+ self._status_page.props.description = _("Try a different search")
def _set_no_tracker_state(self):
- self._main_label.props.margin_bottom = 12
- self._main_label.props.label = _(
+ self._status_page.props.title = _(
"GNOME Music could not connect to Tracker")
- self._icon.props.margin_bottom = 18
- self._information_label.props.label = _(
+ self._status_page.props.description = _(
"Your music files cannot be indexed without Tracker running")
- self._icon.props.icon_name = "dialog-error-symbolic"
+ self._status_page.props.icon_name = "dialog-error-symbolic"
def _set_tracker_outdated_state(self):
- self._main_label.props.margin_bottom = 12
- self._main_label.props.label = _(
+ self._status_page.props.title = _(
"Your system Tracker version seems outdated")
- self._icon.props.margin_bottom = 18
- self._information_label.props.label = _(
+ self._status_page.props.description = _(
"Music needs Tracker version 3.0.0 or higher")
- self._icon.props.icon_name = "dialog-error-symbolic"
+ self._status_page.props.icon_name = "dialog-error-symbolic"
def select_all(self):
"""Cannot select songs from EmptyView."""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]