aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog9
-rw-r--r--mail/Makefile.am7
-rw-r--r--mail/folder-browser-factory.c2
-rw-r--r--mail/folder-browser.c35
-rw-r--r--mail/folder-browser.h2
-rw-r--r--mail/main.c15
-rw-r--r--mail/message-list.c15
7 files changed, 76 insertions, 9 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 40ba1fca0d..4bd326610a 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,12 @@
+2000-02-14 Miguel de Icaza <miguel@gnu.org>
+
+ * folder-browser.c (folder_browser_load_folder): New routine,
+ loads a camel folder.
+ (folder_browser_set_uri): redo.
+
+ * session.c: new file. Implements SessionStores to keep track of
+ a Session/Store tuple.
+
2000-02-13 Matt Loper <matt@helixcode.com>
* html-stream.c (html_stream_new): Second param of gtk_html_begin
diff --git a/mail/Makefile.am b/mail/Makefile.am
index 36c61e427d..8132951901 100644
--- a/mail/Makefile.am
+++ b/mail/Makefile.am
@@ -1,10 +1,13 @@
bin_PROGRAMS = evolution-mail test-mail
+providerdir = $(libdir)/evolution/camel-providers/$(VERSION)
+
INCLUDES = \
-DEVOLUTION_VERSION=\""$(VERSION)"\" \
-DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
-DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \
-DEVOLUTION_LOCALEDIR=\""$(datadir)/locale"\" \
+ -DCAMEL_PROVIDERDIR=\""$(providerdir)"\" \
-I$(top_srcdir)/widgets \
-I$(top_srcdir)/widgets/e-text \
$(BONOBO_HTML_GNOME_CFLAGS)
@@ -27,7 +30,9 @@ evolution_mail_SOURCES = \
mail-display.c \
main.c \
message-list.c \
- message-list.h
+ message-list.h \
+ session.c \
+ session.h
evolution_mail_LDADD = \
../widgets/e-table/libetable.a \
diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c
index fd696395b8..dc5afb79a6 100644
--- a/mail/folder-browser-factory.c
+++ b/mail/folder-browser-factory.c
@@ -32,6 +32,8 @@ folder_browser_factory (BonoboGenericFactory *factory, void *closure)
if (folder_browser == NULL)
return NULL;
+ folder_browser_set_uri (FOLDER_BROWSER (folder_browser), "inbox");
+
control = bonobo_control_new (folder_browser);
if (control == NULL){
gtk_object_destroy (GTK_OBJECT (folder_browser));
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index c74d49ced7..263577d6f9 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -11,6 +11,7 @@
#include <gnome.h>
#include "e-util/e-util.h"
#include "folder-browser.h"
+#include "session.h"
#define PARENT_TYPE (gtk_table_get_type ())
@@ -27,6 +28,9 @@ folder_browser_destroy (GtkObject *object)
if (folder_browser->uri)
g_free (folder_browser->uri);
+ if (folder_browser->folder)
+ gtk_object_unref (GTK_OBJECT (folder_browser->folder));
+
if (folder_browser->message_list)
bonobo_object_unref (BONOBO_OBJECT (folder_browser->message_list));
@@ -41,14 +45,43 @@ folder_browser_class_init (GtkObjectClass *object_class)
folder_browser_parent_class = gtk_type_class (PARENT_TYPE);
}
+static gboolean
+folder_browser_load_folder (FolderBrowser *fb, const char *name)
+{
+ CamelFolder *new_folder;
+ CamelException *ex;
+
+ ex = camel_exception_new ();
+ new_folder = camel_store_get_folder (default_session->store, name, ex);
+
+ if (camel_exception_get_id (ex)){
+ camel_exception_free (ex);
+ return FALSE;
+ }
+ camel_exception_free (ex);
+
+ if (fb->folder)
+ gtk_object_unref (GTK_OBJECT (fb->folder));
+
+ fb->folder = new_folder;
+
+ message_list_set_folder (fb->message_list, new_folder);
+
+ return TRUE;
+}
+
#define EQUAL(a,b) (strcmp (a,b) == 0)
void
folder_browser_set_uri (FolderBrowser *folder_browser, const char *uri)
{
+ /* FIXME: hardcoded uri */
+ if (!folder_browser_load_folder (folder_browser, "inbox"))
+ return;
+
if (folder_browser->uri)
g_free (folder_browser->uri);
-
+
folder_browser->uri = g_strdup (uri);
}
diff --git a/mail/folder-browser.h b/mail/folder-browser.h
index 2e6fb8d1a4..f845c9f98b 100644
--- a/mail/folder-browser.h
+++ b/mail/folder-browser.h
@@ -22,6 +22,8 @@ typedef struct {
* The current URI being displayed by the FolderBrowser
*/
char *uri;
+ CamelFolder *folder;
+
MessageList *message_list;
GtkWidget *message_list_w;
MailDisplay *mail_display;
diff --git a/mail/main.c b/mail/main.c
index 517d6190e2..2dceb6644e 100644
--- a/mail/main.c
+++ b/mail/main.c
@@ -13,12 +13,15 @@
#include "e-util/e-gui-utils.h"
#include "main.h"
-CORBA_Environment ev;
CORBA_ORB orb;
static void
init_bonobo (int argc, char **argv)
{
+ CORBA_Environment ev;
+
+ CORBA_exception_init (&ev);
+
gnome_CORBA_init_with_popt_table (
"evolution-mail-component", "1.0",
&argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev);
@@ -30,6 +33,8 @@ init_bonobo (int argc, char **argv)
_("Mail Component: I could not initialize Bonobo"));
exit (1);
}
+
+ CORBA_exception_free (&ev);
}
int
@@ -38,13 +43,17 @@ main (int argc, char *argv [])
bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR);
textdomain (PACKAGE);
- CORBA_exception_init (&ev);
-
init_bonobo (argc, argv);
+ session_init ();
+
folder_browser_factory_init ();
bonobo_main ();
return 0;
}
+
+
+
+
diff --git a/mail/message-list.c b/mail/message-list.c
index 2cb5044f6c..7c2db35b3c 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -55,18 +55,24 @@ static int
ml_row_count (ETableModel *etm, void *data)
{
MessageList *message_list = data;
- CamelException ex;
-
+ CamelException *ex;
+ int v;
+
if (!message_list->folder)
- return 1;
+ return 0;
+
+ ex = camel_exception_new ();
+ v = camel_folder_get_message_count (message_list->folder, ex);
+ camel_exception_free (ex);
- return camel_folder_get_message_count (message_list->folder, &ex);
+ return v;
}
static void *
ml_value_at (ETableModel *etm, int col, int row, void *data)
{
static char buffer [10];
+
switch (col){
case COL_ONLINE_STATUS:
@@ -465,6 +471,7 @@ message_list_set_folder (MessageList *message_list, CamelFolder *camel_folder)
gtk_object_ref (GTK_OBJECT (camel_folder));
+ printf ("Modelo cambio!\n");
e_table_model_changed (message_list->table_model);
}