aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-08-20 12:02:10 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-08-20 12:02:10 +0800
commitac4f13b93e22cc59dbe36ff3a4825bb5077523c4 (patch)
tree6a78647c2ac037ed920249e1b305ba1f231c0829
parent4455dabad1231935ee45c9e028a2c3bafe402d62 (diff)
downloadgsoc2013-evolution-ac4f13b93e22cc59dbe36ff3a4825bb5077523c4.tar.gz
gsoc2013-evolution-ac4f13b93e22cc59dbe36ff3a4825bb5077523c4.tar.zst
gsoc2013-evolution-ac4f13b93e22cc59dbe36ff3a4825bb5077523c4.zip
Allow the activity to be NULL if there isn't a global_shell_client so that
2001-08-19 Jeffrey Stedfast <fejj@ximian.com> * mail-mt.c (do_op_status): Allow the activity to be NULL if there isn't a global_shell_client so that we don't try and report status updates when the shell is destroyed. * mail-config.c (add_shortcut_entry): Return if there isn't a global_shell_client. * component-factory.c (owner_set_cb): set the global_shell_client here and connect to the destroy signal. * mail-vfolder.c (vfolder_create_storage): Use an extern global_shell_client. svn path=/trunk/; revision=12242
-rw-r--r--mail/ChangeLog15
-rw-r--r--mail/component-factory.c23
-rw-r--r--mail/mail-callbacks.c7
-rw-r--r--mail/mail-config.c42
-rw-r--r--mail/mail-local.c8
-rw-r--r--mail/mail-mt.c101
-rw-r--r--mail/mail-vfolder.c10
7 files changed, 122 insertions, 84 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 1727b9b880..d836e25ddc 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,18 @@
+2001-08-19 Jeffrey Stedfast <fejj@ximian.com>
+
+ * mail-mt.c (do_op_status): Allow the activity to be NULL if there
+ isn't a global_shell_client so that we don't try and report status
+ updates when the shell is destroyed.
+
+ * mail-config.c (add_shortcut_entry): Return if there isn't a
+ global_shell_client.
+
+ * component-factory.c (owner_set_cb): set the global_shell_client
+ here and connect to the destroy signal.
+
+ * mail-vfolder.c (vfolder_create_storage): Use an extern
+ global_shell_client.
+
2001-08-19 Christopher James Lahey <clahey@ximian.com>
* mail-callbacks.c (delete_msg): Made delete make the cursor go
diff --git a/mail/component-factory.c b/mail/component-factory.c
index 3370d2277d..89305125de 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -61,6 +61,8 @@ char *default_outbox_folder_uri;
CamelFolder *outbox_folder = NULL;
char *evolution_dir;
+EvolutionShellClient *global_shell_client = NULL;
+
#define COMPONENT_FACTORY_ID "OAFIID:GNOME_Evolution_Mail_ShellComponentFactory"
#define SUMMARY_FACTORY_ID "OAFIID:GNOME_Evolution_Mail_ExecutiveSummaryComponentFactory"
@@ -127,7 +129,7 @@ create_view (EvolutionShellComponent *shell_component,
shell_client = evolution_shell_component_get_owner (shell_component);
corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client));
-
+
if (g_strcasecmp (folder_type, "mail") == 0) {
const char *noselect;
CamelURL *url;
@@ -592,6 +594,12 @@ got_folder (char *uri, CamelFolder *folder, void *data)
}
static void
+shell_client_destroy (GtkObject *object)
+{
+ global_shell_client = NULL;
+}
+
+static void
owner_set_cb (EvolutionShellComponent *shell_component,
EvolutionShellClient *shell_client,
const char *evolution_homedir,
@@ -603,16 +611,19 @@ owner_set_cb (EvolutionShellComponent *shell_component,
const GSList *news;
#endif
int i;
-
- g_print ("evolution-mail: Yeeeh! We have an owner!\n"); /* FIXME */
-
+
+ /* FIXME: should we ref this? */
+ global_shell_client = shell_client;
+ gtk_signal_connect (GTK_OBJECT (shell_client), "destroy",
+ shell_client_destroy, NULL);
+
evolution_dir = g_strdup (evolution_homedir);
mail_session_init ();
storages_hash = g_hash_table_new (NULL, NULL);
-
+
vfolder_create_storage (shell_component);
-
+
corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client));
accounts = mail_config_get_accounts ();
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 429f5928f2..ed98392aa1 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -629,10 +629,11 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char
camel_internet_address_get (sender, 0, &name, &address);
date = camel_mime_message_get_date (message, NULL);
- format = e_utf8_from_locale_string (_("On %a, %Y-%m-%d at %H:%M, %%s wrote:"));
- strftime (date_str, sizeof (date_str), format, localtime (&date));
- g_free (format);
+ strftime (date_str, sizeof (date_str), _("On %a, %Y-%m-%d at %H:%M, %%s wrote:"),
+ localtime (&date));
+ format = e_utf8_from_locale_string (date_str);
text = mail_tool_quote_message (message, date_str, name && *name ? name : address);
+ g_free (format);
if (text) {
e_msg_composer_set_body_text (composer, text);
diff --git a/mail/mail-config.c b/mail/mail-config.c
index 74dbdaf27c..a406ba1367 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -1455,26 +1455,29 @@ add_shortcut_entry (const char *name, const char *uri, const char *type)
GNOME_Evolution_Shortcuts_Group *the_group;
GNOME_Evolution_Shortcuts_Shortcut *the_shortcut;
int i, group_num;
-
+
+ if (!global_shell_client)
+ return;
+
CORBA_exception_init (&ev);
-
+
shortcuts_interface = evolution_shell_client_get_shortcuts_interface (global_shell_client);
if (CORBA_Object_is_nil (shortcuts_interface, &ev)) {
g_warning ("No ::Shortcut interface on the shell");
CORBA_exception_free (&ev);
return;
}
-
+
groups = GNOME_Evolution_Shortcuts__get_groups (shortcuts_interface, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("Exception getting the groups: %s", ev._repo_id);
CORBA_exception_free (&ev);
return;
}
-
+
the_group = NULL;
group_num = 0;
-
+
for (i = 0; i < groups->_length; i++) {
GNOME_Evolution_Shortcuts_Group *iter;
@@ -1485,33 +1488,33 @@ add_shortcut_entry (const char *name, const char *uri, const char *type)
break;
}
}
-
+
if (the_group == NULL) {
/* Bleah, just create it. Probably not the best
* course of action. */
-
+
GNOME_Evolution_Shortcuts_addGroup (shortcuts_interface,
group_num,
"Evolution Shortcuts",
&ev);
-
+
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("Exception recreating \"Evolution Shortcuts\" group: %s", ev._repo_id);
goto cleanup;
}
-
+
the_group = GNOME_Evolution_Shortcuts_getGroup (shortcuts_interface,
group_num,
&ev);
-
+
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("Exception getting newly created \"Evolution Shortcuts\" group: %s", ev._repo_id);
goto cleanup;
}
}
-
+
the_shortcut = NULL;
-
+
for (i = 0; i < the_group->shortcuts._length; i++) {
GNOME_Evolution_Shortcuts_Shortcut *iter;
@@ -1521,30 +1524,29 @@ add_shortcut_entry (const char *name, const char *uri, const char *type)
break;
}
}
-
+
if (the_shortcut == NULL) {
the_shortcut =
GNOME_Evolution_Shortcuts_Shortcut__alloc ();
-
+
the_shortcut->name = CORBA_string_dup (name);
the_shortcut->uri = CORBA_string_dup (uri);
the_shortcut->type = CORBA_string_dup (type);
-
+
GNOME_Evolution_Shortcuts_add (shortcuts_interface,
group_num,
the_group->shortcuts._length,
the_shortcut,
&ev);
-
+
CORBA_free (the_shortcut);
-
+
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("Exception creating shortcut \"%s\": %s", name, ev._repo_id);
goto cleanup;
}
-
- }
-
+ }
+
cleanup:
CORBA_exception_free (&ev);
CORBA_free (groups);
diff --git a/mail/mail-local.c b/mail/mail-local.c
index c32ae707bd..9892aa0ca6 100644
--- a/mail/mail-local.c
+++ b/mail/mail-local.c
@@ -223,10 +223,10 @@ mail_local_store_class_init (MailLocalStoreClass *mail_local_store_class)
CAMEL_STORE_CLASS (mail_local_store_class);
CamelServiceClass *camel_service_class =
CAMEL_SERVICE_CLASS (mail_local_store_class);
-
+
/* virtual method overload */
camel_service_class->get_name = get_name;
-
+
/* Don't cache folders */
camel_store_class->hash_folder_name = NULL;
camel_store_class->compare_folder_name = NULL;
@@ -237,8 +237,8 @@ mail_local_store_class_init (MailLocalStoreClass *mail_local_store_class)
camel_store_class->free_folder_info = camel_store_free_folder_info_full;
camel_store_class->delete_folder = delete_folder;
camel_store_class->rename_folder = rename_folder;
-
- local_parent_class = (CamelStoreClass *)camel_type_get_global_classfuncs(camel_store_get_type ());
+
+ local_parent_class = (CamelStoreClass *)camel_type_get_global_classfuncs (camel_store_get_type ());
}
static void
diff --git a/mail/mail-mt.c b/mail/mail-mt.c
index 41501f8a29..99277d56b4 100644
--- a/mail/mail-mt.c
+++ b/mail/mail-mt.c
@@ -740,31 +740,31 @@ static void do_op_status(struct _mail_msg *mm)
char *out, *p, *o, c;
int pc;
EvolutionActivityClient *activity;
-
- g_assert(mail_gui_thread == pthread_self());
-
- MAIL_MT_LOCK(mail_msg_lock);
-
- msg = g_hash_table_lookup(mail_msg_active, m->data);
+
+ g_assert (mail_gui_thread == pthread_self ());
+
+ MAIL_MT_LOCK (mail_msg_lock);
+
+ msg = g_hash_table_lookup (mail_msg_active, m->data);
if (msg == NULL) {
- MAIL_MT_UNLOCK(mail_msg_lock);
+ MAIL_MT_UNLOCK (mail_msg_lock);
return;
}
-
+
data = msg->priv;
-
- out = alloca(strlen(m->what)*2+1);
+
+ out = alloca (strlen (m->what) * 2 + 1);
o = out;
p = m->what;
while ((c = *p++)) {
- if (c=='%')
+ if (c == '%')
*o++ = '%';
*o++ = c;
}
*o = 0;
-
+
pc = m->pc;
-
+
/* so whats all this crap about:
* When we call activity_client, we have a chance of coming
* back to code that will call mail_msg_new or one of many
@@ -774,60 +774,73 @@ static void do_op_status(struct _mail_msg *mm)
* ... of course we have to be careful in the free function to
* keep track of it too.
*/
- if (data->activity == NULL) {
+ if (data->activity == NULL && global_shell_client) {
char *clientid, *what;
int display;
-
+
/* its being created/removed? well leave it be */
if (data->activity_state == 1 || data->activity_state == 3) {
- MAIL_MT_UNLOCK(mail_msg_lock);
+ MAIL_MT_UNLOCK (mail_msg_lock);
return;
} else {
data->activity_state = 1;
-
+
if (progress_icon[0] == NULL)
- progress_icon[0] = gdk_pixbuf_new_from_xpm_data((const char **)mail_new_xpm);
-
- MAIL_MT_UNLOCK(mail_msg_lock);
- clientid = g_strdup_printf("%p", msg);
+ progress_icon[0] = gdk_pixbuf_new_from_xpm_data ((const char **)mail_new_xpm);
+
+ MAIL_MT_UNLOCK (mail_msg_lock);
+ clientid = g_strdup_printf ("%p", msg);
if (msg->ops->describe_msg)
- what = msg->ops->describe_msg(msg, FALSE);
+ what = msg->ops->describe_msg (msg, FALSE);
else
what = _("Working");
- activity = evolution_activity_client_new(global_shell_client, clientid,
- progress_icon, what, TRUE, &display);
+
+ if (global_shell_client) {
+ activity = evolution_activity_client_new (global_shell_client, clientid,
+ progress_icon, what, TRUE,
+ &display);
+ } else {
+ activity = NULL;
+ }
+
if (msg->ops->describe_msg)
- g_free(what);
- g_free(clientid);
- MAIL_MT_LOCK(mail_msg_lock);
+ g_free (what);
+ g_free (clientid);
+
+ MAIL_MT_LOCK (mail_msg_lock);
if (data->activity_state == 3) {
- MAIL_MT_UNLOCK(mail_msg_lock);
- gtk_object_unref((GtkObject *)activity);
- camel_operation_unref(msg->cancel);
- camel_exception_clear(&msg->ex);
- g_free(msg->priv);
- g_free(msg);
+ MAIL_MT_UNLOCK (mail_msg_lock);
+ if (activity)
+ gtk_object_unref (GTK_OBJECT (activity));
+ camel_operation_unref (msg->cancel);
+ camel_exception_clear (&msg->ex);
+ g_free (msg->priv);
+ g_free (msg);
} else {
data->activity_state = 2;
data->activity = activity;
- MAIL_MT_UNLOCK(mail_msg_lock);
+ MAIL_MT_UNLOCK (mail_msg_lock);
}
return;
}
}
-
+
activity = data->activity;
- gtk_object_ref((GtkObject *)activity);
- MAIL_MT_UNLOCK(mail_msg_lock);
- evolution_activity_client_update(activity, out, (double)(pc/100.0));
- gtk_object_unref((GtkObject *)activity);
+ if (activity) {
+ gtk_object_ref (GTK_OBJECT (activity));
+ MAIL_MT_UNLOCK (mail_msg_lock);
+
+ evolution_activity_client_update (activity, out, (double)(pc/100.0));
+ gtk_object_unref (GTK_OBJECT (activity));
+ }
}
-static void do_op_status_free(struct _mail_msg *mm)
+static void
+do_op_status_free (struct _mail_msg *mm)
{
struct _op_status_msg *m = (struct _op_status_msg *)mm;
- g_free(m->what);
+ g_free (m->what);
}
struct _mail_msg_op op_status_op = {
@@ -838,12 +851,12 @@ struct _mail_msg_op op_status_op = {
};
static void
-mail_operation_status(struct _CamelOperation *op, const char *what, int pc, void *data)
+mail_operation_status (struct _CamelOperation *op, const char *what, int pc, void *data)
{
struct _op_status_msg *m;
-
+
d(printf("got operation statys: %s %d%%\n", what, pc));
-
+
m = mail_msg_new(&op_status_op, NULL, sizeof(*m));
m->op = op;
m->what = g_strdup(what);
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index 4af918e64d..8240b0008c 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -49,8 +49,7 @@ static GList *source_folders; /* list of source folders */
/* Ditto below */
EvolutionStorage *vfolder_storage;
-/* GROSS HACK: for passing to other parts of the program */
-EvolutionShellClient *global_shell_client = NULL;
+extern EvolutionShellClient *global_shell_client;
/* more globals ... */
extern char *evolution_dir;
@@ -265,19 +264,16 @@ vfolder_remove_cb (EvolutionStorage *storage,
void
vfolder_create_storage (EvolutionShellComponent *shell_component)
{
- EvolutionShellClient *shell_client;
GNOME_Evolution_Shell corba_shell;
EvolutionStorage *storage;
char *user, *system;
- shell_client = evolution_shell_component_get_owner (shell_component);
- if (shell_client == NULL) {
+ if (global_shell_client == NULL) {
g_warning ("We have no shell!?");
return;
}
- global_shell_client = shell_client;
- corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client));
+ corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (global_shell_client));
storage = evolution_storage_new (_("VFolders"), NULL, NULL);
if (evolution_storage_register_on_shell (storage, corba_shell) != EVOLUTION_STORAGE_OK) {