[gedit] Use gtk_widget_is_toplevel when possible. Fixes #562052.



commit 874b81bb320c66c2985ddd4b4b42d4b91445674c
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Mon Apr 12 20:49:05 2010 +0200

    Use gtk_widget_is_toplevel when possible. Fixes #562052.

 gedit/gedit-encodings-combo-box.c |    4 ++++
 gedit/gedit-panel.c               |    8 ++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/gedit/gedit-encodings-combo-box.c b/gedit/gedit-encodings-combo-box.c
index eca30d7..1626bb9 100644
--- a/gedit/gedit-encodings-combo-box.c
+++ b/gedit/gedit-encodings-combo-box.c
@@ -191,7 +191,11 @@ add_or_remove (GeditEncodingsComboBox *menu,
 
 		GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (menu));
 
+#if !GTK_CHECK_VERSION (2, 18, 0)
 		if (!GTK_WIDGET_TOPLEVEL (toplevel))
+#else
+		if (!gtk_widget_is_toplevel (toplevel))
+#endif
 			toplevel = NULL;
 
 		g_signal_handler_block (menu, menu->priv->changed_id);
diff --git a/gedit/gedit-panel.c b/gedit/gedit-panel.c
index 305bf2a..1fa1fd2 100644
--- a/gedit/gedit-panel.c
+++ b/gedit/gedit-panel.c
@@ -142,14 +142,18 @@ static void
 gedit_panel_focus_document (GeditPanel *panel)
 {
 	GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (panel));
+#if !GTK_CHECK_VERSION (2, 18, 0)
 	if (GTK_WIDGET_TOPLEVEL (toplevel) && GEDIT_IS_WINDOW (toplevel))
-   	{
+#else
+	if (gtk_widget_is_toplevel (toplevel) && GEDIT_IS_WINDOW (toplevel))
+#endif
+	{
 		GeditView *view;
 
 		view = gedit_window_get_active_view (GEDIT_WINDOW (toplevel));
 		if (view != NULL)
 			gtk_widget_grab_focus (GTK_WIDGET (view));
-   	}
+	}
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]