[gnome-music/wip/mschraal/gtk4-svgpaintable: 2/2] emptyview: Fix-m-upper




commit 2a5128bc466331f4889d85839b63e2136f94d8c2
Author: Marinus Schraal <mschraal gnome org>
Date:   Wed Feb 9 16:41:30 2022 +0100

    emptyview: Fix-m-upper

 data/ui/EmptyView.ui          | 86 +++++++++++++++++++++----------------------
 gnomemusic/views/emptyview.py | 21 +++++++++--
 2 files changed, 61 insertions(+), 46 deletions(-)
---
diff --git a/data/ui/EmptyView.ui b/data/ui/EmptyView.ui
index e39c48a82..1a06c3d90 100644
--- a/data/ui/EmptyView.ui
+++ b/data/ui/EmptyView.ui
@@ -6,50 +6,50 @@
     <property name="visible">False</property>
     <child>
       <object class="AdwStatusPage" id="_status_page">
-        <property name="visible">True</property>
-        <property name="hexpand">True</property>
-        <property name="vexpand">True</property>
-        <property name="icon_name">emblem-music-symbolic</property>
+        <!-- <property name="visible">True</property> -->
+        <!-- <property name="hexpand">True</property> -->
+        <!-- <property name="vexpand">True</property> -->
+        <!-- <property name="icon_name">emblem-music-symbolic</property> -->
       </object>
     </child>
   </template>
-  <object class="GtkBox" id="_initial_state">
-    <property name="visible">False</property>
-    <property name="can_focus">False</property>
-    <property name="valign">start</property>
-    <property name="orientation">vertical</property>
-    <child>
-      <object class="GtkImage">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="resource">/org/gnome/Music/icons/welcome-music.svg</property>
-        <property name="height-request">600</property>
-        <property name="width-request">800</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkLabel" id="_title_label">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="justify">center</property>
-        <property name="label" translatable="yes">Welcome to Music</property>
-        <style>
-          <class name="title"/>
-          <class name="large-title"/>
-        </style>
-      </object>
-    </child>
-    <child>
-      <object class="GtkLabel" id="_description_label">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="justify">center</property>
-        <property name="use-markup">True</property>
-        <style>
-          <class name="description"/>
-          <class name="body"/>
-        </style>
-      </object>
-    </child>
-  </object>
+  <!-- <object class="GtkBox" id="_initial_state"> -->
+  <!--   <property name="visible">False</property> -->
+  <!--   <property name="can_focus">False</property> -->
+  <!--   <property name="valign">start</property> -->
+  <!--   <property name="orientation">vertical</property> -->
+  <!--   <child> -->
+  <!--     <object class="GtkImage"> -->
+  <!--       <property name="visible">True</property> -->
+  <!--       <property name="can_focus">False</property> -->
+  <!--       <property name="resource">/org/gnome/Music/icons/welcome-music.svg</property> -->
+  <!--       <property name="height-request">600</property> -->
+  <!--       <property name="width-request">800</property> -->
+  <!--     </object> -->
+  <!--   </child> -->
+  <!--   <child> -->
+  <!--     <object class="GtkLabel" id="_title_label"> -->
+  <!--       <property name="visible">True</property> -->
+  <!--       <property name="can_focus">False</property> -->
+  <!--       <property name="justify">center</property> -->
+  <!--       <property name="label" translatable="yes">Welcome to Music</property> -->
+  <!--       <style> -->
+  <!--         <class name="title"/> -->
+  <!--         <class name="large-title"/> -->
+  <!--       </style> -->
+  <!--     </object> -->
+  <!--   </child> -->
+  <!--   <child> -->
+  <!--     <object class="GtkLabel" id="_description_label"> -->
+  <!--       <property name="visible">True</property> -->
+  <!--       <property name="can_focus">False</property> -->
+  <!--       <property name="justify">center</property> -->
+  <!--       <property name="use-markup">True</property> -->
+  <!--       <style> -->
+  <!--         <class name="description"/> -->
+  <!--         <class name="body"/> -->
+  <!--       </style> -->
+  <!--     </object> -->
+  <!--   </child> -->
+  <!-- </object> -->
 </interface>
diff --git a/gnomemusic/views/emptyview.py b/gnomemusic/views/emptyview.py
index 45a7a5fe5..247aa387f 100644
--- a/gnomemusic/views/emptyview.py
+++ b/gnomemusic/views/emptyview.py
@@ -27,6 +27,7 @@ from enum import IntEnum
 from gettext import gettext as _
 from gi.repository import GLib, GObject, Gtk, Tracker
 
+from gnomemusic.svgpaintable import SVGPaintable
 
 @Gtk.Template(resource_path="/org/gnome/Music/ui/EmptyView.ui")
 class EmptyView(Gtk.Stack):
@@ -81,7 +82,20 @@ class EmptyView(Gtk.Stack):
         # child_of_child = self._status_page.get_child().get_child()
         # self._adw_clamp = child_of_child.get_child().get_children()[0]
 
-        self._status_page.set_child(self._initial_state)
+        paintable = SVGPaintable(None)
+        # self._status_page.set_child(self._initial_state)
+        #picture = Gtk.Picture()
+        #picture.props.can_shrink = True
+        # picture.props.paintable = paintable
+        picture = Gtk.Picture.new_for_paintable(paintable)
+
+        self._status_page.props.paintable = paintable
+
+        self._status_page.props.description = self._content_text
+        self._status_page.props.title = _("Welcome to Music")
+
+        picture.props.can_shrink = True
+        self._status_page.set_child(picture)
 
         self._state = EmptyView.State.EMPTY
 
@@ -103,7 +117,7 @@ class EmptyView(Gtk.Stack):
         self._state = value
 
         # self._adw_clamp.props.visible = True
-        self._initial_state.props.visible = False
+        # self._initial_state.props.visible = False
 
         if self._state == EmptyView.State.EMPTY:
             self._set_empty_state()
@@ -115,8 +129,9 @@ class EmptyView(Gtk.Stack):
             self._set_tracker_outdated_state()
 
     def _set_empty_state(self):
+        return
         # self._adw_clamp.props.visible = False
-        self._initial_state.props.visible = True
+        # self._initial_state.props.visible = True
 
         self._description_label.props.label = self._content_text
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]