[geany/geany] 7a4b52: Avoid code duplication in document_get_current()

Colomban Wendling git-noreply at xxxxx
Tue May 27 16:00:56 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 16:00:56 UTC
Commit:      7a4b5246611193cece08161c965c9a81b1e6b04d
             https://github.com/geany/geany/commit/7a4b5246611193cece08161c965c9a81b1e6b04d

Log Message:
-----------
Avoid code duplication in document_get_current()


Modified Paths:
--------------
    src/document.c

Modified: src/document.c
16 lines changed, 2 insertions(+), 14 deletions(-)
===================================================================
@@ -304,24 +304,12 @@ GeanyDocument *document_get_from_page(guint page_num)
  **/
 GeanyDocument *document_get_current(void)
 {
-	gint cur_page;
-	GtkWidget *parent;
-	ScintillaObject *sci;
-
-	cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(main_widgets.notebook));
+	gint cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(main_widgets.notebook));
 
 	if (cur_page == -1)
 		return NULL;
 	else
-	{
-		parent = gtk_notebook_get_nth_page(GTK_NOTEBOOK(main_widgets.notebook), cur_page);
-		g_return_val_if_fail(GTK_IS_BOX(parent), NULL);
-
-		sci = locate_sci_in_container(parent);
-		g_return_val_if_fail(IS_SCINTILLA(sci), NULL);
-
-		return document_find_by_sci(sci);
-	}
+		return document_get_from_page((guint) cur_page);
 }
 
 



--------------
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