SF.net SVN: geany:[3792] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Wed May 13 15:37:28 UTC 2009


Revision: 3792
          http://geany.svn.sourceforge.net/geany/?rev=3792&view=rev
Author:   ntrel
Date:     2009-05-13 15:37:28 +0000 (Wed, 13 May 2009)

Log Message:
-----------
Implement Most-Recently-Used document switching when pressing
Ctrl-Tab keybinding. (It's probably not perfect, but works OK).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/TODO
    trunk/src/keybindings.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-05-13 15:21:54 UTC (rev 3791)
+++ trunk/ChangeLog	2009-05-13 15:37:28 UTC (rev 3792)
@@ -2,6 +2,9 @@
 
  * src/keyfile.c:
    Remember scribble cursor position.
+ * src/keybindings.c, TODO:
+   Implement Most-Recently-Used document switching when pressing
+   Ctrl-Tab keybinding. (It's probably not perfect, but works OK).
 
 
 2009-05-12  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/TODO
===================================================================
--- trunk/TODO	2009-05-13 15:21:54 UTC (rev 3791)
+++ trunk/TODO	2009-05-13 15:37:28 UTC (rev 3792)
@@ -12,7 +12,6 @@
 	  programming languages
 	o configurable filetype and project make commands (e.g. using
 	  bud for D)
-	o MRU documents switching
 	o (support for adding plugin filetypes - SCI_LOADLEXERLIBRARY?)
 	o (selectable menu of arguments to use for Make, from Make Custom)
 	o (DBUS)

Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c	2009-05-13 15:21:54 UTC (rev 3791)
+++ trunk/src/keybindings.c	2009-05-13 15:37:28 UTC (rev 3792)
@@ -63,6 +63,7 @@
 
 const gsize MAX_MRU_DOCS = 20;
 static GQueue *mru_docs = NULL;
+static guint mru_pos = 0;
 
 static gboolean switch_dialog_cancelled = TRUE;
 static GtkWidget *switch_dialog = NULL;
@@ -1499,6 +1500,8 @@
 
 		if (switch_dialog && GTK_WIDGET_VISIBLE(switch_dialog))
 			gtk_widget_hide(switch_dialog);
+
+		mru_pos = 0;
 	}
 	return FALSE;
 }
@@ -1552,7 +1555,10 @@
 static gboolean on_switch_timeout(G_GNUC_UNUSED gpointer data)
 {
 	if (switch_dialog_cancelled)
+	{
 		return FALSE;
+	}
+	mru_pos += 2;
 
 	if (! switch_dialog)
 		switch_dialog = create_switch_dialog();
@@ -1566,10 +1572,14 @@
 
 static void cb_func_switch_tablastused(G_GNUC_UNUSED guint key_id)
 {
-	/* TODO: MRU switching order */
-	GeanyDocument *last_doc = g_queue_peek_head(mru_docs);
+	GeanyDocument *last_doc = g_queue_peek_nth(mru_docs, mru_pos);
 
 	if (! DOC_VALID(last_doc))
+	{
+		mru_pos = 0;
+		last_doc = g_queue_peek_nth(mru_docs, mru_pos);
+	}
+	if (! DOC_VALID(last_doc))
 		return;
 
 	gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook),


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