[gedit/wip/misc-improvements] notebook: use gtk_widget_get_ancestor()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/wip/misc-improvements] notebook: use gtk_widget_get_ancestor()
- Date: Fri, 26 Jun 2015 09:31:24 +0000 (UTC)
commit 4f56d417be6627380369a3b5575a8bdbbeed587e
Author: Sébastien Wilmet <swilmet gnome org>
Date: Fri Jun 26 11:30:30 2015 +0200
notebook: use gtk_widget_get_ancestor()
gedit/gedit-notebook.c | 19 ++-----------------
1 files changed, 2 insertions(+), 17 deletions(-)
---
diff --git a/gedit/gedit-notebook.c b/gedit/gedit-notebook.c
index 1022ed2..e6fce54 100644
--- a/gedit/gedit-notebook.c
+++ b/gedit/gedit-notebook.c
@@ -278,22 +278,6 @@ switch_to_last_focused_page (GeditNotebook *notebook,
}
}
-static GtkWidget *
-get_notebook_from_view (GtkWidget *view)
-{
- GtkWidget *widget;
-
- widget = view;
-
- do
- {
- widget = gtk_widget_get_parent (widget);
- }
- while (!GEDIT_IS_NOTEBOOK (widget));
-
- return widget;
-}
-
static void
drag_data_received_cb (GtkWidget *widget,
GdkDragContext *context,
@@ -325,7 +309,8 @@ drag_data_received_cb (GtkWidget *widget,
/* We need to iterate and get the notebook of the target view
* because we can have several notebooks per window.
*/
- new_notebook = get_notebook_from_view (widget);
+ new_notebook = gtk_widget_get_ancestor (widget, GEDIT_TYPE_NOTEBOOK);
+ g_return_if_fail (new_notebook != NULL);
if (notebook != new_notebook)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]