[gnome-music] notificationspopup: Port LoadingNotification to GtkTemplate



commit a0e183c675d1bde5ce9f48d392880c20c01a75d1
Author: Atharva Veer <adveer_b17 it vjti ac in>
Date:   Wed Apr 1 19:30:04 2020 +0530

    notificationspopup: Port LoadingNotification to GtkTemplate

 data/org.gnome.Music.gresource.xml       |  1 +
 data/ui/LoadingNotification.ui           | 20 ++++++++++++++++++++
 gnomemusic/widgets/notificationspopup.py | 14 ++++----------
 po/POTFILES.in                           |  1 +
 4 files changed, 26 insertions(+), 10 deletions(-)
---
diff --git a/data/org.gnome.Music.gresource.xml b/data/org.gnome.Music.gresource.xml
index 5633440a..999cac2a 100644
--- a/data/org.gnome.Music.gresource.xml
+++ b/data/org.gnome.Music.gresource.xml
@@ -18,6 +18,7 @@
     <file preprocess="xml-stripblanks">ui/FilterView.ui</file>
     <file preprocess="xml-stripblanks">ui/HeaderBar.ui</file>
     <file preprocess="xml-stripblanks">ui/LastfmDialog.ui</file>
+    <file preprocess="xml-stripblanks">ui/LoadingNotification.ui</file>
     <file preprocess="xml-stripblanks">ui/NotificationsPopup.ui</file>
     <file preprocess="xml-stripblanks">ui/PlayerToolbar.ui</file>
     <file preprocess="xml-stripblanks">ui/PlaylistContextMenu.ui</file>
diff --git a/data/ui/LoadingNotification.ui b/data/ui/LoadingNotification.ui
new file mode 100644
index 00000000..3af3a1ac
--- /dev/null
+++ b/data/ui/LoadingNotification.ui
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="LoadingNotification" parent="GtkGrid">
+    <property name="column_spacing">18</property>
+    <child>
+      <object class="GtkSpinner">
+        <property name="visible">True</property>
+        <property name="active">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkLabel">
+        <property name="visible">True</property>
+        <property name="halign">start</property>
+        <property name="hexpand">True</property>
+        <property name="label" translatable="yes">Loading</property>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/gnomemusic/widgets/notificationspopup.py b/gnomemusic/widgets/notificationspopup.py
index 29c8be48..36791b57 100644
--- a/gnomemusic/widgets/notificationspopup.py
+++ b/gnomemusic/widgets/notificationspopup.py
@@ -119,6 +119,7 @@ class NotificationsPopup(Gtk.Revealer):
                 notification._finish_deletion()
 
 
+@Gtk.Template(resource_path="/org/gnome/Music/ui/LoadingNotification.ui")
 class LoadingNotification(Gtk.Grid):
     """LoadingNotification displays a loading notification message
 
@@ -131,20 +132,13 @@ class LoadingNotification(Gtk.Grid):
         'invisible': (GObject.SignalFlags.RUN_FIRST, None, ())
     }
 
+    __gtype_name__ = "LoadingNotification"
+
     def __init__(self):
-        super().__init__(column_spacing=18)
+        super().__init__()
         self._counter = 0
         self._timeout_id = 0
 
-        spinner = Gtk.Spinner()
-        spinner.start()
-        self.add(spinner)
-
-        label = Gtk.Label(
-            label=_("Loading"), halign=Gtk.Align.START, hexpand=True)
-        self.add(label)
-        self.show_all()
-
     def pop(self):
         """Decrease the counter. Hide notification if it reaches 0."""
         self._counter = self._counter - 1
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 337ac20b..a01d6928 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -9,6 +9,7 @@ data/ui/AppMenu.ui
 data/ui/HeaderBar.ui
 data/ui/help-overlay.ui
 data/ui/LastfmDialog.ui
+data/ui/LoadingNotification.ui
 data/ui/PlayerToolbar.ui
 data/ui/PlaylistContextMenu.ui
 data/ui/PlaylistControls.ui


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