2002-02-22 10:35:36 +01:00
|
|
|
/*
|
|
|
|
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
|
|
|
|
* Copyright (C) 1999-2002 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
|
|
|
|
* 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 <gtk/gtkoptionmenu.h>
|
|
|
|
#include <gdk/gdkkeysyms.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "intl.h"
|
|
|
|
#include "main.h"
|
2002-12-25 14:46:41 +01:00
|
|
|
#include "prefs_gtk.h"
|
2002-02-22 10:35:36 +01:00
|
|
|
#include "account.h"
|
|
|
|
#include "mainwindow.h"
|
|
|
|
#include "manage_window.h"
|
2002-06-10 23:55:17 +02:00
|
|
|
#include "menu.h"
|
2002-02-22 10:35:36 +01:00
|
|
|
#include "stock_pixmap.h"
|
|
|
|
#include "inc.h"
|
|
|
|
#include "utils.h"
|
|
|
|
#include "alertpanel.h"
|
|
|
|
#include "inc.h"
|
|
|
|
#include "filtering.h"
|
2002-07-18 10:02:09 +02:00
|
|
|
#include "matcher.h"
|
2002-02-22 10:35:36 +01:00
|
|
|
#include "procheader.h"
|
2002-07-18 10:02:09 +02:00
|
|
|
#include "selective_download.h"
|
|
|
|
|
2002-02-22 10:35:36 +01:00
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
static struct _SDView {
|
2002-02-22 10:35:36 +01:00
|
|
|
MainWindow *mainwin;
|
|
|
|
|
|
|
|
GtkWidget *window;
|
|
|
|
GtkWidget *clist;
|
2002-06-10 23:55:17 +02:00
|
|
|
GtkWidget *preview_btn;
|
|
|
|
GtkWidget *remove_btn;
|
|
|
|
GtkWidget *download_btn;
|
|
|
|
GtkWidget *ac_button;
|
|
|
|
GtkWidget *ac_label;
|
|
|
|
GtkWidget *ac_menu;
|
|
|
|
GtkWidget *preview_popup;
|
|
|
|
GtkWidget *msgs_label;
|
|
|
|
GtkWidget *show_old_chkbtn;
|
2002-02-22 10:35:36 +01:00
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
}selective;
|
2002-02-22 10:35:36 +01:00
|
|
|
|
2002-07-18 10:02:09 +02:00
|
|
|
/* clist pixmaps */
|
2002-02-22 10:35:36 +01:00
|
|
|
static GdkPixmap *checkboxonxpm;
|
2002-06-10 23:55:17 +02:00
|
|
|
static GdkBitmap *checkboxonxpmmask;
|
2002-02-22 10:35:36 +01:00
|
|
|
static GdkPixmap *checkboxoffxpm;
|
2002-06-10 23:55:17 +02:00
|
|
|
static GdkBitmap *checkboxoffxpmmask;
|
|
|
|
static GdkPixmap *markxpm;
|
|
|
|
static GdkBitmap *markxpmmask;
|
|
|
|
static GdkPixmap *deletedxpm;
|
|
|
|
static GdkBitmap *deletedxpmmask;
|
2002-02-22 10:35:36 +01:00
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
/* local functions */
|
2002-07-19 10:45:10 +02:00
|
|
|
static void sd_clear_msglist (void);
|
|
|
|
static void sd_remove_header_files (void);
|
|
|
|
static void sd_toggle_btn (void);
|
|
|
|
static SD_State sd_header_filter (MsgInfo *msginfo);
|
|
|
|
static MsgInfo *sd_get_msginfo_from_file (const gchar *filename);
|
|
|
|
|
|
|
|
static void sd_clist_set_pixmap (HeaderItems *items,
|
|
|
|
gint row);
|
|
|
|
static void sd_clist_get_items (void);
|
|
|
|
static void sd_clist_set_items (void);
|
|
|
|
static void sd_update_msg_num (PrefsAccount *acc);
|
2002-06-10 23:55:17 +02:00
|
|
|
|
|
|
|
enum {
|
|
|
|
PREVIEW_NEW,
|
|
|
|
PREVIEW_ALL,
|
|
|
|
REMOVE,
|
|
|
|
DOWNLOAD,
|
|
|
|
DONE,
|
|
|
|
CHECKBTN,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* callbacks */
|
2002-07-19 10:45:10 +02:00
|
|
|
static void sd_action_cb (GtkWidget *widget,
|
|
|
|
guint action);
|
|
|
|
|
|
|
|
static void sd_select_row_cb (GtkCList *clist,
|
|
|
|
gint row,
|
|
|
|
gint column,
|
|
|
|
GdkEvent *event,
|
|
|
|
gpointer user_data);
|
|
|
|
static gint sd_key_pressed (GtkWidget *widget,
|
|
|
|
GdkEventKey *event,
|
|
|
|
gpointer data);
|
|
|
|
static gint sd_delete_event_cb (GtkWidget *widget,
|
|
|
|
GdkEvent *event,
|
|
|
|
gpointer data);
|
2002-06-10 23:55:17 +02:00
|
|
|
|
|
|
|
/* account menu */
|
2002-07-19 10:45:10 +02:00
|
|
|
static gint sd_ac_label_pressed (GtkWidget *widget,
|
|
|
|
GdkEventButton *event,
|
|
|
|
gpointer data);
|
2002-06-10 23:55:17 +02:00
|
|
|
|
2002-07-19 10:45:10 +02:00
|
|
|
static void sd_ac_menu_popup_closed (GtkMenuShell *menu_shell);
|
|
|
|
static void sd_ac_menu_cb (GtkMenuItem *menuitem,
|
|
|
|
gpointer data);
|
|
|
|
static void sd_ac_menu_set (void);
|
2002-06-10 23:55:17 +02:00
|
|
|
|
|
|
|
/* preview popup */
|
2002-07-19 10:45:10 +02:00
|
|
|
static void sd_preview_popup_closed (GtkMenuShell *menu_shell);
|
|
|
|
static gint sd_preview_popup_cb (GtkWidget *widget,
|
|
|
|
GdkEventButton *event,
|
|
|
|
gpointer data);
|
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
static GtkItemFactoryEntry preview_popup_entries[] =
|
|
|
|
{
|
2002-07-18 10:02:09 +02:00
|
|
|
{N_("/Preview _new messages"), NULL, sd_action_cb, PREVIEW_NEW, NULL},
|
|
|
|
{N_("/Preview _all messages"), NULL, sd_action_cb, PREVIEW_ALL, NULL}
|
2002-06-10 23:55:17 +02:00
|
|
|
};
|
2002-02-22 10:35:36 +01:00
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
/* create dialog */
|
2002-07-19 10:45:10 +02:00
|
|
|
static void sd_window_create (MainWindow *mainwin);
|
|
|
|
static void sd_create_toolbar (MainWindow *mainwin,
|
|
|
|
GtkWidget *container);
|
2002-07-18 10:02:09 +02:00
|
|
|
|
|
|
|
/* pixmaps */
|
2002-07-19 10:45:10 +02:00
|
|
|
void sd_init_pixmaps (MainWindow *mainwin);
|
2002-02-22 10:35:36 +01:00
|
|
|
|
|
|
|
void selective_download(MainWindow *mainwin)
|
|
|
|
{
|
|
|
|
sd_remove_header_files();
|
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
inc_lock();
|
2002-07-18 10:02:09 +02:00
|
|
|
|
|
|
|
if (!selective.window) {
|
|
|
|
sd_init_pixmaps(mainwin);
|
|
|
|
sd_window_create(mainwin);
|
|
|
|
}
|
2002-06-10 23:55:17 +02:00
|
|
|
|
|
|
|
manage_window_set_transient(GTK_WINDOW(selective.window));
|
|
|
|
gtk_widget_show(selective.window);
|
|
|
|
sd_clear_msglist();
|
|
|
|
sd_ac_menu_set();
|
|
|
|
gtk_clist_clear(GTK_CLIST(selective.clist));
|
2002-07-18 10:02:09 +02:00
|
|
|
}
|
2002-06-10 23:55:17 +02:00
|
|
|
|
2002-07-18 10:02:09 +02:00
|
|
|
void sd_init_pixmaps(MainWindow *mainwin)
|
|
|
|
{
|
|
|
|
GtkWidget *widget = mainwin->window;
|
|
|
|
|
|
|
|
g_return_if_fail(mainwin != NULL);
|
|
|
|
|
|
|
|
/* clist pixmaps */
|
|
|
|
stock_pixmap_gdk(widget, STOCK_PIXMAP_CHECKBOX_OFF,
|
|
|
|
&checkboxoffxpm, &checkboxoffxpmmask);
|
|
|
|
stock_pixmap_gdk(widget, STOCK_PIXMAP_CHECKBOX_ON,
|
|
|
|
&checkboxonxpm, &checkboxonxpmmask);
|
|
|
|
stock_pixmap_gdk(widget, STOCK_PIXMAP_DELETED,
|
|
|
|
&deletedxpm, &deletedxpmmask);
|
|
|
|
stock_pixmap_gdk(widget, STOCK_PIXMAP_MARK,
|
|
|
|
&markxpm, &markxpmmask);
|
|
|
|
}
|
2002-06-10 23:55:17 +02:00
|
|
|
|
2002-07-18 10:02:09 +02:00
|
|
|
void sd_reflect_prefs_pixmap_theme()
|
|
|
|
{
|
|
|
|
if (selective.window)
|
|
|
|
selective.window = NULL;
|
2002-02-22 10:35:36 +01:00
|
|
|
}
|
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
static void sd_clear_msglist()
|
|
|
|
{
|
|
|
|
PrefsAccount *acc = cur_account;
|
|
|
|
while (acc->msg_list != NULL) {
|
|
|
|
HeaderItems *item = (HeaderItems*)acc->msg_list->data;
|
2002-06-21 23:07:57 +02:00
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
acc->msg_list = g_slist_remove(acc->msg_list, item);
|
2002-06-21 23:07:57 +02:00
|
|
|
g_free(item->from);
|
|
|
|
g_free(item->subject);
|
2002-06-22 12:08:35 +02:00
|
|
|
g_free(item->date);
|
2002-06-21 23:07:57 +02:00
|
|
|
g_free(item);
|
2002-06-10 23:55:17 +02:00
|
|
|
}
|
|
|
|
g_slist_free(acc->msg_list);
|
|
|
|
sd_update_msg_num(acc);
|
|
|
|
}
|
2002-02-22 10:35:36 +01:00
|
|
|
|
|
|
|
/* sd_remove_header_files()
|
|
|
|
*
|
|
|
|
* - removes any stale header files in HEADER_CACHE_DIR
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static void sd_remove_header_files()
|
|
|
|
{
|
|
|
|
gchar *path = g_strconcat(get_header_cache_dir(), G_DIR_SEPARATOR_S, NULL);
|
|
|
|
|
|
|
|
remove_all_files(path);
|
|
|
|
g_free(path);
|
|
|
|
}
|
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
/* sd_toggle_btn()
|
2002-02-22 10:35:36 +01:00
|
|
|
*
|
2002-06-10 23:55:17 +02:00
|
|
|
* - checks whether at least on email is selected
|
|
|
|
* if so, untoggle remove / download button
|
2002-02-22 10:35:36 +01:00
|
|
|
*/
|
2002-06-10 23:55:17 +02:00
|
|
|
static void sd_toggle_btn()
|
2002-02-22 10:35:36 +01:00
|
|
|
{
|
2002-06-10 23:55:17 +02:00
|
|
|
PrefsAccount *acc = cur_account;
|
2002-02-22 10:35:36 +01:00
|
|
|
GSList *cur;
|
2002-06-10 23:55:17 +02:00
|
|
|
|
|
|
|
for (cur = acc->msg_list; cur != NULL; cur = cur->next) {
|
|
|
|
HeaderItems *items = (HeaderItems*)cur->data;
|
2002-02-22 10:35:36 +01:00
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
if (items->state == SD_CHECKED) {
|
|
|
|
gtk_widget_set_sensitive (selective.remove_btn, TRUE);
|
|
|
|
gtk_widget_set_sensitive (selective.download_btn, TRUE);
|
|
|
|
return;
|
2002-02-22 10:35:36 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
gtk_widget_set_sensitive (selective.remove_btn, FALSE);
|
2002-02-22 10:35:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* sd_header_filter(MsgInfo *msginfo)
|
|
|
|
*
|
|
|
|
* - parse header line and look for any applying filtering rules
|
|
|
|
* - if message matches other MATCHACTION --> return
|
|
|
|
*
|
|
|
|
*/
|
2002-06-10 23:55:17 +02:00
|
|
|
SD_State sd_header_filter(MsgInfo *msginfo)
|
2002-02-22 10:35:36 +01:00
|
|
|
{
|
|
|
|
GSList *rules;
|
|
|
|
|
|
|
|
/* parse header line for line */
|
|
|
|
for (rules = global_processing; rules != NULL; rules = rules->next) {
|
|
|
|
|
|
|
|
FilteringProp *prop = (FilteringProp*) rules->data;
|
|
|
|
|
|
|
|
if ( matcherlist_match(prop->matchers, msginfo) ) {
|
|
|
|
if (prop->action->type == MATCHACTION_DELETE_ON_SERVER) {
|
2002-08-15 09:38:17 +02:00
|
|
|
debug_print("action matched\n");
|
2002-06-10 23:55:17 +02:00
|
|
|
return SD_CHECKED;
|
|
|
|
}
|
|
|
|
else {
|
2002-08-15 09:38:17 +02:00
|
|
|
debug_print("action not matched\n");
|
2002-06-10 23:55:17 +02:00
|
|
|
return SD_UNCHECKED;
|
2002-02-22 10:35:36 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-06-10 23:55:17 +02:00
|
|
|
return SD_UNCHECKED;
|
2002-02-22 10:35:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* sd_get_msginfo_from_file(const gchar *filename)
|
|
|
|
*
|
|
|
|
* - retrieve msginfo from saved header files
|
|
|
|
*/
|
2002-06-21 23:07:57 +02:00
|
|
|
static MsgInfo *sd_get_msginfo_from_file(const gchar *filename)
|
2002-02-22 10:35:36 +01:00
|
|
|
{
|
2002-06-21 23:07:57 +02:00
|
|
|
MsgInfo *msginfo;
|
|
|
|
MsgFlags msgflags = { 0, 0 };
|
2002-06-22 12:08:35 +02:00
|
|
|
gchar date[80];
|
2002-02-22 10:35:36 +01:00
|
|
|
|
2002-06-21 23:07:57 +02:00
|
|
|
msginfo = procheader_parse_file(filename, msgflags, TRUE, FALSE);
|
2002-06-10 23:55:17 +02:00
|
|
|
|
2002-06-22 12:08:35 +02:00
|
|
|
if (msginfo && msginfo->date_t) {
|
|
|
|
procheader_date_get_localtime(date, sizeof date, msginfo->date_t);
|
|
|
|
if (msginfo->date) g_free(msginfo->date);
|
|
|
|
msginfo->date = g_strdup(date);
|
2002-06-22 12:56:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!msginfo)
|
2002-06-21 23:07:57 +02:00
|
|
|
msginfo = g_new0(MsgInfo, 1);
|
|
|
|
|
|
|
|
if (!msginfo->date)
|
2002-07-18 10:02:09 +02:00
|
|
|
msginfo->date = g_strdup(_("(No date)"));
|
2002-06-21 23:07:57 +02:00
|
|
|
if (!msginfo->from)
|
2002-07-18 10:02:09 +02:00
|
|
|
msginfo->from = g_strdup(_("(No sender)"));
|
2002-06-21 23:07:57 +02:00
|
|
|
if (!msginfo->subject)
|
2002-07-18 10:02:09 +02:00
|
|
|
msginfo->subject = g_strdup(_("(No subject)"));
|
2002-06-21 23:07:57 +02:00
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
return msginfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sd_clist_set_pixmap(HeaderItems *items, gint row)
|
|
|
|
{
|
|
|
|
|
|
|
|
switch (items->state) {
|
|
|
|
case SD_REMOVED:
|
|
|
|
gtk_clist_set_pixmap (GTK_CLIST (selective.clist),
|
|
|
|
row, 0,
|
|
|
|
deletedxpm, deletedxpmmask);
|
|
|
|
break;
|
|
|
|
case SD_CHECKED:
|
|
|
|
gtk_clist_set_pixmap (GTK_CLIST (selective.clist),
|
|
|
|
row, 0,
|
|
|
|
checkboxonxpm, checkboxonxpmmask);
|
|
|
|
break;
|
|
|
|
case SD_DOWNLOADED:
|
|
|
|
gtk_clist_set_pixmap (GTK_CLIST (selective.clist),
|
|
|
|
row, 0,
|
|
|
|
markxpm, markxpmmask);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
gtk_clist_set_pixmap (GTK_CLIST (selective.clist),
|
|
|
|
row, 0,
|
|
|
|
checkboxoffxpm, checkboxoffxpmmask);
|
|
|
|
break;
|
2002-02-22 10:35:36 +01:00
|
|
|
}
|
2002-06-10 23:55:17 +02:00
|
|
|
}
|
2002-02-22 10:35:36 +01:00
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
static void sd_clist_set_items()
|
|
|
|
{
|
|
|
|
PrefsAccount *acc = cur_account;
|
|
|
|
GSList *cur;
|
|
|
|
gboolean show_old =
|
|
|
|
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(selective.show_old_chkbtn));
|
2002-02-22 10:35:36 +01:00
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
gtk_clist_clear(GTK_CLIST(selective.clist));
|
|
|
|
gtk_clist_freeze(GTK_CLIST(selective.clist));
|
|
|
|
|
|
|
|
for (cur = acc->msg_list; cur != NULL; cur = cur->next) {
|
|
|
|
HeaderItems *items = (HeaderItems*)cur->data;
|
|
|
|
gchar *row[5];
|
|
|
|
gint row_num;
|
|
|
|
|
2002-06-26 12:45:13 +02:00
|
|
|
row[0] = ("");
|
2002-06-10 23:55:17 +02:00
|
|
|
row[1] = items->from;
|
|
|
|
row[2] = items->subject;
|
|
|
|
row[3] = items->date;
|
|
|
|
row[4] = g_strdup_printf("%i KB", items->size/1024);
|
|
|
|
|
|
|
|
switch (items->state) {
|
|
|
|
case SD_REMOVED:
|
|
|
|
case SD_DOWNLOADED:
|
|
|
|
items->del_by_old_session = TRUE;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (show_old) {
|
|
|
|
if (items->received) {
|
|
|
|
row_num = gtk_clist_append(GTK_CLIST(selective.clist), row);
|
|
|
|
sd_clist_set_pixmap(items, row_num);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
row_num = gtk_clist_append(GTK_CLIST(selective.clist), row);
|
|
|
|
sd_clist_set_pixmap(items, row_num);
|
|
|
|
}
|
|
|
|
g_free(row[4]);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_clist_thaw(GTK_CLIST(selective.clist));
|
|
|
|
sd_toggle_btn();
|
2002-02-22 10:35:36 +01:00
|
|
|
}
|
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
/* sd_update_msg_num(PrefsAccount *acc)
|
|
|
|
* - keep track of msgs still on server
|
|
|
|
* - count UNCHECKED items as well as downloaded but not removed
|
|
|
|
*/
|
|
|
|
static void sd_update_msg_num(PrefsAccount *acc)
|
|
|
|
{
|
|
|
|
GSList *cur;
|
|
|
|
gint msg_num = g_slist_length(acc->msg_list);
|
|
|
|
gchar *text;
|
2002-02-22 10:35:36 +01:00
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
for (cur = acc->msg_list; cur != NULL; cur = cur->next) {
|
|
|
|
HeaderItems *items = (HeaderItems*) cur->data;
|
|
|
|
|
|
|
|
if (items->state != SD_UNCHECKED)
|
|
|
|
msg_num--;
|
|
|
|
if (items->state == SD_DOWNLOADED)
|
|
|
|
if (!acc->sd_rmmail_on_download)
|
|
|
|
msg_num++;
|
|
|
|
}
|
|
|
|
|
2002-08-25 13:54:54 +02:00
|
|
|
text = g_strdup_printf(_("%i Messages"), msg_num);
|
2002-06-10 23:55:17 +02:00
|
|
|
gtk_label_set_text(GTK_LABEL(selective.msgs_label), text);
|
|
|
|
|
|
|
|
g_free(text);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* sd_clist_get_items()
|
2002-02-22 10:35:36 +01:00
|
|
|
*
|
2002-06-10 23:55:17 +02:00
|
|
|
* - get items for clist from Files
|
2002-02-22 10:35:36 +01:00
|
|
|
*/
|
2002-06-21 23:07:57 +02:00
|
|
|
static void sd_clist_get_items(void)
|
2002-02-22 10:35:36 +01:00
|
|
|
{
|
2002-06-10 23:55:17 +02:00
|
|
|
GSList *cur;
|
|
|
|
PrefsAccount *acc = cur_account;
|
|
|
|
gchar *path = g_strconcat(get_header_cache_dir(), G_DIR_SEPARATOR_S, NULL);
|
2002-02-22 10:35:36 +01:00
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
for (cur = acc->msg_list; cur != NULL; cur = cur->next) {
|
2002-02-22 10:35:36 +01:00
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
HeaderItems *items = (HeaderItems*) cur->data;
|
2002-06-21 23:07:57 +02:00
|
|
|
gchar *filename = g_strdup_printf("%s%i", path, items->index);
|
|
|
|
MsgInfo *msginfo = sd_get_msginfo_from_file(filename);
|
|
|
|
|
|
|
|
items->from = g_strdup(msginfo->from);
|
|
|
|
items->subject = g_strdup(msginfo->subject);
|
2002-06-22 12:08:35 +02:00
|
|
|
items->date = g_strdup(msginfo->date);
|
2002-02-22 10:35:36 +01:00
|
|
|
|
|
|
|
msginfo->folder = folder_get_default_processing();
|
|
|
|
|
|
|
|
/* move msg file to drop folder */
|
|
|
|
if ((msginfo->msgnum = folder_item_add_msg(msginfo->folder,
|
|
|
|
filename, TRUE)) < 0) {
|
|
|
|
unlink(filename);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
if (acc->sd_filter_on_recv)
|
|
|
|
items->state = sd_header_filter(msginfo);
|
2002-02-22 10:35:36 +01:00
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
folder_item_remove_msg(msginfo->folder, msginfo->msgnum);
|
|
|
|
g_free(filename);
|
2002-06-21 23:07:57 +02:00
|
|
|
procmsg_msginfo_free(msginfo);
|
2002-02-22 10:35:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
g_free(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* --- Callbacks -- */
|
2002-06-10 23:55:17 +02:00
|
|
|
static void sd_action_cb(GtkWidget *widget, guint action)
|
2002-02-22 10:35:36 +01:00
|
|
|
{
|
2002-06-10 23:55:17 +02:00
|
|
|
PrefsAccount *acc = cur_account;
|
|
|
|
|
|
|
|
switch(action) {
|
|
|
|
case PREVIEW_NEW:
|
|
|
|
case PREVIEW_ALL:
|
|
|
|
if ( (acc->protocol != A_APOP) &&
|
|
|
|
(acc->protocol != A_POP3) ) {
|
|
|
|
alertpanel_error(
|
2002-07-18 10:02:09 +02:00
|
|
|
_("Selected account \"%s\" is not a POP mail server.\nPlease select a different account"), acc->account_name);
|
2002-06-10 23:55:17 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
sd_clear_msglist();
|
|
|
|
if (action == PREVIEW_NEW) {
|
|
|
|
gtk_widget_set_sensitive(selective.show_old_chkbtn, FALSE);
|
|
|
|
inc_selective_download(selective.mainwin, acc, STYPE_PREVIEW_NEW);
|
2002-02-22 10:35:36 +01:00
|
|
|
}
|
2002-06-10 23:55:17 +02:00
|
|
|
else {
|
|
|
|
gtk_widget_set_sensitive(selective.show_old_chkbtn, TRUE);
|
|
|
|
inc_selective_download(selective.mainwin, acc, STYPE_PREVIEW_ALL);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_clist_clear(GTK_CLIST(selective.clist));
|
|
|
|
sd_clist_get_items();
|
|
|
|
sd_clist_set_items();
|
|
|
|
break;
|
|
|
|
case REMOVE:
|
|
|
|
inc_selective_download(selective.mainwin, acc, STYPE_DELETE);
|
|
|
|
sd_clist_set_items();
|
|
|
|
break;
|
|
|
|
case DOWNLOAD:
|
|
|
|
inc_selective_download(selective.mainwin, acc, STYPE_DOWNLOAD);
|
|
|
|
sd_clist_set_items();
|
|
|
|
break;
|
|
|
|
case DONE:
|
|
|
|
sd_remove_header_files();
|
|
|
|
sd_clear_msglist();
|
|
|
|
gtk_widget_hide(selective.window);
|
|
|
|
inc_unlock();
|
|
|
|
break;
|
|
|
|
case CHECKBTN:
|
|
|
|
sd_clist_set_items();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2002-02-22 10:35:36 +01:00
|
|
|
}
|
2002-06-10 23:55:17 +02:00
|
|
|
|
|
|
|
sd_update_msg_num(acc);
|
|
|
|
}
|
2002-02-22 10:35:36 +01:00
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
/* Events */
|
|
|
|
static void sd_select_row_cb(GtkCList *clist, gint row, gint column,
|
|
|
|
GdkEvent *event, gpointer user_data)
|
|
|
|
{
|
|
|
|
if ((row >= 0) && (column >= 0)) {
|
|
|
|
PrefsAccount *acc = cur_account;
|
|
|
|
HeaderItems *items = (HeaderItems*) g_slist_nth_data (acc->msg_list, row);
|
2002-02-22 10:35:36 +01:00
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
if (!items) return;
|
|
|
|
if (!gtk_clist_get_selectable(GTK_CLIST(selective.clist), row)) return;
|
2002-02-22 10:35:36 +01:00
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
if (items->state == SD_UNCHECKED) {
|
|
|
|
items->state = SD_CHECKED;
|
|
|
|
gtk_clist_set_pixmap (GTK_CLIST (selective.clist), row, 0,
|
|
|
|
checkboxonxpm, checkboxonxpmmask);
|
|
|
|
} else if (items->state == SD_CHECKED) {
|
|
|
|
items->state = SD_UNCHECKED;
|
|
|
|
gtk_clist_set_pixmap (GTK_CLIST (selective.clist), row, 0,
|
|
|
|
checkboxoffxpm, checkboxoffxpmmask);
|
|
|
|
}
|
|
|
|
sd_toggle_btn();
|
|
|
|
}
|
|
|
|
}
|
2002-02-22 10:35:36 +01:00
|
|
|
|
2002-07-19 10:45:10 +02:00
|
|
|
static gint sd_key_pressed(GtkWidget *widget,
|
2002-06-10 23:55:17 +02:00
|
|
|
GdkEventKey *event,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2002-07-19 10:45:10 +02:00
|
|
|
if (event && event->keyval == GDK_Escape) {
|
2002-06-10 23:55:17 +02:00
|
|
|
sd_action_cb(widget, DONE);
|
2002-07-19 10:45:10 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint sd_delete_event_cb(GtkWidget *widget,
|
|
|
|
GdkEvent *event,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
sd_action_cb(widget, DONE);
|
|
|
|
return TRUE;
|
2002-02-22 10:35:36 +01:00
|
|
|
}
|
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
/* account menu */
|
2002-07-19 10:45:10 +02:00
|
|
|
static gint sd_ac_label_pressed(GtkWidget *widget, GdkEventButton *event,
|
2002-06-10 23:55:17 +02:00
|
|
|
gpointer data)
|
2002-02-22 10:35:36 +01:00
|
|
|
{
|
2002-07-19 10:45:10 +02:00
|
|
|
if (!event) return FALSE;
|
2002-02-22 10:35:36 +01:00
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
gtk_button_set_relief(GTK_BUTTON(widget), GTK_RELIEF_NORMAL);
|
|
|
|
gtk_object_set_data(GTK_OBJECT(selective.ac_menu), "menu_button",
|
|
|
|
widget);
|
2002-02-22 10:35:36 +01:00
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
gtk_menu_popup(GTK_MENU(selective.ac_menu), NULL, NULL,
|
|
|
|
menu_button_position, widget,
|
|
|
|
event->button, event->time);
|
2002-07-19 10:45:10 +02:00
|
|
|
return TRUE;
|
2002-06-10 23:55:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void sd_ac_menu_popup_closed(GtkMenuShell *menu_shell)
|
|
|
|
{
|
|
|
|
GtkWidget *button;
|
2002-02-22 10:35:36 +01:00
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
button = gtk_object_get_data(GTK_OBJECT(menu_shell), "menu_button");
|
|
|
|
if (!button) return;
|
|
|
|
gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
|
2002-02-22 10:35:36 +01:00
|
|
|
gtk_clist_clear(GTK_CLIST(selective.clist));
|
2002-06-10 23:55:17 +02:00
|
|
|
sd_clear_msglist();
|
|
|
|
sd_toggle_btn();
|
|
|
|
gtk_object_remove_data(GTK_OBJECT(selective.ac_menu), "menu_button");
|
2002-02-22 10:35:36 +01:00
|
|
|
}
|
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
static void sd_ac_menu_cb(GtkMenuItem *menuitem, gpointer data)
|
2002-02-22 10:35:36 +01:00
|
|
|
{
|
2002-06-10 23:55:17 +02:00
|
|
|
cur_account = (PrefsAccount *)data;
|
|
|
|
gtk_label_set_text(GTK_LABEL(selective.ac_label), cur_account->account_name);
|
|
|
|
gtk_widget_queue_resize(selective.ac_button);
|
|
|
|
main_window_reflect_prefs_all();
|
2002-02-22 10:35:36 +01:00
|
|
|
}
|
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
static void sd_ac_menu_set()
|
2002-02-22 10:35:36 +01:00
|
|
|
{
|
2002-06-10 23:55:17 +02:00
|
|
|
GList *cur_ac, *cur_item;
|
|
|
|
GtkWidget *menuitem;
|
|
|
|
PrefsAccount *ac_prefs;
|
|
|
|
GList *account_list = account_get_list();
|
|
|
|
|
|
|
|
/* destroy all previous menu item */
|
|
|
|
cur_item = GTK_MENU_SHELL(selective.ac_menu)->children;
|
|
|
|
while (cur_item != NULL) {
|
|
|
|
GList *next = cur_item->next;
|
|
|
|
gtk_widget_destroy(GTK_WIDGET(cur_item->data));
|
|
|
|
cur_item = next;
|
|
|
|
}
|
2002-02-22 10:35:36 +01:00
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
gtk_label_set_text(GTK_LABEL(selective.ac_label), cur_account->account_name);
|
2002-02-22 10:35:36 +01:00
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
for (cur_ac = account_list; cur_ac != NULL; cur_ac = cur_ac->next) {
|
|
|
|
ac_prefs = (PrefsAccount *)cur_ac->data;
|
|
|
|
|
|
|
|
menuitem = gtk_menu_item_new_with_label
|
|
|
|
(ac_prefs->account_name
|
|
|
|
? ac_prefs->account_name : _("Untitled"));
|
|
|
|
gtk_widget_show(menuitem);
|
|
|
|
gtk_menu_append(GTK_MENU(selective.ac_menu), menuitem);
|
|
|
|
gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
|
|
|
|
GTK_SIGNAL_FUNC(sd_ac_menu_cb),
|
|
|
|
ac_prefs);
|
|
|
|
}
|
|
|
|
}
|
2002-02-22 10:35:36 +01:00
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
/* receive button popup */
|
|
|
|
static void sd_preview_popup_closed(GtkMenuShell *menu_shell)
|
|
|
|
{
|
|
|
|
gtk_button_set_relief(GTK_BUTTON(selective.preview_btn), GTK_RELIEF_NORMAL);
|
|
|
|
manage_window_focus_in(selective.window, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
2002-07-19 10:45:10 +02:00
|
|
|
static gint sd_preview_popup_cb(GtkWidget *widget, GdkEventButton *event,
|
|
|
|
gpointer data)
|
2002-06-10 23:55:17 +02:00
|
|
|
{
|
2002-07-19 10:45:10 +02:00
|
|
|
if (!event) return FALSE;
|
2002-06-10 23:55:17 +02:00
|
|
|
|
|
|
|
if (event->button == 1) {
|
|
|
|
gtk_button_set_relief(GTK_BUTTON(widget), GTK_RELIEF_NORMAL);
|
|
|
|
gtk_menu_popup(GTK_MENU(selective.preview_popup), NULL, NULL,
|
|
|
|
menu_button_position, widget,
|
|
|
|
event->button, event->time);
|
2002-07-19 10:45:10 +02:00
|
|
|
return TRUE;
|
2002-02-22 10:35:36 +01:00
|
|
|
}
|
2002-07-19 10:45:10 +02:00
|
|
|
return FALSE;
|
2002-02-22 10:35:36 +01:00
|
|
|
}
|
|
|
|
|
2002-07-18 10:02:09 +02:00
|
|
|
static void sd_create_toolbar(MainWindow *mainwin, GtkWidget *container)
|
|
|
|
{
|
|
|
|
GtkWidget *toolbar;
|
|
|
|
GtkWidget *tmp_toolbar_icon;
|
|
|
|
GtkWidget *preview_btn;
|
|
|
|
GtkWidget *remove_btn;
|
|
|
|
GtkWidget *download_btn;
|
|
|
|
GtkWidget *done_btn;
|
|
|
|
GtkWidget *preview_popup;
|
|
|
|
gint n_menu_entries;
|
|
|
|
|
|
|
|
toolbar = gtk_toolbar_new (GTK_ORIENTATION_VERTICAL, GTK_TOOLBAR_BOTH);
|
|
|
|
|
|
|
|
gtk_container_add (GTK_CONTAINER(container), toolbar);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER(container), 2);
|
|
|
|
|
|
|
|
gtk_toolbar_set_space_size (GTK_TOOLBAR (toolbar), 30);
|
|
|
|
gtk_toolbar_set_space_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_SPACE_LINE);
|
|
|
|
|
|
|
|
tmp_toolbar_icon = stock_pixmap_widget (container, STOCK_PIXMAP_MAIL_RECEIVE);
|
|
|
|
preview_btn = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
|
|
|
|
GTK_TOOLBAR_CHILD_BUTTON,
|
|
|
|
NULL,
|
|
|
|
_("Preview mail"),
|
|
|
|
_("Preview old/new mail on account"), NULL,
|
|
|
|
tmp_toolbar_icon, NULL, NULL);
|
|
|
|
|
|
|
|
n_menu_entries = sizeof (preview_popup_entries)/sizeof (preview_popup_entries[0]);
|
|
|
|
preview_popup = popupmenu_create (preview_btn, preview_popup_entries, n_menu_entries,
|
|
|
|
"<SelectiveDownload>", mainwin);
|
|
|
|
|
|
|
|
gtk_signal_connect (GTK_OBJECT(preview_popup), "selection_done",
|
|
|
|
GTK_SIGNAL_FUNC(sd_preview_popup_closed), NULL);
|
|
|
|
|
|
|
|
gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
|
|
|
|
|
|
|
|
tmp_toolbar_icon = stock_pixmap_widget (container, STOCK_PIXMAP_CLOSE);
|
|
|
|
remove_btn = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
|
|
|
|
GTK_TOOLBAR_CHILD_BUTTON,
|
|
|
|
NULL,
|
|
|
|
_("Remove"),
|
|
|
|
_("Remove selected mail"), NULL,
|
|
|
|
tmp_toolbar_icon, NULL, NULL);
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (remove_btn, FALSE);
|
|
|
|
|
|
|
|
tmp_toolbar_icon = stock_pixmap_widget(container, STOCK_PIXMAP_DOWN_ARROW);
|
|
|
|
download_btn = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
|
|
|
|
GTK_TOOLBAR_CHILD_BUTTON,
|
|
|
|
NULL,
|
|
|
|
_("Download"),
|
|
|
|
_("Download selected mail"), NULL,
|
|
|
|
tmp_toolbar_icon, NULL, NULL);
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (download_btn, FALSE);
|
|
|
|
|
|
|
|
gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
|
|
|
|
|
|
|
|
tmp_toolbar_icon = stock_pixmap_widget (container, STOCK_PIXMAP_COMPLETE);
|
|
|
|
|
|
|
|
done_btn = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
|
|
|
|
GTK_TOOLBAR_CHILD_BUTTON,
|
|
|
|
NULL,
|
|
|
|
_("Done"),
|
|
|
|
_("Exit dialog"), NULL ,
|
|
|
|
tmp_toolbar_icon, NULL, NULL);
|
|
|
|
|
|
|
|
gtk_signal_connect (GTK_OBJECT (preview_btn), "button_press_event",
|
|
|
|
GTK_SIGNAL_FUNC (sd_preview_popup_cb),
|
|
|
|
NULL);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (remove_btn), "clicked",
|
|
|
|
GTK_SIGNAL_FUNC (sd_action_cb),
|
|
|
|
GUINT_TO_POINTER(REMOVE));
|
|
|
|
gtk_signal_connect (GTK_OBJECT (download_btn), "clicked",
|
|
|
|
GTK_SIGNAL_FUNC (sd_action_cb),
|
|
|
|
GUINT_TO_POINTER(DOWNLOAD));
|
|
|
|
gtk_signal_connect (GTK_OBJECT (done_btn), "clicked",
|
|
|
|
GTK_SIGNAL_FUNC (sd_action_cb),
|
|
|
|
GUINT_TO_POINTER(DONE));
|
|
|
|
|
|
|
|
selective.preview_btn = preview_btn;
|
|
|
|
selective.remove_btn = remove_btn;
|
|
|
|
selective.download_btn = download_btn;
|
|
|
|
selective.preview_popup = preview_popup;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2002-02-22 10:35:36 +01:00
|
|
|
static void sd_window_create(MainWindow *mainwin)
|
|
|
|
{
|
|
|
|
GtkWidget *window;
|
|
|
|
GtkWidget *table;
|
2002-06-10 23:55:17 +02:00
|
|
|
GtkWidget *msgs_label;
|
|
|
|
GtkWidget *bottom_hbox;
|
|
|
|
GtkWidget *fixed_label;
|
|
|
|
GtkWidget *expand_label;
|
|
|
|
GtkWidget *ac_button;
|
|
|
|
GtkWidget *ac_label;
|
|
|
|
GtkWidget *ac_menu;
|
|
|
|
GtkWidget *show_old_chkbtn;
|
2002-02-22 10:35:36 +01:00
|
|
|
GtkWidget *scrolledwindow;
|
|
|
|
GtkWidget *clist;
|
2002-06-10 23:55:17 +02:00
|
|
|
GtkWidget *state_label;
|
|
|
|
GtkWidget *from_label;
|
|
|
|
GtkWidget *subject_label;
|
|
|
|
GtkWidget *size_label;
|
|
|
|
GtkWidget *date_label;
|
|
|
|
GtkWidget *toolbar_hbox;
|
2002-02-22 10:35:36 +01:00
|
|
|
|
|
|
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
|
|
|
gtk_object_set_data (GTK_OBJECT (window), "window", window);
|
2002-03-25 17:34:03 +01:00
|
|
|
gtk_window_set_title (GTK_WINDOW (window), _("Selective download"));
|
2002-02-22 10:35:36 +01:00
|
|
|
gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
|
2002-06-10 23:55:17 +02:00
|
|
|
gtk_window_set_modal (GTK_WINDOW (window), TRUE);
|
|
|
|
gtk_window_set_policy (GTK_WINDOW (window), TRUE, TRUE, TRUE);
|
2002-07-18 10:02:09 +02:00
|
|
|
/* avoids GDK warning (pixmap with NULL window) */
|
|
|
|
gtk_widget_realize (window);
|
2002-06-10 23:55:17 +02:00
|
|
|
|
2002-02-22 10:35:36 +01:00
|
|
|
table = gtk_table_new (2, 2, FALSE);
|
|
|
|
gtk_container_add (GTK_CONTAINER (window), table);
|
2002-06-10 23:55:17 +02:00
|
|
|
|
2002-07-18 10:02:09 +02:00
|
|
|
msgs_label = gtk_label_new (_("0 messages"));
|
2002-06-10 23:55:17 +02:00
|
|
|
gtk_table_attach (GTK_TABLE (table), msgs_label, 1, 2, 1, 2,
|
2002-02-22 10:35:36 +01:00
|
|
|
(GtkAttachOptions) (GTK_FILL),
|
|
|
|
(GtkAttachOptions) (0), 0, 0);
|
2002-06-10 23:55:17 +02:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (msgs_label), 0, 0.5);
|
|
|
|
|
|
|
|
bottom_hbox = gtk_hbox_new (FALSE, 0);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), bottom_hbox, 0, 1, 1, 2,
|
2002-02-22 10:35:36 +01:00
|
|
|
(GtkAttachOptions) (GTK_FILL),
|
|
|
|
(GtkAttachOptions) (GTK_FILL), 0, 0);
|
2002-06-28 16:04:04 +02:00
|
|
|
|
2002-08-25 13:54:54 +02:00
|
|
|
show_old_chkbtn = gtk_check_button_new_with_label(_("Show only old messages"));
|
2002-07-18 10:02:09 +02:00
|
|
|
gtk_box_pack_start (GTK_BOX(bottom_hbox), show_old_chkbtn, FALSE, FALSE, 0);
|
2002-06-28 16:04:04 +02:00
|
|
|
|
2002-07-18 10:02:09 +02:00
|
|
|
gtk_signal_connect (GTK_OBJECT(show_old_chkbtn), "toggled",
|
|
|
|
GTK_SIGNAL_FUNC(sd_action_cb), GUINT_TO_POINTER(CHECKBTN));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(show_old_chkbtn), FALSE);
|
|
|
|
GTK_WIDGET_UNSET_FLAGS (show_old_chkbtn, GTK_CAN_FOCUS);
|
2002-06-28 16:04:04 +02:00
|
|
|
|
|
|
|
expand_label = gtk_label_new (" ");
|
2002-06-10 23:55:17 +02:00
|
|
|
gtk_box_pack_start (GTK_BOX (bottom_hbox), expand_label, TRUE, TRUE, 0);
|
2002-02-22 10:35:36 +01:00
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
fixed_label = gtk_label_new (_(" contains "));
|
|
|
|
gtk_box_pack_end (GTK_BOX (bottom_hbox), fixed_label, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
ac_menu = gtk_menu_new();
|
2002-07-18 10:02:09 +02:00
|
|
|
gtk_signal_connect (GTK_OBJECT(ac_menu), "selection_done",
|
|
|
|
GTK_SIGNAL_FUNC(sd_ac_menu_popup_closed), NULL);
|
2002-06-10 23:55:17 +02:00
|
|
|
ac_button = gtk_button_new();
|
2002-07-18 10:02:09 +02:00
|
|
|
gtk_button_set_relief (GTK_BUTTON(ac_button), GTK_RELIEF_NONE);
|
|
|
|
GTK_WIDGET_UNSET_FLAGS (ac_button, GTK_CAN_FOCUS);
|
|
|
|
gtk_widget_set_usize (ac_button, -1, 1);
|
|
|
|
gtk_box_pack_start (GTK_BOX(bottom_hbox), ac_button, FALSE, FALSE, 0);
|
|
|
|
gtk_signal_connect (GTK_OBJECT(ac_button), "button_press_event",
|
|
|
|
GTK_SIGNAL_FUNC(sd_ac_label_pressed), GTK_OBJECT(ac_menu));
|
2002-06-10 23:55:17 +02:00
|
|
|
|
|
|
|
ac_label = gtk_label_new("");
|
2002-07-18 10:02:09 +02:00
|
|
|
gtk_container_add (GTK_CONTAINER(ac_button), ac_label);
|
2002-06-10 23:55:17 +02:00
|
|
|
|
2002-02-22 10:35:36 +01:00
|
|
|
scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), scrolledwindow, 0, 1, 0, 1,
|
|
|
|
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
|
|
|
|
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
|
2002-06-10 23:55:17 +02:00
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
|
|
|
|
GTK_POLICY_NEVER,
|
|
|
|
GTK_POLICY_AUTOMATIC);
|
2002-02-22 10:35:36 +01:00
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
clist = gtk_clist_new (5);
|
2002-02-22 10:35:36 +01:00
|
|
|
gtk_container_add (GTK_CONTAINER (scrolledwindow), clist);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (clist), 5);
|
2002-06-10 23:55:17 +02:00
|
|
|
gtk_clist_set_column_width (GTK_CLIST (clist), 0, 20);
|
|
|
|
gtk_clist_set_column_width (GTK_CLIST (clist), 1, 150);
|
|
|
|
gtk_clist_set_column_width (GTK_CLIST (clist), 2, 150);
|
|
|
|
gtk_clist_set_column_width (GTK_CLIST (clist), 3, 100);
|
|
|
|
gtk_clist_set_column_width (GTK_CLIST (clist), 4, 30);
|
2002-02-22 10:35:36 +01:00
|
|
|
gtk_clist_set_selection_mode (GTK_CLIST (clist), GTK_SELECTION_BROWSE);
|
|
|
|
gtk_clist_column_titles_show (GTK_CLIST (clist));
|
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
state_label = gtk_label_new (_("#"));
|
|
|
|
gtk_clist_set_column_widget (GTK_CLIST (clist), 0, state_label);
|
2002-02-22 10:35:36 +01:00
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
from_label = gtk_label_new (_("From"));
|
|
|
|
gtk_clist_set_column_widget (GTK_CLIST (clist), 1, from_label);
|
2002-06-28 16:04:04 +02:00
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
subject_label = gtk_label_new (_("Subject"));
|
|
|
|
gtk_clist_set_column_widget (GTK_CLIST (clist), 2, subject_label);
|
2002-02-22 10:35:36 +01:00
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
date_label = gtk_label_new (_("Date"));
|
|
|
|
gtk_clist_set_column_widget (GTK_CLIST (clist), 3, date_label);
|
|
|
|
|
|
|
|
size_label = gtk_label_new (_("Size"));
|
|
|
|
gtk_widget_ref (size_label);
|
|
|
|
gtk_clist_set_column_widget (GTK_CLIST (clist), 4, size_label);
|
2002-02-22 10:35:36 +01:00
|
|
|
|
2002-07-18 10:02:09 +02:00
|
|
|
/* create toolbar */
|
2002-06-10 23:55:17 +02:00
|
|
|
toolbar_hbox = gtk_hbox_new (FALSE, 0);
|
|
|
|
|
|
|
|
gtk_table_attach (GTK_TABLE (table), toolbar_hbox, 1, 2, 0, 1,
|
2002-02-22 10:35:36 +01:00
|
|
|
(GtkAttachOptions) (GTK_FILL),
|
|
|
|
(GtkAttachOptions) (GTK_FILL), 0, 0);
|
2002-07-18 10:02:09 +02:00
|
|
|
sd_create_toolbar(mainwin, toolbar_hbox);
|
2002-06-10 23:55:17 +02:00
|
|
|
|
|
|
|
|
|
|
|
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
|
2002-07-19 10:45:10 +02:00
|
|
|
GTK_SIGNAL_FUNC (sd_delete_event_cb),
|
2002-02-22 10:35:36 +01:00
|
|
|
NULL);
|
2002-06-10 23:55:17 +02:00
|
|
|
gtk_signal_connect (GTK_OBJECT(window), "key_press_event",
|
|
|
|
GTK_SIGNAL_FUNC(sd_key_pressed),
|
2002-02-22 10:35:36 +01:00
|
|
|
NULL);
|
2002-07-18 10:02:09 +02:00
|
|
|
MANAGE_WINDOW_SIGNALS_CONNECT (window);
|
2002-06-10 23:55:17 +02:00
|
|
|
|
2002-02-22 10:35:36 +01:00
|
|
|
gtk_signal_connect (GTK_OBJECT (clist), "select_row",
|
|
|
|
GTK_SIGNAL_FUNC (sd_select_row_cb),
|
|
|
|
NULL);
|
|
|
|
|
2002-06-10 23:55:17 +02:00
|
|
|
selective.mainwin = mainwin;
|
|
|
|
selective.window = window;
|
|
|
|
selective.clist = clist;
|
|
|
|
selective.ac_label = ac_label;
|
|
|
|
selective.ac_button = ac_button;
|
|
|
|
selective.ac_menu = ac_menu;
|
|
|
|
selective.msgs_label = msgs_label;
|
|
|
|
selective.show_old_chkbtn = show_old_chkbtn;
|
2002-02-22 10:35:36 +01:00
|
|
|
|
|
|
|
gtk_widget_show_all(window);
|
|
|
|
}
|