aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog17
-rw-r--r--mail/component-factory.c7
-rw-r--r--mail/folder-browser-factory.c42
-rw-r--r--mail/folder-browser.c77
-rw-r--r--mail/folder-browser.h2
-rw-r--r--mail/mail.h2
-rw-r--r--mail/main.c1
7 files changed, 31 insertions, 117 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 1ffb588b60..fd143b4e83 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,22 @@
2000-06-12 Dan Winship <danw@helixcode.com>
+ * folder-browser.c (folder_browser_set_uri): Return the result of
+ folder_browser_load_folder.
+ (get_prop, set_prop, folder_browser_properties_init): Remove. No
+ longer needed.
+
+ * folder-browser-factory.c (folder_browser_factory_new_control):
+ Add a "uri" argument, return NULL if setting it fails.
+ (folder_browser_factory_new_control): Remove property bag stuff.
+ (folder_browser_factory_init, folder_browser_factory): Remove
+ this, since we're using the component factory now.
+
+ * component-factory.c (create_view): Update for
+ folder_browser_factory_new_control change and return NOTFOUND as
+ appropriate.
+
+ * main.c (main): Don't call folder_browser_factory_init.
+
* mail-format.c (mail_generate_reply): Fix the subject generation
so we don't get "Re: Re:". This is working around something that
may later be declared a misfeature in Camel.
diff --git a/mail/component-factory.c b/mail/component-factory.c
index ee69f0da84..605789854f 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -72,7 +72,9 @@ create_view (EvolutionShellComponent *shell_component,
if (g_strcasecmp (folder_type, "mail") != 0)
return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE;
- control = folder_browser_factory_new_control ();
+ control = folder_browser_factory_new_control (physical_uri);
+ if (!control)
+ return EVOLUTION_SHELL_COMPONENT_NOTFOUND;
folder_browser_widget = bonobo_control_get_widget (control);
@@ -85,9 +87,6 @@ create_view (EvolutionShellComponent *shell_component,
gtk_object_set_data((GtkObject *)folder_browser_widget, "e-storage",
gtk_object_get_data((GtkObject *)shell_component, "e-storage"));
- /* FIXME: This never fails. :-/ */
- folder_browser_set_uri (FOLDER_BROWSER (folder_browser_widget), physical_uri);
-
*control_return = control;
return EVOLUTION_SHELL_COMPONENT_OK;
diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c
index 540119d3fd..794f44d96d 100644
--- a/mail/folder-browser-factory.c
+++ b/mail/folder-browser-factory.c
@@ -163,7 +163,7 @@ control_destroy_cb (BonoboControl *control,
}
BonoboControl *
-folder_browser_factory_new_control (void)
+folder_browser_factory_new_control (const char *uri)
{
BonoboControl *control;
GtkWidget *folder_browser;
@@ -172,7 +172,12 @@ folder_browser_factory_new_control (void)
if (folder_browser == NULL)
return NULL;
- gtk_widget_show(folder_browser);
+ if (!folder_browser_set_uri (FOLDER_BROWSER (folder_browser), uri)) {
+ gtk_object_sink (GTK_OBJECT (folder_browser));
+ return NULL;
+ }
+
+ gtk_widget_show (folder_browser);
control = bonobo_control_new (folder_browser);
@@ -186,39 +191,6 @@ folder_browser_factory_new_control (void)
gtk_signal_connect (GTK_OBJECT (control), "destroy",
control_destroy_cb, folder_browser);
-
- bonobo_control_set_property_bag (control,
- FOLDER_BROWSER (folder_browser)->properties);
return control;
}
-
-/*
- * Creates the Folder Browser, wraps it in a Bonobo Control, and
- * sets the Bonobo Control properties to point to the Folder Browser
- * Properties
- */
-static BonoboObject *
-folder_browser_factory (BonoboGenericFactory *factory, void *closure)
-{
- return BONOBO_OBJECT (folder_browser_factory_new_control ());
-}
-
-void
-folder_browser_factory_init (void)
-{
- static BonoboGenericFactory *bonobo_folder_browser_factory = NULL;
-
- if (bonobo_folder_browser_factory != NULL)
- return;
-
- bonobo_folder_browser_factory = bonobo_generic_factory_new (CONTROL_FACTORY_ID,
- folder_browser_factory,
- NULL);
-
- if (bonobo_folder_browser_factory == NULL){
- e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
- _("We are sorry, Evolution's Folder Browser can not be initialized."));
- exit (1);
- }
-}
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index efb1deaa9e..7a6b751842 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -21,14 +21,6 @@
static GtkObjectClass *folder_browser_parent_class;
-#define PROPERTY_FOLDER_URI "folder_uri"
-#define PROPERTY_MESSAGE_PREVIEW "message_preview"
-
-#define PROPERTY_FOLDER_URI_IDX 1
-#define PROPERTY_MESSAGE_PREVIEW_IDX 2
-
-
-
static void
folder_browser_destroy (GtkObject *object)
{
@@ -151,14 +143,14 @@ folder_browser_load_folder (FolderBrowser *fb, const char *name)
#define EQUAL(a,b) (strcmp (a,b) == 0)
-void
+gboolean
folder_browser_set_uri (FolderBrowser *folder_browser, const char *uri)
{
if (folder_browser->uri)
g_free (folder_browser->uri);
folder_browser->uri = g_strdup (uri);
- folder_browser_load_folder (folder_browser, folder_browser->uri);
+ return folder_browser_load_folder (folder_browser, folder_browser->uri);
}
void
@@ -170,70 +162,6 @@ folder_browser_set_message_preview (FolderBrowser *folder_browser, gboolean show
g_warning ("FIXME: implement me");
}
-static void
-get_prop (BonoboPropertyBag *bag,
- BonoboArg *arg,
- guint arg_id,
- gpointer user_data)
-{
- FolderBrowser *fb = user_data;
-
- switch (arg_id) {
-
- case PROPERTY_FOLDER_URI_IDX:
- if (fb && fb->uri)
- BONOBO_ARG_SET_STRING (arg, fb->uri);
- else
- BONOBO_ARG_SET_STRING (arg, "");
- break;
-
- case PROPERTY_MESSAGE_PREVIEW_IDX:
- g_warning ("Implement me; no return value");
- BONOBO_ARG_SET_BOOLEAN (arg, FALSE);
- break;
-
- default:
- g_warning ("Unhandled arg %d\n", arg_id);
- }
-}
-
-static void
-set_prop (BonoboPropertyBag *bag,
- const BonoboArg *arg,
- guint arg_id,
- gpointer user_data)
-{
- FolderBrowser *fb = user_data;
-
- switch (arg_id) {
-
- case PROPERTY_FOLDER_URI_IDX:
- folder_browser_set_uri (fb, BONOBO_ARG_GET_STRING (arg));
- break;
-
- case PROPERTY_MESSAGE_PREVIEW_IDX:
- folder_browser_set_message_preview (fb, BONOBO_ARG_GET_BOOLEAN (arg));
- break;
-
- default:
- g_warning ("Unhandled arg %d\n", arg_id);
- break;
- }
-}
-
-static void
-folder_browser_properties_init (FolderBrowser *fb)
-{
- fb->properties = bonobo_property_bag_new (get_prop, set_prop, fb);
-
- bonobo_property_bag_add (
- fb->properties, PROPERTY_FOLDER_URI, PROPERTY_FOLDER_URI_IDX,
- BONOBO_ARG_STRING, NULL, _("The URI that the Folder Browser will display"), 0);
- bonobo_property_bag_add (
- fb->properties, PROPERTY_MESSAGE_PREVIEW, PROPERTY_MESSAGE_PREVIEW_IDX,
- BONOBO_ARG_BOOLEAN, NULL, _("Whether a message preview should be shown"), 0);
-}
-
static char * search_options[] = {
"Body or subject contains",
"Body contains",
@@ -439,7 +367,6 @@ my_folder_browser_init (GtkObject *object)
gtk_signal_connect (GTK_OBJECT (fb->message_list->etable),
"key_press", GTK_SIGNAL_FUNC (etable_key), fb);
- folder_browser_properties_init (fb);
folder_browser_gui_init (fb);
}
diff --git a/mail/folder-browser.h b/mail/folder-browser.h
index f601d2cb2c..5c385268bd 100644
--- a/mail/folder-browser.h
+++ b/mail/folder-browser.h
@@ -57,7 +57,7 @@ typedef struct {
GtkType folder_browser_get_type (void);
GtkWidget *folder_browser_new (void);
-void folder_browser_set_uri (FolderBrowser *folder_browser,
+gboolean folder_browser_set_uri (FolderBrowser *folder_browser,
const char *uri);
void folder_browser_set_message_preview (FolderBrowser *folder_browser,
gboolean show_message_preview);
diff --git a/mail/mail.h b/mail/mail.h
index 190dfa9272..a63ffdb4ac 100644
--- a/mail/mail.h
+++ b/mail/mail.h
@@ -26,7 +26,7 @@
/* folder-browser-factory */
void folder_browser_factory_init (void);
-BonoboControl *folder_browser_factory_new_control (void);
+BonoboControl *folder_browser_factory_new_control (const char *uri);
/* mail-config */
void mail_config_druid (void);
diff --git a/mail/main.c b/mail/main.c
index 0355c5534c..3e6d924bb1 100644
--- a/mail/main.c
+++ b/mail/main.c
@@ -74,7 +74,6 @@ main (int argc, char *argv [])
session_init ();
e_cursors_init ();
- folder_browser_factory_init ();
component_factory_init ();
bonobo_main ();