[gitg] Added preference to ignore external diff tool



commit 251cf70e6ac398e875c4871c3f38600673f4e4a0
Author: Jesse van den Kieboom <jesse vandenkieboom epfl ch>
Date:   Mon Nov 1 09:41:42 2010 +0100

    Added preference to ignore external diff tool

 data/gitg.schemas.in           |   13 +
 gitg/gitg-preferences-dialog.c |    9 +
 gitg/gitg-preferences.c        |  617 +++++++++++++++++-----------------------
 gitg/gitg-preferences.ui       |  104 ++++++-
 4 files changed, 382 insertions(+), 361 deletions(-)
---
diff --git a/data/gitg.schemas.in b/data/gitg.schemas.in
index c62cefa..15900f1 100644
--- a/data/gitg.schemas.in
+++ b/data/gitg.schemas.in
@@ -78,6 +78,19 @@
       </locale>
     </schema>
     <schema>
+      <key>/schemas/apps/gitg/preferences/diff/external</key>
+      <applyto>/apps/gitg/preferences/diff/external</applyto>
+      <owner>gitg</owner>
+      <type>bool</type>
+      <default>FALSE</default>
+      <locale name="C">
+        <short>Allow External Diff Program</short>
+        <long>Allow an external diff program to be used when viewing diffs in
+        gitg.
+        </long>
+      </locale>
+    </schema>
+    <schema>
       <key>/schemas/desktop/gnome/url-handlers/gitg/command</key>
       <applyto>/desktop/gnome/url-handlers/gitg/command</applyto>
       <owner>gitg</owner>
diff --git a/gitg/gitg-preferences-dialog.c b/gitg/gitg-preferences-dialog.c
index 97afb2f..0619b9e 100644
--- a/gitg/gitg-preferences-dialog.c
+++ b/gitg/gitg-preferences-dialog.c
@@ -70,6 +70,8 @@ struct _GitgPreferencesDialogPrivate
 	GtkLabel *label_right_margin;
 	GtkSpinButton *spin_button_right_margin;
 
+	GtkCheckButton *check_button_external_diff;
+
 	GtkEntry *entry_configuration_user_name;
 	GtkEntry *entry_configuration_user_email;
 
@@ -219,6 +221,11 @@ initialize_view(GitgPreferencesDialog *dialog)
 	                             "main-layout-vertical",
 	                             dialog->priv->main_layout_vertical,
 	                             "active");
+
+	gitg_data_binding_new_mutual(preferences,
+	                             "diff-external",
+	                             dialog->priv->check_button_external_diff,
+	                             "active");
 }
 
 static void
@@ -248,6 +255,8 @@ create_preferences_dialog()
 	priv->label_right_margin = GTK_LABEL(gtk_builder_get_object(b, "label_right_margin"));
 	priv->spin_button_right_margin = GTK_SPIN_BUTTON(gtk_builder_get_object(b, "spin_button_right_margin"));
 
+	priv->check_button_external_diff = GTK_CHECK_BUTTON (gtk_builder_get_object (b, "check_button_external_diff"));
+
 	priv->prev_value = (gint)gtk_adjustment_get_value(priv->collapse_inactive_lanes);
 	g_signal_connect(preferences_dialog, "response", G_CALLBACK(on_response), NULL);
 
diff --git a/gitg/gitg-preferences.c b/gitg/gitg-preferences.c
index 06f63f5..62ec3f2 100644
--- a/gitg/gitg-preferences.c
+++ b/gitg/gitg-preferences.c
@@ -25,7 +25,7 @@
 #include <gconf/gconf-client.h>
 #include <string.h>
 
-#define GITG_PREFERENCES_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), GITG_TYPE_PREFERENCES, GitgPreferencesPrivate))
+#define GITG_PREFERENCES_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GITG_TYPE_PREFERENCES, GitgPreferencesPrivate))
 
 #define KEY_ROOT "/apps/gitg/preferences"
 
@@ -52,43 +52,17 @@ enum
 
 	PROP_HIDDEN_SIGN_TAG,
 
-	PROP_STYLE_TEXT_FOREGROUND,
-	PROP_STYLE_TEXT_BACKGROUND,
-	PROP_STYLE_TEXT_STYLE,
-
-	PROP_STYLE_ADDED_LINE_FOREGROUND,
-	PROP_STYLE_ADDED_LINE_BACKGROUND,
-	PROP_STYLE_ADDED_LINE_STYLE,
-
-	PROP_STYLE_REMOVED_LINE_FOREGROUND,
-	PROP_STYLE_REMOVED_LINE_BACKGROUND,
-	PROP_STYLE_REMOVED_LINE_STYLE,
-
-	PROP_STYLE_CHANGED_LINE_FOREGROUND,
-	PROP_STYLE_CHANGED_LINE_BACKGROUND,
-	PROP_STYLE_CHANGED_LINE_STYLE,
-
-	PROP_STYLE_HEADER_FOREGROUND,
-	PROP_STYLE_HEADER_BACKGROUND,
-	PROP_STYLE_HEADER_STYLE,
-
-	PROP_STYLE_HUNK_FOREGROUND,
-	PROP_STYLE_HUNK_BACKGROUND,
-	PROP_STYLE_HUNK_STYLE,
-
-	PROP_STYLE_TRAILING_SPACES_FOREGROUND,
-	PROP_STYLE_TRAILING_SPACES_BACKGROUND,
-	PROP_STYLE_TRAILING_SPACES_STYLE,
+	PROP_EXTERNAL_DIFF,
 
 	PROP_LAST
 };
 
 typedef struct _Binding Binding;
 
-typedef void (*WrapGet)(GitgPreferences *preferences, Binding *binding, GValue *value);
-typedef gboolean (*WrapSet)(GitgPreferences *preferences, Binding *binding, GValue const *value);
+typedef void (*WrapGet) (GitgPreferences *preferences, Binding *binding, GValue *value);
+typedef gboolean (*WrapSet) (GitgPreferences *preferences, Binding *binding, GValue const *value);
 
-static void on_preference_changed(GConfClient *client, guint id, GConfEntry *entry, GitgPreferences *preferences);
+static void on_preference_changed (GConfClient *client, guint id, GConfEntry *entry, GitgPreferences *preferences);
 
 struct _Binding
 {
@@ -108,110 +82,110 @@ struct _GitgPreferencesPrivate
 	gboolean block_notify[PROP_LAST];
 };
 
-G_DEFINE_TYPE(GitgPreferences, gitg_preferences, G_TYPE_OBJECT)
+G_DEFINE_TYPE (GitgPreferences, gitg_preferences, G_TYPE_OBJECT)
 
 static Binding property_bindings[PROP_LAST];
 
 static gboolean
-wrap_set_boolean(GitgPreferences *preferences, Binding *binding, GValue const *value)
+wrap_set_boolean (GitgPreferences *preferences, Binding *binding, GValue const *value)
 {
-	gboolean val = g_value_get_boolean(value);
-	return gconf_client_set_bool(preferences->priv->client, binding->key, val, NULL);
+	gboolean val = g_value_get_boolean (value);
+	return gconf_client_set_bool (preferences->priv->client, binding->key, val, NULL);
 }
 
 static void
-wrap_get_boolean(GitgPreferences *preferences, Binding *binding, GValue *value)
+wrap_get_boolean (GitgPreferences *preferences, Binding *binding, GValue *value)
 {
-	gboolean val = gconf_client_get_bool(preferences->priv->client, binding->key, NULL);
-	g_value_set_boolean(value, val);
+	gboolean val = gconf_client_get_bool (preferences->priv->client, binding->key, NULL);
+	g_value_set_boolean (value, val);
 }
 
 static gboolean
-wrap_set_int(GitgPreferences *preferences, Binding *binding, GValue const *value)
+wrap_set_int (GitgPreferences *preferences, Binding *binding, GValue const *value)
 {
-	gint val = g_value_get_int(value);
-	return gconf_client_set_int(preferences->priv->client, binding->key, val, NULL);
+	gint val = g_value_get_int (value);
+	return gconf_client_set_int (preferences->priv->client, binding->key, val, NULL);
 }
 
 static void
-wrap_get_int(GitgPreferences *preferences, Binding *binding, GValue *value)
+wrap_get_int (GitgPreferences *preferences, Binding *binding, GValue *value)
 {
-	gint val = gconf_client_get_int(preferences->priv->client, binding->key, NULL);
-	g_value_set_int(value, val);
+	gint val = gconf_client_get_int (preferences->priv->client, binding->key, NULL);
+	g_value_set_int (value, val);
 }
 
-static gboolean
-wrap_set_string(GitgPreferences *preferences, Binding *binding, GValue const *value)
+/*static gboolean
+wrap_set_string (GitgPreferences *preferences, Binding *binding, GValue const *value)
 {
-	gchar const *val = g_value_get_string(value);
-	return gconf_client_set_string(preferences->priv->client, binding->key, val ? val : "", NULL);
+	gchar const *val = g_value_get_string (value);
+	return gconf_client_set_string (preferences->priv->client, binding->key, val ? val : "", NULL);
 }
 
 static void
-wrap_get_string(GitgPreferences *preferences, Binding *binding, GValue *value)
+wrap_get_string (GitgPreferences *preferences, Binding *binding, GValue *value)
 {
-	gchar *val = gconf_client_get_string(preferences->priv->client, binding->key, NULL);
-	g_value_take_string(value, val);
-}
+	gchar *val = gconf_client_get_string (preferences->priv->client, binding->key, NULL);
+	g_value_take_string (value, val);
+}*/
 
 static void
-finalize_notify(GitgPreferences *preferences)
+finalize_notify (GitgPreferences *preferences)
 {
-	gconf_client_remove_dir(preferences->priv->client, KEY_ROOT, NULL);
-	gconf_client_notify_remove(preferences->priv->client, preferences->priv->notify_id);
+	gconf_client_remove_dir (preferences->priv->client, KEY_ROOT, NULL);
+	gconf_client_notify_remove (preferences->priv->client, preferences->priv->notify_id);
 }
 
 static void
-gitg_preferences_finalize(GObject *object)
+gitg_preferences_finalize (GObject *object)
 {
-	GitgPreferences *preferences = GITG_PREFERENCES(object);
+	GitgPreferences *preferences = GITG_PREFERENCES (object);
 
-	finalize_notify(preferences);
+	finalize_notify (preferences);
 
-	g_object_unref(preferences->priv->client);
-	G_OBJECT_CLASS(gitg_preferences_parent_class)->finalize(object);
+	g_object_unref (preferences->priv->client);
+	G_OBJECT_CLASS (gitg_preferences_parent_class)->finalize (object);
 }
 
 static void
-gitg_preferences_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+gitg_preferences_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
 {
-	GitgPreferences *self = GITG_PREFERENCES(object);
+	GitgPreferences *self = GITG_PREFERENCES (object);
 
 	if (prop_id > PROP_0 && prop_id < PROP_LAST)
 	{
 		Binding *b = &property_bindings[prop_id];
-		self->priv->block_notify[prop_id] = b->wrap_set(self, b, value);
+		self->priv->block_notify[prop_id] = b->wrap_set (self, b, value);
 	}
 	else
 	{
-		G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 	}
 }
 
 static void
-gitg_preferences_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+gitg_preferences_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
 {
-	GitgPreferences *self = GITG_PREFERENCES(object);
+	GitgPreferences *self = GITG_PREFERENCES (object);
 
 	if (prop_id > PROP_0 && prop_id < PROP_LAST)
 	{
 		Binding *b = &property_bindings[prop_id];
-		b->wrap_get(self, b, value);
+		b->wrap_get (self, b, value);
 	}
 	else
 	{
-		G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 	}
 }
 
 static void
-install_property_binding(guint prop_id, gchar const *group, gchar const *name, WrapGet wrap_get, WrapSet wrap_set)
+install_property_binding (guint prop_id, gchar const *group, gchar const *name, WrapGet wrap_get, WrapSet wrap_set)
 {
 	Binding *b = &property_bindings[prop_id];
 	
-	b->key = g_strdup_printf("%s/%s/%s", KEY_ROOT, group, name);
+	b->key = g_strdup_printf ("%s/%s/%s", KEY_ROOT, group, name);
 
-	gchar const *prefix = g_utf8_strrchr(group, -1, '/');
+	gchar const *prefix = g_utf8_strrchr (group, -1, '/');
 
 	if (prefix)
 	{
@@ -222,347 +196,286 @@ install_property_binding(guint prop_id, gchar const *group, gchar const *name, W
 		prefix = group;
 	}
 	
-	b->property = g_strdup_printf("%s-%s", prefix, name);
+	b->property = g_strdup_printf ("%s-%s", prefix, name);
 
 	b->wrap_get = wrap_get;
 	b->wrap_set = wrap_set;
 }
 
 static void
-install_style_properties(GObjectClass *object_class, guint prop_start, gchar const *name)
-{
-	gchar *group = g_strconcat("style/", name, NULL);
-
-	/* install bindings */
-	install_property_binding(prop_start + 0,
-							 group,
-							 "foreground",
-							 wrap_get_string,
-							 wrap_set_string);
-
-	install_property_binding(prop_start + 1,
-							 group,
-							 "background",
-							 wrap_get_string,
-							 wrap_set_string);
-
-	install_property_binding(prop_start + 2,
-							 group,
-							 "style",
-							 wrap_get_int,
-							 wrap_set_int);
-	g_free(group);
-
-	gchar *stylename = g_strconcat("gitgdiff:", name, NULL);
-
-	GtkSourceStyleSchemeManager *manager = gtk_source_style_scheme_manager_get_default();
-	GtkSourceStyleScheme *scheme = gtk_source_style_scheme_manager_get_scheme(manager, "gitg");
-	GtkSourceStyle *style = gtk_source_style_scheme_get_style(scheme, stylename);
-
-	g_free(stylename);
-
-	gchar *foreground = NULL;
-	gchar *background = NULL;
-	gboolean line_background;
-
-	group = g_strconcat(name, "-foreground", NULL);
-	g_object_get(G_OBJECT(style), "line-background-set", &line_background, NULL);
-
-	g_object_get(G_OBJECT(style), "foreground", &foreground, line_background ? "line-background" : "background", &background, NULL);
-
-	/* install foreground property */
-	g_object_class_install_property(object_class, prop_start + 0,
-					 g_param_spec_string(group,
-							      NULL,
-							      NULL,
-							      foreground,
-							      G_PARAM_READWRITE));
-
-	g_free(group);
-	group = g_strconcat(name, "-background", NULL);
-
-	/* install background property */
-	g_object_class_install_property(object_class, prop_start + 1,
-					 g_param_spec_string(group,
-							      NULL,
-							      NULL,
-							      background,
-							      G_PARAM_READWRITE));
-
-	g_free(group);
-	group = g_strconcat(name, "-style", NULL);
-
-	gboolean bold;
-	gboolean italic;
-	gboolean underline;
-
-	g_object_get(G_OBJECT(style), "bold", &bold, "italic", &italic, "underline", &underline, NULL);
-
-	/* install style property */
-	g_object_class_install_property(object_class, prop_start + 2,
-					 g_param_spec_int(group,
-							      NULL,
-							      NULL,
-							      0,
-							      G_MAXINT,
-							      bold << 0 | italic << 1 | underline << 2 | line_background << 3,
-							      G_PARAM_READWRITE));
-
-	g_free(group);
-
-	g_free(foreground);
-	g_free(background);
-}
-
-static void
-gitg_preferences_class_init(GitgPreferencesClass *klass)
+gitg_preferences_class_init (GitgPreferencesClass *klass)
 {
-	GObjectClass *object_class = G_OBJECT_CLASS(klass);
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
 	object_class->finalize = gitg_preferences_finalize;
 	object_class->set_property = gitg_preferences_set_property;
 	object_class->get_property = gitg_preferences_get_property;
 
-	install_property_binding(PROP_HISTORY_SEARCH_FILTER, 
-							 "view/history",
-							 "search-filter", 
-							 wrap_get_boolean,
-							 wrap_set_boolean);
-
-	g_object_class_install_property(object_class, PROP_HISTORY_SEARCH_FILTER,
-					 g_param_spec_boolean("history-search-filter",
-							      "HISTORY_SEARCH_FILTER",
-							      "Filter revisions when searching",
-							      FALSE,
-							      G_PARAM_READWRITE));
-
-	install_property_binding(PROP_HISTORY_COLLAPSE_INACTIVE_LANES_ACTIVE, 
-							 "view/history",
-							 "collapse-inactive-lanes-active", 
-							 wrap_get_boolean,
-							 wrap_set_boolean);
-
-	g_object_class_install_property(object_class, PROP_HISTORY_COLLAPSE_INACTIVE_LANES_ACTIVE,
-					 g_param_spec_boolean("history-collapse-inactive-lanes-active",
-							      "HISTORY_COLLAPSE_INACTIVE_LANES_ACTIVE",
-							      "Collapsing inactive lanes active",
-							      TRUE,
-							      G_PARAM_READWRITE));
-
-	install_property_binding(PROP_HISTORY_COLLAPSE_INACTIVE_LANES, 
-							 "view/history",
-							 "collapse-inactive-lanes", 
-							 wrap_get_int,
-							 wrap_set_int);
-
-	g_object_class_install_property(object_class, PROP_HISTORY_COLLAPSE_INACTIVE_LANES,
-					 g_param_spec_int("history-collapse-inactive-lanes",
-							      "HISTORY_COLLAPSE_INACTIVE_LANES",
-							      "Rule for collapsing inactive lanes",
-							      0,
-							      5,
-							      2,
-							      G_PARAM_READWRITE));
-
-	install_property_binding(PROP_HISTORY_SHOW_VIRTUAL_STASH, 
-							 "view/history",
-							 "show-virtual-stash", 
-							 wrap_get_boolean,
-							 wrap_set_boolean);
-
-	g_object_class_install_property(object_class, PROP_HISTORY_SHOW_VIRTUAL_STASH,
-					 g_param_spec_boolean("history-show-virtual-stash",
-							      "HISTORY_SHOW_VIRTUAL_STASH",
-							      "Show stash in history",
-							      TRUE,
-							      G_PARAM_READWRITE));
-
-	install_property_binding(PROP_HISTORY_SHOW_VIRTUAL_STAGED, 
-							 "view/history",
-							 "show-virtual-staged", 
-							 wrap_get_boolean,
-							 wrap_set_boolean);
-
-	g_object_class_install_property(object_class, PROP_HISTORY_SHOW_VIRTUAL_STAGED,
-					 g_param_spec_boolean("history-show-virtual-staged",
-							      "HISTORY_SHOW_VIRTUAL_STAGED",
-							      "Show staged changes in history",
-							      TRUE,
-							      G_PARAM_READWRITE));
-
-	install_property_binding(PROP_HISTORY_SHOW_VIRTUAL_UNSTAGED, 
-							 "view/history",
-							 "show-virtual-unstaged", 
-							 wrap_get_boolean,
-							 wrap_set_boolean);
-
-	g_object_class_install_property(object_class, PROP_HISTORY_SHOW_VIRTUAL_UNSTAGED,
-					 g_param_spec_boolean("history-show-virtual-unstaged",
-							      "HISTORY_SHOW_VIRTUAL_UNSTAGED",
-							      "Show unstaged changes in history",
-							      TRUE,
-							      G_PARAM_READWRITE));
-
-
-	install_property_binding(PROP_MESSAGE_SHOW_RIGHT_MARGIN, 
-							 "commit/message",
-							 "show-right-margin", 
-							 wrap_get_boolean,
-							 wrap_set_boolean);
-
-	g_object_class_install_property(object_class, PROP_MESSAGE_SHOW_RIGHT_MARGIN,
-					 g_param_spec_boolean("message-show-right-margin",
-							      "MESSAGE_SHOW_RIGHT_MARGIN",
-							      "Show right margin in commit message view",
-							      TRUE,
-							      G_PARAM_READWRITE));
-
-	install_property_binding(PROP_MESSAGE_RIGHT_MARGIN_AT, 
-							 "commit/message",
-							 "right-margin-at", 
-							 wrap_get_int,
-							 wrap_set_int);
-
-	g_object_class_install_property(object_class, PROP_MESSAGE_RIGHT_MARGIN_AT,
-					 g_param_spec_int("message-right-margin-at",
-							      "MESSAGE_RIGHT_MARGIN_AT",
-							      "The column to show the right margin at",
-							      1,
-							      160,
-							      72,
-							      G_PARAM_READWRITE));
-
-	install_property_binding(PROP_HIDDEN_SIGN_TAG, 
-							 "hidden",
-							 "sign-tag", 
-							 wrap_get_boolean,
-							 wrap_set_boolean);
-
-	g_object_class_install_property(object_class, PROP_HIDDEN_SIGN_TAG,
-					 g_param_spec_boolean("hidden-sign-tag",
-							      "HIDDEN_SIGN_TAG",
-							      "Whether to sign tag objects",
-							      TRUE,
-							      G_PARAM_READWRITE));
-
-	install_property_binding(PROP_HISTORY_TOPO_ORDER,
-							 "view/history",
-							 "topo-order", 
-							 wrap_get_boolean,
-							 wrap_set_boolean);
-
-	g_object_class_install_property(object_class, PROP_HISTORY_TOPO_ORDER,
-					 g_param_spec_boolean("history-topo-order",
-							      "HISTORY_TOPO_ORDER",
-							      "Whether to load history in topological order",
-							      FALSE,
-							      G_PARAM_READWRITE));
-
-	install_property_binding(PROP_MAIN_LAYOUT_VERTICAL,
-							 "view/main",
-							 "layout-vertical",
-							 wrap_get_boolean,
-							 wrap_set_boolean);
-
-	g_object_class_install_property(object_class, PROP_MAIN_LAYOUT_VERTICAL,
-					 g_param_spec_boolean("main-layout-vertical",
-							      "MAIN_LAYOUT_VERTICAL",
-							      "Whether to use a vertical layout",
-							      TRUE,
-							      G_PARAM_READWRITE));
-
-	install_style_properties(object_class, PROP_STYLE_TEXT_FOREGROUND, "text");
-	install_style_properties(object_class, PROP_STYLE_ADDED_LINE_FOREGROUND, "added-line");
-	install_style_properties(object_class, PROP_STYLE_REMOVED_LINE_FOREGROUND, "removed-line");
-	install_style_properties(object_class, PROP_STYLE_CHANGED_LINE_FOREGROUND, "changed-line");
-	install_style_properties(object_class, PROP_STYLE_HEADER_FOREGROUND, "header");
-	install_style_properties(object_class, PROP_STYLE_HUNK_FOREGROUND, "hunk");
-	install_style_properties(object_class, PROP_STYLE_TRAILING_SPACES_FOREGROUND, "trailing-spaces");
-
-	g_type_class_add_private(object_class, sizeof(GitgPreferencesPrivate));
+	install_property_binding (PROP_HISTORY_SEARCH_FILTER,
+	                          "view/history",
+	                          "search-filter",
+	                          wrap_get_boolean,
+	                          wrap_set_boolean);
+
+	g_object_class_install_property (object_class,
+	                                 PROP_HISTORY_SEARCH_FILTER,
+	                                 g_param_spec_boolean ("history-search-filter",
+	                                                       "HISTORY_SEARCH_FILTER",
+	                                                       "Filter revisions when searching",
+	                                                       FALSE,
+	                                                       G_PARAM_READWRITE));
+
+	install_property_binding (PROP_HISTORY_COLLAPSE_INACTIVE_LANES_ACTIVE,
+	                          "view/history",
+	                          "collapse-inactive-lanes-active",
+	                          wrap_get_boolean,
+	                          wrap_set_boolean);
+
+	g_object_class_install_property (object_class,
+	                                 PROP_HISTORY_COLLAPSE_INACTIVE_LANES_ACTIVE,
+	                                 g_param_spec_boolean ("history-collapse-inactive-lanes-active",
+	                                                       "HISTORY_COLLAPSE_INACTIVE_LANES_ACTIVE",
+	                                                       "Collapsing inactive lanes active",
+	                                                       TRUE,
+	                                                       G_PARAM_READWRITE));
+
+	install_property_binding (PROP_HISTORY_COLLAPSE_INACTIVE_LANES,
+	                          "view/history",
+	                          "collapse-inactive-lanes",
+	                          wrap_get_int,
+	                          wrap_set_int);
+
+	g_object_class_install_property (object_class,
+	                                 PROP_HISTORY_COLLAPSE_INACTIVE_LANES,
+	                                 g_param_spec_int ("history-collapse-inactive-lanes",
+	                                                   "HISTORY_COLLAPSE_INACTIVE_LANES",
+	                                                   "Rule for collapsing inactive lanes",
+	                                                   0,
+	                                                   5,
+	                                                   2,
+	                                                   G_PARAM_READWRITE));
+
+	install_property_binding (PROP_HISTORY_SHOW_VIRTUAL_STASH,
+	                          "view/history",
+	                          "show-virtual-stash",
+	                          wrap_get_boolean,
+	                          wrap_set_boolean);
+
+	g_object_class_install_property (object_class,
+	                                 PROP_HISTORY_SHOW_VIRTUAL_STASH,
+	                                 g_param_spec_boolean ("history-show-virtual-stash",
+	                                                       "HISTORY_SHOW_VIRTUAL_STASH",
+	                                                       "Show stash in history",
+	                                                       TRUE,
+	                                                       G_PARAM_READWRITE));
+
+	install_property_binding (PROP_HISTORY_SHOW_VIRTUAL_STAGED,
+	                          "view/history",
+	                          "show-virtual-staged",
+	                          wrap_get_boolean,
+	                          wrap_set_boolean);
+
+	g_object_class_install_property (object_class,
+	                                 PROP_HISTORY_SHOW_VIRTUAL_STAGED,
+	                                 g_param_spec_boolean ("history-show-virtual-staged",
+	                                                       "HISTORY_SHOW_VIRTUAL_STAGED",
+	                                                       "Show staged changes in history",
+	                                                       TRUE,
+	                                                       G_PARAM_READWRITE));
+
+	install_property_binding (PROP_HISTORY_SHOW_VIRTUAL_UNSTAGED,
+	                          "view/history",
+	                          "show-virtual-unstaged",
+	                          wrap_get_boolean,
+	                          wrap_set_boolean);
+
+	g_object_class_install_property (object_class,
+	                                 PROP_HISTORY_SHOW_VIRTUAL_UNSTAGED,
+	                                 g_param_spec_boolean ("history-show-virtual-unstaged",
+	                                                       "HISTORY_SHOW_VIRTUAL_UNSTAGED",
+	                                                       "Show unstaged changes in history",
+	                                                       TRUE,
+	                                                       G_PARAM_READWRITE));
+
+	install_property_binding (PROP_MESSAGE_SHOW_RIGHT_MARGIN,
+	                          "commit/message",
+	                          "show-right-margin",
+	                          wrap_get_boolean,
+	                          wrap_set_boolean);
+
+	g_object_class_install_property (object_class,
+	                                 PROP_MESSAGE_SHOW_RIGHT_MARGIN,
+	                                 g_param_spec_boolean ("message-show-right-margin",
+	                                                       "MESSAGE_SHOW_RIGHT_MARGIN",
+	                                                       "Show right margin in commit message view",
+	                                                       TRUE,
+	                                                       G_PARAM_READWRITE));
+
+	install_property_binding (PROP_MESSAGE_RIGHT_MARGIN_AT,
+	                          "commit/message",
+	                          "right-margin-at",
+	                          wrap_get_int,
+	                          wrap_set_int);
+
+	g_object_class_install_property (object_class,
+	                                 PROP_MESSAGE_RIGHT_MARGIN_AT,
+	                                 g_param_spec_int ("message-right-margin-at",
+	                                                   "MESSAGE_RIGHT_MARGIN_AT",
+	                                                   "The column to show the right margin at",
+	                                                   1,
+	                                                   160,
+	                                                   72,
+	                                                   G_PARAM_READWRITE));
+
+	install_property_binding (PROP_HIDDEN_SIGN_TAG,
+	                          "hidden",
+	                          "sign-tag",
+	                          wrap_get_boolean,
+	                          wrap_set_boolean);
+
+	g_object_class_install_property (object_class,
+	                                 PROP_HIDDEN_SIGN_TAG,
+	                                 g_param_spec_boolean ("hidden-sign-tag",
+	                                                       "HIDDEN_SIGN_TAG",
+	                                                       "Whether to sign tag objects",
+	                                                       TRUE,
+	                                                       G_PARAM_READWRITE));
+
+	install_property_binding (PROP_HISTORY_TOPO_ORDER,
+	                          "view/history",
+	                          "topo-order",
+	                          wrap_get_boolean,
+	                          wrap_set_boolean);
+
+	g_object_class_install_property (object_class,
+	                                 PROP_HISTORY_TOPO_ORDER,
+	                                 g_param_spec_boolean ("history-topo-order",
+	                                                       "HISTORY_TOPO_ORDER",
+	                                                       "Whether to load history in topological order",
+	                                                       FALSE,
+	                                                       G_PARAM_READWRITE));
+
+	install_property_binding (PROP_MAIN_LAYOUT_VERTICAL,
+	                          "view/main",
+	                          "layout-vertical",
+	                          wrap_get_boolean,
+	                          wrap_set_boolean);
+
+	g_object_class_install_property (object_class,
+	                                 PROP_MAIN_LAYOUT_VERTICAL,
+	                                 g_param_spec_boolean ("main-layout-vertical",
+	                                                       "MAIN_LAYOUT_VERTICAL",
+	                                                       "Whether to use a vertical layout",
+	                                                       TRUE,
+	                                                       G_PARAM_READWRITE));
+
+	install_property_binding (PROP_EXTERNAL_DIFF,
+	                          "diff",
+	                          "external",
+	                          wrap_get_boolean,
+	                          wrap_set_boolean);
+
+	g_object_class_install_property (object_class,
+	                                 PROP_EXTERNAL_DIFF,
+	                                 g_param_spec_boolean ("diff-external",
+	                                                       "EXTERNAL_DIFF",
+	                                                       "Use external diff viewer",
+	                                                       FALSE,
+	                                                       G_PARAM_READWRITE));
+
+	g_type_class_add_private (object_class, sizeof (GitgPreferencesPrivate));
 }
 
 static void
-initialize_notify(GitgPreferences *preferences)
+initialize_notify (GitgPreferences *preferences)
 {
-	gconf_client_add_dir(preferences->priv->client, 
-					     KEY_ROOT, 
-					     GCONF_CLIENT_PRELOAD_NONE,
-					     NULL);
-
-	gconf_client_notify_add(preferences->priv->client, 
-							KEY_ROOT,
-							(GConfClientNotifyFunc)on_preference_changed,
-							preferences,
-							NULL,
-							NULL);
+	gconf_client_add_dir (preferences->priv->client,
+	                      KEY_ROOT,
+	                      GCONF_CLIENT_PRELOAD_NONE,
+	                      NULL);
+
+	gconf_client_notify_add (preferences->priv->client,
+	                         KEY_ROOT,
+	                         (GConfClientNotifyFunc)on_preference_changed,
+	                         preferences,
+	                         NULL,
+	                         NULL);
 }
 
 static void
-initialize_default_values(GitgPreferences *preferences)
+initialize_default_values (GitgPreferences *preferences)
 {
 	guint i;
-	GObjectClass *class = G_OBJECT_GET_CLASS(G_OBJECT(preferences));
+	GObjectClass *class = G_OBJECT_GET_CLASS (G_OBJECT (preferences));
 
 	for (i = PROP_0 + 1; i < PROP_LAST; ++i)
 	{
 		Binding *binding = &property_bindings[i];
 
-		GConfValue *v = gconf_client_get_without_default(preferences->priv->client, binding->key, NULL);
+		GConfValue *v = gconf_client_get_without_default (preferences->priv->client,
+		                                                  binding->key,
+		                                                  NULL);
 
 		if (v)
 		{
-			gconf_value_free(v);
+			gconf_value_free (v);
 			continue;
 		}
 
-		GParamSpec *spec = g_object_class_find_property(class, binding->property);
+		GParamSpec *spec = g_object_class_find_property (class,
+		                                                 binding->property);
 		GValue value = {0,};
 
 		/* Get default value */
-		g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE(spec));
-		g_param_value_set_default(spec, &value);
+		g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (spec));
+		g_param_value_set_default (spec, &value);
 
 		/* Set it */
-		g_object_set_property(G_OBJECT(preferences), binding->property, &value);
+		g_object_set_property (G_OBJECT (preferences),
+		                       binding->property,
+		                       &value);
 
-		g_value_unset(&value);
+		g_value_unset (&value);
 	}
 }
 
 static void
-gitg_preferences_init(GitgPreferences *self)
+gitg_preferences_init (GitgPreferences *self)
 {
-	self->priv = GITG_PREFERENCES_GET_PRIVATE(self);
+	self->priv = GITG_PREFERENCES_GET_PRIVATE (self);
 
-	self->priv->client = gconf_client_get_default();
+	self->priv->client = gconf_client_get_default ();
 
-	initialize_notify(self);
+	initialize_notify (self);
 
 	/* Set initial values for properties that have defaults and do not exist
 	   yet */
-	initialize_default_values(self);
+	initialize_default_values (self);
 }
 
 GitgPreferences *
-gitg_preferences_get_default(void)
+gitg_preferences_get_default (void)
 {
 	static GitgPreferences *preferences = NULL;
 
 	if (!preferences)
 	{
-		preferences = g_object_new(GITG_TYPE_PREFERENCES, NULL);
-		g_object_add_weak_pointer(G_OBJECT(preferences), (gpointer *)&preferences);
+		preferences = g_object_new (GITG_TYPE_PREFERENCES, NULL);
+		g_object_add_weak_pointer (G_OBJECT (preferences),
+		                           (gpointer *)&preferences);
 	}
 
 	return preferences;
 }
 
 /* Callbacks */
-static void 
-on_preference_changed(GConfClient *client, guint id, GConfEntry *entry, GitgPreferences *preferences)
+static void
+on_preference_changed (GConfClient     *client,
+                       guint            id,
+                       GConfEntry      *entry,
+                       GitgPreferences *preferences)
 {
-	gchar const *key = gconf_entry_get_key(entry);
+	gchar const *key = gconf_entry_get_key (entry);
 
 	/* Find corresponding property */
 	guint i;
@@ -571,11 +484,13 @@ on_preference_changed(GConfClient *client, guint id, GConfEntry *entry, GitgPref
 	{
 		Binding *b = &property_bindings[i];
 
-		if (strcmp(key, b->key) == 0)
+		if (strcmp (key, b->key) == 0)
 		{
 			/* Property match, emit notify */
 			if (!preferences->priv->block_notify[i])
-				g_object_notify(G_OBJECT(preferences), b->property);
+			{
+				g_object_notify (G_OBJECT (preferences), b->property);
+			}
 
 			preferences->priv->block_notify[i] = FALSE;
 			break;
diff --git a/gitg/gitg-preferences.ui b/gitg/gitg-preferences.ui
index 778252e..35f4000 100644
--- a/gitg/gitg-preferences.ui
+++ b/gitg/gitg-preferences.ui
@@ -24,7 +24,6 @@
     <property name="default_width">400</property>
     <property name="default_height">500</property>
     <property name="type_hint">normal</property>
-    <property name="has_separator">False</property>
     <child internal-child="vbox">
       <object class="GtkVBox" id="dialog_vbox_main">
         <property name="visible">True</property>
@@ -418,6 +417,91 @@
               </packing>
             </child>
             <child>
+              <object class="GtkVBox" id="vbox_commit1">
+                <property name="visible">True</property>
+                <property name="border_width">12</property>
+                <property name="spacing">18</property>
+                <child>
+                  <object class="GtkVBox" id="vbox2">
+                    <property name="visible">True</property>
+                    <property name="spacing">6</property>
+                    <child>
+                      <object class="GtkLabel" id="label_diff_program">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">&lt;b&gt;Diff Program&lt;/b&gt;</property>
+                        <property name="use_markup">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkHBox" id="hbox1">
+                        <property name="visible">True</property>
+                        <child>
+                          <object class="GtkLabel" id="label9">
+                            <property name="visible">True</property>
+                            <property name="label">    </property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkVBox" id="vbox_diff_program">
+                            <property name="visible">True</property>
+                            <property name="spacing">6</property>
+                            <child>
+                              <object class="GtkCheckButton" id="check_button_external_diff">
+                                <property name="label" translatable="yes">Allow external diff program</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_underline">True</property>
+                                <property name="active">True</property>
+                                <property name="draw_indicator">True</property>
+                              </object>
+                              <packing>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child type="tab">
+              <object class="GtkLabel" id="label_diff">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">Diff</property>
+              </object>
+              <packing>
+                <property name="position">2</property>
+                <property name="tab_fill">False</property>
+              </packing>
+            </child>
+            <child>
               <object class="GtkVBox" id="vbox_configure">
                 <property name="visible">True</property>
                 <property name="border_width">12</property>
@@ -427,7 +511,7 @@
                     <property name="visible">True</property>
                     <property name="spacing">6</property>
                     <child>
-                      <object class="GtkLabel" id="label4">
+                      <object class="GtkLabel" id="label5">
                         <property name="visible">True</property>
                         <property name="xalign">0</property>
                         <property name="label" translatable="yes">&lt;b&gt;User&lt;/b&gt;</property>
@@ -487,7 +571,7 @@
                                 <property name="can_focus">True</property>
                                 <property name="invisible_char">â??</property>
                                 <property name="invisible_char_set">True</property>
-                                <signal name="focus-out-event" handler="on_entry_configuration_user_name_focus_out_event" swapped="no"/>
+                                <signal name="focus_out_event" handler="on_entry_configuration_user_name_focus_out_event"/>
                               </object>
                               <packing>
                                 <property name="left_attach">1</property>
@@ -500,7 +584,7 @@
                                 <property name="can_focus">True</property>
                                 <property name="invisible_char">â??</property>
                                 <property name="invisible_char_set">True</property>
-                                <signal name="focus-out-event" handler="on_entry_configuration_user_email_focus_out_event" swapped="no"/>
+                                <signal name="focus_out_event" handler="on_entry_configuration_user_email_focus_out_event"/>
                               </object>
                               <packing>
                                 <property name="left_attach">1</property>
@@ -528,17 +612,17 @@
                 </child>
               </object>
               <packing>
-                <property name="position">2</property>
+                <property name="position">3</property>
               </packing>
             </child>
             <child type="tab">
-              <object class="GtkLabel" id="label3">
+              <object class="GtkLabel" id="label_configuration">
                 <property name="visible">True</property>
                 <property name="tooltip_text" translatable="yes">Configure global git settings. This corresponds to the settings as stored in ~/.gitconfig. Repository specific settings can be configured at the repository properties.</property>
                 <property name="label" translatable="yes">Configuration</property>
               </object>
               <packing>
-                <property name="position">2</property>
+                <property name="position">3</property>
                 <property name="tab_fill">False</property>
               </packing>
             </child>
@@ -579,18 +663,18 @@
     </action-widgets>
   </object>
   <object class="GtkAdjustment" id="spin_button_right_margin_adjustment">
+    <property name="value">72</property>
     <property name="lower">1</property>
     <property name="upper">160</property>
-    <property name="value">72</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
   <object class="GtkAdjustment" id="adjustment_collapse_inactive_lanes">
-    <property name="upper">5</property>
     <property name="value">2</property>
+    <property name="upper">5</property>
     <property name="step_increment">1</property>
     <property name="page_increment">1</property>
     <property name="page_size">1</property>
-    <signal name="notify::value" handler="on_collapse_inactive_lanes_changed" swapped="no"/>
+    <signal name="notify::value" handler="on_collapse_inactive_lanes_changed"/>
   </object>
 </interface>



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