summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-03-03 11:44:05 +0300
committermonsta <[email protected]>2016-03-03 11:56:57 +0300
commitd746e6200476b98b07f23d80268a992508e32477 (patch)
tree0b8e607e883af20f2e0179511a3316a280e007fe
parentf1d3357dd9894baf39ee4137bc5d593a40719ad7 (diff)
downloadmate-utils-d746e6200476b98b07f23d80268a992508e32477.tar.bz2
mate-utils-d746e6200476b98b07f23d80268a992508e32477.tar.xz
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
-rw-r--r--mate-dictionary/src/gdict-sidebar.c9
1 files 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 *