Commit ea1e546d authored by Gabriel Ivascu's avatar Gabriel Ivascu

notification: Destroy widget when close button is clicked

https://bugzilla.gnome.org/show_bug.cgi?id=790094
parent f7610e3b
......@@ -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;
}
......@@ -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
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment