Headerbar: Wire menu refresh button.

This commit is contained in:
Jordan Petridis 2017-12-25 22:03:37 +02:00
parent 9f51f4826f
commit 0a47b91913
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6
2 changed files with 16 additions and 10 deletions

View File

@ -7,7 +7,7 @@
<property name="tooltip_text" translatable="yes">Add a new feed</property>
<property name="valign">center</property>
<child>
<object class="GtkBox" id="add-box">
<object class="GtkBox" id="add_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
@ -18,7 +18,7 @@
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="add-box-enter-address-label">
<object class="GtkLabel" id="enter_address_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
@ -35,12 +35,12 @@
</packing>
</child>
<child>
<object class="GtkBox" id="add-entry-box">
<object class="GtkBox" id="add_entry_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkEntry" id="new-url">
<object class="GtkEntry" id="new_url">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="width_chars">30</property>
@ -53,12 +53,12 @@
</packing>
</child>
<child>
<object class="GtkStack" id="add-button-stack">
<object class="GtkStack" id="add_button_stack">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="interpolate_size">True</property>
<child>
<object class="GtkButton" id="add-button">
<object class="GtkButton" id="add_button">
<property name="label" translatable="yes">Add</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@ -99,7 +99,7 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="add-box-already-subscribed-label">
<object class="GtkLabel" id="already_subscribed_label">
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">You are already subscribed to that feed!</property>
@ -240,7 +240,7 @@
</packing>
</child>
<child>
<object class="GtkModelButton">
<object class="GtkModelButton" id="refresh_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>

View File

@ -57,8 +57,9 @@ impl Header {
let add_popover: gtk::Popover = builder.get_object("add_popover").unwrap();
let menu_popover: gtk::PopoverMenu = builder.get_object("menu_popover").unwrap();
let new_url: gtk::Entry = builder.get_object("new-url").unwrap();
let add_button: gtk::Button = builder.get_object("add-button").unwrap();
let new_url: gtk::Entry = builder.get_object("new_url").unwrap();
let add_button: gtk::Button = builder.get_object("add_button").unwrap();
let refresh_button: gtk::Button = builder.get_object("refresh_button").unwrap();
self.switch.set_stack(&content.stack);
new_url.connect_changed(move |url| {
@ -72,6 +73,11 @@ impl Header {
// TODO: map the spinner
add_popover.hide();
}));
refresh_button.connect_clicked(clone!(content => move |_| {
utils::refresh_feed(content.clone(), None);
}));
self.add_toggle.set_popover(&add_popover);
self.menu_toggle.set_popover(&menu_popover);