[gnome-boxes] notification: Port Boxes.AuthNotification to GtkRevealer
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] notification: Port Boxes.AuthNotification to GtkRevealer
- Date: Tue, 2 May 2017 10:19:11 +0000 (UTC)
commit 6a83809a911b37fff43134bcc0f2b1f2a8e9690b
Author: Felipe Borges <felipeborges gnome org>
Date: Mon Mar 13 13:21:37 2017 +0100
notification: Port Boxes.AuthNotification to GtkRevealer
GtkRevealer combined with the "app-notification" class is enough
to represent the notification concept nowadays. This is part of
the effort to drop the dependency on libgd.
https://bugzilla.gnome.org/show_bug.cgi?id=779978
data/ui/auth-notification.ui | 8 +++++---
src/auth-notification.vala | 16 ++++++++++++++--
2 files changed, 19 insertions(+), 5 deletions(-)
---
diff --git a/data/ui/auth-notification.ui b/data/ui/auth-notification.ui
index 69ad0d7..285fada 100644
--- a/data/ui/auth-notification.ui
+++ b/data/ui/auth-notification.ui
@@ -1,17 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.9 -->
- <template class="BoxesAuthNotification" parent="GdNotification">
+ <template class="BoxesAuthNotification" parent="GtkRevealer">
<property name="visible">True</property>
<property name="valign">start</property>
- <property name="timeout">-1</property>
+ <property name="border-width">6</property>
<child>
<object class="GtkGrid" id="grid">
<property name="visible">True</property>
<property name="column-spacing">12</property>
<property name="row-spacing">6</property>
- <property name="border-width">6</property>
+ <style>
+ <class name="app-notification"/>
+ </style>
<child>
<object class="GtkLabel" id="title_label">
diff --git a/src/auth-notification.vala b/src/auth-notification.vala
index d33ff9c..3f33f47 100644
--- a/src/auth-notification.vala
+++ b/src/auth-notification.vala
@@ -2,7 +2,9 @@
using Gtk;
[GtkTemplate (ui = "/org/gnome/Boxes/ui/auth-notification.ui")]
-private class Boxes.AuthNotification: Gd.Notification {
+private class Boxes.AuthNotification: Gtk.Revealer {
+ public signal void dismissed ();
+
public delegate void AuthFunc (string username, string password);
[GtkChild]
@@ -26,7 +28,12 @@ private class Boxes.AuthNotification: Gd.Notification {
owned Notification.DismissFunc? dismiss_func,
bool need_username,
Searchbar searchbar) {
- show_close_button = false; // FIXME: Seems setting this from .UI file doesn't work
+ /*
+ * Templates cannot set construct properties, so
+ * lets use the respective property setter method.
+ */
+ set_reveal_child (true);
+
title_label.label = auth_string;
dismissed.connect (() => {
@@ -79,4 +86,9 @@ private class Boxes.AuthNotification: Gd.Notification {
dismiss ();
}
+
+ public void dismiss () {
+ set_reveal_child (false);
+ dismissed ();
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]