[gnome-dictionary] sidebar: Do not select unrealized menu items
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-dictionary] sidebar: Do not select unrealized menu items
- Date: Sun, 6 Oct 2013 03:12:06 +0000 (UTC)
commit 100e14d428c85b20252c92ee56c6a2f410e2f6d0
Author: Florian Müllner <fmuellner gnome org>
Date: Tue May 8 17:44:21 2012 +0200
sidebar: Do not select unrealized menu items
Current GTK+ does not like this and will emit a warning in the best
case or block all events in the worst one.
https://bugzilla.gnome.org/show_bug.cgi?id=675704
src/gdict-sidebar.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/gdict-sidebar.c b/src/gdict-sidebar.c
index fcff371..c800428 100644
--- a/src/gdict-sidebar.c
+++ b/src/gdict-sidebar.c
@@ -445,7 +445,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);
}
@@ -495,7 +496,9 @@ 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);
}
@@ -520,7 +523,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 *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]