[gtk+] popover: Ensure there is a child before focusing it
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] popover: Ensure there is a child before focusing it
- Date: Sat, 13 Dec 2014 16:12:17 +0000 (UTC)
commit 99791007a77abef9375c171c62592e4b3b397d24
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Dec 13 17:05:56 2014 +0100
popover: Ensure there is a child before focusing it
Fixes a warning in empty popovers being shown.
gtk/gtkpopover.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index ef2badc..a3a1902 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -1254,9 +1254,13 @@ gtk_popover_key_press (GtkWidget *widget,
static void
gtk_popover_grab_focus (GtkWidget *widget)
{
+ GtkWidget *child;
+
/* Focus the first natural child */
- gtk_widget_child_focus (gtk_bin_get_child (GTK_BIN (widget)),
- GTK_DIR_TAB_FORWARD);
+ child = gtk_bin_get_child (GTK_BIN (widget));
+
+ if (child)
+ gtk_widget_child_focus (child, GTK_DIR_TAB_FORWARD);
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]