InAppNotification: Remove reduntant Overlay.

This commit is contained in:
Jordan Petridis 2018-03-09 19:46:46 +02:00
parent 8614922213
commit 064879c4ce
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6
3 changed files with 68 additions and 71 deletions

View File

@ -2,15 +2,11 @@
<!-- Generated with glade 3.21.0 --> <!-- Generated with glade 3.21.0 -->
<interface> <interface>
<requires lib="gtk+" version="3.20"/> <requires lib="gtk+" version="3.20"/>
<object class="GtkOverlay" id="overlay"> <object class="GtkRevealer" id="revealer">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="halign">center</property> <property name="halign">center</property>
<property name="valign">start</property> <property name="valign">start</property>
<child>
<object class="GtkRevealer" id="revealer">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child> <child>
<object class="GtkFrame"> <object class="GtkFrame">
<property name="visible">True</property> <property name="visible">True</property>
@ -58,6 +54,9 @@
<property name="icon_name">window-close-symbolic</property> <property name="icon_name">window-close-symbolic</property>
</object> </object>
</child> </child>
<style>
<class name="flat image-button"/>
</style>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -74,6 +73,9 @@
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="halign">center</property> <property name="halign">center</property>
<property name="valign">center</property> <property name="valign">center</property>
<style>
<class name="text-button"/>
</style>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -92,10 +94,8 @@
</style> </style>
</object> </object>
</child> </child>
</object> <style>
<packing> <class name="top"/>
<property name="index">-1</property> </style>
</packing>
</child>
</object> </object>
</interface> </interface>

View File

@ -171,7 +171,7 @@ impl App {
let text = "Marked all episodes as listened"; let text = "Marked all episodes as listened";
let notif = InAppNotification::new(text.into(), callback, sender.clone()); let notif = InAppNotification::new(text.into(), callback, sender.clone());
overlay.add_overlay(&notif.overlay); overlay.add_overlay(&notif.revealer);
// We need to display the notification after the widget is added to the overlay // We need to display the notification after the widget is added to the overlay
// so there will be a nice animation. // so there will be a nice animation.
notif.show(); notif.show();

View File

@ -10,8 +10,7 @@ use std::sync::mpsc::Sender;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct InAppNotification { pub struct InAppNotification {
pub overlay: gtk::Overlay, pub revealer: gtk::Revealer,
revealer: gtk::Revealer,
text: gtk::Label, text: gtk::Label,
undo: gtk::Button, undo: gtk::Button,
close: gtk::Button, close: gtk::Button,
@ -21,14 +20,12 @@ impl Default for InAppNotification {
fn default() -> Self { fn default() -> Self {
let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/inapp_notif.ui"); let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/inapp_notif.ui");
let overlay: gtk::Overlay = builder.get_object("overlay").unwrap();
let revealer: gtk::Revealer = builder.get_object("revealer").unwrap(); let revealer: gtk::Revealer = builder.get_object("revealer").unwrap();
let text: gtk::Label = builder.get_object("text").unwrap(); let text: gtk::Label = builder.get_object("text").unwrap();
let undo: gtk::Button = builder.get_object("undo").unwrap(); let undo: gtk::Button = builder.get_object("undo").unwrap();
let close: gtk::Button = builder.get_object("close").unwrap(); let close: gtk::Button = builder.get_object("close").unwrap();
InAppNotification { InAppNotification {
overlay,
revealer, revealer,
text, text,
undo, undo,