SF.net SVN: geany: [1024] trunk/src/notebook.c

ntrel at users.sourceforge.net ntrel at xxxxx
Thu Nov 23 16:06:55 UTC 2006


Revision: 1024
          http://svn.sourceforge.net/geany/?rev=1024&view=rev
Author:   ntrel
Date:     2006-11-23 08:06:54 -0800 (Thu, 23 Nov 2006)

Log Message:
-----------
Make tab_count_changed() slightly more efficient.

Modified Paths:
--------------
    trunk/src/notebook.c

Modified: trunk/src/notebook.c
===================================================================
--- trunk/src/notebook.c	2006-11-23 15:48:02 UTC (rev 1023)
+++ trunk/src/notebook.c	2006-11-23 16:06:54 UTC (rev 1024)
@@ -271,23 +271,25 @@
 }
 
 
-// call this whenever the number of tabs in app->notebook changes.
+// call this after the number of tabs in app->notebook changes.
 static void tab_count_changed()
 {
-	if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)) == 0)
+	switch (gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)))
 	{
+		case 0:
 		/* Enables DnD for dropping files into the empty notebook widget */
 		gtk_drag_dest_set(app->notebook, GTK_DEST_DEFAULT_ALL,
 			files_drop_targets,	G_N_ELEMENTS(files_drop_targets),
 			GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_ASK);
-	}
-	else
-	{
+		break;
+
+		case 1:
 		/* Disables DnD for dropping files into the notebook widget and enables the DnD for moving file
 		 * tabs. Files can still be dropped into the notebook widget because it will be handled by the
 		 * active Scintilla Widget (only dropping to the tab bar is not possible but it should be ok) */
 		gtk_drag_dest_set(app->notebook, GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP,
 			drag_targets, G_N_ELEMENTS(drag_targets), GDK_ACTION_MOVE);
+		break;
 	}
 }
 


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