aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--addressbook/ChangeLog11
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c9
-rw-r--r--addressbook/gui/widgets/eab-contact-display.c46
-rw-r--r--addressbook/gui/widgets/eab-contact-display.h5
-rw-r--r--addressbook/gui/widgets/eab-vcard-control.c33
5 files changed, 53 insertions, 51 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index a0dd8523a0..c19963f7a8 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,14 @@
+2004-07-19 Radek Doulik <rodo@ximian.com>
+
+ * gui/widgets/eab-vcard-control.c (eab_vcard_control_new): but
+ buttons to button box, use vbox instead of table
+
+ * gui/widgets/eab-contact-display.c: base this widget directly on
+ gtkhtml
+
+ * gui/widgets/e-addressbook-view.c (eab_view_new): put contact
+ display in scrolled window
+
2004-07-20 Not Zed <NotZed@Ximian.com>
* gui/widgets/eab-contact-display.c:
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index 907309348a..fc74e340cb 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -414,6 +414,7 @@ GtkWidget*
eab_view_new (void)
{
GtkWidget *widget = GTK_WIDGET (g_object_new (E_TYPE_AB_VIEW, NULL));
+ GtkWidget *scrolled_window;
EABView *eav = EAB_VIEW (widget);
FilterPart *part;
@@ -480,9 +481,13 @@ eab_view_new (void)
gtk_widget_show (eav->widget);
eav->contact_display = eab_contact_display_new ();
- gtk_container_add (GTK_CONTAINER (eav->paned), eav->contact_display);
+ scrolled_window = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN);
+ gtk_container_add (GTK_CONTAINER (scrolled_window), eav->contact_display);
+ gtk_container_add (GTK_CONTAINER (eav->paned), scrolled_window);
gtk_widget_show (eav->contact_display);
-
+ gtk_widget_show (scrolled_window);
gtk_widget_show (eav->paned);
/* gtk selection crap */
diff --git a/addressbook/gui/widgets/eab-contact-display.c b/addressbook/gui/widgets/eab-contact-display.c
index 001ab99bf4..fc9cff11a4 100644
--- a/addressbook/gui/widgets/eab-contact-display.c
+++ b/addressbook/gui/widgets/eab-contact-display.c
@@ -35,14 +35,12 @@
#include <libgnome/gnome-url.h>
#include <gtkhtml/gtkhtml.h>
#include <gtkhtml/gtkhtml-stream.h>
-#include <gtk/gtkscrolledwindow.h>
/*#define HANDLE_MAILTO_INTERNALLY 1*/
-#define PARENT_TYPE (gtk_vbox_get_type ())
+#define PARENT_TYPE (GTK_TYPE_HTML)
struct _EABContactDisplayPrivate {
- GtkHTML *html;
EContact *contact;
};
@@ -394,7 +392,7 @@ eab_contact_display_render_normal (EABContactDisplay *display, EContact *contact
if (display->priv->contact)
g_object_ref (display->priv->contact);
- html_stream = gtk_html_begin (display->priv->html);
+ html_stream = gtk_html_begin (GTK_HTML (display));
gtk_html_stream_write (html_stream, HTML_HEADER, sizeof (HTML_HEADER) - 1);
gtk_html_stream_write (html_stream, "<body>\n", 7);
@@ -433,7 +431,7 @@ eab_contact_display_render_normal (EABContactDisplay *display, EContact *contact
}
gtk_html_stream_write (html_stream, "</body></html>\n", 15);
- gtk_html_end (display->priv->html, html_stream, GTK_HTML_STREAM_OK);
+ gtk_html_end (GTK_HTML (display), html_stream, GTK_HTML_STREAM_OK);
}
static void
@@ -447,7 +445,7 @@ eab_contact_display_render_compact (EABContactDisplay *display, EContact *contac
if (display->priv->contact)
g_object_ref (display->priv->contact);
- html_stream = gtk_html_begin (display->priv->html);
+ html_stream = gtk_html_begin (GTK_HTML (display));
gtk_html_stream_write (html_stream, HTML_HEADER, sizeof (HTML_HEADER) - 1);
gtk_html_stream_write (html_stream, "<body>\n", 7);
@@ -589,7 +587,7 @@ eab_contact_display_render_compact (EABContactDisplay *display, EContact *contac
}
gtk_html_stream_write (html_stream, "</body></html>\n", 15);
- gtk_html_end (display->priv->html, html_stream, GTK_HTML_STREAM_OK);
+ gtk_html_end (GTK_HTML (display), html_stream, GTK_HTML_STREAM_OK);
}
void
@@ -610,51 +608,37 @@ GtkWidget*
eab_contact_display_new (void)
{
EABContactDisplay *display;
- GtkWidget *scrolled_window;
display = g_object_new (EAB_TYPE_CONTACT_DISPLAY, NULL);
display->priv = g_new0 (EABContactDisplayPrivate, 1);
- scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN);
-
- display->priv->html = GTK_HTML (gtk_html_new ());
-
- gtk_html_set_default_content_type (display->priv->html, "text/html; charset=utf-8");
+ gtk_html_set_default_content_type (GTK_HTML (display), "text/html; charset=utf-8");
- gtk_html_set_editable (display->priv->html, FALSE);
+ gtk_html_set_editable (GTK_HTML (display), FALSE);
- g_signal_connect (display->priv->html, "url_requested",
+ g_signal_connect (display, "url_requested",
G_CALLBACK (on_url_requested),
display);
- g_signal_connect (display->priv->html, "link_clicked",
+ g_signal_connect (display, "link_clicked",
G_CALLBACK (on_link_clicked),
display);
#if 0
- g_signal_connect (display->priv->html, "object_requested",
+ g_signal_connect (display, "object_requested",
G_CALLBACK (on_object_requested),
mail_display);
- g_signal_connect (display->priv->html, "button_press_event",
+ g_signal_connect (display, "button_press_event",
G_CALLBACK (html_button_press_event), mail_display);
- g_signal_connect (display->priv->html, "motion_notify_event",
+ g_signal_connect (display, "motion_notify_event",
G_CALLBACK (html_motion_notify_event), mail_display);
- g_signal_connect (display->priv->html, "enter_notify_event",
+ g_signal_connect (display, "enter_notify_event",
G_CALLBACK (html_enter_notify_event), mail_display);
- g_signal_connect (display->priv->html, "iframe_created",
+ g_signal_connect (display, "iframe_created",
G_CALLBACK (html_iframe_created), mail_display);
- g_signal_connect (display->priv->html, "on_url",
+ g_signal_connect (display, "on_url",
G_CALLBACK (html_on_url), mail_display);
#endif
- gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET (display->priv->html));
-
- gtk_box_pack_start_defaults (GTK_BOX (display), scrolled_window);
- gtk_widget_show_all (scrolled_window);
-
return GTK_WIDGET (display);
}
diff --git a/addressbook/gui/widgets/eab-contact-display.h b/addressbook/gui/widgets/eab-contact-display.h
index e7f47031ce..08c3936cad 100644
--- a/addressbook/gui/widgets/eab-contact-display.h
+++ b/addressbook/gui/widgets/eab-contact-display.h
@@ -23,7 +23,6 @@
#ifndef _EAB_CONTACT_DISPLAY_H_
#define _EAB_CONTACT_DISPLAY_H_
-#include <gtk/gtkvbox.h>
#include <gtkhtml/gtkhtml.h>
#include <libebook/e-contact.h>
@@ -43,13 +42,13 @@ typedef enum {
} EABContactDisplayRenderMode;
struct _EABContactDisplay {
- GtkVBox parent;
+ GtkHTML parent;
EABContactDisplayPrivate *priv;
};
struct _EABContactDisplayClass {
- GtkVBoxClass parent_class;
+ GtkHTMLClass parent_class;
};
GtkType eab_contact_display_get_type (void);
diff --git a/addressbook/gui/widgets/eab-vcard-control.c b/addressbook/gui/widgets/eab-vcard-control.c
index 239abe5e1c..3e2cdddcc9 100644
--- a/addressbook/gui/widgets/eab-vcard-control.c
+++ b/addressbook/gui/widgets/eab-vcard-control.c
@@ -247,8 +247,8 @@ eab_vcard_control_new (void)
BonoboPersistStream *stream;
GtkWidget *display;
GtkWidget *button1, *button2;
- GtkWidget *label;
- GtkWidget *table;
+ GtkWidget *bbox;
+ GtkWidget *vbox;
EABVCardControl *vcard_control = g_new (EABVCardControl, 1);
@@ -263,31 +263,34 @@ eab_vcard_control_new (void)
/* Create the control. */
display = eab_contact_display_new ();
- gtk_widget_show (display);
vcard_control->display = EAB_CONTACT_DISPLAY (display);
- /* This is intentionally not shown. */
- label = gtk_label_new ("");
- vcard_control->label = label;
+ bbox = gtk_hbutton_box_new ();
+ gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_START);
+ gtk_box_set_spacing (GTK_BOX (bbox), 12);
button1 = gtk_button_new_with_label(_("Show Full VCard"));
g_signal_connect (button1, "clicked",
G_CALLBACK (toggle_full_vcard), vcard_control);
- gtk_widget_show (button1);
+ gtk_box_pack_start (GTK_BOX (bbox), button1, FALSE, FALSE, 0);
button2 = gtk_button_new_with_label(_("Save in addressbook"));
g_signal_connect (button2, "clicked",
G_CALLBACK (save_in_addressbook), vcard_control);
- gtk_widget_show (button2);
+ gtk_box_pack_start (GTK_BOX (bbox), button2, FALSE, FALSE, 0);
- table = gtk_table_new (6, 6, FALSE);
- gtk_table_attach (GTK_TABLE (table), display, 0, 6, 3, 6, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_table_attach (GTK_TABLE (table), label, 0, 3, 2, 3, GTK_FILL, 0, 0, 0);
- gtk_table_attach (GTK_TABLE (table), button1, 0, 1, 1, 2, 0, 0, 0, 0);
- gtk_table_attach (GTK_TABLE (table), button2, 1, 2, 1, 2, 0, 0, 0, 0);
- gtk_widget_show (table);
+ /* This is intentionally not shown. */
+ vcard_control->label = gtk_label_new ("");
+
+ vbox = gtk_vbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), display, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), vcard_control->label, TRUE, TRUE, 0);
+ gtk_widget_show_all (bbox);
+ gtk_widget_show (display);
+ gtk_widget_show (vbox);
- control = bonobo_control_new (table);
+ control = bonobo_control_new (vbox);
g_object_weak_ref (G_OBJECT (control), free_struct, vcard_control);