diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-12-14 02:52:35 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-12-14 02:52:35 +0800 |
commit | 25a94bfe0cc1b88fc2b50e52fad62ce8b3afd77a (patch) | |
tree | ed624b33c65495be7899ed211c3e6dbab717a846 /mail | |
parent | d08474c3a598ce2d12ed7d912f69f1993f5a5897 (diff) | |
download | gsoc2013-evolution-25a94bfe0cc1b88fc2b50e52fad62ce8b3afd77a.tar.gz gsoc2013-evolution-25a94bfe0cc1b88fc2b50e52fad62ce8b3afd77a.tar.zst gsoc2013-evolution-25a94bfe0cc1b88fc2b50e52fad62ce8b3afd77a.zip |
Get rid of unneeded CamelObject casts. (user_message_response): Don't
2002-12-13 Jeffrey Stedfast <fejj@ximian.com>
* mail-session.c: Get rid of unneeded CamelObject casts.
(user_message_response): Don't unref the dialog object after we've
destroyed it.
* mail-display.c (write_data_to_file): Don't unref the dialog
object after we've destroyed it.
* mail-callbacks.c: Same here.
* component-factory.c: Here too.
* message-tag-editor.c: Added MESSAGE_TAG_EDITOR_GET_CLASS macros.
svn path=/trunk/; revision=19112
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 15 | ||||
-rw-r--r-- | mail/component-factory.c | 34 | ||||
-rw-r--r-- | mail/mail-callbacks.c | 108 | ||||
-rw-r--r-- | mail/mail-display.c | 62 | ||||
-rw-r--r-- | mail/mail-session.c | 325 | ||||
-rw-r--r-- | mail/message-tag-editor.c | 20 | ||||
-rw-r--r-- | mail/message-tag-editor.h | 9 |
7 files changed, 297 insertions, 276 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 27c2c71bfb..5a2df6220b 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,18 @@ +2002-12-13 Jeffrey Stedfast <fejj@ximian.com> + + * mail-session.c: Get rid of unneeded CamelObject casts. + (user_message_response): Don't unref the dialog object after we've + destroyed it. + + * mail-display.c (write_data_to_file): Don't unref the dialog + object after we've destroyed it. + + * mail-callbacks.c: Same here. + + * component-factory.c: Here too. + + * message-tag-editor.c: Added MESSAGE_TAG_EDITOR_GET_CLASS macros. + 2002-12-12 Jeffrey Stedfast <fejj@ximian.com> * mail-accounts.c (mail_accounts_tab_construct): Setup diff --git a/mail/component-factory.c b/mail/component-factory.c index 03aaa2c5b6..43b3076752 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -758,22 +758,22 @@ owner_set_cb (EvolutionShellComponent *shell_component, /* FIXME: should we ref this? */ global_shell_client = shell_client; - g_object_weak_ref(G_OBJECT(shell_client), (GWeakNotify)shell_client_destroy, NULL); + g_object_weak_ref ((GObject *) shell_client, (GWeakNotify) shell_client_destroy, NULL); evolution_dir = g_strdup (evolution_homedir); mail_session_init (); - + async_event = mail_async_event_new(); storages_hash = g_hash_table_new (NULL, NULL); - corba_shell = evolution_shell_client_corba_objref(shell_client); - + corba_shell = evolution_shell_client_corba_objref (shell_client); + for (i = 0; i < sizeof (standard_folders) / sizeof (standard_folders[0]); i++) *standard_folders[i].uri = g_strdup_printf ("file://%s/local/%s", evolution_dir, standard_folders[i].name); vfolder_load_storage(corba_shell); - + accounts = mail_config_get_accounts (); mail_load_storages (corba_shell, accounts); @@ -786,7 +786,7 @@ owner_set_cb (EvolutionShellComponent *shell_component, } mail_autoreceive_setup (); - + { /* setup the global quick-search context */ char *user = g_strdup_printf ("%s/searches.xml", evolution_dir); @@ -809,14 +809,14 @@ owner_set_cb (EvolutionShellComponent *shell_component, if (mail_config_is_corrupt ()) { GtkWidget *dialog; - - dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE, - _("Some of your mail settings seem corrupt, " - "please check that everything is in order.")); - g_signal_connect(dialog, "response", G_CALLBACK(warning_response), NULL); + + dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE, + _("Some of your mail settings seem corrupt, " + "please check that everything is in order.")); + g_signal_connect (dialog, "response", G_CALLBACK (warning_response), NULL); gtk_widget_show (dialog); } - + /* Everything should be ready now */ evolution_folder_info_notify_ready (); } @@ -975,11 +975,11 @@ send_receive_cb (EvolutionShellComponent *shell_component, if (!account || !account->transport) { GtkWidget *dialog; - dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, - _("You have not set a mail transport method")); - gtk_dialog_run((GtkDialog *)dialog); - gtk_widget_destroy(dialog); - + dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, + _("You have not set a mail transport method")); + gtk_dialog_run ((GtkDialog *) dialog); + gtk_widget_destroy (dialog); + return; } diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index 4d655f6950..02c54e5b06 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -79,32 +79,32 @@ if again is != NULL, a checkbox "dont show this again" will appear, and the result stored in *again */ static gboolean -e_question(GtkWindow *parent, int def, gboolean *again, const char *fmt, ...) +e_question (GtkWindow *parent, int def, gboolean *again, const char *fmt, ...) { GtkWidget *mbox, *check = NULL; va_list ap; int button; char *str; - - va_start(ap, fmt); - str = g_strdup_vprintf(fmt, ap); - va_end(ap); - mbox = gtk_message_dialog_new(parent, GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, - "%s", str); - g_free(str); - gtk_dialog_set_default_response ((GtkDialog *)mbox, def); + + va_start (ap, fmt); + str = g_strdup_vprintf (fmt, ap); + va_end (ap); + mbox = gtk_message_dialog_new (parent, GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, + "%s", str); + g_free (str); + gtk_dialog_set_default_response ((GtkDialog *) mbox, def); if (again) { check = gtk_check_button_new_with_label (_("Don't show this message again.")); - gtk_box_pack_start((GtkBox *)((GtkDialog *)mbox)->vbox, check, TRUE, TRUE, 10); - gtk_widget_show(check); + gtk_box_pack_start ((GtkBox *)((GtkDialog *) mbox)->vbox, check, TRUE, TRUE, 10); + gtk_widget_show (check); } - - button = gtk_dialog_run((GtkDialog *)mbox); + + button = gtk_dialog_run ((GtkDialog *) mbox); if (again) *again = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)); - gtk_widget_destroy(mbox); - + gtk_widget_destroy (mbox); + return button == GTK_RESPONSE_YES; } @@ -2255,9 +2255,9 @@ are_you_sure (const char *msg, GPtrArray *uids, FolderBrowser *fb) dialog = gtk_message_dialog_new (FB_WINDOW (fb), GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, msg, uids->len); - button = gtk_dialog_run((GtkDialog *)dialog); - gtk_widget_destroy(dialog); - + button = gtk_dialog_run ((GtkDialog *) dialog); + gtk_widget_destroy (dialog); + if (button != GTK_RESPONSE_OK) { for (i = 0; i < uids->len; i++) g_free (uids->pdata[i]); @@ -2358,9 +2358,9 @@ search_msg (GtkWidget *widget, gpointer user_data) if (fb->mail_display->current_message == NULL) { GtkWidget *dialog; - dialog = gtk_message_dialog_new(FB_WINDOW(fb), GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE, - _("No Message Selected")); + dialog = gtk_message_dialog_new (FB_WINDOW(fb), GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE, + _("No Message Selected")); g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog); gtk_widget_show (dialog); return; @@ -2827,12 +2827,12 @@ filter_edit (BonoboUIComponent *uih, void *user_data, const char *path) } filter_editor = (GtkWidget *)filter_editor_new (fc, filter_source_names); - /* maybe this needs destroy func? */ - gtk_window_set_transient_for((GtkWindow *)filter_editor, FB_WINDOW(fb)); + /* FIXME: maybe this needs destroy func? */ + gtk_window_set_transient_for ((GtkWindow *) filter_editor, FB_WINDOW (fb)); gtk_window_set_title (GTK_WINDOW (filter_editor), _("Filters")); - gtk_dialog_add_button((GtkDialog *)filter_editor, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); - g_object_set_data_full(G_OBJECT(filter_editor), "context", fc, (GtkDestroyNotify)g_object_unref); - g_signal_connect(filter_editor, "response", G_CALLBACK(filter_editor_response), fb); + gtk_dialog_add_button ((GtkDialog *) filter_editor, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); + g_object_set_data_full ((GObject *) filter_editor, "context", fc, (GtkDestroyNotify) g_object_unref); + g_signal_connect (filter_editor, "response", G_CALLBACK (filter_editor_response), fb); gtk_widget_show (GTK_WIDGET (filter_editor)); } @@ -2869,13 +2869,13 @@ footer_print_cb (GtkHTML *html, GnomePrintContext *print_context, double x, double y, double width, double height, gpointer user_data) { struct footer_info *info = (struct footer_info *) user_data; - + if (info->local_font) { - gchar *text = g_strdup_printf (_("Page %d of %d"), info->page_num, info->pages); + char *text = g_strdup_printf (_("Page %d of %d"), info->page_num, info->pages); /*gdouble tw = gnome_font_get_width_string (info->local_font, text);*/ /* FIXME: work out how to measure this */ - gdouble tw = strlen(text) * 8; - + gdouble tw = strlen (text) * 8; + gnome_print_gsave (print_context); gnome_print_newpath (print_context); gnome_print_setrgbcolor (print_context, .0, .0, .0); @@ -2883,7 +2883,7 @@ footer_print_cb (GtkHTML *html, GnomePrintContext *print_context, gnome_print_setfont (print_context, info->local_font); gnome_print_show (print_context, text); gnome_print_grestore (print_context); - + g_free (text); info->page_num++; } @@ -2901,15 +2901,16 @@ static struct footer_info * footer_info_new (GtkHTML *html, GnomePrintContext *pc, gdouble *line) { struct footer_info *info; - + info = g_new (struct footer_info, 1); info->local_font = gnome_font_find_closest ("Helvetica", 10.0); - if (info->local_font) { + + if (info->local_font) *line = gnome_font_get_ascender (info->local_font) + gnome_font_get_descender (info->local_font); - } + info->page_num = 1; info->pages = gtk_html_print_get_pages_num (html, pc, 0.0, *line); - + return info; } @@ -2919,35 +2920,34 @@ do_mail_print (FolderBrowser *fb, gboolean preview) GtkHTML *html; GnomePrintContext *print_context; GnomePrintMaster *print_master; - GnomePrintDialog *dialog; GnomePrintConfig *config = NULL; + GtkDialog *dialog; gdouble line = 0.0; struct footer_info *info; - + if (!preview) { - dialog = GNOME_PRINT_DIALOG (gnome_print_dialog_new (_("Print Message"), - GNOME_PRINT_DIALOG_COPIES)); - gtk_dialog_set_default_response((GtkDialog *)dialog, GNOME_PRINT_DIALOG_RESPONSE_PRINT); - gtk_window_set_transient_for((GtkWindow *)dialog, (GtkWindow *)fb); + dialog = (GtkDialog *) gnome_print_dialog_new (_("Print Message"), GNOME_PRINT_DIALOG_COPIES); + gtk_dialog_set_default_response (dialog, GNOME_PRINT_DIALOG_RESPONSE_PRINT); + gtk_window_set_transient_for ((GtkWindow *) dialog, (GtkWindow *) fb); - switch(gtk_dialog_run((GtkDialog *)dialog)) { + switch (gtk_dialog_run (dialog)) { case GNOME_PRINT_DIALOG_RESPONSE_PRINT: - break; + break; case GNOME_PRINT_DIALOG_RESPONSE_PREVIEW: preview = TRUE; break; default: - gtk_widget_destroy((GtkWidget *)dialog); + gtk_widget_destroy ((GtkWidget *) dialog); return; } - config = gnome_print_dialog_get_config(dialog); - gtk_widget_destroy((GtkWidget *)dialog); + config = gnome_print_dialog_get_config ((GnomePrintDialog *) dialog); + gtk_widget_destroy ((GtkWidget *)dialog); } if (config) { - print_master = gnome_print_master_new_from_config(config); - gnome_print_config_unref(config); + print_master = gnome_print_master_new_from_config (config); + gnome_print_config_unref (config); } else print_master = gnome_print_master_new (); @@ -2978,14 +2978,14 @@ do_mail_print (FolderBrowser *fb, gboolean preview) if (preview){ GtkWidget *preview; - - preview = gnome_print_master_preview_new(print_master, _("Print Preview")); - gtk_widget_show(preview); + + preview = gnome_print_master_preview_new (print_master, _("Print Preview")); + gtk_widget_show (preview); } else { int result = gnome_print_master_print (print_master); if (result == -1) - e_notice(FB_WINDOW(fb), GTK_MESSAGE_ERROR, _("Printing of message failed")); + e_notice (FB_WINDOW (fb), GTK_MESSAGE_ERROR, _("Printing of message failed")); } /* FIXME: We are leaking the GtkHTML object */ @@ -3019,7 +3019,7 @@ done_message_selected (CamelFolder *folder, const char *uid, CamelMimeMessage *m g_free (fb->loaded_uid); fb->loaded_uid = fb->loading_uid; fb->loading_uid = NULL; - + if (msg) do_mail_print (fb, preview); } diff --git a/mail/mail-display.c b/mail/mail-display.c index 45aaa56811..d4a9f9a1f0 100644 --- a/mail/mail-display.c +++ b/mail/mail-display.c @@ -179,17 +179,16 @@ write_data_to_file (CamelMimePart *part, const char *name, gboolean unique) fd = open (name, O_WRONLY | O_CREAT | O_EXCL, 0666); if (fd == -1 && errno == EEXIST && !unique) { - GtkWidget *dlg; + GtkWidget *dialog; int button; - dlg = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, - _("File `%s' already exists.\nOverwrite it?"), - name); + dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, + _("File `%s' already exists.\nOverwrite it?"), + name); - g_object_set (dlg, "title", _("Overwrite file?"), "allow_grow", TRUE, NULL); - button = gtk_dialog_run ((GtkDialog *) dlg); - gtk_widget_destroy (dlg); - g_object_unref (dlg); + g_object_set (dialog, "title", _("Overwrite file?"), "allow_grow", TRUE, NULL); + button = gtk_dialog_run ((GtkDialog *) dialog); + gtk_widget_destroy (dialog); if (button != GTK_RESPONSE_YES) return FALSE; @@ -372,29 +371,31 @@ launch_cb (GtkWidget *widget, gpointer user_data) tmpdir = e_mkdtemp ("evolution.XXXXXX"); if (!tmpdir) { - GtkDialog *dialogue; - - dialogue = (GtkDialog *)gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_ERROR, GTK_RESPONSE_CLOSE, - _("Could not create temporary directory: %s"), - g_strerror (errno)); + GtkWidget *dialog; + + dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_RESPONSE_CLOSE, + _("Could not create temporary directory: %s"), + g_strerror (errno)); + /* FIXME: this should be async */ - gtk_dialog_run(dialogue); - gtk_widget_destroy((GtkWidget *)dialogue); + gtk_dialog_run ((GtkDialog *) dialog); + gtk_widget_destroy (dialog); return; } filename = make_safe_filename (tmpdir, part); if (!write_data_to_file (part, filename, TRUE)) { - GtkDialog *dialogue; - - dialogue = (GtkDialog *)gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_ERROR, GTK_RESPONSE_CLOSE, - _("Could not create temporary file '%s': %s"), - filename, g_strerror (errno)); + GtkWidget *dialog; + + dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_RESPONSE_CLOSE, + _("Could not create temporary file '%s': %s"), + filename, g_strerror (errno)); + /* FIXME: this should be async */ - gtk_dialog_run(dialogue); - gtk_widget_destroy((GtkWidget *)dialogue); - g_free(filename); + gtk_dialog_run ((GtkDialog *) dialog); + gtk_widget_destroy (dialog); + g_free (filename); return; } @@ -879,14 +880,15 @@ drag_data_get_cb (GtkWidget *widget, tmpdir = e_mkdtemp ("drag-n-drop-XXXXXX"); if (!tmpdir) { - GtkDialog *dialogue; - - dialogue = (GtkDialog *)gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_ERROR, GTK_RESPONSE_CLOSE, - _("Could not create temporary directory: %s"), - g_strerror (errno)); + GtkWidget *dialog; + + dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_RESPONSE_CLOSE, + _("Could not create temporary directory: %s"), + g_strerror (errno)); + /* FIXME: this should be async */ - gtk_dialog_run(dialogue); - gtk_widget_destroy((GtkWidget *)dialogue); + gtk_dialog_run ((GtkDialog *) dialog); + gtk_widget_destroy (dialog); } filename = camel_mime_part_get_filename (part); diff --git a/mail/mail-session.c b/mail/mail-session.c index 4b524abdc0..5a46ee76b2 100644 --- a/mail/mail-session.c +++ b/mail/mail-session.c @@ -148,22 +148,22 @@ make_key (CamelService *service, const char *item) /* ********************************************************************** */ -static GtkDialog *password_dialogue = NULL; +static GtkDialog *password_dialog = NULL; static EDList password_list = E_DLIST_INITIALISER(password_list); struct _pass_msg { struct _mail_msg msg; - + CamelSession *session; const char *prompt; gboolean secret; CamelService *service; const char *item; CamelException *ex; - + char *service_url; char *key; - + MailConfigService *config_service; GtkWidget *check; GtkWidget *entry; @@ -174,17 +174,17 @@ struct _pass_msg { static void do_get_pass(struct _mail_msg *mm); static void -pass_response(GtkDialog *dialogue, int button, void *data) +pass_response (GtkDialog *dialog, int button, void *data) { struct _pass_msg *m = data; - - switch(button) { + + switch (button) { case GTK_RESPONSE_OK: { gboolean cache, remember; - m->result = g_strdup(gtk_entry_get_text((GtkEntry *)m->entry)); - remember = cache = m->check?gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (m->check)):FALSE; - + m->result = g_strdup (gtk_entry_get_text ((GtkEntry *) m->entry)); + remember = cache = m->check ? gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (m->check)) : FALSE; + if (m->service_url) { if (m->service) { mail_config_service_set_save_passwd (m->config_service, cache); @@ -209,35 +209,35 @@ pass_response(GtkDialog *dialogue, int button, void *data) } break; } default: - camel_exception_set(m->ex, CAMEL_EXCEPTION_USER_CANCEL, _("User canceled operation.")); + camel_exception_set (m->ex, CAMEL_EXCEPTION_USER_CANCEL, _("User canceled operation.")); break; } - - gtk_widget_destroy((GtkWidget *)dialogue); - - password_dialogue = NULL; - e_msgport_reply((EMsg *)m); - - if ((m = (struct _pass_msg *)e_dlist_remhead(&password_list))) - do_get_pass((struct _mail_msg *)m); + + gtk_widget_destroy ((GtkWidget *) dialog); + + password_dialog = NULL; + e_msgport_reply ((EMsg *)m); + + if ((m = (struct _pass_msg *) e_dlist_remhead (&password_list))) + do_get_pass ((struct _mail_msg *) m); } static void -request_password(struct _pass_msg *m) +request_password (struct _pass_msg *m) { - char *title; const MailConfigAccount *mca = NULL; - - /* If we already have a password_dialogue up, save this request till later */ - if (!m->ismain && password_dialogue) { - e_dlist_addtail(&password_list, (EDListNode *)m); + char *title; + + /* If we already have a password_dialog up, save this request till later */ + if (!m->ismain && password_dialog) { + e_dlist_addtail (&password_list, (EDListNode *)m); return; } - + if (m->service_url) { - if ( (mca = mail_config_get_account_by_source_url(m->service_url)) ) + if ((mca = mail_config_get_account_by_source_url (m->service_url))) m->config_service = mca->source; - else if ( (mca = mail_config_get_account_by_transport_url (m->service_url)) ) + else if ((mca = mail_config_get_account_by_transport_url (m->service_url))) m->config_service = mca->transport; } @@ -245,29 +245,31 @@ request_password(struct _pass_msg *m) title = g_strdup_printf (_("Enter Password for %s"), mca->name); else title = g_strdup (_("Enter Password")); - - password_dialogue = (GtkDialog *)gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, "%s", m->prompt); - g_signal_connect(password_dialogue, "response", G_CALLBACK(pass_response), m); - gtk_window_set_title (GTK_WINDOW (password_dialogue), title); + + password_dialog = (GtkDialog *) gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_QUESTION, + GTK_BUTTONS_OK_CANCEL, "%s", m->prompt); + + g_signal_connect (password_dialog, "response", G_CALLBACK (pass_response), m); + gtk_window_set_title (GTK_WINDOW (password_dialog), title); g_free (title); - - m->entry = gtk_entry_new(); - gtk_entry_set_visibility((GtkEntry *)m->entry, !m->secret); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (password_dialogue)->vbox), m->entry, TRUE, FALSE, 0); - gtk_widget_show(m->entry); - + + m->entry = gtk_entry_new (); + gtk_entry_set_visibility ((GtkEntry *) m->entry, !m->secret); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (password_dialog)->vbox), m->entry, TRUE, FALSE, 0); + gtk_widget_show (m->entry); + if (m->service_url == NULL || m->service != NULL) { - m->check = gtk_check_button_new_with_mnemonic(m->service_url? _("_Remember this password") : - _("_Remember this password for the remainder of this session")); + m->check = gtk_check_button_new_with_mnemonic (m->service_url? _("_Remember this password") : + _("_Remember this password for the remainder of this session")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (m->check), m->config_service->save_passwd); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (password_dialogue)->vbox), m->check, TRUE, FALSE, 0); - gtk_widget_show(m->check); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (password_dialog)->vbox), m->check, TRUE, FALSE, 0); + gtk_widget_show (m->check); } - + if (m->ismain) - gtk_dialog_run(password_dialogue); + gtk_dialog_run (password_dialog); else - gtk_widget_show((GtkWidget *)password_dialogue); + gtk_widget_show ((GtkWidget *) password_dialog); } static void @@ -350,7 +352,7 @@ get_password (CamelSession *session, const char *prompt, gboolean secret, CamelS ret = m->result; mail_msg_free(m); e_msgport_destroy(pass_reply); - + return ret; } @@ -358,7 +360,7 @@ static void main_forget_password (CamelSession *session, CamelService *service, const char *item, CamelException *ex) { char *key = make_key (service, item); - + e_passwords_forget_password ("Mail", key); g_free (key); @@ -373,7 +375,7 @@ forget_password (CamelSession *session, CamelService *service, const char *item, /* ********************************************************************** */ -static GtkDialog *message_dialogue; +static GtkDialog *message_dialog; static EDList message_list = E_DLIST_INITIALISER(password_list); struct _user_message_msg { @@ -391,19 +393,18 @@ static void do_user_message (struct _mail_msg *mm); /* clicked, send back the reply */ static void -user_message_response(GtkDialog *gd, int button, struct _user_message_msg *m) +user_message_response (GtkDialog *dialog, int button, struct _user_message_msg *m) { - gtk_widget_destroy((GtkWidget *)gd); - g_object_unref(gd); - - message_dialogue = NULL; - + gtk_widget_destroy ((GtkWidget *) dialog); + + message_dialog = NULL; + /* if !allow_cancel, then we've already replied */ if (m->allow_cancel) { m->result = button == GTK_RESPONSE_OK; e_msgport_reply((EMsg *)m); } - + /* check for pendings */ if ((m = (struct _user_message_msg *)e_dlist_remhead(&message_list))) do_user_message((struct _mail_msg *)m); @@ -414,12 +415,12 @@ do_user_message (struct _mail_msg *mm) { struct _user_message_msg *m = (struct _user_message_msg *)mm; GtkMessageType msg_type; - - if (!m->ismain && message_dialogue != NULL) { - e_dlist_addtail(&message_list, (EDListNode *)m); + + if (!m->ismain && message_dialog != NULL) { + e_dlist_addtail (&message_list, (EDListNode *)m); return; } - + switch (m->type) { case CAMEL_SESSION_ALERT_INFO: msg_type = GTK_MESSAGE_INFO; @@ -433,25 +434,25 @@ do_user_message (struct _mail_msg *mm) default: msg_type = GTK_MESSAGE_INFO; } - - message_dialogue = (GtkDialog *)gtk_message_dialog_new( + + message_dialog = (GtkDialog *) gtk_message_dialog_new ( NULL, 0, msg_type, - m->allow_cancel?GTK_BUTTONS_OK_CANCEL:GTK_BUTTONS_OK, + m->allow_cancel ? GTK_BUTTONS_OK_CANCEL : GTK_BUTTONS_OK, m->prompt); - gtk_dialog_set_default_response(message_dialogue, m->allow_cancel?GTK_RESPONSE_CANCEL:GTK_RESPONSE_OK); - g_object_set(message_dialogue, "allow_shrink", TRUE, "allow_grow", TRUE, NULL); - + gtk_dialog_set_default_response (message_dialog, m->allow_cancel ? GTK_RESPONSE_CANCEL : GTK_RESPONSE_OK); + g_object_set ((GObject *) message_dialog, "allow_shrink", TRUE, "allow_grow", TRUE, NULL); + /* We only need to wait for the result if we allow cancel otherwise show but send result back instantly */ if (m->allow_cancel) { - g_signal_connect(message_dialogue, "response", G_CALLBACK(user_message_response), m); + g_signal_connect (message_dialog, "response", G_CALLBACK (user_message_response), m); if (m->ismain) - gtk_dialog_run(message_dialogue); + gtk_dialog_run (message_dialog); else - gtk_widget_show((GtkWidget *)message_dialogue); + gtk_widget_show ((GtkWidget *) message_dialog); } else { - gtk_widget_show((GtkWidget *)message_dialogue); + gtk_widget_show ((GtkWidget *) message_dialog); m->result = TRUE; - e_msgport_reply((EMsg *)m); + e_msgport_reply ((EMsg *)m); } } @@ -562,31 +563,31 @@ timeout_timeout (struct _mail_msg *mm) } static void -timeout_done(struct _mail_msg *mm) +timeout_done (struct _mail_msg *mm) { - struct _timeout_msg *m = (struct _timeout_msg *)mm; - MailSession *ms = (MailSession *)m->session; + struct _timeout_msg *m = (struct _timeout_msg *) mm; + MailSession *ms = (MailSession *) m->session; struct _timeout_data *td; - + if (!m->result) { MAIL_SESSION_LOCK(ms, lock); - td = find_timeout(&ms->timeouts, m->id); + td = find_timeout (&ms->timeouts, m->id); if (td) { - e_dlist_remove((EDListNode *)td); + e_dlist_remove ((EDListNode *) td); if (td->timeout_id) - gtk_timeout_remove(td->timeout_id); - g_free(td); + gtk_timeout_remove (td->timeout_id); + g_free (td); } MAIL_SESSION_UNLOCK(ms, lock); } } static void -timeout_free(struct _mail_msg *mm) +timeout_free (struct _mail_msg *mm) { struct _timeout_msg *m = (struct _timeout_msg *)mm; - - camel_object_unref((CamelObject *)m->session); + + camel_object_unref (m->session); } static struct _mail_msg_op timeout_op = { @@ -601,63 +602,63 @@ camel_timeout (gpointer data) { struct _timeout_data *td = data; struct _timeout_msg *m; - + /* stop if we are removed pending */ if (td->removed) return FALSE; - m = mail_msg_new(&timeout_op, NULL, sizeof (*m)); - + m = mail_msg_new (&timeout_op, NULL, sizeof (*m)); + m->session = td->session; - camel_object_ref((CamelObject *)td->session); + camel_object_ref (td->session); m->id = td->id; - e_thread_put(mail_thread_queued, (EMsg *)m); + e_thread_put (mail_thread_queued, (EMsg *)m); return TRUE; } static void -main_register_timeout(CamelSession *session, void *event_data, void *data) +main_register_timeout (CamelSession *session, void *event_data, void *data) { MailSession *ms = (MailSession *)session; unsigned int handle = (unsigned int)event_data; struct _timeout_data *td; - + MAIL_SESSION_LOCK(session, lock); - td = find_timeout(&ms->timeouts, handle); + td = find_timeout (&ms->timeouts, handle); if (td) { if (td->removed) { - e_dlist_remove((EDListNode *)td); + e_dlist_remove ((EDListNode *) td); if (td->timeout_id) - gtk_timeout_remove(td->timeout_id); - g_free(td); + gtk_timeout_remove (td->timeout_id); + g_free (td); } else { - td->timeout_id = gtk_timeout_add(td->interval, camel_timeout, td); + td->timeout_id = gtk_timeout_add (td->interval, camel_timeout, td); } } MAIL_SESSION_UNLOCK(session, lock); - - camel_object_unref((CamelObject *)ms); + + camel_object_unref (ms); } static guint register_timeout (CamelSession *session, guint32 interval, CamelTimeoutCallback cb, gpointer camel_data) { struct _timeout_data *td; - MailSession *ms = (MailSession *)session; + MailSession *ms = (MailSession *) session; guint ret; - + MAIL_SESSION_LOCK(session, lock); - + ret = ms->timeout_id; - ms->timeout_id ++; - + ms->timeout_id++; + /* just debugging, the timeout code now ignores excessive events anyway */ if (interval < 100) - g_warning("Timeout requested %d is small, may cause performance problems", interval); - - td = g_malloc(sizeof(*td)); + g_warning ("Timeout requested %d is small, may cause performance problems", interval); + + td = g_malloc (sizeof (*td)); td->cb = cb; td->camel_data = camel_data; td->interval = interval; @@ -665,34 +666,35 @@ register_timeout (CamelSession *session, guint32 interval, CamelTimeoutCallback td->session = session; td->removed = FALSE; td->busy = FALSE; - e_dlist_addhead(&ms->timeouts, (EDListNode *)td); - + e_dlist_addhead (&ms->timeouts, (EDListNode *) td); + MAIL_SESSION_UNLOCK(session, lock); - - camel_object_ref(ms); - mail_async_event_emit(ms->async, MAIL_ASYNC_GUI, (MailAsyncFunc)main_register_timeout, (CamelObject *)session, (void *)ret, NULL); + + camel_object_ref (ms); + mail_async_event_emit (ms->async, MAIL_ASYNC_GUI, (MailAsyncFunc) main_register_timeout, + (CamelObject *) session, (void *) ret, NULL); return ret; } static void -main_remove_timeout(CamelSession *session, void *event_data, void *data) +main_remove_timeout (CamelSession *session, void *event_data, void *data) { - MailSession *ms = (MailSession *)session; - unsigned int handle = (unsigned int)event_data; + MailSession *ms = (MailSession *) session; + unsigned int handle = (unsigned int) event_data; struct _timeout_data *td; - + MAIL_SESSION_LOCK(session, lock); - td = find_timeout(&ms->timeouts, handle); + td = find_timeout (&ms->timeouts, handle); if (td) { - e_dlist_remove((EDListNode *)td); + e_dlist_remove ((EDListNode *) td); if (td->timeout_id) - gtk_timeout_remove(td->timeout_id); - g_free(td); + gtk_timeout_remove (td->timeout_id); + g_free (td); } MAIL_SESSION_UNLOCK(session, lock); - - camel_object_unref((CamelObject *)ms); + + camel_object_unref (ms); } static gboolean @@ -701,21 +703,21 @@ remove_timeout (CamelSession *session, guint handle) MailSession *ms = (MailSession *)session; struct _timeout_data *td; int remove = FALSE; - + MAIL_SESSION_LOCK(session, lock); - td = find_timeout(&ms->timeouts, handle); + td = find_timeout (&ms->timeouts, handle); if (td && !td->removed) { td->removed = TRUE; remove = TRUE; } MAIL_SESSION_UNLOCK(session, lock); - + if (remove) { - camel_object_ref(ms); - mail_async_event_emit(ms->async, MAIL_ASYNC_GUI, - (MailAsyncFunc)main_remove_timeout, (CamelObject *)session, (void *)handle, NULL); + camel_object_ref (ms); + mail_async_event_emit (ms->async, MAIL_ASYNC_GUI, (MailAsyncFunc) main_remove_timeout, + (CamelObject *) session, (void *) handle, NULL); } else - g_warning("Removing a timeout i dont know about (or twice): %d", handle); + g_warning ("Removing a timeout i dont know about (or twice): %d", handle); return TRUE; } @@ -752,7 +754,7 @@ main_get_filter_driver (CamelSession *session, const char *type, CamelException user = g_strdup_printf ("%s/filters.xml", evolution_dir); system = EVOLUTION_DATADIR "/evolution/filtertypes.xml"; - fc = (RuleContext *)filter_context_new (); + fc = (RuleContext *) filter_context_new (); rule_context_load (fc, system, user); g_free (user); @@ -760,7 +762,7 @@ main_get_filter_driver (CamelSession *session, const char *type, CamelException camel_filter_driver_set_folder_func (driver, get_folder, NULL); if (mail_config_get_filter_log ()) { - MailSession *ms = (MailSession *)session; + MailSession *ms = (MailSession *) session; if (ms->filter_logfile == NULL) { const char *filename; @@ -813,16 +815,15 @@ main_get_filter_driver (CamelSession *session, const char *type, CamelException g_string_truncate (faction, 0); filter_rule_build_code (rule, fsearch); - filter_filter_build_action ((FilterFilter *)rule, faction); + filter_filter_build_action ((FilterFilter *) rule, faction); - camel_filter_driver_add_rule (driver, rule->name, - fsearch->str, faction->str); + camel_filter_driver_add_rule (driver, rule->name, fsearch->str, faction->str); } g_string_free (fsearch, TRUE); g_string_free (faction, TRUE); - g_object_unref(fc); + g_object_unref (fc); return driver; } @@ -830,8 +831,8 @@ main_get_filter_driver (CamelSession *session, const char *type, CamelException static CamelFilterDriver * get_filter_driver (CamelSession *session, const char *type, CamelException *ex) { - return (CamelFilterDriver *)mail_call_main(MAIL_CALL_p_ppp, (MailMainFunc)main_get_filter_driver, - session, type, ex); + return (CamelFilterDriver *) mail_call_main (MAIL_CALL_p_ppp, (MailMainFunc) main_get_filter_driver, + session, type, ex); } char * @@ -840,15 +841,15 @@ mail_session_get_password (const char *url_string) CamelURL *url; char *simple_url; char *passwd; - + url = camel_url_new (url_string, NULL); simple_url = camel_url_to_string (url, CAMEL_URL_HIDE_PASSWORD | CAMEL_URL_HIDE_PARAMS); camel_url_free (url); - + passwd = e_passwords_get_password ("Mail", simple_url); - + g_free (simple_url); - + return passwd; } @@ -858,13 +859,13 @@ mail_session_add_password (const char *url_string, { CamelURL *url; char *simple_url; - + url = camel_url_new (url_string, NULL); simple_url = camel_url_to_string (url, CAMEL_URL_HIDE_PASSWORD | CAMEL_URL_HIDE_PARAMS); camel_url_free (url); - + e_passwords_add_password (simple_url, passwd); - + g_free (simple_url); } @@ -877,9 +878,9 @@ mail_session_remember_password (const char *url_string) url = camel_url_new (url_string, NULL); simple_url = camel_url_to_string (url, CAMEL_URL_HIDE_PASSWORD | CAMEL_URL_HIDE_PARAMS); camel_url_free (url); - + e_passwords_remember_password ("Mail", simple_url); - + g_free (simple_url); } @@ -901,10 +902,10 @@ mail_session_init (void) camel_dir = g_strdup_printf ("%s/mail", evolution_dir); camel_session_construct (session, camel_dir); - + /* The shell will tell us to go online. */ - camel_session_set_online ((CamelSession *)session, FALSE); - + camel_session_set_online ((CamelSession *) session, FALSE); + g_free (camel_dir); } @@ -922,31 +923,31 @@ mail_session_set_interactive (gboolean interactive) if (!interactive) { struct _pass_msg *pm; struct _user_message_msg *um; - - d(printf("Gone non-interactive, checking for outstanding interactive tasks\n")); - + + d(printf ("Gone non-interactive, checking for outstanding interactive tasks\n")); + /* clear out pending password requests */ - while ((pm = (struct _pass_msg *)e_dlist_remhead(&password_list))) { - d(printf("Flushing password request : %s\n", pm->prompt)); - e_msgport_reply((EMsg *)pm); + while ((pm = (struct _pass_msg *) e_dlist_remhead (&password_list))) { + d(printf ("Flushing password request : %s\n", pm->prompt)); + e_msgport_reply ((EMsg *) pm); } - + /* destroy the current */ - if (password_dialogue) { - d(printf("Destroying password dialogue\n")); - gtk_object_destroy((GtkObject *)password_dialogue); + if (password_dialog) { + d(printf ("Destroying password dialogue\n")); + gtk_widget_destroy ((GtkWidget *) password_dialog); } - + /* same for pending user messages */ - while ((um = (struct _user_message_msg *)e_dlist_remhead(&message_list))) { - d(printf("Flusing message request: %s\n", um->prompt)); - e_msgport_reply((EMsg *)um); + while ((um = (struct _user_message_msg *) e_dlist_remhead (&message_list))) { + d(printf ("Flusing message request: %s\n", um->prompt)); + e_msgport_reply((EMsg *) um); } - + /* and the current */ - if (message_dialogue) { + if (message_dialog) { d(printf("Destroying message dialogue\n")); - gtk_object_destroy((GtkObject *)message_dialogue); + gtk_widget_destroy ((GtkWidget *) message_dialog); } } } diff --git a/mail/message-tag-editor.c b/mail/message-tag-editor.c index 5906111f4c..b7d8ca8f86 100644 --- a/mail/message-tag-editor.c +++ b/mail/message-tag-editor.c @@ -25,9 +25,10 @@ #include <config.h> #endif -#include "message-tag-editor.h" #include <gtk/gtkstock.h> +#include "message-tag-editor.h" + static void message_tag_editor_class_init (MessageTagEditorClass *class); static void message_tag_editor_init (MessageTagEditor *editor); static void message_tag_editor_finalise (GObject *obj); @@ -55,7 +56,7 @@ message_tag_editor_get_type (void) (GInstanceInitFunc) message_tag_editor_init, }; - type = g_type_register_static(gtk_dialog_get_type (), "MessageTagEditor", &type_info, 0); + type = g_type_register_static (gtk_dialog_get_type (), "MessageTagEditor", &type_info, 0); } return type; @@ -64,10 +65,9 @@ message_tag_editor_get_type (void) static void message_tag_editor_class_init (MessageTagEditorClass *klass) { - GObjectClass *object_class; + GObjectClass *object_class = G_OBJECT_CLASS (klass); - object_class = (GObjectClass *) klass; - parent_class = g_type_class_ref(gtk_dialog_get_type ()); + parent_class = g_type_class_ref (gtk_dialog_get_type ()); object_class->finalize = message_tag_editor_finalise; @@ -78,7 +78,7 @@ message_tag_editor_class_init (MessageTagEditorClass *klass) static void message_tag_editor_init (MessageTagEditor *editor) { - g_object_set(editor, "allow_shrink", FALSE, "allow_grow", TRUE, NULL); + g_object_set (editor, "allow_shrink", FALSE, "allow_grow", TRUE, NULL); gtk_dialog_add_buttons (GTK_DIALOG (editor), GTK_STOCK_OK, GTK_RESPONSE_OK, @@ -93,9 +93,9 @@ message_tag_editor_init (MessageTagEditor *editor) static void message_tag_editor_finalise (GObject *obj) { - /* MessageTagEditor *editor = (MessageTagEditor *) obj;*/ + /*MessageTagEditor *editor = (MessageTagEditor *) obj;*/ - ((GObjectClass *)(parent_class))->finalize (obj); + G_OBJECT_CLASS (parent_class)->finalize (obj); } static CamelTag * @@ -109,7 +109,7 @@ message_tag_editor_get_tag_list (MessageTagEditor *editor) { g_return_val_if_fail (IS_MESSAGE_TAG_EDITOR (editor), NULL); - return ((MessageTagEditorClass *)(G_OBJECT_GET_CLASS(editor)))->get_tag_list (editor); + return MESSAGE_TAG_EDITOR_GET_CLASS (editor)->get_tag_list (editor); } @@ -126,5 +126,5 @@ message_tag_editor_set_tag_list (MessageTagEditor *editor, CamelTag *tags) g_return_if_fail (IS_MESSAGE_TAG_EDITOR (editor)); g_return_if_fail (tags != NULL); - ((MessageTagEditorClass *)(G_OBJECT_GET_CLASS(editor)))->set_tag_list (editor, tags); + MESSAGE_TAG_EDITOR_GET_CLASS (editor)->set_tag_list (editor, tags); } diff --git a/mail/message-tag-editor.h b/mail/message-tag-editor.h index 92c4364b0f..14a3dc8a8d 100644 --- a/mail/message-tag-editor.h +++ b/mail/message-tag-editor.h @@ -34,9 +34,12 @@ extern "C" { #pragma } #endif /* __cplusplus */ -#define MESSAGE_TAG_EDITOR(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, message_tag_editor_get_type (), MessageTagEditor) -#define MESSAGE_TAG_EDITOR_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, message_tag_editor_get_type (), MessageTagEditorClass) -#define IS_MESSAGE_TAG_EDITOR(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, message_tag_editor_get_type ()) +#define MESSAGE_TYPE_TAG_EDITOR (message_tag_editor_get_type ()) +#define MESSAGE_TAG_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, MESSAGE_TYPE_TAG_EDITOR, MessageTagEditor)) +#define MESSAGE_TAG_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST (klass, MESSAGE_TYPE_TAG_EDITOR, MessageTagEditorClass)) +#define IS_MESSAGE_TAG_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, MESSAGE_TYPE_TAG_EDITOR)) +#define IS_MESSAGE_TAG_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MESSAGE_TYPE_TAG_EDITOR)) +#define MESSAGE_TAG_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MESSAGE_TYPE_TAG_EDITOR, MessageTagEditorClass)) typedef struct _MessageTagEditor MessageTagEditor; typedef struct _MessageTagEditorClass MessageTagEditorClass; |