[gitg] Move the backend part of gitg into a libgitg library.



commit 2796d4caf699b94072a4608fdc088a2e682219d8
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Sat Feb 20 17:35:56 2010 +0100

    Move the backend part of gitg into a libgitg library.

 Makefile.am                                  |    2 +-
 configure.ac                                 |   12 +-
 gitg/Makefile.am                             |   51 +---
 gitg/gitg-branch-actions.c                   |   12 +-
 gitg/gitg-branch-actions.h                   |    2 +-
 gitg/gitg-cell-renderer-path.c               |    5 +-
 gitg/gitg-cell-renderer-path.h               |    2 +-
 gitg/gitg-commit-view.c                      |    4 +-
 gitg/gitg-commit-view.h                      |    2 +-
 gitg/gitg-diff-line-renderer.c               |    2 +-
 gitg/gitg-diff-view.c                        |    3 +-
 gitg/gitg-dnd.c                              |    6 +-
 gitg/gitg-dnd.h                              |    4 +-
 gitg/gitg-label-renderer.c                   |    2 +-
 gitg/gitg-label-renderer.h                   |    2 +-
 gitg/gitg-preferences-dialog.c               |    2 +-
 gitg/gitg-repository-dialog.c                |    2 +-
 gitg/gitg-revision-tree-view.c               |    4 +-
 gitg/gitg-revision-tree-view.h               |    4 +-
 gitg/gitg-revision-view.c                    |   11 +-
 gitg/gitg-revision-view.h                    |    4 +-
 gitg/gitg-utils.c                            |  457 ++++++--------------------
 gitg/gitg-utils.h                            |   40 +--
 gitg/gitg-window.c                           |  129 +++++++-
 gitg/gitg-window.h                           |    2 +-
 gitg/gitg.c                                  |    2 +-
 libgitg/Makefile.am                          |   84 +++++
 {gitg => libgitg}/gitg-changed-file.c        |    0
 {gitg => libgitg}/gitg-changed-file.h        |    0
 {gitg => libgitg}/gitg-color.c               |    0
 {gitg => libgitg}/gitg-color.h               |   16 +-
 {gitg => libgitg}/gitg-commit.c              |    1 -
 {gitg => libgitg}/gitg-commit.h              |    0
 {gitg => libgitg}/gitg-config.c              |    0
 {gitg => libgitg}/gitg-config.h              |    0
 libgitg/gitg-convert.c                       |  118 +++++++
 gitg/gitg-types.h => libgitg/gitg-convert.h  |   14 +-
 {gitg => libgitg}/gitg-debug.c               |    0
 {gitg => libgitg}/gitg-debug.h               |    0
 {gitg => libgitg}/gitg-enum-types.c.template |    0
 {gitg => libgitg}/gitg-enum-types.h.template |    0
 libgitg/gitg-hash.c                          |  137 ++++++++
 gitg/gitg-debug.h => libgitg/gitg-hash.h     |   25 +-
 libgitg/gitg-i18n.c                          |   52 +++
 libgitg/gitg-i18n.h                          |   71 ++++
 {gitg => libgitg}/gitg-lane.c                |    0
 {gitg => libgitg}/gitg-lane.h                |    0
 {gitg => libgitg}/gitg-lanes.c               |    6 +-
 {gitg => libgitg}/gitg-lanes.h               |    0
 {gitg => libgitg}/gitg-ref.c                 |    4 +-
 {gitg => libgitg}/gitg-ref.h                 |    0
 {gitg => libgitg}/gitg-repository.c          |  316 +++++++++++-------
 {gitg => libgitg}/gitg-repository.h          |    0
 {gitg => libgitg}/gitg-revision.c            |   23 +-
 {gitg => libgitg}/gitg-revision.h            |    5 +-
 {gitg => libgitg}/gitg-runner.c              |   13 +-
 {gitg => libgitg}/gitg-runner.h              |    0
 {gitg => libgitg}/gitg-types.h               |    0
 58 files changed, 1009 insertions(+), 644 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index f52d8a7..962d582 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in
 
-SUBDIRS = gitg data po
+SUBDIRS = libgitg gitg data po
 
 DISTCLEANFILES = \
 	intltool-extract \
diff --git a/configure.ac b/configure.ac
index 9a2929c..5eaa528 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,13 +54,18 @@ PKG_CHECK_EXISTS([gtk+-3.0 >= 2.90],
 			GTK_REQUIRED_VERSION=2.20.0
 		 ])
 
-PKG_CHECK_MODULES(PACKAGE, [
+PKG_CHECK_MODULES(GITG, [
 	$GTK_REQUIRED >= $GTK_REQUIRED_VERSION
 	gthread-2.0
-	gtksourceview-2.0 >= 2.8
+	glib-2.0
+	gobject-2.0
+	gmodule-2.0
 	gio-2.0
 	gio-unix-2.0
-	gmodule-2.0
+])
+
+PKG_CHECK_MODULES(PACKAGE, [
+	gtksourceview-2.0 >= 2.8
 	gconf-2.0
 ])
 
@@ -97,6 +102,7 @@ AM_GCONF_SOURCE_2
 
 AC_CONFIG_FILES([
 Makefile
+libgitg/Makefile
 gitg/Makefile
 data/Makefile
 data/gitg.desktop.in
diff --git a/gitg/Makefile.am b/gitg/Makefile.am
index 7b7dc19..83c1bdc 100644
--- a/gitg/Makefile.am
+++ b/gitg/Makefile.am
@@ -3,6 +3,7 @@ bin_PROGRAMS = gitg
 AM_CPPFLAGS =							\
 	-I$(top_srcdir)						\
 	-I$(srcdir)						\
+	$(GITG_CFLAGS)						\
 	$(PACKAGE_CFLAGS)					\
 	$(WARN_CFLAGS)						\
 	$(DISABLE_DEPRECATED_CFLAGS)				\
@@ -10,39 +11,23 @@ AM_CPPFLAGS =							\
 	-DGITG_DATADIR=\""$(datadir)/gitg"\"			\
 	-DGITG_LOCALEDIR=\""$(datadir)/locale"\"
 
-BUILT_SOURCES = 				\
-	gitg-enum-types.c			\
-	gitg-enum-types.h
-
 NOINST_H_FILES = 			\
 	gitg-branch-actions.h		\
 	gitg-cell-renderer-path.h	\
-	gitg-changed-file.h		\
-	gitg-color.h			\
-	gitg-config.h			\
-	gitg-commit.h			\
 	gitg-commit-view.h		\
 	gitg-data-binding.h		\
-	gitg-debug.h			\
 	gitg-diff-line-renderer.h	\
 	gitg-diff-view.h		\
 	gitg-dirs.h			\
 	gitg-dnd.h			\
 	gitg-label-renderer.h		\
-	gitg-lane.h			\
-	gitg-lanes.h			\
 	gitg-preferences-dialog.h	\
 	gitg-preferences.h		\
-	gitg-ref.h			\
-	gitg-repository.h		\
 	gitg-repository-dialog.h	\
-	gitg-revision.h			\
 	gitg-revision-tree-store.h	\
 	gitg-revision-tree-view.h	\
 	gitg-revision-view.h		\
-	gitg-runner.h			\
 	gitg-settings.h			\
-	gitg-types.h			\
 	gitg-utils.h			\
 	gitg-window.h			\
 	gseal-gtk-compat.h
@@ -52,39 +37,29 @@ gitg_SOURCES = 				\
 	gitg.c				\
 	gitg-branch-actions.c		\
 	gitg-cell-renderer-path.c	\
-	gitg-changed-file.c		\
-	gitg-color.c			\
-	gitg-config.c			\
-	gitg-commit.c			\
 	gitg-commit-view.c		\
 	gitg-data-binding.c		\
-	gitg-debug.c			\
 	gitg-diff-line-renderer.c	\
 	gitg-diff-view.c		\
 	gitg-dirs.c			\
 	gitg-dnd.c			\
 	gitg-label-renderer.c		\
-	gitg-lane.c			\
-	gitg-lanes.c			\
 	gitg-preferences.c		\
 	gitg-preferences-dialog.c	\
-	gitg-ref.c			\
-	gitg-repository.c		\
 	gitg-repository-dialog.c	\
-	gitg-revision.c			\
 	gitg-revision-tree-store.c	\
 	gitg-revision-tree-view.c	\
 	gitg-revision-view.c		\
-	gitg-runner.c			\
 	gitg-settings.c			\
 	gitg-utils.c			\
 	gitg-window.c			\
 	$(NOINST_H_FILES)
 
-ENUM_H_FILES =				\
-	gitg-changed-file.h
+gitg_LDADD =		\
+	$(GITG_LIBS)	\
+	$(PACKAGE_LIBS) \
+	$(top_builddir)/libgitg/libgitg-1.0.la
 
-gitg_LDADD = $(PACKAGE_LIBS)
 gitg_LDFLAGS = -export-dynamic -no-undefined -export-symbols-regex "^[[^_]].*"
 
 uidir = $(datadir)/gitg/ui/
@@ -97,22 +72,8 @@ ui_DATA = \
 	gitg-tag.ui			\
 	gitg-repository.ui
 
-gitg-enum-types.h: gitg-enum-types.h.template $(ENUM_H_FILES) $(GLIB_MKENUMS)
-	$(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template gitg-enum-types.h.template $(ENUM_H_FILES)) > $@
-        
-gitg-enum-types.c: gitg-enum-types.c.template $(ENUM_H_FILES) $(GLIB_MKENUMS)
-	$(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template gitg-enum-types.c.template $(ENUM_H_FILES)) > $@
-
 EXTRA_DIST = 				\
-	$(ui_DATA)			\
-	gitg-enum-types.h.template	\
-	gitg-enum-types.c.template
-
-
-CLEANFILES = $(BUILT_SOURCES)
-
-dist-hook:
-	cd $(distdir); rm -f $(BUILT_SOURCES)
+	$(ui_DATA)
 
 bundle: $(bin_PROGRAMS) $(ui_DATA)
 	for i in $(SUBDIRS); do (cd $$i && $(MAKE) top_bundledir="$(top_bundledir)" $(AM_MAKEFLAGS) bundle); done; \
diff --git a/gitg/gitg-branch-actions.c b/gitg/gitg-branch-actions.c
index 35a230b..ef76cc0 100644
--- a/gitg/gitg-branch-actions.c
+++ b/gitg/gitg-branch-actions.c
@@ -21,10 +21,10 @@
  */
 
 #include <glib/gi18n.h>
+#include <libgitg/gitg-hash.h>
 #include <unistd.h>
 
 #include "gitg-branch-actions.h"
-#include "gitg-utils.h"
 
 typedef enum
 {
@@ -378,7 +378,7 @@ get_stash_refspec (GitgRepository *repository, GitgRef *stash)
 	                                            NULL);
 
 	gchar **ptr = out;
-	gchar *sha1 = gitg_utils_hash_to_sha1_new (gitg_ref_get_hash (stash));
+	gchar *sha1 = gitg_hash_hash_to_sha1_new (gitg_ref_get_hash (stash));
 	gchar *ret = NULL;
 
 	while (ptr && *ptr)
@@ -1308,10 +1308,10 @@ gitg_branch_actions_rebase (GitgWindow *window,
 		gchar *head = gitg_repository_parse_head (repository);
 		Hash hash;
 
-		gitg_utils_sha1_to_hash (head, hash);
+		gitg_hash_sha1_to_hash (head, hash);
 		g_free (head);
 
-		if (gitg_utils_hash_equal (hash, gitg_ref_get_hash (dest)))
+		if (gitg_hash_hash_equal (hash, gitg_ref_get_hash (dest)))
 		{
 			message_dialog (window,
 			                GTK_MESSAGE_ERROR,
@@ -1327,7 +1327,7 @@ gitg_branch_actions_rebase (GitgWindow *window,
 		}
 	}
 
-	gchar *merge_head = gitg_utils_hash_to_sha1_new (gitg_ref_get_hash (dest));
+	gchar *merge_head = gitg_hash_hash_to_sha1_new (gitg_ref_get_hash (dest));
 
 	message = g_strdup_printf (_("Rebasing %s branch <%s> onto %s branch <%s>"),
 	                           gitg_ref_get_ref_type (source) == GITG_REF_TYPE_BRANCH ? _("local") : _("remote"),
@@ -1538,7 +1538,7 @@ gitg_branch_actions_apply_stash (GitgWindow *window,
 		}
 	}
 
-	gchar *sha1 = gitg_utils_hash_to_sha1_new (gitg_ref_get_hash (stash));
+	gchar *sha1 = gitg_hash_hash_to_sha1_new (gitg_ref_get_hash (stash));
 	gboolean ret;
 
 	if (!gitg_repository_commandv (repository,
diff --git a/gitg/gitg-branch-actions.h b/gitg/gitg-branch-actions.h
index 1cd0f61..dafccd4 100644
--- a/gitg/gitg-branch-actions.h
+++ b/gitg/gitg-branch-actions.h
@@ -23,8 +23,8 @@
 #ifndef __GITG_BRANCH_ACTIONS_H__
 #define __GITG_BRANCH_ACTIONS_H__
 
+#include <libgitg/gitg-ref.h>
 #include "gitg-window.h"
-#include "gitg-ref.h"
 
 G_BEGIN_DECLS
 
diff --git a/gitg/gitg-cell-renderer-path.c b/gitg/gitg-cell-renderer-path.c
index 3baf088..e4f7fd4 100644
--- a/gitg/gitg-cell-renderer-path.c
+++ b/gitg/gitg-cell-renderer-path.c
@@ -21,9 +21,10 @@
  */
 
 #include <math.h>
+#include <libgitg/gitg-lane.h>
+#include <libgitg/gitg-revision.h>
+
 #include "gitg-cell-renderer-path.h"
-#include "gitg-lane.h"
-#include "gitg-utils.h"
 #include "gitg-label-renderer.h"
 
 #define GITG_CELL_RENDERER_PATH_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), GITG_TYPE_CELL_RENDERER_PATH, GitgCellRendererPathPrivate))
diff --git a/gitg/gitg-cell-renderer-path.h b/gitg/gitg-cell-renderer-path.h
index c3a91be..21f99d9 100644
--- a/gitg/gitg-cell-renderer-path.h
+++ b/gitg/gitg-cell-renderer-path.h
@@ -24,7 +24,7 @@
 #define __GITG_CELL_RENDERER_PATH_H__
 
 #include <gtk/gtk.h>
-#include "gitg-ref.h"
+#include <libgitg/gitg-ref.h>
 
 G_BEGIN_DECLS
 
diff --git a/gitg/gitg-commit-view.c b/gitg/gitg-commit-view.c
index b2c1c0f..f6998b1 100644
--- a/gitg/gitg-commit-view.c
+++ b/gitg/gitg-commit-view.c
@@ -25,13 +25,13 @@
 #include <gtksourceview/gtksourcestyleschememanager.h>
 #include <glib/gi18n.h>
 #include <string.h>
+#include <libgitg/gitg-commit.h>
 
 #include "gitg-commit-view.h"
-#include "gitg-commit.h"
-#include "gitg-utils.h"
 #include "gitg-diff-view.h"
 #include "gitg-preferences.h"
 #include "gitg-data-binding.h"
+#include "gitg-utils.h"
 
 #define GITG_COMMIT_VIEW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), GITG_TYPE_COMMIT_VIEW, GitgCommitViewPrivate))
 #define CATEGORY_UNSTAGE_HUNK "CategoryUnstageHunk"
diff --git a/gitg/gitg-commit-view.h b/gitg/gitg-commit-view.h
index 012398c..b38521a 100644
--- a/gitg/gitg-commit-view.h
+++ b/gitg/gitg-commit-view.h
@@ -24,7 +24,7 @@
 #define __GITG_COMMIT_VIEW_H__
 
 #include <gtk/gtk.h>
-#include "gitg-repository.h"
+#include <libgitg/gitg-repository.h>
 
 G_BEGIN_DECLS
 
diff --git a/gitg/gitg-diff-line-renderer.c b/gitg/gitg-diff-line-renderer.c
index b24f2e4..c77fa46 100644
--- a/gitg/gitg-diff-line-renderer.c
+++ b/gitg/gitg-diff-line-renderer.c
@@ -20,8 +20,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#include "gitg-diff-line-renderer.h"
 #include "gitg-utils.h"
+#include "gitg-diff-line-renderer.h"
 
 #define GITG_DIFF_LINE_RENDERER_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), GITG_TYPE_DIFF_LINE_RENDERER, GitgDiffLineRendererPrivate))
 
diff --git a/gitg/gitg-diff-view.c b/gitg/gitg-diff-view.c
index c4599c8..b2ed007 100644
--- a/gitg/gitg-diff-view.c
+++ b/gitg/gitg-diff-view.c
@@ -20,8 +20,9 @@
  * Boston, MA 02111-1307, USA.
  */
 
+#include <libgitg/gitg-types.h>
+
 #include "gitg-diff-view.h"
-#include "gitg-types.h"
 #include "gitg-diff-line-renderer.h"
 #include "gitg-utils.h"
 
diff --git a/gitg/gitg-dnd.c b/gitg/gitg-dnd.c
index 947c764..c1987e1 100644
--- a/gitg/gitg-dnd.c
+++ b/gitg/gitg-dnd.c
@@ -23,13 +23,13 @@
 #include <gtk/gtk.h>
 
 #include "gitg-dnd.h"
-#include "gitg-ref.h"
 #include "gitg-cell-renderer-path.h"
-#include "gitg-utils.h"
-#include <string.h>
 #include "gitg-window.h"
 #include "gitg-branch-actions.h"
 #include "gseal-gtk-compat.h"
+#include "gitg-utils.h"
+
+#include <string.h>
 
 enum
 {
diff --git a/gitg/gitg-dnd.h b/gitg/gitg-dnd.h
index bda0de7..560dbea 100644
--- a/gitg/gitg-dnd.h
+++ b/gitg/gitg-dnd.h
@@ -24,8 +24,8 @@
 #define __GITG_DND_H__
 
 #include <gtk/gtk.h>
-#include "gitg-ref.h"
-#include "gitg-revision.h"
+#include <libgitg/gitg-ref.h>
+#include <libgitg/gitg-revision.h>
 
 G_BEGIN_DECLS
 
diff --git a/gitg/gitg-label-renderer.c b/gitg/gitg-label-renderer.c
index bd5f3b2..39265ef 100644
--- a/gitg/gitg-label-renderer.c
+++ b/gitg/gitg-label-renderer.c
@@ -21,9 +21,9 @@
  */
 
 #include "gitg-label-renderer.h"
-#include "gitg-ref.h"
 #include "gitg-utils.h"
 
+#include <libgitg/gitg-ref.h>
 #include <math.h>
 
 #define PADDING 4
diff --git a/gitg/gitg-label-renderer.h b/gitg/gitg-label-renderer.h
index 2641d12..595e03e 100644
--- a/gitg/gitg-label-renderer.h
+++ b/gitg/gitg-label-renderer.h
@@ -25,7 +25,7 @@
 
 #include <gtk/gtk.h>
 #include <pango/pango.h>
-#include "gitg-ref.h"
+#include <libgitg/gitg-ref.h>
 
 gint gitg_label_renderer_width(GtkWidget *widget, PangoFontDescription *description, GSList *labels);
 void gitg_label_renderer_draw(GtkWidget *widget, PangoFontDescription *description, cairo_t *context, GSList *labels, GdkRectangle *area);
diff --git a/gitg/gitg-preferences-dialog.c b/gitg/gitg-preferences-dialog.c
index e16180b..97afb2f 100644
--- a/gitg/gitg-preferences-dialog.c
+++ b/gitg/gitg-preferences-dialog.c
@@ -25,8 +25,8 @@
 #include "gitg-preferences.h"
 #include "gitg-data-binding.h"
 #include "gitg-utils.h"
-#include "gitg-config.h"
 
+#include <libgitg/gitg-config.h>
 #include <stdlib.h>
 #include <glib/gi18n.h>
 
diff --git a/gitg/gitg-repository-dialog.c b/gitg/gitg-repository-dialog.c
index de5085b..2d0276a 100644
--- a/gitg/gitg-repository-dialog.c
+++ b/gitg/gitg-repository-dialog.c
@@ -23,10 +23,10 @@
 #include <glib/gi18n.h>
 
 #include <stdlib.h>
+#include <libgitg/gitg-config.h>
 
 #include "gitg-repository-dialog.h"
 #include "gitg-utils.h"
-#include "gitg-config.h"
 
 void on_button_fetch_remote_clicked (GtkButton *button,
                                      GitgRepositoryDialog *dialog);
diff --git a/gitg/gitg-revision-tree-view.c b/gitg/gitg-revision-tree-view.c
index 59e5d47..541bb48 100644
--- a/gitg/gitg-revision-tree-view.c
+++ b/gitg/gitg-revision-tree-view.c
@@ -26,12 +26,12 @@
 #include <glib/gi18n.h>
 #include <gio/gio.h>
 #include <stdlib.h>
+#include <libgitg/gitg-revision.h>
+#include <libgitg/gitg-runner.h>
 
 #include "gitg-revision-tree-view.h"
 #include "gitg-revision-tree-store.h"
-#include "gitg-runner.h"
 #include "gitg-utils.h"
-#include "gitg-revision.h"
 
 #define GITG_REVISION_TREE_VIEW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), GITG_TYPE_REVISION_TREE, GitgRevisionTreeViewPrivate))
 
diff --git a/gitg/gitg-revision-tree-view.h b/gitg/gitg-revision-tree-view.h
index d19ea76..d762838 100644
--- a/gitg/gitg-revision-tree-view.h
+++ b/gitg/gitg-revision-tree-view.h
@@ -24,8 +24,8 @@
 #define __GITG_REVISION_TREE_VIEW_H__
 
 #include <gtk/gtk.h>
-#include "gitg-repository.h"
-#include "gitg-revision.h"
+#include <libgitg/gitg-repository.h>
+#include <libgitg/gitg-revision.h>
 
 G_BEGIN_DECLS
 
diff --git a/gitg/gitg-revision-view.c b/gitg/gitg-revision-view.c
index b27dd47..545fcf3 100644
--- a/gitg/gitg-revision-view.c
+++ b/gitg/gitg-revision-view.c
@@ -24,11 +24,12 @@
 #include <gtksourceview/gtksourcelanguagemanager.h>
 #include <gtksourceview/gtksourcestyleschememanager.h>
 #include <string.h>
+#include <libgitg/gitg-revision.h>
+#include <libgitg/gitg-runner.h>
+#include <libgitg/gitg-hash.h>
 
 #include "gitg-revision-view.h"
 #include "gitg-diff-view.h"
-#include "gitg-revision.h"
-#include "gitg-runner.h"
 #include "gitg-utils.h"
 
 #define GITG_REVISION_VIEW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), GITG_TYPE_REVISION_VIEW, GitgRevisionViewPrivate))
@@ -633,7 +634,7 @@ make_parent_label(GitgRevisionView *self, gchar const *hash)
 	gtk_widget_show(ev);
 	gtk_widget_show(lbl);
 
-	g_object_set_data_full(G_OBJECT(ev), HASH_KEY, (gpointer)gitg_utils_sha1_to_hash_new(hash), (GDestroyNotify)g_free);
+	g_object_set_data_full(G_OBJECT(ev), HASH_KEY, (gpointer)gitg_hash_sha1_to_hash_new(hash), (GDestroyNotify)g_free);
 	g_signal_connect(ev, "button-release-event", G_CALLBACK(on_parent_clicked), self);
 
 	return ev;
@@ -670,7 +671,7 @@ update_parents(GitgRevisionView *self, GitgRevision *revision)
 		gdk_window_set_cursor (gtk_widget_get_window (widget), cursor);
 
 		/* find subject */
-		gitg_utils_sha1_to_hash(parents[i], hash);
+		gitg_hash_sha1_to_hash(parents[i], hash);
 
 		GitgRevision *revision = gitg_repository_lookup(self->priv->repository, hash);
 
@@ -771,7 +772,7 @@ gitg_revision_view_update(GitgRevisionView *self, GitgRepository *repository, Gi
 		gtk_label_set_markup(self->priv->subject, subject);
 		g_free(subject);
 
-		gchar *date = gitg_utils_timestamp_to_str(gitg_revision_get_timestamp(revision));
+		gchar *date = gitg_revision_get_timestamp_for_display(revision);
 		gtk_label_set_text(self->priv->date, date);
 		g_free(date);
 
diff --git a/gitg/gitg-revision-view.h b/gitg/gitg-revision-view.h
index 9572cba..772a793 100644
--- a/gitg/gitg-revision-view.h
+++ b/gitg/gitg-revision-view.h
@@ -24,8 +24,8 @@
 #define __GITG_REVISION_VIEW_H__
 
 #include <gtk/gtk.h>
-#include "gitg-revision.h"
-#include "gitg-repository.h"
+#include <libgitg/gitg-revision.h>
+#include <libgitg/gitg-repository.h>
 
 G_BEGIN_DECLS
 
diff --git a/gitg/gitg-utils.c b/gitg/gitg-utils.c
index cb49a7f..570a9c1 100644
--- a/gitg/gitg-utils.c
+++ b/gitg/gitg-utils.c
@@ -20,133 +20,51 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#include <string.h>
-#include <glib.h>
-#include <stdlib.h>
-#include <gconf/gconf-client.h>
-#include <math.h>
-
-#include "gitg-utils.h"
 #include "gitg-dirs.h"
+#include "gitg-utils.h"
 
-inline static guint8
-atoh(gchar c)
-{
-	if (c >= 'a')
-		return c - 'a' + 10;
-	if (c >= 'A')
-		return c - 'A' + 10;
-
-	return c - '0';
-}
-
-void
-gitg_utils_partial_sha1_to_hash(gchar const *sha, gint length, gchar *hash)
-{
-	if (length % 2 == 1)
-	{
-		--length;
-	}
-
-	int i;
-
-	for (i = 0; i < length / 2; ++i)
-	{
-		gchar h = atoh(*(sha++)) << 4;
-		hash[i] = h | atoh(*(sha++));
-	}
-}
-
-void
-gitg_utils_sha1_to_hash(gchar const *sha, gchar *hash)
-{
-	gitg_utils_partial_sha1_to_hash (sha, HASH_SHA_SIZE, hash);
-}
-
-void
-gitg_utils_hash_to_sha1(gchar const *hash, gchar *sha)
-{
-	char const *repr = "0123456789abcdef";
-	int i;
-	int pos = 0;
-
-	for (i = 0; i < HASH_BINARY_SIZE; ++i)
-	{
-		sha[pos++] = repr[(hash[i] >> 4) & 0x0f];
-		sha[pos++] = repr[(hash[i] & 0x0f)];
-	}
-}
-
-gchar *
-gitg_utils_hash_to_sha1_new(gchar const *hash)
-{
-	gchar *ret = g_new(gchar, HASH_SHA_SIZE + 1);
-	gitg_utils_hash_to_sha1(hash, ret);
-
-	ret[HASH_SHA_SIZE] = '\0';
-	return ret;
-}
+#include <gconf/gconf-client.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
 
 gchar *
-gitg_utils_partial_sha1_to_hash_new (gchar const *sha, gint length, gint *retlen)
+gitg_utils_get_content_type(GFile *file)
 {
-	if (length == -1)
-	{
-		length = strlen (sha);
-	}
-
-	if (length % 2 != 0)
-	{
-		--length;
-	}
+	GFileInfo *info = g_file_query_info(file, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, G_FILE_QUERY_INFO_NONE, NULL, NULL);
 
-	*retlen = length / 2;
-	gchar *ret = g_new (gchar, *retlen);
+	if (!info || !g_file_info_has_attribute(info, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE))
+		return NULL;
 
-	gitg_utils_partial_sha1_to_hash (sha, length, ret);
+	gchar *content_type = g_strdup(g_file_info_get_content_type(info));
+	g_object_unref(info);
 
-	return ret;
+	return content_type;
 }
 
-gchar *
-gitg_utils_sha1_to_hash_new(gchar const *sha1)
+gboolean
+gitg_utils_can_display_content_type (gchar const *content_type)
 {
-	gchar *ret = g_new(gchar, HASH_BINARY_SIZE);
-	gitg_utils_sha1_to_hash(sha1, ret);
-
-	return ret;
+	return g_content_type_is_a (content_type, "text/plain") ||
+	       g_content_type_equals (content_type, "application/octet-stream");
 }
 
-GFile *
-gitg_utils_find_dot_git (GFile *location)
+gchar *
+gitg_utils_guess_content_type(GtkTextBuffer *buffer)
 {
-	location = g_file_dup (location);
-
-	do
-	{
-		GFile *tmp;
-		gboolean exists;
-
-		tmp = g_file_get_child (location, ".git");
-		exists = g_file_query_exists (tmp, NULL);
-
-		if (exists)
-		{
-			g_object_unref (location);
-			location = tmp;
-
-			break;
-		}
+	GtkTextIter start;
+	GtkTextIter end;
 
-		g_object_unref (tmp);
+	gtk_text_buffer_get_start_iter(buffer, &start);
+	end = start;
 
-		tmp = g_file_get_parent (location);
+	gtk_text_iter_forward_chars(&end, 256);
+	gchar *data = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
 
-		g_object_unref (location);
-		location = tmp;
-	} while (location != NULL);
+	gchar *content_type = g_content_type_guess(NULL, (guchar *)data, strlen(data), NULL);
+	g_free(data);
 
-	return location;
+	return content_type;
 }
 
 static void
@@ -205,159 +123,65 @@ gitg_utils_export_files (GitgRepository *repository,
 	return ret;
 }
 
-static void
-utf8_validate_fallback (gchar  *text,
-                        gssize  size)
+GtkSourceLanguage *
+gitg_utils_get_language(gchar const *filename, gchar const *content_type)
 {
-	gchar const *end;
+	if (!gitg_utils_can_display_content_type(content_type))
+		return NULL;
 
-	while (!g_utf8_validate (text, size, &end))
-	{
-		*((gchar *)end) = '?';
-	}
+	GtkSourceLanguageManager *manager = gtk_source_language_manager_get_default();
+	return gtk_source_language_manager_guess_language(manager, filename, content_type);
 }
 
-static gchar *
-convert_fallback (gchar const *text,
-                  gssize       size,
-                  gchar const *fallback)
+gchar *
+gitg_utils_get_monospace_font_name(void)
 {
-	gchar *res;
-	gsize read, written;
-	GString *str = g_string_new ("");
-
-	while ((res = g_convert(text,
-	                        size,
-	                        "UTF-8",
-	                        "ASCII",
-	                        &read,
-	                        &written,
-	                        NULL)) == NULL)
-	{
-		res = g_convert (text, read, "UTF-8", "ASCII", NULL, NULL, NULL);
-		str = g_string_append (str, res);
-
-		str = g_string_append (str, fallback);
-		text = text + read + 1;
-		size = size - read;
-	}
+	GConfClient *client = gconf_client_get_default();
+	gchar *name = gconf_client_get_string(client, "/desktop/gnome/interface/monospace_font_name", NULL);
 
-	str = g_string_append (str, res);
-	g_free (res);
+	g_object_unref(client);
 
-	utf8_validate_fallback (str->str, str->len);
-	return g_string_free (str, FALSE);
+	return name;
 }
 
-gchar *
-gitg_utils_convert_utf8 (gchar const *str, gssize size)
+void 
+gitg_utils_set_monospace_font(GtkWidget *widget)
 {
-	static gchar *encodings[] = {
-		"ISO-8859-15",
-		"ASCII"
-	};
-
-	if (str == NULL)
-	{
-		return NULL;
-	}
-
-	if (size == -1)
-	{
-		size = strlen (str);
-	}
+	gchar *name = gitg_utils_get_monospace_font_name();
 
-	if (g_utf8_validate (str, size, NULL))
+	if (name)
 	{
-		return g_strndup (str, size);
-	}
+		PangoFontDescription *description = pango_font_description_from_string(name);
 
-	int i;
-	for (i = 0; i < sizeof (encodings) / sizeof (gchar *); ++i)
-	{
-		gsize read;
-		gsize written;
-
-		gchar *ret = g_convert (str,
-		                        size,
-		                        "UTF-8",
-		                        encodings[i],
-		                        &read,
-		                        &written,
-		                        NULL);
-
-		if (ret && read == size)
+		if (description)
 		{
-			utf8_validate_fallback (ret, written);
-			return ret;
+			gtk_widget_modify_font(widget, description);
+			pango_font_description_free(description);
 		}
-
-		g_free (ret);
 	}
 
-	return convert_fallback (str, size, "?");
-}
-
-guint
-gitg_utils_hash_hash(gconstpointer v)
-{
-	/* 31 bit hash function, copied from g_str_hash */
-	const signed char *p = v;
-	guint32 h = *p;
-	int i;
-
-	for (i = 1; i < HASH_BINARY_SIZE; ++i)
-		h = (h << 5) - h + p[i];
-
-	return h;
-}
-
-gboolean 
-gitg_utils_hash_equal(gconstpointer a, gconstpointer b)
-{
-	return memcmp(a, b, HASH_BINARY_SIZE) == 0;
-}
-
-gint
-gitg_utils_null_length(gconstpointer *ptr)
-{
-	gint ret = 0;
-
-	while (*ptr++)
-		++ret;
-
-	return ret;
+	g_free(name);
 }
 
-gchar *
-gitg_utils_get_content_type(GFile *file)
+GtkBuilder *
+gitg_utils_new_builder(gchar const *filename)
 {
-	GFileInfo *info = g_file_query_info(file, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, G_FILE_QUERY_INFO_NONE, NULL, NULL);
-
-	if (!info || !g_file_info_has_attribute(info, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE))
-		return NULL;
-
-	gchar *content_type = g_strdup(g_file_info_get_content_type(info));
-	g_object_unref(info);
+	GtkBuilder *b = gtk_builder_new();
+	GError *error = NULL;
 
-	return content_type;
-}
+	gchar *path = gitg_dirs_get_data_filename("ui", filename, NULL);
 
-gboolean
-gitg_utils_can_display_content_type (gchar const *content_type)
-{
-	return g_content_type_is_a (content_type, "text/plain") ||
-	       g_content_type_equals (content_type, "application/octet-stream");
-}
+	if (!gtk_builder_add_from_file(b, path, &error))
+	{
+		g_critical("Could not open UI file: %s (%s)", path, error->message);
+		g_error_free(error);
 
-GtkSourceLanguage *
-gitg_utils_get_language(gchar const *filename, gchar const *content_type)
-{
-	if (!gitg_utils_can_display_content_type(content_type))
-		return NULL;
+		g_free(path);
+		exit(1);
+	}
 
-	GtkSourceLanguageManager *manager = gtk_source_language_manager_get_default();
-	return gtk_source_language_manager_guess_language(manager, filename, content_type);
+	g_free(path);
+	return b;
 }
 
 gint 
@@ -380,24 +204,6 @@ gitg_utils_sort_names(gchar const *s1, gchar const *s2)
 	return ret;
 }
 
-gchar *
-gitg_utils_guess_content_type(GtkTextBuffer *buffer)
-{
-	GtkTextIter start;
-	GtkTextIter end;
-
-	gtk_text_buffer_get_start_iter(buffer, &start);
-	end = start;
-
-	gtk_text_iter_forward_chars(&end, 256);
-	gchar *data = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
-
-	gchar *content_type = g_content_type_guess(NULL, (guchar *)data, strlen(data), NULL);
-	g_free(data);
-
-	return content_type;
-}
-
 /* Copied from gedit-utils.c */
 void
 gitg_utils_menu_position_under_widget (GtkMenu  *menu,
@@ -479,66 +285,61 @@ gitg_utils_menu_position_under_tree_view (GtkMenu  *menu,
 }
 
 gchar *
-gitg_utils_get_monospace_font_name (void)
+gitg_utils_rewrite_hunk_counters (gchar const *header,
+                                  guint old_count,
+                                  guint new_count)
 {
-	GConfClient *client = gconf_client_get_default();
-	gchar *name = gconf_client_get_string(client, "/desktop/gnome/interface/monospace_font_name", NULL);
+	if (!header)
+	{
+		return NULL;
+	}
 
-	g_object_unref(client);
+	gchar *copy = g_strdup (header);
+	gchar *ptr1 = g_utf8_strchr (copy, -1, ',');
 
-	return name;
-}
+	if (!ptr1)
+	{
+		g_free (copy);
+		return NULL;
+	}
 
-void 
-gitg_utils_set_monospace_font(GtkWidget *widget)
-{
-	gchar *name = gitg_utils_get_monospace_font_name();
+	gchar *ptrs1 = g_utf8_strchr (ptr1 + 1, -1, ' ');
 
-	if (name)
+	if (!ptrs1)
 	{
-		PangoFontDescription *description = pango_font_description_from_string(name);
-
-		if (description)
-		{
-			gtk_widget_modify_font(widget, description);
-			pango_font_description_free(description);
-		}
+		g_free (copy);
+		return NULL;
 	}
 
-	g_free(name);
-}
+	gchar *ptr2 = g_utf8_strchr (ptrs1 + 1, -1, ',');
 
-GtkBuilder *
-gitg_utils_new_builder(gchar const *filename)
-{
-	GtkBuilder *b = gtk_builder_new();
-	GError *error = NULL;
+	if (!ptr2)
+	{
+		g_free (copy);
+		return NULL;
+	}
 
-	gchar *path = gitg_dirs_get_data_filename("ui", filename, NULL);
+	gchar *ptrs2 = g_utf8_strchr (ptr2 + 1, -1, ' ');
 
-	if (!gtk_builder_add_from_file(b, path, &error))
+	if (!ptrs2)
 	{
-		g_critical("Could not open UI file: %s (%s)", path, error->message);
-		g_error_free(error);
-
-		g_free(path);
-		exit(1);
+		g_free (copy);
+		return NULL;
 	}
 
-	g_free(path);
-	return b;
-}
+	*ptr1 = *ptr2 = '\0';
 
-gchar *
-gitg_utils_timestamp_to_str(guint64 timestamp)
-{
-	time_t t = timestamp;
+	gchar *ret;
 
-	struct tm *tms = localtime(&t);
-	gchar buf[255];
+	ret = g_strdup_printf ("%s,%d%s,%d%s",
+	                       copy,
+	                       old_count,
+	                       ptrs1,
+	                       new_count,
+	                       ptrs2);
 
-	strftime(buf, 254, "%c", tms);
-	return gitg_utils_convert_utf8(buf, -1);
+	g_free (copy);
+	return ret;
 }
 
 GtkCellRenderer *
@@ -645,64 +446,6 @@ gitg_utils_restore_pane_position (GtkPaned *paned, gint position, gboolean rever
 	                       G_CONNECT_AFTER);
 }
 
-gchar *
-gitg_utils_rewrite_hunk_counters (gchar const *header,
-                                  guint old_count,
-                                  guint new_count)
-{
-	if (!header)
-	{
-		return NULL;
-	}
-
-	gchar *copy = g_strdup (header);
-	gchar *ptr1 = g_utf8_strchr (copy, -1, ',');
-
-	if (!ptr1)
-	{
-		g_free (copy);
-		return NULL;
-	}
-
-	gchar *ptrs1 = g_utf8_strchr (ptr1 + 1, -1, ' ');
-
-	if (!ptrs1)
-	{
-		g_free (copy);
-		return NULL;
-	}
-
-	gchar *ptr2 = g_utf8_strchr (ptrs1 + 1, -1, ',');
-
-	if (!ptr2)
-	{
-		g_free (copy);
-		return NULL;
-	}
-
-	gchar *ptrs2 = g_utf8_strchr (ptr2 + 1, -1, ' ');
-
-	if (!ptrs2)
-	{
-		g_free (copy);
-		return NULL;
-	}
-
-	*ptr1 = *ptr2 = '\0';
-
-	gchar *ret;
-
-	ret = g_strdup_printf ("%s,%d%s,%d%s",
-	                       copy,
-	                       old_count,
-	                       ptrs1,
-	                       new_count,
-	                       ptrs2);
-
-	g_free (copy);
-	return ret;
-}
-
 void
 gitg_utils_rounded_rectangle(cairo_t *ctx, gdouble x, gdouble y, gdouble width, gdouble height, gdouble radius)
 {
diff --git a/gitg/gitg-utils.h b/gitg/gitg-utils.h
index ff1dec0..e5f5e42 100644
--- a/gitg/gitg-utils.h
+++ b/gitg/gitg-utils.h
@@ -25,54 +25,36 @@
 
 #include <glib.h>
 #include <gtksourceview/gtksourcelanguagemanager.h>
-#include <gio/gio.h>
+#include <gtksourceview/gtksourcelanguage.h>
 
-#include "gitg-repository.h"
-#include "gitg-revision.h"
+#include <libgitg/gitg-repository.h>
+#include <libgitg/gitg-revision.h>
 
-void gitg_utils_sha1_to_hash(gchar const *sha, gchar *hash);
-void gitg_utils_hash_to_sha1(gchar const *hash, gchar *sha);
-
-void gitg_utils_partial_sha1_to_hash (gchar const *sha, gint length, gchar *hash);
-
-gchar *gitg_utils_sha1_to_hash_new(gchar const *sha);
-gchar *gitg_utils_hash_to_sha1_new(gchar const *hash);
-
-gchar *gitg_utils_partial_sha1_to_hash_new (gchar const *sha, gint length, gint *retlen);
-
-GFile *gitg_utils_find_dot_git (GFile *location);
+gchar *gitg_utils_get_content_type(GFile *file);
+gboolean gitg_utils_can_display_content_type(gchar const *content_type);
+gchar *gitg_utils_guess_content_type(GtkTextBuffer *buffer);
 
 gboolean gitg_utils_export_files(GitgRepository *repository, GitgRevision *revision,
 gchar const *todir, gchar * const *paths);
 
-gchar *gitg_utils_convert_utf8(gchar const *str, gssize size);
+GtkSourceLanguage *gitg_utils_get_language(gchar const *filename, gchar const *content_type);
 
-guint gitg_utils_hash_hash(gconstpointer v);
-gboolean gitg_utils_hash_equal(gconstpointer a, gconstpointer b);
-gint gitg_utils_null_length(gconstpointer *ptr);
+gchar *gitg_utils_get_monospace_font_name(void);
+void gitg_utils_set_monospace_font(GtkWidget *widget);
 
-gchar *gitg_utils_get_content_type(GFile *file);
-GtkSourceLanguage *gitg_utils_get_language(gchar const *filename, gchar const *content_type);
-gboolean gitg_utils_can_display_content_type(gchar const *content_type);
-gchar *gitg_utils_guess_content_type(GtkTextBuffer *buffer);
+GtkBuilder *gitg_utils_new_builder(gchar const *filename);
 
 gint gitg_utils_sort_names(gchar const *s1, gchar const *s2);
 
 void gitg_utils_menu_position_under_widget(GtkMenu *menu, gint *x, gint *y,	gboolean *push_in, gpointer user_data);
 void gitg_utils_menu_position_under_tree_view(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer user_data);
 
-gchar *gitg_utils_get_monospace_font_name (void);
-void gitg_utils_set_monospace_font(GtkWidget *widget);
-
-gchar *gitg_utils_timestamp_to_str(guint64 timestamp);
+gchar *gitg_utils_rewrite_hunk_counters (gchar const *hunk, guint old_count, guint new_count);
 
-GtkBuilder *gitg_utils_new_builder(gchar const *filename);
 GtkCellRenderer *gitg_utils_find_cell_at_pos (GtkTreeView *tree_view, GtkTreeViewColumn *column, GtkTreePath *path, gint x);
 
 void gitg_utils_restore_pane_position (GtkPaned *paned, gint position, gboolean reversed);
 
-gchar *gitg_utils_rewrite_hunk_counters (gchar const *hunk, guint old_count, guint new_count);
 void gitg_utils_rounded_rectangle (cairo_t *ctx, gdouble x, gdouble y, gdouble width, gdouble height, gdouble radius);
 
-
 #endif /* __GITG_UTILS_H__ */
diff --git a/gitg/gitg-window.c b/gitg/gitg-window.c
index ac55e82..72994ab 100644
--- a/gitg/gitg-window.c
+++ b/gitg/gitg-window.c
@@ -24,13 +24,15 @@
 #include <string.h>
 #include <stdlib.h>
 #include <glib/gi18n.h>
+#include <libgitg/gitg-config.h>
+#include <libgitg/gitg-ref.h>
+#include <libgitg/gitg-runner.h>
+#include <libgitg/gitg-hash.h>
 
 #include "config.h"
 
+#include "gitg-data-binding.h"
 #include "gitg-dirs.h"
-#include "gitg-ref.h"
-#include "gitg-utils.h"
-#include "gitg-runner.h"
 #include "gitg-window.h"
 #include "gitg-revision-view.h"
 #include "gitg-revision-tree-view.h"
@@ -42,7 +44,7 @@
 #include "gitg-dnd.h"
 #include "gitg-branch-actions.h"
 #include "gitg-preferences.h"
-#include "gitg-config.h"
+#include "gitg-utils.h"
 
 #define DYNAMIC_ACTION_DATA_KEY "GitgDynamicActionDataKey"
 #define DYNAMIC_ACTION_DATA_REMOTE_KEY "GitgDynamicActionDataRemoteKey"
@@ -971,7 +973,7 @@ gitg_window_set_select_on_load (GitgWindow  *window,
 
 	if (resolved && strlen (resolved) == HASH_SHA_SIZE)
 	{
-		gitg_utils_sha1_to_hash (resolved, window->priv->select_on_load);
+		gitg_hash_sha1_to_hash (resolved, window->priv->select_on_load);
 	}
 
 	g_free (resolved);
@@ -1021,6 +1023,85 @@ parse_gitg_uri (GFile *file, GFile **work_tree, gchar **selection)
 }
 
 static gboolean
+convert_setting_to_inactive_max(GValue const *setting, GValue *value, gpointer userdata)
+{
+	g_return_val_if_fail(G_VALUE_HOLDS(setting, G_TYPE_INT), FALSE);
+	g_return_val_if_fail(G_VALUE_HOLDS(value, G_TYPE_INT), FALSE);
+
+	gint s = g_value_get_int(setting);
+	g_value_set_int(value, 2 + s * 8);
+
+	return TRUE;
+}
+
+static gboolean
+convert_setting_to_inactive_collapse(GValue const *setting, GValue *value, gpointer userdata)
+{
+	g_return_val_if_fail(G_VALUE_HOLDS(setting, G_TYPE_INT), FALSE);
+	g_return_val_if_fail(G_VALUE_HOLDS(value, G_TYPE_INT), FALSE);
+
+	gint s = g_value_get_int(setting);
+	g_value_set_int(value, 1 + s * 3);
+
+	return TRUE;
+}
+
+static gboolean
+convert_setting_to_inactive_gap(GValue const *setting, GValue *value, gpointer userdata)
+{
+	g_return_val_if_fail(G_VALUE_HOLDS(setting, G_TYPE_INT), FALSE);
+	g_return_val_if_fail(G_VALUE_HOLDS(value, G_TYPE_INT), FALSE);
+
+	g_value_set_int(value, 10);
+
+	return TRUE;
+}
+
+static gboolean
+convert_setting_to_inactive_enabled(GValue const *setting, GValue *value, gpointer userdata)
+{
+	g_return_val_if_fail(G_VALUE_HOLDS(setting, G_TYPE_BOOLEAN), FALSE);
+	g_return_val_if_fail(G_VALUE_HOLDS(value, G_TYPE_BOOLEAN), FALSE);
+
+	gboolean s = g_value_get_boolean(setting);
+	g_value_set_boolean(value, s);
+
+	return TRUE;
+}
+
+
+static void
+bind_repository(GitgWindow *window)
+{
+	GitgPreferences *preferences;
+
+	if (window->priv->repository == NULL)
+		return;
+
+	preferences = gitg_preferences_get_default();
+
+	gitg_data_binding_new_full(preferences, "history-collapse-inactive-lanes",
+				   window->priv->repository, "inactive-max",
+				   convert_setting_to_inactive_max,
+				   window);
+
+	gitg_data_binding_new_full(preferences, "history-collapse-inactive-lanes",
+				   window->priv->repository, "inactive-collapse",
+				   convert_setting_to_inactive_collapse,
+				   window);
+
+	gitg_data_binding_new_full(preferences, "history-collapse-inactive-lanes",
+				   window->priv->repository, "inactive-gap",
+				   convert_setting_to_inactive_gap,
+				   window);
+
+	gitg_data_binding_new_full(preferences, "history-collapse-inactive-lanes-active",
+	                           window->priv->repository, "inactive-enabled",
+	                           convert_setting_to_inactive_enabled,
+	                           window);
+}
+
+static gboolean
 create_repository (GitgWindow  *window,
                    GFile       *git_dir,
                    GFile       *work_tree,
@@ -1038,6 +1119,8 @@ create_repository (GitgWindow  *window,
 		gitg_window_set_select_on_load (window, selection);
 	}
 
+	bind_repository (window);
+
 	return window->priv->repository != NULL;
 }
 
@@ -1487,6 +1570,38 @@ gitg_window_load_repository (GitgWindow *window,
 	                        selection);
 }
 
+static GFile *
+find_dot_git (GFile *location)
+{
+	location = g_file_dup (location);
+
+	do
+	{
+		GFile *tmp;
+		gboolean exists;
+
+		tmp = g_file_get_child (location, ".git");
+		exists = g_file_query_exists (tmp, NULL);
+
+		if (exists)
+		{
+			g_object_unref (location);
+			location = tmp;
+
+			break;
+		}
+
+		g_object_unref (tmp);
+
+		tmp = g_file_get_parent (location);
+
+		g_object_unref (location);
+		location = tmp;
+	} while (location != NULL);
+
+	return location;
+}
+
 static gboolean
 load_repository_for_command_line (GitgWindow *window,
                                   gint argc,
@@ -1504,7 +1619,7 @@ load_repository_for_command_line (GitgWindow *window,
 
 		if (!parse_gitg_uri (first_arg, &work_tree, &sel))
 		{
-			git_dir = gitg_utils_find_dot_git (first_arg);
+			git_dir = find_dot_git (first_arg);
 		}
 
 		if (git_dir || (work_tree && g_file_query_exists (work_tree, NULL)))
@@ -1526,7 +1641,7 @@ load_repository_for_command_line (GitgWindow *window,
 		gchar *cwd = g_get_current_dir ();
 
 		GFile *file = g_file_new_for_path (cwd);
-		git_dir = gitg_utils_find_dot_git (file);
+		git_dir = find_dot_git (file);
 
 		g_free (cwd);
 		g_object_unref (file);
diff --git a/gitg/gitg-window.h b/gitg/gitg-window.h
index d7d0ffc..8ae26ef 100644
--- a/gitg/gitg-window.h
+++ b/gitg/gitg-window.h
@@ -24,7 +24,7 @@
 #define __GITG_WINDOW_H__
 
 #include <gtk/gtk.h>
-#include "gitg-repository.h"
+#include <libgitg/gitg-repository.h>
 
 G_BEGIN_DECLS
 
diff --git a/gitg/gitg.c b/gitg/gitg.c
index 21d8aea..555060e 100644
--- a/gitg/gitg.c
+++ b/gitg/gitg.c
@@ -27,8 +27,8 @@
 #include <string.h>
 #include <gtksourceview/gtksourcelanguagemanager.h>
 #include <gtksourceview/gtksourcestyleschememanager.h>
+#include <libgitg/gitg-debug.h>
 
-#include "gitg-debug.h"
 #include "gitg-window.h"
 #include "config.h"
 #include "gitg-settings.h"
diff --git a/libgitg/Makefile.am b/libgitg/Makefile.am
new file mode 100644
index 0000000..5fafe2a
--- /dev/null
+++ b/libgitg/Makefile.am
@@ -0,0 +1,84 @@
+lib_LTLIBRARIES = libgitg-1.0.la
+
+INCLUDES =								\
+	-I$(top_srcdir)							\
+	-I$(srcdir)							\
+	$(GITG_CFLAGS)							\
+	$(WARN_CFLAGS)							\
+	$(DISABLE_DEPRECATED_CFLAGS)					\
+	-DDATADIR=\""$(datadir)"\"					\
+	-DLIBDIR=\""$(libdir)"\"					\
+	-DGITG_LOCALEDIR=\""$(datadir)/locale"\"
+
+libgitg_1_0_la_LDFLAGS = \
+	-export-dynamic -no-undefined -export-symbols-regex "^[^_].*"
+
+libgitg_1_0_la_LIBADD = $(GITG_LIBS)
+
+BUILT_SOURCES =			\
+	gitg-enum-types.h	\
+	gitg-enum-types.c
+
+INST_H_FILES =			\
+	$(BUILT_H_FILES)	\
+	gitg-changed-file.h	\
+	gitg-commit.h		\
+	gitg-hash.h		\
+	gitg-lane.h		\
+	gitg-ref.h		\
+	gitg-repository.h	\
+	gitg-revision.h		\
+	gitg-runner.h		\
+	gitg-types.h
+
+NOINST_H_FILES =		\
+	gitg-color.h		\
+	gitg-config.h		\
+	gitg-convert.h		\
+	gitg-debug.h		\
+	gitg-i18n.h		\
+	gitg-lanes.h
+
+C_FILES =			\
+	$(BUILT_SOURCES)	\
+	gitg-changed-file.c	\
+	gitg-color.c		\
+	gitg-commit.c		\
+	gitg-config.c		\
+	gitg-convert.c		\
+	gitg-debug.c		\
+	gitg-hash.c		\
+	gitg-i18n.c		\
+	gitg-lane.c		\
+	gitg-lanes.c		\
+	gitg-ref.c		\
+	gitg-repository.c	\
+	gitg-revision.c		\
+	gitg-runner.c
+
+ENUM_H_FILES =			\
+	gitg-changed-file.h
+
+libgitg_1_0_la_SOURCES = 	\
+	$(INST_H_FILES)		\
+	$(NOINST_H_FILES)	\
+	$(C_FILES)
+
+headerdir = $(prefix)/include/libgitg-1.0/libgitg
+header_DATA = $(INST_H_FILES)
+
+EXTRA_DIST = 				\
+	gitg-enum-types.h.template	\
+	gitg-enum-types.c.template
+
+CLEANFILES = $(BUILT_SOURCES)
+
+dist-hook:
+	cd $(distdir); rm -f $(BUILT_SOURCES)
+
+gitg-enum-types.h: gitg-enum-types.h.template $(ENUM_H_FILES) $(GLIB_MKENUMS)
+	$(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template gitg-enum-types.h.template $(ENUM_H_FILES)) > $@
+
+gitg-enum-types.c: gitg-enum-types.c.template $(ENUM_H_FILES) $(GLIB_MKENUMS)
+	$(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template gitg-enum-types.c.template $(ENUM_H_FILES)) > $@
+
diff --git a/gitg/gitg-changed-file.c b/libgitg/gitg-changed-file.c
similarity index 100%
rename from gitg/gitg-changed-file.c
rename to libgitg/gitg-changed-file.c
diff --git a/gitg/gitg-changed-file.h b/libgitg/gitg-changed-file.h
similarity index 100%
rename from gitg/gitg-changed-file.h
rename to libgitg/gitg-changed-file.h
diff --git a/gitg/gitg-color.c b/libgitg/gitg-color.c
similarity index 100%
rename from gitg/gitg-color.c
rename to libgitg/gitg-color.c
diff --git a/gitg/gitg-color.h b/libgitg/gitg-color.h
similarity index 72%
rename from gitg/gitg-color.h
rename to libgitg/gitg-color.h
index 2a3fd1f..729df37 100644
--- a/gitg/gitg-color.h
+++ b/libgitg/gitg-color.h
@@ -34,14 +34,14 @@ struct _GitgColor
 	gint8 index;
 };
 
-void gitg_color_reset (void);
-void gitg_color_get (GitgColor *color, gdouble *r, gdouble *g, gdouble *b);
-void gitg_color_set_cairo_source (GitgColor *color, cairo_t *cr);
+void gitg_color_reset(void);
+void gitg_color_get(GitgColor *color, gdouble *r, gdouble *g, gdouble *b);
+void gitg_color_set_cairo_source(GitgColor *color, cairo_t *cr);
 
-GitgColor *gitg_color_next (void);
-GitgColor *gitg_color_next_index (GitgColor *color);
-GitgColor *gitg_color_ref (GitgColor *color);
-GitgColor *gitg_color_copy (GitgColor *color);
-GitgColor *gitg_color_unref (GitgColor *color);
+GitgColor *gitg_color_next(void);
+GitgColor *gitg_color_next_index(GitgColor *color);
+GitgColor *gitg_color_ref(GitgColor *color);
+GitgColor *gitg_color_copy(GitgColor *color);
+GitgColor *gitg_color_unref(GitgColor *color);
 
 #endif /* __GITG_COLOR_H__ */
diff --git a/gitg/gitg-commit.c b/libgitg/gitg-commit.c
similarity index 99%
rename from gitg/gitg-commit.c
rename to libgitg/gitg-commit.c
index 400d5ca..8f9d86b 100644
--- a/gitg/gitg-commit.c
+++ b/libgitg/gitg-commit.c
@@ -22,7 +22,6 @@
 
 #include "gitg-commit.h"
 #include "gitg-runner.h"
-#include "gitg-utils.h"
 #include "gitg-changed-file.h"
 #include "gitg-config.h"
 
diff --git a/gitg/gitg-commit.h b/libgitg/gitg-commit.h
similarity index 100%
rename from gitg/gitg-commit.h
rename to libgitg/gitg-commit.h
diff --git a/gitg/gitg-config.c b/libgitg/gitg-config.c
similarity index 100%
rename from gitg/gitg-config.c
rename to libgitg/gitg-config.c
diff --git a/gitg/gitg-config.h b/libgitg/gitg-config.h
similarity index 100%
rename from gitg/gitg-config.h
rename to libgitg/gitg-config.h
diff --git a/libgitg/gitg-convert.c b/libgitg/gitg-convert.c
new file mode 100644
index 0000000..4978410
--- /dev/null
+++ b/libgitg/gitg-convert.c
@@ -0,0 +1,118 @@
+/*
+ * gitg-convert.c
+ * This file is part of gitg - git repository viewer
+ *
+ * Copyright (C) 2009 - Jesse van den Kieboom
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "gitg-convert.h"
+
+#include <string.h>
+
+static void
+utf8_validate_fallback (gchar  *text,
+                        gssize  size)
+{
+	gchar const *end;
+
+	while (!g_utf8_validate (text, size, &end))
+	{
+		*((gchar *)end) = '?';
+	}
+}
+
+static gchar *
+convert_fallback (gchar const *text,
+                  gssize       size,
+                  gchar const *fallback)
+{
+	gchar *res;
+	gsize read, written;
+	GString *str = g_string_new ("");
+
+	while ((res = g_convert(text,
+	                        size,
+	                        "UTF-8",
+	                        "ASCII",
+	                        &read,
+	                        &written,
+	                        NULL)) == NULL)
+	{
+		res = g_convert (text, read, "UTF-8", "ASCII", NULL, NULL, NULL);
+		str = g_string_append (str, res);
+
+		str = g_string_append (str, fallback);
+		text = text + read + 1;
+		size = size - read;
+	}
+
+	str = g_string_append (str, res);
+	g_free (res);
+
+	utf8_validate_fallback (str->str, str->len);
+	return g_string_free (str, FALSE);
+}
+
+gchar *
+gitg_convert_utf8 (gchar const *str, gssize size)
+{
+	static gchar *encodings[] = {
+		"ISO-8859-15",
+		"ASCII"
+	};
+
+	if (str == NULL)
+	{
+		return NULL;
+	}
+
+	if (size == -1)
+	{
+		size = strlen (str);
+	}
+
+	if (g_utf8_validate (str, size, NULL))
+	{
+		return g_strndup (str, size);
+	}
+
+	int i;
+	for (i = 0; i < sizeof (encodings) / sizeof (gchar *); ++i)
+	{
+		gsize read;
+		gsize written;
+
+		gchar *ret = g_convert (str,
+		                        size,
+		                        "UTF-8",
+		                        encodings[i],
+		                        &read,
+		                        &written,
+		                        NULL);
+
+		if (ret && read == size)
+		{
+			utf8_validate_fallback (ret, written);
+			return ret;
+		}
+
+		g_free (ret);
+	}
+
+	return convert_fallback (str, size, "?");
+}
diff --git a/gitg/gitg-types.h b/libgitg/gitg-convert.h
similarity index 81%
copy from gitg/gitg-types.h
copy to libgitg/gitg-convert.h
index 28b3ac6..2e4cc0a 100644
--- a/gitg/gitg-types.h
+++ b/libgitg/gitg-convert.h
@@ -1,5 +1,5 @@
 /*
- * gitg-types.h
+ * gitg-convert.h
  * This file is part of gitg - git repository viewer
  *
  * Copyright (C) 2009 - Jesse van den Kieboom
@@ -20,15 +20,11 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __GITG_TYPES_H__
-#define __GITG_TYPES_H__
+#ifndef __GITG_CONVERT_H__
+#define __GITG_CONVERT_H__
 
 #include <glib.h>
 
-#define HASH_BINARY_SIZE 20
-#define HASH_SHA_SIZE 40
-
-typedef gchar Hash[HASH_BINARY_SIZE];
-
-#endif /* __GITG_TYPES_H__ */
+gchar *gitg_convert_utf8(gchar const *str, gssize size);
 
+#endif /* __GITG_CONVERT_H__ */
diff --git a/gitg/gitg-debug.c b/libgitg/gitg-debug.c
similarity index 100%
rename from gitg/gitg-debug.c
rename to libgitg/gitg-debug.c
diff --git a/gitg/gitg-debug.h b/libgitg/gitg-debug.h
similarity index 100%
copy from gitg/gitg-debug.h
copy to libgitg/gitg-debug.h
diff --git a/gitg/gitg-enum-types.c.template b/libgitg/gitg-enum-types.c.template
similarity index 100%
rename from gitg/gitg-enum-types.c.template
rename to libgitg/gitg-enum-types.c.template
diff --git a/gitg/gitg-enum-types.h.template b/libgitg/gitg-enum-types.h.template
similarity index 100%
rename from gitg/gitg-enum-types.h.template
rename to libgitg/gitg-enum-types.h.template
diff --git a/libgitg/gitg-hash.c b/libgitg/gitg-hash.c
new file mode 100644
index 0000000..fe4007e
--- /dev/null
+++ b/libgitg/gitg-hash.c
@@ -0,0 +1,137 @@
+/*
+ * gitg-hash.c
+ * This file is part of gitg - git repository viewer
+ *
+ * Copyright (C) 2009 - Jesse van den Kieboom
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <string.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <math.h>
+
+#include "gitg-hash.h"
+#include "gitg-types.h"
+
+inline static guint8
+atoh(gchar c)
+{
+	if (c >= 'a')
+		return c - 'a' + 10;
+	if (c >= 'A')
+		return c - 'A' + 10;
+
+	return c - '0';
+}
+
+void
+gitg_hash_partial_sha1_to_hash(gchar const *sha, gint length, gchar *hash)
+{
+	if (length % 2 == 1)
+	{
+		--length;
+	}
+
+	int i;
+
+	for (i = 0; i < length / 2; ++i)
+	{
+		gchar h = atoh(*(sha++)) << 4;
+		hash[i] = h | atoh(*(sha++));
+	}
+}
+
+void
+gitg_hash_sha1_to_hash(gchar const *sha, gchar *hash)
+{
+	gitg_hash_partial_sha1_to_hash (sha, HASH_SHA_SIZE, hash);
+}
+
+void
+gitg_hash_hash_to_sha1(gchar const *hash, gchar *sha)
+{
+	char const *repr = "0123456789abcdef";
+	int i;
+	int pos = 0;
+
+	for (i = 0; i < HASH_BINARY_SIZE; ++i)
+	{
+		sha[pos++] = repr[(hash[i] >> 4) & 0x0f];
+		sha[pos++] = repr[(hash[i] & 0x0f)];
+	}
+}
+
+gchar *
+gitg_hash_hash_to_sha1_new(gchar const *hash)
+{
+	gchar *ret = g_new(gchar, HASH_SHA_SIZE + 1);
+	gitg_hash_hash_to_sha1(hash, ret);
+
+	ret[HASH_SHA_SIZE] = '\0';
+	return ret;
+}
+
+gchar *
+gitg_hash_partial_sha1_to_hash_new (gchar const *sha, gint length, gint *retlen)
+{
+	if (length == -1)
+	{
+		length = strlen (sha);
+	}
+
+	if (length % 2 != 0)
+	{
+		--length;
+	}
+
+	*retlen = length / 2;
+	gchar *ret = g_new (gchar, *retlen);
+
+	gitg_hash_partial_sha1_to_hash (sha, length, ret);
+
+	return ret;
+}
+
+gchar *
+gitg_hash_sha1_to_hash_new(gchar const *sha1)
+{
+	gchar *ret = g_new(gchar, HASH_BINARY_SIZE);
+	gitg_hash_sha1_to_hash(sha1, ret);
+
+	return ret;
+}
+
+guint
+gitg_hash_hash(gconstpointer v)
+{
+	/* 31 bit hash function, copied from g_str_hash */
+	const signed char *p = v;
+	guint32 h = *p;
+	int i;
+
+	for (i = 1; i < HASH_BINARY_SIZE; ++i)
+		h = (h << 5) - h + p[i];
+
+	return h;
+}
+
+gboolean 
+gitg_hash_hash_equal(gconstpointer a, gconstpointer b)
+{
+	return memcmp(a, b, HASH_BINARY_SIZE) == 0;
+}
diff --git a/gitg/gitg-debug.h b/libgitg/gitg-hash.h
similarity index 58%
rename from gitg/gitg-debug.h
rename to libgitg/gitg-hash.h
index 5c5a493..2b2fe4b 100644
--- a/gitg/gitg-debug.h
+++ b/libgitg/gitg-hash.h
@@ -1,5 +1,5 @@
 /*
- * gitg-debug.h
+ * gitg-hash.h
  * This file is part of gitg - git repository viewer
  *
  * Copyright (C) 2009 - Jesse van den Kieboom
@@ -20,19 +20,22 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __GITG_DEBUG_H__
-#define __GITG_DEBUG_H__
+#ifndef __GITG_HASH_H__
+#define __GITG_HASH_H__
 
 #include <glib.h>
 
-enum
-{
-	GITG_DEBUG_NONE = 0,
-	GITG_DEBUG_RUNNER = 1 << 0
-};
+void gitg_hash_sha1_to_hash(gchar const *sha, gchar *hash);
+void gitg_hash_hash_to_sha1(gchar const *hash, gchar *sha);
 
-void gitg_debug_init (void);
-gboolean gitg_debug_enabled (guint debug);
+void gitg_hash_partial_sha1_to_hash (gchar const *sha, gint length, gchar *hash);
 
-#endif /* __GITG_DEBUG_H__ */
+gchar *gitg_hash_sha1_to_hash_new(gchar const *sha);
+gchar *gitg_hash_hash_to_sha1_new(gchar const *hash);
 
+gchar *gitg_hash_partial_sha1_to_hash_new (gchar const *sha, gint length, gint *retlen);
+
+guint gitg_hash_hash(gconstpointer v);
+gboolean gitg_hash_hash_equal(gconstpointer a, gconstpointer b);
+
+#endif /* __GITG_HASH_H__ */
diff --git a/libgitg/gitg-i18n.c b/libgitg/gitg-i18n.c
new file mode 100644
index 0000000..359c2f2
--- /dev/null
+++ b/libgitg/gitg-i18n.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
+ * All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+
+#include "gitg-i18n.h"
+
+/**
+ * _gitg_gettext:
+ * @msgid: The string to be translated
+ *
+ * Returns the translated string from the libgitg translations.
+ * This is an internal function and should only be used by
+ * the internals of libgitg
+ *
+ * Returns: the transation of @msgid to the current locale
+ */
+const gchar *
+_gitg_gettext (const gchar *msgid)
+{
+	static gboolean initialized = FALSE;
+
+	if (G_UNLIKELY (!initialized))
+	{
+		bindtextdomain (GETTEXT_PACKAGE, GITG_LOCALEDIR);
+		bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+		initialized = TRUE;
+	}
+
+	return g_dgettext (GETTEXT_PACKAGE, msgid);
+}
diff --git a/libgitg/gitg-i18n.h b/libgitg/gitg-i18n.h
new file mode 100644
index 0000000..18ddc07
--- /dev/null
+++ b/libgitg/gitg-i18n.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
+ * All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/*
+ * Handles all of the internationalization configuration options.
+ * Author: Tom Tromey <tromey creche cygnus com>
+ *
+ * This is a modified version of gtksourceview-i18n.h
+ */
+
+#ifndef __PEAS_18N_H__
+#define __PEAS_18N_H__
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+#ifdef ENABLE_NLS
+#    include <libintl.h>
+#    undef _
+#    define _(String) _gitg_gettext (String)
+#    undef N_
+#    ifdef gettext_noop
+#        define N_(String) gettext_noop (String)
+#    else
+#        define N_(String) (String)
+#    endif
+#else
+/* Stubs that do something close enough.  */
+#    undef textdomain
+#    define textdomain(String) (String)
+#    undef gettext
+#    define gettext(String) (String)
+#    undef dgettext
+#    define dgettext(Domain,Message) (Message)
+#    undef dcgettext
+#    define dcgettext(Domain,Message,Type) (Message)
+#    undef bindtextdomain
+#    define bindtextdomain(Domain,Directory) (Domain)
+#    undef bind_textdomain_codeset
+#    define bind_textdomain_codeset(Domain,CodeSet) (Domain)
+#    undef _
+#    define _(String) (String)
+#    undef N_
+#    define N_(String) (String)
+#endif
+
+const gchar *_gitg_gettext (const char *msgid) G_GNUC_FORMAT(1);
+
+G_END_DECLS
+
+#endif /* __PEAS_I18N_H__ */
diff --git a/gitg/gitg-lane.c b/libgitg/gitg-lane.c
similarity index 100%
rename from gitg/gitg-lane.c
rename to libgitg/gitg-lane.c
diff --git a/gitg/gitg-lane.h b/libgitg/gitg-lane.h
similarity index 100%
rename from gitg/gitg-lane.h
rename to libgitg/gitg-lane.h
diff --git a/gitg/gitg-lanes.c b/libgitg/gitg-lanes.c
similarity index 98%
rename from gitg/gitg-lanes.c
rename to libgitg/gitg-lanes.c
index a1a73ad..387073f 100644
--- a/gitg/gitg-lanes.c
+++ b/libgitg/gitg-lanes.c
@@ -21,7 +21,7 @@
  */
 
 #include "gitg-lanes.h"
-#include "gitg-utils.h"
+#include "gitg-hash.h"
 #include <string.h>
 
 #define GITG_LANES_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), GITG_TYPE_LANES, GitgLanesPrivate))
@@ -120,7 +120,7 @@ find_lane_by_hash(GitgLanes *lanes, gchar const *hash, gint8 *pos)
 	{
 		LaneContainer *container = (LaneContainer *)(item->data);
 
-		if (container && container->to && gitg_utils_hash_equal(container->to, hash))
+		if (container && container->to && gitg_hash_hash_equal(container->to, hash))
 		{
 			if (pos)
 				*pos = p;
@@ -246,7 +246,7 @@ static void
 gitg_lanes_init(GitgLanes *self)
 {
 	self->priv = GITG_LANES_GET_PRIVATE(self);
-	self->priv->collapsed = g_hash_table_new_full(gitg_utils_hash_hash, gitg_utils_hash_equal, NULL, (GDestroyNotify)collapsed_lane_free);
+	self->priv->collapsed = g_hash_table_new_full(gitg_hash_hash, gitg_hash_hash_equal, NULL, (GDestroyNotify)collapsed_lane_free);
 }
 
 GitgLanes *
diff --git a/gitg/gitg-lanes.h b/libgitg/gitg-lanes.h
similarity index 100%
rename from gitg/gitg-lanes.h
rename to libgitg/gitg-lanes.h
diff --git a/gitg/gitg-ref.c b/libgitg/gitg-ref.c
similarity index 98%
rename from gitg/gitg-ref.c
rename to libgitg/gitg-ref.c
index 42b8506..1dca7ee 100644
--- a/gitg/gitg-ref.c
+++ b/libgitg/gitg-ref.c
@@ -21,7 +21,7 @@
  */
 
 #include "gitg-ref.h"
-#include "gitg-utils.h"
+#include "gitg-hash.h"
 #include <string.h>
 
 typedef struct 
@@ -64,7 +64,7 @@ gitg_ref_new(gchar const *hash, gchar const *name)
 {
 	GitgRef *inst = g_slice_new0(GitgRef);
 
-	gitg_utils_sha1_to_hash(hash, inst->hash);
+	gitg_hash_sha1_to_hash(hash, inst->hash);
 	inst->name = g_strdup(name);
 
 	PrefixTypeMap map[] = {
diff --git a/gitg/gitg-ref.h b/libgitg/gitg-ref.h
similarity index 100%
rename from gitg/gitg-ref.h
rename to libgitg/gitg-ref.h
diff --git a/gitg/gitg-repository.c b/libgitg/gitg-repository.c
similarity index 87%
rename from gitg/gitg-repository.c
rename to libgitg/gitg-repository.c
index 4ab5883..2c33051 100644
--- a/gitg/gitg-repository.c
+++ b/libgitg/gitg-repository.c
@@ -21,12 +21,10 @@
  */
 
 #include "gitg-repository.h"
-#include "gitg-utils.h"
+#include "gitg-hash.h"
 #include "gitg-lanes.h"
 #include "gitg-ref.h"
 #include "gitg-types.h"
-#include "gitg-preferences.h"
-#include "gitg-data-binding.h"
 #include "gitg-config.h"
 
 #include <gio/gio.h>
@@ -46,10 +44,18 @@ G_DEFINE_TYPE_EXTENDED(GitgRepository, gitg_repository, G_TYPE_OBJECT, 0,
 enum
 {
 	PROP_0,
-
 	PROP_WORK_TREE,
 	PROP_GIT_DIR,
-	PROP_LOADER
+	PROP_PATH,
+	PROP_LOADER,
+	PROP_SHOW_STAGED,
+	PROP_SHOW_UNSTAGED,
+	PROP_SHOW_STASH,
+	PROP_TOPO_ORDER,
+	PROP_INACTIVE_MAX,
+	PROP_INACTIVE_COLLAPSE,
+	PROP_INACTIVE_GAP,
+	PROP_INACTIVE_ENABLED
 };
 
 /* Signals */
@@ -112,6 +118,11 @@ struct _GitgRepositoryPrivate
 	LoadStage load_stage;
 
 	GFileMonitor *monitor;
+
+	guint show_staged : 1;
+	guint show_unstaged : 1;
+	guint show_stash : 1;
+	guint topoorder : 1;
 };
 
 inline static gint
@@ -218,7 +229,7 @@ tree_model_get_value(GtkTreeModel *tree_model, GtkTreeIter *iter, gint column, G
 			g_value_set_string(value, gitg_revision_get_author(rv));
 		break;
 		case DATE_COLUMN:
-			g_value_take_string(value, gitg_utils_timestamp_to_str(gitg_revision_get_timestamp(rv)));
+			g_value_take_string(value, gitg_revision_get_timestamp_for_display(rv));
 		break;
 		default:
 			g_assert_not_reached();
@@ -441,6 +452,38 @@ gitg_repository_set_property(GObject *object, guint prop_id, GValue const *value
 
 			self->priv->git_dir = g_value_dup_object (value);
 		break;
+		case PROP_SHOW_STAGED:
+			self->priv->show_staged = g_value_get_boolean(value);
+		break;
+		case PROP_SHOW_UNSTAGED:
+			self->priv->show_unstaged = g_value_get_boolean(value);
+		break;
+		case PROP_SHOW_STASH:
+			self->priv->show_stash = g_value_get_boolean(value);
+		break;
+		case PROP_TOPO_ORDER:
+			self->priv->topoorder = g_value_get_boolean(value);
+		break;
+		case PROP_INACTIVE_MAX:
+			g_object_set_property(G_OBJECT(self->priv->lanes),
+			                      "inactive-max",
+			                      value);
+		break;
+		case PROP_INACTIVE_COLLAPSE:
+			g_object_set_property(G_OBJECT(self->priv->lanes),
+			                      "inactive-collapse",
+			                      value);
+		break;
+		case PROP_INACTIVE_GAP:
+			g_object_set_property(G_OBJECT(self->priv->lanes),
+			                      "inactive-gap",
+			                      value);
+		break;
+		case PROP_INACTIVE_ENABLED:
+			g_object_set_property(G_OBJECT(self->priv->lanes),
+			                      "inactive-enabled",
+			                      value);
+		break;
 		default:
 			G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
 		break;
@@ -464,6 +507,38 @@ gitg_repository_get_property(GObject *object, guint prop_id, GValue *value, GPar
 		case PROP_LOADER:
 			g_value_set_object(value, self->priv->loader);
 		break;
+		case PROP_SHOW_STAGED:
+			g_value_set_boolean(value, self->priv->show_staged);
+		break;
+		case PROP_SHOW_UNSTAGED:
+			g_value_set_boolean(value, self->priv->show_unstaged);
+		break;
+		case PROP_SHOW_STASH:
+			g_value_set_boolean(value, self->priv->show_stash);
+		break;
+		case PROP_TOPO_ORDER:
+			g_value_set_boolean(value, self->priv->topoorder);
+		break;
+		case PROP_INACTIVE_MAX:
+			g_object_get_property(G_OBJECT(self->priv->lanes),
+			                      "inactive-max",
+			                      value);
+		break;
+		case PROP_INACTIVE_COLLAPSE:
+			g_object_get_property(G_OBJECT(self->priv->lanes),
+			                      "inactive-collapse",
+			                      value);
+		break;
+		case PROP_INACTIVE_GAP:
+			g_object_get_property(G_OBJECT(self->priv->lanes),
+			                      "inactive-gap",
+			                      value);
+		break;
+		case PROP_INACTIVE_ENABLED:
+			g_object_get_property(G_OBJECT(self->priv->lanes),
+			                      "inactive-enabled",
+			                      value);
+		break;
 		default:
 			G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
 		break;
@@ -614,6 +689,69 @@ gitg_repository_class_init(GitgRepositoryClass *klass)
 	                                                      GITG_TYPE_RUNNER,
 	                                                      G_PARAM_READABLE));
 
+	g_object_class_install_property(object_class, PROP_SHOW_STAGED,
+						 g_param_spec_boolean ("show-staged",
+								       "Show Staged",
+								       "Show staged",
+								       FALSE,
+								       G_PARAM_READWRITE));
+
+	g_object_class_install_property(object_class, PROP_SHOW_UNSTAGED,
+						 g_param_spec_boolean ("show-unstaged",
+								       "Show Unstaged",
+								       "Show unstaged",
+								       FALSE,
+								       G_PARAM_READWRITE));
+
+	g_object_class_install_property(object_class, PROP_SHOW_STASH,
+						 g_param_spec_boolean ("show-stash",
+								       "Show Stash",
+								       "Show stash",
+								       FALSE,
+								       G_PARAM_READWRITE));
+
+	g_object_class_install_property(object_class, PROP_TOPO_ORDER,
+						 g_param_spec_boolean ("topo-order",
+								       "Topo order",
+								       "Show in topological order",
+								       FALSE,
+								       G_PARAM_READWRITE));
+
+	/* FIXME: gitg-lanes shouldn't be an object? */
+	g_object_class_install_property(object_class, PROP_INACTIVE_MAX,
+					 g_param_spec_int("inactive-max",
+							          "INACTIVE_MAX",
+							          "Maximum inactivity on a lane before collapsing",
+							          1,
+							          G_MAXINT,
+							          30,
+							          G_PARAM_READWRITE));
+
+	g_object_class_install_property(object_class, PROP_INACTIVE_COLLAPSE,
+					 g_param_spec_int("inactive-collapse",
+							          "INACTIVE_COLLAPSE",
+							          "Number of revisions to collapse",
+							          1,
+							          G_MAXINT,
+							          10,
+							          G_PARAM_READWRITE));
+
+	g_object_class_install_property(object_class, PROP_INACTIVE_GAP,
+					 g_param_spec_int("inactive-gap",
+							          "INACTIVE_GAP",
+							          "Minimum of revisions to leave between collapse and expand",
+							          1,
+							          G_MAXINT,
+							          10,
+							          G_PARAM_READWRITE));
+
+	g_object_class_install_property(object_class, PROP_INACTIVE_ENABLED,
+					 g_param_spec_boolean("inactive-enabled",
+							              "INACTIVE_ENABLED",
+							              "Lane collapsing enabled",
+							              TRUE,
+							              G_PARAM_READWRITE));
+
 	repository_signals[LOAD] =
 		g_signal_new ("load",
 			      G_OBJECT_CLASS_TYPE (object_class),
@@ -683,14 +821,11 @@ on_loader_end_loading(GitgRunner *object, gboolean cancelled, GitgRepository *re
 	}
 
 	LoadStage current = repository->priv->load_stage++;
-	GitgPreferences *preferences = gitg_preferences_get_default();
 	gboolean show_unstaged;
 	gboolean show_staged;
 
-	g_object_get(preferences,
-	             "history-show-virtual-staged", &show_staged,
-	             "history-show-virtual-unstaged", &show_unstaged,
-	             NULL);
+	show_unstaged = repository->priv->show_unstaged;
+	show_staged = repository->priv->show_staged;
 
 	switch (current)
 	{
@@ -779,10 +914,9 @@ static void
 loader_update_stash(GitgRepository *repository, gchar **buffer)
 {
 	gchar *line;
-	GitgPreferences *preferences = gitg_preferences_get_default();
 	gboolean show_stash;
 
-	g_object_get(preferences, "history-show-virtual-stash", &show_stash, NULL);
+	show_stash = repository->priv->show_stash;
 
 	if (!show_stash)
 		return;
@@ -906,61 +1040,10 @@ prepare_relane(GitgRepository *repository)
 		repository->priv->idle_relane_id = g_idle_add((GSourceFunc)repository_relane, repository);
 }
 
-static gboolean
-convert_setting_to_inactive_max(GValue const *setting, GValue *value, gpointer userdata)
-{
-	g_return_val_if_fail(G_VALUE_HOLDS(setting, G_TYPE_INT), FALSE);
-	g_return_val_if_fail(G_VALUE_HOLDS(value, G_TYPE_INT), FALSE);
-
-	gint s = g_value_get_int(setting);
-	g_value_set_int(value, 2 + s * 8);
-
-	prepare_relane(GITG_REPOSITORY(userdata));
-	return TRUE;
-}
-
-static gboolean
-convert_setting_to_inactive_collapse(GValue const *setting, GValue *value, gpointer userdata)
-{
-	g_return_val_if_fail(G_VALUE_HOLDS(setting, G_TYPE_INT), FALSE);
-	g_return_val_if_fail(G_VALUE_HOLDS(value, G_TYPE_INT), FALSE);
-
-	gint s = g_value_get_int(setting);
-	g_value_set_int(value, 1 + s * 3);
-
-	prepare_relane(GITG_REPOSITORY(userdata));
-	return TRUE;
-}
-
-static gboolean
-convert_setting_to_inactive_gap(GValue const *setting, GValue *value, gpointer userdata)
-{
-	g_return_val_if_fail(G_VALUE_HOLDS(setting, G_TYPE_INT), FALSE);
-	g_return_val_if_fail(G_VALUE_HOLDS(value, G_TYPE_INT), FALSE);
-
-	g_value_set_int(value, 10);
-
-	prepare_relane(GITG_REPOSITORY(userdata));
-	return TRUE;
-}
-
-static gboolean
-convert_setting_to_inactive_enabled(GValue const *setting, GValue *value, gpointer userdata)
-{
-	g_return_val_if_fail(G_VALUE_HOLDS(setting, G_TYPE_BOOLEAN), FALSE);
-	g_return_val_if_fail(G_VALUE_HOLDS(value, G_TYPE_BOOLEAN), FALSE);
-
-	gboolean s = g_value_get_boolean(setting);
-	g_value_set_boolean(value, s);
-
-	prepare_relane(GITG_REPOSITORY(userdata));
-	return TRUE;
-}
-
 static void
-on_update_virtual(GObject *object, GParamSpec *spec, GitgRepository *repository)
+on_lane_setting_changed(GitgRepository *repository, GParamSpec *pspec, gpointer useless)
 {
-	gitg_repository_reload (repository);
+	prepare_relane(repository);
 }
 
 static gchar **
@@ -994,10 +1077,9 @@ has_left_right(gchar const **av, int argc)
 static void
 build_log_args(GitgRepository *self, gint argc, gchar const **av)
 {
-	GitgPreferences *preferences = gitg_preferences_get_default ();
 	gboolean topoorder;
 
-	g_object_get (preferences, "history-topo-order", &topoorder, NULL);
+	topoorder = self->priv->topoorder;
 
 	gchar **argv = g_new0(gchar *, 6 + topoorder + (argc > 0 ? argc - 1 : 0));
 
@@ -1054,7 +1136,7 @@ build_log_args(GitgRepository *self, gint argc, gchar const **av)
 }
 
 static void
-on_update_topo_order(GObject *object, GParamSpec *spec, GitgRepository *repository)
+on_update_topo_order(GitgRepository *repository, GParamSpec *spec, gpointer useless)
 {
 	build_log_args (repository,
 	                g_strv_length (repository->priv->selection),
@@ -1064,49 +1146,9 @@ on_update_topo_order(GObject *object, GParamSpec *spec, GitgRepository *reposito
 }
 
 static void
-initialize_bindings(GitgRepository *repository)
+on_update_virtual(GitgRepository *repository, GParamSpec *spec, gpointer useless)
 {
-	GitgPreferences *preferences = gitg_preferences_get_default();
-
-	gitg_data_binding_new_full(preferences, "history-collapse-inactive-lanes",
-							   repository->priv->lanes, "inactive-max",
-							   convert_setting_to_inactive_max,
-							   repository);
-
-	gitg_data_binding_new_full(preferences, "history-collapse-inactive-lanes",
-							   repository->priv->lanes, "inactive-collapse",
-							   convert_setting_to_inactive_collapse,
-							   repository);
-
-	gitg_data_binding_new_full(preferences, "history-collapse-inactive-lanes",
-							   repository->priv->lanes, "inactive-gap",
-							   convert_setting_to_inactive_gap,
-							   repository);
-
-	gitg_data_binding_new_full(preferences, "history-collapse-inactive-lanes-active",
-	                           repository->priv->lanes, "inactive-enabled",
-	                           convert_setting_to_inactive_enabled,
-	                           repository);
-
-	g_signal_connect(preferences, 
-	                 "notify::history-show-virtual-stash",
-	                 G_CALLBACK(on_update_virtual),
-	                 repository);
-
-	g_signal_connect(preferences, 
-	                 "notify::history-show-virtual-unstaged",
-	                 G_CALLBACK(on_update_virtual),
-	                 repository);
-
-	g_signal_connect(preferences, 
-	                 "notify::history-show-virtual-staged",
-	                 G_CALLBACK(on_update_virtual),
-	                 repository);
-
-	g_signal_connect(preferences, 
-	                 "notify::history-topo-order",
-	                 G_CALLBACK(on_update_topo_order),
-	                 repository);
+	gitg_repository_reload(repository);
 }
 
 static void
@@ -1114,11 +1156,11 @@ gitg_repository_init(GitgRepository *object)
 {
 	object->priv = GITG_REPOSITORY_GET_PRIVATE (object);
 
-	object->priv->hashtable = g_hash_table_new (gitg_utils_hash_hash,
-	                                            gitg_utils_hash_equal);
+	object->priv->hashtable = g_hash_table_new (gitg_hash_hash,
+	                                            gitg_hash_hash_equal);
 
-	object->priv->ref_pushes = g_hash_table_new (gitg_utils_hash_hash,
-	                                             gitg_utils_hash_equal);
+	object->priv->ref_pushes = g_hash_table_new (gitg_hash_hash,
+	                                             gitg_hash_hash_equal);
 
 	object->priv->ref_names = g_hash_table_new (g_str_hash, g_str_equal);
 
@@ -1131,8 +1173,8 @@ gitg_repository_init(GitgRepository *object)
 	object->priv->grow_size = 1000;
 	object->priv->stamp = g_random_int ();
 
-	object->priv->refs = g_hash_table_new_full (gitg_utils_hash_hash,
-	                                            gitg_utils_hash_equal,
+	object->priv->refs = g_hash_table_new_full (gitg_hash_hash,
+	                                            gitg_hash_hash_equal,
 	                                            NULL,
 	                                            (GDestroyNotify)free_refs);
 
@@ -1148,7 +1190,45 @@ gitg_repository_init(GitgRepository *object)
 	                  G_CALLBACK (on_loader_end_loading),
 	                  object);
 
-	initialize_bindings (object);
+	g_signal_connect(object,
+	                 "notify::show-stash",
+	                 G_CALLBACK(on_update_virtual),
+	                 NULL);
+
+	g_signal_connect(object,
+	                 "notify::show-unstaged",
+	                 G_CALLBACK(on_update_virtual),
+	                 NULL);
+
+	g_signal_connect(object,
+	                 "notify::show-staged",
+	                 G_CALLBACK(on_update_virtual),
+	                 NULL);
+
+	g_signal_connect(object,
+	                 "notify::topo-order",
+	                 G_CALLBACK(on_update_topo_order),
+	                 NULL);
+
+	g_signal_connect(object,
+	                 "notify::inactive_mac",
+	                 G_CALLBACK(on_lane_setting_changed),
+	                 NULL);
+
+	g_signal_connect(object,
+	                 "notify::inactive_collapse",
+	                 G_CALLBACK(on_lane_setting_changed),
+	                 NULL);
+
+	g_signal_connect(object,
+	                 "notify::inactive_gap",
+	                 G_CALLBACK(on_lane_setting_changed),
+	                 NULL);
+
+	g_signal_connect(object,
+	                 "notify::inactive_enabled",
+	                 G_CALLBACK(on_lane_setting_changed),
+	                 NULL);
 }
 
 static void
diff --git a/gitg/gitg-repository.h b/libgitg/gitg-repository.h
similarity index 100%
rename from gitg/gitg-repository.h
rename to libgitg/gitg-repository.h
diff --git a/gitg/gitg-revision.c b/libgitg/gitg-revision.c
similarity index 92%
rename from gitg/gitg-revision.c
rename to libgitg/gitg-revision.c
index b71a391..e3b522c 100644
--- a/gitg/gitg-revision.c
+++ b/libgitg/gitg-revision.c
@@ -20,8 +20,9 @@
  * Boston, MA 02111-1307, USA.
  */
 
+#include "gitg-convert.h"
 #include "gitg-revision.h"
-#include "gitg-utils.h"
+#include "gitg-hash.h"
 
 struct _GitgRevision
 {
@@ -92,7 +93,7 @@ GitgRevision *gitg_revision_new(gchar const *sha,
 
 	rv->refcount = 1;
 
-	gitg_utils_sha1_to_hash(sha, rv->hash);
+	gitg_hash_sha1_to_hash(sha, rv->hash);
 	rv->author = g_strdup(author);
 	rv->subject = g_strdup(subject);
 	rv->timestamp = timestamp;
@@ -105,7 +106,7 @@ GitgRevision *gitg_revision_new(gchar const *sha,
 
 		gint i;
 		for (i = 0; i < num; ++i)
-			gitg_utils_sha1_to_hash(shas[i], rv->parents[i]);
+			gitg_hash_sha1_to_hash(shas[i], rv->parents[i]);
 
 		g_strfreev(shas);
 		rv->num_parents = num;
@@ -142,7 +143,7 @@ gchar *
 gitg_revision_get_sha1(GitgRevision *revision)
 {
 	char res[HASH_SHA_SIZE];
-	gitg_utils_hash_to_sha1(revision->hash, res);
+	gitg_hash_hash_to_sha1(revision->hash, res);
 
 	return g_strndup(res, HASH_SHA_SIZE);
 }
@@ -165,7 +166,7 @@ gitg_revision_get_parents(GitgRevision *revision)
 	for (i = 0; i < revision->num_parents; ++i)
 	{
 		ret[i] = g_new(gchar, HASH_SHA_SIZE + 1);
-		gitg_utils_hash_to_sha1(revision->parents[i], ret[i]);
+		gitg_hash_hash_to_sha1(revision->parents[i], ret[i]);
 
 		ret[i][HASH_SHA_SIZE] = '\0';
 	}
@@ -307,3 +308,15 @@ gitg_revision_get_format_patch_name (GitgRevision *revision)
 
 	return ret;
 }
+
+gchar *
+gitg_revision_get_timestamp_for_display(GitgRevision *revision)
+{
+	time_t t = gitg_revision_get_timestamp (revision);
+
+	struct tm *tms = localtime(&t);
+	gchar buf[255];
+
+	strftime(buf, 254, "%c", tms);
+	return gitg_convert_utf8(buf, -1);
+}
diff --git a/gitg/gitg-revision.h b/libgitg/gitg-revision.h
similarity index 97%
rename from gitg/gitg-revision.h
rename to libgitg/gitg-revision.h
index 8722a5d..1f67b00 100644
--- a/gitg/gitg-revision.h
+++ b/libgitg/gitg-revision.h
@@ -25,6 +25,7 @@
 
 #include <glib-object.h>
 #include "gitg-lane.h"
+#include "gitg-types.h"
 
 G_BEGIN_DECLS
 
@@ -32,8 +33,6 @@ G_BEGIN_DECLS
 #define GITG_REVISION(obj)				((GitgRevision *)obj)
 #define GITG_REVISION_CONST(obj)		((GitgRevision const *)obj)
 
-#include "gitg-types.h"
-
 typedef struct _GitgRevision		GitgRevision;
 
 GType gitg_revision_get_type (void) G_GNUC_CONST;
@@ -68,6 +67,8 @@ void gitg_revision_unref(GitgRevision *revision);
 
 gchar *gitg_revision_get_format_patch_name (GitgRevision *revision);
 
+gchar *gitg_revision_get_timestamp_for_display(GitgRevision *revision);
+
 G_END_DECLS
 
 #endif /* __GITG_REVISION_H__ */
diff --git a/gitg/gitg-runner.c b/libgitg/gitg-runner.c
similarity index 98%
rename from gitg/gitg-runner.c
rename to libgitg/gitg-runner.c
index c151ea0..08fecaf 100644
--- a/gitg/gitg-runner.c
+++ b/libgitg/gitg-runner.c
@@ -20,12 +20,13 @@
  * Boston, MA 02111-1307, USA.
  */
 
+#include "gitg-convert.h"
+#include "gitg-debug.h"
 #include "gitg-runner.h"
-#include "gitg-utils.h"
+
 #include <string.h>
 #include <sys/types.h>
 #include <sys/wait.h>
-#include "gitg-debug.h"
 #include <errno.h>
 #include <stdlib.h>
 
@@ -326,12 +327,12 @@ parse_lines(GitgRunner *runner, gchar *buffer, gssize size)
 			g_free(runner->priv->buffer);
 			runner->priv->buffer = NULL;
 
-			runner->priv->lines[i++] = gitg_utils_convert_utf8(buffered, -1);
+			runner->priv->lines[i++] = gitg_convert_utf8(buffered, -1);
 			g_free(buffered);
 		}
 		else
 		{
-			runner->priv->lines[i++] = gitg_utils_convert_utf8(ptr, linesize);
+			runner->priv->lines[i++] = gitg_convert_utf8(ptr, linesize);
 		}
 
 		ptr += linesize + 1;
@@ -470,8 +471,8 @@ read_output_ready(GInputStream *stream, GAsyncResult *result, AsyncData *data)
 	if (read == 0)
 	{
 		/* End */
-		gchar *converted = gitg_utils_convert_utf8 (data->runner->priv->buffer,
-		                                            -1);
+		gchar *converted = gitg_convert_utf8 (data->runner->priv->buffer,
+		                                      -1);
 
 		gchar *b[] = {converted, NULL};
 
diff --git a/gitg/gitg-runner.h b/libgitg/gitg-runner.h
similarity index 100%
rename from gitg/gitg-runner.h
rename to libgitg/gitg-runner.h
diff --git a/gitg/gitg-types.h b/libgitg/gitg-types.h
similarity index 100%
rename from gitg/gitg-types.h
rename to libgitg/gitg-types.h



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]