[gnumeric] Show the recently-used functions in the function selector



commit 9e052691e9cc4b3d11a1d00905f29bf5e655fc4b
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Tue Jun 8 22:55:24 2010 -0600

    Show the recently-used functions in the function selector
    
    2010-06-08 Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* dialog-function-select.c (dialog_function_select_search):
    	  for "recent" functions, reset the category to NULL
    	(cb_dialog_function_load_recent_funcs): new
    	(dialog_function_load_recent_funcs): toggle the recent flag
    	  for recently used functions

 src/dialogs/ChangeLog                |    8 ++++++++
 src/dialogs/dialog-function-select.c |   28 +++++++++++++++++++++++++++-
 2 files changed, 35 insertions(+), 1 deletions(-)
---
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index ce021b3..e94657a 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,5 +1,13 @@
 2010-06-08 Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* dialog-function-select.c (dialog_function_select_search):
+	  for "recent" functions, reset the category to NULL
+	(cb_dialog_function_load_recent_funcs): new
+	(dialog_function_load_recent_funcs): toggle the recent flag
+	  for recently used functions
+
+2010-06-08 Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* function-select.glade: redesign
 	* dialog-function-select.c: rewrite nearly completely to
 	  use a GtkTreeModelFilter and to provide search ability
diff --git a/src/dialogs/dialog-function-select.c b/src/dialogs/dialog-function-select.c
index fd5415b..8358e56 100644
--- a/src/dialogs/dialog-function-select.c
+++ b/src/dialogs/dialog-function-select.c
@@ -172,6 +172,8 @@ dialog_function_select_search (GtkEntry *entry, gpointer data)
 		specs.recent_only 
 			= (specs.cat != NULL && 
 			   specs.cat == GINT_TO_POINTER(-1));
+		if (specs.recent_only)
+			specs.cat = NULL;
 	}
 	
 	gtk_tree_model_foreach (GTK_TREE_MODEL (state->model_functions),
@@ -203,6 +205,26 @@ dialog_function_select_cat_changed (G_GNUC_UNUSED GtkComboBox *widget,
 
 /*************************************************************************/
 
+static gboolean
+cb_dialog_function_load_recent_funcs(GtkTreeModel *model,
+				     GtkTreePath *path,
+				     GtkTreeIter *iter,
+				     gpointer data)
+{
+	gpointer this;
+
+	gtk_tree_model_get (model, iter,
+			    FUNCTION, &this,
+			    -1);
+	if (this == data) {
+		gtk_list_store_set (GTK_LIST_STORE (model), iter,
+				    FUNCTION_RECENT, TRUE,
+				    -1);
+		return TRUE;
+	}
+	return FALSE;
+}
+
 static void
 dialog_function_load_recent_funcs (FunctionSelectState *state)
 {
@@ -218,8 +240,12 @@ dialog_function_load_recent_funcs (FunctionSelectState *state)
 			continue;
 
 		fd = gnm_func_lookup (name, NULL);
-		if (fd)
+		if (fd) {
 			state->recent_funcs = g_slist_prepend (state->recent_funcs, fd);
+			gtk_tree_model_foreach (GTK_TREE_MODEL (state->model_functions),
+						cb_dialog_function_load_recent_funcs,
+						fd);
+		}
 	}
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]