diff --git a/sflphone-gtk/src/historyfilter.c b/sflphone-gtk/src/historyfilter.c new file mode 100644 index 0000000000000000000000000000000000000000..4a5def46858e8774c936ae0e1e59426a96873ff6 --- /dev/null +++ b/sflphone-gtk/src/historyfilter.c @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2007 Savoir-Faire Linux inc. + * Author: Antoine Reversat <antoine.reversat@savoirfairelinux.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gtk/gtk.h> +#include <historyfilter.h> + +GtkTreeModel* +create_filter(GtkTreeModel* child) +{ + GtkTreeModel* ret = gtk_tree_model_filter_new(child, NULL); + gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(ret), is_visible, NULL, NULL); + return GTK_TREE_MODEL(ret); +} + +gboolean +is_visible(GtkTreeModel* model, GtkTreeIter* iter, gpointer data) +{ + GValue val = {0, }; + gchar* text; + gtk_tree_model_get_value(GTK_TREE_MODEL(model), iter, 1, &val); + if(G_VALUE_HOLDS_STRING(&val)){ + text = (gchar *)g_value_get_string(&val); + } + if(text != NULL){ + if(g_regex_match_simple("122", text, 0, 0)){ + printf("match\n"); + return FALSE; + }else{ + return TRUE; + } + } +} diff --git a/sflphone-gtk/src/historyfilter.h b/sflphone-gtk/src/historyfilter.h new file mode 100644 index 0000000000000000000000000000000000000000..beb1e1c5553877d25a6f1e5fc61caa0d0635b017 --- /dev/null +++ b/sflphone-gtk/src/historyfilter.h @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2007 Savoir-Faire Linux inc. + * Author: Antoine Reversat <antoine.reversat@savoirfairelinux.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __HFILTER_H__ +#define __HFILTER_H__ + +#include <calllist.h> +#include <gtk/gtk.h> + + + +GtkTreeModel* create_filter(GtkTreeModel* child); + +gboolean is_visible(GtkTreeModel* model, GtkTreeIter* iter, gpointer data); +#endif