From d746e6200476b98b07f23d80268a992508e32477 Mon Sep 17 00:00:00 2001 From: monsta Date: Thu, 3 Mar 2016 11:44:05 +0300 Subject: sidebar: don't select unrealized menu items fixes warnings on startup and UI freeze after selecting "New" menu item with GTK+ >= 3.18 from https://git.gnome.org/browse/gnome-dictionary/commit/?id=100e14d428c85b20252c92ee56c6a2f410e2f6d0 --- mate-dictionary/src/gdict-sidebar.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mate-dictionary/src/gdict-sidebar.c b/mate-dictionary/src/gdict-sidebar.c index ae05a2ea..9709a78d 100644 --- a/mate-dictionary/src/gdict-sidebar.c +++ b/mate-dictionary/src/gdict-sidebar.c @@ -460,7 +460,8 @@ gdict_sidebar_add_page (GdictSidebar *sidebar, gtk_widget_show (menu_item); page->menu_item = menu_item; - gtk_menu_shell_select_item (GTK_MENU_SHELL (priv->menu), menu_item); + if (gtk_widget_get_realized (priv->menu)) + gtk_menu_shell_select_item (GTK_MENU_SHELL (priv->menu), menu_item); gtk_label_set_text (GTK_LABEL (priv->label), page_name); gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), page->index); } @@ -510,7 +511,8 @@ gdict_sidebar_remove_page (GdictSidebar *sidebar, page = priv->pages->data; if (page) { - gtk_menu_shell_select_item (GTK_MENU_SHELL (priv->menu), page->menu_item); + if (gtk_widget_get_realized (priv->menu)) + gtk_menu_shell_select_item (GTK_MENU_SHELL (priv->menu), page->menu_item); gtk_label_set_text (GTK_LABEL (priv->label), page->name); gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), page->index); } @@ -535,7 +537,8 @@ gdict_sidebar_view_page (GdictSidebar *sidebar, gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), page->index); gtk_label_set_text (GTK_LABEL (priv->label), page->name); - gtk_menu_shell_select_item (GTK_MENU_SHELL (priv->menu), page->menu_item); + if (gtk_widget_get_realized (priv->menu)) + gtk_menu_shell_select_item (GTK_MENU_SHELL (priv->menu), page->menu_item); } const gchar * -- cgit v1.2.1