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/mail-display.c | |
parent | 83f816df158441ca750b0bc12b7ccab2d43c0e43 (diff) | |
download | gsoc2013-evolution-f9804e11931411358ce98ad5a7726de6d68f2115.tar.gz 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/mail-display.c')
-rw-r--r-- | mail/mail-display.c | 553 |
1 files changed, 263 insertions, 290 deletions
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"; } |