[gnome-music/wip/cdavis/hdywindow-hdyviewswitcher: 1/2] emptyview: Use HdyStatusPage
- From: Christopher Davis <christopherdavis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/cdavis/hdywindow-hdyviewswitcher: 1/2] emptyview: Use HdyStatusPage
- Date: Tue, 23 Mar 2021 21:31:30 +0000 (UTC)
commit b93877d6fcdfe77c9c1a427309f48c210445eed5
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/artistsview.py | 2 +-
gnomemusic/views/emptyview.py | 42 +++++++++-----------------
meson.build | 2 +-
4 files changed, 19 insertions(+), 93 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/artistsview.py b/gnomemusic/views/artistsview.py
index bdffdadda..afa006e93 100644
--- a/gnomemusic/views/artistsview.py
+++ b/gnomemusic/views/artistsview.py
@@ -42,7 +42,7 @@ class ArtistsView(Gtk.Box):
title = GObject.Property(
type=str, default=_("Artists"), flags=GObject.ParamFlags.READABLE)
icon_name = GObject.Property(type=str, default="system-users-symbolic",
- flags=GObject.ParamFlags.READABLE)
+ flags=GObject.ParamFlags.READABLE)
_artist_container = Gtk.Template.Child()
_artist_view = Gtk.Template.Child()
diff --git a/gnomemusic/views/emptyview.py b/gnomemusic/views/emptyview.py
index 52418f74d..7777ff61d 100644
--- a/gnomemusic/views/emptyview.py
+++ b/gnomemusic/views/emptyview.py
@@ -27,8 +27,6 @@ from enum import IntEnum
from gettext import gettext as _
from gi.repository import GLib, GObject, Gtk, Tracker
-from gnomemusic.utils import ArtSize
-
@Gtk.Template(resource_path="/org/gnome/Music/ui/EmptyView.ui")
class EmptyView(Gtk.Stack):
@@ -51,9 +49,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 +104,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."""
diff --git a/meson.build b/meson.build
index dedac78cf..5a812ab5b 100644
--- a/meson.build
+++ b/meson.build
@@ -39,7 +39,7 @@ PKGLIB_DIR = join_paths(get_option('prefix'), get_option('libdir'), APPLICATION_
dependency('goa-1.0', version: '>= 3.35.90')
dependency('gobject-introspection-1.0', version: '>= 1.35.0')
dependency('gtk+-3.0', version: '>= 3.24.7')
-dependency('libhandy-1', version: '>= 1.0.0')
+dependency('libhandy-1', version: '>= 1.2.0')
dependency('libdazzle-1.0', version: '>= 3.28.0')
dependency('libmediaart-2.0', version: '>= 1.9.1')
dependency('libsoup-2.4')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]