SF.net SVN: geany: [1698] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Fri Jul 13 10:46:12 UTC 2007


Revision: 1698
          http://svn.sourceforge.net/geany/?rev=1698&view=rev
Author:   ntrel
Date:     2007-07-13 03:46:11 -0700 (Fri, 13 Jul 2007)

Log Message:
-----------
Prevent warning when closing files when Geany is busy (e.g. pressing
Ctrl-W when opening files).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/treeviews.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-07-12 18:07:49 UTC (rev 1697)
+++ trunk/ChangeLog	2007-07-13 10:46:11 UTC (rev 1698)
@@ -1,3 +1,10 @@
+2007-07-13  Nick Treleaven  <nick.treleaven at btinternet.com>
+
+ * src/treeviews.c:
+   Prevent warning when closing files when Geany is busy (e.g. pressing
+   Ctrl-W when opening files).
+
+
 2007-07-12  Enrico Tröger  <enrico.troeger at uvena.de>
 
  * src/document.c, src/editor.c:

Modified: trunk/src/treeviews.c
===================================================================
--- trunk/src/treeviews.c	2007-07-12 18:07:49 UTC (rev 1697)
+++ trunk/src/treeviews.c	2007-07-13 10:46:11 UTC (rev 1698)
@@ -414,9 +414,17 @@
 }
 
 
-static gboolean change_focus(GtkWidget *widget)
+static gboolean change_focus(gpointer data)
 {
-	gtk_widget_grab_focus(widget);
+	gint idx = (gint) data;
+
+	// idx might not be valid e.g. if user closed a tab whilst Geany is opening files
+	if (DOC_IDX_VALID(idx))
+	{
+		GtkWidget *widget = GTK_WIDGET(doc_list[idx].sci);
+
+		gtk_widget_grab_focus(widget);
+	}
 	return FALSE;
 }
 
@@ -434,7 +442,7 @@
 		gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook),
 					gtk_notebook_page_num(GTK_NOTEBOOK(app->notebook),
 					(GtkWidget*) doc_list[idx].sci));
-		g_idle_add((GSourceFunc) change_focus, GTK_WIDGET(doc_list[idx].sci));
+		g_idle_add((GSourceFunc) change_focus, (gpointer) idx);
 	}
 }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list