[geany/geany] 46f01b: Properly mirror document_get_from_page() in document_get_notebook_page()
Colomban Wendling
git-noreply at xxxxx
Tue May 27 15:55:00 UTC 2014
Branch: refs/heads/master
Author: Colomban Wendling <ban at herbesfolles.org>
Committer: Colomban Wendling <ban at herbesfolles.org>
Date: Tue, 27 May 2014 15:55:00 UTC
Commit: 46f01bff59073905a01c799219fd0118c041f9c7
https://github.com/geany/geany/commit/46f01bff59073905a01c799219fd0118c041f9c7
Log Message:
-----------
Properly mirror document_get_from_page() in document_get_notebook_page()
Now document_get_from_page() supports arbitrary nesting inside the
notebook page, update document_get_notebook_page() to support it also,
by searching up for the direct notebook child rather than assuming it
is the ScintillaWidget's direct parent.
Modified Paths:
--------------
src/document.c
Modified: src/document.c
13 lines changed, 10 insertions(+), 3 deletions(-)
===================================================================
@@ -222,13 +222,20 @@ GeanyDocument *document_find_by_sci(ScintillaObject *sci)
gint document_get_notebook_page(GeanyDocument *doc)
{
GtkWidget *parent;
+ GtkWidget *child;
g_return_val_if_fail(doc != NULL, -1);
- parent = gtk_widget_get_parent(GTK_WIDGET(doc->editor->sci));
- g_return_val_if_fail(GTK_IS_BOX(parent), -1);
+ child = GTK_WIDGET(doc->editor->sci);
+ parent = gtk_widget_get_parent(child);
+ /* search for the direct notebook child, mirroring document_get_from_page() */
+ while (parent && ! GTK_IS_NOTEBOOK(parent))
+ {
+ child = parent;
+ parent = gtk_widget_get_parent(child);
+ }
- return gtk_notebook_page_num(GTK_NOTEBOOK(main_widgets.notebook), parent);
+ return gtk_notebook_page_num(GTK_NOTEBOOK(main_widgets.notebook), child);
}
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list