From 2bbd4c58853b63410e3a8443942c4e139ca01270 Mon Sep 17 00:00:00 2001 From: hiro Date: Mon, 24 Jan 2005 04:42:56 +0000 Subject: replaced fnmatch() with g_pattern_match_*(). git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@32 ee746299-78ed-0310-b773-934348b2243d --- src/grouplistdialog.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/grouplistdialog.c') diff --git a/src/grouplistdialog.c b/src/grouplistdialog.c index 7088ede6..ee66c5b6 100644 --- a/src/grouplistdialog.c +++ b/src/grouplistdialog.c @@ -40,7 +40,6 @@ #include #include #include -#include #include "intl.h" #include "grouplistdialog.h" @@ -317,7 +316,7 @@ static GtkCTreeNode *grouplist_create_parent(const gchar *name, node = gtk_ctree_insert_node(GTK_CTREE(ctree), parent, node, cols, 0, NULL, NULL, NULL, NULL, FALSE, FALSE); - if (parent && fnmatch(pattern, parent_name, 0) != 0) + if (parent && g_pattern_match_simple(pattern, parent_name) == FALSE) gtk_ctree_expand(GTK_CTREE(ctree), parent); gtk_ctree_node_set_selectable(GTK_CTREE(ctree), node, FALSE); @@ -369,7 +368,8 @@ static GtkCTreeNode *grouplist_create_branch(NewsGroupInfo *ginfo, node = gtk_ctree_insert_node(GTK_CTREE(ctree), parent, node, cols, 0, NULL, NULL, NULL, NULL, TRUE, FALSE); - if (parent && fnmatch(pattern, parent_name, 0) != 0) + if (parent && + g_pattern_match_simple(pattern, parent_name) == FALSE) gtk_ctree_expand(GTK_CTREE(ctree), parent); } gtk_ctree_node_set_selectable(GTK_CTREE(ctree), node, TRUE); @@ -385,6 +385,7 @@ static void grouplist_dialog_set_list(const gchar *pattern, gboolean refresh) { GSList *cur; GtkCTreeNode *node; + GPatternSpec *pspec; if (locked) return; locked = TRUE; @@ -422,10 +423,12 @@ static void grouplist_dialog_set_list(const gchar *pattern, gboolean refresh) g_signal_handlers_block_by_func(G_OBJECT(ctree), G_CALLBACK(ctree_selected), NULL); + pspec = g_pattern_spec_new(pattern); + for (cur = group_list; cur != NULL ; cur = cur->next) { NewsGroupInfo *ginfo = (NewsGroupInfo *)cur->data; - if (fnmatch(pattern, ginfo->name, 0) == 0) { + if (g_pattern_match_string(pspec, ginfo->name)) { node = grouplist_create_branch(ginfo, pattern); if (g_slist_find_custom(subscribed, ginfo->name, (GCompareFunc)g_strcasecmp) @@ -434,6 +437,8 @@ static void grouplist_dialog_set_list(const gchar *pattern, gboolean refresh) } } + g_pattern_spec_free(pspec); + g_signal_handlers_unblock_by_func(G_OBJECT(ctree), G_CALLBACK(ctree_selected), NULL); -- cgit v1.2.3