This commit was manufactured by cvs2svn to create branch 'gtk2'.
authorClaws Mail Team <theteam@claws-mail.org>
Thu, 6 May 2004 14:41:59 +0000 (14:41 +0000)
committerClaws Mail Team <theteam@claws-mail.org>
Thu, 6 May 2004 14:41:59 +0000 (14:41 +0000)
Cherrypick from master 2004-05-06 14:41:58 UTC reboot '0.9.10claws55':
    src/gtk/foldersort.c
    src/gtk/foldersort.glade
    src/gtk/foldersort.h
    src/news_gtk.c

src/gtk/foldersort.c [new file with mode: 0644]
src/gtk/foldersort.glade [new file with mode: 0644]
src/gtk/foldersort.h [new file with mode: 0644]
src/news_gtk.c [new file with mode: 0644]

diff --git a/src/gtk/foldersort.c b/src/gtk/foldersort.c
new file mode 100644 (file)
index 0000000..aaca22f
--- /dev/null
@@ -0,0 +1,267 @@
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2004 Hiroyuki Yamamoto and the Sylpheed-Claws Team
+ *
+ * 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "intl.h"
+#include "foldersort.h"
+#include "inc.h"
+#include "utils.h"
+
+typedef struct _FolderSortDialog FolderSortDialog;
+
+struct _FolderSortDialog
+{
+       GtkWidget *window;
+       GtkWidget *moveup_btn;
+       GtkWidget *movedown_btn;
+       GtkWidget *folderlist;
+
+       gint rows, selected;
+};
+
+static void destroy_dialog(FolderSortDialog *dialog)
+{
+       inc_unlock();
+       gtk_widget_destroy(dialog->window);
+
+       g_free(dialog);
+}
+
+static void ok_clicked(GtkWidget *widget, FolderSortDialog *dialog)
+{
+       Folder *folder;
+       int i;
+
+       for (i = 0; i < dialog->rows; i++) {
+               folder = gtk_clist_get_row_data(GTK_CLIST(dialog->folderlist), i);
+
+               folder_set_sort(folder, dialog->rows - i);
+       }
+
+       destroy_dialog(dialog);
+}
+
+static void cancel_clicked(GtkWidget *widget, FolderSortDialog *dialog)
+{
+       destroy_dialog(dialog);
+}
+
+static void set_selected(FolderSortDialog *dialog, gint row)
+{
+       if (row >= 0) {
+               gtk_widget_set_sensitive(dialog->moveup_btn, row > 0);
+               gtk_widget_set_sensitive(dialog->movedown_btn, row < (dialog->rows - 1));
+       } else {
+               gtk_widget_set_sensitive(dialog->moveup_btn, FALSE);
+               gtk_widget_set_sensitive(dialog->movedown_btn, FALSE);
+       }
+
+       dialog->selected = row;
+}
+
+static void moveup_clicked(GtkWidget *widget, FolderSortDialog *dialog)
+{
+       g_return_if_fail(dialog->selected > 0);
+
+       gtk_clist_swap_rows(GTK_CLIST(dialog->folderlist), dialog->selected, dialog->selected - 1);
+}
+
+static void movedown_clicked(GtkWidget *widget, FolderSortDialog *dialog)
+{
+       g_return_if_fail(dialog->selected < (dialog->rows - 1));
+
+       gtk_clist_swap_rows(GTK_CLIST(dialog->folderlist), dialog->selected, dialog->selected + 1);
+}
+
+static void row_selected(GtkCList *clist, gint row, gint column, GdkEventButton *event, FolderSortDialog *dialog)
+{
+       set_selected(dialog, row);
+}
+
+static void row_unselected(GtkCList *clist, gint row, gint column, GdkEventButton *event, FolderSortDialog *dialog)
+{
+       set_selected(dialog, -1);
+}
+
+static void row_moved(GtkCList *clist, gint srcpos, gint destpos, FolderSortDialog *dialog)
+{
+       if (dialog->selected == -1)
+               return;
+       else if (srcpos == dialog->selected)
+               set_selected(dialog, destpos);
+       else if (srcpos < dialog->selected && destpos >= dialog->selected)
+               set_selected(dialog, dialog->selected - 1);
+       else if (srcpos > dialog->selected && destpos <= dialog->selected)
+               set_selected(dialog, dialog->selected + 1);
+}
+
+void foldersort_open()
+{
+       FolderSortDialog *dialog = g_new0(FolderSortDialog, 1);
+       GList *flist;
+
+       /* BEGIN GLADE CODE */
+
+       GtkWidget *window;
+       GtkWidget *table1;
+       GtkWidget *label1;
+       GtkWidget *hbuttonbox1;
+       GtkWidget *ok_btn;
+       GtkWidget *cancel_btn;
+       GtkWidget *vbox1;
+       GtkWidget *moveup_btn;
+       GtkWidget *arrow1;
+       GtkWidget *movedown_btn;
+       GtkWidget *arrow2;
+       GtkWidget *scrolledwindow1;
+       GtkWidget *folderlist;
+       GtkWidget *label2;
+
+       window = gtk_window_new(GTK_WINDOW_DIALOG);
+       gtk_object_set_data(GTK_OBJECT(window), "window", window);
+       gtk_container_set_border_width(GTK_CONTAINER(window), 4);
+       gtk_window_set_title(GTK_WINDOW(window),
+                            _("Set folder sortorder"));
+       gtk_window_set_modal(GTK_WINDOW(window), TRUE);
+       gtk_window_set_default_size(GTK_WINDOW(window), 400, 300);
+
+       table1 = gtk_table_new(3, 2, FALSE);
+       gtk_widget_show(table1);
+       gtk_container_add(GTK_CONTAINER(window), table1);
+       gtk_table_set_row_spacings(GTK_TABLE(table1), 4);
+       gtk_table_set_col_spacings(GTK_TABLE(table1), 4);
+
+       label1 =
+           gtk_label_new(_
+                         ("Move folders up or down to change\nthe sort order in the folderview"));
+       gtk_widget_show(label1);
+       gtk_table_attach(GTK_TABLE(table1), label1, 0, 1, 0, 1,
+                        (GtkAttachOptions) (GTK_FILL),
+                        (GtkAttachOptions) (0), 0, 0);
+       gtk_label_set_justify(GTK_LABEL(label1), GTK_JUSTIFY_LEFT);
+       gtk_misc_set_alignment(GTK_MISC(label1), 0, 0.5);
+
+       hbuttonbox1 = gtk_hbutton_box_new();
+       gtk_widget_show(hbuttonbox1);
+       gtk_table_attach(GTK_TABLE(table1), hbuttonbox1, 0, 1, 2, 3,
+                        (GtkAttachOptions) (GTK_FILL),
+                        (GtkAttachOptions) (0), 0, 0);
+       gtk_button_box_set_layout(GTK_BUTTON_BOX(hbuttonbox1),
+                                 GTK_BUTTONBOX_END);
+       gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbuttonbox1), 0);
+       gtk_button_box_set_child_size(GTK_BUTTON_BOX(hbuttonbox1), 0, 0);
+       gtk_button_box_set_child_ipadding(GTK_BUTTON_BOX(hbuttonbox1), 0,
+                                         0);
+
+       ok_btn = gtk_button_new_with_label(_("Ok"));
+       gtk_widget_show(ok_btn);
+       gtk_container_add(GTK_CONTAINER(hbuttonbox1), ok_btn);
+       GTK_WIDGET_SET_FLAGS(ok_btn, GTK_CAN_DEFAULT);
+
+       cancel_btn = gtk_button_new_with_label(_("Cancel"));
+       gtk_widget_show(cancel_btn);
+       gtk_container_add(GTK_CONTAINER(hbuttonbox1), cancel_btn);
+       GTK_WIDGET_SET_FLAGS(cancel_btn, GTK_CAN_DEFAULT);
+
+       vbox1 = gtk_vbox_new(FALSE, 0);
+       gtk_widget_show(vbox1);
+       gtk_table_attach(GTK_TABLE(table1), vbox1, 1, 2, 1, 2,
+                        (GtkAttachOptions) (GTK_FILL),
+                        (GtkAttachOptions) (GTK_FILL), 0, 0);
+
+       moveup_btn = gtk_button_new();
+       gtk_widget_show(moveup_btn);
+       gtk_box_pack_start(GTK_BOX(vbox1), moveup_btn, FALSE, FALSE, 0);
+
+       arrow1 = gtk_arrow_new(GTK_ARROW_UP, GTK_SHADOW_OUT);
+       gtk_widget_show(arrow1);
+       gtk_container_add(GTK_CONTAINER(moveup_btn), arrow1);
+
+       movedown_btn = gtk_button_new();
+       gtk_widget_show(movedown_btn);
+       gtk_box_pack_start(GTK_BOX(vbox1), movedown_btn, FALSE, FALSE, 0);
+
+       arrow2 = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_OUT);
+       gtk_widget_show(arrow2);
+       gtk_container_add(GTK_CONTAINER(movedown_btn), arrow2);
+
+       scrolledwindow1 = gtk_scrolled_window_new(NULL, NULL);
+       gtk_widget_show(scrolledwindow1);
+       gtk_table_attach(GTK_TABLE(table1), scrolledwindow1, 0, 1, 1, 2,
+                        (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+                        (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
+       gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW
+                                      (scrolledwindow1),
+                                      GTK_POLICY_AUTOMATIC,
+                                      GTK_POLICY_ALWAYS);
+
+       folderlist = gtk_clist_new(1);
+       gtk_widget_show(folderlist);
+       gtk_container_add(GTK_CONTAINER(scrolledwindow1), folderlist);
+       gtk_clist_set_column_width(GTK_CLIST(folderlist), 0, 80);
+       gtk_clist_column_titles_show(GTK_CLIST(folderlist));
+
+       label2 = gtk_label_new(_("Folders"));
+       gtk_widget_show(label2);
+       gtk_clist_set_column_widget(GTK_CLIST(folderlist), 0, label2);
+       gtk_label_set_justify(GTK_LABEL(label2), GTK_JUSTIFY_LEFT);
+       gtk_misc_set_alignment(GTK_MISC(label2), 0, 0.5);
+
+       /* END GLADE CODE */
+
+       dialog->window = window;
+       dialog->moveup_btn = moveup_btn;
+       dialog->movedown_btn = movedown_btn;
+       dialog->folderlist = folderlist;
+
+       gtk_widget_show(window);
+       gtk_widget_set_sensitive(moveup_btn, FALSE);
+       gtk_widget_set_sensitive(movedown_btn, FALSE);
+       gtk_clist_set_reorderable(GTK_CLIST(folderlist), TRUE);
+
+       gtk_signal_connect(GTK_OBJECT(ok_btn), "clicked",
+                           GTK_SIGNAL_FUNC(ok_clicked), dialog);
+       gtk_signal_connect(GTK_OBJECT(cancel_btn), "clicked",
+                           GTK_SIGNAL_FUNC(cancel_clicked), dialog);
+       gtk_signal_connect(GTK_OBJECT(moveup_btn), "clicked",
+                           GTK_SIGNAL_FUNC(moveup_clicked), dialog);
+       gtk_signal_connect(GTK_OBJECT(movedown_btn), "clicked",
+                           GTK_SIGNAL_FUNC(movedown_clicked), dialog);
+
+       gtk_signal_connect(GTK_OBJECT(folderlist), "select-row",
+                          GTK_SIGNAL_FUNC(row_selected), dialog);
+       gtk_signal_connect(GTK_OBJECT(folderlist), "unselect-row",
+                          GTK_SIGNAL_FUNC(row_unselected), dialog);
+       gtk_signal_connect(GTK_OBJECT(folderlist), "row-move",
+                          GTK_SIGNAL_FUNC(row_moved), dialog);
+
+       dialog->rows = 0;
+       dialog->selected = -1;
+       for (flist = folder_get_list(); flist != NULL; flist = g_list_next(flist)) {
+               Folder *folder = flist->data;
+               int row;
+               gchar *text[1];
+
+               text[0] = folder->name;
+               row = gtk_clist_append(GTK_CLIST(folderlist), text);
+               gtk_clist_set_row_data(GTK_CLIST(folderlist), row, folder);
+               dialog->rows++;
+       }
+
+       inc_lock();
+}
diff --git a/src/gtk/foldersort.glade b/src/gtk/foldersort.glade
new file mode 100644 (file)
index 0000000..849c07e
--- /dev/null
@@ -0,0 +1,227 @@
+<?xml version="1.0"?>
+<GTK-Interface>
+
+<project>
+  <name>Sylpheed-Claws</name>
+  <program_name>sylpheed-claws</program_name>
+  <directory></directory>
+  <source_directory>src</source_directory>
+  <pixmaps_directory>pixmaps</pixmaps_directory>
+  <language>C</language>
+  <gnome_support>False</gnome_support>
+  <gettext_support>True</gettext_support>
+  <output_main_file>False</output_main_file>
+  <output_support_files>False</output_support_files>
+  <output_build_files>False</output_build_files>
+</project>
+
+<widget>
+  <class>GtkWindow</class>
+  <name>window</name>
+  <border_width>4</border_width>
+  <title>Set folder sortorder</title>
+  <type>GTK_WINDOW_DIALOG</type>
+  <position>GTK_WIN_POS_NONE</position>
+  <modal>True</modal>
+  <default_width>400</default_width>
+  <default_height>300</default_height>
+  <allow_shrink>False</allow_shrink>
+  <allow_grow>True</allow_grow>
+  <auto_shrink>False</auto_shrink>
+
+  <widget>
+    <class>GtkTable</class>
+    <name>table1</name>
+    <rows>3</rows>
+    <columns>2</columns>
+    <homogeneous>False</homogeneous>
+    <row_spacing>4</row_spacing>
+    <column_spacing>4</column_spacing>
+
+    <widget>
+      <class>GtkLabel</class>
+      <name>label1</name>
+      <label>Move folders up or down to change
+the sort order in the folderview</label>
+      <justify>GTK_JUSTIFY_LEFT</justify>
+      <wrap>False</wrap>
+      <xalign>0</xalign>
+      <yalign>0.5</yalign>
+      <xpad>0</xpad>
+      <ypad>0</ypad>
+      <child>
+       <left_attach>0</left_attach>
+       <right_attach>1</right_attach>
+       <top_attach>0</top_attach>
+       <bottom_attach>1</bottom_attach>
+       <xpad>0</xpad>
+       <ypad>0</ypad>
+       <xexpand>False</xexpand>
+       <yexpand>False</yexpand>
+       <xshrink>False</xshrink>
+       <yshrink>False</yshrink>
+       <xfill>True</xfill>
+       <yfill>False</yfill>
+      </child>
+    </widget>
+
+    <widget>
+      <class>GtkHButtonBox</class>
+      <name>hbuttonbox1</name>
+      <layout_style>GTK_BUTTONBOX_END</layout_style>
+      <spacing>0</spacing>
+      <child_min_width>0</child_min_width>
+      <child_min_height>0</child_min_height>
+      <child_ipad_x>0</child_ipad_x>
+      <child_ipad_y>0</child_ipad_y>
+      <child>
+       <left_attach>0</left_attach>
+       <right_attach>1</right_attach>
+       <top_attach>2</top_attach>
+       <bottom_attach>3</bottom_attach>
+       <xpad>0</xpad>
+       <ypad>0</ypad>
+       <xexpand>False</xexpand>
+       <yexpand>False</yexpand>
+       <xshrink>False</xshrink>
+       <yshrink>False</yshrink>
+       <xfill>True</xfill>
+       <yfill>False</yfill>
+      </child>
+
+      <widget>
+       <class>GtkButton</class>
+       <name>ok_btn</name>
+       <can_default>True</can_default>
+       <can_focus>True</can_focus>
+       <label>Ok</label>
+       <relief>GTK_RELIEF_NORMAL</relief>
+      </widget>
+
+      <widget>
+       <class>GtkButton</class>
+       <name>cancel_btn</name>
+       <can_default>True</can_default>
+       <can_focus>True</can_focus>
+       <label>Cancel</label>
+       <relief>GTK_RELIEF_NORMAL</relief>
+      </widget>
+    </widget>
+
+    <widget>
+      <class>GtkVBox</class>
+      <name>vbox1</name>
+      <homogeneous>False</homogeneous>
+      <spacing>0</spacing>
+      <child>
+       <left_attach>1</left_attach>
+       <right_attach>2</right_attach>
+       <top_attach>1</top_attach>
+       <bottom_attach>2</bottom_attach>
+       <xpad>0</xpad>
+       <ypad>0</ypad>
+       <xexpand>False</xexpand>
+       <yexpand>False</yexpand>
+       <xshrink>False</xshrink>
+       <yshrink>False</yshrink>
+       <xfill>True</xfill>
+       <yfill>True</yfill>
+      </child>
+
+      <widget>
+       <class>GtkButton</class>
+       <name>moveup_btn</name>
+       <can_focus>True</can_focus>
+       <relief>GTK_RELIEF_NORMAL</relief>
+       <child>
+         <padding>0</padding>
+         <expand>False</expand>
+         <fill>False</fill>
+       </child>
+
+       <widget>
+         <class>GtkArrow</class>
+         <name>arrow1</name>
+         <arrow_type>GTK_ARROW_UP</arrow_type>
+         <shadow_type>GTK_SHADOW_OUT</shadow_type>
+         <xalign>0.5</xalign>
+         <yalign>0.5</yalign>
+         <xpad>0</xpad>
+         <ypad>0</ypad>
+       </widget>
+      </widget>
+
+      <widget>
+       <class>GtkButton</class>
+       <name>movedown_btn</name>
+       <can_focus>True</can_focus>
+       <relief>GTK_RELIEF_NORMAL</relief>
+       <child>
+         <padding>0</padding>
+         <expand>False</expand>
+         <fill>False</fill>
+       </child>
+
+       <widget>
+         <class>GtkArrow</class>
+         <name>arrow2</name>
+         <arrow_type>GTK_ARROW_DOWN</arrow_type>
+         <shadow_type>GTK_SHADOW_OUT</shadow_type>
+         <xalign>0.5</xalign>
+         <yalign>0.5</yalign>
+         <xpad>0</xpad>
+         <ypad>0</ypad>
+       </widget>
+      </widget>
+    </widget>
+
+    <widget>
+      <class>GtkScrolledWindow</class>
+      <name>scrolledwindow1</name>
+      <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
+      <vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
+      <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
+      <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
+      <child>
+       <left_attach>0</left_attach>
+       <right_attach>1</right_attach>
+       <top_attach>1</top_attach>
+       <bottom_attach>2</bottom_attach>
+       <xpad>0</xpad>
+       <ypad>0</ypad>
+       <xexpand>True</xexpand>
+       <yexpand>True</yexpand>
+       <xshrink>False</xshrink>
+       <yshrink>False</yshrink>
+       <xfill>True</xfill>
+       <yfill>True</yfill>
+      </child>
+
+      <widget>
+       <class>GtkCList</class>
+       <name>folderlist</name>
+       <can_focus>True</can_focus>
+       <columns>1</columns>
+       <column_widths>80</column_widths>
+       <selection_mode>GTK_SELECTION_SINGLE</selection_mode>
+       <show_titles>True</show_titles>
+       <shadow_type>GTK_SHADOW_IN</shadow_type>
+
+       <widget>
+         <class>GtkLabel</class>
+         <child_name>CList:title</child_name>
+         <name>label2</name>
+         <label>Folders</label>
+         <justify>GTK_JUSTIFY_LEFT</justify>
+         <wrap>False</wrap>
+         <xalign>0</xalign>
+         <yalign>0.5</yalign>
+         <xpad>0</xpad>
+         <ypad>0</ypad>
+       </widget>
+      </widget>
+    </widget>
+  </widget>
+</widget>
+
+</GTK-Interface>
diff --git a/src/gtk/foldersort.h b/src/gtk/foldersort.h
new file mode 100644 (file)
index 0000000..403cad0
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2004 Hiroyuki Yamamoto and the Sylpheed-Claws Team
+ *
+ * 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef FOLDERSORT_H
+#define FOLDERSORT_H 1
+
+void foldersort_open(void);
+
+#endif /* FOLDERSORT_H */
diff --git a/src/news_gtk.c b/src/news_gtk.c
new file mode 100644 (file)
index 0000000..b800bf4
--- /dev/null
@@ -0,0 +1,322 @@
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2004 Hiroyuki Yamamoto & the Sylpheed-Claws Team
+ *
+ * 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#include "defs.h"
+
+#include <glib.h>
+
+#include <gtk/gtk.h>
+
+#include "intl.h"
+#include "utils.h"
+#include "folder.h"
+#include "folderview.h"
+#include "menu.h"
+#include "account.h"
+#include "alertpanel.h"
+#include "grouplistdialog.h"
+#include "common/hooks.h"
+#include "inc.h"
+
+static void subscribe_newsgroup_cb(FolderView *folderview, guint action, GtkWidget *widget);
+static void unsubscribe_newsgroup_cb(FolderView *folderview, guint action, GtkWidget *widget);
+static void remove_news_server_cb(FolderView *folderview, guint action, GtkWidget *widget);
+static void update_tree_cb(FolderView *folderview, guint action, GtkWidget *widget);
+static void download_cb(FolderView *folderview, guint action, GtkWidget *widget);
+
+static GtkItemFactoryEntry news_popup_entries[] =
+{
+       {N_("/_Subscribe to newsgroup..."),     NULL, subscribe_newsgroup_cb,    0, NULL},
+       {N_("/_Unsubscribe newsgroup"),         NULL, unsubscribe_newsgroup_cb,  0, NULL},
+       {N_("/---"),                            NULL, NULL,                      0, "<Separator>"},
+       {N_("/Down_load"),                      NULL, download_cb,               0, NULL},
+       {N_("/---"),                            NULL, NULL,                      0, "<Separator>"},
+       {N_("/_Check for new messages"),        NULL, update_tree_cb,            0, NULL},
+       {N_("/---"),                            NULL, NULL,                      0, "<Separator>"},
+       {N_("/Remove _news account"),           NULL, remove_news_server_cb,     0, NULL},
+       {N_("/---"),                            NULL, NULL,                      0, "<Separator>"},
+};
+
+static void set_sensitivity(GtkItemFactory *factory, FolderItem *item);
+
+static FolderViewPopup news_popup =
+{
+       "news",
+       "<NewsFolder>",
+       NULL,
+       set_sensitivity
+};
+
+void news_gtk_init(void)
+{
+       guint i, n_entries;
+
+       n_entries = sizeof(news_popup_entries) /
+               sizeof(news_popup_entries[0]);
+       for (i = 0; i < n_entries; i++)
+               news_popup.entries = g_slist_append(news_popup.entries, &news_popup_entries[i]);
+
+       folderview_register_popup(&news_popup);
+}
+
+static void set_sensitivity(GtkItemFactory *factory, FolderItem *item)
+{
+#define SET_SENS(name, sens) \
+       menu_set_sensitive(factory, name, sens)
+
+       SET_SENS("/Subscribe to newsgroup...", folder_item_parent(item) == NULL);
+       SET_SENS("/Unsubscribe newsgroup",     folder_item_parent(item) != NULL);
+       SET_SENS("/Remove news account",       folder_item_parent(item) == NULL);
+
+       SET_SENS("/Check for new messages",    folder_item_parent(item) == NULL);
+
+#undef SET_SENS
+}
+
+static void subscribe_newsgroup_cb(FolderView *folderview, guint action, GtkWidget *widget)
+{
+       GtkCTree *ctree = GTK_CTREE(folderview->ctree);
+       GtkCTreeNode *servernode, *node;
+       Folder *folder;
+       FolderItem *item;
+       FolderItem *rootitem;
+       FolderItem *newitem;
+       GSList *new_subscr;
+       GSList *cur;
+       GNode *gnode;
+
+       if (!folderview->selected) return;
+
+       item = gtk_ctree_node_get_row_data(ctree, folderview->selected);
+       g_return_if_fail(item != NULL);
+       folder = item->folder;
+       g_return_if_fail(folder != NULL);
+       g_return_if_fail(FOLDER_TYPE(folder) == F_NEWS);
+       g_return_if_fail(folder->account != NULL);
+
+       if (GTK_CTREE_ROW(folderview->selected)->parent != NULL)
+               servernode = GTK_CTREE_ROW(folderview->selected)->parent;
+       else
+               servernode = folderview->selected;
+
+       rootitem = gtk_ctree_node_get_row_data(ctree, servernode);
+
+       new_subscr = grouplist_dialog(folder);
+
+       /* remove unsubscribed newsgroups */
+       for (gnode = folder->node->children; gnode != NULL; ) {
+               GNode *next = gnode->next;
+
+               item = FOLDER_ITEM(gnode->data);
+               if (g_slist_find_custom(new_subscr, item->path,
+                                       (GCompareFunc)g_strcasecmp) != NULL) {
+                       gnode = next;
+                       continue;
+               }
+
+               node = gtk_ctree_find_by_row_data(ctree, servernode, item);
+               if (!node) {
+                       gnode = next;
+                       continue;
+               }
+
+               if (folderview->opened == node) {
+                       summary_clear_all(folderview->summaryview);
+                       folderview->opened = NULL;
+               }
+
+               gtk_ctree_remove_node(ctree, node);
+               folder_item_remove(item);
+
+               gnode = next;
+       }
+
+       gtk_clist_freeze(GTK_CLIST(ctree));
+
+       /* add subscribed newsgroups */
+       for (cur = new_subscr; cur != NULL; cur = cur->next) {
+               gchar *name = (gchar *)cur->data;
+               FolderUpdateData hookdata;
+
+               if (folder_find_child_item_by_name(rootitem, name) != NULL)
+                       continue;
+
+               newitem = folder_item_new(folder, name, name);
+               folder_item_append(rootitem, newitem);
+
+               hookdata.folder = newitem->folder;
+               hookdata.update_flags = FOLDER_TREE_CHANGED | FOLDER_ADD_FOLDERITEM;
+               hookdata.item = newitem;
+               hooks_invoke(FOLDER_UPDATE_HOOKLIST, &hookdata);
+       }
+
+       gtk_clist_thaw(GTK_CLIST(ctree));
+
+       slist_free_strings(new_subscr);
+       g_slist_free(new_subscr);
+
+       folder_write_list();
+}
+
+static void unsubscribe_newsgroup_cb(FolderView *folderview, guint action,
+                                    GtkWidget *widget)
+{
+       GtkCTree *ctree = GTK_CTREE(folderview->ctree);
+       FolderItem *item;
+       gchar *name;
+       gchar *message;
+       gchar *old_id;
+       AlertValue avalue;
+
+       if (!folderview->selected) return;
+
+       item = gtk_ctree_node_get_row_data(ctree, folderview->selected);
+       g_return_if_fail(item != NULL);
+       g_return_if_fail(item->folder != NULL);
+       g_return_if_fail(FOLDER_TYPE(item->folder) == F_NEWS);
+       g_return_if_fail(item->folder->account != NULL);
+
+       old_id = folder_item_get_identifier(item);
+
+       name = trim_string(item->path, 32);
+       message = g_strdup_printf(_("Really unsubscribe newsgroup `%s'?"), name);
+       avalue = alertpanel(_("Unsubscribe newsgroup"), message,
+                           _("Yes"), _("+No"), NULL);
+       g_free(message);
+       g_free(name);
+       if (avalue != G_ALERTDEFAULT) return;
+
+       if (folderview->opened == folderview->selected) {
+               summary_clear_all(folderview->summaryview);
+               folderview->opened = NULL;
+       }
+
+       folder_item_remove(item);
+       folder_write_list();
+       
+       prefs_filtering_delete_path(old_id);
+       g_free(old_id);
+}
+
+static void remove_news_server_cb(FolderView *folderview, guint action,
+                                 GtkWidget *widget)
+{
+       GtkCTree *ctree = GTK_CTREE(folderview->ctree);
+       FolderItem *item;
+       PrefsAccount *account;
+       gchar *name;
+       gchar *message;
+       AlertValue avalue;
+
+       if (!folderview->selected) return;
+
+       item = gtk_ctree_node_get_row_data(ctree, folderview->selected);
+       g_return_if_fail(item != NULL);
+       g_return_if_fail(item->folder != NULL);
+       g_return_if_fail(FOLDER_TYPE(item->folder) == F_NEWS);
+       g_return_if_fail(item->folder->account != NULL);
+
+       name = trim_string(item->folder->name, 32);
+       message = g_strdup_printf(_("Really delete news account `%s'?"), name);
+       avalue = alertpanel(_("Delete news account"), message,
+                           _("Yes"), _("+No"), NULL);
+       g_free(message);
+       g_free(name);
+
+       if (avalue != G_ALERTDEFAULT) return;
+
+       if (folderview->opened == folderview->selected ||
+           gtk_ctree_is_ancestor(ctree,
+                                 folderview->selected,
+                                 folderview->opened)) {
+               summary_clear_all(folderview->summaryview);
+               folderview->opened = NULL;
+       }
+
+       account = item->folder->account;
+       folderview_unselect(folderview);
+       summary_clear_all(folderview->summaryview);
+       folder_destroy(item->folder);
+       account_destroy(account);
+       account_set_menu();
+       main_window_reflect_prefs_all();
+       folder_write_list();
+}
+
+static void update_tree_cb(FolderView *folderview, guint action,
+                          GtkWidget *widget)
+{
+       FolderItem *item;
+
+       item = folderview_get_selected(folderview);
+       g_return_if_fail(item != NULL);
+
+       summary_show(folderview->summaryview, NULL);
+
+       g_return_if_fail(item->folder != NULL);
+
+       folderview_check_new(item->folder);
+}
+
+static void download_cb(FolderView *folderview, guint action,
+                       GtkWidget *widget)
+{
+       GtkCTree *ctree = GTK_CTREE(folderview->ctree);
+       MainWindow *mainwin = folderview->mainwin;
+       FolderItem *item;
+
+       if (!folderview->selected) return;
+
+       item = gtk_ctree_node_get_row_data(ctree, folderview->selected);
+       g_return_if_fail(item != NULL);
+       g_return_if_fail(item->folder != NULL);
+#if 0
+       if (!prefs_common.online_mode) {
+               if (alertpanel(_("Offline"),
+                              _("You are offline. Go online?"),
+                              _("Yes"), _("No"), NULL) == G_ALERTDEFAULT)
+                       main_window_toggle_online(folderview->mainwin, TRUE);
+               else
+                       return;
+       }
+#endif
+       main_window_cursor_wait(mainwin);
+       inc_lock();
+       main_window_lock(mainwin);
+       gtk_widget_set_sensitive(folderview->ctree, FALSE);
+       main_window_progress_on(mainwin);
+       GTK_EVENTS_FLUSH();
+       if (folder_item_fetch_all_msg(item) < 0) {
+               gchar *name;
+
+               name = trim_string(item->name, 32);
+               alertpanel_error(_("Error occurred while downloading messages in `%s'."), name);
+               g_free(name);
+       }
+       folder_set_ui_func(item->folder, NULL, NULL);
+       main_window_progress_off(mainwin);
+       gtk_widget_set_sensitive(folderview->ctree, TRUE);
+       main_window_unlock(mainwin);
+       inc_unlock();
+       main_window_cursor_normal(mainwin);
+}