[gnome-news] toolbar: show a spinner while adding the feed
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-news] toolbar: show a spinner while adding the feed
- Date: Mon, 7 Nov 2016 12:07:15 +0000 (UTC)
commit 42787d1f7c42054340edb33363d739b3ed913902
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Mon Nov 7 09:52:45 2016 -0200
toolbar: show a spinner while adding the feed
data/ui/headerbar.ui | 35 +++++++++++++++++++++++++++++------
gnomenews/toolbar.py | 11 ++++++++++-
2 files changed, 39 insertions(+), 7 deletions(-)
---
diff --git a/data/ui/headerbar.ui b/data/ui/headerbar.ui
index dc66419..1324ed8 100644
--- a/data/ui/headerbar.ui
+++ b/data/ui/headerbar.ui
@@ -41,14 +41,37 @@
</object>
</child>
<child>
- <object class="GtkButton" id="add-button">
+ <object class="GtkStack" id="add-button-stack">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="sensitive">False</property>
- <property name="label" translatable="yes">Add</property>
- <style>
- <class name="suggested-action"/>
- </style>
+ <property name="vhomogeneous">True</property>
+ <property name="interpolate_size">True</property>
+ <child>
+ <object class="GtkButton" id="add-button">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="sensitive">False</property>
+ <property name="label" translatable="yes">Add</property>
+ <style>
+ <class name="suggested-action"/>
+ </style>
+ </object>
+ <packing>
+ <property name="name">button</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinner">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="active">True</property>
+ <property name="valign">center</property>
+ <property name="halign">start</property>
+ </object>
+ <packing>
+ <property name="name">spinner</property>
+ </packing>
+ </child>
</object>
</child>
</object>
diff --git a/gnomenews/toolbar.py b/gnomenews/toolbar.py
index bb2c760..7624660 100644
--- a/gnomenews/toolbar.py
+++ b/gnomenews/toolbar.py
@@ -54,6 +54,8 @@ class Toolbar(GObject.GObject):
self.add_popover.hide()
self.add_toggle_button.set_popover(self.add_popover)
+ self.button_stack = self._ui.get_object('add-button-stack')
+
self.new_url = self._ui.get_object('new-url')
self.new_url.connect('changed', self.on_new_url_changed)
self.add_button = self._ui.get_object('add-button')
@@ -148,7 +150,14 @@ class Toolbar(GObject.GObject):
@log
def _add_new_feed(self, button):
new_url = self.new_url.get_text()
- self.window.tracker.add_channel(new_url)
+ self.window.tracker.add_channel(new_url, 30, None, self._channel_added)
+ self.button_stack.set_visible_child_name('spinner')
+ self.new_url.set_sensitive(False)
+
+ @log
+ def _channel_added(self, user_data=None):
+ self.button_stack.set_visible_child_name('button')
+ self.new_url.set_sensitive(True)
self.new_url.set_text('')
self.add_popover.hide()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]