aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog19
-rw-r--r--mail/component-factory.c79
-rw-r--r--mail/folder-browser-factory.c18
-rw-r--r--mail/folder-browser.c4
-rw-r--r--mail/folder-browser.h13
-rw-r--r--mail/mail-config.c79
-rw-r--r--mail/mail-config.h4
7 files changed, 176 insertions, 40 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index dd2516f37f..d730844a94 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,24 @@
2001-06-14 Jeffrey Stedfast <fejj@ximian.com>
+ * folder-browser.c (got_folder): Updated to reflect changes to
+ mail_config_[g,s]et_thread_list().
+ (folder_browser_toggle_threads): Same.
+
+ * folder-browser-factory.c (control_activate): Updated to reflect
+ changes to mail_config_[g,s]et_thread_list().
+
+ * mail-config.c (mail_config_write_on_exit): Do cleanup when we're
+ done.
+ (mail_config_set_thread_list): Send in a URI so we can save the
+ state on a per-folder basis.
+ (mail_config_get_thread_list): Send in a URI so we can retrieve
+ the state on a per-folder basis.
+
+ * component-factory.c: Setup the accepted_dnd_types. Also added
+ skeleton code for DnD.
+
+2001-06-14 Jeffrey Stedfast <fejj@ximian.com>
+
* folder-browser-factory.c: Add Reply-to-List bonobo verbs.
* folder-browser.c: Add Reply-to-List menu items.
diff --git a/mail/component-factory.c b/mail/component-factory.c
index ed8f8707c0..2ab6d7c825 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -35,6 +35,7 @@
#include "folder-browser-factory.h"
#include "evolution-shell-component.h"
+#include "evolution-shell-component-dnd.h"
#include "folder-browser.h"
#include "mail.h" /* YUCK FIXME */
#include "mail-config.h"
@@ -65,6 +66,18 @@ char *evolution_dir;
static BonoboGenericFactory *component_factory = NULL;
static GHashTable *storages_hash;
+static char *accepted_dnd_types[] = {
+ "message/rfc822",
+ NULL
+};
+
+static const EvolutionShellComponentFolderType folder_types[] = {
+ { "mail", "evolution-inbox.png", accepted_dnd_types, NULL },
+ { "mailstorage", "evolution-inbox.png", NULL, NULL },
+ { "vtrash", "evolution-trash.png", NULL, NULL },
+ { NULL, NULL, NULL, NULL }
+};
+
/* EvolutionShellComponent methods and signals. */
static EvolutionShellComponentResult
@@ -77,7 +90,7 @@ create_view (EvolutionShellComponent *shell_component,
EvolutionShellClient *shell_client;
GNOME_Evolution_Shell corba_shell;
BonoboControl *control;
-
+
shell_client = evolution_shell_component_get_owner (shell_component);
corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client));
@@ -232,6 +245,53 @@ xfer_folder (EvolutionShellComponent *shell_component,
CORBA_exception_free (&ev);
}
+static char *
+get_dnd_selection (EvolutionShellComponent *shell_component,
+ const char *physical_uri,
+ int type,
+ int *format_return,
+ const char **selection_return,
+ int *selection_length_return,
+ void *closure)
+{
+ g_print ("should get dnd selection for %s\n", physical_uri);
+ return NULL;
+}
+
+/* Destination side DnD */
+static CORBA_boolean
+destination_folder_handle_motion (EvolutionShellComponentDndDestinationFolder *folder,
+ const char *physical_uri,
+ const GNOME_Evolution_ShellComponentDnd_DestinationFolder_Context *destination_context,
+ GNOME_Evolution_ShellComponentDnd_Action *suggested_action_return,
+ gpointer user_data)
+{
+ g_print ("in destination_folder_handle_motion (%s)\n", physical_uri);
+
+ *suggested_action_return = GNOME_Evolution_ShellComponentDnd_ACTION_MOVE;
+
+ return TRUE;
+}
+
+static CORBA_boolean
+destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *folder,
+ const char *physical_uri,
+ const GNOME_Evolution_ShellComponentDnd_DestinationFolder_Context *destination_context,
+ const GNOME_Evolution_ShellComponentDnd_Action action,
+ const GNOME_Evolution_ShellComponentDnd_Data *data,
+ gpointer user_data)
+{
+ CamelStream *stream;
+
+ if (action == GNOME_Evolution_ShellComponentDnd_ACTION_LINK)
+ return FALSE; /* we can't create links */
+
+ g_print ("in destination_folder_handle_drop (%s)\n", physical_uri);
+
+ return TRUE;
+}
+
+
static struct {
char *name, **uri;
CamelFolder **folder;
@@ -350,16 +410,10 @@ debug_cb (EvolutionShellComponent *shell_component, gpointer user_data)
camel_verbose_debug = 1;
}
-static const EvolutionShellComponentFolderType folder_types[] = {
- { "mail", "evolution-inbox.png" },
- { "mailstorage", "evolution-inbox.png" },
- { "vtrash", "evolution-trash.png" },
- { NULL, NULL }
-};
-
static BonoboObject *
component_fn (BonoboGenericFactory *factory, void *closure)
{
+ EvolutionShellComponentDndDestinationFolder *destination_interface;
EvolutionShellComponent *shell_component;
MailOfflineHandler *offline_handler;
@@ -369,9 +423,16 @@ component_fn (BonoboGenericFactory *factory, void *closure)
remove_folder,
xfer_folder,
NULL, /* populate_folder_context_menu_fn */
- NULL, /* get_dnd_selection_fn */
+ get_dnd_selection,
NULL);
+ destination_interface = evolution_shell_component_dnd_destination_folder_new (destination_folder_handle_motion,
+ destination_folder_handle_drop,
+ shell_component);
+
+ bonobo_object_add_interface (BONOBO_OBJECT (shell_component),
+ BONOBO_OBJECT (destination_interface));
+
gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set",
GTK_SIGNAL_FUNC (owner_set_cb), NULL);
gtk_signal_connect (GTK_OBJECT (shell_component), "owner_unset",
diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c
index d392eb6a95..38602b5a64 100644
--- a/mail/folder-browser-factory.c
+++ b/mail/folder-browser-factory.c
@@ -251,13 +251,13 @@ control_activate (BonoboControl *control,
bonobo_ui_util_set_ui (
uic, EVOLUTION_DATADIR,
"evolution-mail.xml", "evolution-mail");
-
- state = mail_config_get_thread_list();
- bonobo_ui_component_set_prop(uic, "/commands/ViewThreaded", "state", state?"1":"0", NULL);
- bonobo_ui_component_add_listener(uic, "ViewThreaded", folder_browser_toggle_threads, folder_browser);
+
+ state = mail_config_get_thread_list (FOLDER_BROWSER (folder_browser)->uri);
+ bonobo_ui_component_set_prop (uic, "/commands/ViewThreaded", "state", state ? "1" : "0", NULL);
+ bonobo_ui_component_add_listener (uic, "ViewThreaded", folder_browser_toggle_threads, folder_browser);
/* FIXME: this kind of bypasses bonobo but seems the only way when we change components */
- folder_browser_toggle_threads(uic, "", Bonobo_UIComponent_STATE_CHANGED, state?"1":"0", folder_browser);
-
+ folder_browser_toggle_threads (uic, "", Bonobo_UIComponent_STATE_CHANGED, state ? "1" : "0", folder_browser);
+
state = mail_config_get_message_display_style ();
bonobo_ui_component_set_prop (uic, message_display_styles[state],
"state", "1", NULL);
@@ -267,7 +267,7 @@ control_activate (BonoboControl *control,
/* FIXME: this kind of bypasses bonobo but seems the only way when we change components */
folder_browser_set_message_display_style (uic, strrchr (message_display_styles[state], '/') + 1,
Bonobo_UIComponent_STATE_CHANGED, "1", folder_browser);
-
+
if (fb->folder && CAMEL_IS_VTRASH_FOLDER(fb->folder)) {
bonobo_ui_component_set_prop(uic, "/commands/HideDeleted", "sensitive", "0", NULL);
state = FALSE;
@@ -287,9 +287,9 @@ control_activate (BonoboControl *control,
folder_browser_setup_property_menu (fb, uic);
e_pixmaps_update (uic, pixcache);
-
+
bonobo_ui_component_set_prop(uic, "/commands/MailStop", "sensitive", "0", NULL);
-
+
bonobo_ui_component_thaw (uic, NULL);
if (fb->folder)
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index 1e70501b88..663dd40f6c 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -214,7 +214,7 @@ got_folder(char *uri, CamelFolder *folder, void *data)
}
gtk_widget_set_sensitive(GTK_WIDGET(fb->search), camel_folder_has_search_capability(folder));
- message_list_set_threaded(fb->message_list, mail_config_get_thread_list());
+ message_list_set_threaded (fb->message_list, mail_config_get_thread_list (fb->uri));
message_list_set_folder(fb->message_list, folder,
folder_browser_is_drafts (fb) ||
folder_browser_is_sent (fb) ||
@@ -429,7 +429,7 @@ folder_browser_toggle_threads (BonoboUIComponent *component,
if (type != Bonobo_UIComponent_STATE_CHANGED)
return;
- mail_config_set_thread_list (atoi (state));
+ mail_config_set_thread_list (fb->uri, atoi (state));
message_list_set_threaded (fb->message_list, atoi (state));
}
diff --git a/mail/folder-browser.h b/mail/folder-browser.h
index c41562153e..ac6aef90f9 100644
--- a/mail/folder-browser.h
+++ b/mail/folder-browser.h
@@ -37,29 +37,30 @@ struct _FolderBrowser {
char *uri;
CamelFolder *folder;
int unread_count; /* last known unread message count */
-
+
/* async loading stuff */
char *loading_uid;/* what uid am i loading now */
char *pending_uid; /* what uid should i load next */
char *new_uid; /* place to save the next uid during idle timeout */
char *loaded_uid; /* what we have loaded */
guint loading_id, seen_id;
-
+
/* a folder we are expunging, dont use other than to compare the pointer value */
CamelFolder *expunging;
-
+
/* set to true when we are reconfiguring stuff == can't do much else */
int reconfigure;
-
+
MessageList *message_list;
MailDisplay *mail_display;
GtkWidget *vpaned;
EFilterBar *search;
FilterRule *search_full; /* if we have a full search active */
-
+
gboolean preview_shown;
-
+ gboolean threaded;
+
/* View collection and the menu handler object */
GalViewCollection *view_collection;
GalViewMenus *view_menus;
diff --git a/mail/mail-config.c b/mail/mail-config.c
index 4465ac27db..1a346ebff0 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -70,6 +70,8 @@ typedef struct {
MailConfigForwardStyle default_forward_style;
MailConfigDisplayStyle message_display_style;
char *default_charset;
+
+ GHashTable *threaded_hash;
} MailConfig;
static const char GCONFPATH[] = "/apps/Evolution/Mail";
@@ -234,9 +236,6 @@ mail_config_clear (void)
g_slist_free (config->news);
config->news = NULL;
}
-
- /* overkill? */
- memset (config, 0, sizeof (MailConfig));
}
static void
@@ -446,7 +445,7 @@ config_read (void)
if (def)
config->citation_color = 0x737373;
g_free (str);
-
+
/* Mark as seen timeout */
str = g_strdup_printf ("=%s/config/Mail=/Display/seen_timeout",
evolution_dir);
@@ -498,7 +497,7 @@ config_read (void)
if (def)
config->pgp_type = CAMEL_PGP_TYPE_NONE;
g_free (str);
-
+
/* HTTP images */
str = g_strdup_printf ("=%s/config/Mail=/Display/http_images",
evolution_dir);
@@ -665,6 +664,17 @@ mail_config_write (void)
gnome_config_sync ();
}
+static gboolean
+threaded_save_state (gpointer key, gpointer value, gpointer user_data)
+{
+ gboolean threaded = GPOINTER_TO_INT (value);
+
+ gnome_config_set_bool ((char *) key, threaded);
+ g_free (key);
+
+ return TRUE;
+}
+
void
mail_config_write_on_exit (void)
{
@@ -677,7 +687,7 @@ mail_config_write_on_exit (void)
evolution_dir);
gnome_config_set_bool (str, config->thread_list);
g_free (str);
-
+
/* Hide deleted automatically */
str = g_strdup_printf ("=%s/config/Mail=/Display/hide_deleted",
evolution_dir);
@@ -711,7 +721,7 @@ mail_config_write_on_exit (void)
evolution_dir);
gnome_config_set_int (str, config->citation_color);
g_free (str);
-
+
/* Empty Subject */
str = g_strdup_printf ("=%s/config/Mail=/Prompts/empty_subject",
evolution_dir);
@@ -733,7 +743,7 @@ mail_config_write_on_exit (void)
evolution_dir);
gnome_config_set_int (str, config->http_mode);
g_free (str);
-
+
/* Forwarding */
str = g_strdup_printf ("=%s/config/Mail=/Format/default_forward_style",
evolution_dir);
@@ -750,7 +760,7 @@ mail_config_write_on_exit (void)
str = g_strdup_printf ("=%s/config/Mail=/Format/default_charset", evolution_dir);
gnome_config_set_string (str, config->default_charset);
g_free (str);
-
+
/* Passwords */
gnome_config_private_clean_section ("/Evolution/Passwords");
sources = mail_config_get_sources ();
@@ -761,7 +771,18 @@ mail_config_write_on_exit (void)
}
g_slist_free (sources);
+ str = g_strdup_printf ("=%s/config/Mail=/Threads/", evolution_dir);
+ gnome_config_push_prefix (str);
+ g_free (str);
+
+ g_hash_table_foreach_remove (config->threaded_hash, threaded_save_state, NULL);
+
+ gnome_config_pop_prefix ();
+
gnome_config_sync ();
+
+ /* now do cleanup */
+ mail_config_clear ();
}
/* Accessor functions */
@@ -772,15 +793,49 @@ mail_config_is_configured (void)
}
gboolean
-mail_config_get_thread_list (void)
+mail_config_get_thread_list (const char *uri)
{
+ if (uri) {
+ gboolean value = FALSE;
+
+ if (!config->threaded_hash)
+ config->threaded_hash = g_hash_table_new (g_str_hash, g_str_equal);
+ else
+ value = GPOINTER_TO_INT (g_hash_table_lookup (config->threaded_hash, uri));
+
+ if (!value) {
+ /* just in case we got a NULL because it just wasn't in the hash table yet */
+ gboolean def;
+ char *str;
+
+ str = g_strdup_printf ("=%s/config/Mail=/Threads/%s", evolution_dir, uri);
+ value = gnome_config_get_bool_with_default (str, &def);
+ g_free (str);
+
+ if (!def) {
+ g_hash_table_insert (config->threaded_hash, g_strdup (uri),
+ GINT_TO_POINTER (value));
+ return value;
+ }
+ } else
+ return value;
+ }
+
+ /* return the default value */
+
return config->thread_list;
}
void
-mail_config_set_thread_list (gboolean value)
+mail_config_set_thread_list (const char *uri, gboolean value)
{
- config->thread_list = value;
+ if (uri) {
+ if (!config->threaded_hash)
+ config->threaded_hash = g_hash_table_new (g_str_hash, g_str_equal);
+
+ g_hash_table_insert (config->threaded_hash, g_strdup (uri), GINT_TO_POINTER (value));
+ } else
+ config->thread_list = value;
}
gboolean
diff --git a/mail/mail-config.h b/mail/mail-config.h
index e4f9b1d020..e71b0878b7 100644
--- a/mail/mail-config.h
+++ b/mail/mail-config.h
@@ -104,8 +104,8 @@ void mail_config_write_on_exit (void);
/* General Accessor functions */
gboolean mail_config_is_configured (void);
-gboolean mail_config_get_thread_list (void);
-void mail_config_set_thread_list (gboolean value);
+gboolean mail_config_get_thread_list (const char *uri);
+void mail_config_set_thread_list (const char *uri, gboolean value);
gboolean mail_config_get_hide_deleted (void);
void mail_config_set_hide_deleted (gboolean value);