[epiphany/gnome-3-26] notification: Destroy widget when close button is clicked
- From: Gabriel Ivașcu <gabrielivascu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/gnome-3-26] notification: Destroy widget when close button is clicked
- Date: Sun, 10 Dec 2017 16:14:35 +0000 (UTC)
commit ea1e546db9efebcc89fe3f46a2b031e4c603452c
Author: Gabriel Ivascu <gabrielivascu gnome org>
Date: Sun Dec 10 14:11:04 2017 +0200
notification: Destroy widget when close button is clicked
https://bugzilla.gnome.org/show_bug.cgi?id=790094
lib/ephy-notification-container.c | 15 +++++++++++++++
lib/ephy-notification-container.h | 1 +
lib/ephy-notification.c | 9 +++++++--
3 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/lib/ephy-notification-container.c b/lib/ephy-notification-container.c
index 1fdce67..8591f2d 100644
--- a/lib/ephy-notification-container.c
+++ b/lib/ephy-notification-container.c
@@ -79,3 +79,18 @@ ephy_notification_container_add_notification (EphyNotificationContainer *self,
gtk_widget_show_all (GTK_WIDGET (self));
gtk_revealer_set_reveal_child (GTK_REVEALER (self), TRUE);
}
+
+guint
+ephy_notification_container_get_num_children (EphyNotificationContainer *self)
+{
+ GList *children;
+ guint retval;
+
+ g_assert (EPHY_IS_NOTIFICATION_CONTAINER (self));
+
+ children = gtk_container_get_children (GTK_CONTAINER (self->grid));
+ retval = g_list_length (children);
+ g_list_free (children);
+
+ return retval;
+}
diff --git a/lib/ephy-notification-container.h b/lib/ephy-notification-container.h
index dc4348e..5cb5b43 100644
--- a/lib/ephy-notification-container.h
+++ b/lib/ephy-notification-container.h
@@ -32,5 +32,6 @@ EphyNotificationContainer *ephy_notification_container_get_default (void);
void ephy_notification_container_add_notification (EphyNotificationContainer *self,
GtkWidget
*notification);
+guint ephy_notification_container_get_num_children (EphyNotificationContainer *self);
G_END_DECLS
diff --git a/lib/ephy-notification.c b/lib/ephy-notification.c
index 68d45c4..fa1a08f 100644
--- a/lib/ephy-notification.c
+++ b/lib/ephy-notification.c
@@ -118,8 +118,13 @@ close_button_clicked_cb (GtkButton *button,
{
EphyNotificationContainer *container = ephy_notification_container_get_default ();
- gtk_widget_hide (GTK_WIDGET (container));
- gtk_revealer_set_reveal_child (GTK_REVEALER (container), FALSE);
+ /* gtk_widget_destroy() removes the widget from its parent container. */
+ gtk_widget_destroy (GTK_WIDGET (self));
+
+ if (ephy_notification_container_get_num_children (container) == 0) {
+ gtk_widget_hide (GTK_WIDGET (container));
+ gtk_revealer_set_reveal_child (GTK_REVEALER (container), FALSE);
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]