diff options
author | Not Zed <NotZed@Ximian.com> | 2002-11-12 22:59:35 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2002-11-12 22:59:35 +0800 |
commit | f9804e11931411358ce98ad5a7726de6d68f2115 (patch) | |
tree | a8fb046c3abbc7c0e07147c21557a3e22504dbda /mail | |
parent | 83f816df158441ca750b0bc12b7ccab2d43c0e43 (diff) | |
download | gsoc2013-evolution-f9804e11931411358ce98ad5a7726de6d68f2115.tar gsoc2013-evolution-f9804e11931411358ce98ad5a7726de6d68f2115.tar.gz gsoc2013-evolution-f9804e11931411358ce98ad5a7726de6d68f2115.tar.bz2 gsoc2013-evolution-f9804e11931411358ce98ad5a7726de6d68f2115.tar.lz gsoc2013-evolution-f9804e11931411358ce98ad5a7726de6d68f2115.tar.xz gsoc2013-evolution-f9804e11931411358ce98ad5a7726de6d68f2115.tar.zst gsoc2013-evolution-f9804e11931411358ce98ad5a7726de6d68f2115.zip |
Commented out stuff that doesn't build yet. Also fixed idl build rule.
2002-11-13 Not Zed <NotZed@Ximian.com>
* Makefile.am: Commented out stuff that doesn't build yet. Also
fixed idl build rule. importers still not built.
* main.c (main): bonobactivationise. remove push visual/colormap.
(main): no longer activate activation, let bonobo_init do it.
* mail-signature-editor.c (menu_help): Change help api.
* mail-session.c (user_message_destroy_noreply): removed. Not
used?
* mail-local.c (load_metainfo): xml root->children.
* mail-format.c (g_string_append_len): Removed, it exists now.
2002-11-12 Not Zed <NotZed@Ximian.com>
* subscribe-dialog.c: gnome2ised, use gtkdialog.
(subscribe_get_global_extras): use a weak ref rather than destroy signal.
* message-tag-followup.c: gnome2ised.
* message-tag-editor.c: gnome2ised & converted to gtkdialog.
* message-list.c: gnome2ised.
(message_list_finalise): From destroy method. maybe should be
destroy still.
* message-browser.c: port to gnome2
(message_browser_finalise): renamed from destroy method.
* mail-stream-gtkhtml.c: removed redundant
camel_class_get_global_classfuncs() call.
* mail-signature-editor.c: gtkdialogised, & bonobo api changes.
* mail-search-dialogue.c: gtkdialogised.
* mail-folder-cache.c: cleaned up camel ref/hook casts.
* mail-composer-prefs.c (mail_composer_prefs_get_type): convert to
gtype.
* mail-font-prefs.c (mail_font_prefs_destroy): from finalise.
* mail-config.c: s/bonobo_config/e_config_listener/
Added /apps/Evolution prefix to the evolution keys.
Changed to use e_config_listener, etc.
(mail_config_init): remove bonobo_config stuff.
(mail_config_check_service): gtk dialogise.
(check_response): from check_cancelled.
* mail-config-druid.c (mail_config_druid_destroy): renamed from
_finalize, turned into destroy handler.
(construct): set type to toplevel, GTK_WINDOW_DIALOG no longer exists.
* mail-config-factory.c (mail_config_register_factory): bonobo api
changes.
* mail-crypto.c (mail_crypto_get_pgp_cipher_context): cleaned up
unref casts.
* mail-display.c (write_data_to_file): gnome->gtkdialog.
(on_link_clicked): use ascii_str*cmp on url.
(save_part): g_path stuff.
(launch_cb): gtk dialog.
(pixmap_press): de-oafify.
(pixbuf_for_mime_type): gnome-vfs api changes.
(do_attachment_header): Change the pixmap to a gtkimage.
(do_signature): "
(pixbuf_gen_idle): "
(do_attachment_header): ascii_str*cmp
(do_attachment_header): gnome pixmap->gtkimage.
(mail_display_destroy): protect against gtk mentalness.
(html_button_press_event): ascii_str*cmp
(drag_data_get_cb): added comment for translators of filename.
* mail-format.c (component_supports): de-oafise.
(is_anonymous): ascii_strncmp
(attachment_header): remove utf8<>locale stuff, and gnomevfs api
changes.
(format_mime_part): fix g_strdown call.
(write_field_row_begin): kill utf8->gtk stuff.
(write_address): "
(default_header_index): ascii_strcasecmp
(handle_text_plain): "
(handle_text_enriched): "
(handle_multipart_encrypted): remove utf/gtk stuff.
(handle_message_external_body): ascii_str*cmp
* mail-identify.c (mail_identify_mime_part):
(identify_by_magic): gnome vfs api changes.
* mail-importer.c: Converted.
* mail-local.c (load_metainfo): xml childs -> children.
(mls_get_folder): g_strerror.
(mls_delete_folder): g_strerror.
(reconfigure_got_folder): Gnome->GtkDialog
(reconfigure_response): from reconfigure_clicked.
* mail-mt.c (mail_msg_check_error): gnome -> gtk dialog
(error_response): renmae from error_gone. destroy widget on any
response.
* mail-offline-handler.c (impl_finalise): renamed from
impl_destroy since thats what it should be anyway.
* mail-ops.c: removed utf8 widget conversion & camel_object_un/ref
casts.
* mail-preferences.c (mail_preferences_get_type): glib2'ised.
* mail-search.c (mail_search_finalise): renmaed from destroy &
properly chain.
(mail_search_get_type): glib2 & make gtkdialog parent.
(entry_run_search): run search when entry activated. not sure if
gtkdialog has anohter way to do this on an arbitrary widget.
* mail-send-recv.c (dialogue_response): renamed from clicked. Use
gtkdialog.
* mail-session.c (request_password_deleted): removed, redundant.
(pass_response): rename from pass_got, changed for gtkdialog.
(user_message_destroy): Removed, redundant.
(user_message_response): Renamed from user_message_clicked.
2002-11-11 Not Zed <NotZed@Ximian.com>
* mail-stream-gtkhtml.c (mail_stream_gtkhtml_class_init): dont use
get_global_classfuncs, just get the type
* mail-tools.c: converted gnome2 api's.
* mail-vfolder.c (vfolder_editor_response): clicked->response.
(vfolder_editor_destroy): Removed.
(vfolder_edit): gtk dialog api
(edit_rule_response): clicked->response.
(vfolder_edit_rule): gnomedialog->gtkdialog.
(vfolder_gui_add_rule): "
(new_rule_clicked): clicked->response
svn path=/trunk/; revision=18723
Diffstat (limited to 'mail')
42 files changed, 1904 insertions, 1966 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 264ffa166e..b85a8c0837 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,148 @@ +2002-11-13 Not Zed <NotZed@Ximian.com> + + * Makefile.am: Commented out stuff that doesn't build yet. Also + fixed idl build rule. importers still not built. + + * main.c (main): bonobactivationise. remove push visual/colormap. + (main): no longer activate activation, let bonobo_init do it. + + * mail-signature-editor.c (menu_help): Change help api. + + * mail-session.c (user_message_destroy_noreply): removed. Not + used? + + * mail-local.c (load_metainfo): xml root->children. + + * mail-format.c (g_string_append_len): Removed, it exists now. + +2002-11-12 Not Zed <NotZed@Ximian.com> + + * subscribe-dialog.c: gnome2ised, use gtkdialog. + (subscribe_get_global_extras): use a weak ref rather than destroy signal. + + * message-tag-followup.c: gnome2ised. + + * message-tag-editor.c: gnome2ised & converted to gtkdialog. + + * message-list.c: gnome2ised. + (message_list_finalise): From destroy method. maybe should be + destroy still. + + * message-browser.c: port to gnome2 + (message_browser_finalise): renamed from destroy method. + + * mail-stream-gtkhtml.c: removed redundant + camel_class_get_global_classfuncs() call. + + * mail-signature-editor.c: gtkdialogised, & bonobo api changes. + + + * mail-search-dialogue.c: gtkdialogised. + + * mail-folder-cache.c: cleaned up camel ref/hook casts. + + * mail-composer-prefs.c (mail_composer_prefs_get_type): convert to + gtype. + + * mail-font-prefs.c (mail_font_prefs_destroy): from finalise. + + * mail-config.c: s/bonobo_config/e_config_listener/ + Added /apps/Evolution prefix to the evolution keys. + Changed to use e_config_listener, etc. + (mail_config_init): remove bonobo_config stuff. + (mail_config_check_service): gtk dialogise. + (check_response): from check_cancelled. + + * mail-config-druid.c (mail_config_druid_destroy): renamed from + _finalize, turned into destroy handler. + (construct): set type to toplevel, GTK_WINDOW_DIALOG no longer exists. + + * mail-config-factory.c (mail_config_register_factory): bonobo api + changes. + + * mail-crypto.c (mail_crypto_get_pgp_cipher_context): cleaned up + unref casts. + + * mail-display.c (write_data_to_file): gnome->gtkdialog. + (on_link_clicked): use ascii_str*cmp on url. + (save_part): g_path stuff. + (launch_cb): gtk dialog. + (pixmap_press): de-oafify. + (pixbuf_for_mime_type): gnome-vfs api changes. + (do_attachment_header): Change the pixmap to a gtkimage. + (do_signature): " + (pixbuf_gen_idle): " + (do_attachment_header): ascii_str*cmp + (do_attachment_header): gnome pixmap->gtkimage. + (mail_display_destroy): protect against gtk mentalness. + (html_button_press_event): ascii_str*cmp + (drag_data_get_cb): added comment for translators of filename. + + * mail-format.c (component_supports): de-oafise. + (is_anonymous): ascii_strncmp + (attachment_header): remove utf8<>locale stuff, and gnomevfs api + changes. + (format_mime_part): fix g_strdown call. + (write_field_row_begin): kill utf8->gtk stuff. + (write_address): " + (default_header_index): ascii_strcasecmp + (handle_text_plain): " + (handle_text_enriched): " + (handle_multipart_encrypted): remove utf/gtk stuff. + (handle_message_external_body): ascii_str*cmp + + * mail-identify.c (mail_identify_mime_part): + (identify_by_magic): gnome vfs api changes. + + * mail-importer.c: Converted. + + * mail-local.c (load_metainfo): xml childs -> children. + (mls_get_folder): g_strerror. + (mls_delete_folder): g_strerror. + (reconfigure_got_folder): Gnome->GtkDialog + (reconfigure_response): from reconfigure_clicked. + + * mail-mt.c (mail_msg_check_error): gnome -> gtk dialog + (error_response): renmae from error_gone. destroy widget on any + response. + + * mail-offline-handler.c (impl_finalise): renamed from + impl_destroy since thats what it should be anyway. + + * mail-ops.c: removed utf8 widget conversion & camel_object_un/ref + casts. + + * mail-preferences.c (mail_preferences_get_type): glib2'ised. + + * mail-search.c (mail_search_finalise): renmaed from destroy & + properly chain. + (mail_search_get_type): glib2 & make gtkdialog parent. + (entry_run_search): run search when entry activated. not sure if + gtkdialog has anohter way to do this on an arbitrary widget. + + * mail-send-recv.c (dialogue_response): renamed from clicked. Use + gtkdialog. + + * mail-session.c (request_password_deleted): removed, redundant. + (pass_response): rename from pass_got, changed for gtkdialog. + (user_message_destroy): Removed, redundant. + (user_message_response): Renamed from user_message_clicked. + +2002-11-11 Not Zed <NotZed@Ximian.com> + + * mail-stream-gtkhtml.c (mail_stream_gtkhtml_class_init): dont use + get_global_classfuncs, just get the type + + * mail-tools.c: converted gnome2 api's. + + * mail-vfolder.c (vfolder_editor_response): clicked->response. + (vfolder_editor_destroy): Removed. + (vfolder_edit): gtk dialog api + (edit_rule_response): clicked->response. + (vfolder_edit_rule): gnomedialog->gtkdialog. + (vfolder_gui_add_rule): " + (new_rule_clicked): clicked->response + 2002-11-11 Jeffrey Stedfast <fejj@ximian.com> * mail-callbacks.c: Half way ported. I'll finish the rest later. diff --git a/mail/Makefile.am b/mail/Makefile.am index 9265aa48d4..0431caf9a7 100644 --- a/mail/Makefile.am +++ b/mail/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = importers +#SUBDIRS = importers bin_PROGRAMS = \ evolution-mail \ @@ -47,46 +47,17 @@ IDL_GENERATED = \ Spell-stubs.c $(IDL_GENERATED): $(SPELL_IDL) - $(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl -I `$(GNOME_CONFIG) --cflags idl` \ - -I `$(GNOME_CONFIG) --datadir`/idl $(srcdir)/Spell.idl + $(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl $(IDL_INCLUDES) $(srcdir)/Spell.idl Spell-impl.o: Spell.h evolution_mail_SOURCES = \ $(EVOLUTION_MAIL_CORBA_GENERATED) \ $(IDL_GENERATED) \ - component-factory.c \ - component-factory.h \ - e-searching-tokenizer.c \ - e-searching-tokenizer.h \ - folder-browser.c \ - folder-browser.h \ - folder-browser-factory.c \ - folder-browser-factory.h \ - folder-browser-ui.c \ - folder-browser-ui.h \ - folder-info.c \ - folder-info.h \ - mail-accounts.c \ - mail-accounts.h \ - mail-account-editor.c \ - mail-account-editor.h \ - mail-account-gui.c \ - mail-account-gui.h \ - mail-autofilter.c \ - mail-autofilter.h \ - mail-callbacks.c \ - mail-callbacks.h \ - mail-composer-prefs.c \ - mail-composer-prefs.h \ - mail-font-prefs.c \ - mail-font-prefs.h \ mail-config.c \ mail-config.h \ mail-config-druid.c \ mail-config-druid.h \ - mail-config-factory.c \ - mail-config-factory.h \ mail-crypto.c \ mail-crypto.h \ mail-display.c \ @@ -105,8 +76,6 @@ evolution_mail_SOURCES = \ mail-offline-handler.h \ mail-ops.c \ mail-ops.h \ - mail-preferences.c \ - mail-preferences.h \ mail-search.c \ mail-search.h \ mail-search-dialogue.c \ @@ -137,6 +106,39 @@ evolution_mail_SOURCES = \ subscribe-dialog.h \ mail.h +# component-factory.c \ +# component-factory.h \ +# e-searching-tokenizer.c \ +# e-searching-tokenizer.h \ +# folder-browser.c \ +# folder-browser.h \ +# folder-browser-factory.c \ +# folder-browser-factory.h \ +# folder-browser-ui.c \ +# folder-browser-ui.h \ +# folder-info.c \ +# folder-info.h \ +# mail-accounts.c \ +# mail-accounts.h \ +# mail-account-editor.c \ +# mail-account-editor.h \ +# mail-account-gui.c \ +# mail-account-gui.h \ +# mail-autofilter.c \ +# mail-autofilter.h \ +# mail-callbacks.c \ +# mail-callbacks.h \ +# mail-composer-prefs.c \ +# mail-composer-prefs.h \ +# mail-font-prefs.c \ +# mail-font-prefs.h \ + +# mail-config-factory.c \ +# mail-config-factory.h \ + +# mail-preferences.c \ +# mail-preferences.h \ + evolution_mail_LDADD = \ $(top_builddir)/camel/libcamel.la \ $(top_builddir)/e-util/libeutil.la \ @@ -165,7 +167,7 @@ oafdir = $(datadir)/oaf oaf_in_files = GNOME_Evolution_Mail.oaf.in oaf_DATA = $(oaf_in_files:.oaf.in=.oaf) -@XML_I18N_MERGE_OAF_RULE@ +@INTLTOOL_SERVER_RULE@ gladedir = $(datadir)/evolution/glade glade_DATA = mail-config.glade local-config.glade subscribe-dialog.glade message-tags.glade @@ -180,8 +182,7 @@ idldir = $(datadir)/idl idl_DATA = Mailer.idl $(EVOLUTION_MAIL_CORBA_GENERATED): Mailer.idl - $(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl -I `$(GNOME_CONFIG) --cflags idl` \ - -I `$(GNOME_CONFIG) --datadir`/idl $(srcdir)/Mailer.idl + $(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl $(IDL_INCLUDES) $(srcdir)/Mailer.idl EXTRA_DIST = \ Mailer.idl \ diff --git a/mail/mail-composer-prefs.c b/mail/mail-composer-prefs.c index b17287685b..35d5670ee7 100644 --- a/mail/mail-composer-prefs.c +++ b/mail/mail-composer-prefs.c @@ -31,7 +31,6 @@ #include <gtk/gtksignal.h> #include <bonobo/bonobo-generic-factory.h> -#include <bonobo/bonobo-object-client.h> #include <gal/widgets/e-gui-utils.h> #include <gal/widgets/e-unicode.h> @@ -55,24 +54,23 @@ static void sig_event_client (MailConfigSigEvent event, MailConfigSignature *sig static GtkVBoxClass *parent_class = NULL; -GtkType +GType mail_composer_prefs_get_type (void) { - static GtkType type = 0; + static GType type = 0; if (!type) { - static const GtkTypeInfo info = { - "MailComposerPrefs", - sizeof (MailComposerPrefs), + static const GTypeInfo info = { sizeof (MailComposerPrefsClass), - (GtkClassInitFunc) mail_composer_prefs_class_init, - (GtkObjectInitFunc) mail_composer_prefs_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + NULL, NULL, + (GClassInitFunc) mail_composer_prefs_class_init, + NULL, NULL, + sizeof (MailComposerPrefs), + 0, + (GInstanceInitFunc) mail_composer_prefs_init, }; - type = gtk_type_unique (gtk_vbox_get_type (), &info); + type = g_type_register_static(gtk_vbox_get_type (), "MailComposerPrefs", &info, 0); } return type; @@ -84,7 +82,7 @@ mail_composer_prefs_class_init (MailComposerPrefsClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass); - parent_class = gtk_type_class (gtk_vbox_get_type ()); + parent_class = g_type_class_ref(gtk_vbox_get_type ()); object_class->destroy = mail_composer_prefs_destroy; gobject_class->finalize = mail_composer_prefs_finalise; @@ -103,11 +101,11 @@ mail_composer_prefs_finalise (GObject *obj) { MailComposerPrefs *prefs = (MailComposerPrefs *) obj; - gtk_object_unref (GTK_OBJECT (prefs->gui)); - gtk_object_unref (GTK_OBJECT (prefs->pman)); - gdk_pixbuf_unref (prefs->enabled_pixbuf); + g_object_unref((prefs->gui)); + g_object_unref((prefs->pman)); + g_object_unref (prefs->enabled_pixbuf); gdk_pixmap_unref (prefs->mark_pixmap); - gdk_bitmap_unref (prefs->mark_bitmap); + g_object_unref (prefs->mark_bitmap); G_OBJECT_CLASS (parent_class)->finalize (obj); } @@ -116,7 +114,7 @@ static void mail_composer_prefs_destroy (GtkObject *obj) { MailComposerPrefs *prefs = (MailComposerPrefs *) obj; - + mail_config_signature_unregister_client ((MailConfigSignatureClient) sig_event_client, prefs); GTK_OBJECT_CLASS (parent_class)->destroy (obj); @@ -127,7 +125,7 @@ attach_style_info (GtkWidget *item, gpointer user_data) { int *style = user_data; - gtk_object_set_data (GTK_OBJECT (item), "style", GINT_TO_POINTER (*style)); + g_object_set_data((item), "style", GINT_TO_POINTER (*style)); (*style)++; } @@ -161,7 +159,7 @@ option_menu_connect (GtkOptionMenu *omenu, gpointer user_data) items = GTK_MENU_SHELL (menu)->children; while (items) { item = items->data; - g_signal_connect (item, "activate", GTK_SIGNAL_FUNC (menu_changed), user_data); + g_signal_connect (item, "activate", G_CALLBACK (menu_changed), user_data); items = items->next; } } @@ -720,14 +718,14 @@ spell_setup (MailComposerPrefs *prefs) spell_load_values (prefs); spell_set_ui (prefs); - glade_xml_signal_connect_data (prefs->gui, "spellColorSet", GTK_SIGNAL_FUNC (spell_color_set), prefs); + glade_xml_signal_connect_data (prefs->gui, "spellColorSet", G_CALLBACK (spell_color_set), prefs); glade_xml_signal_connect_data (prefs->gui, "spellLanguageSelectRow", - GTK_SIGNAL_FUNC (spell_language_select_row), prefs); + G_CALLBACK (spell_language_select_row), prefs); glade_xml_signal_connect_data (prefs->gui, "spellLanguageUnselectRow", - GTK_SIGNAL_FUNC (spell_language_unselect_row), prefs); - glade_xml_signal_connect_data (prefs->gui, "spellLanguageEnable", GTK_SIGNAL_FUNC (spell_language_enable), prefs); + G_CALLBACK (spell_language_unselect_row), prefs); + glade_xml_signal_connect_data (prefs->gui, "spellLanguageEnable", G_CALLBACK (spell_language_enable), prefs); - g_signal_connect (prefs->language, "button_press_event", GTK_SIGNAL_FUNC (spell_language_button_press), prefs); + g_signal_connect (prefs->language, "button_press_event", G_CALLBACK (spell_language_button_press), prefs); } static gboolean @@ -822,7 +820,7 @@ mail_composer_prefs_construct (MailComposerPrefs *prefs) /* Spell Checking: GtkHTML part */ prefs->pman = GTK_HTML_PROPMANAGER (gtk_html_propmanager_new (NULL)); g_signal_connect (prefs->pman, "changed", toggle_button_toggled, prefs); - gtk_object_ref (GTK_OBJECT (prefs->pman)); + g_object_ref((prefs->pman)); gtk_html_propmanager_set_names (prefs->pman, names); gtk_html_propmanager_set_gui (prefs->pman, gui, NULL); @@ -862,25 +860,25 @@ mail_composer_prefs_construct (MailComposerPrefs *prefs) gtk_dialog_add_buttons (dialog, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL); gtk_window_set_title ((GtkWindow *) dialog, _("Add script signature")); - g_signal_connect (dialog, "response", GTK_SIGNAL_FUNC (sig_add_script_response), prefs); + g_signal_connect (dialog, "response", G_CALLBACK (sig_add_script_response), prefs); widget = glade_xml_get_widget (prefs->sig_script_gui, "vbox_add_script_signature"); gtk_box_pack_start_defaults ((GtkBox *) dialog->vbox, widget); prefs->sig_add = GTK_BUTTON (glade_xml_get_widget (gui, "cmdSignatureAdd")); - g_signal_connect (prefs->sig_add, "clicked", GTK_SIGNAL_FUNC (sig_add), prefs); + g_signal_connect (prefs->sig_add, "clicked", G_CALLBACK (sig_add), prefs); glade_xml_signal_connect_data (gui, "cmdSignatureAddScriptClicked", sig_add_script, prefs); prefs->sig_edit = GTK_BUTTON (glade_xml_get_widget (gui, "cmdSignatureEdit")); - g_signal_connect (prefs->sig_edit, "clicked", GTK_SIGNAL_FUNC (sig_edit), prefs); + g_signal_connect (prefs->sig_edit, "clicked", G_CALLBACK (sig_edit), prefs); prefs->sig_delete = GTK_BUTTON (glade_xml_get_widget (gui, "cmdSignatureDelete")); - g_signal_connect (prefs->sig_delete, "clicked", GTK_SIGNAL_FUNC (sig_delete), prefs); + g_signal_connect (prefs->sig_delete, "clicked", G_CALLBACK (sig_delete), prefs); prefs->sig_clist = GTK_CLIST (glade_xml_get_widget (gui, "clistSignatures")); sig_fill_clist (prefs->sig_clist); - g_signal_connect (prefs->sig_clist, "select_row", GTK_SIGNAL_FUNC (sig_row_select), prefs); - g_signal_connect (prefs->sig_clist, "unselect_row", GTK_SIGNAL_FUNC (sig_row_unselect), prefs); + g_signal_connect (prefs->sig_clist, "select_row", G_CALLBACK (sig_row_select), prefs); + g_signal_connect (prefs->sig_clist, "unselect_row", G_CALLBACK (sig_row_unselect), prefs); if (mail_config_get_signature_list () == NULL) { gtk_widget_set_sensitive ((GtkWidget *) prefs->sig_delete, FALSE); gtk_widget_set_sensitive ((GtkWidget *) prefs->sig_edit, FALSE); @@ -889,7 +887,7 @@ mail_composer_prefs_construct (MailComposerPrefs *prefs) /* preview GtkHTML widget */ widget = glade_xml_get_widget (gui, "scrolled-sig"); prefs->sig_preview = (GtkHTML *) gtk_html_new (); - g_signal_connect (prefs->sig_preview, "url_requested", GTK_SIGNAL_FUNC (url_requested), NULL); + g_signal_connect (prefs->sig_preview, "url_requested", G_CALLBACK (url_requested), NULL); gtk_widget_show (GTK_WIDGET (prefs->sig_preview)); gtk_container_add (GTK_CONTAINER (widget), GTK_WIDGET (prefs->sig_preview)); @@ -940,12 +938,12 @@ mail_composer_prefs_apply (MailComposerPrefs *prefs) /* Forwards and Replies */ menu = gtk_option_menu_get_menu (prefs->forward_style); item = gtk_menu_get_active (GTK_MENU (menu)); - val = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (item), "style")); + val = GPOINTER_TO_INT (g_object_get_data((item), "style")); mail_config_set_default_forward_style (val); menu = gtk_option_menu_get_menu (prefs->reply_style); item = gtk_menu_get_active (GTK_MENU (menu)); - val = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (item), "style")); + val = GPOINTER_TO_INT (g_object_get_data((item), "style")); mail_config_set_default_reply_style (val); /* Keyboard Shortcuts */ diff --git a/mail/mail-composer-prefs.h b/mail/mail-composer-prefs.h index 698a35098e..d0cc55592c 100644 --- a/mail/mail-composer-prefs.h +++ b/mail/mail-composer-prefs.h @@ -33,6 +33,7 @@ extern "C" { #include <glade/glade.h> #include <gtkhtml/gtkhtml.h> #include <gtkhtml/gtkhtml-propmanager.h> + #include <libgnomeui/gnome-color-picker.h> #include <libgnomeui/gnome-file-entry.h> #include <gconf/gconf-client.h> @@ -115,7 +116,7 @@ struct _MailComposerPrefsClass { }; -GtkType mail_composer_prefs_get_type (void); +GType mail_composer_prefs_get_type (void); GtkWidget *mail_composer_prefs_new (void); diff --git a/mail/mail-config-druid.c b/mail/mail-config-druid.c index 5d4ff66b86..1922a741c0 100644 --- a/mail/mail-config-druid.c +++ b/mail/mail-config-druid.c @@ -54,7 +54,7 @@ #include <evolution-wizard.h> static void mail_config_druid_class_init (MailConfigDruidClass *class); -static void mail_config_druid_finalize (GtkObject *obj); +static void mail_config_druid_destroy (GtkObject *obj); static GtkWindowClass *parent_class; @@ -88,20 +88,20 @@ typedef struct { GtkType mail_config_druid_get_type (void) { - static GtkType type = 0; + static GType type = 0; if (!type) { - GtkTypeInfo type_info = { - "MailConfigDruid", - sizeof (MailConfigDruid), + GTypeInfo type_info = { sizeof (MailConfigDruidClass), - (GtkClassInitFunc) mail_config_druid_class_init, - (GtkObjectInitFunc) NULL, - (GtkArgSetFunc) NULL, - (GtkArgGetFunc) NULL + NULL, NULL, + (GClassInitFunc) mail_config_druid_class_init, + NULL, NULL, + sizeof (MailConfigDruid), + 0, + (GInstanceInitFunc) NULL, }; - - type = gtk_type_unique (gtk_window_get_type (), &type_info); + + type = g_type_register_static (gtk_window_get_type (), "MailConfigDruid", &type_info, 0); } return type; @@ -113,28 +113,33 @@ mail_config_druid_class_init (MailConfigDruidClass *class) GtkObjectClass *object_class; object_class = (GtkObjectClass *) class; - parent_class = gtk_type_class (gtk_window_get_type ()); + parent_class = g_type_class_ref(gtk_window_get_type ()); /* override methods */ - object_class->finalize = mail_config_druid_finalize; + object_class->destroy = mail_config_druid_destroy; } static void -mail_config_druid_finalize (GtkObject *obj) +mail_config_druid_destroy (GtkObject *obj) { MailConfigDruid *druid = (MailConfigDruid *) obj; CORBA_Environment ev; - gtk_object_destroy (GTK_OBJECT (druid->xml)); + if (druid->xml) { + gtk_object_destroy (GTK_OBJECT (druid->xml)); + g_object_unref(druid->xml); + druid->xml = NULL; - CORBA_exception_init (&ev); - Bonobo_EventSource_removeListener ((Bonobo_EventSource) druid->event_source, druid->id, &ev); - CORBA_exception_free (&ev); + CORBA_exception_init (&ev); + Bonobo_EventSource_removeListener ((Bonobo_EventSource) druid->event_source, + bonobo_object_corba_objref(BONOBO_OBJECT(druid->listener)), &ev); + CORBA_exception_free (&ev); - bonobo_object_release_unref ((Bonobo_Unknown) druid->event_source, &ev); - bonobo_object_unref (BONOBO_OBJECT (druid->listener)); + bonobo_object_release_unref ((Bonobo_Unknown) druid->event_source, &ev); + bonobo_object_unref (BONOBO_OBJECT (druid->listener)); + } - ((GtkObjectClass *)(parent_class))->finalize (obj); + ((GtkObjectClass *)(parent_class))->destroy(obj); } @@ -212,7 +217,7 @@ druid_finish (GnomeDruidPage *page, gpointer arg1, gpointer user_data) { MailConfigDruid *druid = user_data; - gtk_object_set_data (GTK_OBJECT (account_wizard), "account-data", NULL); + g_object_set_data(G_OBJECT(account_wizard), "account-data", NULL); if (page_list != NULL) { g_list_free (page_list); page_list = NULL; @@ -270,12 +275,13 @@ identity_next (EvolutionWizard *wizard, gpointer data) if (!gui->identity_copied) { char *username; - + const char *user; + /* Copy the username part of the email address into * the Username field of the source and transport pages. */ - username = gtk_entry_get_text (gui->gui->email_address); - username = g_strndup (username, strcspn (username, "@")); + user = gtk_entry_get_text (gui->gui->email_address); + username = g_strndup (user, strcspn (user, "@")); gtk_entry_set_text (gui->gui->source.username, username); gtk_entry_set_text (gui->gui->transport.username, username); g_free (username); @@ -395,7 +401,7 @@ static gboolean management_check (MailConfigWizard *wizard) { gboolean next_sensitive; - char *text; + const char *text; text = gtk_entry_get_text (wizard->gui->account_name); next_sensitive = text && *text; @@ -419,7 +425,7 @@ management_prepare (EvolutionWizard *wizard, gpointer data) text = gtk_entry_get_text (gui->gui->account_name); if (!text || *text == '\0') { - name = e_utf8_gtk_entry_get_text (gui->gui->email_address); + name = gtk_entry_get_text(gui->gui->email_address); if (name && *name) { if (mail_config_get_account_by_name (name)) { char *template; @@ -437,7 +443,7 @@ management_prepare (EvolutionWizard *wizard, gpointer data) } while (mail_config_get_account_by_name (name) && i != 0); } - e_utf8_gtk_entry_set_text (gui->gui->account_name, name); + gtk_entry_set_text(gui->gui->account_name, name); } } @@ -461,7 +467,7 @@ static MailConfigAccount * make_account (void) { MailConfigAccount *account; - char *name, *user; + const char *name, *user; struct utsname uts; account = g_new0 (MailConfigAccount, 1); @@ -599,7 +605,8 @@ wizard_listener_event (BonoboListener *listener, gnome_druid_set_buttons_sensitive (GNOME_DRUID (druid->druid), (buttons & 4) >> 2, (buttons & 2) >> 1, - (buttons & 1)); + (buttons & 1), + FALSE); } else if (strcmp (event_name, EVOLUTION_WIZARD_SET_SHOW_FINISH) == 0) { gnome_druid_set_show_finish (GNOME_DRUID (druid->druid), (gboolean) *((CORBA_boolean *)event_data->_value)); @@ -622,11 +629,11 @@ construct (MailConfigDruid *druid) /* Start account wizard */ CORBA_exception_init (&ev); - corba_wizard = oaf_activate_from_id ("OAFIID:GNOME_Evolution_Mail_Wizard", 0, NULL, &ev); + corba_wizard = bonobo_activation_activate_from_id ("OAFIID:GNOME_Evolution_Mail_Wizard", 0, NULL, &ev); CORBA_exception_free (&ev); g_assert (account_wizard != NULL); - druid->xml = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", NULL); + druid->xml = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", NULL, NULL); /* get our toplevel widget and reparent it */ widget = glade_xml_get_widget (druid->xml, "druid"); gtk_widget_reparent (widget, GTK_WIDGET (druid)); @@ -637,17 +644,17 @@ construct (MailConfigDruid *druid) gtk_window_set_title (GTK_WINDOW (druid), _("Evolution Account Assistant")); gtk_window_set_policy (GTK_WINDOW (druid), FALSE, TRUE, FALSE); gtk_window_set_modal (GTK_WINDOW (druid), FALSE); - gtk_object_set (GTK_OBJECT (druid), "type", GTK_WINDOW_DIALOG, NULL); + gtk_object_set (GTK_OBJECT (druid), "type", GTK_WINDOW_TOPLEVEL, NULL); druid->listener = bonobo_listener_new (NULL, NULL); - gtk_signal_connect (GTK_OBJECT (druid->listener), "event-notify", - GTK_SIGNAL_FUNC (wizard_listener_event), druid); + g_signal_connect(druid->listener, "event-notify", + G_CALLBACK (wizard_listener_event), druid); corba_listener = bonobo_object_corba_objref (BONOBO_OBJECT (druid->listener)); CORBA_exception_init (&ev); druid->event_source = (Bonobo_Unknown) bonobo_object_query_interface ( - BONOBO_OBJECT (account_wizard), "IDL:Bonobo/EventSource:1.0"); + BONOBO_OBJECT (account_wizard), "IDL:Bonobo/EventSource:1.0", NULL); g_assert (druid->event_source != CORBA_OBJECT_NIL); - druid->id = Bonobo_EventSource_addListener ((Bonobo_EventSource) druid->event_source, corba_listener, &ev); + Bonobo_EventSource_addListener ((Bonobo_EventSource) druid->event_source, corba_listener, &ev); if (BONOBO_EX (&ev)) { g_warning ("Error adding listener (%s)", CORBA_exception_id (&ev)); @@ -667,15 +674,10 @@ construct (MailConfigDruid *druid) g_hash_table_insert (page_hash, page, GINT_TO_POINTER (i)); page_list = g_list_append (page_list, page); - gtk_signal_connect (GTK_OBJECT (page), "next", - GTK_SIGNAL_FUNC (next_func), druid); - gtk_signal_connect (GTK_OBJECT (page), "prepare", - GTK_SIGNAL_FUNC (prepare_func), druid); - gtk_signal_connect (GTK_OBJECT (page), "back", - GTK_SIGNAL_FUNC (back_func), druid); - - gtk_signal_connect (GTK_OBJECT (page), "finish", - GTK_SIGNAL_FUNC (finish_func), druid); + g_signal_connect(page, "next", G_CALLBACK (next_func), druid); + g_signal_connect(page, "prepare", G_CALLBACK (prepare_func), druid); + g_signal_connect(page, "back", G_CALLBACK (back_func), druid); + g_signal_connect(page, "finish", G_CALLBACK (finish_func), druid); if (i != 5) { Bonobo_Control control; @@ -687,22 +689,19 @@ construct (MailConfigDruid *druid) CORBA_exception_init (&ev); control = GNOME_Evolution_Wizard_getControl (corba_wizard, i, &ev); if (BONOBO_EX (&ev)) { - g_warning ("Error getting page %d: %s", i, - CORBA_exception_id (&ev)); + g_warning ("Error getting page %d: %s", i, CORBA_exception_id (&ev)); CORBA_exception_free (&ev); continue; } - w = bonobo_widget_new_control_from_objref (control, - CORBA_OBJECT_NIL); - gtk_box_pack_start (GTK_BOX (dpage->vbox), w, TRUE, - TRUE, 0); + w = bonobo_widget_new_control_from_objref (control, CORBA_OBJECT_NIL); + gtk_box_pack_start (GTK_BOX (dpage->vbox), w, TRUE, TRUE, 0); gtk_widget_show_all (w); } } - gtk_signal_connect (GTK_OBJECT (druid->druid), "cancel", druid_cancel, druid); + g_signal_connect(druid->druid, "cancel", G_CALLBACK(druid_cancel), druid); - gnome_druid_set_buttons_sensitive (druid->druid, FALSE, TRUE, TRUE); + gnome_druid_set_buttons_sensitive (druid->druid, FALSE, TRUE, TRUE, FALSE); } MailConfigDruid * @@ -710,7 +709,7 @@ mail_config_druid_new (GNOME_Evolution_Shell shell) { MailConfigDruid *new; - new = (MailConfigDruid *) gtk_type_new (mail_config_druid_get_type ()); + new = (MailConfigDruid *) g_object_new(mail_config_druid_get_type(), NULL); construct (new); new->shell = shell; @@ -774,55 +773,35 @@ get_fn (EvolutionWizard *wizard, if (gui->gui == NULL) { if (gui->account == NULL) { gui->account = make_account (); - gtk_object_set_data (GTK_OBJECT (wizard), "account-data", - gui->account); + g_object_set_data(G_OBJECT(wizard), "account-data", gui->account); } gui->gui = mail_account_gui_new (gui->account, NULL); /* set up signals, etc */ - gtk_signal_connect (GTK_OBJECT (gui->gui->account_name), - "changed", management_changed, gui); - gtk_signal_connect (GTK_OBJECT (gui->gui->full_name), - "changed", identity_changed, gui); - gtk_signal_connect (GTK_OBJECT (gui->gui->email_address), - "changed", identity_changed, gui); - gtk_signal_connect (GTK_OBJECT (gui->gui->reply_to), - "changed", identity_changed, gui); - gtk_signal_connect (GTK_OBJECT (gui->gui->source.hostname), - "changed", source_changed, gui); - gtk_signal_connect (GTK_OBJECT (gui->gui->source.username), - "changed", source_changed, gui); - gtk_signal_connect (GTK_OBJECT (gui->gui->source.path), - "changed", source_changed, gui); - gtk_signal_connect (GTK_OBJECT (gui->gui->transport.hostname), - "changed", transport_changed, gui); - gtk_signal_connect (GTK_OBJECT (gui->gui->transport.username), - "changed", transport_changed, gui); - - gtk_signal_connect (GTK_OBJECT (gui->gui->account_name), - "activate", management_activate_cb, gui); - - gtk_signal_connect (GTK_OBJECT (gui->gui->full_name), - "activate", identity_activate_cb, gui); - gtk_signal_connect (GTK_OBJECT (gui->gui->email_address), - "activate", identity_activate_cb, gui); - gtk_signal_connect (GTK_OBJECT (gui->gui->reply_to), - "activate", identity_activate_cb, gui); - gtk_signal_connect (GTK_OBJECT (gui->gui->organization), - "activate", identity_activate_cb, gui); - - gtk_signal_connect (GTK_OBJECT (gui->gui->source.hostname), - "activate", source_activate_cb, gui); - gtk_signal_connect (GTK_OBJECT (gui->gui->source.username), - "activate", source_activate_cb, gui); - gtk_signal_connect (GTK_OBJECT (gui->gui->source.path), - "activate", source_activate_cb, gui); - - gtk_signal_connect (GTK_OBJECT (gui->gui->transport.hostname), - "activate", transport_activate_cb, gui); - gtk_signal_connect (GTK_OBJECT (gui->gui->transport.username), - "activate", transport_activate_cb, gui); + g_signal_connect(gui->gui->account_name, "changed", G_CALLBACK(management_changed), gui); + g_signal_connect(gui->gui->full_name, "changed", G_CALLBACK(identity_changed), gui); + g_signal_connect(gui->gui->email_address, "changed", G_CALLBACK(identity_changed), gui); + g_signal_connect(gui->gui->reply_to,"changed", G_CALLBACK(identity_changed), gui); + g_signal_connect(gui->gui->source.hostname, "changed", G_CALLBACK(source_changed), gui); + g_signal_connect(gui->gui->source.username, "changed", G_CALLBACK(source_changed), gui); + g_signal_connect(gui->gui->source.path, "changed", G_CALLBACK(source_changed), gui); + g_signal_connect(gui->gui->transport.hostname, "changed", G_CALLBACK(transport_changed), gui); + g_signal_connect(gui->gui->transport.username, "changed", G_CALLBACK(transport_changed), gui); + + g_signal_connect(gui->gui->account_name, "activate", G_CALLBACK(management_activate_cb), gui); + + g_signal_connect(gui->gui->full_name, "activate", G_CALLBACK(identity_activate_cb), gui); + g_signal_connect(gui->gui->email_address, "activate", G_CALLBACK(identity_activate_cb), gui); + g_signal_connect(gui->gui->reply_to,"activate", G_CALLBACK(identity_activate_cb), gui); + g_signal_connect(gui->gui->organization, "activate", G_CALLBACK(identity_activate_cb), gui); + + g_signal_connect(gui->gui->source.hostname, "activate", G_CALLBACK(source_activate_cb), gui); + g_signal_connect(gui->gui->source.username, "activate", G_CALLBACK(source_activate_cb), gui); + g_signal_connect(gui->gui->source.path, "activate", G_CALLBACK(source_activate_cb), gui); + + g_signal_connect(gui->gui->transport.hostname, "activate", G_CALLBACK(transport_activate_cb), gui); + g_signal_connect(gui->gui->transport.username, "activate", G_CALLBACK(transport_activate_cb), gui); first_time = TRUE; } @@ -884,39 +863,40 @@ get_fn (EvolutionWizard *wizard, } typedef gboolean (*NextFunc)(EvolutionWizard *wizard, gpointer data); +typedef void (*PrepFunc)(EvolutionWizard *wizard, gpointer data); static struct { NextFunc next_func; - GtkSignalFunc prepare_func; + PrepFunc prepare_func; NextFunc back_func; GtkSignalFunc finish_func; GtkSignalFunc help_func; } wizard_pages[] = { { identity_next, - GTK_SIGNAL_FUNC (identity_prepare), + identity_prepare, NULL, - GTK_SIGNAL_FUNC (NULL), - GTK_SIGNAL_FUNC (NULL) }, + G_CALLBACK (NULL), + G_CALLBACK (NULL) }, { source_next, - GTK_SIGNAL_FUNC (source_prepare), + source_prepare, NULL, - GTK_SIGNAL_FUNC (NULL), - GTK_SIGNAL_FUNC (NULL) }, + G_CALLBACK (NULL), + G_CALLBACK (NULL) }, { NULL, - GTK_SIGNAL_FUNC (extra_prepare), + extra_prepare, NULL, - GTK_SIGNAL_FUNC (NULL), - GTK_SIGNAL_FUNC (NULL) }, + G_CALLBACK (NULL), + G_CALLBACK (NULL) }, { transport_next, - GTK_SIGNAL_FUNC (transport_prepare), + transport_prepare, transport_back, - GTK_SIGNAL_FUNC (NULL), - GTK_SIGNAL_FUNC (NULL) }, + G_CALLBACK (NULL), + G_CALLBACK (NULL) }, { NULL, - GTK_SIGNAL_FUNC (management_prepare), + management_prepare, NULL, - GTK_SIGNAL_FUNC (NULL), - GTK_SIGNAL_FUNC (NULL) } + G_CALLBACK (NULL), + G_CALLBACK (NULL) } }; static void @@ -1008,6 +988,7 @@ wizard_free (MailConfigWizard *wizard) static BonoboObject * evolution_mail_config_wizard_factory_fn (BonoboGenericFactory *factory, + const char *id, void *closure) { EvolutionWizard *wizard; @@ -1026,23 +1007,15 @@ evolution_mail_config_wizard_factory_fn (BonoboGenericFactory *factory, wizard = evolution_wizard_new (get_fn, 5, gui); account_wizard = wizard; - gtk_object_set_data_full (GTK_OBJECT (account_wizard), - "account-data", gui, - (GtkDestroyNotify) wizard_free); + g_object_set_data_full(G_OBJECT(account_wizard), "account-data", gui, (GDestroyNotify) wizard_free); gui->wizard = wizard; - gtk_signal_connect (GTK_OBJECT (wizard), "next", - GTK_SIGNAL_FUNC (wizard_next_cb), gui); - gtk_signal_connect (GTK_OBJECT (wizard), "prepare", - GTK_SIGNAL_FUNC (wizard_prepare_cb), gui); - gtk_signal_connect (GTK_OBJECT (wizard), "back", - GTK_SIGNAL_FUNC (wizard_back_cb), gui); - gtk_signal_connect (GTK_OBJECT (wizard), "finish", - GTK_SIGNAL_FUNC (wizard_finish_cb), gui); - gtk_signal_connect (GTK_OBJECT (wizard), "cancel", - GTK_SIGNAL_FUNC (wizard_cancel_cb), gui); - gtk_signal_connect (GTK_OBJECT (wizard), "help", - GTK_SIGNAL_FUNC (wizard_help_cb), gui); + g_signal_connect(wizard, "next", G_CALLBACK (wizard_next_cb), gui); + g_signal_connect(wizard, "prepare", G_CALLBACK (wizard_prepare_cb), gui); + g_signal_connect(wizard, "back", G_CALLBACK (wizard_back_cb), gui); + g_signal_connect(wizard, "finish", G_CALLBACK (wizard_finish_cb), gui); + g_signal_connect(wizard, "cancel", G_CALLBACK (wizard_cancel_cb), gui); + g_signal_connect(wizard, "help", G_CALLBACK (wizard_help_cb), gui); return BONOBO_OBJECT (wizard); } diff --git a/mail/mail-config-druid.h b/mail/mail-config-druid.h index a85ee97baa..ed9f8d2f76 100644 --- a/mail/mail-config-druid.h +++ b/mail/mail-config-druid.h @@ -53,7 +53,6 @@ typedef struct { gboolean identity_copied; CamelProvider *last_source; - int id; BonoboListener *listener; Bonobo_EventSource event_source; } MailConfigDruid; diff --git a/mail/mail-config-factory.c b/mail/mail-config-factory.c index f7ce73fd38..c34d7a6b55 100644 --- a/mail/mail-config-factory.c +++ b/mail/mail-config-factory.c @@ -51,8 +51,7 @@ config_control_destroy_callback (EvolutionConfigControl *config_control, void *u { struct _config_data *data = user_data; - gtk_widget_unref (data->prefs); - + g_object_unref (data->prefs); g_free (data); } @@ -74,6 +73,7 @@ config_control_factory_cb (BonoboGenericFactory *factory, const char *component_ data = g_new (struct _config_data, 1); + /* TODO: should use ascii_str*cmp? */ if (!strcmp (component_id, MAIL_ACCOUNTS_CONTROL_ID)) { prefs = mail_accounts_tab_new (shell); data->apply = (ApplyFunc) mail_accounts_tab_apply; @@ -91,7 +91,7 @@ config_control_factory_cb (BonoboGenericFactory *factory, const char *component_ } data->prefs = prefs; - gtk_object_ref (GTK_OBJECT (prefs)); + g_object_ref((prefs)); gtk_widget_show_all (prefs); @@ -109,10 +109,8 @@ config_control_factory_cb (BonoboGenericFactory *factory, const char *component_ g_assert_not_reached (); } - gtk_signal_connect (GTK_OBJECT (control), "apply", - GTK_SIGNAL_FUNC (config_control_apply_callback), data); - gtk_signal_connect (GTK_OBJECT (control), "destroy", - GTK_SIGNAL_FUNC (config_control_destroy_callback), data); + g_signal_connect(control, "apply", G_CALLBACK (config_control_apply_callback), data); + g_signal_connect(control, "destroy", G_CALLBACK (config_control_destroy_callback), data); return BONOBO_OBJECT (control); } @@ -122,9 +120,9 @@ mail_config_register_factory (GNOME_Evolution_Shell shell) { g_return_val_if_fail (shell != CORBA_OBJECT_NIL, FALSE); - factory = bonobo_generic_factory_new_multi (CONFIG_CONTROL_FACTORY_ID, - config_control_factory_cb, - shell); + factory = bonobo_generic_factory_new (CONFIG_CONTROL_FACTORY_ID, + config_control_factory_cb, + shell); if (factory != NULL) { return TRUE; diff --git a/mail/mail-config.c b/mail/mail-config.c index fda1d257eb..130e65eae3 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -31,27 +31,25 @@ #include <sys/wait.h> #include <signal.h> #include <errno.h> +#include <string.h> #include <glib.h> +#include <gtk/gtkdialog.h> #include <libgnome/gnome-defs.h> -#include <libgnome/gnome-config.h> -#include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-stock.h> #include <gtkhtml/gtkhtml.h> #include <glade/glade.h> +#include <e-util/e-config-listener.h> #include <bonobo/bonobo-object.h> #include <bonobo/bonobo-generic-factory.h> #include <bonobo/bonobo-context.h> #include <bonobo/bonobo-moniker-util.h> #include <bonobo/bonobo-exception.h> -#include <bonobo-conf/bonobo-config-database.h> #include <shell/evolution-shell-client.h> -#include <gal/util/e-unicode-i18n.h> #include <gal/util/e-util.h> -#include <gal/unicode/gunicode.h> +#include <glib/gunicode.h> #include <gal/widgets/e-gui-utils.h> #include <e-util/e-html-utils.h> #include <e-util/e-url.h> @@ -73,7 +71,7 @@ MailConfigLabel label_defaults[5] = { }; typedef struct { - Bonobo_ConfigDatabase db; + EConfigListener *db; gboolean corrupt; @@ -305,30 +303,11 @@ account_destroy_each (gpointer item, gpointer data) void mail_config_init (void) { - Bonobo_ConfigDatabase db; - CORBA_Environment ev; - if (config) return; - CORBA_exception_init (&ev); - - db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev); - - if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) { - char *err; - g_error ("Very serious error, cannot activate config database '%s'", - (err = bonobo_exception_get_text (&ev))); - g_free (err); - CORBA_exception_free (&ev); - return; - } - - CORBA_exception_free (&ev); - config = g_new0 (MailConfig, 1); - - config->db = db; + config->db = e_config_listener_new(); config_read (); } @@ -377,32 +356,32 @@ config_read_signature (gint i) sig->id = i; - path = g_strdup_printf ("/Mail/Signatures/name_%d", i); - val = bonobo_config_get_string (config->db, path, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Signatures/name_%d", i); + val = e_config_listener_get_string (config->db, path); g_free (path); if (val && *val) sig->name = val; else g_free (val); - path = g_strdup_printf ("/Mail/Signatures/filename_%d", i); - val = bonobo_config_get_string (config->db, path, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Signatures/filename_%d", i); + val = e_config_listener_get_string (config->db, path); g_free (path); if (val && *val) sig->filename = val; else g_free (val); - path = g_strdup_printf ("/Mail/Signatures/script_%d", i); - val = bonobo_config_get_string (config->db, path, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Signatures/script_%d", i); + val = e_config_listener_get_string (config->db, path); g_free (path); if (val && *val) sig->script = val; else g_free (val); - path = g_strdup_printf ("/Mail/Signatures/html_%d", i); - sig->html = bonobo_config_get_boolean_with_default (config->db, path, FALSE, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Signatures/html_%d", i); + sig->html = e_config_listener_get_boolean_with_default (config->db, path, FALSE, NULL); g_free (path); return sig; @@ -415,7 +394,7 @@ config_read_signatures () gint i; config->signature_list = NULL; - config->signatures = bonobo_config_get_long_with_default (config->db, "/Mail/Signatures/num", 0, NULL); + config->signatures = e_config_listener_get_long_with_default (config->db, "/apps/Evolution/Mail/Signatures/num", 0, NULL); for (i = 0; i < config->signatures; i ++) { sig = config_read_signature (i); @@ -430,27 +409,27 @@ config_write_signature (MailConfigSignature *sig, gint i) printf ("config_write_signature i: %d id: %d\n", i, sig->id); - path = g_strdup_printf ("/Mail/Signatures/name_%d", i); - bonobo_config_set_string (config->db, path, sig->name ? sig->name : "", NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Signatures/name_%d", i); + e_config_listener_set_string (config->db, path, sig->name ? sig->name : ""); g_free (path); - path = g_strdup_printf ("/Mail/Signatures/filename_%d", i); - bonobo_config_set_string (config->db, path, sig->filename ? sig->filename : "", NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Signatures/filename_%d", i); + e_config_listener_set_string (config->db, path, sig->filename ? sig->filename : ""); g_free (path); - path = g_strdup_printf ("/Mail/Signatures/script_%d", i); - bonobo_config_set_string (config->db, path, sig->script ? sig->script : "", NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Signatures/script_%d", i); + e_config_listener_set_string (config->db, path, sig->script ? sig->script : ""); g_free (path); - path = g_strdup_printf ("/Mail/Signatures/html_%d", i); - bonobo_config_set_boolean (config->db, path, sig->html, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Signatures/html_%d", i); + e_config_listener_set_boolean (config->db, path, sig->html); g_free (path); } static void config_write_signatures_num () { - bonobo_config_set_long (config->db, "/Mail/Signatures/num", config->signatures, NULL); + e_config_listener_set_long (config->db, "/apps/Evolution/Mail/Signatures/num", config->signatures); } static void @@ -509,7 +488,7 @@ config_import_old_signatures () { int num; - num = bonobo_config_get_long_with_default (config->db, "/Mail/Signatures/num", -1, NULL); + num = e_config_listener_get_long_with_default (config->db, "/apps/Evolution/Mail/Signatures/num", -1, NULL); if (num == -1) { /* there are no signatures defined @@ -519,14 +498,14 @@ config_import_old_signatures () int i, accounts; cache = g_hash_table_new (g_str_hash, g_str_equal); - accounts = bonobo_config_get_long_with_default (config->db, "/Mail/Accounts/num", 0, NULL); + accounts = e_config_listener_get_long_with_default (config->db, "/apps/Evolution/Mail/Accounts/num", 0, NULL); num = 0; for (i = 0; i < accounts; i ++) { char *path, *val; /* read text signature file */ - path = g_strdup_printf ("/Mail/Accounts/identity_signature_%d", i); - val = bonobo_config_get_string (config->db, path, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_signature_%d", i); + val = e_config_listener_get_string (config->db, path); g_free (path); if (val && *val) { gpointer orig_key, node_val; @@ -542,17 +521,17 @@ config_import_old_signatures () } /* set new text signature to this identity */ - path = g_strdup_printf ("/Mail/Accounts/identity_signature_text_%d", i); - bonobo_config_set_long (config->db, path, id, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_signature_text_%d", i); + e_config_listener_set_long (config->db, path, id); g_free (path); } else g_free (val); - path = g_strdup_printf ("/Mail/Accounts/identity_has_html_signature_%d", i); - if (bonobo_config_get_boolean_with_default (config->db, path, FALSE, NULL)) { + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_has_html_signature_%d", i); + if (e_config_listener_get_boolean_with_default (config->db, path, FALSE, NULL)) { g_free (path); - path = g_strdup_printf ("/Mail/Accounts/identity_html_signature_%d", i); - val = bonobo_config_get_string (config->db, path, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_html_signature_%d", i); + val = e_config_listener_get_string (config->db, path); if (val && *val) { gpointer orig_key, node_val; int id; @@ -568,14 +547,14 @@ config_import_old_signatures () /* set new html signature to this identity */ g_free (path); - path = g_strdup_printf ("/Mail/Accounts/identity_signature_html_%d", i); - bonobo_config_set_long (config->db, path, id, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_signature_html_%d", i); + e_config_listener_set_long (config->db, path, id); } else g_free (val); } g_free (path); } - bonobo_config_set_long (config->db, "/Mail/Signatures/num", num, NULL); + e_config_listener_set_long (config->db, "/apps/Evolution/Mail/Signatures/num", num); g_hash_table_destroy (cache); } } @@ -602,8 +581,8 @@ config_read (void) config_import_old_signatures (); config_read_signatures (); - len = bonobo_config_get_long_with_default (config->db, - "/Mail/Accounts/num", 0, NULL); + len = e_config_listener_get_long_with_default (config->db, + "/apps/Evolution/Mail/Accounts/num", 0, NULL); for (i = 0; i < len; i++) { MailConfigAccount *account; @@ -612,53 +591,53 @@ config_read (void) MailConfigService *transport; account = g_new0 (MailConfigAccount, 1); - path = g_strdup_printf ("/Mail/Accounts/account_name_%d", i); - val = bonobo_config_get_string (config->db, path, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_name_%d", i); + val = e_config_listener_get_string (config->db, path); g_free (path); if (val && *val) { account->name = val; } else { g_free (val); - account->name = g_strdup_printf (U_("Account %d"), i + 1); + account->name = g_strdup_printf (_("Account %d"), i + 1); config->corrupt = TRUE; } - path = g_strdup_printf ("/Mail/Accounts/account_drafts_folder_uri_%d", i); - val = bonobo_config_get_string (config->db, path, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_drafts_folder_uri_%d", i); + val = e_config_listener_get_string (config->db, path); g_free (path); if (val && *val) account->drafts_folder_uri = val; else g_free (val); - path = g_strdup_printf ("/Mail/Accounts/account_sent_folder_uri_%d", i); - val = bonobo_config_get_string (config->db, path, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_sent_folder_uri_%d", i); + val = e_config_listener_get_string (config->db, path); g_free (path); if (val && *val) account->sent_folder_uri = val; else g_free (val); - path = g_strdup_printf ("/Mail/Accounts/account_always_cc_%d", i); - account->always_cc = bonobo_config_get_boolean_with_default ( + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_always_cc_%d", i); + account->always_cc = e_config_listener_get_boolean_with_default ( config->db, path, FALSE, NULL); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/account_always_cc_addrs_%d", i); - val = bonobo_config_get_string (config->db, path, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_always_cc_addrs_%d", i); + val = e_config_listener_get_string (config->db, path); g_free (path); if (val && *val) account->cc_addrs = val; else g_free (val); - path = g_strdup_printf ("/Mail/Accounts/account_always_bcc_%d", i); - account->always_bcc = bonobo_config_get_boolean_with_default ( + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_always_bcc_%d", i); + account->always_bcc = e_config_listener_get_boolean_with_default ( config->db, path, FALSE, NULL); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/account_always_bcc_addrs_%d", i); - val = bonobo_config_get_string (config->db, path, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_always_bcc_addrs_%d", i); + val = e_config_listener_get_string (config->db, path); g_free (path); if (val && *val) account->bcc_addrs = val; @@ -666,103 +645,103 @@ config_read (void) g_free (val); /* get the pgp info */ - path = g_strdup_printf ("/Mail/Accounts/account_pgp_key_%d", i); - val = bonobo_config_get_string (config->db, path, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_pgp_key_%d", i); + val = e_config_listener_get_string (config->db, path); g_free (path); if (val && *val) account->pgp_key = val; else g_free (val); - path = g_strdup_printf ("/Mail/Accounts/account_pgp_always_sign_%d", i); - account->pgp_always_sign = bonobo_config_get_boolean_with_default ( + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_pgp_always_sign_%d", i); + account->pgp_always_sign = e_config_listener_get_boolean_with_default ( config->db, path, FALSE, NULL); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/account_pgp_no_imip_sign_%d", i); - account->pgp_no_imip_sign = bonobo_config_get_boolean_with_default ( + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_pgp_no_imip_sign_%d", i); + account->pgp_no_imip_sign = e_config_listener_get_boolean_with_default ( config->db, path, FALSE, NULL); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/account_pgp_encrypt_to_self_%d", i); - account->pgp_encrypt_to_self = bonobo_config_get_boolean_with_default ( + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_pgp_encrypt_to_self_%d", i); + account->pgp_encrypt_to_self = e_config_listener_get_boolean_with_default ( config->db, path, TRUE, NULL); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/account_pgp_always_trust_%d", i); - account->pgp_always_trust = bonobo_config_get_boolean_with_default ( + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_pgp_always_trust_%d", i); + account->pgp_always_trust = e_config_listener_get_boolean_with_default ( config->db, path, FALSE, NULL); g_free (path); /* get the s/mime info */ - path = g_strdup_printf ("/Mail/Accounts/account_smime_key_%d", i); - val = bonobo_config_get_string (config->db, path, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_smime_key_%d", i); + val = e_config_listener_get_string (config->db, path); g_free (path); if (val && *val) account->smime_key = val; else g_free (val); - path = g_strdup_printf ("/Mail/Accounts/account_smime_always_sign_%d", i); - account->smime_always_sign = bonobo_config_get_boolean_with_default ( + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_smime_always_sign_%d", i); + account->smime_always_sign = e_config_listener_get_boolean_with_default ( config->db, path, FALSE, NULL); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/account_smime_encrypt_to_self_%d", i); - account->smime_encrypt_to_self = bonobo_config_get_boolean_with_default ( + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_smime_encrypt_to_self_%d", i); + account->smime_encrypt_to_self = e_config_listener_get_boolean_with_default ( config->db, path, TRUE, NULL); g_free (path); /* get the identity info */ id = g_new0 (MailConfigIdentity, 1); - path = g_strdup_printf ("/Mail/Accounts/identity_name_%d", i); - id->name = bonobo_config_get_string (config->db, path, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_name_%d", i); + id->name = e_config_listener_get_string (config->db, path); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/identity_address_%d", i); - id->address = bonobo_config_get_string (config->db, path, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_address_%d", i); + id->address = e_config_listener_get_string (config->db, path); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/identity_reply_to_%d", i); - id->reply_to = bonobo_config_get_string (config->db, path, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_reply_to_%d", i); + id->reply_to = e_config_listener_get_string (config->db, path); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/identity_organization_%d", i); - id->organization = bonobo_config_get_string (config->db, path, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_organization_%d", i); + id->organization = e_config_listener_get_string (config->db, path); g_free (path); /* id signatures */ - path = g_strdup_printf ("/Mail/Accounts/identity_def_signature_%d", i); - id->def_signature = lookup_signature (bonobo_config_get_long_with_default (config->db, path, -1, NULL)); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_def_signature_%d", i); + id->def_signature = lookup_signature (e_config_listener_get_long_with_default (config->db, path, -1, NULL)); g_free (path); /* autogenerated signature */ - path = g_strdup_printf ("/Mail/Accounts/identity_autogenerated_signature_%d", i); - id->auto_signature = bonobo_config_get_boolean_with_default (config->db, path, TRUE, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_autogenerated_signature_%d", i); + id->auto_signature = e_config_listener_get_boolean_with_default (config->db, path, TRUE, NULL); g_free (path); /* get the source */ source = g_new0 (MailConfigService, 1); - path = g_strdup_printf ("/Mail/Accounts/source_url_%d", i); - val = bonobo_config_get_string (config->db, path, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/source_url_%d", i); + val = e_config_listener_get_string (config->db, path); g_free (path); if (val && *val) source->url = val; else g_free (val); - path = g_strdup_printf ("/Mail/Accounts/source_keep_on_server_%d", i); - source->keep_on_server = bonobo_config_get_boolean (config->db, path, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/source_keep_on_server_%d", i); + source->keep_on_server = e_config_listener_get_boolean (config->db, path); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/source_auto_check_%d", i); - source->auto_check = bonobo_config_get_boolean_with_default ( + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/source_auto_check_%d", i); + source->auto_check = e_config_listener_get_boolean_with_default ( config->db, path, FALSE, NULL); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/source_auto_check_time_%d", i); - source->auto_check_time = bonobo_config_get_long_with_default ( + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/source_auto_check_time_%d", i); + source->auto_check_time = e_config_listener_get_long_with_default ( config->db, path, -1, NULL); if (source->auto_check && source->auto_check_time <= 0) { @@ -772,29 +751,29 @@ config_read (void) g_free (path); - path = g_strdup_printf ("/Mail/Accounts/source_enabled_%d", i); - source->enabled = bonobo_config_get_boolean_with_default ( + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/source_enabled_%d", i); + source->enabled = e_config_listener_get_boolean_with_default ( config->db, path, TRUE, NULL); g_free (path); path = g_strdup_printf - ("/Mail/Accounts/source_save_passwd_%d", i); - source->save_passwd = bonobo_config_get_boolean_with_default ( + ("/apps/Evolution/Mail/Accounts/source_save_passwd_%d", i); + source->save_passwd = e_config_listener_get_boolean_with_default ( config->db, path, TRUE, NULL); g_free (path); /* get the transport */ transport = g_new0 (MailConfigService, 1); - path = g_strdup_printf ("/Mail/Accounts/transport_url_%d", i); - val = bonobo_config_get_string (config->db, path, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/transport_url_%d", i); + val = e_config_listener_get_string (config->db, path); g_free (path); if (val && *val) transport->url = val; else g_free (val); - path = g_strdup_printf ("/Mail/Accounts/transport_save_passwd_%d", i); - transport->save_passwd = bonobo_config_get_boolean (config->db, path, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/transport_save_passwd_%d", i); + transport->save_passwd = e_config_listener_get_boolean (config->db, path); g_free (path); account->id = id; @@ -804,97 +783,100 @@ config_read (void) config->accounts = g_slist_append (config->accounts, account); } - default_num = bonobo_config_get_long_with_default (config->db, - "/Mail/Accounts/default_account", 0, NULL); + default_num = e_config_listener_get_long_with_default (config->db, + "/apps/Evolution/Mail/Accounts/default_account", 0, NULL); mail_config_set_default_account_num (default_num); /* Format */ - config->send_html = bonobo_config_get_boolean_with_default (config->db, - "/Mail/Format/send_html", FALSE, NULL); + config->send_html = e_config_listener_get_boolean_with_default (config->db, + "/apps/Evolution/Mail/Format/send_html", FALSE, NULL); /* Confirm Sending Unwanted HTML */ - config->confirm_unwanted_html = bonobo_config_get_boolean_with_default (config->db, - "/Mail/Format/confirm_unwanted_html", TRUE, NULL); + config->confirm_unwanted_html = e_config_listener_get_boolean_with_default (config->db, + "/apps/Evolution/Mail/Format/confirm_unwanted_html", TRUE, NULL); /* Citation */ - config->citation_highlight = bonobo_config_get_boolean_with_default ( - config->db, "/Mail/Display/citation_highlight", TRUE, NULL); + config->citation_highlight = e_config_listener_get_boolean_with_default ( + config->db, "/apps/Evolution/Mail/Display/citation_highlight", TRUE, NULL); - config->citation_color = bonobo_config_get_long_with_default ( - config->db, "/Mail/Display/citation_color", 0x737373, NULL); + config->citation_color = e_config_listener_get_long_with_default ( + config->db, "/apps/Evolution/Mail/Display/citation_color", 0x737373, NULL); /* Mark as seen toggle */ - config->do_seen_timeout = bonobo_config_get_boolean_with_default ( - config->db, "/Mail/Display/do_seen_timeout", TRUE, NULL); + config->do_seen_timeout = e_config_listener_get_boolean_with_default ( + config->db, "/apps/Evolution/Mail/Display/do_seen_timeout", TRUE, NULL); /* Mark as seen timeout */ - config->seen_timeout = bonobo_config_get_long_with_default (config->db, - "/Mail/Display/seen_timeout", 1500, NULL); + config->seen_timeout = e_config_listener_get_long_with_default (config->db, + "/apps/Evolution/Mail/Display/seen_timeout", 1500, NULL); /* Show Messages Threaded */ - config->thread_list = bonobo_config_get_boolean_with_default ( - config->db, "/Mail/Display/thread_list", FALSE, NULL); + config->thread_list = e_config_listener_get_boolean_with_default ( + config->db, "/apps/Evolution/Mail/Display/thread_list", FALSE, NULL); - config->thread_subject = bonobo_config_get_boolean_with_default ( - config->db, "/Mail/Display/thread_subject", FALSE, NULL); + config->thread_subject = e_config_listener_get_boolean_with_default ( + config->db, "/apps/Evolution/Mail/Display/thread_subject", FALSE, NULL); - config->show_preview = bonobo_config_get_boolean_with_default ( - config->db, "/Mail/Display/preview_pane", TRUE, NULL); + config->show_preview = e_config_listener_get_boolean_with_default ( + config->db, "/apps/Evolution/Mail/Display/preview_pane", TRUE, NULL); /* Hide deleted automatically */ - config->hide_deleted = bonobo_config_get_boolean_with_default ( - config->db, "/Mail/Display/hide_deleted", FALSE, NULL); + config->hide_deleted = e_config_listener_get_boolean_with_default ( + config->db, "/apps/Evolution/Mail/Display/hide_deleted", FALSE, NULL); /* Size of vpaned in mail view */ - config->paned_size = bonobo_config_get_long_with_default (config->db, - "/Mail/Display/paned_size", 200, NULL); + config->paned_size = e_config_listener_get_long_with_default (config->db, + "/apps/Evolution/Mail/Display/paned_size", 200, NULL); /* Goto next folder when user has reached the bottom of the message-list */ - config->goto_next_folder = bonobo_config_get_boolean_with_default ( - config->db, "/Mail/MessageList/goto_next_folder", FALSE, NULL); + config->goto_next_folder = e_config_listener_get_boolean_with_default ( + config->db, "/apps/Evolution/Mail/MessageList/goto_next_folder", FALSE, NULL); /* Empty Subject */ - config->prompt_empty_subject = bonobo_config_get_boolean_with_default ( - config->db, "/Mail/Prompts/empty_subject", TRUE, NULL); + config->prompt_empty_subject = e_config_listener_get_boolean_with_default ( + config->db, "/apps/Evolution/Mail/Prompts/empty_subject", TRUE, NULL); /* Only Bcc */ - config->prompt_only_bcc = bonobo_config_get_boolean_with_default ( - config->db, "/Mail/Prompts/only_bcc", TRUE, NULL); + config->prompt_only_bcc = e_config_listener_get_boolean_with_default ( + config->db, "/apps/Evolution/Mail/Prompts/only_bcc", TRUE, NULL); /* Expunge */ - config->confirm_expunge = bonobo_config_get_boolean_with_default ( - config->db, "/Mail/Prompts/confirm_expunge", TRUE, NULL); + config->confirm_expunge = e_config_listener_get_boolean_with_default ( + config->db, "/apps/Evolution/Mail/Prompts/confirm_expunge", TRUE, NULL); /* Goto next folder */ - config->confirm_goto_next_folder = bonobo_config_get_boolean_with_default ( - config->db, "/Mail/Prompts/confirm_goto_next_folder", TRUE, NULL); + config->confirm_goto_next_folder = e_config_listener_get_boolean_with_default ( + config->db, "/apps/Evolution/Mail/Prompts/confirm_goto_next_folder", TRUE, NULL); /* HTTP images */ - config->http_mode = bonobo_config_get_long_with_default (config->db, - "/Mail/Display/http_images", MAIL_CONFIG_HTTP_NEVER, NULL); + config->http_mode = e_config_listener_get_long_with_default (config->db, + "/apps/Evolution/Mail/Display/http_images", MAIL_CONFIG_HTTP_NEVER, NULL); /* Forwarding */ - config->default_forward_style = bonobo_config_get_long_with_default ( - config->db, "/Mail/Format/default_forward_style", + config->default_forward_style = e_config_listener_get_long_with_default ( + config->db, "/apps/Evolution/Mail/Format/default_forward_style", MAIL_CONFIG_FORWARD_ATTACHED, NULL); /* Replying */ - config->default_reply_style = bonobo_config_get_long_with_default ( - config->db, "/Mail/Format/default_reply_style", + config->default_reply_style = e_config_listener_get_long_with_default ( + config->db, "/apps/Evolution/Mail/Format/default_reply_style", MAIL_CONFIG_REPLY_QUOTED, NULL); /* Message Display */ - config->message_display_style = bonobo_config_get_long_with_default ( - config->db, "/Mail/Format/message_display_style", + config->message_display_style = e_config_listener_get_long_with_default ( + config->db, "/apps/Evolution/Mail/Format/message_display_style", MAIL_CONFIG_DISPLAY_NORMAL, NULL); /* Default charset */ - config->default_charset = bonobo_config_get_string (config->db, - "/Mail/Format/default_charset", NULL); + config->default_charset = e_config_listener_get_string (config->db, + "/apps/Evolution/Mail/Format/default_charset"); if (!config->default_charset) { - g_get_charset (&config->default_charset); + const char *def; + + g_get_charset (&def); + config->default_charset = g_strdup(def); if (!config->default_charset || !g_strcasecmp (config->default_charset, "US-ASCII")) config->default_charset = g_strdup ("ISO-8859-1"); @@ -903,65 +885,65 @@ config_read (void) } /* Trash folders */ - config->empty_trash_on_exit = bonobo_config_get_boolean_with_default ( - config->db, "/Mail/Trash/empty_on_exit", FALSE, NULL); + config->empty_trash_on_exit = e_config_listener_get_boolean_with_default ( + config->db, "/apps/Evolution/Mail/Trash/empty_on_exit", FALSE, NULL); /* Filter logging */ - config->filter_log = bonobo_config_get_boolean_with_default ( - config->db, "/Mail/Filters/log", FALSE, NULL); + config->filter_log = e_config_listener_get_boolean_with_default ( + config->db, "/apps/Evolution/Mail/Filters/log", FALSE, NULL); - config->filter_log_path = bonobo_config_get_string ( - config->db, "/Mail/Filters/log_path", NULL); + config->filter_log_path = e_config_listener_get_string ( + config->db, "/apps/Evolution/Mail/Filters/log_path"); /* New Mail Notification */ - config->notify = bonobo_config_get_long_with_default ( - config->db, "/Mail/Notify/new_mail_notification", + config->notify = e_config_listener_get_long_with_default ( + config->db, "/apps/Evolution/Mail/Notify/new_mail_notification", MAIL_CONFIG_NOTIFY_NOT, NULL); - config->notify_filename = bonobo_config_get_string ( - config->db, "/Mail/Notify/new_mail_notification_sound_file", NULL); + config->notify_filename = e_config_listener_get_string ( + config->db, "/apps/Evolution/Mail/Notify/new_mail_notification_sound_file"); /* X-Mailer header display */ - config->x_mailer_display_style = bonobo_config_get_long_with_default ( - config->db, "/Mail/Display/x_mailer_display_style", + config->x_mailer_display_style = e_config_listener_get_long_with_default ( + config->db, "/apps/Evolution/Mail/Display/x_mailer_display_style", MAIL_CONFIG_XMAILER_NONE, NULL); /* last filesel dir */ - config->last_filesel_dir = bonobo_config_get_string ( - config->db, "/Mail/Filesel/last_filesel_dir", NULL); + config->last_filesel_dir = e_config_listener_get_string ( + config->db, "/apps/Evolution/Mail/Filesel/last_filesel_dir"); /* Color labels */ /* Note: we avoid having to malloc/free 10 times this way... */ - path = g_malloc (sizeof ("/Mail/Labels/") + sizeof ("label_#") + 1); - strcpy (path, "/Mail/Labels/label_#"); + path = g_malloc (sizeof ("/apps/Evolution/Mail/Labels/") + sizeof ("label_#") + 1); + strcpy (path, "/apps/Evolution/Mail/Labels/label_#"); p = path + strlen (path) - 1; for (i = 0; i < 5; i++) { *p = '0' + i; - val = bonobo_config_get_string (config->db, path, NULL); + val = e_config_listener_get_string (config->db, path); if (!(val && *val)) { g_free (val); val = NULL; } config->labels[i].name = val; } - strcpy (path, "/Mail/Labels/color_#"); + strcpy (path, "/apps/Evolution/Mail/Labels/color_#"); p = path + strlen (path) - 1; for (i = 0; i < 5; i++) { *p = '0' + i; - config->labels[i].color = bonobo_config_get_long_with_default (config->db, path, + config->labels[i].color = e_config_listener_get_long_with_default (config->db, path, label_defaults[i].color, NULL); } g_free (path); - config->week_start_day = bonobo_config_get_long_with_default(config->db, "/Calendar/Display/WeekStartDay", 1, NULL); + config->week_start_day = e_config_listener_get_long_with_default(config->db, "/apps/Evolution/Calendar/Display/WeekStartDay", 1, NULL); if (locale_supports_12_hour_format()) { - config->time_24hour = bonobo_config_get_boolean_with_default(config->db, "/Calendar/Display/Use24HourFormat", FALSE, NULL); + config->time_24hour = e_config_listener_get_boolean_with_default(config->db, "/apps/Evolution/Calendar/Display/Use24HourFormat", FALSE, NULL); } else { config->time_24hour = TRUE; } } -#define bonobo_config_set_string_wrapper(db, path, val, ev) bonobo_config_set_string (db, path, val ? val : "", ev) +#define e_config_listener_set_string_wrapper(db, path, val) e_config_listener_set_string (db, path, val ? val : "") void mail_config_write_account_sig (MailConfigAccount *account, gint i) @@ -982,13 +964,13 @@ mail_config_write_account_sig (MailConfigAccount *account, gint i) } /* id signatures */ - path = g_strdup_printf ("/Mail/Accounts/identity_def_signature_%d", i); - bonobo_config_set_long (config->db, path, account->id->def_signature - ? account->id->def_signature->id : -1, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_def_signature_%d", i); + e_config_listener_set_long (config->db, path, account->id->def_signature + ? account->id->def_signature->id : -1); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/identity_autogenerated_signature_%d", i); - bonobo_config_set_boolean (config->db, path, account->id->auto_signature, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_autogenerated_signature_%d", i); + e_config_listener_set_boolean (config->db, path, account->id->auto_signature); g_free (path); } @@ -1002,23 +984,25 @@ mail_config_write (void) if (!config) return; - + +#if 0 + /* FIXME: remove, do we need to do anything about this with e-config-listner? */ CORBA_exception_init (&ev); - Bonobo_ConfigDatabase_removeDir (config->db, "/Mail/Accounts", &ev); + Bonobo_ConfigDatabase_removeDir (config->db, "/apps/Evolution/Mail/Accounts", &ev); CORBA_exception_init (&ev); - Bonobo_ConfigDatabase_removeDir (config->db, "/News/Sources", &ev); + Bonobo_ConfigDatabase_removeDir (config->db, "/apps/Evolution/News/Sources", &ev); CORBA_exception_init (&ev); Bonobo_ConfigDatabase_sync (config->db, &ev); - +#endif + config_write_signatures (); len = g_slist_length (config->accounts); - bonobo_config_set_long (config->db, - "/Mail/Accounts/num", len, NULL); + e_config_listener_set_long (config->db, + "/apps/Evolution/Mail/Accounts/num", len); default_num = mail_config_get_default_account_num (); - bonobo_config_set_long (config->db, - "/Mail/Accounts/default_account", default_num, NULL); + e_config_listener_set_long (config->db, "/apps/Evolution/Mail/Accounts/default_account", default_num); for (i = 0; i < len; i++) { MailConfigAccount *account; @@ -1027,134 +1011,131 @@ mail_config_write (void) account = g_slist_nth_data (config->accounts, i); /* account info */ - path = g_strdup_printf ("/Mail/Accounts/account_name_%d", i); - bonobo_config_set_string_wrapper (config->db, path, account->name, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_name_%d", i); + e_config_listener_set_string_wrapper (config->db, path, account->name); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/account_drafts_folder_uri_%d", i); - bonobo_config_set_string_wrapper (config->db, path, - account->drafts_folder_uri, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_drafts_folder_uri_%d", i); + e_config_listener_set_string_wrapper (config->db, path, account->drafts_folder_uri); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/account_sent_folder_uri_%d", i); - bonobo_config_set_string_wrapper (config->db, path, - account->sent_folder_uri, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_sent_folder_uri_%d", i); + e_config_listener_set_string_wrapper (config->db, path, account->sent_folder_uri); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/account_always_cc_%d", i); - bonobo_config_set_boolean (config->db, path, account->always_cc, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_always_cc_%d", i); + e_config_listener_set_boolean (config->db, path, account->always_cc); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/account_always_cc_addrs_%d", i); - bonobo_config_set_string_wrapper (config->db, path, - account->cc_addrs, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_always_cc_addrs_%d", i); + e_config_listener_set_string_wrapper (config->db, path, account->cc_addrs); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/account_always_bcc_%d", i); - bonobo_config_set_boolean (config->db, path, account->always_bcc, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_always_bcc_%d", i); + e_config_listener_set_boolean (config->db, path, account->always_bcc); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/account_always_bcc_addrs_%d", i); - bonobo_config_set_string_wrapper (config->db, path, - account->bcc_addrs, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_always_bcc_addrs_%d", i); + e_config_listener_set_string_wrapper (config->db, path, account->bcc_addrs); g_free (path); /* account pgp options */ - path = g_strdup_printf ("/Mail/Accounts/account_pgp_key_%d", i); - bonobo_config_set_string_wrapper (config->db, path, account->pgp_key, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_pgp_key_%d", i); + e_config_listener_set_string_wrapper (config->db, path, account->pgp_key); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/account_pgp_always_sign_%d", i); - bonobo_config_set_boolean (config->db, path, account->pgp_always_sign, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_pgp_always_sign_%d", i); + e_config_listener_set_boolean (config->db, path, account->pgp_always_sign); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/account_pgp_no_imip_sign_%d", i); - bonobo_config_set_boolean (config->db, path, account->pgp_no_imip_sign, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_pgp_no_imip_sign_%d", i); + e_config_listener_set_boolean (config->db, path, account->pgp_no_imip_sign); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/account_pgp_encrypt_to_self_%d", i); - bonobo_config_set_boolean (config->db, path, - account->pgp_encrypt_to_self, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_pgp_encrypt_to_self_%d", i); + e_config_listener_set_boolean (config->db, path, account->pgp_encrypt_to_self); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/account_pgp_always_trust_%d", i); - bonobo_config_set_boolean (config->db, path, account->pgp_always_trust, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_pgp_always_trust_%d", i); + e_config_listener_set_boolean (config->db, path, account->pgp_always_trust); g_free (path); /* account s/mime options */ - path = g_strdup_printf ("/Mail/Accounts/account_smime_key_%d", i); - bonobo_config_set_string_wrapper (config->db, path, account->smime_key, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_smime_key_%d", i); + e_config_listener_set_string_wrapper (config->db, path, account->smime_key); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/account_smime_always_sign_%d", i); - bonobo_config_set_boolean (config->db, path, account->smime_always_sign, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_smime_always_sign_%d", i); + e_config_listener_set_boolean (config->db, path, account->smime_always_sign); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/account_smime_encrypt_to_self_%d", i); - bonobo_config_set_boolean (config->db, path, account->smime_encrypt_to_self, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_smime_encrypt_to_self_%d", i); + e_config_listener_set_boolean (config->db, path, account->smime_encrypt_to_self); g_free (path); /* identity info */ - path = g_strdup_printf ("/Mail/Accounts/identity_name_%d", i); - bonobo_config_set_string_wrapper (config->db, path, account->id->name, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_name_%d", i); + e_config_listener_set_string_wrapper (config->db, path, account->id->name); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/identity_address_%d", i); - bonobo_config_set_string_wrapper (config->db, path, account->id->address, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_address_%d", i); + e_config_listener_set_string_wrapper (config->db, path, account->id->address); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/identity_reply_to_%d", i); - bonobo_config_set_string_wrapper (config->db, path, account->id->reply_to, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_reply_to_%d", i); + e_config_listener_set_string_wrapper (config->db, path, account->id->reply_to); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/identity_organization_%d", i); - bonobo_config_set_string_wrapper (config->db, path, account->id->organization, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_organization_%d", i); + e_config_listener_set_string_wrapper (config->db, path, account->id->organization); g_free (path); mail_config_write_account_sig (account, i); - path = g_strdup_printf ("/Mail/Accounts/identity_autogenerated_signature_%d", i); - bonobo_config_set_boolean (config->db, path, account->id->auto_signature, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_autogenerated_signature_%d", i); + e_config_listener_set_boolean (config->db, path, account->id->auto_signature); g_free (path); /* source info */ - path = g_strdup_printf ("/Mail/Accounts/source_url_%d", i); - bonobo_config_set_string_wrapper (config->db, path, account->source->url, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/source_url_%d", i); + e_config_listener_set_string_wrapper (config->db, path, account->source->url); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/source_keep_on_server_%d", i); - bonobo_config_set_boolean (config->db, path, account->source->keep_on_server, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/source_keep_on_server_%d", i); + e_config_listener_set_boolean (config->db, path, account->source->keep_on_server); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/source_auto_check_%d", i); - bonobo_config_set_boolean (config->db, path, account->source->auto_check, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/source_auto_check_%d", i); + e_config_listener_set_boolean (config->db, path, account->source->auto_check); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/source_auto_check_time_%d", i); - bonobo_config_set_long (config->db, path, account->source->auto_check_time, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/source_auto_check_time_%d", i); + e_config_listener_set_long (config->db, path, account->source->auto_check_time); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/source_enabled_%d", i); - bonobo_config_set_boolean (config->db, path, account->source->enabled, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/source_enabled_%d", i); + e_config_listener_set_boolean (config->db, path, account->source->enabled); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/source_save_passwd_%d", i); - bonobo_config_set_boolean (config->db, path, account->source->save_passwd, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/source_save_passwd_%d", i); + e_config_listener_set_boolean (config->db, path, account->source->save_passwd); g_free (path); /* transport info */ - path = g_strdup_printf ("/Mail/Accounts/transport_url_%d", i); - bonobo_config_set_string_wrapper (config->db, path, account->transport->url, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/transport_url_%d", i); + e_config_listener_set_string_wrapper (config->db, path, account->transport->url); g_free (path); - path = g_strdup_printf ("/Mail/Accounts/transport_save_passwd_%d", i); - bonobo_config_set_boolean (config->db, path, account->transport->save_passwd, NULL); + path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/transport_save_passwd_%d", i); + e_config_listener_set_boolean (config->db, path, account->transport->save_passwd); g_free (path); } - + +#if 0 CORBA_exception_init (&ev); Bonobo_ConfigDatabase_sync (config->db, &ev); CORBA_exception_free (&ev); +#endif } static gboolean @@ -1163,9 +1144,9 @@ hash_save_state (gpointer key, gpointer value, gpointer user_data) char *path; gboolean bool = GPOINTER_TO_INT (value); - path = g_strconcat ("/Mail/", (char *)user_data, "/", (char *)key, + path = g_strconcat ("/apps/Evolution/Mail/", (char *)user_data, "/", (char *)key, NULL); - bonobo_config_set_boolean (config->db, path, bool, NULL); + e_config_listener_set_boolean (config->db, path, bool); g_free (path); g_free (key); @@ -1188,131 +1169,98 @@ mail_config_write_on_exit (void) } /* Show Messages Threaded */ - bonobo_config_set_boolean (config->db, "/Mail/Display/thread_list", - config->thread_list, NULL); + e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/Display/thread_list", config->thread_list); - bonobo_config_set_boolean (config->db, "/Mail/Display/thread_subject", - config->thread_subject, NULL); + e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/Display/thread_subject", config->thread_subject); /* Show Message Preview */ - bonobo_config_set_boolean (config->db, "/Mail/Display/preview_pane", - config->show_preview, NULL); + e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/Display/preview_pane",config->show_preview); /* Hide deleted automatically */ - bonobo_config_set_boolean (config->db, "/Mail/Display/hide_deleted", - config->hide_deleted, NULL); + e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/Display/hide_deleted", config->hide_deleted); /* Size of vpaned in mail view */ - bonobo_config_set_long (config->db, "/Mail/Display/paned_size", - config->paned_size, NULL); + e_config_listener_set_long (config->db, "/apps/Evolution/Mail/Display/paned_size", config->paned_size); /* Mark as seen toggle */ - bonobo_config_set_boolean (config->db, "/Mail/Display/do_seen_timeout", - config->do_seen_timeout, NULL); + e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/Display/do_seen_timeout", config->do_seen_timeout); /* Mark as seen timeout */ - bonobo_config_set_long (config->db, "/Mail/Display/seen_timeout", - config->seen_timeout, NULL); + e_config_listener_set_long (config->db, "/apps/Evolution/Mail/Display/seen_timeout", config->seen_timeout); /* Format */ - bonobo_config_set_boolean (config->db, "/Mail/Format/send_html", - config->send_html, NULL); + e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/Format/send_html", config->send_html); /* Confirm Sending Unwanted HTML */ - bonobo_config_set_boolean (config->db, "/Mail/Format/confirm_unwanted_html", - config->confirm_unwanted_html, NULL); + e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/Format/confirm_unwanted_html", config->confirm_unwanted_html); /* Citation */ - bonobo_config_set_boolean (config->db, - "/Mail/Display/citation_highlight", - config->citation_highlight, NULL); + e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/Display/citation_highlight", config->citation_highlight); - bonobo_config_set_long (config->db, "/Mail/Display/citation_color", - config->citation_color, NULL); + e_config_listener_set_long (config->db, "/apps/Evolution/Mail/Display/citation_color", config->citation_color); /* Goto next folder */ - bonobo_config_set_boolean (config->db, "/Mail/MessageList/goto_next_folder", - config->goto_next_folder, NULL); + e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/MessageList/goto_next_folder", config->goto_next_folder); /* Empty Subject */ - bonobo_config_set_boolean (config->db, "/Mail/Prompts/empty_subject", - config->prompt_empty_subject, NULL); + e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/Prompts/empty_subject", config->prompt_empty_subject); /* Only Bcc */ - bonobo_config_set_boolean (config->db, "/Mail/Prompts/only_bcc", - config->prompt_only_bcc, NULL); + e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/Prompts/only_bcc", config->prompt_only_bcc); /* Expunge */ - bonobo_config_set_boolean (config->db, "/Mail/Prompts/confirm_expunge", - config->confirm_expunge, NULL); + e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/Prompts/confirm_expunge", config->confirm_expunge); /* Goto next folder */ - bonobo_config_set_boolean (config->db, "/Mail/Prompts/confirm_goto_next_folder", - config->confirm_goto_next_folder, NULL); + e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/Prompts/confirm_goto_next_folder", config->confirm_goto_next_folder); /* HTTP images */ - bonobo_config_set_long (config->db, "/Mail/Display/http_images", - config->http_mode, NULL); + e_config_listener_set_long (config->db, "/apps/Evolution/Mail/Display/http_images", config->http_mode); /* Forwarding */ - bonobo_config_set_long (config->db, - "/Mail/Format/default_forward_style", - config->default_forward_style, NULL); + e_config_listener_set_long (config->db, "/apps/Evolution/Mail/Format/default_forward_style", config->default_forward_style); /* Replying */ - bonobo_config_set_long (config->db, - "/Mail/Format/default_reply_style", - config->default_reply_style, NULL); + e_config_listener_set_long (config->db, "/apps/Evolution/Mail/Format/default_reply_style", config->default_reply_style); /* Message Display */ - bonobo_config_set_long (config->db, - "/Mail/Format/message_display_style", - config->message_display_style, NULL); + e_config_listener_set_long (config->db, "/apps/Evolution/Mail/Format/message_display_style", config->message_display_style); /* Default charset */ - bonobo_config_set_string_wrapper (config->db, "/Mail/Format/default_charset", - config->default_charset, NULL); + e_config_listener_set_string_wrapper (config->db, "/apps/Evolution/Mail/Format/default_charset", config->default_charset); /* Trash folders */ - bonobo_config_set_boolean (config->db, "/Mail/Trash/empty_on_exit", - config->empty_trash_on_exit, NULL); + e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/Trash/empty_on_exit", config->empty_trash_on_exit); /* Filter logging */ - bonobo_config_set_boolean (config->db, "/Mail/Filters/log", - config->filter_log, NULL); + e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/Filters/log", config->filter_log); - bonobo_config_set_string_wrapper (config->db, "/Mail/Filters/log_path", - config->filter_log_path, NULL); + e_config_listener_set_string_wrapper (config->db, "/apps/Evolution/Mail/Filters/log_path", config->filter_log_path); /* New Mail Notification */ - bonobo_config_set_long (config->db, "/Mail/Notify/new_mail_notification", - config->notify, NULL); + e_config_listener_set_long (config->db, "/apps/Evolution/Mail/Notify/new_mail_notification", config->notify); - bonobo_config_set_string_wrapper (config->db, "/Mail/Notify/new_mail_notification_sound_file", - config->notify_filename, NULL); + e_config_listener_set_string_wrapper (config->db, "/apps/Evolution/Mail/Notify/new_mail_notification_sound_file", config->notify_filename); /* X-Mailer Display */ - bonobo_config_set_long (config->db, - "/Mail/Display/x_mailer_display_style", - config->x_mailer_display_style, NULL); + e_config_listener_set_long (config->db, "/apps/Evolution/Mail/Display/x_mailer_display_style", config->x_mailer_display_style); /* last filesel dir */ - bonobo_config_set_string_wrapper (config->db, "/Mail/Filesel/last_filesel_dir", - config->last_filesel_dir, NULL); + e_config_listener_set_string_wrapper (config->db, "/apps/Evolution/Mail/Filesel/last_filesel_dir", config->last_filesel_dir); /* Color labels */ /* Note: we avoid having to malloc/free 10 times this way... */ - path = g_malloc (sizeof ("/Mail/Labels/") + sizeof ("label_#") + 1); - strcpy (path, "/Mail/Labels/label_#"); + path = g_malloc (sizeof ("/apps/Evolution/Mail/Labels/") + sizeof ("label_#") + 1); + strcpy (path, "/apps/Evolution/Mail/Labels/label_#"); p = path + strlen (path) - 1; for (i = 0; i < 5; i++) { *p = '0' + i; - bonobo_config_set_string_wrapper (config->db, path, config->labels[i].name, NULL); + e_config_listener_set_string_wrapper (config->db, path, config->labels[i].name); } - strcpy (path, "/Mail/Labels/color_#"); + strcpy (path, "/apps/Evolution/Mail/Labels/color_#"); p = path + strlen (path) - 1; for (i = 0; i < 5; i++) { *p = '0' + i; - bonobo_config_set_long (config->db, path, config->labels[i].color, NULL); + e_config_listener_set_long (config->db, path, config->labels[i].color); } g_free (path); @@ -1324,10 +1272,11 @@ mail_config_write_on_exit (void) if (config->preview_hash) g_hash_table_foreach_remove (config->preview_hash, hash_save_state, "Preview"); +#if 0 CORBA_exception_init (&ev); Bonobo_ConfigDatabase_sync (config->db, &ev); CORBA_exception_free (&ev); - +#endif /* Passwords */ /* then we make sure the ones we want to remember are in the @@ -1439,8 +1388,8 @@ mail_config_get_show_preview (const char *uri) gboolean value; char *str; - str = g_strdup_printf ("/Mail/Preview/%s", dbkey); - value = bonobo_config_get_boolean_with_default (config->db, str, TRUE, NULL); + str = g_strdup_printf ("/apps/Evolution/Mail/Preview/%s", dbkey); + value = e_config_listener_get_boolean_with_default (config->db, str, TRUE, NULL); g_free (str); g_hash_table_insert (config->preview_hash, dbkey, @@ -1496,8 +1445,8 @@ mail_config_get_thread_list (const char *uri) gboolean value; char *str; - str = g_strdup_printf ("/Mail/Threads/%s", dbkey); - value = bonobo_config_get_boolean_with_default (config->db, str, FALSE, NULL); + str = g_strdup_printf ("/apps/Evolution/Mail/Threads/%s", dbkey); + value = e_config_listener_get_boolean_with_default (config->db, str, FALSE, NULL); g_free (str); g_hash_table_insert (config->threaded_hash, dbkey, @@ -1838,7 +1787,7 @@ mail_config_get_label_name (int label) g_return_val_if_fail (label >= 0 && label < 5, NULL); if (!config->labels[label].name) - config->labels[label].name = g_strdup (U_(label_defaults[label].name)); + config->labels[label].name = g_strdup (_(label_defaults[label].name)); return config->labels[label].name; } @@ -1849,7 +1798,7 @@ mail_config_set_label_name (int label, const char *name) g_return_if_fail (label >= 0 && label < 5); if (!name) - name = U_(label_defaults[label].name); + name = _(label_defaults[label].name); g_free (config->labels[label].name); config->labels[label].name = g_strdup (name); @@ -2335,7 +2284,7 @@ check_service_check (struct _mail_msg *mm) else camel_service_connect (service, &mm->ex); - camel_object_unref (CAMEL_OBJECT (service)); + camel_object_unref (service); *m->success = !camel_exception_is_set(&mm->ex); camel_operation_unregister(mm->cancel); @@ -2349,7 +2298,7 @@ static struct _mail_msg_op check_service_op = { }; static void -check_cancelled (GnomeDialog *dialog, int button, gpointer data) +check_response (GtkDialog *dialog, int button, gpointer data) { int *msg_id = data; @@ -2390,25 +2339,20 @@ mail_config_check_service (const char *url, CamelProviderType type, GList **auth id = m->msg.seq; e_thread_put(mail_thread_queued, (EMsg *)m); - - dialog = gnome_dialog_new (_("Connecting to server..."), - GNOME_STOCK_BUTTON_CANCEL, - NULL); - gnome_dialog_set_parent (GNOME_DIALOG (dialog), window); + + dialog = gtk_dialog_new_with_buttons(_("Connecting to server..."), window, GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + NULL); label = gtk_label_new (_("Connecting to server...")); - gtk_box_pack_start (GTK_BOX(GNOME_DIALOG (dialog)->vbox), + gtk_box_pack_start (GTK_BOX(GTK_DIALOG (dialog)->vbox), label, TRUE, TRUE, 10); - gnome_dialog_set_close (GNOME_DIALOG (dialog), FALSE); - gtk_signal_connect (GTK_OBJECT (dialog), "clicked", - GTK_SIGNAL_FUNC (check_cancelled), &id); - gtk_signal_connect (GTK_OBJECT (dialog), "delete_event", - GTK_SIGNAL_FUNC (check_cancelled), &id); - gtk_window_set_modal (GTK_WINDOW (dialog), FALSE); + g_signal_connect(dialog, "response", G_CALLBACK (check_response), &id); gtk_widget_show_all (dialog); mail_msg_wait(id); gtk_widget_destroy (dialog); + g_object_unref(dialog); dialog = NULL; return ret; @@ -2535,7 +2479,7 @@ evolution_mail_config_class_init (EvolutionMailConfigClass *klass) { POA_GNOME_Evolution_MailConfig__epv *epv = &klass->epv; - parent_class = gtk_type_class (PARENT_TYPE); + parent_class = g_type_class_ref(PARENT_TYPE); epv->addAccount = impl_GNOME_Evolution_MailConfig_addAccount; epv->removeAccount = impl_GNOME_Evolution_MailConfig_removeAccount; } @@ -2552,11 +2496,13 @@ BONOBO_X_TYPE_FUNC_FULL (EvolutionMailConfig, static BonoboObject * evolution_mail_config_factory_fn (BonoboGenericFactory *factory, + const char *id, void *closure) { EvolutionMailConfig *config; - config = gtk_type_new (evolution_mail_config_get_type ()); + config = g_object_new (evolution_mail_config_get_type (), NULL); + return BONOBO_OBJECT (config); } @@ -2590,7 +2536,7 @@ get_new_signature_filename () gchar *filename; gint i; - filename = g_strconcat (evolution_dir, "/signatures", NULL); + filename = g_build_filename (evolution_dir, "/signatures", NULL); if (lstat (filename, &st_buf)) { if (errno == ENOENT) { if (mkdir (filename, 0700)) @@ -2626,7 +2572,7 @@ mail_config_signature_add (gboolean html, const gchar *script) /* printf ("mail_config_signature_add %d\n", config->signatures); */ sig->id = config->signatures; - sig->name = g_strdup (U_("Unnamed")); + sig->name = g_strdup (_("Unnamed")); if (script) sig->script = g_strdup (script); else diff --git a/mail/mail-crypto.c b/mail/mail-crypto.c index 115745d247..629bc8b845 100644 --- a/mail/mail-crypto.c +++ b/mail/mail-crypto.c @@ -78,7 +78,7 @@ mail_crypto_smime_sign (CamelMimeMessage *message, const char *userid, if (context) { mesg = camel_cms_sign (CAMEL_CMS_CONTEXT (context), message, userid, signing_time, detached, ex); - camel_object_unref (CAMEL_OBJECT (context)); + camel_object_unref (context); } else camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Could not create a S/MIME signature context.")); @@ -110,7 +110,7 @@ mail_crypto_smime_certsonly (CamelMimeMessage *message, const char *userid, if (context) { mesg = camel_cms_certsonly (CAMEL_CMS_CONTEXT (context), message, userid, recipients, ex); - camel_object_unref (CAMEL_OBJECT (context)); + camel_object_unref (context); } else camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Could not create a S/MIME certsonly context.")); @@ -142,7 +142,7 @@ mail_crypto_smime_encrypt (CamelMimeMessage *message, const char *userid, if (context) { mesg = camel_cms_encrypt (CAMEL_CMS_CONTEXT (context), message, userid, recipients, ex); - camel_object_unref (CAMEL_OBJECT (context)); + camel_object_unref (context); } else camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Could not create a S/MIME encryption context.")); @@ -174,7 +174,7 @@ mail_crypto_smime_envelope (CamelMimeMessage *message, const char *userid, if (context) { mesg = camel_cms_envelope (CAMEL_CMS_CONTEXT (context), message, userid, recipients, ex); - camel_object_unref (CAMEL_OBJECT (context)); + camel_object_unref (context); } else camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Could not create a S/MIME envelope context.")); @@ -205,7 +205,7 @@ mail_crypto_smime_decode (CamelMimeMessage *message, CamelCMSValidityInfo **info if (context) { mesg = camel_cms_decode (CAMEL_CMS_CONTEXT (context), message, info, ex); - camel_object_unref (CAMEL_OBJECT (context)); + camel_object_unref (context); } else camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Could not create a S/MIME decode context.")); diff --git a/mail/mail-display.c b/mail/mail-display.c index c088323f56..2c6ba79114 100644 --- a/mail/mail-display.c +++ b/mail/mail-display.c @@ -33,19 +33,16 @@ #include <ctype.h> #include <fcntl.h> #include <errno.h> -#include <libgnorba/gnorba.h> -#include <libgnomevfs/gnome-vfs-mime-info.h> +#include <string.h> #include <libgnomevfs/gnome-vfs-mime-handlers.h> #include <libgnomevfs/gnome-vfs.h> #include <bonobo/bonobo-control-frame.h> #include <bonobo/bonobo-stream-memory.h> -#include <bonobo/bonobo-ui-toolbar-icon.h> #include <bonobo/bonobo-widget.h> #include <bonobo/bonobo-socket.h> #include <gdk-pixbuf/gdk-pixbuf.h> #include <gdk-pixbuf/gdk-pixbuf-loader.h> #include <gal/util/e-util.h> -#include <gal/util/e-unicode-i18n.h> #include <gal/widgets/e-popup-menu.h> #include <gal/widgets/e-unicode.h> #include <gtk/gtkinvisible.h> @@ -57,6 +54,7 @@ #include <gtkhtml/htmlinterval.h> #include <gtkhtml/gtkhtml-stream.h> #include <libsoup/soup-message.h> +#include <libgnome/gnome-program.h> #include "e-util/e-html-utils.h" #include "e-util/e-mktemp.h" @@ -183,18 +181,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 *text; + int button; + + dlg = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, + _("A file by that name already exists.\nOverwrite it?")); + 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); - dlg = gnome_dialog_new (_("Overwrite file?"), - GNOME_STOCK_BUTTON_YES, - GNOME_STOCK_BUTTON_NO, - NULL); - text = gtk_label_new (_("A file by that name already exists.\nOverwrite it?")); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dlg)->vbox), text, TRUE, TRUE, 4); - gtk_window_set_policy (GTK_WINDOW (dlg), FALSE, TRUE, FALSE); - gtk_widget_show (text); - - if (gnome_dialog_run_and_close (GNOME_DIALOG (dlg)) != 0) + if (button != GTK_RESPONSE_YES) return FALSE; } @@ -248,7 +244,7 @@ save_data_cb (GtkWidget *widget, gpointer user_data) FALSE); /* preserve the pathname */ - dir = g_dirname (gtk_file_selection_get_filename (file_select)); + dir = g_path_get_dirname (gtk_file_selection_get_filename (file_select)); mail_config_set_last_filesel_dir (dir); g_free (dir); @@ -258,7 +254,7 @@ save_data_cb (GtkWidget *widget, gpointer user_data) static void save_destroy_cb (GtkWidget *widget, CamelMimePart *part) { - camel_object_unref (CAMEL_OBJECT (part)); + camel_object_unref (part); } static gboolean @@ -295,9 +291,9 @@ mail_display_jump_to_anchor (MailDisplay *md, const char *url) static void on_link_clicked (GtkHTML *html, const char *url, MailDisplay *md) { - if (!g_strncasecmp (url, "news:", 5) || !g_strncasecmp (url, "nntp:", 5)) { + if (!g_ascii_strncasecmp (url, "news:", 5) || !g_ascii_strncasecmp (url, "nntp:", 5)) { g_warning ("Can't handle news URLs yet."); - } else if (!g_strncasecmp (url, "mailto:", 7)) { + } else if (!g_ascii_strncasecmp (url, "mailto:", 7)) { send_to_url (url); } else if (*url == '#') { mail_display_jump_to_anchor (md, url); @@ -310,7 +306,7 @@ static void save_part (CamelMimePart *part) { GtkFileSelection *file_select; - char *filename; + char *filename, *base; g_return_if_fail (part != NULL); camel_object_ref (CAMEL_OBJECT (part)); @@ -321,18 +317,21 @@ save_part (CamelMimePart *part) gtk_file_selection_new (_("Save Attachment"))); gtk_file_selection_set_filename (file_select, filename); /* set the GtkEntry with the locale filename by breaking abstraction */ - e_utf8_gtk_entry_set_text (GTK_ENTRY (file_select->selection_entry), g_basename (filename)); + base = g_path_get_basename(filename); + gtk_entry_set_text(GTK_ENTRY (file_select->selection_entry), base); + g_free(base); g_free (filename); - gtk_signal_connect (GTK_OBJECT (file_select->ok_button), "clicked", - GTK_SIGNAL_FUNC (save_data_cb), part); + g_signal_connect(file_select->ok_button, "clicked", + G_CALLBACK (save_data_cb), part); + /* FIXME: deprecated */ gtk_signal_connect_object (GTK_OBJECT (file_select->cancel_button), "clicked", - GTK_SIGNAL_FUNC (gtk_widget_destroy), + G_CALLBACK (gtk_widget_destroy), GTK_OBJECT (file_select)); - gtk_signal_connect (GTK_OBJECT (file_select), "destroy", - GTK_SIGNAL_FUNC (save_destroy_cb), part); + g_signal_connect(file_select, "destroy", + G_CALLBACK (save_destroy_cb), part); gtk_widget_show (GTK_WIDGET (file_select)); } @@ -340,7 +339,7 @@ save_part (CamelMimePart *part) static void save_cb (GtkWidget *widget, gpointer user_data) { - CamelMimePart *part = gtk_object_get_data (GTK_OBJECT (user_data), "CamelMimePart"); + CamelMimePart *part = g_object_get_data((user_data), "CamelMimePart"); save_part (part); } @@ -348,14 +347,14 @@ save_cb (GtkWidget *widget, gpointer user_data) static void launch_cb (GtkWidget *widget, gpointer user_data) { - CamelMimePart *part = gtk_object_get_data (user_data, "CamelMimePart"); + CamelMimePart *part = g_object_get_data(user_data, "CamelMimePart"); MailMimeHandler *handler; GList *apps, *children, *c; GnomeVFSMimeApplication *app; char *command, *filename; const char *tmpdir; - handler = mail_lookup_handler (gtk_object_get_data (user_data, "mime_type")); + handler = mail_lookup_handler (g_object_get_data(user_data, "mime_type")); g_return_if_fail (handler != NULL && handler->applications != NULL); /* Yum. Too bad EPopupMenu doesn't allow per-item closures. */ @@ -373,21 +372,31 @@ launch_cb (GtkWidget *widget, gpointer user_data) tmpdir = e_mkdtemp ("evolution.XXXXXX"); if (!tmpdir) { - char *msg = g_strdup_printf (_("Could not create temporary directory: %s"), - g_strerror (errno)); - gnome_error_dialog (msg); - g_free (msg); + 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)); + /* FIXME: this should be async */ + gtk_dialog_run(dialogue); + gtk_widget_destroy((GtkWidget *)dialogue); + g_object_unref(dialogue); return; } filename = make_safe_filename (tmpdir, part); if (!write_data_to_file (part, filename, TRUE)) { - char *msg = g_strdup_printf (_("Could not create temporary file '%s': %s"), - filename, g_strerror (errno)); - gnome_error_dialog (msg); - g_free (filename); - g_free (msg); + 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)); + /* FIXME: this should be async */ + gtk_dialog_run(dialogue); + gtk_widget_destroy((GtkWidget *)dialogue); + g_object_unref(dialogue); + g_free(filename); return; } @@ -403,8 +412,8 @@ launch_cb (GtkWidget *widget, gpointer user_data) static void inline_cb (GtkWidget *widget, gpointer user_data) { - MailDisplay *md = gtk_object_get_data (user_data, "MailDisplay"); - CamelMimePart *part = gtk_object_get_data (user_data, "CamelMimePart"); + MailDisplay *md = g_object_get_data(user_data, "MailDisplay"); + CamelMimePart *part = g_object_get_data(user_data, "CamelMimePart"); mail_part_toggle_displayed (part, md); mail_display_queue_redisplay (md); @@ -415,7 +424,7 @@ button_press (GtkWidget *widget, CamelMimePart *part) { MailDisplay *md; - md = gtk_object_get_data (GTK_OBJECT (widget), "MailDisplay"); + md = g_object_get_data(G_OBJECT(widget), "MailDisplay"); if (md == NULL) { g_warning ("No MailDisplay on button!"); return; @@ -429,9 +438,9 @@ static gboolean pixmap_press (GtkWidget *widget, GdkEventButton *event, EScrollFrame *user_data) { EPopupMenu *menu; - EPopupMenu save_item = E_POPUP_ITEM (N_("Save Attachment..."), GTK_SIGNAL_FUNC (save_cb), 0); - EPopupMenu view_item = E_POPUP_ITEM (N_("View Inline"), GTK_SIGNAL_FUNC (inline_cb), 2); - EPopupMenu open_item = E_POPUP_ITEM (N_("Open in %s..."), GTK_SIGNAL_FUNC (launch_cb), 1); + EPopupMenu save_item = E_POPUP_ITEM (N_("Save Attachment..."), G_CALLBACK (save_cb), 0); + EPopupMenu view_item = E_POPUP_ITEM (N_("View Inline"), G_CALLBACK (inline_cb), 2); + EPopupMenu open_item = E_POPUP_ITEM (N_("Open in %s..."), G_CALLBACK (launch_cb), 1); MailDisplay *md; CamelMimePart *part; MailMimeHandler *handler; @@ -453,12 +462,11 @@ pixmap_press (GtkWidget *widget, GdkEventButton *event, EScrollFrame *user_data) /* Stop the signal, since we don't want the button's class method to mess up our popup. */ - gtk_signal_emit_stop_by_name (GTK_OBJECT (widget), "button_press_event"); - - part = gtk_object_get_data (GTK_OBJECT (widget), "CamelMimePart"); - handler = mail_lookup_handler (gtk_object_get_data (GTK_OBJECT (widget), - "mime_type")); + g_signal_stop_emission_by_name(widget, "button_press_event"); + part = g_object_get_data(G_OBJECT(widget), "CamelMimePart"); + handler = mail_lookup_handler (g_object_get_data(G_OBJECT(widget), "mime_type")); + if (handler && handler->applications) nitems = g_list_length (handler->applications) + 2; else @@ -472,26 +480,22 @@ pixmap_press (GtkWidget *widget, GdkEventButton *event, EScrollFrame *user_data) /* Inline view item */ memcpy (&menu[1], &view_item, sizeof (menu[1])); if (handler && handler->builtin) { - md = gtk_object_get_data (GTK_OBJECT (widget), "MailDisplay"); - + md = g_object_get_data(G_OBJECT(widget), "MailDisplay"); + if (!mail_part_is_displayed_inline (part, md)) { if (handler->component) { - OAF_Property *prop; + Bonobo_ActivationProperty *prop; char *name; - prop = oaf_server_info_prop_find ( - handler->component, "name"); + prop = bonobo_server_info_prop_find(handler->component, "name"); if (!prop) { - prop = oaf_server_info_prop_find ( - handler->component, - "description"); + prop = bonobo_server_info_prop_find(handler->component, "description"); } - if (prop && prop->v._d == OAF_P_STRING) + if (prop && prop->v._d == Bonobo_ACTIVATION_P_STRING) name = prop->v._u.value_string; else name = "bonobo"; - menu[1].name = g_strdup_printf ( - _("View Inline (via %s)"), name); + menu[1].name = g_strdup_printf(_("View Inline (via %s)"), name); } else menu[1].name = g_strdup (_(menu[1].name)); } else @@ -515,8 +519,7 @@ pixmap_press (GtkWidget *widget, GdkEventButton *event, EScrollFrame *user_data) } } else { memcpy (&menu[2], &open_item, sizeof (menu[2])); - menu[2].name = g_strdup_printf (_(menu[2].name), - _("External Viewer")); + menu[2].name = g_strdup_printf (_(menu[2].name), _("External Viewer")); mask |= 1; } @@ -535,48 +538,43 @@ pixbuf_for_mime_type (const char *mime_type) char *filename = NULL; GdkPixbuf *pixbuf = NULL; - /* GnomeVFS changed the key from icon-filename to - icon_filename, so check icon_filename first and if that - fails, fall back to the old key name */ - if (!(icon_name = gnome_vfs_mime_get_value (mime_type, "icon_filename"))) - icon_name = gnome_vfs_mime_get_value (mime_type, "icon-filename"); - + icon_name = gnome_vfs_mime_get_icon(mime_type); + if (icon_name) { if (*icon_name == '/') { - pixbuf = gdk_pixbuf_new_from_file (icon_name); + pixbuf = gdk_pixbuf_new_from_file (icon_name, NULL); if (pixbuf) return pixbuf; } - filename = gnome_pixmap_file (icon_name); + filename = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP, icon_name, TRUE, NULL); if (!filename) { char *fm_icon; fm_icon = g_strdup_printf ("nautilus/%s", icon_name); - filename = gnome_pixmap_file (fm_icon); + filename = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP, fm_icon, TRUE, NULL); if (!filename) { g_free (fm_icon); fm_icon = g_strdup_printf ("mc/%s", icon_name); - filename = gnome_pixmap_file (fm_icon); + filename = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP, fm_icon, TRUE, NULL); } g_free (fm_icon); } if (filename) { - pixbuf = gdk_pixbuf_new_from_file (filename); + pixbuf = gdk_pixbuf_new_from_file (filename, NULL); g_free (filename); } } if (!pixbuf) { - filename = gnome_pixmap_file ("gnome-unknown.png"); + filename = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP, "gnome-unknown.png", TRUE, NULL); if (filename) { - pixbuf = gdk_pixbuf_new_from_file (filename); + pixbuf = gdk_pixbuf_new_from_file (filename, NULL); g_free (filename); } else { g_warning ("Could not get any icon for %s!",mime_type); - pixbuf = gdk_pixbuf_new_from_xpm_data ( - (const char **)empty_xpm); + pixbuf = gdk_pixbuf_new_from_xpm_data((const char **)empty_xpm); } } @@ -589,7 +587,7 @@ pixbuf_uncache (gpointer key) GdkPixbuf *pixbuf; pixbuf = g_hash_table_lookup (thumbnail_cache, key); - gdk_pixbuf_unref (pixbuf); + g_object_unref (pixbuf); g_hash_table_remove (thumbnail_cache, key); g_free (key); return FALSE; @@ -610,20 +608,19 @@ pixbuf_gen_idle (struct _PixbufLoader *pbl) width = gdk_pixbuf_get_width (mini); height = gdk_pixbuf_get_height (mini); - bonobo_ui_toolbar_icon_set_pixbuf ( - BONOBO_UI_TOOLBAR_ICON (pbl->pixmap), mini); - gtk_widget_set_usize (pbl->pixmap, width, height); + gtk_image_set_from_pixbuf((GtkImage *)pbl->pixmap, mini); + gtk_widget_set_size_request (pbl->pixmap, width, height); /* Restart the cache-cleaning timer */ g_source_remove_by_user_data (orig_key); g_timeout_add (5 * 60 * 1000, pixbuf_uncache, orig_key); if (pbl->loader) { - gdk_pixbuf_loader_close (pbl->loader); + gdk_pixbuf_loader_close (pbl->loader, NULL); gtk_object_destroy (GTK_OBJECT (pbl->loader)); - camel_object_unref (CAMEL_OBJECT (pbl->mstream)); + camel_object_unref (pbl->mstream); } - gtk_signal_disconnect (GTK_OBJECT (pbl->eb), pbl->destroy_id); + g_signal_handler_disconnect((pbl->eb), pbl->destroy_id); g_free (pbl->type); g_free (pbl->cid); g_free (pbl); @@ -636,10 +633,10 @@ pixbuf_gen_idle (struct _PixbufLoader *pbl) if (!GTK_IS_WIDGET (pbl->pixmap)) { /* Widget has died */ if (pbl->mstream) - camel_object_unref (CAMEL_OBJECT (pbl->mstream)); + camel_object_unref (pbl->mstream); if (pbl->loader) { - gdk_pixbuf_loader_close (pbl->loader); + gdk_pixbuf_loader_close (pbl->loader, NULL); gtk_object_destroy (GTK_OBJECT (pbl->loader)); } @@ -655,7 +652,7 @@ pixbuf_gen_idle (struct _PixbufLoader *pbl) len = camel_stream_read (pbl->mstream, tmp, 4096); if (len > 0) { - error = !gdk_pixbuf_loader_write (pbl->loader, tmp, len); + error = !gdk_pixbuf_loader_write (pbl->loader, tmp, len, NULL); if (!error) return TRUE; } else if (!camel_stream_eos (pbl->mstream)) @@ -666,7 +663,7 @@ pixbuf_gen_idle (struct _PixbufLoader *pbl) if (pbl->type) pixbuf = pixbuf_for_mime_type (pbl->type); else - pixbuf = gdk_pixbuf_new_from_file (EVOLUTION_ICONSDIR "/pgp-signature-nokey.png"); + pixbuf = gdk_pixbuf_new_from_file (EVOLUTION_ICONSDIR "/pgp-signature-nokey.png", NULL); } else pixbuf = gdk_pixbuf_loader_get_pixbuf (pbl->loader); @@ -687,22 +684,20 @@ pixbuf_gen_idle (struct _PixbufLoader *pbl) } } - mini = gdk_pixbuf_scale_simple (pixbuf, width, height, - GDK_INTERP_BILINEAR); + mini = gdk_pixbuf_scale_simple (pixbuf, width, height, GDK_INTERP_BILINEAR); if (error || !pbl->mstream) - gdk_pixbuf_unref (pixbuf); - bonobo_ui_toolbar_icon_set_pixbuf ( - BONOBO_UI_TOOLBAR_ICON (pbl->pixmap), mini); + g_object_unref (pixbuf); + gtk_image_set_from_pixbuf((GtkImage *)pbl->pixmap, mini); /* Add the pixbuf to the cache */ g_hash_table_insert (thumbnail_cache, pbl->cid, mini); g_timeout_add (5 * 60 * 1000, pixbuf_uncache, pbl->cid); - gtk_signal_disconnect (GTK_OBJECT (pbl->eb), pbl->destroy_id); + g_signal_handler_disconnect(pbl->eb, pbl->destroy_id); if (pbl->loader) { - gdk_pixbuf_loader_close (pbl->loader); - gtk_object_unref (GTK_OBJECT (pbl->loader)); - camel_object_unref (CAMEL_OBJECT (pbl->mstream)); + gdk_pixbuf_loader_close (pbl->loader, NULL); + g_object_unref(pbl->loader); + camel_object_unref (pbl->mstream); } g_free (pbl->type); g_free (pbl); @@ -718,10 +713,10 @@ embeddable_destroy_cb (GtkObject *embeddable, { g_idle_remove_by_data (pbl); if (pbl->mstream) - camel_object_unref (CAMEL_OBJECT (pbl->mstream)); + camel_object_unref (pbl->mstream); if (pbl->loader) { - gdk_pixbuf_loader_close (pbl->loader); + gdk_pixbuf_loader_close (pbl->loader, NULL); gtk_object_destroy (GTK_OBJECT (pbl->loader)); } @@ -742,6 +737,8 @@ get_embedded_for_component (const char *iid, MailDisplay *md) */ embedded = bonobo_widget_new_control (iid, NULL); if (embedded == NULL) { +#warning "what about bonobo_widget_new_subdoc?" +#if 0 /* * No control, try an embeddable instead. */ @@ -757,6 +754,7 @@ get_embedded_for_component (const char *iid, MailDisplay *md) return embedded; } +#endif } if (embedded == NULL) @@ -830,14 +828,14 @@ save_url (MailDisplay *md, const char *url) memstream = camel_stream_mem_new_with_buffer (ba->data, ba->len); wrapper = camel_data_wrapper_new (); camel_data_wrapper_construct_from_stream (wrapper, memstream); - camel_object_unref (CAMEL_OBJECT (memstream)); + camel_object_unref (memstream); part = camel_mime_part_new (); camel_medium_set_content_object (CAMEL_MEDIUM (part), wrapper); - camel_object_unref (CAMEL_OBJECT (wrapper)); + camel_object_unref (wrapper); camel_mime_part_set_filename (part, name); } } else { - camel_object_ref (CAMEL_OBJECT (part)); + camel_object_ref (part); } if (part) { @@ -851,7 +849,7 @@ save_url (MailDisplay *md, const char *url) } save_part (part); - camel_object_unref (CAMEL_OBJECT (part)); + camel_object_unref (part); return NULL; } @@ -874,7 +872,7 @@ drag_data_get_cb (GtkWidget *widget, switch (info) { case DND_TARGET_TYPE_TEXT_URI_LIST: /* Kludge around Nautilus requesting the same data many times */ - uri_list = gtk_object_get_data (GTK_OBJECT (widget), "uri-list"); + uri_list = g_object_get_data(G_OBJECT(widget), "uri-list"); if (uri_list) { gtk_selection_data_set (selection_data, selection_data->target, 8, uri_list, strlen (uri_list)); @@ -883,15 +881,19 @@ drag_data_get_cb (GtkWidget *widget, tmpdir = e_mkdtemp ("drag-n-drop-XXXXXX"); if (!tmpdir) { - char *msg; - - msg = g_strdup_printf (_("Could not create temporary directory: %s"), - g_strerror (errno)); - gnome_error_dialog (msg); - g_free (msg); + 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)); + /* FIXME: this should be async */ + gtk_dialog_run(dialogue); + gtk_widget_destroy((GtkWidget *)dialogue); + g_object_unref(dialogue); } filename = camel_mime_part_get_filename (part); + /* This is the default filename used for dnd temporary target of attachment */ if (!filename) filename = _("Unknown"); @@ -905,7 +907,7 @@ drag_data_get_cb (GtkWidget *widget, gtk_selection_data_set (selection_data, selection_data->target, 8, uri_list, strlen (uri_list)); - gtk_object_set_data_full (GTK_OBJECT (widget), "uri-list", uri_list, g_free); + g_object_set_data_full(G_OBJECT(widget), "uri-list", uri_list, g_free); break; case DND_TARGET_TYPE_PART_MIME_TYPE: if (header_content_type_is (part->content_type, "text", "*")) { @@ -919,19 +921,16 @@ drag_data_get_cb (GtkWidget *widget, } } else { CamelDataWrapper *wrapper; - CamelStream *cstream; - GByteArray *ba; - - ba = g_byte_array_new (); + CamelStreamMem *cstream; - cstream = camel_stream_mem_new_with_byte_array (ba); + cstream = (CamelStreamMem *)camel_stream_mem_new(); wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part)); - camel_data_wrapper_write_to_stream (wrapper, cstream); + camel_data_wrapper_write_to_stream (wrapper, (CamelStream *)cstream); gtk_selection_data_set (selection_data, selection_data->target, 8, - ba->data, ba->len); + cstream->buffer->data, cstream->buffer->len); - camel_object_unref (CAMEL_OBJECT (cstream)); + camel_object_unref (cstream); } break; default: @@ -946,10 +945,10 @@ drag_data_delete_cb (GtkWidget *widget, { char *uri_list; - uri_list = gtk_object_get_data (GTK_OBJECT (widget), "uri-list"); + uri_list = g_object_get_data(G_OBJECT(widget), "uri-list"); if (uri_list) { unlink (uri_list + 7); - gtk_object_set_data (GTK_OBJECT (widget), "uri-list", NULL); + g_object_set_data(G_OBJECT(widget), "uri-list", NULL); } } @@ -962,7 +961,7 @@ do_attachment_header (GtkHTML *html, GtkHTMLEmbedded *eb, struct _PixbufLoader *pbl; pbl = g_new0 (struct _PixbufLoader, 1); - if (g_strncasecmp (eb->type, "image/", 6) == 0) { + if (g_ascii_strncasecmp (eb->type, "image/", 6) == 0) { CamelDataWrapper *content; content = camel_medium_get_content_object (CAMEL_MEDIUM (part)); @@ -974,23 +973,20 @@ do_attachment_header (GtkHTML *html, GtkHTMLEmbedded *eb, } pbl->type = g_strdup (eb->type); pbl->cid = g_strdup (eb->classid + 6); - pbl->pixmap = bonobo_ui_toolbar_icon_new (); - gtk_widget_set_usize (pbl->pixmap, 24, 24); + pbl->pixmap = gtk_image_new(); + gtk_widget_set_size_request (pbl->pixmap, 24, 24); pbl->eb = eb; - pbl->destroy_id = gtk_signal_connect (GTK_OBJECT (eb), "destroy", - embeddable_destroy_cb, pbl); + pbl->destroy_id = g_signal_connect(G_OBJECT(eb), "destroy", G_CALLBACK(embeddable_destroy_cb), pbl); - g_idle_add_full (G_PRIORITY_LOW, (GSourceFunc)pixbuf_gen_idle, - pbl, NULL); + g_idle_add_full (G_PRIORITY_LOW, (GSourceFunc)pixbuf_gen_idle, pbl, NULL); mainbox = gtk_hbox_new (FALSE, 0); button = gtk_button_new (); GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS); - gtk_object_set_data (GTK_OBJECT (button), "MailDisplay", md); + g_object_set_data(G_OBJECT(button), "MailDisplay", md); - gtk_signal_connect (GTK_OBJECT (button), "clicked", - GTK_SIGNAL_FUNC (button_press), part); + g_signal_connect(button, "clicked", G_CALLBACK (button_press), part); handler = mail_lookup_handler (eb->type); if (handler && handler->builtin) @@ -1005,21 +1001,20 @@ do_attachment_header (GtkHTML *html, GtkHTMLEmbedded *eb, gtk_drag_source_set (button, GDK_BUTTON1_MASK, drag_types, num_drag_types, GDK_ACTION_COPY); - gtk_signal_connect (GTK_OBJECT (button), "drag-data-get", - drag_data_get_cb, part); - gtk_signal_connect (GTK_OBJECT (button), "drag-data-delete", - drag_data_delete_cb, part); + g_signal_connect(G_OBJECT(button), "drag-data-get", G_CALLBACK(drag_data_get_cb), part); + g_signal_connect(G_OBJECT(button), "drag-data-delete", G_CALLBACK(drag_data_delete_cb), part); g_free (drag_types[DND_TARGET_TYPE_PART_MIME_TYPE].target); drag_types[DND_TARGET_TYPE_PART_MIME_TYPE].target = NULL; hbox = gtk_hbox_new (FALSE, 2); gtk_container_set_border_width (GTK_CONTAINER (hbox), 2); - + + /* should this be a gtk_arrow? */ if (handler && mail_part_is_displayed_inline (part, md)) - arrow = gnome_stock_new_with_icon (GNOME_STOCK_PIXMAP_DOWN); + arrow = gtk_image_new_from_stock(GTK_STOCK_GO_DOWN, GTK_ICON_SIZE_BUTTON); else - arrow = gnome_stock_new_with_icon (GNOME_STOCK_PIXMAP_FORWARD); + arrow = gtk_image_new_from_stock(GTK_STOCK_GO_FORWARD, GTK_ICON_SIZE_BUTTON); gtk_box_pack_start (GTK_BOX (hbox), arrow, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), pbl->pixmap, TRUE, TRUE, 0); gtk_container_add (GTK_CONTAINER (button), hbox); @@ -1030,13 +1025,11 @@ do_attachment_header (GtkHTML *html, GtkHTMLEmbedded *eb, gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_ETCHED_IN)); - gtk_object_set_data (GTK_OBJECT (popup), "MailDisplay", md); - gtk_object_set_data (GTK_OBJECT (popup), "CamelMimePart", part); - gtk_object_set_data_full (GTK_OBJECT (popup), "mime_type", - g_strdup (eb->type), (GDestroyNotify)g_free); + g_object_set_data(G_OBJECT(popup), "MailDisplay", md); + g_object_set_data(G_OBJECT(popup), "CamelMimePart", part); + g_object_set_data_full(G_OBJECT(popup), "mime_type", g_strdup (eb->type), (GDestroyNotify)g_free); - gtk_signal_connect (GTK_OBJECT (popup), "button_press_event", - GTK_SIGNAL_FUNC (pixmap_press), md->scroll); + g_signal_connect(popup, "button_press_event", G_CALLBACK (pixmap_press), md->scroll); gtk_box_pack_start (GTK_BOX (mainbox), button, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (mainbox), popup, TRUE, TRUE, 0); @@ -1052,13 +1045,12 @@ do_external_viewer (GtkHTML *html, GtkHTMLEmbedded *eb, CamelMimePart *part, MailDisplay *md) { CamelDataWrapper *wrapper; - OAF_ServerInfo *component; + Bonobo_ServerInfo *component; GtkWidget *embedded; - BonoboObjectClient *server; Bonobo_PersistStream persist; CORBA_Environment ev; GByteArray *ba; - CamelStream *cstream; + CamelStreamMem *cstream; BonoboStream *bstream; component = gnome_vfs_mime_get_default_component (eb->type); @@ -1070,29 +1062,26 @@ do_external_viewer (GtkHTML *html, GtkHTMLEmbedded *eb, if (!embedded) return FALSE; - server = bonobo_widget_get_server (BONOBO_WIDGET (embedded)); - persist = (Bonobo_PersistStream) bonobo_object_client_query_interface ( - server, "IDL:Bonobo/PersistStream:1.0", NULL); + persist = (Bonobo_PersistStream) Bonobo_Unknown_queryInterface(bonobo_widget_get_objref (BONOBO_WIDGET (embedded)), + "IDL:Bonobo/PersistStream:1.0", NULL); if (persist == CORBA_OBJECT_NIL) { gtk_object_sink (GTK_OBJECT (embedded)); return FALSE; } /* Write the data to a CamelStreamMem... */ - ba = g_byte_array_new (); - cstream = camel_stream_mem_new_with_byte_array (ba); + cstream = (CamelStreamMem *)camel_stream_mem_new(); wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part)); - camel_data_wrapper_write_to_stream (wrapper, cstream); + camel_data_wrapper_write_to_stream (wrapper, (CamelStream *)cstream); /* ...convert the CamelStreamMem to a BonoboStreamMem... */ - bstream = bonobo_stream_mem_create (ba->data, ba->len, TRUE, FALSE); - camel_object_unref (CAMEL_OBJECT (cstream)); + bstream = bonobo_stream_mem_create (cstream->buffer->data, cstream->buffer->len, TRUE, FALSE); + camel_object_unref (cstream); /* ...and hydrate the PersistStream from the BonoboStream. */ CORBA_exception_init (&ev); Bonobo_PersistStream_load (persist, - bonobo_object_corba_objref ( - BONOBO_OBJECT (bstream)), + bonobo_object_corba_objref(BONOBO_OBJECT (bstream)), eb->type, &ev); bonobo_object_unref (BONOBO_OBJECT (bstream)); Bonobo_Unknown_unref (persist, &ev); @@ -1121,20 +1110,17 @@ do_signature (GtkHTML *html, GtkHTMLEmbedded *eb, pbl = g_new0 (struct _PixbufLoader, 1); pbl->type = NULL; pbl->cid = g_strdup (eb->classid); - pbl->pixmap = bonobo_ui_toolbar_icon_new (); - gtk_widget_set_usize (pbl->pixmap, 24, 24); + pbl->pixmap = gtk_image_new(); + gtk_widget_set_size_request (pbl->pixmap, 24, 24); pbl->eb = eb; - pbl->destroy_id = gtk_signal_connect (GTK_OBJECT (eb), "destroy", - embeddable_destroy_cb, pbl); + pbl->destroy_id = g_signal_connect(eb, "destroy", G_CALLBACK(embeddable_destroy_cb), pbl); - g_idle_add_full (G_PRIORITY_LOW, (GSourceFunc)pixbuf_gen_idle, - pbl, NULL); + g_idle_add_full (G_PRIORITY_LOW, (GSourceFunc)pixbuf_gen_idle, pbl, NULL); button = gtk_button_new (); GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS); - gtk_object_set_data (GTK_OBJECT (button), "MailDisplay", md); - gtk_signal_connect (GTK_OBJECT (button), "clicked", - GTK_SIGNAL_FUNC (button_press), part); + g_object_set_data(G_OBJECT(button), "MailDisplay", md); + g_signal_connect(button, "clicked", G_CALLBACK (button_press), part); gtk_container_add (GTK_CONTAINER (button), pbl->pixmap); gtk_widget_show_all (button); gtk_container_add (GTK_CONTAINER (eb), button); @@ -1235,7 +1221,7 @@ on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle, html_stream = mail_stream_gtkhtml_new (html, handle); camel_data_wrapper_write_to_stream (data, html_stream); - camel_object_unref (CAMEL_OBJECT (html_stream)); + camel_object_unref (html_stream); } gtk_html_end (html, handle, GTK_HTML_STREAM_OK); @@ -1373,7 +1359,7 @@ static void fetch_remote(MailDisplay *md, const char *uri, GtkHTML *html, GtkHTM rd->md = md; /* dont ref */ rd->uri = g_strdup(uri); rd->html = html; - gtk_object_ref((GtkObject *)html); + g_object_ref(html); rd->stream = stream; rd->cstream = cstream; @@ -1428,7 +1414,7 @@ static void fetch_data(SoupMessage *req, void *data) static void fetch_free(struct _remote_data *rd) { - gtk_object_unref((GtkObject *)rd->html); + g_object_unref(rd->html); if (rd->cstream) camel_object_unref(rd->cstream); g_free(rd->uri); @@ -1529,7 +1515,7 @@ try_part_urls (struct _load_content_msg *m) html_stream = mail_stream_gtkhtml_new (m->html, m->handle); camel_data_wrapper_write_to_stream (data, html_stream); - camel_object_unref (CAMEL_OBJECT (html_stream)); + camel_object_unref (html_stream); gtk_html_end (m->html, m->handle, GTK_HTML_STREAM_OK); return TRUE; @@ -1547,12 +1533,9 @@ try_data_urls (struct _load_content_msg *m) urls = g_datalist_get_data (m->display->data, "data_urls"); ba = g_hash_table_lookup (urls, m->url); - printf ("url: %s data: %p len: %d\n", m->url, ba, ba ? ba->len : -1); if (ba) { - if (ba->len) { - printf ("writing ...\n"); + if (ba->len) gtk_html_write (m->html, m->handle, ba->data, ba->len); - } gtk_html_end (m->html, m->handle, GTK_HTML_STREAM_OK); return TRUE; } @@ -1564,15 +1547,15 @@ static void load_content_loaded (struct _mail_msg *mm) { struct _load_content_msg *m = (struct _load_content_msg *)mm; - + +#warning "object_destroy check?" +#if 0 if (GTK_OBJECT_DESTROYED (m->display)) return; +#endif if (m->display->current_message == m->message) { if (m->handle) { - printf ("handle: %p orig: %d actual: %d\n", m->handle, - m->redisplay_counter, - m->display->redisplay_counter); if (m->redisplay_counter == m->display->redisplay_counter) { if (!try_part_urls (m) && !try_data_urls (m)) gtk_html_end (m->html, m->handle, GTK_HTML_STREAM_ERROR); @@ -1588,9 +1571,9 @@ load_content_free (struct _mail_msg *mm) struct _load_content_msg *m = (struct _load_content_msg *)mm; g_free (m->url); - gtk_object_unref (GTK_OBJECT (m->html)); - gtk_object_unref (GTK_OBJECT (m->display)); - camel_object_unref (CAMEL_OBJECT (m->message)); + g_object_unref((m->html)); + g_object_unref((m->display)); + camel_object_unref (m->message); } static struct _mail_msg_op load_content_op = { @@ -1611,10 +1594,11 @@ stream_write_or_redisplay_when_loaded (MailDisplay *md, { struct _load_content_msg *m; GHashTable *loading; - + +#if 0 if (GTK_OBJECT_DESTROYED (md)) return; - +#endif loading = g_datalist_get_data (md->data, "loading"); if (loading) { if (g_hash_table_lookup (loading, key)) @@ -1628,14 +1612,14 @@ stream_write_or_redisplay_when_loaded (MailDisplay *md, m = mail_msg_new (&load_content_op, NULL, sizeof (*m)); m->display = md; - gtk_object_ref (GTK_OBJECT (m->display)); + g_object_ref((m->display)); m->html = html; - gtk_object_ref (GTK_OBJECT (html)); + g_object_ref((html)); m->handle = handle; m->url = g_strdup (url); m->redisplay_counter = md->redisplay_counter; m->message = md->current_message; - camel_object_ref (CAMEL_OBJECT (m->message)); + camel_object_ref (m->message); m->callback = callback; m->data = data; @@ -1744,6 +1728,7 @@ mail_display_render (MailDisplay *md, GtkHTML *html, gboolean reset_scroll) int offset; /* my favorite thing to do... muck around with colors so we respect people's stupid themes. */ + /* FIXME: this is also in mail-format.c */ style = gtk_widget_get_style (GTK_WIDGET (html)); if (style && !md->printing) { int state = GTK_WIDGET_STATE (GTK_WIDGET (html)); @@ -1780,7 +1765,7 @@ mail_display_render (MailDisplay *md, GtkHTML *html, gboolean reset_scroll) target_date = header_decode_date (due_by, &offset); now = time (NULL); if (now >= target_date) - overdue = U_("Overdue:"); + overdue = _("Overdue:"); localtime_r (&target_date, &due); @@ -1823,9 +1808,10 @@ mail_display_render (MailDisplay *md, GtkHTML *html, gboolean reset_scroll) void mail_display_redisplay (MailDisplay *md, gboolean reset_scroll) { +#if 0 if (GTK_OBJECT_DESTROYED (md)) return; - +#endif fetch_cancel(md); md->last_active = NULL; @@ -1858,7 +1844,7 @@ mail_display_set_message (MailDisplay *md, CamelMedium *medium, CamelFolder *fol /* Clean up from previous message. */ if (md->current_message) { fetch_cancel (md); - camel_object_unref (CAMEL_OBJECT (md->current_message)); + camel_object_unref (md->current_message); g_datalist_clear (md->data); } @@ -1954,33 +1940,36 @@ mail_display_destroy (GtkObject *object) { MailDisplay *mail_display = MAIL_DISPLAY (object); - gtk_object_unref (GTK_OBJECT (mail_display->html)); - - if (mail_display->current_message) { - camel_object_unref (mail_display->current_message); - g_datalist_clear (mail_display->data); - fetch_cancel(mail_display); - } + if (mail_display->html) { + g_object_unref(mail_display->html); + mail_display->html = NULL; - g_free (mail_display->charset); - g_free (mail_display->selection); - - if (mail_display->folder) { - if (mail_display->info) - camel_folder_free_message_info (mail_display->folder, mail_display->info); - camel_object_unref (mail_display->folder); - } + if (mail_display->current_message) { + camel_object_unref (mail_display->current_message); + g_datalist_clear (mail_display->data); + fetch_cancel(mail_display); + } - g_free (mail_display->data); - mail_display->data = NULL; + g_free (mail_display->charset); + g_free (mail_display->selection); + + if (mail_display->folder) { + if (mail_display->info) + camel_folder_free_message_info (mail_display->folder, mail_display->info); + camel_object_unref (mail_display->folder); + } + + g_free (mail_display->data); + mail_display->data = NULL; - if (mail_display->idle_id) - gtk_timeout_remove (mail_display->idle_id); + if (mail_display->idle_id) + gtk_timeout_remove (mail_display->idle_id); - gtk_widget_unref (mail_display->invisible); + g_object_unref (mail_display->invisible); + + g_free(mail_display->priv); + } - g_free(mail_display->priv); - mail_display_parent_class->destroy (object); } @@ -2035,9 +2024,8 @@ mail_display_class_init (GtkObjectClass *object_class) camel_data_cache_set_expire_age(fetch_cache, 24*60*60); camel_data_cache_set_expire_access(fetch_cache, 2*60*60); - mail_display_parent_class = gtk_type_class (PARENT_TYPE); + mail_display_parent_class = g_type_class_ref(PARENT_TYPE); thumbnail_cache = g_hash_table_new (g_str_hash, g_str_equal); - } } @@ -2088,7 +2076,7 @@ image_save_as (GtkWidget *w, MailDisplay *mail_display) { const char *src; - src = gtk_object_get_data (GTK_OBJECT (mail_display), "current_src_uri"); + src = g_object_get_data(G_OBJECT(mail_display), "current_src_uri"); g_warning ("loading uri=%s", src); @@ -2111,12 +2099,12 @@ enum { #define TERMINATOR { NULL, NULL, (NULL), NULL, 0 } static EPopupMenu link_menu [] = { - E_POPUP_ITEM (N_("Open Link in Browser"), GTK_SIGNAL_FUNC (link_open_in_browser), MASK_URL), - E_POPUP_ITEM (N_("Copy Link Location"), GTK_SIGNAL_FUNC (link_copy_location), MASK_URL), + E_POPUP_ITEM (N_("Open Link in Browser"), G_CALLBACK (link_open_in_browser), MASK_URL), + E_POPUP_ITEM (N_("Copy Link Location"), G_CALLBACK (link_copy_location), MASK_URL), #if 0 - E_POPUP_ITEM (N_("Save Link as (FIXME)"), GTK_SIGNAL_FUNC (link_save_as), MASK_URL), + E_POPUP_ITEM (N_("Save Link as (FIXME)"), G_CALLBACK (link_save_as), MASK_URL), #endif - E_POPUP_ITEM (N_("Save Image as..."), GTK_SIGNAL_FUNC (image_save_as), MASK_SRC), + E_POPUP_ITEM (N_("Save Image as..."), G_CALLBACK (image_save_as), MASK_SRC), TERMINATOR }; @@ -2133,7 +2121,7 @@ struct _PopupInfo { GtkWidget *win; guint destroy_timeout; guint widget_destroy_handle; - Bonobo_EventSource_ListenerId listener_id; + Bonobo_Listener listener; gboolean hidden; }; @@ -2148,9 +2136,9 @@ popup_info_free (PopupInfo *pop) gtk_timeout_remove (pop->destroy_timeout); bonobo_event_source_client_remove_listener (bonobo_widget_get_objref (BONOBO_WIDGET (pop->w)), - pop->listener_id, + pop->listener, NULL); - + CORBA_Object_release (pop->listener, NULL); g_free (pop); } } @@ -2254,26 +2242,11 @@ make_popup_window (GtkWidget *w) gtk_window_set_policy (GTK_WINDOW (pop->win), FALSE, FALSE, FALSE); - gtk_signal_connect (GTK_OBJECT (pop->win), - "destroy", - GTK_SIGNAL_FUNC (popup_window_destroy_cb), - pop); - gtk_signal_connect (GTK_OBJECT (pop->win), - "enter_notify_event", - GTK_SIGNAL_FUNC (popup_enter_cb), - pop); - gtk_signal_connect (GTK_OBJECT (pop->win), - "leave_notify_event", - GTK_SIGNAL_FUNC (popup_leave_cb), - pop); - gtk_signal_connect_after (GTK_OBJECT (pop->win), - "realize", - GTK_SIGNAL_FUNC (popup_realize_cb), - pop); - gtk_signal_connect (GTK_OBJECT (pop->win), - "size_allocate", - GTK_SIGNAL_FUNC (popup_size_allocate_cb), - pop); + g_signal_connect(pop->win, "destroy", G_CALLBACK (popup_window_destroy_cb), pop); + g_signal_connect(pop->win, "enter_notify_event", G_CALLBACK (popup_enter_cb), pop); + g_signal_connect(pop->win, "leave_notify_event", G_CALLBACK (popup_leave_cb), pop); + g_signal_connect_after (pop->win, "realize", G_CALLBACK (popup_realize_cb), pop); + g_signal_connect(pop->win, "size_allocate", G_CALLBACK (popup_size_allocate_cb), pop); gtk_widget_show (w); gtk_widget_show (fr); @@ -2332,7 +2305,7 @@ html_button_press_event (GtkWidget *widget, GdkEventButton *event, MailDisplay * url = html_object_get_url (point->object); src = html_object_get_src (point->object); - if (url && !g_strncasecmp (url, "mailto:", 7)) { + if (url && !g_ascii_strncasecmp (url, "mailto:", 7)) { PopupInfo *pop; gchar *url_decoded; @@ -2351,10 +2324,10 @@ html_button_press_event (GtkWidget *widget, GdkEventButton *event, MailDisplay * pop = make_popup_window (popup_thing); - pop->listener_id = - bonobo_event_source_client_add_listener (bonobo_widget_get_objref (BONOBO_WIDGET (popup_thing)), - listener_cb, NULL, NULL, pop); - + pop->listener = bonobo_event_source_client_add_listener_full( + bonobo_widget_get_objref (BONOBO_WIDGET (popup_thing)), + g_cclosure_new(G_CALLBACK(listener_cb), pop, NULL), + NULL, NULL); } else if (url || src) { gint hide_mask = 0; @@ -2364,11 +2337,11 @@ html_button_press_event (GtkWidget *widget, GdkEventButton *event, MailDisplay * if (!src) hide_mask |= MASK_SRC; - g_free (gtk_object_get_data (GTK_OBJECT (mail_display), "current_src_uri")); - gtk_object_set_data (GTK_OBJECT (mail_display), "current_src_uri", - gtk_html_get_url_object_relative (GTK_HTML (widget), - point->object, - src)); + g_free (g_object_get_data(G_OBJECT(mail_display), "current_src_uri")); + g_object_set_data(G_OBJECT(mail_display), "current_src_uri", + gtk_html_get_url_object_relative (GTK_HTML (widget), + point->object, + src)); e_popup_menu_run (link_menu, (GdkEvent *) event, 0, hide_mask, mail_display); @@ -2451,12 +2424,12 @@ html_motion_notify_event (GtkWidget *widget, GdkEventMotion *event, MailDisplay static void html_iframe_created (GtkWidget *w, GtkHTML *iframe, MailDisplay *mail_display) { - gtk_signal_connect (GTK_OBJECT (iframe), "button_press_event", - GTK_SIGNAL_FUNC (html_button_press_event), mail_display); - gtk_signal_connect (GTK_OBJECT (iframe), "motion_notify_event", - GTK_SIGNAL_FUNC (html_motion_notify_event), mail_display); - gtk_signal_connect (GTK_OBJECT (iframe), "enter_notify_event", - GTK_SIGNAL_FUNC (html_enter_notify_event), mail_display); + g_signal_connect(iframe, "button_press_event", + G_CALLBACK (html_button_press_event), mail_display); + g_signal_connect(iframe, "motion_notify_event", + G_CALLBACK (html_motion_notify_event), mail_display); + g_signal_connect(iframe, "enter_notify_event", + G_CALLBACK (html_enter_notify_event), mail_display); } static GNOME_Evolution_ShellView @@ -2466,7 +2439,7 @@ retrieve_shell_view_interface_from_control (BonoboControl *control) GNOME_Evolution_ShellView shell_view_interface; CORBA_Environment ev; - control_frame = bonobo_control_get_control_frame (control); + control_frame = bonobo_control_get_control_frame (control, NULL); if (control_frame == NULL) return CORBA_OBJECT_NIL; @@ -2478,9 +2451,9 @@ retrieve_shell_view_interface_from_control (BonoboControl *control) CORBA_exception_free (&ev); if (shell_view_interface != CORBA_OBJECT_NIL) - gtk_object_set_data (GTK_OBJECT (control), - "mail_threads_shell_view_interface", - shell_view_interface); + g_object_set_data(G_OBJECT(control), + "mail_threads_shell_view_interface", + shell_view_interface); else g_warning ("Control frame doesn't have Evolution/ShellView."); @@ -2501,7 +2474,7 @@ set_status_message (const char *message, int busy) control = BONOBO_CONTROL (e_iterator_get (it)); - shell_view_interface = gtk_object_get_data (GTK_OBJECT (control), "mail_threads_shell_view_interface"); + shell_view_interface = g_object_get_data(G_OBJECT(control), "mail_threads_shell_view_interface"); if (shell_view_interface == CORBA_OBJECT_NIL) shell_view_interface = retrieve_shell_view_interface_from_control (control); @@ -2522,7 +2495,7 @@ set_status_message (const char *message, int busy) random ones lying around otherwise. Shrug. */ break; } - gtk_object_unref (GTK_OBJECT(it)); + g_object_unref(it); } /* For now show every url but possibly limit it to showing only http: @@ -2548,7 +2521,7 @@ html_on_url (GtkHTML *html, GtkWidget * mail_display_new (void) { - MailDisplay *mail_display = gtk_type_new (mail_display_get_type ()); + MailDisplay *mail_display = g_object_new (mail_display_get_type (), NULL); GtkWidget *scroll, *html; GdkAtom clipboard_atom; HTMLTokenizer *tok; @@ -2567,17 +2540,17 @@ mail_display_new (void) html = gtk_html_new (); tok = e_searching_tokenizer_new (); html_engine_set_tokenizer (GTK_HTML (html)->engine, tok); - gtk_object_unref (GTK_OBJECT (tok)); + g_object_unref((tok)); mail_display_initialize_gtkhtml (mail_display, GTK_HTML (html)); gtk_container_add (GTK_CONTAINER (scroll), html); gtk_widget_show (GTK_WIDGET (html)); - gtk_signal_connect (GTK_OBJECT (mail_display->invisible), "selection_get", - GTK_SIGNAL_FUNC (invisible_selection_get_callback), mail_display); - gtk_signal_connect (GTK_OBJECT (mail_display->invisible), "selection_clear_event", - GTK_SIGNAL_FUNC (invisible_selection_clear_event_callback), mail_display); + g_signal_connect(mail_display->invisible, "selection_get", + G_CALLBACK (invisible_selection_get_callback), mail_display); + g_signal_connect(mail_display->invisible, "selection_clear_event", + G_CALLBACK (invisible_selection_clear_event_callback), mail_display); gtk_selection_add_target (mail_display->invisible, GDK_SELECTION_PRIMARY, GDK_SELECTION_TYPE_STRING, 1); @@ -2589,7 +2562,7 @@ mail_display_new (void) mail_display->scroll = E_SCROLL_FRAME (scroll); mail_display->html = GTK_HTML (html); - gtk_object_ref (GTK_OBJECT (mail_display->html)); + g_object_ref(mail_display->html); mail_display->last_active = NULL; mail_display->data = g_new0 (GData *, 1); g_datalist_init (mail_display->data); @@ -2605,25 +2578,25 @@ mail_display_initialize_gtkhtml (MailDisplay *mail_display, GtkHTML *html) gtk_html_set_editable (GTK_HTML (html), FALSE); - gtk_signal_connect (GTK_OBJECT (html), "url_requested", - GTK_SIGNAL_FUNC (on_url_requested), - mail_display); - gtk_signal_connect (GTK_OBJECT (html), "object_requested", - GTK_SIGNAL_FUNC (on_object_requested), - mail_display); - gtk_signal_connect (GTK_OBJECT (html), "link_clicked", - GTK_SIGNAL_FUNC (on_link_clicked), - mail_display); - gtk_signal_connect (GTK_OBJECT (html), "button_press_event", - GTK_SIGNAL_FUNC (html_button_press_event), mail_display); - gtk_signal_connect (GTK_OBJECT (html), "motion_notify_event", - GTK_SIGNAL_FUNC (html_motion_notify_event), mail_display); - gtk_signal_connect (GTK_OBJECT (html), "enter_notify_event", - GTK_SIGNAL_FUNC (html_enter_notify_event), mail_display); - gtk_signal_connect (GTK_OBJECT (html), "iframe_created", - GTK_SIGNAL_FUNC (html_iframe_created), mail_display); - gtk_signal_connect (GTK_OBJECT (html), "on_url", - GTK_SIGNAL_FUNC (html_on_url), mail_display); + g_signal_connect(html, "url_requested", + G_CALLBACK (on_url_requested), + mail_display); + g_signal_connect(html, "object_requested", + G_CALLBACK (on_object_requested), + mail_display); + g_signal_connect(html, "link_clicked", + G_CALLBACK (on_link_clicked), + mail_display); + g_signal_connect(html, "button_press_event", + G_CALLBACK (html_button_press_event), mail_display); + g_signal_connect(html, "motion_notify_event", + G_CALLBACK (html_motion_notify_event), mail_display); + g_signal_connect(html, "enter_notify_event", + G_CALLBACK (html_enter_notify_event), mail_display); + g_signal_connect(html, "iframe_created", + G_CALLBACK (html_iframe_created), mail_display); + g_signal_connect(html, "on_url", + G_CALLBACK (html_on_url), mail_display); } static void @@ -2676,7 +2649,7 @@ mail_display_get_url_for_icon (MailDisplay *md, const char *icon_name) if (*icon_name == '/') icon_path = g_strdup (icon_name); else { - icon_path = gnome_pixmap_file (icon_name); + icon_path = gnome_program_locate_file(NULL, GNOME_FILE_DOMAIN_PIXMAP, icon_name, TRUE, NULL); if (!icon_path) return "file:///dev/null"; } diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index fe818f33c4..2ec4e72912 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -30,6 +30,7 @@ #define G_LOG_DOMAIN "folder tree" #include <pthread.h> +#include <string.h> #include <bonobo/bonobo-exception.h> #include <camel/camel-store.h> @@ -37,7 +38,6 @@ #include <camel/camel-vtrash-folder.h> #include <camel/camel-vee-store.h> #include <camel/camel-disco-store.h> -#include <gal/util/e-unicode-i18n.h> #include "mail-mt.h" #include "mail-folder-cache.h" @@ -239,10 +239,10 @@ unset_folder_info(struct _folder_info *mfi, int delete, int unsub) if (mfi->folder) { CamelFolder *folder = mfi->folder; - camel_object_unhook_event((CamelObject *)folder, "folder_changed", folder_changed, mfi); - camel_object_unhook_event((CamelObject *)folder, "message_changed", folder_changed, mfi); - camel_object_unhook_event((CamelObject *)folder, "renamed", folder_renamed, mfi); - camel_object_unhook_event((CamelObject *)folder, "finalize", folder_finalised, mfi); + camel_object_unhook_event(folder, "folder_changed", folder_changed, mfi); + camel_object_unhook_event(folder, "message_changed", folder_changed, mfi); + camel_object_unhook_event(folder, "renamed", folder_renamed, mfi); + camel_object_unhook_event(folder, "finalize", folder_finalised, mfi); } if (strstr(mfi->uri, ";noselect") == NULL) { @@ -253,7 +253,7 @@ unset_folder_info(struct _folder_info *mfi, int delete, int unsub) up->unsub = unsub; up->store = mfi->store_info->store; up->path = g_strdup (mfi->path); - camel_object_ref((CamelObject *)up->store); + camel_object_ref(up->store); up->uri = g_strdup(mfi->uri); e_dlist_addtail(&updates, (EDListNode *)up); @@ -328,7 +328,7 @@ update_1folder(struct _folder_info *mfi, CamelFolderInfo *info) up->path = g_strdup(mfi->path); up->unread = unread; up->store = mfi->store_info->store; - camel_object_ref((CamelObject *)up->store); + camel_object_ref(up->store); e_dlist_addtail(&updates, (EDListNode *)up); flush_updates(); } @@ -361,7 +361,7 @@ setup_folder(CamelFolderInfo *fi, struct _store_info *si) up->uri = g_strdup(fi->url); up->unread = (fi->unread_message_count==-1)?0:fi->unread_message_count; up->store = si->store; - camel_object_ref((CamelObject *)up->store); + camel_object_ref(up->store); if (strstr(fi->url, ";noselect") == NULL) up->add = TRUE; @@ -456,10 +456,10 @@ void mail_note_folder(CamelFolder *folder) mfi->folder = folder; - camel_object_hook_event((CamelObject *)folder, "folder_changed", folder_changed, mfi); - camel_object_hook_event((CamelObject *)folder, "message_changed", folder_changed, mfi); - camel_object_hook_event((CamelObject *)folder, "renamed", folder_renamed, mfi); - camel_object_hook_event((CamelObject *)folder, "finalize", folder_finalised, mfi); + camel_object_hook_event(folder, "folder_changed", folder_changed, mfi); + camel_object_hook_event(folder, "message_changed", folder_changed, mfi); + camel_object_hook_event(folder, "renamed", folder_renamed, mfi); + camel_object_hook_event(folder, "finalize", folder_finalised, mfi); update_1folder(mfi, NULL); @@ -570,7 +570,8 @@ rename_folders(struct _store_info *si, const char *oldbase, const char *newbase, up->uri = g_strdup(mfi->uri); up->unread = fi->unread_message_count==-1?0:fi->unread_message_count; up->store = si->store; - camel_object_ref((CamelObject *)up->store); + camel_object_ref(up->store); + /* FIXME: use fi->flags */ if (strstr(fi->url, ";noselect") == NULL) up->add = TRUE; @@ -675,11 +676,11 @@ mail_note_store_remove(CamelStore *store) if (si) { g_hash_table_remove(stores, store); - camel_object_unhook_event((CamelObject *)store, "folder_created", store_folder_created, NULL); - camel_object_unhook_event((CamelObject *)store, "folder_deleted", store_folder_deleted, NULL); - camel_object_unhook_event((CamelObject *)store, "folder_renamed", store_folder_renamed, NULL); - camel_object_unhook_event((CamelObject *)store, "folder_subscribed", store_folder_subscribed, NULL); - camel_object_unhook_event((CamelObject *)store, "folder_unsubscribed", store_folder_unsubscribed, NULL); + camel_object_unhook_event(store, "folder_created", store_folder_created, NULL); + camel_object_unhook_event(store, "folder_deleted", store_folder_deleted, NULL); + camel_object_unhook_event(store, "folder_renamed", store_folder_renamed, NULL); + camel_object_unhook_event(store, "folder_subscribed", store_folder_subscribed, NULL); + camel_object_unhook_event(store, "folder_unsubscribed", store_folder_unsubscribed, NULL); g_hash_table_foreach(si->folders, (GHFunc)unset_folder_info_hash, NULL); ud = (struct _update_data *)si->folderinfo_updates.head; @@ -692,7 +693,7 @@ mail_note_store_remove(CamelStore *store) /* This is the only gtk object we need to unref */ mail_async_event_emit(mail_async_event, MAIL_ASYNC_GUI, (MailAsyncFunc)bonobo_object_unref, si->storage, 0, 0); - camel_object_unref((CamelObject *)si->store); + camel_object_unref(si->store); g_hash_table_foreach(si->folders, (GHFunc)free_folder_info_hash, NULL); g_hash_table_destroy(si->folders); g_hash_table_destroy(si->folders_uri); @@ -841,11 +842,11 @@ mail_note_store(CamelStore *store, EvolutionStorage *storage, GNOME_Evolution_St g_hash_table_insert(stores, store, si); e_dlist_init(&si->folderinfo_updates); - camel_object_hook_event((CamelObject *)store, "folder_created", store_folder_created, NULL); - camel_object_hook_event((CamelObject *)store, "folder_deleted", store_folder_deleted, NULL); - camel_object_hook_event((CamelObject *)store, "folder_renamed", store_folder_renamed, NULL); - camel_object_hook_event((CamelObject *)store, "folder_subscribed", store_folder_subscribed, NULL); - camel_object_hook_event((CamelObject *)store, "folder_unsubscribed", store_folder_unsubscribed, NULL); + camel_object_hook_event(store, "folder_created", store_folder_created, NULL); + camel_object_hook_event(store, "folder_deleted", store_folder_deleted, NULL); + camel_object_hook_event(store, "folder_renamed", store_folder_renamed, NULL); + camel_object_hook_event(store, "folder_subscribed", store_folder_subscribed, NULL); + camel_object_hook_event(store, "folder_unsubscribed", store_folder_unsubscribed, NULL); } @@ -889,7 +890,7 @@ int mail_note_get_folder_from_uri(const char *uri, CamelFolder **folderp) if (folderp) { if (fi.fi && fi.fi->folder) { *folderp = fi.fi->folder; - camel_object_ref((CamelObject *)*folderp); + camel_object_ref(*folderp); } else { *folderp = NULL; } diff --git a/mail/mail-font-prefs.c b/mail/mail-font-prefs.c index 985e0c5c32..0af7fc1fa7 100644 --- a/mail/mail-font-prefs.c +++ b/mail/mail-font-prefs.c @@ -54,12 +54,15 @@ font_prefs_changed (GtkHTMLPropmanager *pman, MailFontPrefs *prefs) } static void -mail_font_prefs_finalize (GtkObject *object) +mail_font_prefs_destroy (GtkObject *object) { MailFontPrefs *prefs = (MailFontPrefs *) object; - gtk_object_unref (GTK_OBJECT (prefs->pman)); - gtk_object_unref (GTK_OBJECT (prefs->gui)); + if (prefs->pman) { + g_object_unref(prefs->pman); + g_object_unref(prefs->gui); + prefs->pman = NULL; + } if (GTK_OBJECT_CLASS (parent_class)->finalize) (* GTK_OBJECT_CLASS (parent_class)->finalize) (object); @@ -71,24 +74,24 @@ mail_font_prefs_init (MailFontPrefs *prefs) GtkWidget *toplevel; GladeXML *gui; - gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", "font_tab"); + gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", "font_tab", NULL); prefs->gui = gui; prefs->pman = GTK_HTML_PROPMANAGER (gtk_html_propmanager_new (NULL)); gtk_html_propmanager_set_gui (prefs->pman, gui, NULL); - gtk_object_ref (GTK_OBJECT (prefs->pman)); + g_object_ref(prefs->pman); gtk_object_sink (GTK_OBJECT (prefs->pman)); - gtk_signal_connect (GTK_OBJECT (prefs->pman), "changed", font_prefs_changed, prefs); + g_signal_connect(prefs->pman, "changed", font_prefs_changed, prefs); /* get our toplevel widget */ toplevel = glade_xml_get_widget (gui, "toplevel"); /* reparent */ - gtk_widget_ref (toplevel); + g_object_ref (toplevel); gtk_container_remove (GTK_CONTAINER (toplevel->parent), toplevel); gtk_container_add (GTK_CONTAINER (prefs), toplevel); - gtk_widget_unref (toplevel); + g_object_unref (toplevel); } static void @@ -97,28 +100,28 @@ mail_font_prefs_class_init (MailFontPrefsClass *klass) GtkObjectClass *object_class; object_class = (GtkObjectClass *) klass; - parent_class = gtk_type_class (gtk_vbox_get_type ()); + parent_class = g_type_class_ref(gtk_vbox_get_type ()); - object_class->finalize = mail_font_prefs_finalize; + object_class->destroy = mail_font_prefs_destroy; } GtkType mail_font_prefs_get_type (void) { - static GtkType type = 0; + static GType type = 0; if (!type) { - GtkTypeInfo type_info = { - "MailFontPrefs", - sizeof (MailFontPrefs), + GTypeInfo type_info = { sizeof (MailFontPrefsClass), - (GtkClassInitFunc) mail_font_prefs_class_init, - (GtkObjectInitFunc) mail_font_prefs_init, - (GtkArgSetFunc) NULL, - (GtkArgGetFunc) NULL + NULL, NULL, + (GClassInitFunc) mail_font_prefs_class_init, + NULL, NULL, + sizeof (MailFontPrefs), + 0, + (GInstanceInitFunc) mail_font_prefs_init, }; - type = gtk_type_unique (gtk_vbox_get_type (), &type_info); + type = g_type_register_static (gtk_vbox_get_type (), "MailFontPrefs", &type_info, 0); } return type; diff --git a/mail/mail-format.c b/mail/mail-format.c index 7590e717be..ba2f4571c5 100644 --- a/mail/mail-format.c +++ b/mail/mail-format.c @@ -30,10 +30,8 @@ #include <ctype.h> #include <fcntl.h> -#include <liboaf/liboaf.h> #include <libgnome/gnome-defs.h> #include <libgnome/gnome-util.h> -#include <libgnomevfs/gnome-vfs-mime-info.h> #include <libgnomevfs/gnome-vfs-mime-handlers.h> #include <gal/widgets/e-unicode.h> #include <gal/util/e-iconv.h> @@ -44,7 +42,6 @@ #include <camel/camel-multipart-signed.h> #include <shell/e-setup.h> #include <e-util/e-html-utils.h> -#include <gal/util/e-unicode-i18n.h> #include "mail.h" #include "mail-tools.h" @@ -354,18 +351,19 @@ setup_mime_tables (void) } static gboolean -component_supports (OAF_ServerInfo *component, const char *mime_type) +component_supports (Bonobo_ServerInfo *component, const char *mime_type) { - OAF_Property *prop; + Bonobo_ActivationProperty *prop; CORBA_sequence_CORBA_string stringv; int i; - prop = oaf_server_info_prop_find (component, "repo_ids"); - if (!prop || prop->v._d != OAF_P_STRINGV) + prop = bonobo_server_info_prop_find (component, "repo_ids"); + if (!prop || prop->v._d != Bonobo_ACTIVATION_P_STRINGV) return FALSE; stringv = prop->v._u.value_stringv; for (i = 0; i < stringv._length; i++) { + /* FIXME: ascii_strcasecmp? */ if (!g_strcasecmp ("IDL:Bonobo/PersistStream:1.0", stringv._buffer[i])) break; } @@ -375,9 +373,9 @@ component_supports (OAF_ServerInfo *component, const char *mime_type) if (i >= stringv._length) return FALSE; - prop = oaf_server_info_prop_find (component, - "bonobo:supported_mime_types"); - if (!prop || prop->v._d != OAF_P_STRINGV) + prop = bonobo_server_info_prop_find (component, + "bonobo:supported_mime_types"); + if (!prop || prop->v._d != Bonobo_ACTIVATION_P_STRINGV) return FALSE; stringv = prop->v._u.value_stringv; @@ -448,7 +446,7 @@ mail_lookup_handler (const char *mime_type) if (component_supports (iter->data, mime_type)) { handler->generic = FALSE; handler->builtin = handle_via_bonobo; - handler->component = OAF_ServerInfo_duplicate (iter->data); + handler->component = Bonobo_ServerInfo_duplicate (iter->data); gnome_vfs_mime_component_list_free (components); goto reg; } @@ -505,11 +503,12 @@ mail_lookup_handler (const char *mime_type) static gboolean is_anonymous (CamelMimePart *part, const char *mime_type) { - if (!g_strncasecmp (mime_type, "multipart/", 10) || - !g_strncasecmp (mime_type, "message/", 8)) + /* FIXME: should use CamelContentType stuff */ + if (!g_ascii_strncasecmp (mime_type, "multipart/", 10) || + !g_ascii_strncasecmp (mime_type, "message/", 8)) return TRUE; - if (!g_strncasecmp (mime_type, "text/", 5) && + if (!g_ascii_strncasecmp (mime_type, "text/", 5) && !camel_mime_part_get_filename (part)) return TRUE; @@ -533,7 +532,7 @@ mail_part_is_inline (CamelMimePart *part) /* If it has an explicit disposition, return that. */ disposition = camel_mime_part_get_disposition (part); if (disposition) - return g_strcasecmp (disposition, "inline") == 0; + return g_ascii_strcasecmp (disposition, "inline") == 0; /* Certain types should default to inline. FIXME: this should * be customizable. @@ -630,7 +629,7 @@ static void attachment_header (CamelMimePart *part, const char *mime_type, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream) { - char *htmlinfo, *html_str, *fmt; + char *htmlinfo; const char *info; /* Start the table, create the pop-up object. */ @@ -649,14 +648,10 @@ attachment_header (CamelMimePart *part, const char *mime_type, MailDisplay *md, /* Write the MIME type */ - info = gnome_vfs_mime_get_value (mime_type, "description"); - html_str = e_text_to_html (info ? info : mime_type, 0); - htmlinfo = e_utf8_from_locale_string (html_str); - g_free (html_str); - fmt = e_utf8_from_locale_string (_("%s attachment")); - gtk_html_stream_printf (stream, fmt, htmlinfo); + info = gnome_vfs_mime_get_description(mime_type); + htmlinfo = e_text_to_html (info ? info : mime_type, 0); + gtk_html_stream_printf (stream, _("%s attachment"), htmlinfo); g_free (htmlinfo); - g_free (fmt); /* Write the name, if we have it. */ info = camel_mime_part_get_filename (part); @@ -684,7 +679,7 @@ format_mime_part (CamelMimePart *part, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream) { CamelDataWrapper *wrapper; - char *mime_type; + char *mime_type, *tmp; MailMimeHandler *handler; gboolean output; int inline_flags; @@ -698,14 +693,15 @@ format_mime_part (CamelMimePart *part, MailDisplay *md, if (CAMEL_IS_MULTIPART (wrapper) && camel_multipart_get_number (CAMEL_MULTIPART (wrapper)) == 0) { - mail_error_printf (html, stream, "\n%s\n", U_("Could not parse MIME message. Displaying as source.")); + mail_error_printf (html, stream, "\n%s\n", _("Could not parse MIME message. Displaying as source.")); if (mail_content_loaded (wrapper, md, TRUE, NULL, html, NULL)) handle_text_plain (part, "text/plain", md, html, stream); return TRUE; } - mime_type = camel_data_wrapper_get_mime_type (wrapper); - g_strdown (mime_type); + tmp = camel_data_wrapper_get_mime_type (wrapper); + mime_type = g_ascii_strdown (tmp, strlen(tmp)); + g_free(tmp); handler = mail_lookup_handler (mime_type); if (!handler) { @@ -753,23 +749,18 @@ enum { static void write_field_row_begin (const char *name, gint flags, GtkHTML *html, GtkHTMLStream *stream) { - char *encoded_name; gboolean bold = (flags & WRITE_BOLD); gboolean nocolumns = (flags & WRITE_NOCOLUMNS); - encoded_name = e_utf8_from_gtk_string (GTK_WIDGET (html), name); - if (nocolumns) { gtk_html_stream_printf (stream, "<tr><td>%s%s:%s ", - bold ? "<b>" : "", encoded_name, + bold ? "<b>" : "", name, bold ? "</b>" : ""); } else { gtk_html_stream_printf (stream, "<tr><%s align=\"right\" valign=\"top\">%s:" "<b> </%s><td>", bold ? "th" : "td", - encoded_name, bold ? "th" : "td"); + name, bold ? "th" : "td"); } - - g_free (encoded_name); } static void @@ -828,7 +819,7 @@ write_address (MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream, camel_internet_address_add (subaddr, name, email); addr_txt = camel_address_format (CAMEL_ADDRESS (subaddr)); addr_url = camel_url_encode (addr_txt, TRUE, NULL); - camel_object_unref (CAMEL_OBJECT (subaddr)); + camel_object_unref (subaddr); if (have_name) { name_disp = e_text_to_html (name, 0); @@ -865,11 +856,7 @@ write_address (MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream, } } else { - char *str; - - str = e_utf8_from_locale_string (_("Bad Address")); - gtk_html_stream_printf (stream, "<i>%s</i>", str); - g_free (str); + gtk_html_stream_printf (stream, "<i>%s</i>", _("Bad Address")); } g_free (name_disp); @@ -895,7 +882,7 @@ default_header_index(const char *name) int i; for (i=0;i<sizeof(default_headers)/sizeof(default_headers[0]);i++) - if (!g_strcasecmp(name, default_headers[i])) + if (!g_ascii_strcasecmp(name, default_headers[i])) return i; return -1; @@ -1084,8 +1071,8 @@ load_offline_content (MailDisplay *md, gpointer data) stream = camel_stream_null_new (); camel_data_wrapper_write_to_stream (wrapper, stream); - camel_object_unref (CAMEL_OBJECT (stream)); - camel_object_unref (CAMEL_OBJECT (wrapper)); + camel_object_unref (stream); + camel_object_unref (wrapper); } gboolean @@ -1095,7 +1082,7 @@ mail_content_loaded (CamelDataWrapper *wrapper, MailDisplay *md, gboolean redisp if (!camel_data_wrapper_is_offline (wrapper)) return TRUE; - camel_object_ref (CAMEL_OBJECT (wrapper)); + camel_object_ref (wrapper); if (redisplay) mail_display_redisplay_when_loaded (md, wrapper, load_offline_content, html, wrapper); else @@ -1120,7 +1107,7 @@ mail_format_get_data_wrapper_text (CamelDataWrapper *wrapper, MailDisplay *mail_ camel_stream_mem_set_byte_array (CAMEL_STREAM_MEM (memstream), ba); filtered_stream = camel_stream_filter_new_with_stream (memstream); - camel_object_unref (CAMEL_OBJECT (memstream)); + camel_object_unref (memstream); if (wrapper->rawtext || (mail_display && mail_display->charset)) { CamelMimeFilterCharset *filter; @@ -1144,7 +1131,7 @@ mail_format_get_data_wrapper_text (CamelDataWrapper *wrapper, MailDisplay *mail_ filter = camel_mime_filter_charset_new_convert ("utf-8", charset); if (filter) { camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (filter)); - camel_object_unref (CAMEL_OBJECT (filter)); + camel_object_unref (filter); } } @@ -1157,13 +1144,13 @@ mail_format_get_data_wrapper_text (CamelDataWrapper *wrapper, MailDisplay *mail_ filter = camel_mime_filter_charset_new_convert (charset, "utf-8"); if (filter) { camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (filter)); - camel_object_unref (CAMEL_OBJECT (filter)); + camel_object_unref (filter); } } camel_data_wrapper_write_to_stream (wrapper, CAMEL_STREAM (filtered_stream)); camel_stream_flush (CAMEL_STREAM (filtered_stream)); - camel_object_unref (CAMEL_OBJECT (filtered_stream)); + camel_object_unref (filtered_stream); for (text = ba->data, end = text + ba->len; text < end; text++) { if (!isspace ((unsigned char) *text)) @@ -1240,6 +1227,7 @@ handle_text_plain (CamelMimePart *part, const char *mime_type, g_byte_array_free (bytes, FALSE); /* Check to see if this is a broken text/html part with content-type text/plain */ + /* NOTE: isn't this done in camel now ? */ start = text; while (isspace ((unsigned) *start)) start++; @@ -1259,7 +1247,7 @@ handle_text_plain (CamelMimePart *part, const char *mime_type, * has decided to call text/plain because it starts with English * text...) */ - check_specials = !g_strcasecmp (mime_type, "text/plain"); + check_specials = !g_ascii_strcasecmp (mime_type, "text/plain"); p = text; while (p && check_specials) { @@ -1400,10 +1388,10 @@ fake_mime_part_from_data (const char *data, int len, const char *type, wrapper = camel_data_wrapper_new (); camel_data_wrapper_construct_from_stream (wrapper, memstream); camel_data_wrapper_set_mime_type (wrapper, type); - camel_object_unref (CAMEL_OBJECT (memstream)); + camel_object_unref (memstream); part = camel_mime_part_new (); camel_medium_set_content_object (CAMEL_MEDIUM (part), wrapper); - camel_object_unref (CAMEL_OBJECT (wrapper)); + camel_object_unref (wrapper); camel_mime_part_set_disposition (part, "inline"); g_hash_table_insert (fake_parts, GUINT_TO_POINTER (offset), part); @@ -1468,8 +1456,7 @@ try_uudecoding (char *start, CamelMimePart *mime_part, g_free (out); camel_mime_part_set_filename (part, filename); g_free (filename); - camel_object_hook_event (CAMEL_OBJECT (md->current_message), - "finalize", destroy_part, part); + camel_object_hook_event (md->current_message, "finalize", destroy_part, part); write_hr (html, stream); format_mime_part (part, md, html, stream); @@ -1498,8 +1485,7 @@ try_inline_binhex (char *start, CamelMimePart *mime_part, part = fake_mime_part_from_data (start, p - start, "application/mac-binhex40", offset, md); - camel_object_hook_event (CAMEL_OBJECT (md->current_message), - "finalize", destroy_part, part); + camel_object_hook_event (md->current_message, "finalize", destroy_part, part); write_hr (html, stream); format_mime_part (part, md, html, stream); @@ -1507,18 +1493,6 @@ try_inline_binhex (char *start, CamelMimePart *mime_part, return p; } -static void -g_string_append_len (GString *string, const char *str, int len) -{ - char *tmp; - - tmp = g_malloc (len + 1); - tmp[len] = 0; - memcpy (tmp, str, len); - g_string_append (string, tmp); - g_free (tmp); -} - /* text/enriched (RFC 1896) or text/richtext (included in RFC 1341) */ static gboolean handle_text_enriched (CamelMimePart *part, const char *mime_type, @@ -1535,7 +1509,8 @@ handle_text_enriched (CamelMimePart *part, const char *mime_type, if (!translations) { translations = g_hash_table_new (g_strcase_hash, g_strcase_equal); - + + /* FIXME: this should be read from a table */ g_hash_table_insert (translations, "bold", "<b>"); g_hash_table_insert (translations, "/bold", "</b>"); g_hash_table_insert (translations, "italic", "<i>"); @@ -1570,7 +1545,7 @@ handle_text_enriched (CamelMimePart *part, const char *mime_type, if (!bytes) return FALSE; - if (!g_strcasecmp (mime_type, "text/richtext")) { + if (!g_ascii_strcasecmp (mime_type, "text/richtext")) { enriched = FALSE; mail_html_write (html, stream, "\n<!-- text/richtext -->\n"); @@ -1665,8 +1640,7 @@ handle_text_enriched (CamelMimePart *part, const char *mime_type, g_free (text); ba = g_byte_array_new (); - g_byte_array_append (ba, (const guint8 *)string->str, - string->len); + g_byte_array_append (ba, (const guint8 *)string->str, string->len); g_string_free (string, TRUE); xed = g_strdup_printf ("x-evolution-data:%p", part); @@ -1727,7 +1701,7 @@ handle_multipart_mixed (CamelMimePart *part, const char *mime_type, gboolean output = FALSE; if (!CAMEL_IS_MULTIPART (wrapper)) { - mail_error_printf (html, stream, "\n%s\n", U_("Could not parse MIME message. Displaying as source.")); + mail_error_printf (html, stream, "\n%s\n", _("Could not parse MIME message. Displaying as source.")); if (mail_content_loaded (wrapper, md, TRUE, NULL, html, NULL)) handle_text_plain (part, "text/plain", md, html, stream); return TRUE; @@ -1773,13 +1747,7 @@ handle_multipart_encrypted (CamelMimePart *part, const char *mime_type, camel_object_unref (cipher); if (camel_exception_is_set (&ex)) { - char *error; - - error = e_utf8_from_locale_string (camel_exception_get_description (&ex)); - - mail_error_printf (html, stream, "\n%s\n", error); - g_free (error); - + mail_error_printf (html, stream, "\n%s\n", camel_exception_get_description(&ex)); camel_exception_clear (&ex); return TRUE; } @@ -1802,7 +1770,7 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type, wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part)); if (!CAMEL_IS_MULTIPART_SIGNED (wrapper)) { - mail_error_printf (html, stream, "\n%s\n", U_("Could not parse MIME message. Displaying as source.")); + mail_error_printf (html, stream, "\n%s\n", _("Could not parse MIME message. Displaying as source.")); if (mail_content_loaded (wrapper, md, TRUE, NULL, html, NULL)) handle_text_plain (part, "text/plain", md, html, stream); return TRUE; @@ -1845,8 +1813,8 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type, mail_display_add_url (md, "part_urls", url, subpart); mail_html_write (html, stream, - U_("This message is digitally signed. " - "Click the lock icon for more information.")); + _("This message is digitally signed. " + "Click the lock icon for more information.")); mail_html_write (html, stream, "</font></td></tr><tr><td height=10><table height=10 cellspacing=0 cellpadding=0>" @@ -1864,7 +1832,7 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type, cipher = camel_gpg_context_new (session); if (cipher) { valid = camel_multipart_signed_verify (mps, cipher, &ex); - camel_object_unref (CAMEL_OBJECT (cipher)); + camel_object_unref (cipher); if (valid) { good = camel_cipher_validity_get_valid (valid); message = camel_cipher_validity_get_description (valid); @@ -1872,7 +1840,7 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type, message = camel_exception_get_description (&ex); } } else { - message = U_("Could not create a PGP verfication context"); + message = _("Could not create a PGP verfication context"); } if (good) { @@ -1881,16 +1849,16 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type, "<td><img src=\"%s\"></td>" "<td>%s<br><br>", mail_display_get_url_for_icon (md, EVOLUTION_ICONSDIR "/pgp-signature-ok.png"), - U_("This message is digitally signed and " - "has been found to be authentic.")); + _("This message is digitally signed and " + "has been found to be authentic.")); } else { gtk_html_stream_printf (stream, "<table><tr valign=top>" "<td><img src=\"%s\"></td>" "<td>%s<br><br>", mail_display_get_url_for_icon (md, EVOLUTION_ICONSDIR "/pgp-signature-bad.png"), - U_("This message is digitally signed but can " - "not be proven to be authentic.")); + _("This message is digitally signed but can " + "not be proven to be authentic.")); } if (message) { @@ -1922,7 +1890,7 @@ handle_multipart_related (CamelMimePart *part, const char *mime_type, int ret; if (!CAMEL_IS_MULTIPART (wrapper)) { - mail_error_printf (html, stream, "\n%s\n", U_("Could not parse MIME message. Displaying as source.")); + mail_error_printf (html, stream, "\n%s\n", _("Could not parse MIME message. Displaying as source.")); if (mail_content_loaded (wrapper, md, TRUE, NULL, html, NULL)) handle_text_plain (part, "text/plain", md, html, stream); return TRUE; @@ -2047,7 +2015,7 @@ handle_multipart_alternative (CamelMimePart *part, const char *mime_type, CamelMimePart *mime_part; if (!CAMEL_IS_MULTIPART (wrapper)) { - mail_error_printf (html, stream, "\n%s\n", U_("Could not parse MIME message. Displaying as source.")); + mail_error_printf (html, stream, "\n%s\n", _("Could not parse MIME message. Displaying as source.")); if (mail_content_loaded (wrapper, md, TRUE, NULL, html, NULL)) handle_text_plain (part, "text/plain", md, html, stream); return TRUE; @@ -2072,7 +2040,7 @@ handle_multipart_appledouble (CamelMimePart *part, const char *mime_type, CamelMultipart *multipart; if (!CAMEL_IS_MULTIPART (wrapper)) { - mail_error_printf (html, stream, "\n%s\n", U_("Could not parse MIME message. Displaying as source.")); + mail_error_printf (html, stream, "\n%s\n", _("Could not parse MIME message. Displaying as source.")); if (mail_content_loaded (wrapper, md, TRUE, NULL, html, NULL)) handle_text_plain (part, "text/plain", md, html, stream); return TRUE; @@ -2111,15 +2079,14 @@ handle_message_external_body (CamelMimePart *part, const char *mime_type, CamelContentType *type; const char *access_type; char *url = NULL, *desc = NULL; - char *fmt; - + type = camel_mime_part_get_content_type (part); access_type = header_content_type_param (type, "access-type"); if (!access_type) goto fallback; - if (!g_strcasecmp (access_type, "ftp") || - !g_strcasecmp (access_type, "anon-ftp")) { + if (!g_ascii_strcasecmp (access_type, "ftp") || + !g_ascii_strcasecmp (access_type, "anon-ftp")) { const char *name, *site, *dir, *mode, *ftype; char *path; @@ -2154,10 +2121,8 @@ handle_message_external_body (CamelMimePart *part, const char *mime_type, url = g_strdup_printf ("ftp://%s%s%s", site, path, ftype); g_free (path); - fmt = e_utf8_from_locale_string (_("Pointer to FTP site (%s)")); - desc = g_strdup_printf (fmt, url); - g_free (fmt); - } else if (!g_strcasecmp (access_type, "local-file")) { + desc = g_strdup_printf (_("Pointer to FTP site (%s)"), url); + } else if (!g_ascii_strcasecmp (access_type, "local-file")) { const char *name, *site; name = header_content_type_param (type, "name"); @@ -2168,16 +2133,12 @@ handle_message_external_body (CamelMimePart *part, const char *mime_type, url = g_strdup_printf ("file://%s%s", *name == '/' ? "" : "/", name); if (site) { - fmt = e_utf8_from_locale_string (_("Pointer to local file (%s) " - "valid at site \"%s\"")); - desc = g_strdup_printf (fmt, name, site); - g_free (fmt); + desc = g_strdup_printf(_("Pointer to local file (%s) " + "valid at site \"%s\""), name, site); } else { - fmt = e_utf8_from_locale_string (_("Pointer to local file (%s)")); - desc = g_strdup_printf (fmt, name); - g_free (fmt); + desc = g_strdup_printf(_("Pointer to local file (%s)"), name); } - } else if (!g_strcasecmp (access_type, "URL")) { + } else if (!g_ascii_strcasecmp (access_type, "URL")) { const char *urlparam; char *s, *d; @@ -2202,20 +2163,15 @@ handle_message_external_body (CamelMimePart *part, const char *mime_type, } *d = *s; - fmt = e_utf8_from_locale_string (_("Pointer to remote data (%s)")); - desc = g_strdup_printf (fmt, url); - g_free (fmt); + desc = g_strdup_printf(_("Pointer to remote data (%s)"), url); } fallback: if (!desc) { - if (access_type) { - fmt = e_utf8_from_locale_string (_("Pointer to unknown external data " - "(\"%s\" type)")); - desc = g_strdup_printf (fmt, access_type); - g_free (fmt); - } else - desc = e_utf8_from_locale_string (_("Malformed external-body part.")); + if (access_type) + desc = g_strdup_printf (_("Pointer to unknown external data (\"%s\" type)"), access_type); + else + desc = g_strdup(_("Malformed external-body part.")); } #if 0 /* FIXME */ diff --git a/mail/mail-identify.c b/mail/mail-identify.c index 21e3b6a0fd..e2f614f059 100644 --- a/mail/mail-identify.c +++ b/mail/mail-identify.c @@ -30,8 +30,7 @@ #include <string.h> #include <glib.h> -#include <libgnomevfs/gnome-vfs-mime.h> -#include <libgnomevfs/gnome-vfs-mime-sniff-buffer.h> +#include <libgnomevfs/gnome-vfs-mime-utils.h> #include "mail.h" static const char *identify_by_magic (CamelDataWrapper *data, MailDisplay *md); @@ -50,8 +49,9 @@ static const char *identify_by_magic (CamelDataWrapper *data, MailDisplay *md); char * mail_identify_mime_part (CamelMimePart *part, MailDisplay *md) { - const char *filename, *name_type = NULL, *magic_type = NULL; + const char *filename, *magic_type = NULL; CamelDataWrapper *data; + char *name_type = NULL; filename = camel_mime_part_get_filename (part); if (filename) { @@ -59,7 +59,8 @@ mail_identify_mime_part (CamelMimePart *part, MailDisplay *md) if (!strcmp (filename, "winmail.dat")) return g_strdup ("application/vnd.ms-tnef"); - name_type = gnome_vfs_mime_type_from_name_or_default (filename, NULL); +#warning "does gnome_vfs_get_mime_type handle a plain filename as the 'text_uri'?" + name_type = gnome_vfs_get_mime_type(filename); } data = camel_medium_get_content_object (CAMEL_MEDIUM (part)); @@ -73,24 +74,26 @@ mail_identify_mime_part (CamelMimePart *part, MailDisplay *md) * that instead. */ if (!strcmp (magic_type, "text/plain")) - return g_strdup (name_type); + return name_type; /* If if returns "application/octet-stream" try to * do better with the filename check. */ if (!strcmp (magic_type, "application/octet-stream")) - return g_strdup (name_type); + return name_type; } /* If the MIME part data was online, and the magic check * returned something, use that, since it's more reliable. */ - if (magic_type) + if (magic_type) { + g_free(name_type); return g_strdup (magic_type); + } /* Otherwise try guessing based on the filename */ if (name_type) - return g_strdup (name_type); + return name_type; /* Another possibility to try is the x-mac-type / x-mac-creator * parameter to Content-Type used by some Mac email clients. That @@ -115,21 +118,15 @@ mail_identify_mime_part (CamelMimePart *part, MailDisplay *md) static const char * identify_by_magic (CamelDataWrapper *data, MailDisplay *md) { - GnomeVFSMimeSniffBuffer *sniffer; - CamelStream *memstream; + CamelStreamMem *memstream; const char *type; - GByteArray *ba; - - ba = g_byte_array_new (); - memstream = camel_stream_mem_new_with_byte_array (ba); - camel_data_wrapper_write_to_stream (data, memstream); - if (ba->len) { - sniffer = gnome_vfs_mime_sniff_buffer_new_from_memory (ba->data, ba->len); - type = gnome_vfs_get_mime_type_for_buffer (sniffer); - gnome_vfs_mime_sniff_buffer_free (sniffer); - } else + + memstream = (CamelStreamMem *)camel_stream_mem_new(); + if (camel_data_wrapper_write_to_stream (data, (CamelStream *)memstream) > 0) + type = gnome_vfs_get_mime_type_for_data(memstream->buffer->data, memstream->buffer->len); + else type = NULL; - camel_object_unref (CAMEL_OBJECT (memstream)); + camel_object_unref(memstream); return type; } diff --git a/mail/mail-importer.c b/mail/mail-importer.c index 13616b31a0..ee785f6bbe 100644 --- a/mail/mail-importer.c +++ b/mail/mail-importer.c @@ -24,6 +24,7 @@ #include <config.h> #endif +#include <string.h> #include <sys/types.h> #include <dirent.h> #include <gmodule.h> @@ -79,16 +80,14 @@ mail_importer_create_folder (const char *parent_path, g_return_if_fail (listener != NULL); g_return_if_fail (BONOBO_IS_LISTENER (listener)); - path = g_concat_dir_and_file (parent_path, name); - physical = g_strdup_printf ("file://%s/local/%s", evolution_dir, - parent_path); + path = g_build_filename(parent_path, name, NULL); + physical = g_strdup_printf ("file://%s/local/%s", evolution_dir, parent_path); corba_listener = bonobo_object_corba_objref (BONOBO_OBJECT (listener)); /* Darn CORBA wanting non-NULL values for strings */ real_description = CORBA_string_dup (description ? description : ""); - CORBA_exception_init (&ev); GNOME_Evolution_Storage_asyncCreateFolder (local_storage, path, "mail", @@ -117,12 +116,10 @@ mail_importer_add_line (MailImporter *importer, CamelMessageInfo *info; CamelException *ex; - if (importer->mstream == NULL) { + if (importer->mstream == NULL) importer->mstream = CAMEL_STREAM_MEM (camel_stream_mem_new ()); - } - camel_stream_write (CAMEL_STREAM (importer->mstream), str, - strlen (str)); + camel_stream_write (CAMEL_STREAM (importer->mstream), str, strlen (str)); if (finished == FALSE) return; @@ -135,12 +132,12 @@ mail_importer_add_line (MailImporter *importer, camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (msg), CAMEL_STREAM (importer->mstream)); - camel_object_unref (CAMEL_OBJECT (importer->mstream)); + camel_object_unref (importer->mstream); importer->mstream = NULL; ex = camel_exception_new (); camel_folder_append_message (importer->folder, msg, info, NULL, ex); - camel_object_unref (CAMEL_OBJECT (msg)); + camel_object_unref (msg); camel_exception_free (ex); g_free (info); @@ -167,7 +164,7 @@ get_importer_list (void) if (!ext || strcmp (ext, ".so") != 0) continue; - path = g_concat_dir_and_file (MAIL_IMPORTERSDIR, d->d_name); + path = g_build_filename (MAIL_IMPORTERSDIR, d->d_name, NULL); importers_ret = g_list_prepend (importers_ret, path); } diff --git a/mail/mail-local.c b/mail/mail-local.c index eba907e178..ccec409a06 100644 --- a/mail/mail-local.c +++ b/mail/mail-local.c @@ -32,14 +32,11 @@ #include <unistd.h> #include <errno.h> -#include <gnome-xml/xmlmemory.h> -#include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-dialog-util.h> +#include <libxml/xmlmemory.h> #include <glade/glade.h> #include "e-util/e-path.h" #include <gal/widgets/e-gui-utils.h> -#include <gal/util/e-unicode-i18n.h> #include <gal/util/e-xml-utils.h> #include "Evolution.h" @@ -151,11 +148,11 @@ load_metainfo(const char *path) if (doc == NULL) goto dodefault; - node = doc->root; + node = doc->children; if (strcmp(node->name, "folderinfo")) goto dodefault; - node = node->childs; + node = node->children; while (node) { if (!strcmp(node->name, "folder")) { char *index, *txt; @@ -239,11 +236,11 @@ mlf_refresh_info(CamelFolder *folder, CamelException *ex) LOCAL_FOLDER_LOCK(mlf); f = mlf->real_folder; - camel_object_ref((CamelObject *)f); + camel_object_ref(f); LOCAL_FOLDER_UNLOCK(mlf); camel_folder_refresh_info(f, ex); - camel_object_unref((CamelObject *)f); + camel_object_unref(f); } static void @@ -254,11 +251,11 @@ mlf_sync(CamelFolder *folder, gboolean expunge, CamelException *ex) LOCAL_FOLDER_LOCK(mlf); f = mlf->real_folder; - camel_object_ref((CamelObject *)f); + camel_object_ref(f); LOCAL_FOLDER_UNLOCK(mlf); camel_folder_sync(f, expunge, ex); - camel_object_unref((CamelObject *)f); + camel_object_unref(f); } static void @@ -269,11 +266,11 @@ mlf_expunge(CamelFolder *folder, CamelException *ex) LOCAL_FOLDER_LOCK(mlf); f = mlf->real_folder; - camel_object_ref((CamelObject *)f); + camel_object_ref(f); LOCAL_FOLDER_UNLOCK(mlf); camel_folder_expunge(f, ex); - camel_object_unref((CamelObject *)f); + camel_object_unref(f); } static void @@ -284,11 +281,11 @@ mlf_append_message(CamelFolder *folder, CamelMimeMessage *message, const CamelMe LOCAL_FOLDER_LOCK(mlf); f = mlf->real_folder; - camel_object_ref((CamelObject *)f); + camel_object_ref(f); LOCAL_FOLDER_UNLOCK(mlf); camel_folder_append_message(f, message, info, appended_uid, ex); - camel_object_unref((CamelObject *)f); + camel_object_unref(f); } static CamelMimeMessage * @@ -300,11 +297,11 @@ mlf_get_message(CamelFolder *folder, const char *uid, CamelException *ex) LOCAL_FOLDER_LOCK(mlf); f = mlf->real_folder; - camel_object_ref((CamelObject *)f); + camel_object_ref(f); LOCAL_FOLDER_UNLOCK(mlf); ret = camel_folder_get_message(f, uid, ex); - camel_object_unref((CamelObject *)f); + camel_object_unref(f); return ret; } @@ -318,11 +315,11 @@ mlf_search_by_expression(CamelFolder *folder, const char *expression, CamelExcep LOCAL_FOLDER_LOCK(mlf); f = mlf->real_folder; - camel_object_ref((CamelObject *)f); + camel_object_ref(f); LOCAL_FOLDER_UNLOCK(mlf); ret = camel_folder_search_by_expression(f, expression, ex); - camel_object_unref((CamelObject *)f); + camel_object_unref(f); return ret; } @@ -336,11 +333,11 @@ mlf_search_by_uids(CamelFolder *folder, const char *expression, GPtrArray *uids, LOCAL_FOLDER_LOCK(mlf); f = mlf->real_folder; - camel_object_ref((CamelObject *)f); + camel_object_ref(f); LOCAL_FOLDER_UNLOCK(mlf); ret = camel_folder_search_by_uids(f, expression, uids, ex); - camel_object_unref((CamelObject *)f); + camel_object_unref(f); return ret; } @@ -353,11 +350,11 @@ mlf_search_free(CamelFolder *folder, GPtrArray *result) LOCAL_FOLDER_LOCK(mlf); f = mlf->real_folder; - camel_object_ref((CamelObject *)f); + camel_object_ref(f); LOCAL_FOLDER_UNLOCK(mlf); camel_folder_search_free(f, result); - camel_object_unref((CamelObject *)f); + camel_object_unref(f); } static void @@ -368,11 +365,11 @@ mlf_set_message_flags(CamelFolder *folder, const char *uid, guint32 flags, guint LOCAL_FOLDER_LOCK(mlf); f = mlf->real_folder; - camel_object_ref((CamelObject *)f); + camel_object_ref(f); LOCAL_FOLDER_UNLOCK(mlf); camel_folder_set_message_flags(mlf->real_folder, uid, flags, set); - camel_object_unref((CamelObject *)f); + camel_object_unref(f); } static void @@ -383,11 +380,11 @@ mlf_set_message_user_flag(CamelFolder *folder, const char *uid, const char *name LOCAL_FOLDER_LOCK(mlf); f = mlf->real_folder; - camel_object_ref((CamelObject *)f); + camel_object_ref(f); LOCAL_FOLDER_UNLOCK(mlf); camel_folder_set_message_user_flag(mlf->real_folder, uid, name, value); - camel_object_unref((CamelObject *)f); + camel_object_unref(f); } static void @@ -398,11 +395,11 @@ mlf_set_message_user_tag(CamelFolder *folder, const char *uid, const char *name, LOCAL_FOLDER_LOCK(mlf); f = mlf->real_folder; - camel_object_ref((CamelObject *)f); + camel_object_ref(f); LOCAL_FOLDER_UNLOCK(mlf); camel_folder_set_message_user_tag(mlf->real_folder, uid, name, value); - camel_object_unref((CamelObject *)f); + camel_object_unref(f); } /* Internal store-rename call, update our strings */ @@ -437,13 +434,13 @@ mlf_rename(CamelFolder *folder, const char *new) static void mlf_proxy_message_changed(CamelObject *real_folder, gpointer event_data, gpointer user_data) { - camel_object_trigger_event((CamelObject *)user_data, "message_changed", event_data); + camel_object_trigger_event(user_data, "message_changed", event_data); } static void mlf_proxy_folder_changed(CamelObject *real_folder, gpointer event_data, gpointer user_data) { - camel_object_trigger_event((CamelObject *)user_data, "folder_changed", event_data); + camel_object_trigger_event(user_data, "folder_changed", event_data); } static void @@ -453,20 +450,20 @@ mlf_unset_folder (MailLocalFolder *mlf) g_assert(mlf->real_folder); - camel_object_unhook_event(CAMEL_OBJECT(mlf->real_folder), + camel_object_unhook_event(mlf->real_folder, "message_changed", mlf_proxy_message_changed, mlf); - camel_object_unhook_event(CAMEL_OBJECT(mlf->real_folder), + camel_object_unhook_event(mlf->real_folder, "folder_changed", mlf_proxy_folder_changed, mlf); - camel_object_unref((CamelObject *)folder->summary); + camel_object_unref(folder->summary); folder->summary = NULL; - camel_object_unref((CamelObject *)mlf->real_folder); + camel_object_unref(mlf->real_folder); mlf->real_folder = NULL; - camel_object_unref((CamelObject *)mlf->real_store); + camel_object_unref(mlf->real_store); mlf->real_store = NULL; folder->permanent_flags = 0; @@ -502,14 +499,14 @@ mlf_set_folder(MailLocalFolder *mlf, guint32 flags, CamelException *ex) if (mlf->real_folder->folder_flags & CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY) { folder->summary = mlf->real_folder->summary; - camel_object_ref((CamelObject *)mlf->real_folder->summary); + camel_object_ref(mlf->real_folder->summary); } folder->permanent_flags = mlf->real_folder->permanent_flags; folder->folder_flags = mlf->real_folder->folder_flags; - camel_object_hook_event((CamelObject *)mlf->real_folder, "message_changed", mlf_proxy_message_changed, mlf); - camel_object_hook_event((CamelObject *)mlf->real_folder, "folder_changed", mlf_proxy_folder_changed, mlf); + camel_object_hook_event(mlf->real_folder, "message_changed", mlf_proxy_message_changed, mlf); + camel_object_hook_event(mlf->real_folder, "folder_changed", mlf_proxy_folder_changed, mlf); return TRUE; } @@ -536,9 +533,9 @@ mlf_getv(CamelObject *object, CamelException *ex, CamelArgGetV *args) /* string to describe a local folder as the location of a message */ pathlen = strlen(evolution_dir) + strlen("local") + 1; if (strlen(folder->full_name) > pathlen) - mlf->description = g_strdup_printf(U_("Local folders/%s"), folder->full_name+pathlen); + mlf->description = g_strdup_printf(_("Local folders/%s"), folder->full_name+pathlen); else - mlf->description = g_strdup_printf(U_("Local folders/%s"), folder->name); + mlf->description = g_strdup_printf(_("Local folders/%s"), folder->name); } *arg->ca_str = mlf->description; break; @@ -622,7 +619,7 @@ mail_local_folder_get_type (void) NULL, mlf_init, mlf_finalize); - mlf_parent_class = (CamelFolderClass *)camel_type_get_global_classfuncs (CAMEL_FOLDER_TYPE); + mlf_parent_class = (CamelFolderClass *)CAMEL_FOLDER_TYPE; } return mail_local_folder_type; @@ -740,7 +737,7 @@ mail_local_folder_reconfigure (MailLocalFolder *mlf, const char *new_format, int camel_folder_expunge(fromfolder, ex); d(printf("delete old mbox ...\n")); - camel_object_unref(CAMEL_OBJECT(fromfolder)); + camel_object_unref(fromfolder); fromfolder = NULL; camel_store_delete_folder(fromstore, tmpname, ex); @@ -763,9 +760,9 @@ mail_local_folder_reconfigure (MailLocalFolder *mlf, const char *new_format, int if (mlf->real_folder == NULL) mlf_set_folder (mlf, CAMEL_STORE_FOLDER_CREATE, ex); if (fromfolder) - camel_object_unref((CamelObject *)fromfolder); + camel_object_unref(fromfolder); if (fromstore) - camel_object_unref((CamelObject *)fromstore); + camel_object_unref(fromstore); g_free(tmpname); g_free(mbox); @@ -798,7 +795,7 @@ mls_get_folder(CamelStore *store, const char *folder_name, guint32 flags, CamelE return NULL; if (!mlf_set_folder(folder, flags, ex)) { - camel_object_unref(CAMEL_OBJECT(folder)); + camel_object_unref(folder); return NULL; } @@ -806,8 +803,8 @@ mls_get_folder(CamelStore *store, const char *folder_name, guint32 flags, CamelE if (save_metainfo(folder->meta) == FALSE) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot save folder metainfo to %s: %s"), - folder->meta->path, strerror(errno)); - camel_object_unref(CAMEL_OBJECT (folder)); + folder->meta->path, g_strerror(errno)); + camel_object_unref(folder); return NULL; } } @@ -836,7 +833,7 @@ mls_delete_folder(CamelStore *store, const char *folder_name, CamelException *ex if (real_store == NULL) { g_free(metapath); free_metainfo(meta); - camel_object_unref((CamelObject *)real_store); + camel_object_unref(real_store); return; } @@ -847,7 +844,7 @@ mls_delete_folder(CamelStore *store, const char *folder_name, CamelException *ex camel_exception_xfer(ex, &local_ex); g_free(metapath); free_metainfo(meta); - camel_object_unref((CamelObject *)real_store); + camel_object_unref(real_store); return; } @@ -858,7 +855,7 @@ mls_delete_folder(CamelStore *store, const char *folder_name, CamelException *ex if (unlink(metapath) == -1) { camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot delete folder metadata %s: %s"), - metapath, strerror(errno)); + metapath, g_strerror(errno)); } g_free(metapath); @@ -938,7 +935,7 @@ mls_rename_folder(CamelStore *store, const char *old_name, const char *new_name, reninfo.new = info; reninfo.old_base = (char *)old_name; - camel_object_trigger_event((CamelObject *)store, "folder_renamed", &reninfo); + camel_object_trigger_event(store, "folder_renamed", &reninfo); } else { g_free(newuri); g_warning("Cannot find existing folder '%s' in table?\n", olduri); @@ -952,7 +949,7 @@ mls_rename_folder(CamelStore *store, const char *old_name, const char *new_name, g_free(newname); g_free(oldname); - camel_object_unref((CamelObject *)real_store); + camel_object_unref(real_store); free_metainfo(meta); @@ -1064,7 +1061,7 @@ static void mail_local_store_add_folder(MailLocalStore *mls, const char *uri, co if (info) { /* FIXME: should copy info, so we dont get a removed while we're using it? */ - camel_object_trigger_event((CamelObject *)mls, "folder_created", info); + camel_object_trigger_event(mls, "folder_created", info); /* this is just so the folder is opened at least once to setup the folder counts etc in the display. Joy eh? The result is discarded. */ @@ -1099,7 +1096,7 @@ static void mail_local_store_remove_folder(MailLocalStore *mls, const char *path LOCAL_STORE_UNLOCK(mls); if (data.info) { - camel_object_trigger_event((CamelObject *)mls, "folder_deleted", data.info); + camel_object_trigger_event(mls, "folder_deleted", data.info); g_free(data.info->url); g_free(data.info->full_name); @@ -1192,7 +1189,7 @@ local_storage_new_folder_cb (EvolutionStorageListener *storage_listener, info.unread_message_count = 0; info.path = (char *)path; - camel_object_trigger_event((CamelObject *)global_local_store, "folder_created", &info); + camel_object_trigger_event(global_local_store, "folder_created", &info); g_free(info.url); camel_url_free(url); } @@ -1233,18 +1230,19 @@ storage_listener_startup (EvolutionShellClient *shellclient) corba_local_storage_listener = evolution_storage_listener_corba_objref ( local_storage_listener); - gtk_signal_connect (GTK_OBJECT (local_storage_listener), - "destroyed", - GTK_SIGNAL_FUNC (local_storage_destroyed_cb), - corba_storage); - gtk_signal_connect (GTK_OBJECT (local_storage_listener), - "new_folder", - GTK_SIGNAL_FUNC (local_storage_new_folder_cb), - corba_storage); - gtk_signal_connect (GTK_OBJECT (local_storage_listener), - "removed_folder", - GTK_SIGNAL_FUNC (local_storage_removed_folder_cb), - corba_storage); + /* FIXME: is this supposed to be destroy? */ + g_signal_connect(local_storage_listener, + "destroyed", + G_CALLBACK (local_storage_destroyed_cb), + corba_storage); + g_signal_connect(local_storage_listener, + "new_folder", + G_CALLBACK (local_storage_new_folder_cb), + corba_storage); + g_signal_connect(local_storage_listener, + "removed_folder", + G_CALLBACK (local_storage_removed_folder_cb), + corba_storage); CORBA_exception_init (&ev); GNOME_Evolution_Storage_addListener (corba_storage, @@ -1370,7 +1368,7 @@ reconfigure_folder_free (struct _mail_msg *mm) } if (m->folder) - camel_object_unref (CAMEL_OBJECT (m->folder)); + camel_object_unref (m->folder); g_free(m->uri); g_free (m->newtype); } @@ -1383,10 +1381,12 @@ static struct _mail_msg_op reconfigure_folder_op = { }; static void -reconfigure_clicked (GnomeDialog *dialog, int button, struct _reconfigure_msg *m) +reconfigure_response(GtkDialog *dialog, int button, struct _reconfigure_msg *m) { - if (button == 0) { + switch(button) { + case GTK_RESPONSE_OK: { GtkWidget *menu, *item; + menu = gtk_option_menu_get_menu(m->optionlist); item = gtk_menu_get_active(GTK_MENU(menu)); m->newtype = g_strdup(gtk_object_get_data((GtkObject *)item, "type")); @@ -1397,21 +1397,24 @@ reconfigure_clicked (GnomeDialog *dialog, int button, struct _reconfigure_msg *m gtk_widget_set_sensitive (m->cancel, FALSE); e_thread_put (mail_thread_queued, (EMsg *)m); - } else { + break; } + case GTK_RESPONSE_CANCEL: + default: if (m->done) m->done(m->uri, NULL, m->done_data); mail_msg_free ((struct _mail_msg *)m); + break; } - - if (button != -1) - gnome_dialog_close (dialog); + + gtk_widget_destroy((GtkWidget *)dialog); + g_object_unref(dialog); } static void reconfigure_got_folder(char *uri, CamelFolder *folder, void *data) { GladeXML *gui; - GnomeDialog *gd; + GtkDialog *gd; struct _reconfigure_msg *m = data; char *title; GList *p; @@ -1440,8 +1443,8 @@ reconfigure_got_folder(char *uri, CamelFolder *folder, void *data) return; } - gui = glade_xml_new (EVOLUTION_GLADEDIR "/local-config.glade", "dialog_format"); - gd = (GnomeDialog *)glade_xml_get_widget (gui, "dialog_format"); + gui = glade_xml_new (EVOLUTION_GLADEDIR "/local-config.glade", "dialog_format", NULL); + gd = (GtkDialog *)glade_xml_get_widget (gui, "dialog_format"); title = g_strdup_printf (_("Reconfigure /%s"), camel_folder_get_full_name (folder)); @@ -1477,7 +1480,7 @@ reconfigure_got_folder(char *uri, CamelFolder *folder, void *data) label = g_strdup_printf("%s (%s)", cp->protocol, _(cp->name)); item = gtk_menu_item_new_with_label(label); g_free(label); - gtk_object_set_data((GtkObject *)item, "type", cp->protocol); + g_object_set_data(G_OBJECT(item), "type", cp->protocol); gtk_widget_show(item); gtk_menu_append(GTK_MENU(menu), item); index++; @@ -1492,8 +1495,8 @@ reconfigure_got_folder(char *uri, CamelFolder *folder, void *data) gtk_label_set_text ((GtkLabel *)glade_xml_get_widget (gui, "label_format"), MAIL_LOCAL_FOLDER (folder)->meta->format); - gtk_signal_connect (GTK_OBJECT (gd), "clicked", reconfigure_clicked, m); - gtk_object_unref (GTK_OBJECT (gui)); + g_signal_connect(gd, "response", G_CALLBACK(reconfigure_response), m); + g_object_unref(gui); g_hash_table_insert (reconfigure_folder_hash, (gpointer) folder, (gpointer) gd); diff --git a/mail/mail-mt.c b/mail/mail-mt.c index cf552dbdb5..631f46b34c 100644 --- a/mail/mail-mt.c +++ b/mail/mail-mt.c @@ -9,16 +9,12 @@ #include <glib.h> -#include <gtk/gtkentry.h> #include <gtk/gtkmain.h> #include <gtk/gtkwidget.h> -#include <gtk/gtkcheckbutton.h> +#include <gtk/gtkdialog.h> +#include <gtk/gtkstock.h> #include <libgnome/gnome-defs.h> #include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-dialog-util.h> -#include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-stock.h> #include <gal/widgets/e-gui-utils.h> #include <gal/widgets/e-unicode.h> @@ -140,7 +136,7 @@ void *mail_msg_new(mail_msg_op_t *ops, EMsgPort *reply_port, size_t size) static void destroy_objects(CamelObject *o, void *event_data, void *data) { if (event_data) - gtk_object_unref(event_data); + g_object_unref(event_data); } #ifdef MALLOC_CHECK @@ -221,9 +217,12 @@ void mail_msg_free(void *msg) /* hash table of ops->dialogue of active errors */ static GHashTable *active_errors = NULL; -static void error_gone(GtkObject *o, void *data) +static void error_response(GtkObject *o, int button, void *data) { g_hash_table_remove(active_errors, data); + + gtk_widget_destroy((GtkWidget *)o); + g_object_unref(o); } void mail_msg_check_error(void *msg) @@ -231,7 +230,7 @@ void mail_msg_check_error(void *msg) struct _mail_msg *m = msg; char *what = NULL; char *text; - GnomeDialog *gd; + GtkDialog *gd; #ifdef MALLOC_CHECK checkmem(m); @@ -268,11 +267,9 @@ void mail_msg_check_error(void *msg) return; } - gd = (GnomeDialog *)gnome_error_dialog(text); + gd = (GtkDialog *)gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s", text); g_hash_table_insert(active_errors, m->ops, gd); - g_free(text); - gtk_signal_connect((GtkObject *)gd, "destroy", error_gone, m->ops); - gnome_dialog_set_close(gd, TRUE); + g_signal_connect(gd, "response", G_CALLBACK(error_response), m->ops); gtk_widget_show((GtkWidget *)gd); } @@ -919,7 +916,7 @@ static void do_op_status(struct _mail_msg *mm) if (data->activity_state == 3) { MAIL_MT_UNLOCK (mail_msg_lock); if (activity) - gtk_object_unref (GTK_OBJECT (activity)); + g_object_unref(activity); if (msg->cancel) camel_operation_unref (msg->cancel); camel_exception_clear (&msg->ex); @@ -934,11 +931,11 @@ static void do_op_status(struct _mail_msg *mm) } } else if (data->activity) { activity = data->activity; - gtk_object_ref (GTK_OBJECT (activity)); + g_object_ref((activity)); MAIL_MT_UNLOCK (mail_msg_lock); evolution_activity_client_update (activity, out, (double)(pc/100.0)); - gtk_object_unref (GTK_OBJECT (activity)); + g_object_unref(activity); } else { MAIL_MT_UNLOCK (mail_msg_lock); } @@ -1009,6 +1006,6 @@ set_stop(int sensitive) bonobo_ui_component_set_prop(uic, "/commands/MailStop", "sensitive", sensitive?"1":"0", NULL); } - gtk_object_unref(GTK_OBJECT(it)); + g_object_unref(it); last = sensitive; } diff --git a/mail/mail-offline-handler.c b/mail/mail-offline-handler.c index 2c571d47f7..e9387215e4 100644 --- a/mail/mail-offline-handler.c +++ b/mail/mail-offline-handler.c @@ -290,10 +290,10 @@ impl_goOnline (PortableServer_Servant servant, mail_storages_foreach (storage_go_online, NULL); } -/* GtkObject methods. */ +/* GObject methods. */ static void -impl_destroy (GtkObject *object) +impl_finalise (GObject *object) { MailOfflineHandler *offline_handler; MailOfflineHandlerPrivate *priv; @@ -303,8 +303,8 @@ impl_destroy (GtkObject *object) g_hash_table_destroy(priv->sync_table); g_free (priv); - if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); + if (G_OBJECT_CLASS (parent_class)->finalize != NULL) + (* G_OBJECT_CLASS (parent_class)->finalize) (object); } /* GTK+ type initialization. */ @@ -312,11 +312,11 @@ impl_destroy (GtkObject *object) static void mail_offline_handler_class_init (MailOfflineHandlerClass *klass) { - GtkObjectClass *object_class; + GObjectClass *object_class; POA_GNOME_Evolution_Offline__epv *epv; - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = impl_destroy; + object_class = G_OBJECT_CLASS (klass); + object_class->finalize = impl_finalise; epv = & klass->epv; epv->_get_isOffline = impl__get_isOffline; @@ -326,7 +326,7 @@ mail_offline_handler_class_init (MailOfflineHandlerClass *klass) epv->goOffline = impl_goOffline; epv->goOnline = impl_goOnline; - parent_class = gtk_type_class (PARENT_TYPE); + parent_class = g_type_class_ref(PARENT_TYPE); } static void @@ -345,7 +345,7 @@ mail_offline_handler_new (void) { MailOfflineHandler *new; - new = gtk_type_new (mail_offline_handler_get_type ()); + new = g_object_new(mail_offline_handler_get_type (), NULL); return new; } diff --git a/mail/mail-offline-handler.h b/mail/mail-offline-handler.h index 5d9746b148..4eba1f9fcb 100644 --- a/mail/mail-offline-handler.h +++ b/mail/mail-offline-handler.h @@ -55,7 +55,7 @@ struct _MailOfflineHandlerClass { }; -GtkType mail_offline_handler_get_type (void); +GType mail_offline_handler_get_type (void); MailOfflineHandler *mail_offline_handler_new (void); #ifdef __cplusplus diff --git a/mail/mail-ops.c b/mail/mail-ops.c index f00a25f555..726474345d 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -29,12 +29,12 @@ #endif /* #include <ctype.h> */ +#include <string.h> #include <errno.h> #include <libgnome/gnome-defs.h> #include <libgnome/gnome-exec.h> #include <gal/util/e-util.h> #include <gal/widgets/e-unicode.h> -#include <gal/util/e-unicode-i18n.h> #include <camel/camel-mime-filter-from.h> #include <camel/camel-operation.h> #include <camel/camel-vtrash-folder.h> @@ -137,7 +137,7 @@ filter_folder_filter (struct _mail_msg *mm) /* this may thaw/unref source folders, do it here so we dont do it in the main thread see also fetch_mail_fetch() below */ - camel_object_unref(CAMEL_OBJECT(m->driver)); + camel_object_unref(m->driver); m->driver = NULL; if (m->cancel) @@ -156,7 +156,7 @@ filter_folder_free (struct _mail_msg *mm) int i; if (m->source_folder) - camel_object_unref (CAMEL_OBJECT (m->source_folder)); + camel_object_unref (m->source_folder); if (m->source_uids) { for (i = 0; i < m->source_uids->len; i++) @@ -169,10 +169,10 @@ filter_folder_free (struct _mail_msg *mm) camel_operation_unref (m->cancel); if (m->destination) - camel_object_unref (CAMEL_OBJECT (m->destination)); + camel_object_unref (m->destination); if (m->driver) - camel_object_unref (CAMEL_OBJECT (m->driver)); + camel_object_unref (m->driver); mail_session_flush_filter_log (); } @@ -193,7 +193,7 @@ mail_filter_folder (CamelFolder *source_folder, GPtrArray *uids, m = mail_msg_new (&filter_folder_op, NULL, sizeof (*m)); m->source_folder = source_folder; - camel_object_ref (CAMEL_OBJECT (source_folder)); + camel_object_ref (source_folder); m->source_uids = uids; m->cache = NULL; m->delete = FALSE; @@ -356,7 +356,7 @@ fetch_mail_fetch (struct _mail_msg *mm) /* we unref the source folder here since we may now block in finalize (we try to disconnect cleanly) */ - camel_object_unref (CAMEL_OBJECT (fm->source_folder)); + camel_object_unref (fm->source_folder); fm->source_folder = NULL; } } @@ -368,7 +368,7 @@ fetch_mail_fetch (struct _mail_msg *mm) folders and whatnot) before we are really done */ /* should this be cancellable too? (i.e. above unregister above) */ if (fm->driver) { - camel_object_unref (CAMEL_OBJECT (fm->driver)); + camel_object_unref (fm->driver); fm->driver = NULL; } } @@ -525,13 +525,13 @@ mail_send_message (CamelMimeMessage *message, const char *destination, } camel_transport_send_to (xport, message, from, recipients, ex); - camel_object_unref (CAMEL_OBJECT (recipients)); - camel_object_unref (CAMEL_OBJECT (from)); + camel_object_unref (recipients); + camel_object_unref (from); mail_tool_restore_xevolution_headers (message, xev); mail_tool_destroy_xevolution (xev); - camel_object_unref (CAMEL_OBJECT (xport)); + camel_object_unref (xport); if (camel_exception_is_set (ex)) { g_free (sent_folder_uri); return; @@ -564,11 +564,11 @@ mail_send_message (CamelMimeMessage *message, const char *destination, g_free (sent_folder_uri); if (!folder) { /* FIXME */ - camel_object_ref (CAMEL_OBJECT (sent_folder)); + camel_object_ref (sent_folder); folder = sent_folder; } } else { - camel_object_ref (CAMEL_OBJECT (sent_folder)); + camel_object_ref (sent_folder); folder = sent_folder; } @@ -583,7 +583,7 @@ mail_send_message (CamelMimeMessage *message, const char *destination, } camel_folder_sync (folder, FALSE, NULL); - camel_object_unref (CAMEL_OBJECT (folder)); + camel_object_unref (folder); } camel_message_info_free (info); @@ -606,19 +606,13 @@ static char * send_mail_desc (struct _mail_msg *mm, int done) { struct _send_mail_msg *m = (struct _send_mail_msg *)mm; - char *subject; - const char *subject_utf8; + const char *subject; - subject_utf8 = camel_mime_message_get_subject (m->message); + subject = camel_mime_message_get_subject (m->message); - if (subject_utf8) { - char *desc; - - subject = e_utf8_to_locale_string (subject_utf8); - desc = g_strdup_printf (_("Sending \"%s\""), subject); - g_free (subject); - return desc; - } else + if (subject) + return g_strdup_printf (_("Sending \"%s\""), subject); + else return g_strdup (_("Sending message")); } @@ -644,8 +638,8 @@ send_mail_free (struct _mail_msg *mm) { struct _send_mail_msg *m = (struct _send_mail_msg *)mm; - camel_object_unref (CAMEL_OBJECT (m->driver)); - camel_object_unref (CAMEL_OBJECT (m->message)); + camel_object_unref (m->driver); + camel_object_unref (m->message); g_free (m->destination); } @@ -667,7 +661,7 @@ mail_send_mail (const char *uri, CamelMimeMessage *message, m = mail_msg_new (&send_mail_op, NULL, sizeof (*m)); m->destination = g_strdup (uri); m->message = message; - camel_object_ref (CAMEL_OBJECT (message)); + camel_object_ref (message); m->data = data; m->done = done; @@ -790,8 +784,8 @@ send_queue_free(struct _mail_msg *mm) struct _send_queue_msg *m = (struct _send_queue_msg *)mm; if (m->driver) - camel_object_unref((CamelObject *)m->driver); - camel_object_unref((CamelObject *)m->queue); + camel_object_unref(m->driver); + camel_object_unref(m->queue); g_free(m->destination); if (m->cancel) camel_operation_unref(m->cancel); @@ -816,7 +810,7 @@ mail_send_queue(CamelFolder *queue, const char *destination, m = mail_msg_new(&send_queue_op, NULL, sizeof(*m)); m->queue = queue; - camel_object_ref((CamelObject *)queue); + camel_object_ref(queue); m->destination = g_strdup(destination); if (cancel) { m->cancel = cancel; @@ -876,8 +870,8 @@ append_mail_free (struct _mail_msg *mm) { struct _append_msg *m = (struct _append_msg *)mm; - camel_object_unref((CamelObject *)m->message); - camel_object_unref((CamelObject *)m->folder); + camel_object_unref(m->message); + camel_object_unref(m->folder); g_free (m->appended_uid); } @@ -900,9 +894,9 @@ mail_append_mail (CamelFolder *folder, CamelMimeMessage *message, CamelMessageIn m = mail_msg_new (&append_mail_op, NULL, sizeof (*m)); m->folder = folder; - camel_object_ref (CAMEL_OBJECT (folder)); + camel_object_ref(folder); m->message = message; - camel_object_ref (CAMEL_OBJECT (message)); + camel_object_ref(message); m->info = info; m->done = done; @@ -947,7 +941,7 @@ transfer_messages_transfer (struct _mail_msg *mm) return; if (dest == m->source) { - camel_object_unref((CamelObject *)dest); + camel_object_unref(dest); /* no-op */ return; } @@ -970,7 +964,7 @@ transfer_messages_transfer (struct _mail_msg *mm) camel_folder_thaw (m->source); camel_folder_thaw (dest); camel_folder_sync (dest, FALSE, NULL); - camel_object_unref (CAMEL_OBJECT (dest)); + camel_object_unref (dest); } static void @@ -988,7 +982,7 @@ transfer_messages_free (struct _mail_msg *mm) struct _transfer_msg *m = (struct _transfer_msg *)mm; int i; - camel_object_unref (CAMEL_OBJECT (m->source)); + camel_object_unref (m->source); g_free (m->dest_uri); for (i = 0; i < m->uids->len; i++) g_free (m->uids->pdata[i]); @@ -1019,7 +1013,7 @@ mail_transfer_messages (CamelFolder *source, GPtrArray *uids, m = mail_msg_new(&transfer_messages_op, NULL, sizeof(*m)); m->source = source; - camel_object_ref (CAMEL_OBJECT (source)); + camel_object_ref (source); m->uids = uids; m->delete = delete_from_source; m->dest_uri = g_strdup (dest_uri); @@ -1098,7 +1092,7 @@ add_vtrash_info (CamelStore *store, CamelFolderInfo *info) } /* Fill in the new fields */ - vtrash->full_name = g_strdup (U_("Trash")); + vtrash->full_name = g_strdup (_("Trash")); vtrash->name = g_strdup(vtrash->full_name); vtrash->url = g_strdup_printf ("vtrash:%s", uri); vtrash->unread_message_count = -1; @@ -1112,7 +1106,7 @@ add_unmatched_info(CamelFolderInfo *fi) for (; fi; fi = fi->sibling) { if (!strcmp(fi->full_name, CAMEL_UNMATCHED_NAME)) { g_free(fi->name); - fi->name = g_strdup(U_("Unmatched")); + fi->name = g_strdup(_("Unmatched")); g_free(fi->path); fi->path = g_strdup_printf("/%s", fi->name); break; @@ -1165,7 +1159,7 @@ get_folderinfo_free (struct _mail_msg *mm) if (m->info) camel_store_free_folder_info(m->store, m->info); - camel_object_unref((CamelObject *)m->store); + camel_object_unref(m->store); } static struct _mail_msg_op get_folderinfo_op = { @@ -1183,7 +1177,7 @@ mail_get_folderinfo (CamelStore *store, void (*done)(CamelStore *store, CamelFol m = mail_msg_new(&get_folderinfo_op, NULL, sizeof(*m)); m->store = store; - camel_object_ref((CamelObject *)store); + camel_object_ref(store); m->done = done; m->data = data; id = m->msg.seq; @@ -1225,11 +1219,11 @@ do_build_attachment (CamelFolder *folder, GPtrArray *uids, GPtrArray *messages, for (i=0;i<messages->len;i++) { part = mail_tool_make_message_attachment(messages->pdata[i]); camel_multipart_add_part(multipart, part); - camel_object_unref((CamelObject *)part); + camel_object_unref(part); } part = camel_mime_part_new(); camel_medium_set_content_object(CAMEL_MEDIUM (part), CAMEL_DATA_WRAPPER(multipart)); - camel_object_unref((CamelObject *)multipart); + camel_object_unref(multipart); camel_mime_part_set_description(part, _("Forwarded messages")); } @@ -1237,7 +1231,7 @@ do_build_attachment (CamelFolder *folder, GPtrArray *uids, GPtrArray *messages, subject = mail_tool_generate_forward_subject(messages->pdata[0]); d->done(folder, messages, part, subject, d->data); g_free(subject); - camel_object_unref((CamelObject *)part); + camel_object_unref(part); g_free(d); } @@ -1301,7 +1295,7 @@ get_folder_free (struct _mail_msg *mm) g_free (m->uri); if (m->folder) - camel_object_unref (CAMEL_OBJECT (m->folder)); + camel_object_unref (m->folder); } static struct _mail_msg_op get_folder_op = { @@ -1377,7 +1371,7 @@ get_store_free (struct _mail_msg *mm) g_free (m->uri); if (m->store) - camel_object_unref (CAMEL_OBJECT (m->store)); + camel_object_unref (m->store); } static struct _mail_msg_op get_store_op = { @@ -1455,7 +1449,7 @@ remove_folder_get (struct _mail_msg *mm) /* Then delete the folder from the store */ camel_store_delete_folder (store, folder->full_name, &mm->ex); m->removed = !camel_exception_is_set (&mm->ex); - camel_object_unref (CAMEL_OBJECT (folder)); + camel_object_unref (folder); } static void @@ -1553,7 +1547,7 @@ mail_sync_folder(CamelFolder *folder, void (*done) (CamelFolder *folder, void *d m = mail_msg_new(&sync_folder_op, NULL, sizeof(*m)); m->folder = folder; - camel_object_ref((CamelObject *)folder); + camel_object_ref(folder); m->data = data; m->done = done; @@ -1589,7 +1583,7 @@ mail_refresh_folder(CamelFolder *folder, void (*done) (CamelFolder *folder, void m = mail_msg_new(&refresh_folder_op, NULL, sizeof(*m)); m->folder = folder; - camel_object_ref((CamelObject *)folder); + camel_object_ref(folder); m->data = data; m->done = done; @@ -1625,7 +1619,7 @@ mail_expunge_folder(CamelFolder *folder, void (*done) (CamelFolder *folder, void m = mail_msg_new(&expunge_folder_op, NULL, sizeof(*m)); m->folder = folder; - camel_object_ref((CamelObject *)folder); + camel_object_ref(folder); m->data = data; m->done = done; @@ -1695,7 +1689,7 @@ mail_get_message(CamelFolder *folder, const char *uid, void (*done) (CamelFolder m = mail_msg_new(&get_message_op, NULL, sizeof(*m)); m->folder = folder; - camel_object_ref((CamelObject *)folder); + camel_object_ref(folder); m->uid = g_strdup(uid); m->data = data; m->done = done; @@ -1760,10 +1754,10 @@ static void get_messages_free(struct _mail_msg *mm) g_ptr_array_free(m->uids, TRUE); for (i=0;i<m->messages->len;i++) { if (m->messages->pdata[i]) - camel_object_unref((CamelObject *)m->messages->pdata[i]); + camel_object_unref(m->messages->pdata[i]); } g_ptr_array_free(m->messages, TRUE); - camel_object_unref((CamelObject *)m->folder); + camel_object_unref(m->folder); } static struct _mail_msg_op get_messages_op = { @@ -1782,7 +1776,7 @@ mail_get_messages(CamelFolder *folder, GPtrArray *uids, m = mail_msg_new(&get_messages_op, NULL, sizeof(*m)); m->folder = folder; - camel_object_ref((CamelObject *)folder); + camel_object_ref(folder); m->uids = uids; m->messages = g_ptr_array_new(); m->data = data; @@ -1927,7 +1921,7 @@ save_messages_save (struct _mail_msg *mm) from_filter = camel_mime_filter_from_new(); filtered_stream = camel_stream_filter_new_with_stream(stream); camel_stream_filter_add(filtered_stream, (CamelMimeFilter *)from_filter); - camel_object_unref((CamelObject *)from_filter); + camel_object_unref(from_filter); for (i=0; i<m->uids->len; i++) { CamelMimeMessage *message; @@ -1953,11 +1947,11 @@ save_messages_save (struct _mail_msg *mm) break; } g_free(from); - camel_object_unref((CamelObject *)message); + camel_object_unref(message); } - camel_object_unref((CamelObject *)filtered_stream); - camel_object_unref((CamelObject *)stream); + camel_object_unref(filtered_stream); + camel_object_unref(stream); } static void save_messages_saved(struct _mail_msg *mm) @@ -1976,7 +1970,7 @@ static void save_messages_free(struct _mail_msg *mm) for (i=0;i<m->uids->len;i++) g_free(m->uids->pdata[i]); g_ptr_array_free(m->uids, TRUE); - camel_object_unref((CamelObject *)m->folder); + camel_object_unref(m->folder); g_free(m->path); } @@ -1996,7 +1990,7 @@ mail_save_messages(CamelFolder *folder, GPtrArray *uids, const char *path, m = mail_msg_new(&save_messages_op, NULL, sizeof(*m)); m->folder = folder; - camel_object_ref((CamelObject *)folder); + camel_object_ref(folder); m->uids = uids; m->path = g_strdup(path); m->data = data; @@ -2059,7 +2053,7 @@ save_part_save (struct _mail_msg *mm) camel_object_unref (CAMEL_OBJECT (stream_fs)); if (charsetfilter) { camel_stream_filter_add (CAMEL_STREAM_FILTER (filtered_stream), CAMEL_MIME_FILTER (charsetfilter)); - camel_object_unref (CAMEL_OBJECT (charsetfilter)); + camel_object_unref (charsetfilter); } } else { filtered_stream = stream_fs; @@ -2071,7 +2065,7 @@ save_part_save (struct _mail_msg *mm) _("Could not write data: %s"), g_strerror (errno)); - camel_object_unref (CAMEL_OBJECT (filtered_stream)); + camel_object_unref (filtered_stream); } static void @@ -2088,7 +2082,7 @@ save_part_free (struct _mail_msg *mm) { struct _save_part_msg *m = (struct _save_part_msg *)mm; - camel_object_unref (CAMEL_OBJECT (m->part)); + camel_object_unref (m->part); g_free (m->path); } @@ -2108,7 +2102,7 @@ mail_save_part (CamelMimePart *part, const char *path, m = mail_msg_new (&save_part_op, NULL, sizeof (*m)); m->part = part; - camel_object_ref (CAMEL_OBJECT (part)); + camel_object_ref (part); m->path = g_strdup (path); m->data = data; m->done = done; @@ -2149,7 +2143,7 @@ static void prep_offline_do(struct _mail_msg *mm) /* prepare_for_offline should do this? */ /* of course it should all be atomic, but ... */ camel_folder_sync(folder, FALSE, NULL); - camel_object_unref((CamelObject *)folder); + camel_object_unref(folder); } if (m->cancel) @@ -2257,7 +2251,7 @@ static void set_offline_free(struct _mail_msg *mm) { struct _set_offline_msg *m = (struct _set_offline_msg *)mm; - camel_object_unref((CamelObject *)m->store); + camel_object_unref(m->store); } static struct _mail_msg_op set_offline_op = { @@ -2282,7 +2276,7 @@ mail_store_set_offline (CamelStore *store, gboolean offline, m = mail_msg_new(&set_offline_op, NULL, sizeof(*m)); m->store = store; - camel_object_ref((CamelObject *)store); + camel_object_ref(store); m->offline = offline; m->data = data; m->done = done; diff --git a/mail/mail-preferences.c b/mail/mail-preferences.c index 758f9cd540..d81de371ce 100644 --- a/mail/mail-preferences.c +++ b/mail/mail-preferences.c @@ -28,7 +28,6 @@ #include "mail-preferences.h" #include <gal/widgets/e-unicode.h> -#include <gal/util/e-unicode-i18n.h> #include <gtkhtml/gtkhtml-properties.h> #include "widgets/misc/e-charset-picker.h" @@ -47,20 +46,20 @@ static GtkVBoxClass *parent_class = NULL; GtkType mail_preferences_get_type (void) { - static GtkType type = 0; + static GType type = 0; if (!type) { - GtkTypeInfo type_info = { - "MailPreferences", - sizeof (MailPreferences), + GTypeInfo type_info = { sizeof (MailPreferencesClass), - (GtkClassInitFunc) mail_preferences_class_init, - (GtkObjectInitFunc) mail_preferences_init, - (GtkArgSetFunc) NULL, - (GtkArgGetFunc) NULL + NULL, NULL, + (GClassInitFunc) mail_preferences_class_init, + NULL, NULL, + sizeof (MailPreferences), + 0, + (GInstanceInitFunc) mail_preferences_init, }; - type = gtk_type_unique (gtk_vbox_get_type (), &type_info); + type = g_type_register_static(gtk_vbox_get_type (), "MailPreferences", &type_info, 0); } return type; @@ -69,14 +68,12 @@ mail_preferences_get_type (void) static void mail_preferences_class_init (MailPreferencesClass *klass) { - GtkObjectClass *object_class; + GObjectClass *object_class; - object_class = (GtkObjectClass *) klass; - parent_class = gtk_type_class (gtk_vbox_get_type ()); + object_class = (GObjectClass *) klass; + parent_class = g_type_class_ref(gtk_vbox_get_type ()); object_class->finalize = mail_preferences_finalise; - /* override methods */ - } static void @@ -90,11 +87,11 @@ mail_preferences_finalise (GtkObject *obj) { MailPreferences *prefs = (MailPreferences *) obj; - gtk_object_unref (GTK_OBJECT (prefs->gui)); - gtk_object_unref (GTK_OBJECT (prefs->pman)); - gtk_object_unref (GTK_OBJECT (prefs->gconf)); + g_object_unref(prefs->gui); + g_object_unref(prefs->pman); + g_object_unref(prefs->gconf); - ((GtkObjectClass *)(parent_class))->finalize (obj); + ((GObjectClass *)(parent_class))->finalize (obj); } @@ -155,7 +152,7 @@ restore_labels_clicked (GtkWidget *widget, gpointer user_data) int i; for (i = 0; i < 5; i++) { - e_utf8_gtk_entry_set_text (prefs->labels[i].name, U_(label_defaults[i].name)); + gtk_entry_set_text(prefs->labels[i].name, U_(label_defaults[i].name)); colorpicker_set_color (prefs->labels[i].color, label_defaults[i].color); } } @@ -180,8 +177,7 @@ option_menu_connect (GtkOptionMenu *omenu, gpointer user_data) items = GTK_MENU_SHELL (menu)->children; while (items) { item = items->data; - gtk_signal_connect (GTK_OBJECT (item), "activate", - menu_changed, user_data); + g_signal_connect(item, "activate", menu_changed, user_data); items = items->next; } } @@ -199,7 +195,7 @@ mail_preferences_construct (MailPreferences *prefs) { NULL, NULL } }; - gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", "preferences_tab"); + gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", "preferences_tab", NULL); prefs->gui = gui; /* get our toplevel widget */ @@ -216,13 +212,11 @@ mail_preferences_construct (MailPreferences *prefs) /* Message Display */ prefs->timeout_toggle = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkMarkTimeout")); gtk_toggle_button_set_active (prefs->timeout_toggle, mail_config_get_do_seen_timeout ()); - gtk_signal_connect (GTK_OBJECT (prefs->timeout_toggle), "toggled", - toggle_button_toggled, prefs); + g_signal_connect(prefs->timeout_toggle, "toggled", toggle_button_toggled, prefs); prefs->timeout = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "spinMarkTimeout")); gtk_spin_button_set_value (prefs->timeout, (1.0 * mail_config_get_mark_as_seen_timeout ()) / 1000.0); - gtk_signal_connect (GTK_OBJECT (prefs->timeout), "changed", - entry_changed, prefs); + g_signal_connect(prefs->timeout, "changed", entry_changed, prefs); prefs->charset = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuCharset")); menu = e_charset_picker_new (mail_config_get_default_charset ()); @@ -231,47 +225,40 @@ mail_preferences_construct (MailPreferences *prefs) prefs->citation_highlight = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkHighlightCitations")); gtk_toggle_button_set_active (prefs->citation_highlight, mail_config_get_citation_highlight ()); - gtk_signal_connect (GTK_OBJECT (prefs->citation_highlight), "toggled", - toggle_button_toggled, prefs); + g_signal_connect(prefs->citation_highlight, "toggled", toggle_button_toggled, prefs); prefs->citation_color = GNOME_COLOR_PICKER (glade_xml_get_widget (gui, "colorpickerHighlightCitations")); colorpicker_set_color (prefs->citation_color, mail_config_get_citation_color ()); - gtk_signal_connect (GTK_OBJECT (prefs->citation_color), "color-set", - color_set, prefs); + g_signal_connect(prefs->citation_color, "color-set", color_set, prefs); /* Deleting Mail */ prefs->empty_trash = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkEmptyTrashOnExit")); gtk_toggle_button_set_active (prefs->empty_trash, mail_config_get_empty_trash_on_exit ()); - gtk_signal_connect (GTK_OBJECT (prefs->empty_trash), "toggled", - toggle_button_toggled, prefs); + g_signal_connect(prefs->empty_trash, "toggled", toggle_button_toggled, prefs); prefs->confirm_expunge = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkConfirmExpunge")); gtk_toggle_button_set_active (prefs->confirm_expunge, mail_config_get_confirm_expunge ()); - gtk_signal_connect (GTK_OBJECT (prefs->confirm_expunge), "toggled", - toggle_button_toggled, prefs); + g_signal_connect(prefs->confirm_expunge, "toggled", toggle_button_toggled, prefs); /* New Mail Notification */ prefs->notify_not = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radNotifyNot")); gtk_toggle_button_set_active (prefs->notify_not, mail_config_get_new_mail_notify () == MAIL_CONFIG_NOTIFY_NOT); - gtk_signal_connect (GTK_OBJECT (prefs->notify_not), "toggled", - toggle_button_toggled, prefs); + g_signal_connect(prefs->notify_not, "toggled", toggle_button_toggled, prefs); prefs->notify_beep = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radNotifyBeep")); gtk_toggle_button_set_active (prefs->notify_beep, mail_config_get_new_mail_notify () == MAIL_CONFIG_NOTIFY_BEEP); - gtk_signal_connect (GTK_OBJECT (prefs->notify_beep), "toggled", - toggle_button_toggled, prefs); + g_signal_connect(prefs->notify_beep, "toggled", toggle_button_toggled, prefs); prefs->notify_play_sound = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radNotifyPlaySound")); gtk_toggle_button_set_active (prefs->notify_play_sound, mail_config_get_new_mail_notify () == MAIL_CONFIG_NOTIFY_PLAY_SOUND); - gtk_signal_connect (GTK_OBJECT (prefs->notify_play_sound), "toggled", - toggle_button_toggled, prefs); + g_signal_connect(prefs->notify_play_sound, "toggled", toggle_button_toggled, prefs); prefs->notify_sound_file = GNOME_FILE_ENTRY (glade_xml_get_widget (gui, "fileNotifyPlaySound")); text = mail_config_get_new_mail_notify_sound_file (); gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (prefs->notify_sound_file)), text ? text : ""); - gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (prefs->notify_sound_file)), "changed", + g_signal_connect(gnome_file_entry_gtk_entry (prefs->notify_sound_file), "changed", entry_changed, prefs); /* HTML Mail tab */ @@ -279,35 +266,30 @@ mail_preferences_construct (MailPreferences *prefs) /* Loading Images */ prefs->images_never = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radImagesNever")); gtk_toggle_button_set_active (prefs->images_never, mail_config_get_http_mode () == MAIL_CONFIG_HTTP_NEVER); - gtk_signal_connect (GTK_OBJECT (prefs->images_never), "toggled", - toggle_button_toggled, prefs); + g_signal_connect(prefs->images_never, "toggled", toggle_button_toggled, prefs); prefs->images_sometimes = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radImagesSometimes")); gtk_toggle_button_set_active (prefs->images_sometimes, mail_config_get_http_mode () == MAIL_CONFIG_HTTP_SOMETIMES); - gtk_signal_connect (GTK_OBJECT (prefs->images_sometimes), "toggled", - toggle_button_toggled, prefs); + g_signal_connect(prefs->images_sometimes, "toggled", toggle_button_toggled, prefs); prefs->images_always = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radImagesAlways")); gtk_toggle_button_set_active (prefs->images_always, mail_config_get_http_mode () == MAIL_CONFIG_HTTP_ALWAYS); - gtk_signal_connect (GTK_OBJECT (prefs->images_always), "toggled", - toggle_button_toggled, prefs); + g_signal_connect(prefs->images_always, "toggled", toggle_button_toggled, prefs); prefs->pman = GTK_HTML_PROPMANAGER (gtk_html_propmanager_new (prefs->gconf)); - gtk_signal_connect (GTK_OBJECT (prefs->pman), "changed", toggle_button_toggled, prefs); - gtk_object_ref (GTK_OBJECT (prefs->pman)); + g_signal_connect(prefs->pman, "changed", toggle_button_toggled, prefs); + g_object_ref(prefs->pman); gtk_html_propmanager_set_names (prefs->pman, names); gtk_html_propmanager_set_gui (prefs->pman, gui, NULL); for (i = 0; names[i][0] != NULL; i++) { widget = glade_xml_get_widget (gui, names[i][1]); - gtk_signal_connect (GTK_OBJECT (widget), "toggled", - toggle_button_toggled, prefs); + g_signal_connect(widget, "toggled", toggle_button_toggled, prefs); } prefs->prompt_unwanted_html = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkPromptWantHTML")); gtk_toggle_button_set_active (prefs->prompt_unwanted_html, mail_config_get_confirm_unwanted_html ()); - gtk_signal_connect (GTK_OBJECT (prefs->prompt_unwanted_html), "toggled", - toggle_button_toggled, prefs); + g_signal_connect(prefs->prompt_unwanted_html, "toggled", toggle_button_toggled, prefs); /* Labels and Colours tab */ for (i = 0; i < 5; i++) { @@ -317,20 +299,17 @@ mail_preferences_construct (MailPreferences *prefs) prefs->labels[i].name = GTK_ENTRY (glade_xml_get_widget (gui, widget_name)); g_free (widget_name); text = mail_config_get_label_name (i); - e_utf8_gtk_entry_set_text (prefs->labels[i].name, text ? text : ""); - gtk_signal_connect (GTK_OBJECT (prefs->labels[i].name), "changed", - entry_changed, prefs); + gtk_entry_set_text(prefs->labels[i].name, text ? text : ""); + g_signal_connect(prefs->labels[i].name, "changed", entry_changed, prefs); widget_name = g_strdup_printf ("colorLabel%d", i); prefs->labels[i].color = GNOME_COLOR_PICKER (glade_xml_get_widget (gui, widget_name)); g_free (widget_name); colorpicker_set_color (prefs->labels[i].color, mail_config_get_label_color (i)); - gtk_signal_connect (GTK_OBJECT (prefs->labels[i].color), "color_set", - color_set, prefs); + g_signal_connect(prefs->labels[i].color, "color_set", color_set, prefs); } prefs->restore_labels = GTK_BUTTON (glade_xml_get_widget (gui, "cmdRestoreLabels")); - gtk_signal_connect (GTK_OBJECT (prefs->restore_labels), "clicked", - restore_labels_clicked, prefs); + g_signal_connect(prefs->restore_labels, "clicked", restore_labels_clicked, prefs); } @@ -339,7 +318,7 @@ mail_preferences_new (void) { MailPreferences *new; - new = (MailPreferences *) gtk_type_new (mail_preferences_get_type ()); + new = (MailPreferences *) g_object_new(mail_preferences_get_type (), 0); mail_preferences_construct (new); return (GtkWidget *) new; @@ -359,7 +338,7 @@ mail_preferences_apply (MailPreferences *prefs) /* Message Display */ mail_config_set_do_seen_timeout (gtk_toggle_button_get_active (prefs->timeout_toggle)); - val = (int) (gtk_spin_button_get_value_as_float (prefs->timeout) * 1000); + val = (int) (gtk_spin_button_get_value (prefs->timeout) * 1000.0); mail_config_set_mark_as_seen_timeout (val); menu = gtk_option_menu_get_menu (prefs->charset); @@ -406,7 +385,7 @@ mail_preferences_apply (MailPreferences *prefs) /* Labels and Colours */ for (i = 0; i < 5; i++) { /* save the label... */ - string = e_utf8_gtk_entry_get_text (prefs->labels[i].name); + string = gtk_entry_get_text(prefs->labels[i].name); mail_config_set_label_name (i, string); g_free (string); diff --git a/mail/mail-preferences.h b/mail/mail-preferences.h index 36835f018e..b9e1b537a9 100644 --- a/mail/mail-preferences.h +++ b/mail/mail-preferences.h @@ -31,7 +31,6 @@ extern "C" { #include <gtk/gtk.h> #include <libgnomeui/gnome-color-picker.h> -#include <libgnomeui/gnome-dialog.h> #include <libgnomeui/gnome-file-entry.h> #include <glade/glade.h> #include <gtkhtml/gtkhtml-propmanager.h> diff --git a/mail/mail-search-dialogue.c b/mail/mail-search-dialogue.c index 352f4f08a1..a49d7d61d7 100644 --- a/mail/mail-search-dialogue.c +++ b/mail/mail-search-dialogue.c @@ -24,35 +24,39 @@ #include <glib.h> #include <gtk/gtkentry.h> +#include <gtk/gtkdialog.h> +#include <gtk/gtkstock.h> +#include <gtk/gtkbox.h> #include <libgnome/gnome-defs.h> #include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-stock.h> #include "mail-search-dialogue.h" static void mail_search_dialogue_class_init (MailSearchDialogueClass *class); static void mail_search_dialogue_init (MailSearchDialogue *gspaper); -static void mail_search_dialogue_finalise (GtkObject *obj); +static void mail_search_dialogue_finalise (GObject *obj); -static GnomeDialogClass *parent_class; +static GtkDialogClass *parent_class; guint mail_search_dialogue_get_type (void) { - static guint type = 0; + static GType type = 0; if (!type) { - GtkTypeInfo type_info = { - "MailSearchDialogue", - sizeof(MailSearchDialogue), + GTypeInfo type_info = { sizeof(MailSearchDialogueClass), - (GtkClassInitFunc)mail_search_dialogue_class_init, + NULL, + NULL, + (GClassInitFunc)mail_search_dialogue_class_init, + NULL, + NULL, + sizeof(MailSearchDialogue), + 0, (GtkObjectInitFunc)mail_search_dialogue_init, - (GtkArgSetFunc)NULL, - (GtkArgGetFunc)NULL }; - type = gtk_type_unique (gnome_dialog_get_type (), &type_info); + type = g_type_register_static (gtk_dialog_get_type (), "MailSearchDialogue", &type_info, 0); } return type; @@ -61,10 +65,10 @@ mail_search_dialogue_get_type (void) static void mail_search_dialogue_class_init (MailSearchDialogueClass *class) { - GtkObjectClass *object_class; + GObjectClass *object_class; - object_class = (GtkObjectClass *)class; - parent_class = gtk_type_class (gnome_dialog_get_type ()); + object_class = (GObjectClass *)class; + parent_class = g_type_class_ref(gtk_dialog_get_type ()); object_class->finalize = mail_search_dialogue_finalise; /* override methods */ @@ -75,10 +79,13 @@ static void mail_search_dialogue_construct (MailSearchDialogue *o, FilterRule *rule) { FilterPart *part; - GnomeDialog *dialogue = GNOME_DIALOG (o); + GtkDialog *dialogue = GTK_DIALOG (o); - gtk_window_set_policy (GTK_WINDOW (dialogue), FALSE, TRUE, FALSE); - gtk_window_set_default_size (GTK_WINDOW (dialogue), 500, 400); + g_object_set(dialogue, + "allow_shrink", FALSE, + "allow_grow", TRUE, + "default_width", 500, + "default_height", 400, NULL); o->context = rule_context_new (); rule_context_add_part_set (o->context, "partset", filter_part_get_type (), @@ -106,28 +113,31 @@ mail_search_dialogue_construct (MailSearchDialogue *o, FilterRule *rule) static void mail_search_dialogue_init (MailSearchDialogue *o) { - GnomeDialog *dialogue = GNOME_DIALOG (o); + GtkDialog *dialogue = GTK_DIALOG (o); - gnome_dialog_append_buttons (dialogue, - GNOME_STOCK_BUTTON_OK, - _("_Search"), - GNOME_STOCK_BUTTON_CANCEL, - NULL); - gnome_dialog_set_default (dialogue, 0); + gtk_dialog_add_buttons (dialogue, + GTK_STOCK_OK, + GTK_RESPONSE_OK, + _("_Search"), + GTK_RESPONSE_APPLY, + GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL, + NULL); + gtk_dialog_set_default_response (dialogue, GTK_RESPONSE_OK); } static void -mail_search_dialogue_finalise (GtkObject *obj) +mail_search_dialogue_finalise (GObject *obj) { MailSearchDialogue *o = (MailSearchDialogue *)obj; if (o->context) - gtk_object_unref (GTK_OBJECT (o->context)); + g_object_unref(o->context); if (o->rule) - gtk_object_unref (GTK_OBJECT (o->rule)); + g_object_unref(o->rule); - ((GtkObjectClass *)(parent_class))->finalize(obj); + ((GObjectClass *)(parent_class))->finalize(obj); } /** @@ -140,7 +150,7 @@ mail_search_dialogue_finalise (GtkObject *obj) MailSearchDialogue * mail_search_dialogue_new () { - MailSearchDialogue *o = (MailSearchDialogue *)gtk_type_new (mail_search_dialogue_get_type ()); + MailSearchDialogue *o = (MailSearchDialogue *)g_object_new(mail_search_dialogue_get_type(), NULL); mail_search_dialogue_construct (o, NULL); return o; } @@ -148,9 +158,9 @@ mail_search_dialogue_new () MailSearchDialogue * mail_search_dialogue_new_with_rule (FilterRule *rule) { - MailSearchDialogue *o = (MailSearchDialogue *)gtk_type_new (mail_search_dialogue_get_type ()); + MailSearchDialogue *o = (MailSearchDialogue *)g_object_new (mail_search_dialogue_get_type (), NULL); if (rule) - gtk_object_ref (GTK_OBJECT (rule)); + g_object_ref((rule)); mail_search_dialogue_construct (o, rule); return o; } diff --git a/mail/mail-search-dialogue.h b/mail/mail-search-dialogue.h index 1f18542671..fc5ff3349e 100644 --- a/mail/mail-search-dialogue.h +++ b/mail/mail-search-dialogue.h @@ -22,7 +22,7 @@ #define _MAIL_SEARCH_DIALOGUE_H #include <gtk/gtkwidget.h> -#include <libgnomeui/gnome-dialog.h> +#include <gtk/gtkdialog.h> #include "filter/rule-context.h" #include "filter/filter-rule.h" @@ -35,7 +35,7 @@ typedef struct _MailSearchDialogue MailSearchDialogue; typedef struct _MailSearchDialogueClass MailSearchDialogueClass; struct _MailSearchDialogue { - GnomeDialog parent; + GtkDialog parent; RuleContext *context; FilterRule *rule; @@ -43,7 +43,7 @@ struct _MailSearchDialogue { }; struct _MailSearchDialogueClass { - GnomeDialogClass parent_class; + GtkDialogClass parent_class; /* virtual methods */ diff --git a/mail/mail-search.c b/mail/mail-search.c index 4611ece6d2..4ca999bb9c 100644 --- a/mail/mail-search.c +++ b/mail/mail-search.c @@ -38,26 +38,27 @@ static GtkObjectClass *parent_class; static void -mail_search_destroy (GtkObject *obj) +mail_search_finalise (GObject *obj) { MailSearch *ms = MAIL_SEARCH (obj); - gtk_signal_disconnect (GTK_OBJECT (ms->mail->html->engine->ht), - ms->match_handler); - gtk_signal_disconnect (GTK_OBJECT (ms->mail->html->engine->ht), - ms->begin_handler); + g_signal_handler_disconnect(ms->mail->html->engine->ht, ms->match_handler); + g_signal_handler_disconnect(ms->mail->html->engine->ht, ms->begin_handler); g_free (ms->last_search); - gtk_object_unref (GTK_OBJECT (ms->mail)); + g_object_unref((ms->mail)); + + ((GObjectClass *)parent_class)->finalize(obj); } static void mail_search_class_init (MailSearchClass *klass) { - GtkObjectClass *object_class = (GtkObjectClass *) klass; - parent_class = GTK_OBJECT_CLASS (gtk_type_class (gnome_dialog_get_type ())); + GObjectClass *object_class = (GObjectClass *) klass; + + parent_class = GTK_OBJECT_CLASS (g_type_class_ref(gtk_dialog_get_type ())); - object_class->destroy = mail_search_destroy; + object_class->finalize = mail_search_finalise; } static void @@ -69,20 +70,20 @@ mail_search_init (MailSearch *ms) GtkType mail_search_get_type (void) { - static GtkType mail_search_type = 0; + static GType mail_search_type = 0; if (! mail_search_type) { - GtkTypeInfo mail_search_info = { - "MailSearch", - sizeof (MailSearch), + GTypeInfo mail_search_info = { sizeof (MailSearchClass), - (GtkClassInitFunc) mail_search_class_init, - (GtkObjectInitFunc) mail_search_init, - NULL, NULL, /* mysteriously reserved */ - (GtkClassInitFunc) NULL + NULL, NULL, + (GClassInitFunc) mail_search_class_init, + NULL, NULL, + sizeof (MailSearch), + 0, + (GInstanceInitFunc) mail_search_init, }; - mail_search_type = gtk_type_unique (gnome_dialog_get_type (), &mail_search_info); + mail_search_type = g_type_register_static (GTK_TYPE_DIALOG, "MailSearch", &mail_search_info, 0); } return mail_search_type; @@ -129,9 +130,10 @@ mail_search_set_subject (MailSearch *ms, const gchar *subject) utf8_subject = NULL; } - if (utf8_subject) - gtk_subject = e_utf8_to_gtk_string (GTK_WIDGET (ms->msg_frame), utf8_subject); - + if (utf8_subject) { + gtk_subject = utf8_subject; + utf8_subject = NULL; + } } else { gtk_subject = g_strdup (_("(Untitled Message)")); @@ -257,14 +259,16 @@ match_cb (ESearchingTokenizer *st, MailSearch *ms) gtk_label_set_text (GTK_LABEL (ms->count_label), buf); } +static void +entry_run_search(GtkWidget *w, MailSearch *ms) +{ + /* run search when enter pressed on widget */ + gtk_dialog_response((GtkDialog *)ms, GTK_RESPONSE_ACCEPT); +} + void mail_search_construct (MailSearch *ms, MailDisplay *mail) { - const gchar *buttons[] = { _("Search"), - GNOME_STOCK_BUTTON_CLOSE, - NULL }; - gchar *title = NULL; - GtkWidget *find_hbox; GtkWidget *matches_hbox; GtkWidget *toggles_hbox; @@ -276,7 +280,7 @@ mail_search_construct (MailSearch *ms, MailDisplay *mail) #if 0 GtkWidget *fwd_check; #endif - + GtkWidget *button; GtkWidget *msg_hbox; GtkWidget *msg_frame; @@ -286,23 +290,26 @@ mail_search_construct (MailSearch *ms, MailDisplay *mail) /* Basic set-up */ ms->mail = mail; - gtk_object_ref (GTK_OBJECT (mail)); + g_object_ref((mail)); - title = g_strdup (_("Find in Message")); - - gnome_dialog_constructv (GNOME_DIALOG (ms), title, buttons); - g_free (title); + gtk_window_set_title((GtkWindow *)ms, _("Find in Message")); + + button = gtk_button_new_from_stock(GTK_STOCK_FIND); + gtk_button_set_label((GtkButton *)button, _("Search")); + gtk_dialog_add_action_widget((GtkDialog*)ms, button, GTK_RESPONSE_ACCEPT); + gtk_dialog_add_button((GtkDialog *)ms, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); + gtk_dialog_set_default_response((GtkDialog *)ms, GTK_RESPONSE_ACCEPT); ms->search_forward = TRUE; ms->case_sensitive = FALSE; - ms->begin_handler = gtk_signal_connect (GTK_OBJECT (ms->mail->html->engine->ht), + ms->begin_handler = g_signal_connect((ms->mail->html->engine->ht), "begin", - GTK_SIGNAL_FUNC (begin_cb), + G_CALLBACK (begin_cb), ms); - ms->match_handler = gtk_signal_connect (GTK_OBJECT (ms->mail->html->engine->ht), + ms->match_handler = g_signal_connect((ms->mail->html->engine->ht), "match", - GTK_SIGNAL_FUNC (match_cb), + G_CALLBACK (match_cb), ms); /* Construct the dialog contents. */ @@ -366,11 +373,10 @@ mail_search_construct (MailSearch *ms, MailDisplay *mail) gtk_container_add (GTK_CONTAINER (msg_frame), GTK_WIDGET (frame_vbox)); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (ms)->vbox), msg_hbox, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (ms)->vbox), msg_hbox, TRUE, TRUE, 0); gtk_widget_grab_focus (entry); /* Give focus to entry by default */ - gnome_dialog_set_default (GNOME_DIALOG (ms), 0); - gnome_dialog_editable_enters (GNOME_DIALOG (ms), GTK_EDITABLE(entry)); /* Make <enter> run the search */ + g_signal_connect(entry, "activate", G_CALLBACK(entry_run_search), ms); gnome_window_icon_set_from_file (GTK_WINDOW (ms), EVOLUTION_ICONSDIR "/find-message.xpm"); gtk_widget_show_all (msg_hbox); @@ -380,29 +386,29 @@ mail_search_construct (MailSearch *ms, MailDisplay *mail) /* Hook up signals */ - gtk_signal_connect (GTK_OBJECT (case_check), + g_signal_connect((case_check), "toggled", - GTK_SIGNAL_FUNC (toggled_case_cb), + G_CALLBACK (toggled_case_cb), ms); #if 0 - gtk_signal_connect (GTK_OBJECT (fwd_check), + g_signal_connect((fwd_check), "toggled", - GTK_SIGNAL_FUNC (toggled_fwd_cb), + G_CALLBACK (toggled_fwd_cb), ms); #endif - gtk_signal_connect (GTK_OBJECT (ms), + g_signal_connect((ms), "clicked", - GTK_SIGNAL_FUNC (dialog_clicked_cb), + G_CALLBACK (dialog_clicked_cb), ms); gtk_signal_connect_object (GTK_OBJECT (ms), "destroy", - GTK_SIGNAL_FUNC (dialog_destroy_cb), + G_CALLBACK (dialog_destroy_cb), GTK_OBJECT (ms)); gtk_signal_connect_object (GTK_OBJECT (ms->mail), "destroy", - GTK_SIGNAL_FUNC (gtk_widget_destroy), + G_CALLBACK (gtk_widget_destroy), GTK_OBJECT (ms)); } @@ -413,7 +419,7 @@ mail_search_new (MailDisplay *mail) g_return_val_if_fail (mail && IS_MAIL_DISPLAY (mail), NULL); - ptr = gtk_type_new (mail_search_get_type ()); + ptr = g_object_new(mail_search_get_type (), NULL); mail_search_construct (MAIL_SEARCH (ptr), mail); return GTK_WIDGET (ptr); diff --git a/mail/mail-search.h b/mail/mail-search.h index 4b84498a73..38e501cc50 100644 --- a/mail/mail-search.h +++ b/mail/mail-search.h @@ -32,7 +32,7 @@ extern "C" { #pragma } #endif /* _cplusplus */ -#include <gnome.h> +#include <gtk/gtkdialog.h> #include "mail-display.h" #define MAIL_SEARCH_TYPE (mail_search_get_type ()) @@ -45,7 +45,7 @@ typedef struct _MailSearch MailSearch; typedef struct _MailSearchClass MailSearchClass; struct _MailSearch { - GnomeDialog parent; + GtkDialog parent; MailDisplay *mail; @@ -61,7 +61,7 @@ struct _MailSearch { }; struct _MailSearchClass { - GnomeDialogClass parent_class; + GtkDialogClass parent_class; }; diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c index c33b165a69..95e609e825 100644 --- a/mail/mail-send-recv.c +++ b/mail/mail-send-recv.c @@ -30,8 +30,8 @@ /* for the dialogue stuff */ #include <glib.h> #include <gtk/gtkmain.h> -#include <libgnomeui/gnome-stock.h> -#include <libgnomeui/gnome-dialog.h> +#include <gtk/gtkdialog.h> +#include <gtk/gtkstock.h> #include <libgnomeui/gnome-window-icon.h> #include "filter/filter-filter.h" @@ -72,7 +72,7 @@ struct _folder_info { struct _send_data { GList *infos; - GnomeDialog *gd; + GtkDialog *gd; int cancelled; CamelFolder *inbox; /* since we're never asked to update this one, do it ourselves */ @@ -150,7 +150,7 @@ free_folder_info(void *key, struct _folder_info *info, void *data) { /*camel_folder_thaw (info->folder); */ mail_sync_folder(info->folder, NULL, NULL); - camel_object_unref((CamelObject *)info->folder); + camel_object_unref(info->folder); g_free(info->uri); } @@ -175,7 +175,7 @@ free_send_data(void) if (data->inbox) { mail_sync_folder(data->inbox, NULL, NULL); /*camel_folder_thaw (data->inbox); */ - camel_object_unref((CamelObject *)data->inbox); + camel_object_unref(data->inbox); } g_list_free(data->infos); @@ -206,28 +206,33 @@ static void hide_send_info(void *key, struct _send_info *info, void *data) } static void -dialog_destroy (GtkProgressBar *bar, struct _send_data *data) +dialog_destroy (struct _send_data *data, GtkProgressBar *bar) { g_hash_table_foreach (data->active, (GHFunc) hide_send_info, NULL); data->gd = NULL; } static void -dialogue_clicked(GnomeDialog *gd, int button, struct _send_data *data) +dialogue_response(GtkDialog *gd, int button, struct _send_data *data) { switch(button) { - case 0: + case GTK_RESPONSE_CANCEL: d(printf("cancelled whole thing\n")); if (!data->cancelled) { data->cancelled = TRUE; g_hash_table_foreach(data->active, (GHFunc)cancel_send_info, NULL); } - gnome_dialog_set_sensitive(gd, 0, FALSE); + gtk_dialog_set_response_sensitive(gd, GTK_RESPONSE_CANCEL, FALSE); break; - case -1: /* dialogue vanished, so make out its just hidden */ + default: + /* FIXME: check this works */ d(printf("hiding dialogue\n")); + gtk_widget_destroy((GtkWidget *)gd); + g_object_unref(gd); +#if 0 g_hash_table_foreach(data->active, (GHFunc)hide_send_info, NULL); data->gd = NULL; +#endif break; } } @@ -277,7 +282,7 @@ static send_info_t get_receive_type(const char *url) static struct _send_data * build_dialogue (GSList *sources, CamelFolder *outbox, const char *destination) { - GnomeDialog *gd; + GtkDialog *gd; GtkTable *table; int row; GList *list = NULL; @@ -289,12 +294,12 @@ build_dialogue (GSList *sources, CamelFolder *outbox, const char *destination) GtkHSeparator *line; struct _send_info *info; char *pretty_url; - - gd = (GnomeDialog *)send_recv_dialogue = gnome_dialog_new (_("Send & Receive Mail"), NULL); - gtk_signal_connect((GtkObject *)gd, "destroy", gtk_widget_destroyed, &send_recv_dialogue); - gnome_dialog_append_button_with_pixmap (gd, _("Cancel All"), GNOME_STOCK_BUTTON_CANCEL); - - gtk_window_set_policy (GTK_WINDOW (gd), FALSE, FALSE, FALSE); + + gd = (GtkDialog *)send_recv_dialogue = gtk_dialog_new_with_buttons(_("Send & Receive Mail"), NULL, 0, NULL); + stop = (GtkButton *)gtk_button_new_from_stock(GTK_STOCK_CANCEL); + gtk_button_set_label(stop, _("Cancel All")); + gtk_dialog_add_action_widget(gd, (GtkWidget *)stop, GTK_RESPONSE_CANCEL); + g_object_set(gd, "resizable", FALSE, NULL); gnome_window_icon_set_from_file (GTK_WINDOW (gd), EVOLUTION_ICONSDIR "/send-receive.xpm"); table = (GtkTable *)gtk_table_new (g_slist_length (sources), 4, FALSE); @@ -342,16 +347,15 @@ build_dialogue (GSList *sources, CamelFolder *outbox, const char *destination) } else if (info->timeout_id == 0) info->timeout_id = gtk_timeout_add (STATUS_TIMEOUT, operation_status_timeout, info); - recv_icon = gnome_pixmap_new_from_file (EVOLUTION_BUTTONSDIR "/receive-24.png"); + recv_icon = gtk_image_new_from_file (EVOLUTION_BUTTONSDIR "/receive-24.png"); pretty_url = format_url (source->url); label = (GtkLabel *)gtk_label_new (pretty_url); g_free (pretty_url); bar = (GtkProgressBar *)gtk_progress_bar_new (); - gtk_progress_set_show_text (GTK_PROGRESS (bar), FALSE); - stop = (GtkButton *)gnome_stock_button (GNOME_STOCK_BUTTON_CANCEL); + stop = (GtkButton *)gtk_button_new_from_stock(GTK_STOCK_CANCEL); status_label = (GtkLabel *)gtk_label_new ((info->type == SEND_UPDATE) ? _("Updating...") : _("Waiting...")); @@ -370,7 +374,7 @@ build_dialogue (GSList *sources, CamelFolder *outbox, const char *destination) info->stop = stop; info->data = data; - gtk_signal_connect (GTK_OBJECT (stop), "clicked", receive_cancel, info); + g_signal_connect(stop, "clicked", G_CALLBACK(receive_cancel), info); sources = sources->next; row = row + 2; } @@ -398,19 +402,18 @@ build_dialogue (GSList *sources, CamelFolder *outbox, const char *destination) } else if (info->timeout_id == 0) info->timeout_id = gtk_timeout_add (STATUS_TIMEOUT, operation_status_timeout, info); - send_icon = gnome_pixmap_new_from_file (EVOLUTION_BUTTONSDIR "/send-24.png"); + send_icon = gtk_image_new_from_file (EVOLUTION_BUTTONSDIR "/send-24.png"); pretty_url = format_url (destination); label = (GtkLabel *)gtk_label_new (pretty_url); g_free (pretty_url); bar = (GtkProgressBar *)gtk_progress_bar_new (); - stop = (GtkButton *)gnome_stock_button (GNOME_STOCK_BUTTON_CANCEL); + stop = (GtkButton *)gtk_button_new_from_stock(GTK_STOCK_CANCEL); status_label = (GtkLabel *)gtk_label_new (_("Waiting...")); gtk_misc_set_alignment (GTK_MISC (label), 0, .5); gtk_misc_set_alignment (GTK_MISC (status_label), 0, .5); - gtk_progress_set_show_text (GTK_PROGRESS (bar), FALSE); gtk_table_attach (table, GTK_WIDGET (send_icon), 0, 1, row, row+2, GTK_EXPAND | GTK_FILL, 0, 3, 1); gtk_table_attach (table, GTK_WIDGET (label), 1, 2, row, row+1, GTK_EXPAND | GTK_FILL, 0, 3, 1); @@ -423,14 +426,14 @@ build_dialogue (GSList *sources, CamelFolder *outbox, const char *destination) info->data = data; info->status = status_label; - gtk_signal_connect (GTK_OBJECT (stop), "clicked", receive_cancel, info); + g_signal_connect(stop, "clicked", G_CALLBACK(receive_cancel), info); gtk_widget_show_all (GTK_WIDGET (table)); } gtk_widget_show (GTK_WIDGET (gd)); - gtk_signal_connect (GTK_OBJECT (gd), "clicked", dialogue_clicked, data); - gtk_signal_connect (GTK_OBJECT (gd), "destroy", dialog_destroy, data); + g_signal_connect(gd, "response", G_CALLBACK(dialogue_response), data); + g_signal_connect(gd, "destroy", G_CALLBACK(dialog_destroy), data); data->infos = list; data->gd = gd; @@ -500,7 +503,7 @@ static int operation_status_timeout(void *data) struct _send_info *info = data; if (info->bar) { - gtk_progress_set_percentage((GtkProgress *)info->bar, (gfloat)(info->pc/100.0)); + gtk_progress_bar_set_fraction((GtkProgressBar *)info->bar, (gfloat)(info->pc/100.0)); gtk_label_set_text(info->status, info->what); return TRUE; } @@ -533,7 +536,7 @@ receive_done (char *uri, void *data) struct _send_info *info = data; if (info->bar) { - gtk_progress_set_percentage((GtkProgress *)info->bar, (gfloat)1.0); + gtk_progress_bar_set_fraction((GtkProgressBar *)info->bar, (gfloat)1.0); switch(info->state) { case SEND_CANCELLED: @@ -554,8 +557,11 @@ receive_done (char *uri, void *data) info->data->infos = g_list_remove(info->data->infos, info); if (g_hash_table_size(info->data->active) == 0) { - if (info->data->gd) - gnome_dialog_close(info->data->gd); + /* FIXME: check this is right ... was gnome_dialog_close() */ + if (info->data->gd) { + gtk_widget_destroy((GtkWidget *)info->data->gd); + g_object_unref(info->data->gd); + } free_send_data(); } @@ -585,7 +591,7 @@ receive_get_folder(CamelFilterDriver *d, const char *uri, void *data, CamelExcep oldinfo = g_hash_table_lookup(info->data->folders, uri); g_mutex_unlock(info->data->lock); if (oldinfo) { - camel_object_ref((CamelObject *)oldinfo->folder); + camel_object_ref(oldinfo->folder); return oldinfo->folder; } folder = mail_tool_uri_to_folder (uri, 0, ex); @@ -597,7 +603,7 @@ receive_get_folder(CamelFilterDriver *d, const char *uri, void *data, CamelExcep g_mutex_lock(info->data->lock); if (g_hash_table_lookup_extended(info->data->folders, uri, (void **)&oldkey, (void **)&oldinfo)) { - camel_object_unref((CamelObject *)oldinfo->folder); + camel_object_unref(oldinfo->folder); oldinfo->folder = folder; } else { /*camel_folder_freeze (folder); */ @@ -607,7 +613,7 @@ receive_get_folder(CamelFilterDriver *d, const char *uri, void *data, CamelExcep g_hash_table_insert(info->data->folders, oldinfo->uri, oldinfo); } - camel_object_ref (CAMEL_OBJECT (folder)); + camel_object_ref (folder); g_mutex_unlock(info->data->lock); diff --git a/mail/mail-session.c b/mail/mail-session.c index 011f09edca..11285f8a12 100644 --- a/mail/mail-session.c +++ b/mail/mail-session.c @@ -25,14 +25,13 @@ #endif #include <stdlib.h> + +#include <gtk/gtkdialog.h> +#include <gtk/gtkstock.h> + #include <libgnome/gnome-defs.h> #include <libgnome/gnome-config.h> #include <libgnome/gnome-sound.h> -#include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-dialog-util.h> -#include <libgnomeui/gnome-messagebox.h> -#include <libgnomeui/gnome-stock.h> - #include <gal/widgets/e-unicode.h> #include "camel/camel-filter-driver.h" @@ -150,9 +149,8 @@ make_key (CamelService *service, const char *item) /* ********************************************************************** */ -static GnomeDialog *password_dialogue = NULL; +static GtkDialog *password_dialogue = NULL; static EDList password_list = E_DLIST_INITIALISER(password_list); -static int password_destroy_id; struct _pass_msg { struct _mail_msg msg; @@ -167,7 +165,9 @@ struct _pass_msg { char *service_url; char *key; + MailConfigService *config_service; GtkWidget *check; + GtkWidget *entry; char *result; int ismain; }; @@ -175,29 +175,20 @@ struct _pass_msg { static void do_get_pass(struct _mail_msg *mm); static void -pass_got (char *string, void *data) +pass_response(GtkDialog *dialogue, int button, void *data) { struct _pass_msg *m = data; - - if (string) { - MailConfigService *service = NULL; - const MailConfigAccount *mca; + + switch(button) { + case GTK_RESPONSE_OK: { gboolean cache, remember; - m->result = g_strdup (string); - remember = cache = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (m->check)); + 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) { - mca = mail_config_get_account_by_source_url (m->service_url); - if (mca) { - service = mca->source; - } else { - mca = mail_config_get_account_by_transport_url (m->service_url); - if (mca) - service = mca->transport; - } - - if (service) { - mail_config_service_set_save_passwd (service, cache); + if (m->service) { + mail_config_service_set_save_passwd (m->config_service, cache); /* set `cache' to TRUE because people don't want to have to re-enter their passwords for this session even if they told @@ -217,14 +208,14 @@ pass_got (char *string, void *data) if (remember) e_passwords_remember_password (m->key); } - } else { + break; } + default: camel_exception_set(m->ex, CAMEL_EXCEPTION_USER_CANCEL, _("User canceled operation.")); + break; } - if (password_destroy_id) { - gtk_signal_disconnect((GtkObject *)password_dialogue, password_destroy_id); - password_destroy_id = 0; - } + gtk_widget_destroy((GtkWidget *)dialogue); + g_object_unref(dialogue); password_dialogue = NULL; e_msgport_reply((EMsg *)m); @@ -234,22 +225,10 @@ pass_got (char *string, void *data) } static void -request_password_deleted(GtkWidget *w, struct _pass_msg *m) -{ - password_destroy_id = 0; - pass_got(NULL, m); -} - -static void request_password(struct _pass_msg *m) { - const MailConfigAccount *mca = NULL; - GtkWidget *dialogue; - GtkWidget *check, *check_label, *entry; - GList *children, *iter; - gboolean show; char *title; - unsigned int accel_key; + const MailConfigAccount *mca = NULL; /* If we already have a password_dialogue up, save this request till later */ if (!m->ismain && password_dialogue) { @@ -257,6 +236,38 @@ request_password(struct _pass_msg *m) return; } + if (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)) ) + m->config_service = mca->transport; + } + + if (mca) + 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); + 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); + + 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")); + 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); + } + +#if 0 + /* FIXME: Remove this total snot */ /* assume we can use any widget to translate string for display */ @@ -264,7 +275,7 @@ request_password(struct _pass_msg *m) title = e_utf8_to_gtk_string (GTK_WIDGET (check_label), m->prompt); password_dialogue = (GnomeDialog *)dialogue = gnome_request_dialog (m->secret, title, NULL, 0, pass_got, m, NULL); g_free(title); - password_destroy_id = gtk_signal_connect((GtkObject *)dialogue, "destroy", request_password_deleted, m); + password_destroy_id = g_signal_connect((GtkObject *)dialogue, "destroy", request_password_deleted, m); check = gtk_check_button_new (); gtk_misc_set_alignment (GTK_MISC (check_label), 0.0, 0.5); @@ -309,7 +320,7 @@ request_password(struct _pass_msg *m) g_list_free (children); if (entry) { - gtk_object_ref (GTK_OBJECT (entry)); + g_object_ref((entry)); gtk_container_remove (GTK_CONTAINER (GNOME_DIALOG (dialogue)->vbox), entry); } @@ -318,7 +329,7 @@ request_password(struct _pass_msg *m) if (entry) { gtk_box_pack_end (GTK_BOX (GNOME_DIALOG (dialogue)->vbox), entry, TRUE, FALSE, 0); gtk_widget_grab_focus (entry); - gtk_object_unref (GTK_OBJECT (entry)); + g_object_unref((entry)); } m->check = check; @@ -334,11 +345,12 @@ request_password(struct _pass_msg *m) gtk_window_set_title (GTK_WINDOW (dialogue), title); g_free (title); +#endif if (m->ismain) - gnome_dialog_run_and_close ((GnomeDialog *)dialogue); + gtk_dialog_run(password_dialogue); else - gtk_widget_show(dialogue); + gtk_widget_show((GtkWidget *)password_dialogue); } static void @@ -444,9 +456,8 @@ forget_password (CamelSession *session, CamelService *service, const char *item, /* ********************************************************************** */ -static GnomeDialog *message_dialogue; +static GtkDialog *message_dialogue; static EDList message_list = E_DLIST_INITIALISER(password_list); -static guint message_destroy_id; struct _user_message_msg { struct _mail_msg msg; @@ -461,48 +472,31 @@ struct _user_message_msg { static void do_user_message (struct _mail_msg *mm); -/* if we dont have to wait for reply, we just check to see if any newly waiting prompts are there */ -static void -user_message_destroy_noreply(GnomeDialog *gd, void *data) -{ - struct _user_message_msg *m; - - message_dialogue = NULL; - if ((m = (struct _user_message_msg *)e_dlist_remhead(&message_list))) - do_user_message((struct _mail_msg *)m); -} - /* clicked, send back the reply */ static void -user_message_clicked(GnomeDialog *gd, int button, struct _user_message_msg *m) +user_message_response(GtkDialog *gd, int button, struct _user_message_msg *m) { + gtk_widget_destroy((GtkWidget *)gd); + g_object_unref(gd); + message_dialogue = NULL; - if (message_destroy_id) { - gtk_signal_disconnect((GtkObject *)gd, message_destroy_id); - message_destroy_id = 0; + /* if !allow_cancel, then we've already replied */ + if (m->allow_cancel) { + m->result = button == GTK_RESPONSE_OK; + e_msgport_reply((EMsg *)m); } - m->result = button == 0; - 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); } static void -user_message_destroy(GnomeDialog *gd, struct _user_message_msg *m) -{ - message_destroy_id = 0; - user_message_clicked(gd, -1, m); -} - -static void do_user_message (struct _mail_msg *mm) { struct _user_message_msg *m = (struct _user_message_msg *)mm; - const char *msg_type; + GtkMessageType msg_type; if (!m->ismain && message_dialogue != NULL) { e_dlist_addtail(&message_list, (EDListNode *)m); @@ -511,35 +505,33 @@ do_user_message (struct _mail_msg *mm) switch (m->type) { case CAMEL_SESSION_ALERT_INFO: - msg_type = GNOME_MESSAGE_BOX_INFO; + msg_type = GTK_MESSAGE_INFO; break; case CAMEL_SESSION_ALERT_WARNING: - msg_type = GNOME_MESSAGE_BOX_WARNING; + msg_type = GTK_MESSAGE_WARNING; break; case CAMEL_SESSION_ALERT_ERROR: - msg_type = GNOME_MESSAGE_BOX_ERROR; + msg_type = GTK_MESSAGE_ERROR; break; default: - msg_type = NULL; + msg_type = GTK_MESSAGE_INFO; } - message_dialogue = (GnomeDialog *)gnome_message_box_new(m->prompt, msg_type, GNOME_STOCK_BUTTON_OK, - m->allow_cancel ? GNOME_STOCK_BUTTON_CANCEL : NULL, - NULL); - gnome_dialog_set_default(message_dialogue, 1); - gnome_dialog_set_close(message_dialogue, TRUE); - gtk_window_set_policy (GTK_WINDOW (message_dialogue), TRUE, TRUE, TRUE); + message_dialogue = (GtkDialog *)gtk_message_dialog_new( + NULL, 0, msg_type, + 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); /* We only need to wait for the result if we allow cancel otherwise show but send result back instantly */ if (m->allow_cancel) { - gtk_signal_connect((GtkObject*)message_dialogue, "clicked", user_message_clicked, m); - message_destroy_id = gtk_signal_connect((GtkObject*)message_dialogue, "destroy", user_message_destroy, m); + g_signal_connect(message_dialogue, "response", G_CALLBACK(user_message_response), m); if (m->ismain) - gnome_dialog_run_and_close ((GnomeDialog *)message_dialogue); + gtk_dialog_run(message_dialogue); else gtk_widget_show((GtkWidget *)message_dialogue); } else { - gtk_signal_connect((GtkObject *)message_dialogue, "destroy", user_message_destroy_noreply, NULL); gtk_widget_show((GtkWidget *)message_dialogue); m->result = TRUE; e_msgport_reply((EMsg *)m); @@ -760,7 +752,7 @@ register_timeout (CamelSession *session, guint32 interval, CamelTimeoutCallback MAIL_SESSION_UNLOCK(session, lock); - camel_object_ref((CamelObject *)ms); + camel_object_ref(ms); mail_async_event_emit(ms->async, MAIL_ASYNC_GUI, (MailAsyncFunc)main_register_timeout, (CamelObject *)session, (void *)ret, NULL); return ret; @@ -802,7 +794,7 @@ remove_timeout (CamelSession *session, guint handle) MAIL_SESSION_UNLOCK(session, lock); if (remove) { - camel_object_ref((CamelObject *)ms); + camel_object_ref(ms); mail_async_event_emit(ms->async, MAIL_ASYNC_GUI, (MailAsyncFunc)main_remove_timeout, (CamelObject *)session, (void *)handle, NULL); } else @@ -913,7 +905,7 @@ main_get_filter_driver (CamelSession *session, const char *type, CamelException g_string_free (fsearch, TRUE); g_string_free (faction, TRUE); - gtk_object_unref (GTK_OBJECT (fc)); + g_object_unref(fc); return driver; } diff --git a/mail/mail-signature-editor.c b/mail/mail-signature-editor.c index d2f0df303d..c6bdf5a53c 100644 --- a/mail/mail-signature-editor.c +++ b/mail/mail-signature-editor.c @@ -90,45 +90,47 @@ menu_file_save_cb (BonoboUIComponent *uic, { ESignatureEditor *editor; CORBA_Environment ev; - char *filename; + char *filename, *base; char *dirname; editor = E_SIGNATURE_EDITOR (data); printf ("editor->sig->filename = %s\n", editor->sig->filename); - dirname = g_dirname (editor->sig->filename); + dirname = g_path_get_dirname (editor->sig->filename); printf ("dirname = %s\n", dirname); - filename = g_basename (editor->sig->filename); - printf ("basename = %s\n", filename); - filename = g_strdup_printf ("%s/.#%s", dirname, filename); + base = g_path_get_basename (editor->sig->filename); + printf ("basename = %s\n", base); + filename = g_strdup_printf ("%s/.#%s", dirname, base); printf ("filename = %s\n", filename); g_free (dirname); - + g_free(base); + CORBA_exception_init (&ev); if (editor->html) { Bonobo_PersistFile pfile_iface; - pfile_iface = bonobo_object_client_query_interface (bonobo_widget_get_server (BONOBO_WIDGET (editor->control)), - "IDL:Bonobo/PersistFile:1.0", NULL); + pfile_iface = Bonobo_Unknown_queryInterface(bonobo_widget_get_objref (BONOBO_WIDGET (editor->control)), + "IDL:Bonobo/PersistFile:1.0", NULL); Bonobo_PersistFile_save (pfile_iface, filename, &ev); } else { Bonobo_PersistStream pstream_iface; - BonoboStream *stream; - - stream = bonobo_stream_open (BONOBO_IO_DRIVER_FS, filename, - Bonobo_Storage_WRITE | Bonobo_Storage_CREATE, 0644); - BONOBO_STREAM_CLASS (GTK_OBJECT (stream)->klass)->truncate (stream, 0, &ev); + Bonobo_Stream stream; + char *uri; + + uri = g_strdup_printf("file://%s", uri); + stream = bonobo_get_object (uri, "IDL:Bonobo/Stream:1.0", NULL); + g_free(uri); + + /* FIXME: truncate? */ - pstream_iface = bonobo_object_client_query_interface - (bonobo_widget_get_server (BONOBO_WIDGET (editor->control)), + pstream_iface = Bonobo_Unknown_queryInterface + (bonobo_widget_get_objref (BONOBO_WIDGET (editor->control)), "IDL:Bonobo/PersistStream:1.0", NULL); - Bonobo_PersistStream_save (pstream_iface, - (Bonobo_Stream) bonobo_object_corba_objref (BONOBO_OBJECT (stream)), - "text/plain", &ev); - - bonobo_object_unref (BONOBO_OBJECT (stream)); + Bonobo_PersistStream_save (pstream_iface, stream, "text/plain", &ev); + + bonobo_object_release_unref(stream, NULL); } if (ev._major != CORBA_NO_EXCEPTION || rename (filename, editor->sig->filename) == -1) { @@ -148,16 +150,12 @@ static void exit_dialog_cb (int reply, ESignatureEditor *editor) { switch (reply) { - case REPLY_YES: + case GTK_RESPONSE_YES: menu_file_save_cb (NULL, editor, NULL); - destroy_editor (editor); break; - case REPLY_NO: + case GTK_RESPONSE_NO: destroy_editor (editor); break; - case REPLY_CANCEL: - default: - break; } } @@ -169,23 +167,22 @@ do_exit (ESignatureEditor *editor) CORBA_exception_init (&ev); if (GNOME_GtkHTML_Editor_Engine_hasUndo (editor->engine, &ev)) { GtkWidget *dialog; - GtkWidget *label; gint button; - dialog = gnome_dialog_new (_("Save signature"), - GNOME_STOCK_BUTTON_YES, /* Save */ - GNOME_STOCK_BUTTON_NO, /* Don't save */ - GNOME_STOCK_BUTTON_CANCEL, /* Cancel */ - NULL); - - label = gtk_label_new (_("This signature has been changed, but hasn't been saved.\n" - "\nDo you wish to save your changes?")); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label, TRUE, TRUE, 0); - gtk_widget_show (label); - gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (editor->win)); - gnome_dialog_set_default (GNOME_DIALOG (dialog), 0); - button = gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); - + dialog = gtk_message_dialog_new(GTK_WINDOW (editor->win), + GTK_DIALOG_DESTROY_WITH_PARENT|GTK_DIALOG_MODAL, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_YES_NO, + _("This signature has been changed, but hasn't been saved.\n" + "\nDo you wish to save your changes?")); + gtk_dialog_add_button((GtkDialog *)dialog, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); + gtk_window_set_title((GtkWindow *)dialog, _("Save signature")); + gtk_dialog_set_default_response((GtkDialog *)dialog, GTK_RESPONSE_YES); + + button = gtk_dialog_run((GtkDialog *)dialog); + gtk_widget_destroy(dialog); + g_object_unref(dialog); + exit_dialog_cb (button, editor); } else destroy_editor (editor); @@ -223,11 +220,7 @@ menu_file_save_close_cb (BonoboUIComponent *uic, gpointer data, const gchar *pat static void menu_help (BonoboUIComponent *uih, void *data, const char *path) { - GnomeHelpMenuEntry he; - - he.name = PACKAGE; - he.path = "usage-mail-getnsend-send.html#HTML-SIGNATURE-HOWTO"; - gnome_help_display (NULL, &he); + gnome_help_display ("usage-mail-getnsend-send.html", "HTML-SIGNATURE-HOWTO", NULL); } static BonoboUIVerb verbs [] = { @@ -248,8 +241,8 @@ load_signature (ESignatureEditor *editor) if (editor->html) { Bonobo_PersistFile pfile_iface; - pfile_iface = bonobo_object_client_query_interface (bonobo_widget_get_server (BONOBO_WIDGET (editor->control)), - "IDL:Bonobo/PersistFile:1.0", NULL); + pfile_iface = Bonobo_Unknown_queryInterface(bonobo_widget_get_objref (BONOBO_WIDGET (editor->control)), + "IDL:Bonobo/PersistFile:1.0", NULL); CORBA_exception_init (&ev); Bonobo_PersistFile_load (pfile_iface, editor->sig->filename, &ev); CORBA_exception_free (&ev); @@ -262,8 +255,8 @@ load_signature (ESignatureEditor *editor) html = g_strdup_printf ("<PRE>\n%s", data); g_free (data); - pstream_iface = bonobo_object_client_query_interface - (bonobo_widget_get_server (BONOBO_WIDGET (editor->control)), + pstream_iface = Bonobo_Unknown_queryInterface + (bonobo_widget_get_objref (BONOBO_WIDGET (editor->control)), "IDL:Bonobo/PersistStream:1.0", NULL); CORBA_exception_init (&ev); stream = bonobo_stream_mem_create (html, strlen (html), TRUE, FALSE); @@ -292,7 +285,7 @@ load_signature (ESignatureEditor *editor) static void sig_name_changed (GtkWidget *w, ESignatureEditor *editor) { - mail_config_signature_set_name (editor->sig, e_utf8_gtk_entry_get_text (GTK_ENTRY (editor->name_entry))); + mail_config_signature_set_name (editor->sig, gtk_entry_get_text(GTK_ENTRY (editor->name_entry))); } static void @@ -320,7 +313,6 @@ mail_signature_editor (MailConfigSignature *sig) BonoboUIComponent *component; BonoboUIContainer *container; GtkWidget *vbox, *hbox, *label, *frame, *vbox1; - gchar *title; if (!sig->filename || !*sig->filename) return; @@ -330,19 +322,17 @@ mail_signature_editor (MailConfigSignature *sig) editor->sig = sig; editor->html = sig->html; - title = g_strdup_printf (_("Edit signature")); - editor->win = bonobo_window_new ("e-sig-editor", title); + editor->win = bonobo_window_new ("e-sig-editor", _("Edit signature")); gtk_window_set_default_size (GTK_WINDOW (editor->win), DEFAULT_WIDTH, DEFAULT_HEIGHT); - gtk_window_set_policy (GTK_WINDOW (editor->win), FALSE, TRUE, FALSE); - g_free (title); + g_object_set(editor->win, "allow_shrink", FALSE, "allow_grow", TRUE, NULL); container = bonobo_ui_container_new (); bonobo_ui_container_set_win (container, BONOBO_WINDOW (editor->win)); component = bonobo_ui_component_new_default (); - bonobo_ui_component_set_container (component, bonobo_object_corba_objref (BONOBO_OBJECT (container))); + bonobo_ui_component_set_container (component, bonobo_object_corba_objref (BONOBO_OBJECT (container)), NULL); bonobo_ui_component_add_verb_list_with_data (component, verbs, editor); - bonobo_ui_util_set_ui (component, EVOLUTION_DATADIR, "evolution-signature-editor.xml", "evolution-signature-editor"); + bonobo_ui_util_set_ui (component, EVOLUTION_DATADIR, "evolution-signature-editor.xml", "evolution-signature-editor", NULL); editor->control = bonobo_widget_new_control ("OAFIID:GNOME_GtkHTML_Editor:1.1", bonobo_ui_component_get_container (component)); @@ -354,16 +344,16 @@ mail_signature_editor (MailConfigSignature *sig) return; } - editor->engine = (GNOME_GtkHTML_Editor_Engine) bonobo_object_client_query_interface - (bonobo_widget_get_server (BONOBO_WIDGET (editor->control)), "IDL:GNOME/GtkHTML/Editor/Engine:1.0", NULL); + editor->engine = (GNOME_GtkHTML_Editor_Engine) Bonobo_Unknown_queryInterface + (bonobo_widget_get_objref (BONOBO_WIDGET (editor->control)), "IDL:GNOME/GtkHTML/Editor/Engine:1.0", NULL); load_signature (editor); bonobo_ui_component_set_prop (component, "/commands/FormatHtml", "state", editor->html ? "1" : "0", NULL); bonobo_ui_component_add_listener (component, "FormatHtml", format_html_cb, editor); - gtk_signal_connect (GTK_OBJECT (editor->win), "delete_event", - GTK_SIGNAL_FUNC (delete_event_cb), editor); + g_signal_connect(editor->win, "delete_event", + G_CALLBACK (delete_event_cb), editor); vbox = gtk_vbox_new (FALSE, 0); hbox = gtk_hbox_new (FALSE, 4); @@ -375,8 +365,8 @@ mail_signature_editor (MailConfigSignature *sig) label = gtk_label_new (_("Name:")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0); editor->name_entry = gtk_entry_new (); - e_utf8_gtk_entry_set_text (GTK_ENTRY (editor->name_entry), sig->name); - gtk_signal_connect (GTK_OBJECT (editor->name_entry), "changed", GTK_SIGNAL_FUNC (sig_name_changed), editor); + gtk_entry_set_text(GTK_ENTRY (editor->name_entry), sig->name); + g_signal_connect(editor->name_entry, "changed", G_CALLBACK (sig_name_changed), editor); gtk_box_pack_start_defaults (GTK_BOX (hbox), editor->name_entry); frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT); diff --git a/mail/mail-stream-gtkhtml.c b/mail/mail-stream-gtkhtml.c index 2dd8c02ee0..db5726aab6 100644 --- a/mail/mail-stream-gtkhtml.c +++ b/mail/mail-stream-gtkhtml.c @@ -37,7 +37,7 @@ mail_stream_gtkhtml_class_init (MailStreamGtkHTMLClass *mail_stream_gtkhtml_clas CamelStreamClass *camel_stream_class = CAMEL_STREAM_CLASS (mail_stream_gtkhtml_class); - parent_class = CAMEL_STREAM_CLASS (camel_type_get_global_classfuncs (CAMEL_STREAM_TYPE)); + parent_class = (CamelStreamClass *)CAMEL_STREAM_TYPE; /* virtual method overload */ camel_stream_class->write = stream_write; diff --git a/mail/mail-tools.c b/mail/mail-tools.c index 4801ac6969..79abe80523 100644 --- a/mail/mail-tools.c +++ b/mail/mail-tools.c @@ -30,6 +30,7 @@ #include <pthread.h> #include <ctype.h> #include <errno.h> +#include <string.h> #include <gal/widgets/e-unicode.h> #include "camel/camel.h" #include "camel/camel-vee-folder.h" @@ -70,7 +71,7 @@ mail_tool_get_inbox (const gchar *url, CamelException *ex) return NULL; folder = camel_store_get_inbox (store, ex); - camel_object_unref (CAMEL_OBJECT (store)); + camel_object_unref (store); return folder; } @@ -94,7 +95,7 @@ mail_tool_get_trash (const gchar *url, int connect, CamelException *ex) else trash = NULL; - camel_object_unref (CAMEL_OBJECT (store)); + camel_object_unref (store); return trash; } @@ -256,15 +257,10 @@ mail_tool_make_message_attachment (CamelMimeMessage *message) char *desc; subject = camel_mime_message_get_subject (message); - if (subject) { - char *fmt; - - fmt = e_utf8_from_locale_string (_("Forwarded message - %s")); - desc = g_strdup_printf (fmt, subject); - g_free (fmt); - } else { - desc = e_utf8_from_locale_string (_("Forwarded message")); - } + if (subject) + desc = g_strdup_printf (_("Forwarded message - %s"), subject); + else + desc = g_strdup (_("Forwarded message")); /* rip off the X-Evolution headers */ xev = mail_tool_remove_xevolution_headers (message); @@ -323,7 +319,7 @@ mail_tool_uri_to_folder (const char *uri, guint32 flags, CamelException *ex) folder = camel_store_get_trash (store, ex); else folder = camel_store_get_folder (store, name, flags, ex); - camel_object_unref (CAMEL_OBJECT (store)); + camel_object_unref (store); } if (folder) @@ -413,9 +409,8 @@ mail_tool_forward_message (CamelMimeMessage *message, gboolean quoted) body = mail_get_message_body (CAMEL_DATA_WRAPPER (message), !mail_config_get_send_html (), quoted); - title = e_utf8_from_locale_string (_("Forwarded Message")); + title = _("Forwarded Message"); ret = g_strdup_printf ("-----%s-----<br>%s", title, body ? body : ""); - g_free (title); g_free (body); return ret; } diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index 7a8ac3011d..d1fdba5b24 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -15,9 +15,6 @@ #include <glib.h> #include <libgnome/gnome-defs.h> #include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-dialog-util.h> -#include <libgnomeui/gnome-stock.h> #include "Evolution.h" #include "evolution-storage.h" @@ -33,7 +30,6 @@ #include "mail-mt.h" #include "gal/widgets/e-gui-utils.h" -#include "gal/util/e-unicode-i18n.h" #include "camel/camel.h" #include "camel/camel-vee-folder.h" @@ -111,7 +107,7 @@ vfolder_setup_do(struct _mail_msg *mm) l = m->sources_folder; while (l) { d(printf(" Adding folder: %s\n", ((CamelFolder *)l->data)->full_name)); - camel_object_ref((CamelObject *)l->data); + camel_object_ref(l->data); list = g_list_append(list, l->data); l = l->next; } @@ -120,7 +116,7 @@ vfolder_setup_do(struct _mail_msg *mm) l = list; while (l) { - camel_object_unref((CamelObject *)l->data); + camel_object_unref(l->data); l = l->next; } g_list_free(list); @@ -140,7 +136,7 @@ vfolder_setup_free (struct _mail_msg *mm) struct _setup_msg *m = (struct _setup_msg *)mm; GList *l; - camel_object_unref((CamelObject *)m->folder); + camel_object_unref(m->folder); g_free(m->query); l = m->sources_uri; @@ -173,7 +169,7 @@ vfolder_setup(CamelFolder *folder, const char *query, GList *sources_uri, GList m = mail_msg_new(&vfolder_setup_op, NULL, sizeof (*m)); m->folder = folder; - camel_object_ref((CamelObject *)folder); + camel_object_ref(folder); m->query = g_strdup(query); m->sources_uri = sources_uri; m->sources_folder = sources_folder; @@ -229,7 +225,7 @@ vfolder_adduri_do(struct _mail_msg *mm) camel_vee_folder_add_folder((CamelVeeFolder *)l->data, folder); l = l->next; } - camel_object_unref((CamelObject *)folder); + camel_object_unref(folder); } } @@ -387,7 +383,7 @@ mail_vfolder_add_uri(CamelStore *store, const char *uri, int remove) if (found) { vf = g_hash_table_lookup(vfolder_hash, rule->name); g_assert(vf); - camel_object_ref((CamelObject *)vf); + camel_object_ref(vf); folders = g_list_prepend(folders, vf); } } @@ -398,6 +394,12 @@ mail_vfolder_add_uri(CamelStore *store, const char *uri, int remove) vfolder_adduri(uri, folders, remove); } +static void +close_dialogue(GtkDialog *gd, int response) +{ + g_object_unref(gd); +} + /* called when a uri is deleted from a store */ void mail_vfolder_delete_uri(CamelStore *store, const char *uri) @@ -429,9 +431,10 @@ mail_vfolder_delete_uri(CamelStore *store, const char *uri) if (uri_cmp(uri, source)) { vf = g_hash_table_lookup(vfolder_hash, rule->name); g_assert(vf); - gtk_signal_disconnect_by_func((GtkObject *)rule, rule_changed, vf); + g_signal_handlers_disconnect_matched(rule, G_SIGNAL_MATCH_FUNC|G_SIGNAL_MATCH_DATA, 0, + 0, NULL, rule_changed, vf); vfolder_rule_remove_source((VfolderRule *)rule, source); - gtk_signal_connect((GtkObject *)rule, "changed", rule_changed, vf); + g_signal_connect(rule, "changed", G_CALLBACK(rule_changed), vf); g_string_sprintfa(changed, " %s\n", rule->name); source = NULL; } @@ -441,17 +444,15 @@ mail_vfolder_delete_uri(CamelStore *store, const char *uri) UNLOCK(); if (changed->str[0]) { - GnomeDialog *gd; - char *text, *user; - - text = g_strdup_printf(_("The following vFolder(s):\n%s" - "Used the removed folder:\n '%s'\n" - "And have been updated."), - changed->str, uri); + GtkDialog *gd; + char *user; - gd = (GnomeDialog *)gnome_warning_dialog(text); - g_free(text); - gnome_dialog_set_close(gd, TRUE); + gd = (GtkDialog *)gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, + _("The following vFolder(s):\n%s" + "Used the removed folder:\n '%s'\n" + "And have been updated."), + changed->str, uri); + g_signal_connect(gd, "response", G_CALLBACK(close_dialogue), NULL); gtk_widget_show((GtkWidget *)gd); user = g_strdup_printf("%s/vfolders.xml", evolution_dir); @@ -492,10 +493,11 @@ mail_vfolder_rename_uri(CamelStore *store, const char *from, const char *to) d(printf("Vfolder '%s' used '%s' ('%s') now uses '%s'\n", rule->name, source, from, to)); vf = g_hash_table_lookup(vfolder_hash, rule->name); g_assert(vf); - gtk_signal_disconnect_by_func((GtkObject *)rule, rule_changed, vf); + g_signal_handlers_disconnect_matched(rule, G_SIGNAL_MATCH_FUNC|G_SIGNAL_MATCH_DATA, 0, + 0, NULL, rule_changed, vf); vfolder_rule_remove_source((VfolderRule *)rule, source); vfolder_rule_add_source((VfolderRule *)rule, to); - gtk_signal_connect((GtkObject *)rule, "changed", rule_changed, vf); + g_signal_connect(rule, "changed", G_CALLBACK(rule_changed), vf); changed++; source = NULL; } @@ -607,7 +609,7 @@ static void context_rule_added(RuleContext *ctx, FilterRule *rule) /* this always runs quickly */ folder = camel_store_get_folder(vfolder_store, rule->name, 0, NULL); if (folder) { - gtk_signal_connect((GtkObject *)rule, "changed", rule_changed, folder); + g_signal_connect(rule, "changed", G_CALLBACK(rule_changed), folder); LOCK(); g_hash_table_insert(vfolder_hash, g_strdup(rule->name), folder); @@ -673,10 +675,11 @@ store_folder_deleted(CamelObject *o, void *event_data, void *data) rule = rule_context_find_rule((RuleContext *)context, info->full_name, NULL); if (rule) { /* We need to stop listening to removed events, otherwise we'll try and remove it again */ - gtk_signal_disconnect_by_func((GtkObject *)context, context_rule_removed, context); + g_signal_handlers_disconnect_matched(context, G_SIGNAL_MATCH_FUNC|G_SIGNAL_MATCH_DATA, 0, + 0, NULL, context_rule_removed, context); rule_context_remove_rule((RuleContext *)context, rule); - gtk_object_unref((GtkObject *)rule); - gtk_signal_connect((GtkObject *)context, "rule_removed", context_rule_removed, context); + g_object_unref(rule); + g_signal_connect(context, "rule_removed", G_CALLBACK(context_rule_removed), context); user = g_strdup_printf("%s/vfolders.xml", evolution_dir); rule_context_save((RuleContext *)context, user); @@ -714,10 +717,10 @@ store_folder_renamed(CamelObject *o, void *event_data, void *data) rule = rule_context_find_rule((RuleContext *)context, info->old_base, NULL); g_assert(rule); - - gtk_signal_disconnect_by_func((GtkObject *)rule, rule_changed, folder); + g_signal_handlers_disconnect_matched(rule, G_SIGNAL_MATCH_FUNC|G_SIGNAL_MATCH_DATA, 0, + 0, NULL, rule_changed, folder); filter_rule_set_name(rule, info->new->full_name); - gtk_signal_connect((GtkObject *)rule, "changed", rule_changed, folder); + g_signal_connect(rule, "changed", G_CALLBACK(rule_changed), folder); user = g_strdup_printf("%s/vfolders.xml", evolution_dir); rule_context_save((RuleContext *)context, user); @@ -746,15 +749,15 @@ vfolder_load_storage(GNOME_Evolution_Shell shell) return; } - camel_object_hook_event((CamelObject *)vfolder_store, "folder_created", + camel_object_hook_event(vfolder_store, "folder_created", (CamelObjectEventHookFunc)store_folder_created, NULL); - camel_object_hook_event((CamelObject *)vfolder_store, "folder_deleted", + camel_object_hook_event(vfolder_store, "folder_deleted", (CamelObjectEventHookFunc)store_folder_deleted, NULL); - camel_object_hook_event((CamelObject *)vfolder_store, "folder_renamed", + camel_object_hook_event(vfolder_store, "folder_renamed", (CamelObjectEventHookFunc)store_folder_renamed, NULL); d(printf("got store '%s' = %p\n", storeuri, vfolder_store)); - mail_load_storage_by_uri(shell, storeuri, U_("VFolders")); + mail_load_storage_by_uri(shell, storeuri, _("VFolders")); /* load our rules */ user = g_strdup_printf ("%s/vfolders.xml", evolution_dir); @@ -764,8 +767,8 @@ vfolder_load_storage(GNOME_Evolution_Shell shell) } g_free (user); - gtk_signal_connect((GtkObject *)context, "rule_added", context_rule_added, context); - gtk_signal_connect((GtkObject *)context, "rule_removed", context_rule_removed, context); + g_signal_connect(context, "rule_added", G_CALLBACK(context_rule_added), context); + g_signal_connect(context, "rule_removed", G_CALLBACK(context_rule_removed), context); /* and setup the rules we have */ rule = NULL; @@ -782,29 +785,25 @@ vfolder_load_storage(GNOME_Evolution_Shell shell) static GtkWidget *vfolder_editor = NULL; static void -vfolder_editor_clicked (GtkWidget *dialog, int button, void *data) +vfolder_editor_response (GtkWidget *dialog, int button, void *data) { char *user; user = alloca(strlen(evolution_dir)+16); sprintf(user, "%s/vfolders.xml", evolution_dir); - if (button == 0) + switch(button) { + case GTK_RESPONSE_OK: rule_context_save((RuleContext *)context, user); - else + break; + default: rule_context_revert((RuleContext *)context, user); + } vfolder_editor = NULL; - if (button != -1) - gnome_dialog_close (GNOME_DIALOG (dialog)); -} - -static void -vfolder_editor_destroy (GtkWidget *widget, gpointer user_data) -{ - if (vfolder_editor) - vfolder_editor_clicked(vfolder_editor, -1, user_data); + gtk_widget_destroy(dialog); + g_object_unref(dialog); } void @@ -817,17 +816,16 @@ vfolder_edit (void) vfolder_editor = GTK_WIDGET (vfolder_editor_new (context)); gtk_window_set_title (GTK_WINDOW (vfolder_editor), _("vFolders")); - gtk_signal_connect (GTK_OBJECT (vfolder_editor), "clicked", vfolder_editor_clicked, NULL); - gtk_signal_connect (GTK_OBJECT (vfolder_editor), "destroy", vfolder_editor_destroy, NULL); - gnome_dialog_append_buttons (GNOME_DIALOG (vfolder_editor), GNOME_STOCK_BUTTON_CANCEL, NULL); + g_signal_connect(vfolder_editor, "response", G_CALLBACK(vfolder_editor_response), NULL); + gtk_dialog_add_button (GTK_DIALOG (vfolder_editor), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); gtk_widget_show (vfolder_editor); } static void -edit_rule_clicked(GtkWidget *w, int button, void *data) +edit_rule_response(GtkWidget *w, int button, void *data) { - if (button == 0) { + if (button == GTK_RESPONSE_OK) { char *user; FilterRule *rule = gtk_object_get_data((GtkObject *)w, "rule"); FilterRule *orig = gtk_object_get_data((GtkObject *)w, "orig"); @@ -837,40 +835,42 @@ edit_rule_clicked(GtkWidget *w, int button, void *data) rule_context_save((RuleContext *)context, user); g_free(user); } - if (button != -1) { - gnome_dialog_close((GnomeDialog *)w); - } + + gtk_widget_destroy(w); + g_object_unref(w); } void vfolder_edit_rule(const char *uri) { GtkWidget *w; - GnomeDialog *gd; + GtkDialog *gd; FilterRule *rule, *newrule; CamelURL *url; url = camel_url_new(uri, NULL); if (url && url->fragment && (rule = rule_context_find_rule((RuleContext *)context, url->fragment, NULL))) { - gtk_object_ref((GtkObject *)rule); + g_object_ref((GtkObject *)rule); newrule = filter_rule_clone(rule); w = filter_rule_get_widget((FilterRule *)newrule, (RuleContext *)context); - gd = (GnomeDialog *)gnome_dialog_new(_("Edit VFolder"), - GNOME_STOCK_BUTTON_OK, - GNOME_STOCK_BUTTON_CANCEL, - NULL); - gnome_dialog_set_default (gd, 0); - - gtk_window_set_policy(GTK_WINDOW(gd), FALSE, TRUE, FALSE); + gd = (GtkDialog *)gtk_dialog_new_with_buttons(_("Edit VFolder"), NULL, + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_OK, + GTK_RESPONSE_OK, + GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL, + NULL); + gtk_dialog_set_default_response(gd, GTK_RESPONSE_OK); + g_object_set(gd, "allow_shrink", FALSE, "allow_grow", TRUE, NULL); gtk_window_set_default_size (GTK_WINDOW (gd), 500, 500); gtk_box_pack_start((GtkBox *)gd->vbox, w, TRUE, TRUE, 0); gtk_widget_show((GtkWidget *)gd); - gtk_object_set_data_full((GtkObject *)gd, "rule", newrule, (GtkDestroyNotify)gtk_object_unref); - gtk_object_set_data_full((GtkObject *)gd, "orig", rule, (GtkDestroyNotify)gtk_object_unref); - gtk_signal_connect((GtkObject *)gd, "clicked", edit_rule_clicked, NULL); + g_object_set_data_full(G_OBJECT(gd), "rule", newrule, (GtkDestroyNotify)g_object_unref); + g_object_set_data_full(G_OBJECT(gd), "orig", rule, (GtkDestroyNotify)g_object_unref); + g_signal_connect(gd, "response", G_CALLBACK(edit_rule_response), NULL); gtk_widget_show((GtkWidget *)gd); } else { e_notice (NULL, GNOME_MESSAGE_BOX_WARNING, @@ -884,19 +884,19 @@ vfolder_edit_rule(const char *uri) static void new_rule_clicked(GtkWidget *w, int button, void *data) { - if (button == 0) { + if (button == GTK_RESPONSE_OK) { char *user; FilterRule *rule = gtk_object_get_data((GtkObject *)w, "rule"); - gtk_object_ref((GtkObject *)rule); + g_object_ref(rule); rule_context_add_rule((RuleContext *)context, rule); user = g_strdup_printf("%s/vfolders.xml", evolution_dir); rule_context_save((RuleContext *)context, user); g_free(user); } - if (button != -1) { - gnome_dialog_close((GnomeDialog *)w); - } + + gtk_widget_destroy(w); + g_object_unref(w); } FilterPart * @@ -924,22 +924,25 @@ void vfolder_gui_add_rule(VfolderRule *rule) { GtkWidget *w; - GnomeDialog *gd; + GtkDialog *gd; w = filter_rule_get_widget((FilterRule *)rule, (RuleContext *)context); - gd = (GnomeDialog *)gnome_dialog_new(_("New VFolder"), - GNOME_STOCK_BUTTON_OK, - GNOME_STOCK_BUTTON_CANCEL, - NULL); - gnome_dialog_set_default (gd, 0); - - gtk_window_set_policy(GTK_WINDOW(gd), FALSE, TRUE, FALSE); + gd = (GtkDialog *)gtk_dialog_new_with_buttons(_("New VFolder"), + NULL, + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_OK, + GTK_RESPONSE_OK, + GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL, + NULL); + gtk_dialog_set_default_response(gd, GTK_RESPONSE_OK); + g_object_set(gd, "allow_shrink", FALSE, "allow_grow", TRUE, NULL); gtk_window_set_default_size (GTK_WINDOW (gd), 500, 500); gtk_box_pack_start((GtkBox *)gd->vbox, w, TRUE, TRUE, 0); gtk_widget_show((GtkWidget *)gd); - gtk_object_set_data_full((GtkObject *)gd, "rule", rule, (GtkDestroyNotify)gtk_object_unref); - gtk_signal_connect((GtkObject *)gd, "clicked", new_rule_clicked, NULL); + g_object_set_data_full(G_OBJECT(gd), "rule", rule, (GtkDestroyNotify)g_object_unref); + g_signal_connect(gd, "clicked", G_CALLBACK(new_rule_clicked), NULL); gtk_widget_show((GtkWidget *)gd); } @@ -960,7 +963,7 @@ vfolder_foreach_cb (gpointer key, gpointer data, gpointer user_data) CamelFolder *folder = CAMEL_FOLDER (data); if (folder) - camel_object_unref (CAMEL_OBJECT (folder)); + camel_object_unref(folder); g_free (key); } @@ -973,12 +976,12 @@ mail_vfolder_shutdown (void) vfolder_hash = NULL; if (vfolder_store) { - camel_object_unref (CAMEL_OBJECT (vfolder_store)); + camel_object_unref (vfolder_store); vfolder_store = NULL; } if (context) { - gtk_object_unref (GTK_OBJECT (context)); + g_object_unref(context); context = NULL; } } diff --git a/mail/mail.h b/mail/mail.h index 98eb291d56..d303bef845 100644 --- a/mail/mail.h +++ b/mail/mail.h @@ -55,7 +55,7 @@ typedef gboolean (*MailMimeHandlerFn) (CamelMimePart *part, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream); typedef struct { gboolean generic; - OAF_ServerInfo *component; + Bonobo_ServerInfo *component; GList *applications; MailMimeHandlerFn builtin; } MailMimeHandler; diff --git a/mail/main.c b/mail/main.c index 7c3f0ff34a..f55b0a8d87 100644 --- a/mail/main.c +++ b/mail/main.c @@ -17,9 +17,8 @@ #include <libgnome/gnome-sound.h> #include <libgnomeui/gnome-init.h> #include <bonobo/bonobo-main.h> -#include <bonobo/bonobo-object-directory.h> +#include <bonobo-activation/bonobo-activation-init.h> #include <glade/glade.h> -#include <liboaf/liboaf.h> #include <libgnomevfs/gnome-vfs.h> #include <gconf/gconf.h> @@ -99,7 +98,7 @@ main (int argc, char *argv []) g_thread_init (NULL); gnome_init_with_popt_table ("evolution-mail-component", VERSION, - argc, argv, oaf_popt_options, 0, NULL); + argc, argv, bonobo_activation_popt_options, 0, NULL); sigaction (SIGSEGV, NULL, &osa); if (osa.sa_handler != SIG_DFL) { @@ -116,19 +115,13 @@ main (int argc, char *argv []) g_static_mutex_lock (&segv_mutex); } - orb = oaf_init (argc, argv); - - if (bonobo_init (orb, CORBA_OBJECT_NIL, - CORBA_OBJECT_NIL) == FALSE) { + if (!bonobo_init (&argc, argv)) { g_error ("Mail component could not initialize Bonobo.\n" "If there was a warning message about the " "RootPOA, it probably means\nyou compiled " - "Bonobo against GOAD instead of OAF."); + "Bonobo against GOAD instead of Bonobo Activation."); } - gtk_widget_push_visual (gdk_rgb_get_visual ()); - gtk_widget_push_colormap (gdk_rgb_get_cmap ()); - gconf_init (argc, argv, NULL); glade_gnome_init (); diff --git a/mail/message-browser.c b/mail/message-browser.c index 1b44f0934b..a9994631ab 100644 --- a/mail/message-browser.c +++ b/mail/message-browser.c @@ -61,25 +61,25 @@ static GtkAllocation last_allocation = { 0, 0 }; static BonoboWindowClass *message_browser_parent_class; static void -message_browser_destroy (GtkObject *object) +message_browser_finalise (GObject *object) { MessageBrowser *message_browser; message_browser = MESSAGE_BROWSER (object); + + g_signal_handlers_disconnect_matched(message_browser->fb, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, message_browser); + g_object_unref((message_browser->fb)); - gtk_signal_disconnect_by_data((GtkObject *)message_browser->fb, message_browser); - gtk_object_unref (GTK_OBJECT (message_browser->fb)); - - if (GTK_OBJECT_CLASS (message_browser_parent_class)->destroy) - (GTK_OBJECT_CLASS (message_browser_parent_class)->destroy) (object); + if (G_OBJECT_CLASS (message_browser_parent_class)->finalize) + (G_OBJECT_CLASS (message_browser_parent_class)->finalize) (object); } static void -message_browser_class_init (GtkObjectClass *object_class) +message_browser_class_init (GObjectClass *object_class) { - object_class->destroy = message_browser_destroy; + object_class->finalize = message_browser_finalise; - message_browser_parent_class = gtk_type_class (PARENT_TYPE); + message_browser_parent_class = g_type_class_ref(PARENT_TYPE); } static void @@ -94,7 +94,9 @@ transfer_msg_done (gboolean ok, void *data) MessageBrowser *mb = data; int row; - if (ok && !GTK_OBJECT_DESTROYED (mb)) { +#warning "GTK_OBJECT_DESTROYED" + /*if (ok && !GTK_OBJECT_DESTROYED (mb)) {*/ + if (ok) { row = e_tree_row_of_node (mb->fb->message_list->tree, e_tree_get_cursor (mb->fb->message_list->tree)); @@ -109,7 +111,7 @@ transfer_msg_done (gboolean ok, void *data) 0, 0, FALSE); } - gtk_object_unref (GTK_OBJECT (mb)); + g_object_unref((mb)); } static void @@ -121,9 +123,9 @@ transfer_msg (MessageBrowser *mb, int del) static char *last_uri = NULL; GPtrArray *uids; char *desc; - - if (GTK_OBJECT_DESTROYED(mb)) - return; + +/* if (GTK_OBJECT_DESTROYED(mb)) + return;*/ if (last_uri == NULL) last_uri = g_strdup (""); @@ -148,7 +150,7 @@ transfer_msg (MessageBrowser *mb, int del) message_list_foreach (mb->fb->message_list, enumerate_msg, uids); if (del) { - gtk_object_ref (GTK_OBJECT (mb)); + g_object_ref((mb)); mail_transfer_messages (mb->fb->folder, uids, del, folder->physicalUri, 0, transfer_msg_done, mb); } else { @@ -204,13 +206,10 @@ message_browser_message_loaded (FolderBrowser *fb, const char *uid, MessageBrows if (message) subject = (char *) camel_mime_message_get_subject (message); - if (subject != NULL) - subject = e_utf8_to_gtk_string (GTK_WIDGET (mb), subject); - else - subject = g_strdup (_("(No subject)")); + if (subject == NULL) + subject = _("(No subject)"); title = g_strdup_printf (_("%s - Message"), subject); - g_free (subject); gtk_window_set_title (GTK_WINDOW (mb), title); @@ -222,16 +221,16 @@ message_browser_message_list_built (MessageList *ml, MessageBrowser *mb) { const char *uid = gtk_object_get_data (GTK_OBJECT (mb), "uid"); - gtk_signal_disconnect_by_func (GTK_OBJECT (ml), message_browser_message_list_built, mb); - + g_signal_handlers_disconnect_matched(mb->fb, G_SIGNAL_MATCH_DATA|G_SIGNAL_MATCH_FUNC, 0, 0, NULL, + message_browser_message_list_built, mb); message_list_select_uid (ml, uid); } static void message_browser_folder_loaded (FolderBrowser *fb, const char *uri, MessageBrowser *mb) { - gtk_signal_connect (GTK_OBJECT (fb->message_list), "message_list_built", - message_browser_message_list_built, mb); + g_signal_connect(fb->message_list, "message_list_built", + G_CALLBACK(message_browser_message_list_built), mb); } static void @@ -261,17 +260,16 @@ set_bonobo_ui (GtkWidget *widget, FolderBrowser *fb) BonoboUIComponent *uic; CORBA_Environment ev; - uicont = bonobo_ui_container_new (); - bonobo_ui_container_set_win (uicont, BONOBO_WINDOW (widget)); + uicont = bonobo_window_get_ui_container(BONOBO_WINDOW(widget)); uic = bonobo_ui_component_new_default (); - bonobo_ui_component_set_container (uic, BONOBO_OBJREF (uicont)); + bonobo_ui_component_set_container (uic, BONOBO_OBJREF (uicont), NULL); folder_browser_set_ui_component (fb, uic); /* Load our UI */ /*bonobo_ui_component_freeze (uic, NULL);*/ - bonobo_ui_util_set_ui (uic, EVOLUTION_DATADIR, "evolution-mail-messagedisplay.xml", "evolution-mail"); + bonobo_ui_util_set_ui (uic, EVOLUTION_DATADIR, "evolution-mail-messagedisplay.xml", "evolution-mail", NULL); /* Load the appropriate UI stuff from the folder browser */ @@ -307,14 +305,14 @@ message_browser_new (const GNOME_Evolution_Shell shell, const char *uri, const c MessageBrowser *new; FolderBrowser *fb; - new = gtk_type_new (MESSAGE_BROWSER_TYPE); - new = (MessageBrowser *) bonobo_window_construct (BONOBO_WINDOW (new), "Ximian Evolution", ""); + new = g_object_new (MESSAGE_BROWSER_TYPE, + "title", "Ximian Evolution", NULL); if (!new) { g_warning ("Failed to construct Bonobo window!"); return NULL; } - gtk_object_set_data_full (GTK_OBJECT (new), "uid", g_strdup (uid), g_free); + g_object_set_data_full(G_OBJECT(new), "uid", g_strdup (uid), g_free); fb = FOLDER_BROWSER (folder_browser_new (shell, uri)); new->fb = fb; @@ -332,8 +330,8 @@ message_browser_new (const GNOME_Evolution_Shell shell, const char *uri, const c gtk_widget_show (GTK_WIDGET (fb->mail_display)); gtk_widget_show (vbox); - gtk_signal_connect (GTK_OBJECT (new), "size_allocate", - GTK_SIGNAL_FUNC (message_browser_size_allocate_cb), NULL); + g_signal_connect(new, "size_allocate", + G_CALLBACK (message_browser_size_allocate_cb), NULL); bonobo_window_set_contents (BONOBO_WINDOW (new), vbox); gtk_widget_grab_focus (GTK_WIDGET (MAIL_DISPLAY (fb->mail_display)->html)); @@ -341,11 +339,8 @@ message_browser_new (const GNOME_Evolution_Shell shell, const char *uri, const c set_default_size (GTK_WIDGET (new)); /* more evil hackery... */ - gtk_signal_connect (GTK_OBJECT (fb), "folder_loaded", - message_browser_folder_loaded, new); - - gtk_signal_connect (GTK_OBJECT (fb), "message_loaded", - message_browser_message_loaded, new); + g_signal_connect(fb, "folder_loaded", G_CALLBACK(message_browser_folder_loaded), new); + g_signal_connect(fb, "message_loaded", G_CALLBACK(message_browser_message_loaded), new); return GTK_WIDGET (new); } diff --git a/mail/message-browser.h b/mail/message-browser.h index d9a54b0900..15dd75c30e 100644 --- a/mail/message-browser.h +++ b/mail/message-browser.h @@ -24,7 +24,7 @@ #define _MESSAGE_BROWSER_H_ #include <gnome.h> -#include <bonobo/bonobo-win.h> +#include <bonobo/bonobo-window.h> #include <camel/camel-folder.h> #include "folder-browser.h" diff --git a/mail/message-list.c b/mail/message-list.c index b6c73c6e17..880af45ec2 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -30,6 +30,8 @@ #include <string.h> #include <ctype.h> +#include <glib/gunicode.h> + #include <gal/util/e-util.h> #include <gal/widgets/e-gui-utils.h> #include <gal/e-table/e-cell-text.h> @@ -40,7 +42,6 @@ #include <gal/e-table/e-cell-size.h> #include <gal/e-table/e-tree-memory.h> #include <gal/e-table/e-tree-memory-callbacks.h> -#include <gal/unicode/gunicode.h> #include <camel/camel-exception.h> #include <camel/camel-file-utils.h> @@ -185,7 +186,7 @@ e_mail_address_new (const char *address) cia = camel_internet_address_new (); if (camel_address_unformat (CAMEL_ADDRESS (cia), address) == -1) { - camel_object_unref (CAMEL_OBJECT (cia)); + camel_object_unref (cia); return NULL; } camel_internet_address_get (cia, 0, &name, &addr); @@ -198,7 +199,7 @@ e_mail_address_new (const char *address) new->wname = NULL; } - camel_object_unref (CAMEL_OBJECT (cia)); + camel_object_unref (cia); return new; } @@ -395,7 +396,7 @@ get_normalised_string (MessageList *message_list, CamelMessageInfo *info, int co const unsigned char *subject; subject = (const unsigned char *) string; - while (!g_strncasecmp (subject, "Re:", 3)) { + while (!g_ascii_strncasecmp (subject, "Re:", 3)) { subject += 3; /* jump over any spaces */ @@ -412,7 +413,8 @@ get_normalised_string (MessageList *message_list, CamelMessageInfo *info, int co normalised = g_utf8_collate_key (string, -1); e_poolv_set (poolv, index, normalised, TRUE); - + g_free(normalised); + return e_poolv_get (poolv, index); } @@ -437,8 +439,8 @@ search_func (ETreeModel *model, ETreePath path, struct search_func_data *data) g_free (data->message_list->cursor_uid); data->message_list->cursor_uid = g_strdup (camel_message_info_uid (info)); } - gtk_signal_emit (GTK_OBJECT (data->message_list), message_list_signals[MESSAGE_SELECTED], - camel_message_info_uid (info)); + g_signal_emit (GTK_OBJECT (data->message_list), message_list_signals[MESSAGE_SELECTED], 0, + camel_message_info_uid (info)); return TRUE; } return FALSE; @@ -514,12 +516,12 @@ message_list_select_uid (MessageList *message_list, const char *uid) g_free (message_list->cursor_uid); message_list->cursor_uid = g_strdup (camel_message_info_uid (info)); - gtk_signal_emit (GTK_OBJECT (message_list), message_list_signals[MESSAGE_SELECTED], + g_signal_emit (GTK_OBJECT (message_list), message_list_signals[MESSAGE_SELECTED], 0, camel_message_info_uid (info)); } else { g_free (message_list->cursor_uid); message_list->cursor_uid = NULL; - gtk_signal_emit (GTK_OBJECT (message_list), message_list_signals[MESSAGE_SELECTED], NULL); + g_signal_emit (GTK_OBJECT (message_list), message_list_signals[MESSAGE_SELECTED], 0, NULL); } } @@ -551,8 +553,8 @@ message_list_select_next_thread (MessageList *message_list) g_free (message_list->cursor_uid); message_list->cursor_uid = g_strdup (camel_message_info_uid (info)); - gtk_signal_emit (GTK_OBJECT (message_list), message_list_signals[MESSAGE_SELECTED], - camel_message_info_uid (info)); + g_signal_emit (GTK_OBJECT (message_list), message_list_signals[MESSAGE_SELECTED], 0, + camel_message_info_uid (info)); } } @@ -1207,9 +1209,9 @@ message_list_setup_etree (MessageList *message_list, gboolean outgoing) char *name; struct stat st; - gtk_object_set (GTK_OBJECT (message_list->tree), - "uniform_row_height", TRUE, - NULL); + g_object_set (message_list->tree, + "uniform_row_height", TRUE, + NULL); name = camel_service_get_name (CAMEL_SERVICE (message_list->folder->parent_store), TRUE); d(printf ("folder name is '%s'\n", name)); @@ -1259,7 +1261,7 @@ normalised_free (gpointer key, gpointer value, gpointer user_data) } static void -message_list_destroy (GtkObject *object) +message_list_finalise (GObject *object) { MessageList *message_list = MESSAGE_LIST (object); @@ -1272,24 +1274,24 @@ message_list_destroy (GtkObject *object) save_tree_state(message_list); hide_save_state(message_list); - camel_object_unhook_event((CamelObject *)message_list->folder, "folder_changed", - folder_changed, message_list); - camel_object_unhook_event((CamelObject *)message_list->folder, "message_changed", - message_changed, message_list); - camel_object_unref (CAMEL_OBJECT (message_list->folder)); + camel_object_unhook_event(message_list->folder, "folder_changed", folder_changed, message_list); + camel_object_unhook_event(message_list->folder, "message_changed", message_changed, message_list); + camel_object_unref (message_list->folder); } if (message_list->thread_tree) camel_folder_thread_messages_unref(message_list->thread_tree); - gtk_object_unref (GTK_OBJECT (message_list->extras)); - gtk_object_unref (GTK_OBJECT (message_list->model)); + if (message_list->extras) + g_object_unref((message_list->extras)); + if (message_list->model) + g_object_unref((message_list->model)); if (message_list->idle_id != 0) g_source_remove (message_list->idle_id); if (message_list->seen_id) - gtk_timeout_remove (message_list->seen_id); + g_source_remove (message_list->seen_id); if (message_list->hidden) { g_hash_table_destroy(message_list->hidden); @@ -1307,36 +1309,38 @@ message_list_destroy (GtkObject *object) g_mutex_free(message_list->hide_lock); - GTK_OBJECT_CLASS (message_list_parent_class)->destroy (object); + G_OBJECT_CLASS (message_list_parent_class)->finalize (object); } /* * GtkObjectClass::init */ static void -message_list_class_init (GtkObjectClass *object_class) +message_list_class_init (GObjectClass *object_class) { - message_list_parent_class = gtk_type_class (PARENT_TYPE); + message_list_parent_class = g_type_class_ref(PARENT_TYPE); - object_class->destroy = message_list_destroy; + object_class->finalize = message_list_finalise; message_list_signals[MESSAGE_SELECTED] = - gtk_signal_new ("message_selected", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (MessageListClass, message_selected), - gtk_marshal_NONE__STRING, - GTK_TYPE_NONE, 1, GTK_TYPE_STRING); + g_signal_new ("message_selected", + MESSAGE_LIST_TYPE, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (MessageListClass, message_selected), + NULL, + NULL, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, G_TYPE_STRING); message_list_signals[MESSAGE_LIST_BUILT] = - gtk_signal_new ("message_list_built", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (MessageListClass, message_list_built), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals(object_class, message_list_signals, LAST_SIGNAL); + g_signal_new ("message_list_built", + MESSAGE_LIST_TYPE, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (MessageListClass, message_list_built), + NULL, + NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); message_list_init_images (); } @@ -1367,8 +1371,6 @@ message_list_construct (MessageList *message_list) ml_value_to_string, message_list); - gtk_object_ref (GTK_OBJECT (message_list->model)); - gtk_object_sink (GTK_OBJECT (message_list->model)); e_tree_memory_set_expanded_default(E_TREE_MEMORY(message_list->model), TRUE); @@ -1387,12 +1389,12 @@ message_list_construct (MessageList *message_list) if (!construct_failed) e_tree_root_node_set_visible (message_list->tree, FALSE); - gtk_signal_connect (GTK_OBJECT (message_list->tree), "cursor_activated", - GTK_SIGNAL_FUNC (on_cursor_activated_cmd), - message_list); + g_signal_connect((message_list->tree), "cursor_activated", + G_CALLBACK (on_cursor_activated_cmd), + message_list); - gtk_signal_connect (GTK_OBJECT (message_list->tree), "click", - GTK_SIGNAL_FUNC (on_click), message_list); + g_signal_connect((message_list->tree), "click", + G_CALLBACK (on_click), message_list); } GtkWidget * @@ -1400,10 +1402,10 @@ message_list_new (void) { MessageList *message_list; - message_list = MESSAGE_LIST (gtk_widget_new (message_list_get_type (), - "hadjustment", NULL, - "vadjustment", NULL, - NULL)); + message_list = MESSAGE_LIST (g_object_new(message_list_get_type (), + "hadjustment", NULL, + "vadjustment", NULL, + NULL)); message_list_construct (message_list); return GTK_WIDGET (message_list); @@ -2109,7 +2111,7 @@ message_list_set_folder (MessageList *message_list, CamelFolder *camel_folder, g folder_changed, message_list); camel_object_unhook_event((CamelObject *)message_list->folder, "message_changed", message_changed, message_list); - camel_object_unref (CAMEL_OBJECT (message_list->folder)); + camel_object_unref (message_list->folder); } if (message_list->thread_tree) { @@ -2122,7 +2124,7 @@ message_list_set_folder (MessageList *message_list, CamelFolder *camel_folder, g if (message_list->cursor_uid) { g_free(message_list->cursor_uid); message_list->cursor_uid = NULL; - gtk_signal_emit((GtkObject *)message_list, message_list_signals[MESSAGE_SELECTED], NULL); + g_signal_emit(message_list, message_list_signals[MESSAGE_SELECTED], 0, NULL); } if (camel_folder) { @@ -2131,33 +2133,33 @@ message_list_set_folder (MessageList *message_list, CamelFolder *camel_folder, g ECell *cell; cell = e_table_extras_get_cell (message_list->extras, "render_date"); - gtk_object_set (GTK_OBJECT (cell), - "strikeout_column", COL_DELETED, - NULL); + g_object_set (cell, + "strikeout_column", COL_DELETED, + NULL); cell = e_table_extras_get_cell (message_list->extras, "render_text"); - gtk_object_set (GTK_OBJECT (cell), - "strikeout_column", COL_DELETED, - NULL); + g_object_set (cell, + "strikeout_column", COL_DELETED, + NULL); cell = e_table_extras_get_cell (message_list->extras, "render_size"); - gtk_object_set (GTK_OBJECT (cell), - "strikeout_column", COL_DELETED, - NULL); + g_object_set (cell, + "strikeout_column", COL_DELETED, + NULL); } /* Build the etree suitable for this folder */ message_list_setup_etree (message_list, outgoing); - camel_object_hook_event (CAMEL_OBJECT (camel_folder), "folder_changed", + camel_object_hook_event (camel_folder, "folder_changed", folder_changed, message_list); - camel_object_hook_event (CAMEL_OBJECT (camel_folder), "message_changed", + camel_object_hook_event (camel_folder, "message_changed", message_changed, message_list); - camel_object_ref (CAMEL_OBJECT (camel_folder)); + camel_object_ref (camel_folder); - message_list->hidedeleted = mail_config_get_hide_deleted () && - !(camel_folder->folder_flags & CAMEL_FOLDER_IS_TRASH); + message_list->hidedeleted = mail_config_get_hide_deleted () + && !(camel_folder->folder_flags & CAMEL_FOLDER_IS_TRASH); hide_load_state (message_list); mail_regen_list (message_list, message_list->search, NULL, NULL); @@ -2175,11 +2177,9 @@ on_cursor_activated_idle (gpointer data) if (selected == 1 && message_list->cursor_uid) { d(printf ("emitting cursor changed signal, for uid %s\n", message_list->cursor_uid)); - gtk_signal_emit (GTK_OBJECT (message_list), - message_list_signals[MESSAGE_SELECTED], message_list->cursor_uid); + g_signal_emit (message_list, message_list_signals[MESSAGE_SELECTED], 0, message_list->cursor_uid); } else { - gtk_signal_emit (GTK_OBJECT (message_list), - message_list_signals[MESSAGE_SELECTED], NULL); + g_signal_emit (message_list, message_list_signals[MESSAGE_SELECTED], 0, NULL); } message_list->idle_id = 0; @@ -2243,7 +2243,7 @@ on_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, Mess camel_folder_set_message_flags (list->folder, camel_message_info_uid (info), flag, ~info->flags); if (flag == CAMEL_MESSAGE_SEEN && list->seen_id) { - gtk_timeout_remove (list->seen_id); + g_source_remove (list->seen_id); list->seen_id = 0; } @@ -2710,8 +2710,9 @@ regen_list_regened (struct _mail_msg *mm) { struct _regen_list_msg *m = (struct _regen_list_msg *)mm; - if (GTK_OBJECT_DESTROYED(m->ml)) - return; +#warning "GTK_OBJECT_DESTROYED replacement" + /*if (GTK_OBJECT_DESTROYED(m->ml)) + return;*/ if (!m->complete) return; @@ -2728,7 +2729,7 @@ regen_list_regened (struct _mail_msg *mm) } else build_flat (m->ml, m->summary, m->changes); - gtk_signal_emit (GTK_OBJECT (m->ml), message_list_signals[MESSAGE_LIST_BUILT]); + g_signal_emit (m->ml, message_list_signals[MESSAGE_LIST_BUILT], 0); } static void @@ -2752,7 +2753,7 @@ regen_list_free (struct _mail_msg *mm) g_free (m->hideexpr); - camel_object_unref (CAMEL_OBJECT (m->folder)); + camel_object_unref (m->folder); if (m->changes) camel_folder_change_info_free (m->changes); @@ -2761,7 +2762,7 @@ regen_list_free (struct _mail_msg *mm) However, since we have a received function, this will always be called in gui thread */ m->ml->regen = g_list_remove(m->ml->regen, m); - gtk_object_unref (GTK_OBJECT (m->ml)); + g_object_unref(m->ml); } static struct _mail_msg_op regen_list_op = { @@ -2811,9 +2812,9 @@ mail_regen_list (MessageList *ml, const char *search, const char *hideexpr, Came m->changes = changes; m->dotree = ml->threaded; m->hidedel = ml->hidedeleted; - gtk_object_ref (GTK_OBJECT (ml)); + g_object_ref(ml); m->folder = ml->folder; - camel_object_ref (CAMEL_OBJECT (m->folder)); + camel_object_ref(m->folder); if ((!m->hidedel || !m->dotree) && ml->thread_tree) { camel_folder_thread_messages_unref(ml->thread_tree); diff --git a/mail/message-tag-editor.c b/mail/message-tag-editor.c index 3622611fec..5906111f4c 100644 --- a/mail/message-tag-editor.c +++ b/mail/message-tag-editor.c @@ -25,39 +25,37 @@ #include <config.h> #endif -#include <libgnomeui/gnome-stock.h> -#include <libgnomeui/gnome-window-icon.h> #include "message-tag-editor.h" - +#include <gtk/gtkstock.h> static void message_tag_editor_class_init (MessageTagEditorClass *class); static void message_tag_editor_init (MessageTagEditor *editor); -static void message_tag_editor_finalise (GtkObject *obj); +static void message_tag_editor_finalise (GObject *obj); static CamelTag *get_tag_list (MessageTagEditor *editor); static void set_tag_list (MessageTagEditor *editor, CamelTag *value); +static GtkDialogClass *parent_class = NULL; -static GnomeDialogClass *parent_class = NULL; - - -GtkType +GType message_tag_editor_get_type (void) { - static GtkType type = 0; + static GType type = 0; if (!type) { - GtkTypeInfo type_info = { - "MessageTagEditor", - sizeof (MessageTagEditor), + GTypeInfo type_info = { sizeof (MessageTagEditorClass), - (GtkClassInitFunc) message_tag_editor_class_init, - (GtkObjectInitFunc) message_tag_editor_init, - (GtkArgSetFunc) NULL, - (GtkArgGetFunc) NULL + NULL, + NULL, + (GClassInitFunc) message_tag_editor_class_init, + NULL, + NULL, + sizeof (MessageTagEditor), + 0, + (GInstanceInitFunc) message_tag_editor_init, }; - type = gtk_type_unique (gnome_dialog_get_type (), &type_info); + type = g_type_register_static(gtk_dialog_get_type (), "MessageTagEditor", &type_info, 0); } return type; @@ -66,10 +64,10 @@ message_tag_editor_get_type (void) static void message_tag_editor_class_init (MessageTagEditorClass *klass) { - GtkObjectClass *object_class; + GObjectClass *object_class; - object_class = (GtkObjectClass *) klass; - parent_class = gtk_type_class (gnome_dialog_get_type ()); + object_class = (GObjectClass *) klass; + parent_class = g_type_class_ref(gtk_dialog_get_type ()); object_class->finalize = message_tag_editor_finalise; @@ -80,23 +78,24 @@ message_tag_editor_class_init (MessageTagEditorClass *klass) static void message_tag_editor_init (MessageTagEditor *editor) { - gtk_window_set_policy (GTK_WINDOW (editor), FALSE, TRUE, FALSE); - - gnome_dialog_append_buttons (GNOME_DIALOG (editor), - GNOME_STOCK_BUTTON_OK, - GNOME_STOCK_BUTTON_CANCEL, - 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, + GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL, + NULL); - gnome_dialog_set_default (GNOME_DIALOG (editor), 0); + gtk_dialog_set_default_response (GTK_DIALOG (editor), GTK_RESPONSE_OK); } static void -message_tag_editor_finalise (GtkObject *obj) +message_tag_editor_finalise (GObject *obj) { /* MessageTagEditor *editor = (MessageTagEditor *) obj;*/ - ((GtkObjectClass *)(parent_class))->finalize (obj); + ((GObjectClass *)(parent_class))->finalize (obj); } static CamelTag * @@ -110,7 +109,7 @@ message_tag_editor_get_tag_list (MessageTagEditor *editor) { g_return_val_if_fail (IS_MESSAGE_TAG_EDITOR (editor), NULL); - return ((MessageTagEditorClass *)((GtkObject *) editor)->klass)->get_tag_list (editor); + return ((MessageTagEditorClass *)(G_OBJECT_GET_CLASS(editor)))->get_tag_list (editor); } @@ -127,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 *)((GtkObject *) editor)->klass)->set_tag_list (editor, tags); + ((MessageTagEditorClass *)(G_OBJECT_GET_CLASS(editor)))->set_tag_list (editor, tags); } diff --git a/mail/message-tag-editor.h b/mail/message-tag-editor.h index 5602489656..01d6b0c052 100644 --- a/mail/message-tag-editor.h +++ b/mail/message-tag-editor.h @@ -25,10 +25,9 @@ #define __MESSAGE_TAG_EDITOR_H__ #include <gtk/gtkwidget.h> -#include <libgnomeui/gnome-dialog.h> +#include <gtk/gtkdialog.h> #include <camel/camel-folder.h> #include <camel/camel-folder-summary.h> -#include <time.h> #ifdef __cplusplus extern "C" { @@ -43,12 +42,12 @@ typedef struct _MessageTagEditor MessageTagEditor; typedef struct _MessageTagEditorClass MessageTagEditorClass; struct _MessageTagEditor { - GnomeDialog parent; + GtkDialog parent; }; struct _MessageTagEditorClass { - GnomeDialogClass parent_class; + GtkDialogClass parent_class; /* virtual methods */ CamelTag * (*get_tag_list) (MessageTagEditor *editor); diff --git a/mail/message-tag-followup.c b/mail/message-tag-followup.c index bee65fab6d..31e0979dca 100644 --- a/mail/message-tag-followup.c +++ b/mail/message-tag-followup.c @@ -20,7 +20,6 @@ * */ - #ifdef HAVE_CONFIG_H #include <config.h> #endif @@ -36,14 +35,13 @@ #include <libgnomeui/gnome-pixmap.h> #include <gal/widgets/e-unicode.h> -#include <gal/util/e-unicode-i18n.h> #include "message-tag-followup.h" #include "mail-config.h" static void message_tag_followup_class_init (MessageTagFollowUpClass *class); static void message_tag_followup_init (MessageTagFollowUp *followup); -static void message_tag_followup_finalise (GtkObject *obj); +static void message_tag_followup_finalise (GObject *obj); static CamelTag *get_tag_list (MessageTagEditor *editor); static void set_tag_list (MessageTagEditor *editor, CamelTag *tags); @@ -69,23 +67,23 @@ static int num_available_flags = sizeof (available_flags) / sizeof (available_fl static MessageTagEditorClass *parent_class = NULL; -GtkType +GType message_tag_followup_get_type (void) { - static GtkType type = 0; + static GType type = 0; if (!type) { - GtkTypeInfo type_info = { - "MessageTagFollowUp", - sizeof (MessageTagFollowUp), + GTypeInfo type_info = { sizeof (MessageTagFollowUpClass), - (GtkClassInitFunc) message_tag_followup_class_init, - (GtkObjectInitFunc) message_tag_followup_init, - (GtkArgSetFunc) NULL, - (GtkArgGetFunc) NULL + NULL, NULL, + (GClassInitFunc) message_tag_followup_class_init, + NULL, NULL, + sizeof (MessageTagFollowUp), + 0, + (GInstanceInitFunc) message_tag_followup_init, }; - type = gtk_type_unique (message_tag_editor_get_type (), &type_info); + type = g_type_register_static (message_tag_editor_get_type (), "MessageTagFollowUp", &type_info, 0); } return type; @@ -94,12 +92,12 @@ message_tag_followup_get_type (void) static void message_tag_followup_class_init (MessageTagFollowUpClass *klass) { - GtkObjectClass *object_class; + GObjectClass *object_class; MessageTagEditorClass *editor_class; - object_class = (GtkObjectClass *) klass; + object_class = (GObjectClass *) klass; editor_class = (MessageTagEditorClass *) klass; - parent_class = gtk_type_class (message_tag_editor_get_type ()); + parent_class = g_type_class_ref(message_tag_editor_get_type ()); object_class->finalize = message_tag_followup_finalise; @@ -119,13 +117,13 @@ message_tag_followup_init (MessageTagFollowUp *editor) static void -message_tag_followup_finalise (GtkObject *obj) +message_tag_followup_finalise (GObject *obj) { MessageTagFollowUp *editor = (MessageTagFollowUp *) obj; editor->completed_date = 0; - ((GtkObjectClass *)(parent_class))->finalize (obj); + ((GObjectClass *)(parent_class))->finalize (obj); } @@ -137,9 +135,7 @@ get_tag_list (MessageTagEditor *editor) time_t date; char *text; - text = e_utf8_gtk_entry_get_text (GTK_ENTRY (followup->combo->entry)); - camel_tag_set (&tags, "follow-up", text); - g_free (text); + camel_tag_set(&tags, "follow-up", gtk_entry_get_text(GTK_ENTRY(followup->combo->entry))); date = e_date_edit_get_time (followup->target_date); if (date != (time_t) -1) { @@ -170,7 +166,7 @@ set_tag_list (MessageTagEditor *editor, CamelTag *tags) text = camel_tag_get (&tags, "follow-up"); if (text) - e_utf8_gtk_entry_set_text (GTK_ENTRY (followup->combo->entry), text); + gtk_entry_set_text(GTK_ENTRY (followup->combo->entry), text); text = camel_tag_get (&tags, "due-by"); if (text && *text) { @@ -246,12 +242,12 @@ construct (MessageTagEditor *editor) gtk_window_set_title (GTK_WINDOW (editor), _("Flag to Follow Up")); gnome_window_icon_set_from_file (GTK_WINDOW (editor), EVOLUTION_IMAGES "/flag-for-followup-16.png"); - gui = glade_xml_new (EVOLUTION_GLADEDIR "/message-tags.glade", "followup_editor"); + gui = glade_xml_new (EVOLUTION_GLADEDIR "/message-tags.glade", "followup_editor", NULL); widget = glade_xml_get_widget (gui, "toplevel"); /* reparent */ - gtk_widget_reparent (widget, GNOME_DIALOG (editor)->vbox); + gtk_widget_reparent (widget, GTK_DIALOG (editor)->vbox); widget = glade_xml_get_widget (gui, "pixmap"); gnome_pixmap_load_file (GNOME_PIXMAP (widget), EVOLUTION_GLADEDIR "/flag-for-followup-48.png"); @@ -271,14 +267,12 @@ construct (MessageTagEditor *editor) e_date_edit_set_time (followup->target_date, (time_t) -1); followup->completed = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "completed")); - gtk_signal_connect (GTK_OBJECT (followup->completed), "toggled", - completed_toggled, followup); + g_signal_connect(followup->completed, "toggled", G_CALLBACK(completed_toggled), followup); followup->clear = GTK_BUTTON (glade_xml_get_widget (gui, "clear")); - gtk_signal_connect (GTK_OBJECT (followup->clear), "clicked", - clear_clicked, followup); + g_signal_connect(followup->clear, "clicked", G_CALLBACK(clear_clicked), followup); - gtk_object_unref (GTK_OBJECT (gui)); + g_object_unref((gui)); } MessageTagEditor * @@ -286,7 +280,7 @@ message_tag_followup_new (void) { MessageTagEditor *editor; - editor = (MessageTagEditor *) gtk_type_new (message_tag_followup_get_type ()); + editor = (MessageTagEditor *) g_object_new (message_tag_followup_get_type (), NULL); construct (editor); return editor; @@ -301,12 +295,9 @@ message_tag_followup_append_message (MessageTagFollowUp *editor, g_return_if_fail (IS_MESSAGE_TAG_FOLLOWUP (editor)); - text[0] = e_utf8_to_gtk_string (GTK_WIDGET (editor->message_list), from); - text[1] = e_utf8_to_gtk_string (GTK_WIDGET (editor->message_list), subject); + text[0] = (char *)from; + text[1] = (char *)subject; text[2] = NULL; gtk_clist_append (editor->message_list, text); - - g_free (text[0]); - g_free (text[1]); } diff --git a/mail/subscribe-dialog.c b/mail/subscribe-dialog.c index 37e58c0e4e..b4074df635 100644 --- a/mail/subscribe-dialog.c +++ b/mail/subscribe-dialog.c @@ -27,6 +27,8 @@ #include <config.h> #endif +#include <string.h> + #include <libgnomeui/gnome-app.h> #include <libgnomeui/gnome-appbar.h> @@ -269,7 +271,7 @@ get_short_folderinfo_free (struct _mail_msg *mm) struct _get_short_folderinfo_msg *m = (struct _get_short_folderinfo_msg *) mm; camel_store_free_folder_info (m->ftree->store, m->info); - gtk_object_unref (GTK_OBJECT (m->ftree)); + g_object_unref((m->ftree)); g_free (m->prefix); /* may be NULL but that's ok */ } @@ -293,13 +295,8 @@ subscribe_get_short_folderinfo (FolderETree *ftree, m = mail_msg_new (&get_short_folderinfo_op, NULL, sizeof(*m)); m->ftree = ftree; - gtk_object_ref (GTK_OBJECT (ftree)); - - if (prefix) - m->prefix = g_strdup (prefix); - else - m->prefix = NULL; - + g_object_ref((ftree)); + m->prefix = g_strdup (prefix); m->func = func; m->user_data = user_data; @@ -367,7 +364,7 @@ subscribe_folder_free (struct _mail_msg *mm) g_free (m->name); g_free (m->full_name); - camel_object_unref (CAMEL_OBJECT (m->store)); + camel_object_unref (m->store); } static struct _mail_msg_op subscribe_folder_op = { @@ -395,7 +392,7 @@ subscribe_do_subscribe_folder (CamelStore *store, const char *full_name, const c m->cb = cb; m->cb_data = cb_data; - camel_object_ref (CAMEL_OBJECT (store)); + camel_object_ref(store); id = m->msg.seq; e_thread_put (mail_thread_queued, (EMsg *)m); @@ -405,22 +402,22 @@ subscribe_do_subscribe_folder (CamelStore *store, const char *full_name, const c /* ** FolderETree Extras *************************************************** */ static void -fete_destroy (GtkObject *object) +fete_finalise (GObject *object) { FolderETreeExtras *extras = (FolderETreeExtras *) object; - gdk_pixbuf_unref (extras->toggles[0]); - gdk_pixbuf_unref (extras->toggles[1]); + g_object_unref (extras->toggles[0]); + g_object_unref (extras->toggles[1]); - ftree_extras_parent_class->destroy (object); + ((GObjectClass *)ftree_extras_parent_class)->finalize (object); } static void -fete_class_init (GtkObjectClass *object_class) +fete_class_init (GObjectClass *object_class) { - object_class->destroy = fete_destroy; + object_class->finalize = fete_finalise; - ftree_extras_parent_class = gtk_type_class (E_TABLE_EXTRAS_TYPE); + ftree_extras_parent_class = g_type_class_ref (E_TABLE_EXTRAS_TYPE); } static void @@ -465,7 +462,7 @@ E_MAKE_TYPE (fete, "FolderETreeExtras", FolderETreeExtras, fete_class_init, fete static FolderETreeExtras *global_extras = NULL; static void -global_extras_destroyed (GtkObject *obj, gpointer user_data) +global_extras_destroyed (void *user_data, GObject *obj) { global_extras = NULL; } @@ -474,14 +471,14 @@ static ETableExtras * subscribe_get_global_extras (void) { if (global_extras == NULL) { - global_extras = gtk_type_new (fete_get_type()); - gtk_object_ref (GTK_OBJECT (global_extras)); - gtk_object_sink (GTK_OBJECT (global_extras)); - gtk_signal_connect (GTK_OBJECT (global_extras), "destroy", - global_extras_destroyed, NULL); + global_extras = g_object_new (fete_get_type(), NULL); + g_object_ref(global_extras); + gtk_object_sink((GtkObject *)global_extras); + g_object_weak_ref(G_OBJECT(global_extras), global_extras_destroyed, NULL); + } else { + g_object_ref(global_extras); } - gtk_object_ref (GTK_OBJECT (global_extras)); return E_TABLE_EXTRAS (global_extras); } @@ -700,7 +697,8 @@ fe_sort_folder (ETreeMemory *etmm, ETreePath left, ETreePath right, gpointer use n_left = e_tree_memory_node_get_data (etmm, left); n_right = e_tree_memory_node_get_data (etmm, right); - return g_strcasecmp (ftree_node_get_name (n_left), ftree_node_get_name (n_right)); + /* TODO: not localised */ + return g_utf8_strcasecmp (ftree_node_get_name (n_left), ftree_node_get_name (n_right)); } /* scanning */ @@ -857,7 +855,7 @@ fe_kill_current_tree (FolderETree *ftree) } static void -fe_destroy (GtkObject *obj) +fe_finalise (GObject *obj) { FolderETree *ftree = (FolderETree *) (obj); @@ -869,24 +867,26 @@ fe_destroy (GtkObject *obj) g_hash_table_destroy (ftree->subscribe_ops); g_hash_table_destroy(ftree->node_full_name); - camel_object_unref (CAMEL_OBJECT (ftree->store)); + camel_object_unref (ftree->store); bonobo_object_unref (BONOBO_OBJECT (ftree->e_storage)); g_free (ftree->search); g_free (ftree->service_name); + + ((GObjectClass *)folder_etree_parent_class)->finalize(obj); } typedef gboolean (*bool_func_1) (ETreeModel *, ETreePath, int); typedef gboolean (*bool_func_2) (ETreeModel *); static void -folder_etree_class_init (GtkObjectClass *klass) +folder_etree_class_init (GObjectClass *klass) { ETreeModelClass *etree_model_class = E_TREE_MODEL_CLASS (klass); - folder_etree_parent_class = gtk_type_class (E_TREE_MEMORY_TYPE); + folder_etree_parent_class = g_type_class_ref (E_TREE_MEMORY_TYPE); - klass->destroy = fe_destroy; + klass->finalize = fe_finalise; etree_model_class->value_at = fe_value_at; etree_model_class->set_value_at = fe_set_value_at; @@ -928,7 +928,7 @@ folder_etree_construct (FolderETree *ftree, e_tree_memory_construct (E_TREE_MEMORY (ftree)); ftree->store = store; - camel_object_ref (CAMEL_OBJECT (store)); + camel_object_ref (store); ftree->service_name = camel_service_get_name (CAMEL_SERVICE (store), FALSE); @@ -954,7 +954,7 @@ folder_etree_new (CamelStore *store, { FolderETree *ftree; - ftree = gtk_type_new (folder_etree_get_type()); + ftree = g_object_new (folder_etree_get_type(), NULL); ftree = folder_etree_construct (ftree, store, activity_cb, activity_data); return ftree; } @@ -1075,13 +1075,13 @@ store_data_free (StoreData *sd) mail_msg_cancel (sd->request_id); if (sd->widget) - gtk_object_unref (GTK_OBJECT (sd->widget)); + g_object_unref(sd->widget); if (sd->ftree) - gtk_object_unref (GTK_OBJECT (sd->ftree)); + g_object_unref(sd->ftree); if (sd->store) - camel_object_unref (CAMEL_OBJECT (sd->store)); + camel_object_unref (sd->store); g_free (sd->uri); g_free (sd); @@ -1111,7 +1111,7 @@ sd_got_store (char *uri, CamelStore *store, gpointer user_data) sd->store = store; if (store) /* we can have exceptions getting the store... server is down, eg */ - camel_object_ref (CAMEL_OBJECT (sd->store)); + camel_object_ref (sd->store); /* uh, so we might have a problem if this operation is cancelled. Unsure. */ sd->request_id = 0; @@ -1188,13 +1188,13 @@ store_data_get_widget (StoreData *sd, EVOLUTION_ETSPECDIR "/subscribe-dialog.etspec", NULL); e_tree_root_node_set_visible (e_tree_scrolled_get_tree(E_TREE_SCROLLED(tree)), TRUE); - gtk_signal_connect (GTK_OBJECT (e_tree_scrolled_get_tree(E_TREE_SCROLLED (tree))), - "double_click", GTK_SIGNAL_FUNC (sd_toggle_cb), sd); + g_signal_connect(e_tree_scrolled_get_tree(E_TREE_SCROLLED (tree)), + "double_click", G_CALLBACK (sd_toggle_cb), sd); - gtk_object_unref (GTK_OBJECT (global_extras)); + g_object_unref(global_extras); sd->widget = tree; - gtk_object_ref (GTK_OBJECT (sd->widget)); + g_object_ref(sd->widget); return sd->widget; } @@ -1308,13 +1308,11 @@ sc_search_activated (GtkWidget *widget, gpointer user_data) { SubscribeDialog *sc = SUBSCRIBE_DIALOG (user_data); StoreData *store = sc->priv->current_store; - char *search; if (!store) return; - search = e_utf8_gtk_entry_get_text (GTK_ENTRY (widget)); - folder_etree_set_search (store->ftree, search); + folder_etree_set_search (store->ftree, gtk_entry_get_text (GTK_ENTRY (widget))); } static void @@ -1421,18 +1419,11 @@ sc_selection_changed (GtkObject *obj, gpointer user_data) gtk_widget_set_sensitive (sc->priv->unsub_button, sensitive); } -static gint +static gboolean sc_activity_timeout (SubscribeDialog *sc) { - GtkAdjustment *adj; - gfloat next; - - adj = GTK_PROGRESS (sc->priv->progress)->adjustment; - next = adj->value + 1; - if (next > adj->upper) - next = adj->lower; + gtk_progress_bar_pulse(GTK_PROGRESS_BAR(sc->priv->progress)); - gtk_progress_set_value (GTK_PROGRESS (sc->priv->progress), next); return TRUE; } @@ -1445,12 +1436,11 @@ sc_activity_cb (int level, SubscribeDialog *sc) if (sc->priv->activity_timeout_id) return; - sc->priv->activity_timeout_id = gtk_timeout_add (50, (GtkFunction) - sc_activity_timeout, sc); + sc->priv->activity_timeout_id = g_timeout_add(50, (GSourceFunc)sc_activity_timeout, sc); gnome_appbar_set_status (GNOME_APPBAR (sc->priv->appbar), _("Scanning folders...")); } else { if (sc->priv->activity_timeout_id) { - gtk_timeout_remove (sc->priv->activity_timeout_id); + g_source_remove (sc->priv->activity_timeout_id); sc->priv->activity_timeout_id = 0; } @@ -1476,7 +1466,7 @@ menu_item_selected (GtkMenuItem *item, gpointer user_data) tree = e_tree_scrolled_get_tree (E_TREE_SCROLLED (widget)); esm = e_tree_get_selection_model (tree); - gtk_signal_connect (GTK_OBJECT (esm), "selection_changed", sc_selection_changed, sc); + g_signal_connect(esm, "selection_changed", G_CALLBACK(sc_selection_changed), sc); sc_selection_changed ((GtkObject *)esm, sc); } @@ -1489,10 +1479,10 @@ menu_item_selected (GtkMenuItem *item, gpointer user_data) sc->priv->current_store = sd; if (*sd->ftree->search) { - e_utf8_gtk_entry_set_text (GTK_ENTRY (sc->priv->search_entry), sd->ftree->search); + gtk_entry_set_text (GTK_ENTRY (sc->priv->search_entry), sd->ftree->search); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sc->priv->filter_radio), TRUE); } else { - e_utf8_gtk_entry_set_text (GTK_ENTRY (sc->priv->search_entry), ""); + gtk_entry_set_text (GTK_ENTRY (sc->priv->search_entry), ""); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sc->priv->all_radio), TRUE); } } @@ -1507,7 +1497,7 @@ dummy_item_selected (GtkMenuItem *item, gpointer user_data) sc->priv->current_widget = sc->priv->default_widget; sc->priv->current_store = NULL; - e_utf8_gtk_entry_set_text (GTK_ENTRY (sc->priv->search_entry), ""); + gtk_entry_set_text (GTK_ENTRY (sc->priv->search_entry), ""); } /* wonderful */ @@ -1548,14 +1538,14 @@ populate_store_list (SubscribeDialog *sc) item = gtk_menu_item_new_with_label (string); store_data_async_get_store (iter->data, got_sd_store, item); gtk_object_set_data (GTK_OBJECT (item), STORE_DATA_KEY, iter->data); - gtk_signal_connect (GTK_OBJECT (item), "activate", menu_item_selected, sc); + g_signal_connect(item, "activate", G_CALLBACK(menu_item_selected), sc); g_free (string); - gtk_menu_prepend (GTK_MENU (menu), item); + gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), item); } sc->priv->none_item = gtk_menu_item_new_with_label (_("No server has been selected")); - gtk_signal_connect (GTK_OBJECT (sc->priv->none_item), "activate", dummy_item_selected, sc); + g_signal_connect(sc->priv->none_item, "activate", G_CALLBACK(dummy_item_selected), sc); gtk_widget_show (sc->priv->none_item); gtk_menu_prepend (GTK_MENU (menu), sc->priv->none_item); @@ -1573,25 +1563,36 @@ subscribe_dialog_destroy (GtkObject *object) sc = SUBSCRIBE_DIALOG (object); - if (sc->priv->activity_timeout_id) - gtk_timeout_remove (sc->priv->activity_timeout_id); + if (sc->priv) { + if (sc->priv->activity_timeout_id) { + g_source_remove (sc->priv->activity_timeout_id); + sc->priv->activity_timeout_id = 0; + } - for (iter = sc->priv->store_list; iter; iter = iter->next) { - StoreData *data = iter->data; - - if (store_data_mid_request (data)) - store_data_cancel_get_store (data); + if (sc->priv->store_list) { + for (iter = sc->priv->store_list; iter; iter = iter->next) { + StoreData *data = iter->data; - data->store_func = NULL; + if (store_data_mid_request (data)) + store_data_cancel_get_store (data); + + data->store_func = NULL; + + store_data_unref (data); + } - store_data_unref (data); - } - - g_list_free (sc->priv->store_list); - - gtk_object_unref (GTK_OBJECT (sc->priv->xml)); + g_list_free (sc->priv->store_list); + sc->priv->store_list = NULL; + } - g_free (sc->priv); + if (sc->priv->xml) { + g_object_unref(sc->priv->xml); + sc->priv->xml = NULL; + } + + g_free (sc->priv); + sc->priv = NULL; + } subscribe_dialog_parent_class->destroy (object); } @@ -1601,7 +1602,7 @@ subscribe_dialog_class_init (GtkObjectClass *object_class) { object_class->destroy = subscribe_dialog_destroy; - subscribe_dialog_parent_class = gtk_type_class (PARENT_TYPE); + subscribe_dialog_parent_class = g_type_class_ref (PARENT_TYPE); } static void @@ -1635,7 +1636,7 @@ subscribe_dialog_construct (GtkObject *object) /* Load the XML */ /* "app2" */ - sc->priv->xml = glade_xml_new (EVOLUTION_GLADEDIR "/subscribe-dialog.glade", "app"); + sc->priv->xml = glade_xml_new (EVOLUTION_GLADEDIR "/subscribe-dialog.glade", "app", NULL); sc->app = glade_xml_get_widget (sc->priv->xml, "app"); sc->priv->hbox = glade_xml_get_widget (sc->priv->xml, "tree_box"); @@ -1663,18 +1664,16 @@ subscribe_dialog_construct (GtkObject *object) gtk_widget_set_sensitive (sc->priv->refresh_button, FALSE); /* hook up some signals */ - gtk_signal_connect (GTK_OBJECT (sc->priv->search_entry), "activate", sc_search_activated, sc); - gtk_signal_connect (GTK_OBJECT (sc->priv->close_button), "clicked", sc_close_pressed, sc); - gtk_signal_connect (GTK_OBJECT (sc->priv->sub_button), "clicked", sc_subscribe_pressed, sc); - gtk_signal_connect (GTK_OBJECT (sc->priv->unsub_button), "clicked", sc_unsubscribe_pressed, sc); - gtk_signal_connect (GTK_OBJECT (sc->priv->refresh_button), "clicked", sc_refresh_pressed, sc); - gtk_signal_connect (GTK_OBJECT (sc->priv->all_radio), "toggled", sc_all_toggled, sc); - gtk_signal_connect (GTK_OBJECT (sc->priv->filter_radio), "toggled", sc_filter_toggled, sc); + g_signal_connect(sc->priv->search_entry, "activate", G_CALLBACK(sc_search_activated), sc); + g_signal_connect(sc->priv->close_button, "clicked", G_CALLBACK(sc_close_pressed), sc); + g_signal_connect(sc->priv->sub_button, "clicked", G_CALLBACK(sc_subscribe_pressed), sc); + g_signal_connect(sc->priv->unsub_button, "clicked", G_CALLBACK(sc_unsubscribe_pressed), sc); + g_signal_connect(sc->priv->refresh_button, "clicked", G_CALLBACK(sc_refresh_pressed), sc); + g_signal_connect(sc->priv->all_radio, "toggled", G_CALLBACK(sc_all_toggled), sc); + g_signal_connect(sc->priv->filter_radio, "toggled", G_CALLBACK(sc_filter_toggled), sc); /* progress */ - gtk_progress_set_activity_mode (GTK_PROGRESS (sc->priv->progress), 1); - gtk_progress_bar_set_activity_step (GTK_PROGRESS_BAR (sc->priv->progress), 5); - gtk_progress_bar_set_activity_blocks (GTK_PROGRESS_BAR (sc->priv->progress), 10); + gtk_progress_bar_set_pulse_step(GTK_PROGRESS_BAR(sc->priv->progress), 0.1); /* Get the list of stores */ populate_store_list (sc); @@ -1685,7 +1684,7 @@ subscribe_dialog_new (void) { SubscribeDialog *subscribe_dialog; - subscribe_dialog = gtk_type_new (SUBSCRIBE_DIALOG_TYPE); + subscribe_dialog = g_object_new (SUBSCRIBE_DIALOG_TYPE, NULL); subscribe_dialog_construct (GTK_OBJECT (subscribe_dialog)); return GTK_OBJECT (subscribe_dialog); diff --git a/mail/subscribe-dialog.h b/mail/subscribe-dialog.h index 2acd34221d..537a4d73ce 100644 --- a/mail/subscribe-dialog.h +++ b/mail/subscribe-dialog.h @@ -49,7 +49,6 @@ struct _SubscribeDialog { SubscribeDialogPrivate *priv; }; - typedef struct { GtkObjectClass parent_class; } SubscribeDialogClass; |