[gitg] Added preference for default activity
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Added preference for default activity
- Date: Thu, 18 Dec 2014 07:47:01 +0000 (UTC)
commit 44b51c99d5d107b1ecf55f078a80dd2846fe56dd
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Thu Dec 18 08:46:26 2014 +0100
Added preference for default activity
data/org.gnome.gitg.gschema.xml.in.in | 11 +++-
gitg/gitg-window.vala | 23 ++++++-
gitg/preferences/gitg-preferences-interface.vala | 8 ++
gitg/resources/ui/gitg-preferences-interface.ui | 78 +++++++++++++++++++++-
4 files changed, 114 insertions(+), 6 deletions(-)
---
diff --git a/data/org.gnome.gitg.gschema.xml.in.in b/data/org.gnome.gitg.gschema.xml.in.in
index bf7e12f..fdb9cf8 100644
--- a/data/org.gnome.gitg.gschema.xml.in.in
+++ b/data/org.gnome.gitg.gschema.xml.in.in
@@ -28,6 +28,13 @@
Setting that sets the orientation of the main interface.
</_description>
</key>
+ <key name="default-activity" type="s">
+ <default>"history"</default>
+ <_summary>Default Activity</_summary>
+ <_description>
+ The activity which gitg activates by default when first launched.
+ </_description>
+ </key>
</schema>
<schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.gitg.preferences.history"
path="/org/gnome/gitg/preferences/history/">
<key name="collapse-inactive-lanes" type="i">
@@ -91,8 +98,8 @@
<default>true</default>
<_summary>Show Right Margin in Commit Message View</_summary>
<_description>
- Show a right margin indicator in the commit message view.
- This can be used to easily see where to break the commit message at
+ Show a right margin indicator in the commit message view.
+ This can be used to easily see where to break the commit message at
a particular column.
</_description>
</key>
diff --git a/gitg/gitg-window.vala b/gitg/gitg-window.vala
index 67766a9..474fc1c 100644
--- a/gitg/gitg-window.vala
+++ b/gitg/gitg-window.vala
@@ -583,15 +583,32 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
private void activate_default_activity()
{
GitgExt.Activity? def = null;
+ GitgExt.Activity? deffb = null;
+
+ string default_activity;
+
+ if (d_action == null || d_action == "")
+ {
+ default_activity = d_interface_settings.get_string("default-activity");
+ }
+ else
+ {
+ default_activity = d_action;
+ }
d_activities.foreach((element) => {
GitgExt.Activity activity = (GitgExt.Activity)element;
- if (activity.is_default_for(d_action != null ? d_action : ""))
+ if (activity.is_default_for(default_activity))
{
def = activity;
}
+ if (activity.is_default_for(""))
+ {
+ deffb = activity;
+ }
+
return true;
});
@@ -599,6 +616,10 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
{
d_activities.current = def;
}
+ else if (deffb != null)
+ {
+ d_activities.current = deffb;
+ }
}
private bool init(Cancellable? cancellable)
diff --git a/gitg/preferences/gitg-preferences-interface.vala
b/gitg/preferences/gitg-preferences-interface.vala
index 69f36ad..1588b8a 100644
--- a/gitg/preferences/gitg-preferences-interface.vala
+++ b/gitg/preferences/gitg-preferences-interface.vala
@@ -31,6 +31,9 @@ public class PreferencesInterface : Gtk.Grid, GitgExt.Preferences
[GtkChild (name = "horizontal_layout_enabled")]
private Gtk.CheckButton d_horizontal_layout_enabled;
+ [GtkChild (name = "default_activity")]
+ private Gtk.ComboBox d_default_activity;
+
construct
{
d_settings = new Settings("org.gnome.gitg.preferences.interface");
@@ -50,6 +53,11 @@ public class PreferencesInterface : Gtk.Grid, GitgExt.Preferences
});
d_settings.changed["orientation"].connect(orientation_changed);
+
+ d_settings.bind("default-activity",
+ d_default_activity,
+ "active-id",
+ SettingsBindFlags.GET | SettingsBindFlags.SET);
}
public override void dispose()
diff --git a/gitg/resources/ui/gitg-preferences-interface.ui b/gitg/resources/ui/gitg-preferences-interface.ui
index f29b3f2..d07b4d4 100644
--- a/gitg/resources/ui/gitg-preferences-interface.ui
+++ b/gitg/resources/ui/gitg-preferences-interface.ui
@@ -26,7 +26,7 @@
<property name="has_focus">False</property>
<property name="is_focus">False</property>
<property name="halign">start</property>
- <property name="label" translatable="yes">Layout</property>
+ <property name="label" translatable="yes">Startup</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
@@ -45,7 +45,79 @@
<property name="has_focus">False</property>
<property name="is_focus">False</property>
<property name="hexpand">True</property>
- <property name="vexpand">True</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
+ <property name="margin_start">12</property>
+ <child>
+ <object class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="has_focus">False</property>
+ <property name="is_focus">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Start with activity:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBoxText" id="default_activity">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_focus">False</property>
+ <property name="is_focus">False</property>
+ <property name="receives_default">False</property>
+ <property name="halign">start</property>
+ <items>
+ <item translatable="yes" id="history">History</item>
+ <item translatable="yes" id="commit">Commit</item>
+ </items>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="has_focus">False</property>
+ <property name="is_focus">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Layout</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="grid3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="has_focus">False</property>
+ <property name="is_focus">False</property>
+ <property name="hexpand">True</property>
<property name="row_spacing">6</property>
<property name="margin_start">12</property>
<child>
@@ -70,7 +142,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">1</property>
+ <property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]