de9df26a979d96e46e1ef7b0fe6e2feb288e9efd
diff --git a/ChangeLog b/ChangeLog
index 6ceab24..1a9fdd0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,16 @@
 2007-11-30  Jonathon Jongsma  <jjongsma@gnome.org>
 
 	* src/gtkhex.c:
+	* src/gtkhex.h: add API to set a starting offset address.  In some ways it
+	seems that this information is a property of the document rather than the
+	view, but the GtkHex widget does all of the offset-related stuff, so I put
+	it here.  This is useful for using this widget as a debugger memory editor
+	since we'll only read a small amount of memory from gdb and we want to be
+	able to label the rows with the correct address.  Fix for bug #465137
+
+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
diff --git a/src/gtkhex.c b/src/gtkhex.c
index 804659f..4661570 100644
--- a/src/gtkhex.c
+++ b/src/gtkhex.c
@@ -673,7 +673,7 @@ static void render_offsets(GtkHex *gh, gint imin, gint imax) {
 	gdk_gc_set_foreground(gh->offsets_gc, &GTK_WIDGET(gh)->style->text[GTK_STATE_NORMAL]);
 	
 	for(i = imin; i <= imax; i++) {
-		sprintf(offstr, "%08X", (gh->top_line + i)*gh->cpl);
+		sprintf(offstr, "%08X", (gh->top_line + i)*gh->cpl + gh->starting_offset);
 		/* Changes for Gnome 2.0 */
 		pango_layout_set_text (gh->olayout, offstr, 8);
 		gdk_draw_layout (w->window, gh->offsets_gc, 0, i*gh->char_height, gh->olayout);
@@ -1951,6 +1951,7 @@ static void gtk_hex_init(GtkHex *gh, gpointer klass) {
 
 	gh->disp_buffer = NULL;
 	gh->document = NULL;
+	gh->starting_offset = 0;
 
 	gh->xdisp_width = gh->adisp_width = 200;
 	gh->adisp_gc = gh->xdisp_gc = NULL;
@@ -2302,6 +2303,13 @@ void gtk_hex_show_offsets(GtkHex *gh, gboolean show)
 		hide_offsets_widget(gh);
 }
 
+void gtk_hex_set_starting_offset(GtkHex *gh, gint starting_offset)
+{
+	g_return_if_fail (gh != NULL);
+	g_return_if_fail(GTK_IS_HEX(gh));
+	gh->starting_offset = starting_offset;
+}
+
 void gtk_hex_set_insert_mode(GtkHex *gh, gboolean insert)
 {
 	g_return_if_fail(gh != NULL);
diff --git a/src/gtkhex.h b/src/gtkhex.h
index 92905cc..2dea885 100644
--- a/src/gtkhex.h
+++ b/src/gtkhex.h
@@ -110,6 +110,7 @@ struct _GtkHex
 	gint scroll_dir;
 	guint scroll_timeout;
 	gboolean show_offsets;
+	gint starting_offset;
 	gboolean insert;
 	gboolean selecting;
 };
@@ -140,6 +141,7 @@ guchar gtk_hex_get_byte(GtkHex *, guint);
 
 void gtk_hex_set_group_type(GtkHex *, guint);
 
+void gtk_hex_set_starting_offset(GtkHex *, gint);
 void gtk_hex_show_offsets(GtkHex *, gboolean);
 void gtk_hex_set_font(GtkHex *, const PangoFontMetrics *, const PangoFontDescription *);
 
