47878df8fe273d42a5f3756cb9d484681c2e027d
diff --git a/ChangeLog b/ChangeLog
index be4cad6..6b81fe9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-11-30  Jonathon Jongsma  <jjongsma@gnome.org>
+
+	* src/gtkhex.c:
+	* src/gtkhex.h: connect to the HexDocument's document_changed signal and
+	redraw the widget so that the display gets updated when modifying the data
+	with hex_document_set_data().  Fix for bug #500358
+
 2007-12-09  Rodney Dawes  <dobey.pwns@gmail.com>
 
 	* configure.in: Update version to 2.20.1 for release
diff --git a/src/gtkhex.c b/src/gtkhex.c
index 1930c87..804659f 100644
--- a/src/gtkhex.c
+++ b/src/gtkhex.c
@@ -1208,6 +1208,10 @@ static void gtk_hex_real_data_changed(GtkHex *gh, gpointer data) {
 
 	render_hex_lines(gh, start_line, end_line);
 	render_ascii_lines(gh, start_line, end_line);
+    if (gh->show_offsets)
+    {
+        render_offsets (gh, start_line, end_line);
+    }
 }
 
 static void bytes_changed(GtkHex *gh, gint start, gint end)
@@ -1223,6 +1227,10 @@ static void bytes_changed(GtkHex *gh, gint start, gint end)
 
 	render_hex_lines(gh, start_line, end_line);
 	render_ascii_lines(gh, start_line, end_line);
+    if (gh->show_offsets)
+    {
+        render_offsets (gh, start_line, end_line);
+    }
 }
 
 static void primary_get_cb(GtkClipboard *clipboard,
@@ -1847,6 +1855,13 @@ static gint gtk_hex_expose(GtkWidget *w, GdkEventExpose *event) {
 	return TRUE;
 }
 
+static void gtk_hex_document_changed(HexDocument* doc, gpointer change_data,
+        gboolean push_undo, gpointer data)
+{
+    gtk_hex_real_data_changed (GTK_HEX(data), change_data);
+}
+
+
 static void gtk_hex_size_request(GtkWidget *w, GtkRequisition *req) {
 	GtkHex *gh = GTK_HEX(w);
 	GtkRequisition sb_req;
@@ -2060,6 +2075,8 @@ GtkWidget *gtk_hex_new(HexDocument *owner) {
 	g_return_val_if_fail (gh != NULL, NULL);
 
 	gh->document = owner;
+    g_signal_connect (G_OBJECT (gh->document), "document_changed",
+            G_CALLBACK (gtk_hex_document_changed), gh);
 	
 	return GTK_WIDGET(gh);
 }
@@ -2237,7 +2254,7 @@ void gtk_hex_set_group_type(GtkHex *gh, guint gt) {
 /*
  * sets font for displaying data
  */
-void gtk_hex_set_font(GtkHex *gh, PangoFontMetrics *font_metrics, PangoFontDescription *font_desc) {
+void gtk_hex_set_font(GtkHex *gh, const PangoFontMetrics *font_metrics, const PangoFontDescription *font_desc) {
 	g_return_if_fail(gh != NULL);
 	g_return_if_fail(GTK_IS_HEX(gh));
 
diff --git a/src/gtkhex.h b/src/gtkhex.h
index 6e16592..92905cc 100644
--- a/src/gtkhex.h
+++ b/src/gtkhex.h
@@ -141,7 +141,7 @@ guchar gtk_hex_get_byte(GtkHex *, guint);
 void gtk_hex_set_group_type(GtkHex *, guint);
 
 void gtk_hex_show_offsets(GtkHex *, gboolean);
-void gtk_hex_set_font(GtkHex *, PangoFontMetrics *, PangoFontDescription *);
+void gtk_hex_set_font(GtkHex *, const PangoFontMetrics *, const PangoFontDescription *);
 
 void gtk_hex_set_insert_mode(GtkHex *, gboolean);
 
