aboutsummaryrefslogtreecommitdiffstats
path: root/mail/message-list.h
blob: e66dc74a5578528dafe5909371e0aae02405ac18 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#ifndef _MESSAGE_LIST_H_
#define _MESSAGE_LIST_H_

#include <gnome.h>
#include "mail-types.h"
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-object.h>
#include <bonobo/bonobo-ui-component.h>
#include <gal/e-table/e-table-scrolled.h>
#include <gal/e-table/e-table-simple.h>
#include <gal/e-table/e-tree-simple.h>
#include <gal/e-table/e-cell-text.h>
#include <gal/e-table/e-cell-toggle.h>
#include <gal/e-table/e-cell-checkbox.h>
#include <gal/e-table/e-cell-tree.h>
#include "folder-browser.h"


#define MESSAGE_LIST_TYPE        (message_list_get_type ())
#define MESSAGE_LIST(o)          (GTK_CHECK_CAST ((o), MESSAGE_LIST_TYPE, MessageList))
#define MESSAGE_LIST_CLASS(k)    (GTK_CHECK_CLASS_CAST((k), MESSAGE_LIST_TYPE, MessageListClass))
#define IS_MESSAGE_LIST(o)       (GTK_CHECK_TYPE ((o), MESSAGE_LIST_TYPE))
#define IS_MESSAGE_LIST_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), MESSAGE_LIST_TYPE))

typedef struct _Renderer Renderer;


enum {
    COL_MESSAGE_STATUS,
    COL_FLAGGED,
    COL_SCORE,
    COL_ATTACHMENT,
    COL_FROM,
    COL_SUBJECT,
    COL_SENT,
    COL_RECEIVED,
    COL_TO,
    COL_SIZE,
    
    COL_LAST,
    
    /* Invisible columns */
    COL_DELETED,
    COL_UNREAD,
    COL_COLOUR,
};

struct _MessageList {
    BonoboObject parent;
    
    /* the folder browser that contains the 
     * this message list */
    FolderBrowser *parent_folder_browser;
    
    ETableModel  *table_model;
    
    ETreePath    *tree_root; /* for tree view */
    
    GtkWidget    *etable;

    CamelFolder  *folder;
    
    GHashTable *uid_rowmap;
    
    char *search;       /* search string */
    
    int cursor_row;
    const char *cursor_uid;
    
    /* row-selection and seen-marking timers */
    guint idle_id, seen_id;
};

typedef struct {
    BonoboObjectClass parent_class;
} MessageListClass;

typedef void (*MessageListForeachFunc) (MessageList *message_list,
                    const char *uid,
                    gpointer user_data);

typedef enum {
    MESSAGE_LIST_SELECT_NEXT = 1,
    MESSAGE_LIST_SELECT_PREVIOUS = -1
} MessageListSelectDirection;

GtkType        message_list_get_type   (void);
BonoboObject   *message_list_new        (FolderBrowser *parent_folder_browser);
void           message_list_set_folder (MessageList *message_list,
                    CamelFolder *camel_folder);
GtkWidget     *message_list_get_widget (MessageList *message_list);

void           message_list_foreach    (MessageList *message_list,
                    MessageListForeachFunc callback,
                    gpointer user_data);

void           message_list_select     (MessageList *message_list,
                    int base_row,
                    MessageListSelectDirection direction,
                    guint32 flags, guint32 mask);

void           message_list_home       (MessageList *message_list);
void           message_list_end        (MessageList *message_list);

extern gboolean threaded_view;
void           message_list_toggle_threads (BonoboUIComponent           *component,
                        const char                  *path,
                        Bonobo_UIComponent_EventType type,
                        const char                  *state,
                        gpointer                     user_data);

#endif /* _MESSAGE_LIST_H_ */