[gitg] Added preference for vertical/horizontal layout
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gitg] Added preference for vertical/horizontal layout
- Date: Sun, 10 Jan 2010 21:31:03 +0000 (UTC)
commit 84297e6fedd19591fc5a11418f2c68b89727f2e3
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Sun Jan 10 10:48:49 2010 +0100
Added preference for vertical/horizontal layout
configure.ac | 2 +-
data/gitg.schemas.in | 12 ++++++++
gitg/gitg-preferences-dialog.c | 8 ++++++
gitg/gitg-preferences.c | 15 +++++++++++
gitg/gitg-preferences.ui | 55 +++++++++++++++++++++++++++++++++++++++-
gitg/gitg-repository.ui | 2 +-
gitg/gitg-tag.ui | 2 +-
gitg/gitg-window.c | 20 ++++++++++++++
gitg/gitg-window.ui | 2 +-
9 files changed, 113 insertions(+), 5 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index e470c3a..90d17aa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -46,7 +46,7 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
AM_GLIB_GNU_GETTEXT
PKG_CHECK_MODULES(PACKAGE, [
- gtk+-2.0 >= 2.14.0
+ gtk+-2.0 >= 2.16.0
gthread-2.0
gtksourceview-2.0 >= 2.8
gio-2.0
diff --git a/data/gitg.schemas.in b/data/gitg.schemas.in
index ac30ace..05dab9b 100644
--- a/data/gitg.schemas.in
+++ b/data/gitg.schemas.in
@@ -39,6 +39,18 @@
</locale>
</schema>
<schema>
+ <key>/schemas/apps/gitg/preferences/view/main/layout-vertical</key>
+ <applyto>/apps/gitg/preferences/view/main/layout-vertical</applyto>
+ <owner>gitg</owner>
+ <type>bool</type>
+ <default>TRUE</default>
+ <locale name="C">
+ <short>Show Main View in Vertical Layout</short>
+ <long>Setting that sets the orientation layout of the main view.
+ </long>
+ </locale>
+ </schema>
+ <schema>
<key>/schemas/apps/gitg/preferences/commit/message/show-right-margin</key>
<applyto>/apps/gitg/preferences/commit/message/show-right-margin</applyto>
<owner>gitg</owner>
diff --git a/gitg/gitg-preferences-dialog.c b/gitg/gitg-preferences-dialog.c
index cb89edc..eca30e9 100644
--- a/gitg/gitg-preferences-dialog.c
+++ b/gitg/gitg-preferences-dialog.c
@@ -52,6 +52,7 @@ struct _GitgPreferencesDialogPrivate
GtkCheckButton *history_show_virtual_unstaged;
GtkCheckButton *history_topo_order;
GtkCheckButton *check_button_collapse_inactive;
+ GtkCheckButton *main_layout_vertical;
GtkCheckButton *check_button_show_right_margin;
GtkLabel *label_right_margin;
@@ -201,6 +202,11 @@ initialize_view(GitgPreferencesDialog *dialog)
"message-right-margin-at",
dialog->priv->spin_button_right_margin,
"value");
+
+ gitg_data_binding_new_mutual(preferences,
+ "main-layout-vertical",
+ dialog->priv->main_layout_vertical,
+ "active");
}
static void
@@ -221,6 +227,8 @@ create_preferences_dialog()
priv->history_show_virtual_unstaged = GTK_CHECK_BUTTON(gtk_builder_get_object(b, "check_button_history_show_virtual_unstaged"));
priv->history_topo_order = GTK_CHECK_BUTTON (gtk_builder_get_object (b, "check_button_history_topo_order"));
+ priv->main_layout_vertical = GTK_CHECK_BUTTON (gtk_builder_get_object (b, "check_button_main_layout_vertical"));
+
priv->check_button_collapse_inactive = GTK_CHECK_BUTTON(gtk_builder_get_object(b, "check_button_collapse_inactive"));
priv->table = GTK_WIDGET(gtk_builder_get_object(b, "table_collapse_inactive_lanes"));
diff --git a/gitg/gitg-preferences.c b/gitg/gitg-preferences.c
index 4144f79..0727705 100644
--- a/gitg/gitg-preferences.c
+++ b/gitg/gitg-preferences.c
@@ -45,6 +45,8 @@ enum
PROP_HISTORY_TOPO_ORDER,
+ PROP_MAIN_LAYOUT_VERTICAL,
+
PROP_MESSAGE_SHOW_RIGHT_MARGIN,
PROP_MESSAGE_RIGHT_MARGIN_AT,
@@ -456,6 +458,19 @@ gitg_preferences_class_init(GitgPreferencesClass *klass)
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");
diff --git a/gitg/gitg-preferences.ui b/gitg/gitg-preferences.ui
index 7d0126d..114c705 100644
--- a/gitg/gitg-preferences.ui
+++ b/gitg/gitg-preferences.ui
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<interface>
- <requires lib="gtk+" version="2.14"/>
+ <requires lib="gtk+" version="2.16"/>
<!-- interface-requires gitg 0.2 -->
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkAdjustment" id="adjustment_collapse_inactive_lanes">
@@ -213,6 +213,59 @@
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <object class="GtkLabel" id="label130">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Main</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox23">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label22">
+ <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="vbox54">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCheckButton" id="check_button_main_layout_vertical">
+ <property name="label" translatable="yes">Use vertical layout</property>
+ <property name="can_focus">True</property>
+ <property name="visible">True</property>
+ <property name="receives_default">False</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">3</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="position">0</property>
diff --git a/gitg/gitg-repository.ui b/gitg/gitg-repository.ui
index 5b821ae..61c8afd 100644
--- a/gitg/gitg-repository.ui
+++ b/gitg/gitg-repository.ui
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<interface>
- <requires lib="gtk+" version="2.14"/>
+ <requires lib="gtk+" version="2.16"/>
<!-- interface-requires gitg 0.2 -->
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkListStore" id="list_store_remotes">
diff --git a/gitg/gitg-tag.ui b/gitg/gitg-tag.ui
index cb4b62b..5179e97 100644
--- a/gitg/gitg-tag.ui
+++ b/gitg/gitg-tag.ui
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<interface>
- <!-- interface-requires gtk+ 2.12 -->
+ <!-- interface-requires gtk+ 2.16 -->
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkDialog" id="dialog_tag">
<property name="border_width">5</property>
diff --git a/gitg/gitg-window.c b/gitg/gitg-window.c
index 6266bb0..31d0918 100644
--- a/gitg/gitg-window.c
+++ b/gitg/gitg-window.c
@@ -631,6 +631,18 @@ init_tree_view (GitgWindow *window, GtkBuilder *builder)
}
static void
+on_main_layout_vertical_cb (GitgWindow *window)
+{
+ GitgPreferences *preferences = gitg_preferences_get_default ();
+ gboolean vertical;
+
+ g_object_get (preferences, "main-layout-vertical", &vertical, NULL);
+ g_object_set (window->priv->vpaned_main,
+ "orientation",
+ vertical ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL);
+}
+
+static void
gitg_window_parser_finished(GtkBuildable *buildable, GtkBuilder *builder)
{
if (parent_iface.parser_finished)
@@ -701,6 +713,14 @@ gitg_window_parser_finished(GtkBuildable *buildable, GtkBuilder *builder)
g_signal_connect(window->priv->tree_view, "motion-notify-event", G_CALLBACK(on_tree_view_motion), window);
g_signal_connect(window->priv->tree_view, "button-release-event", G_CALLBACK(on_tree_view_button_release), window);
+
+ GitgPreferences *preferences = gitg_preferences_get_default ();
+ g_signal_connect_swapped (preferences,
+ "notify::main-layout-vertical",
+ G_CALLBACK (on_main_layout_vertical_cb),
+ window);
+
+ on_main_layout_vertical_cb (window);
}
static void
diff --git a/gitg/gitg-window.ui b/gitg/gitg-window.ui
index 125a3b6..04c02a1 100644
--- a/gitg/gitg-window.ui
+++ b/gitg/gitg-window.ui
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<interface>
- <!-- interface-requires gtk+ 2.12 -->
+ <!-- interface-requires gtk+ 2.16 -->
<!-- interface-requires gitg 0.2 -->
<!-- interface-requires sourceview2 0.0 -->
<!-- interface-naming-policy toplevel-contextual -->
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]