aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-09-07 07:23:57 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-09-09 02:53:45 +0800
commitfa9051e04051156a9e11e2af72a0d7342f4ea2e4 (patch)
tree0d064bddb366257c660722359dc33f5ef3c610c7 /addressbook/gui
parentc9e7aa7aee6b407659843131cc8becdafa71992a (diff)
downloadgsoc2013-evolution-fa9051e04051156a9e11e2af72a0d7342f4ea2e4.tar.gz
gsoc2013-evolution-fa9051e04051156a9e11e2af72a0d7342f4ea2e4.tar.zst
gsoc2013-evolution-fa9051e04051156a9e11e2af72a0d7342f4ea2e4.zip
Finish killing Bonobo.
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/merging/Makefile.am1
-rw-r--r--addressbook/gui/widgets/Makefile.am2
-rw-r--r--addressbook/gui/widgets/eab-contact-display.c157
-rw-r--r--addressbook/gui/widgets/eab-contact-display.h6
4 files changed, 90 insertions, 76 deletions
diff --git a/addressbook/gui/merging/Makefile.am b/addressbook/gui/merging/Makefile.am
index fd13c9779e..e399c19747 100644
--- a/addressbook/gui/merging/Makefile.am
+++ b/addressbook/gui/merging/Makefile.am
@@ -2,6 +2,7 @@ AM_CPPFLAGS = \
-DG_LOG_DOMAIN=\"eab-contact-merging\" \
-DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
-I$(top_srcdir) \
+ -I$(top_srcdir)/widgets \
-I$(top_srcdir)/addressbook \
$(EVOLUTION_ADDRESSBOOK_CFLAGS)
diff --git a/addressbook/gui/widgets/Makefile.am b/addressbook/gui/widgets/Makefile.am
index 58d1e1b1d1..b642fde5c2 100644
--- a/addressbook/gui/widgets/Makefile.am
+++ b/addressbook/gui/widgets/Makefile.am
@@ -1,7 +1,7 @@
ruledir = $(privdatadir)
rule_DATA = addresstypes.xml
-AM_CPPFLAGS = \
+AM_CPPFLAGS = \
-DG_LOG_DOMAIN=\"eab-widgets\" \
-DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
-DEVOLUTION_GALVIEWSDIR=\""$(viewsdir)"\" \
diff --git a/addressbook/gui/widgets/eab-contact-display.c b/addressbook/gui/widgets/eab-contact-display.c
index d47b3e1866..0ade284323 100644
--- a/addressbook/gui/widgets/eab-contact-display.c
+++ b/addressbook/gui/widgets/eab-contact-display.c
@@ -240,71 +240,6 @@ contact_display_selection_clear_event (EABContactDisplay *display,
}
static void
-contact_display_on_url_requested (GtkHTML *html,
- const gchar *url,
- GtkHTMLStream *handle,
- EABContactDisplay *display)
-{
- if (!strcmp (url, "internal-contact-photo:")) {
- EContactPhoto *photo;
-
- photo = e_contact_get (display->priv->contact, E_CONTACT_PHOTO);
- if (!photo)
- photo = e_contact_get (display->priv->contact, E_CONTACT_LOGO);
-
- gtk_html_stream_write (handle, (gchar *)photo->data.inlined.data, photo->data.inlined.length);
-
- gtk_html_end (html, handle, GTK_HTML_STREAM_OK);
-
- e_contact_photo_free (photo);
- }
- else if (!strncmp (url, "evo-icon:", strlen ("evo-icon:"))) {
- gchar *data;
- gsize data_length;
- gchar *filename;
-
- filename = e_icon_factory_get_icon_filename (url + strlen ("evo-icon:"), GTK_ICON_SIZE_MENU);
- if (g_file_get_contents (filename, &data, &data_length, NULL)) {
- gtk_html_stream_write (handle, data, data_length);
- g_free (data);
- }
-
- gtk_html_stream_close (handle, GTK_HTML_STREAM_OK);
-
- g_free (filename);
- }
-}
-
-static void
-contact_display_on_link_clicked (GtkHTML *html,
- const gchar *uri,
- EABContactDisplay *display)
-{
-#ifdef HANDLE_MAILTO_INTERNALLY
- if (!strncmp (uri, "internal-mailto:", strlen ("internal-mailto:"))) {
- EDestination *destination;
- EContact *contact;
- gint email_num;
-
- email_num = atoi (uri + strlen ("internal-mailto:"));
- if (email_num == -1)
- return;
-
- destination = e_destination_new ();
- contact = eab_contact_display_get_contact (display);
- e_destination_set_contact (destination, contact, email_num);
- g_signal_emit (display, signals[SEND_MESSAGE], 0, destination);
- g_object_unref (destination);
-
- return;
- }
-#endif
-
- /* FIXME Pass a parent window. */
- e_show_uri (NULL, uri);
-}
-
-static void
render_name_value (GtkHTMLStream *html_stream, const gchar *label, const gchar *str, const gchar *icon, guint html_flags)
{
gchar *value = e_text_to_html (str, html_flags);
@@ -1033,9 +968,89 @@ contact_display_finalize (GObject *object)
}
static void
+contact_display_url_requested (GtkHTML *html,
+ const gchar *url,
+ GtkHTMLStream *handle)
+{
+ EABContactDisplayPrivate *priv;
+
+ priv = EAB_CONTACT_DISPLAY_GET_PRIVATE (html);
+
+ if (strcmp (url, "internal-contact-photo:") == 0) {
+ EContactPhoto *photo;
+
+ photo = e_contact_get (priv->contact, E_CONTACT_PHOTO);
+ if (!photo)
+ photo = e_contact_get (priv->contact, E_CONTACT_LOGO);
+
+ gtk_html_stream_write (handle, (gchar *)photo->data.inlined.data, photo->data.inlined.length);
+
+ gtk_html_end (html, handle, GTK_HTML_STREAM_OK);
+
+ e_contact_photo_free (photo);
+
+ return;
+ }
+
+ if (strncmp (url, "evo-icon:", strlen ("evo-icon:")) == 0) {
+ gchar *data;
+ gsize data_length;
+ gchar *filename;
+
+ filename = e_icon_factory_get_icon_filename (url + strlen ("evo-icon:"), GTK_ICON_SIZE_MENU);
+ if (g_file_get_contents (filename, &data, &data_length, NULL)) {
+ gtk_html_stream_write (handle, data, data_length);
+ g_free (data);
+ }
+
+ gtk_html_stream_close (handle, GTK_HTML_STREAM_OK);
+
+ g_free (filename);
+
+ return;
+ }
+
+ /* Chain up to parent's url_requested() method. */
+ GTK_HTML_CLASS (parent_class)->url_requested (html, url, handle);
+}
+
+static void
+contact_display_link_clicked (GtkHTML *html,
+ const gchar *uri)
+{
+ EABContactDisplay *display;
+
+ display = EAB_CONTACT_DISPLAY (html);
+
+#ifdef HANDLE_MAILTO_INTERNALLY
+ if (!strncmp (uri, "internal-mailto:", strlen ("internal-mailto:"))) {
+ EDestination *destination;
+ EContact *contact;
+ gint email_num;
+
+ email_num = atoi (uri + strlen ("internal-mailto:"));
+ if (email_num == -1)
+ return;
+
+ destination = e_destination_new ();
+ contact = eab_contact_display_get_contact (display);
+ e_destination_set_contact (destination, contact, email_num);
+ g_signal_emit (display, signals[SEND_MESSAGE], 0, destination);
+ g_object_unref (destination);
+
+ return;
+ }
+#endif
+
+ /* Chain up to parent's link_clicked() method. */
+ GTK_HTML_CLASS (parent_class)->link_clicked (html, uri);
+}
+
+static void
eab_contact_display_class_init (EABContactDisplayClass *class)
{
GObjectClass *object_class;
+ GtkHTMLClass *html_class;
parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EABContactDisplayPrivate));
@@ -1046,6 +1061,10 @@ eab_contact_display_class_init (EABContactDisplayClass *class)
object_class->dispose = contact_display_dispose;
object_class->finalize = contact_display_finalize;
+ html_class = GTK_HTML_CLASS (class);
+ html_class->url_requested = contact_display_url_requested;
+ html_class->link_clicked = contact_display_link_clicked;
+
g_object_class_install_property (
object_class,
PROP_CONTACT,
@@ -1123,12 +1142,6 @@ eab_contact_display_init (EABContactDisplay *display)
gtk_html_set_default_content_type (html, "text/html; charset=utf-8");
g_signal_connect (
- display, "url-requested",
- G_CALLBACK (contact_display_on_url_requested), display);
- g_signal_connect (
- display, "link-clicked",
- G_CALLBACK (contact_display_on_link_clicked), display);
- g_signal_connect (
display, "button-press-event",
G_CALLBACK (contact_display_button_press_event), display);
@@ -1170,7 +1183,7 @@ eab_contact_display_get_type (void)
};
type = g_type_register_static (
- GTK_TYPE_HTML, "EABContactDisplay", &type_info, 0);
+ E_TYPE_WEB_VIEW, "EABContactDisplay", &type_info, 0);
}
return type;
diff --git a/addressbook/gui/widgets/eab-contact-display.h b/addressbook/gui/widgets/eab-contact-display.h
index 5a6902fc20..7b9707e0af 100644
--- a/addressbook/gui/widgets/eab-contact-display.h
+++ b/addressbook/gui/widgets/eab-contact-display.h
@@ -23,9 +23,9 @@
#ifndef EAB_CONTACT_DISPLAY_H
#define EAB_CONTACT_DISPLAY_H
-#include <gtkhtml/gtkhtml.h>
#include <libebook/e-contact.h>
#include <libebook/e-destination.h>
+#include <misc/e-web-view.h>
/* Standard GObject macros */
#define EAB_TYPE_CONTACT_DISPLAY \
@@ -58,12 +58,12 @@ typedef enum {
} EABContactDisplayMode;
struct _EABContactDisplay {
- GtkHTML parent;
+ EWebView parent;
EABContactDisplayPrivate *priv;
};
struct _EABContactDisplayClass {
- GtkHTMLClass parent_class;
+ EWebViewClass parent_class;
/* Signals */
void (*send_message) (EABContactDisplay *display,