aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog15
-rw-r--r--mail/em-folder-tree-model.c8
-rw-r--r--mail/mail-component.c45
-rw-r--r--mail/mail-offline-handler.c9
4 files changed, 31 insertions, 46 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 2e5984f39a..8fae433051 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,18 @@
+2004-01-27 Not Zed <NotZed@Ximian.com>
+
+ * em-folder-tree-model.c (folder_renamed): fix the parent-finding
+ logic.
+
+2004-01-23 Not Zed <NotZed@Ximian.com>
+
+ * mail-component.c (mail_component_init): add the offline handler
+ interface to the component.
+ (store_go_online, go_online): removed, handled by the offline
+ handler.
+
+ * mail-offline-handler.c (store_go_online): add the store to the
+ tree model when we go online.
+
2004-01-26 Jeffrey Stedfast <fejj@ximian.com>
Fixes for bug #53251.
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index 5811cb09ef..cd0b1de9e0 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -604,10 +604,10 @@ folder_renamed (CamelStore *store, CamelRenameInfo *info, EMFolderTreeModel *mod
em_folder_tree_model_remove_folders (model, si, &iter);
parent = g_strdup (info->new->path);
- if ((p = strrchr (parent + 1, '/')))
- *p = '\0';
-
- if (!strcmp (parent, "/")) {
+ p = strrchr(parent, '/');
+ g_assert(p);
+ *p = 0;
+ if (parent == p) {
/* renamed to a toplevel folder on the store */
path = gtk_tree_row_reference_get_path (si->row);
} else {
diff --git a/mail/mail-component.c b/mail/mail-component.c
index ad6b728ad6..ff45e0af5a 100644
--- a/mail/mail-component.c
+++ b/mail/mail-component.c
@@ -20,7 +20,6 @@
* Author: Ettore Perazzoli <ettore@ximian.com>
*/
-
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -51,6 +50,7 @@
#include "mail-tools.h"
#include "mail-send-recv.h"
#include "mail-session.h"
+#include "mail-offline-handler.h"
#include "e-task-bar.h"
@@ -131,32 +131,6 @@ load_accounts (MailComponent *component, EAccountList *accounts)
}
static void
-store_go_online (gpointer key, gpointer value, gpointer data)
-{
- CamelStore *store = key;
- CamelService *service = CAMEL_SERVICE (store);
-
- if (! (service->provider->flags & CAMEL_PROVIDER_IS_REMOTE)
- || (service->provider->flags & CAMEL_PROVIDER_IS_EXTERNAL))
- return;
-
- if ((CAMEL_IS_DISCO_STORE (service)
- && camel_disco_store_status (CAMEL_DISCO_STORE (service)) == CAMEL_DISCO_STORE_OFFLINE)
- || service->status != CAMEL_SERVICE_DISCONNECTED) {
- mail_store_set_offline (store, FALSE, NULL, NULL);
- mail_note_store (store, NULL, NULL, NULL);
- }
-}
-
-static void
-go_online (MailComponent *component)
-{
- camel_session_set_online (session, TRUE);
- mail_session_set_interactive (TRUE);
- mail_component_stores_foreach (component, store_go_online, NULL);
-}
-
-static void
setup_search_context (MailComponent *component)
{
MailComponentPrivate *priv = component->priv;
@@ -307,7 +281,6 @@ view_control_activate_cb (BonoboControl *control, gboolean activate, EMFolderVie
}
}
-
/* GObject methods. */
static void
@@ -420,7 +393,6 @@ impl_createControls (PortableServer_Servant servant,
g_signal_connect (tree_widget, "folder-selected", G_CALLBACK (folder_selected_cb), view_widget);
}
-
static GNOME_Evolution_CreatableItemTypeList *
impl__get_userCreatableItems (PortableServer_Servant servant, CORBA_Environment *ev)
{
@@ -524,6 +496,7 @@ mail_component_init (MailComponent *component)
{
MailComponentPrivate *priv;
EAccountList *accounts;
+ MailOfflineHandler *offline;
priv = g_new0 (MailComponentPrivate, 1);
component->priv = priv;
@@ -549,11 +522,10 @@ mail_component_init (MailComponent *component)
mail_autoreceive_setup();
setup_search_context (component);
-
- /* EPFIXME not sure about this. */
- go_online (component);
-}
+ offline = mail_offline_handler_new();
+ bonobo_object_add_interface((BonoboObject *)component, (BonoboObject *)offline);
+}
/* Public API. */
BonoboControl *
@@ -603,7 +575,6 @@ mail_component_peek (void)
return component;
}
-
const char *
mail_component_peek_base_directory (MailComponent *component)
{
@@ -642,7 +613,6 @@ mail_component_add_store (MailComponent *component, CamelStore *store, const cha
camel_exception_clear (&ex);
}
-
/**
* mail_component_load_store_by_uri:
* @component: mail component
@@ -710,7 +680,6 @@ mail_component_load_store_by_uri (MailComponent *component, const char *uri, con
return store;
}
-
static void
store_disconnect (CamelStore *store, void *event_data, void *user_data)
{
@@ -766,28 +735,24 @@ mail_component_remove_store_by_uri (MailComponent *component, const char *uri)
}
}
-
int
mail_component_get_store_count (MailComponent *component)
{
return g_hash_table_size (component->priv->store_hash);
}
-
void
mail_component_stores_foreach (MailComponent *component, GHFunc func, void *user_data)
{
g_hash_table_foreach (component->priv->store_hash, func, user_data);
}
-
void
mail_component_remove_folder (MailComponent *component, CamelStore *store, const char *path)
{
/* FIXME: implement me. but first, am I really even needed? */
}
-
EMFolderTreeModel *
mail_component_peek_tree_model (MailComponent *component)
{
diff --git a/mail/mail-offline-handler.c b/mail/mail-offline-handler.c
index 6613391a7b..b7cff8b65a 100644
--- a/mail/mail-offline-handler.c
+++ b/mail/mail-offline-handler.c
@@ -30,7 +30,10 @@
#include "mail-component.h"
#include "mail-ops.h"
#include "mail-folder-cache.h"
-#include "mail.h"
+#include "em-folder-tree.h"
+
+#include <camel/camel-disco-store.h>
+#include "mail-session.h"
#include <gtk/gtkmain.h>
@@ -174,9 +177,11 @@ static void
store_go_online (gpointer key, gpointer value, gpointer data)
{
CamelStore *store = key;
-
+ char *name = value;
+
if (service_is_relevant (CAMEL_SERVICE (store), FALSE)) {
mail_store_set_offline (store, FALSE, NULL, NULL);
+ em_folder_tree_model_add_store(mail_component_peek_tree_model(mail_component_peek()), store, name);
mail_note_store (store, NULL, NULL, NULL);
}
}