[dconf-editor] Create NotificationsRevealer on the fly.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Create NotificationsRevealer on the fly.
- Date: Wed, 19 Dec 2018 17:19:56 +0000 (UTC)
commit b5b482cbf832d214938f005a212a8c3006b2b55d
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Fri Dec 14 10:55:38 2018 +0100
Create NotificationsRevealer on the fly.
editor/browser-window.ui | 7 +------
editor/browser-window.vala | 22 ++++++++++++++++++++--
2 files changed, 21 insertions(+), 8 deletions(-)
---
diff --git a/editor/browser-window.ui b/editor/browser-window.ui
index 5a8f81b..89ce242 100644
--- a/editor/browser-window.ui
+++ b/editor/browser-window.ui
@@ -9,7 +9,7 @@
<signal name="button-press-event" handler="on_button_press_event"/>
<signal name="destroy" handler="on_destroy"/>
<child>
- <object class="GtkOverlay">
+ <object class="GtkOverlay" id="main_overlay">
<property name="visible">True</property>
<child>
<object class="GtkGrid" id="main_grid">
@@ -17,11 +17,6 @@
<property name="orientation">vertical</property>
</object>
</child>
- <child type="overlay">
- <object class="NotificationsRevealer" id="notifications_revealer">
- <property name="visible">True</property>
- </object>
- </child>
</object>
</child>
</template>
diff --git a/editor/browser-window.vala b/editor/browser-window.vala
index ec9b67c..d2dc625 100644
--- a/editor/browser-window.vala
+++ b/editor/browser-window.vala
@@ -49,7 +49,6 @@ private abstract class BrowserWindow : AdaptativeWindow, AdaptativeWidget
add_adaptative_child (headerbar);
add_adaptative_child (browser_view);
- add_adaptative_child (notifications_revealer);
add_adaptative_child (this);
}
@@ -902,15 +901,34 @@ private abstract class BrowserWindow : AdaptativeWindow, AdaptativeWidget
* * notifications
\*/
- [GtkChild] private NotificationsRevealer notifications_revealer;
+ [GtkChild] private Overlay main_overlay;
+
+ private bool notifications_revealer_created = false;
+ private NotificationsRevealer notifications_revealer;
+
+ private void create_notifications_revealer ()
+ {
+ notifications_revealer = new NotificationsRevealer ();
+ add_adaptative_child (notifications_revealer);
+ notifications_revealer.set_window_size (window_size);
+ notifications_revealer.show ();
+ main_overlay.add_overlay (notifications_revealer);
+ notifications_revealer_created = true;
+ }
protected void show_notification (string notification)
{
+ if (!notifications_revealer_created)
+ create_notifications_revealer ();
+
notifications_revealer.show_notification (notification);
}
protected void hide_notification ()
{
+ if (!notifications_revealer_created)
+ return;
+
notifications_revealer.hide_notification ();
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]