/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2003 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2005 Hiroyuki Yamamoto
*
* 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
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include "defs.h"
#include <glib.h>
+#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtkmain.h>
#include <gtk/gtkwidget.h>
#include <gtk/gtkscrolledwindow.h>
#include <gtk/gtkbutton.h>
#include <gtk/gtkhbbox.h>
+#include <gtk/gtksctree.h>
+#include <gtk/gtkstock.h>
#include <string.h>
-#include <fnmatch.h>
-#include "intl.h"
#include "grouplistdialog.h"
#include "manage_window.h"
#include "gtkutils.h"
gint i;
dialog = gtk_dialog_new();
- gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, TRUE, FALSE);
+ gtk_window_set_resizable(GTK_WINDOW(dialog), TRUE);
gtk_widget_set_size_request(dialog,
- GROUPLIST_DIALOG_WIDTH, GROUPLIST_DIALOG_HEIGHT);
+ GROUPLIST_DIALOG_WIDTH,
+ GROUPLIST_DIALOG_HEIGHT);
gtk_container_set_border_width
(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), 5);
gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER);
scrolledwin = gtk_scrolled_window_new(NULL, NULL);
gtk_box_pack_start(GTK_BOX (vbox), scrolledwin, TRUE, TRUE, 0);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrolledwin),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
+ GTK_POLICY_ALWAYS,
+ GTK_POLICY_ALWAYS);
titles[0] = _("Newsgroup name");
titles[1] = _("Messages");
gtk_container_add(GTK_CONTAINER(scrolledwin), ctree);
gtk_clist_set_column_width
(GTK_CLIST(ctree), 0, GROUPLIST_COL_NAME_WIDTH);
+ gtk_clist_set_column_auto_resize(GTK_CLIST(ctree), 0, TRUE);
gtk_clist_set_selection_mode(GTK_CLIST(ctree), GTK_SELECTION_MULTIPLE);
gtk_ctree_set_line_style(GTK_CTREE(ctree), GTK_CTREE_LINES_DOTTED);
gtk_ctree_set_expander_style(GTK_CTREE(ctree),
status_label = gtk_label_new("");
gtk_box_pack_start(GTK_BOX(hbox), status_label, FALSE, FALSE, 0);
- gtkut_button_set_create(&confirm_area,
- &ok_button, _("OK"),
- &cancel_button, _("Cancel"),
- &refresh_button, _("Refresh"));
+ gtkut_stock_button_set_create(&confirm_area,
+ &ok_button, GTK_STOCK_OK,
+ &cancel_button, GTK_STOCK_CANCEL,
+ &refresh_button, GTK_STOCK_REFRESH);
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area),
confirm_area);
gtk_widget_grab_default(ok_button);
node = parent ? GTK_CTREE_ROW(parent)->children
: GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
- node = gtk_ctree_insert_node(GTK_CTREE(ctree), parent, node,
+ node = gtk_sctree_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);
parent = grouplist_create_parent(parent_name, pattern);
node = grouplist_hash_get_branch_node(name);
if (node) {
- gtk_ctree_set_node_info(GTK_CTREE(ctree), node, cols[0], 0,
+ gtk_sctree_set_node_info(GTK_CTREE(ctree), node, cols[0], 0,
NULL, NULL, NULL, NULL, FALSE, FALSE);
gtk_ctree_node_set_text(GTK_CTREE(ctree), node, 1, cols[1]);
gtk_ctree_node_set_text(GTK_CTREE(ctree), node, 2, cols[2]);
} else {
node = parent ? GTK_CTREE_ROW(parent)->children
: GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
- node = gtk_ctree_insert_node(GTK_CTREE(ctree), parent, node,
+ node = gtk_sctree_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);
{
GSList *cur;
GtkCTreeNode *node;
+ GPatternSpec *pspec;
if (locked) return;
locked = TRUE;
gtk_clist_freeze(GTK_CLIST(ctree));
+ 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)
- != NULL) {
+ (GCompareFunc)g_ascii_strcasecmp)
+ != NULL)
gtk_ctree_select(GTK_CTREE(ctree), node);
- }
}
}
for (cur = subscribed; cur; cur = g_slist_next(cur))
grouplist_expand_upwards(GTK_CTREE(ctree), (gchar *)cur->data);
+ g_pattern_spec_free(pspec);
+
gtk_clist_thaw(GTK_CLIST(ctree));
grouplist_hash_done();
if (!ginfo) return TRUE;
list = g_slist_find_custom(subscribed, ginfo->name,
- (GCompareFunc)g_strcasecmp);
+ (GCompareFunc)g_ascii_strcasecmp);
if (list) {
g_free(list->data);
subscribed = g_slist_remove(subscribed, list->data);