mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-28 22:41:43 +00:00
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:
parent
e1ff15549b
commit
8fcf3a8e88
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user