diff options
author | Jason Leach <jleach@ximian.com> | 2001-06-06 01:42:42 +0800 |
---|---|---|
committer | Jacob Leach <jleach@src.gnome.org> | 2001-06-06 01:42:42 +0800 |
commit | ce23de3eeb67e8140f67f056644223f6c9cdb44a (patch) | |
tree | f8c382b7a2d855d7f75d0bbb791d31ec0ac90c82 /mail | |
parent | 8f366de2a4fb5c5bddab80667a821c1acee91c21 (diff) | |
download | gsoc2013-evolution-ce23de3eeb67e8140f67f056644223f6c9cdb44a.tar.gz gsoc2013-evolution-ce23de3eeb67e8140f67f056644223f6c9cdb44a.tar.zst gsoc2013-evolution-ce23de3eeb67e8140f67f056644223f6c9cdb44a.zip |
(Fix bug #314: Display URLs in statusbar on mouseover)
2001-06-05 Jason Leach <jleach@ximian.com>
(Fix bug #314: Display URLs in statusbar on mouseover)
* mail-display.c (html_on_url): New function, callback for
GtkHTML's "on_url" signal.
svn path=/trunk/; revision=10117
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 7 | ||||
-rw-r--r-- | mail/mail-display.c | 92 |
2 files changed, 98 insertions, 1 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 950824bdbb..5f00dd6cec 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,10 @@ +2001-06-05 Jason Leach <jleach@ximian.com> + + (Fix bug #314: Display URLs in statusbar on mouseover) + + * mail-display.c (html_on_url): New function, callback for + GtkHTML's "on_url" signal. + 2001-06-05 Radek Doulik <rodo@ximian.com> * mail-format.c: make HTML and plain mails to have the same diff --git a/mail/mail-display.c b/mail/mail-display.c index dd50e4d4cd..1025b0af7c 100644 --- a/mail/mail-display.c +++ b/mail/mail-display.c @@ -905,7 +905,7 @@ ebook_callback (EBook *book, const gchar *addr, ECard *card, gpointer data) static void on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle, - gpointer user_data) + gpointer user_data) { MailDisplay *md = user_data; GHashTable *urls; @@ -1577,6 +1577,93 @@ html_iframe_created (GtkWidget *w, GtkHTML *iframe, MailDisplay *mail_display) GTK_SIGNAL_FUNC (html_enter_notify_event), mail_display); } +static GNOME_Evolution_ShellView +retrieve_shell_view_interface_from_control (BonoboControl *control) +{ + Bonobo_ControlFrame control_frame; + GNOME_Evolution_ShellView shell_view_interface; + CORBA_Environment ev; + + control_frame = bonobo_control_get_control_frame (control); + + if (control_frame == NULL) + return CORBA_OBJECT_NIL; + + CORBA_exception_init (&ev); + shell_view_interface = Bonobo_Unknown_queryInterface (control_frame, + "IDL:GNOME/Evolution/ShellView:1.0", + &ev); + 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); + else + g_warning ("Control frame doesn't have Evolution/ShellView."); + + return shell_view_interface; +} + +static void +set_status_message (const char *message, int busy) +{ + EList *controls; + EIterator *it; + + controls = folder_browser_factory_get_control_list (); + for (it = e_list_get_iterator (controls); e_iterator_is_valid (it); e_iterator_next (it)) { + BonoboControl *control; + GNOME_Evolution_ShellView shell_view_interface; + CORBA_Environment ev; + + control = BONOBO_CONTROL (e_iterator_get (it)); + + shell_view_interface = gtk_object_get_data (GTK_OBJECT (control), "mail_threads_shell_view_interface"); + + if (shell_view_interface == CORBA_OBJECT_NIL) + shell_view_interface = retrieve_shell_view_interface_from_control (control); + + CORBA_exception_init (&ev); + + if (shell_view_interface != CORBA_OBJECT_NIL) { + + if (message != NULL) + GNOME_Evolution_ShellView_setMessage (shell_view_interface, + message[0] ? message: "", + busy, + &ev); + } + + CORBA_exception_free (&ev); + + /* yeah we only set the first one. Why? Because it seems to leave + random ones lying around otherwise. Shrug. */ + break; + } + gtk_object_unref (GTK_OBJECT(it)); +} + +/* For now show every url but possibly limit it to showing only http: + or ftp: urls */ +static void +html_on_url (GtkHTML *html, + const char *url, + MailDisplay *mail_display) +{ + static char *previous_url = NULL; + + /* This all looks silly but yes, this is the proper way to mix + GtkHTML's on_url with BonoboUIComponent statusbar */ + if (!url || (previous_url && (strcmp (url, previous_url) != 0))) + set_status_message ("", FALSE); + if (url) { + set_status_message (url, FALSE); + g_free (previous_url); + previous_url = g_strdup (url); + } +} + GtkWidget * mail_display_new (void) { @@ -1617,6 +1704,9 @@ mail_display_new (void) 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); + #if 0 gtk_selection_add_target (GTK_WIDGET(html), GDK_SELECTION_PRIMARY, |