GtkSearchBar: don't peek out

When the searchbar is hidden, a 1-pixel-high piece of it is
still peeking out, because visible widgets are always allocated
at least 1x1. Work around this by setting child-visible to FALSE
in this situation.

https://bugzilla.gnome.org/show_bug.cgi?id=724096
This commit is contained in:
Matthias Clasen 2014-10-12 18:18:04 -04:00
parent e1ff15549b
commit 8fcf3a8e88

View File

@ -250,6 +250,9 @@ reveal_child_changed_cb (GObject *object,
gboolean reveal_child;
g_object_get (object, "reveal-child", &reveal_child, NULL);
if (reveal_child)
gtk_widget_set_child_visible (priv->revealer, TRUE);
if (reveal_child == priv->reveal_child)
return;
@ -266,6 +269,19 @@ reveal_child_changed_cb (GObject *object,
g_object_notify (G_OBJECT (bar), "search-mode-enabled");
}
static void
child_revealed_changed_cb (GObject *object,
GParamSpec *pspec,
GtkSearchBar *bar)
{
GtkSearchBarPrivate *priv = gtk_search_bar_get_instance_private (bar);
gboolean val;
g_object_get (object, "child-revealed", &val, NULL);
if (!val)
gtk_widget_set_child_visible (priv->revealer, FALSE);
}
static void
close_button_clicked_cb (GtkWidget *button,
GtkSearchBar *bar)
@ -437,10 +453,15 @@ gtk_search_bar_init (GtkSearchBar *bar)
gtk_widget_init_template (GTK_WIDGET (bar));
gtk_widget_show_all (priv->tool_box);
/* We use child-visible to avoid the unexpanded revealer
* peaking out by 1 pixel
*/
gtk_widget_set_child_visible (priv->revealer, FALSE);
g_signal_connect (priv->revealer, "notify::reveal-child",
G_CALLBACK (reveal_child_changed_cb), bar);
g_signal_connect (priv->revealer, "notify::child-revealed",
G_CALLBACK (child_revealed_changed_cb), bar);
gtk_widget_set_no_show_all (priv->close_button, TRUE);
g_signal_connect (priv->close_button, "clicked",