[gitg/wip/albfan/commit-mesage-history: 7/7] Add message history to commit dialog



commit c08f0939501208ad0f41e4c3cd70e9dfea11c2f9
Author: Alberto Fanjul <albertofanjul gmail com>
Date:   Tue Oct 29 07:54:23 2019 +0100

    Add message history to commit dialog
    
    Preferences to keep messages by max num of messages and/or max num days

 data/org.gnome.gitg.gschema.xml.in              |  10 ++
 gitg/commit/gitg-commit-dialog.vala             | 225 +++++++++++++++++++++++-
 gitg/meson.build                                |   1 +
 gitg/preferences/gitg-preferences-commit.vala   |  16 ++
 gitg/resources/ui/gitg-author-details-dialog.ui |   4 +-
 gitg/resources/ui/gitg-commit-dialog.ui         | 167 +++++++++++-------
 gitg/resources/ui/gitg-preferences-commit.ui    |  87 +++++++++
 meson.build                                     |   1 +
 8 files changed, 438 insertions(+), 73 deletions(-)
---
diff --git a/data/org.gnome.gitg.gschema.xml.in b/data/org.gnome.gitg.gschema.xml.in
index a12bd1b9..2e7020cc 100644
--- a/data/org.gnome.gitg.gschema.xml.in
+++ b/data/org.gnome.gitg.gschema.xml.in
@@ -222,6 +222,16 @@
         commit message.
       </description>
     </key>
+    <key name="max-number-commit-messages" type="i">
+      <default>10</default>
+      <summary>Maximum number of previous commit messages</summary>
+      <description>Maximum number of previous commit messages to store for commit message 
history.</description>
+    </key>
+    <key name="max-number-days-commit-messages" type="i">
+      <default>30</default>
+      <summary>Maximum number of days to store previous commit messages</summary>
+      <description>Maximum number of days to store previous commit messages for commit message 
history.</description>
+    </key>
   </schema>
   <schema gettext-domain="@GETTEXT_PACKAGE@" id="@APPLICATION_ID  preferences diff" 
path="@SCHEMA_PATH@/preferences/diff/">
     <key name="patience" type="b">
diff --git a/gitg/commit/gitg-commit-dialog.vala b/gitg/commit/gitg-commit-dialog.vala
index 695ed9ce..3d224613 100644
--- a/gitg/commit/gitg-commit-dialog.vala
+++ b/gitg/commit/gitg-commit-dialog.vala
@@ -26,6 +26,13 @@ class Dialog : Gtk.Dialog
        // Do this to pull in config.h before glib.h (for gettext...)
        private const string version = Gitg.Config.VERSION;
 
+       private string VERSION_PROP = "version";
+       private string DESCRIPTION_PROP = "version";
+       private string MESSAGES_PROP = "messages";
+       private string DATETIME_PROP = "datetime";
+       private string TEXT_PROP = "text";
+       private string COMMIT_MESSAGE_FILENAME = "commit-messages.json";
+
        [GtkChild (name = "source_view_message")]
        private Gtk.SourceView d_source_view_message;
 
@@ -65,6 +72,12 @@ class Dialog : Gtk.Dialog
        [GtkChild (name = "scrolled_window_stats")]
        private Gtk.ScrolledWindow d_scrolled_window_stats;
 
+       [GtkChild (name = "prev_commit_message_button")]
+       private Gtk.Button d_prev_commit_message_button;
+
+       [GtkChild (name = "next_commit_message_button")]
+       private Gtk.Button d_next_commit_message_button;
+
        private bool d_show_markup;
        private bool d_show_right_margin;
        private bool d_show_subject_margin;
@@ -81,6 +94,11 @@ class Dialog : Gtk.Dialog
        private Gspell.Checker? d_spell_checker;
        private Ggit.Diff d_diff;
        private bool d_infobar_shown;
+       private Json.Array d_message_array;
+       private int reverse_pos_messages;
+       private string saved_commit_message;
+       private Gtk.TextTag d_subject_tag;
+       private Gtk.TextTag d_too_long_tag;
 
        public Ggit.Diff? diff
        {
@@ -176,6 +194,10 @@ class Dialog : Gtk.Dialog
 
        public bool sign_off { get; set; }
 
+       public int max_number_commit_messages { get; set; }
+
+       public int max_number_days_commit_messages { get; set; }
+
        public bool show_markup
        {
                get { return d_show_markup; }
@@ -401,6 +423,18 @@ class Dialog : Gtk.Dialog
 
        construct
        {
+               reverse_pos_messages = 0;
+
+               response.connect(() => {
+                       save_commit_message ();
+               });
+
+               d_message_array = load_commit_messages ();
+               if (d_message_array.get_length () == 0) {
+                       reverse_pos_messages = 0;
+                       d_prev_commit_message_button.sensitive = false;
+               }
+
                d_font_manager = new Gitg.FontManager(d_source_view_message, false);
 
                var b = d_source_view_message.buffer;
@@ -429,6 +463,14 @@ class Dialog : Gtk.Dialog
 
                d_message_settings = new Settings(Gitg.Config.APPLICATION_ID + ".preferences.commit.message");
 
+               d_message_settings.bind("max-number-days-commit-messages",
+                                                               this,
+                                                               "max-number-days-commit-messages",
+                                                               SettingsBindFlags.GET);
+               d_message_settings.bind("max-number-commit-messages",
+                                                               this,
+                                                               "max-number-commit-messages",
+                                                               SettingsBindFlags.GET);
                d_message_settings.bind("show-markup",
                                        this,
                                        "show-markup",
@@ -492,8 +534,83 @@ class Dialog : Gtk.Dialog
                }
        }
 
-       private Gtk.TextTag d_subject_tag;
-       private Gtk.TextTag d_too_long_tag;
+       private void save_commit_message ()
+       {
+               var message = pretty_message;
+               if (message == "") {
+                       return;
+               }
+
+               Json.Builder builder = new Json.Builder ();
+
+               builder.begin_object ();
+               builder.set_member_name (VERSION_PROP);
+               builder.add_string_value ("1.0");
+
+               builder.set_member_name (DESCRIPTION_PROP);
+               builder.add_string_value ("recent commit messages");
+
+               builder.set_member_name (MESSAGES_PROP);
+               builder.begin_array ();
+               builder.begin_object ();
+               builder.set_member_name (DATETIME_PROP);
+               builder.add_string_value (new DateTime.now_utc ().to_string ());
+               builder.set_member_name (TEXT_PROP);
+               builder.add_string_value (message);
+               builder.end_object ();
+
+               var max_datetime = new DateTime.now_utc ().add_days (-max_number_days_commit_messages);
+               int message_counter = 1;
+               foreach (unowned Json.Node node in d_message_array.get_elements ()) {
+                       var object_node = node.get_object ();
+                       if (max_number_commit_messages > 0)
+                       {
+                               var datetime_str = object_node.get_string_member (DATETIME_PROP);
+                               var datetime = new DateTime.from_iso8601 (datetime_str, null);
+                               if (datetime.compare (max_datetime) < 0)
+                               {
+                                       break;
+                               }
+                       }
+                       if (max_number_commit_messages > 0)
+                       {
+                               if (message_counter == max_number_commit_messages)
+                               {
+                                       break;
+                               }
+                               message_counter++;
+                       }
+                       var node_message = object_node.get_string_member (TEXT_PROP);
+                       if (message == node_message)
+                       {
+                               continue;
+                       }
+                       builder.add_value (node);
+               }
+               builder.end_array ();
+
+               builder.end_object ();
+
+               Json.Generator generator = new Json.Generator ();
+               generator.pretty = true;
+               Json.Node root = builder.get_root ();
+               generator.set_root (root);
+
+               string current_contents = generator.to_data (null);
+               try {
+                               var dirname = Environment.get_user_data_dir() + "/" + 
Gitg.Config.APPLICATION_ID;
+                               var dir = File.new_for_path(dirname);
+                               if (!dir.query_exists ()) {
+                                       dir.make_directory_with_parents ();
+                               }
+                               var file = File.new_for_path(dirname + "/" + COMMIT_MESSAGE_FILENAME);
+                               file.replace_contents (current_contents.data, null, false,
+                                                                          GLib.FileCreateFlags.NONE, null, 
null);
+               }
+               catch (GLib.Error err) {
+                       error ("%s\n", err.message);
+               }
+       }
 
        private void iterate_diff()
        {
@@ -590,11 +707,21 @@ class Dialog : Gtk.Dialog
        {
                var mmask = Gtk.accelerator_get_default_mod_mask();
 
-               if ((mmask & event.state) == Gdk.ModifierType.CONTROL_MASK &&
-                   (event.keyval == Gdk.Key.Return || event.keyval == Gdk.Key.KP_Enter))
+               if ((mmask & event.state) == Gdk.ModifierType.CONTROL_MASK)
                {
-                       d_button_ok.activate();
-                       return true;
+                       if ((event.keyval == Gdk.Key.Return || event.keyval == Gdk.Key.KP_Enter))
+                       {
+                               d_button_ok.activate();
+                               return true;
+                       }
+                       else if ((event.keyval == Gdk.Key.Left || event.keyval == Gdk.Key.KP_Left))
+                       {
+                               on_prev_commit_message_button_clicked ();
+                       }
+                       else if ((event.keyval == Gdk.Key.Right || event.keyval == Gdk.Key.KP_Right))
+                       {
+                               on_next_commit_message_button_clicked ();
+                       }
                }
 
                return false;
@@ -648,7 +775,7 @@ class Dialog : Gtk.Dialog
                                FileUtils.get_contents(path, out contents, out len);
 
                                default_message = Gitg.Convert.utf8(contents, (ssize_t)len).strip();
-                               d_source_view_message.buffer.set_text(default_message);
+                               message = default_message;
                        }
                }
                catch {}
@@ -779,6 +906,90 @@ class Dialog : Gtk.Dialog
 
                set_response_sensitive(Gtk.ResponseType.OK, false);
        }
+
+       private Json.Array load_commit_messages ()
+       {
+               var file = File.new_for_path(Environment.get_user_data_dir() + "/" +
+                                                                        Gitg.Config.APPLICATION_ID + "/" + 
COMMIT_MESSAGE_FILENAME);
+
+               uint8[] file_contents;
+
+               Json.Array message_array;
+               try {
+                       file.load_contents (null, out file_contents, null);
+                       Json.Parser parser = new Json.Parser ();
+                       parser.load_from_data ((string) file_contents);
+                       Json.Node node = parser.get_root ();
+                       var root_object_node = node.get_object ();
+                       message_array = root_object_node.get_member (MESSAGES_PROP).get_array ();
+               }
+               catch (GLib.Error err) {
+                       warning ("%s\n", err.message);
+                       message_array = new Json.Array ();
+               }
+               return message_array;
+
+       }
+
+       [GtkCallback]
+       private void on_next_commit_message_button_clicked ()
+       {
+               if (reverse_pos_messages > 0) {
+                 d_prev_commit_message_button.sensitive = true;
+                 reverse_pos_messages--;
+                 if (reverse_pos_messages == 0) {
+                         message = saved_commit_message;
+                         d_next_commit_message_button.sensitive = false;
+                         return;
+                 }
+               } else {
+                       d_next_commit_message_button.sensitive = false;
+                       d_prev_commit_message_button.sensitive = true;
+                       return;
+               }
+
+               load_selected_commit_message ();
+       }
+
+       [GtkCallback]
+       private void on_prev_commit_message_button_clicked ()
+       {
+               if (reverse_pos_messages < d_message_array.get_length ()) {
+                 if (reverse_pos_messages == 0) {
+                         saved_commit_message = message;
+                 }
+                 d_next_commit_message_button.sensitive = true;
+                 reverse_pos_messages++;
+               } else {
+                       d_prev_commit_message_button.sensitive = false;
+                       if (reverse_pos_messages <= 0) {
+                               reverse_pos_messages = 0;
+                               d_next_commit_message_button.sensitive = true;
+                       }
+                       return;
+               }
+
+               if (d_message_array.get_length() == reverse_pos_messages) {
+                       d_prev_commit_message_button.sensitive = false;
+               }
+
+               load_selected_commit_message ();
+       }
+
+       private void load_selected_commit_message ()
+       {
+               int counter = 0;
+               foreach (unowned Json.Node node_item in d_message_array.get_elements ()) {
+                       counter++;
+                       if (counter < reverse_pos_messages) {
+                               continue;
+                       }
+                       var object_node = node_item.get_object ();
+                       var commit_message = object_node.get_string_member(TEXT_PROP);
+                       message = commit_message;
+                       break;
+               }
+       }
 }
 
 }
diff --git a/gitg/meson.build b/gitg/meson.build
index af0609d2..055b3cdc 100644
--- a/gitg/meson.build
+++ b/gitg/meson.build
@@ -62,6 +62,7 @@ deps = [
   libgitg_ext_dep,
   libpeas_dep,
   libdazzle_dep,
+  json_glib_dependency,
 ]
 
 cflags = warn_flags + [
diff --git a/gitg/preferences/gitg-preferences-commit.vala b/gitg/preferences/gitg-preferences-commit.vala
index d9811790..015dc0aa 100644
--- a/gitg/preferences/gitg-preferences-commit.vala
+++ b/gitg/preferences/gitg-preferences-commit.vala
@@ -53,6 +53,12 @@ public class PreferencesCommit : Gtk.Grid, GitgExt.Preferences
        [GtkChild (name = "enable_spell_checking")]
        private Gtk.CheckButton d_enable_spell_checking;
 
+       [GtkChild (name = "spin_button_max_num_commit_messages")]
+       private Gtk.SpinButton d_spin_button_max_num_commit_messages;
+
+       [GtkChild (name = "spin_button_max_num_days_commit_messages")]
+       private Gtk.SpinButton d_spin_button_max_num_days_commit_messages;
+
        construct
        {
                var settings = new Settings(Gitg.Config.APPLICATION_ID + ".preferences.commit.message");
@@ -106,6 +112,16 @@ public class PreferencesCommit : Gtk.Grid, GitgExt.Preferences
                              "language-code",
                              SettingsBindFlags.GET | SettingsBindFlags.SET);
 
+               settings.bind("max-number-commit-messages",
+                             d_spin_button_max_num_commit_messages,
+                             "value",
+                             SettingsBindFlags.GET | SettingsBindFlags.SET);
+
+               settings.bind("max-number-days-commit-messages",
+                             d_spin_button_max_num_days_commit_messages,
+                             "value",
+                             SettingsBindFlags.GET | SettingsBindFlags.SET);
+
        }
 
        public Gtk.Widget widget
diff --git a/gitg/resources/ui/gitg-author-details-dialog.ui b/gitg/resources/ui/gitg-author-details-dialog.ui
index 009aa3bf..8519baa1 100644
--- a/gitg/resources/ui/gitg-author-details-dialog.ui
+++ b/gitg/resources/ui/gitg-author-details-dialog.ui
@@ -134,8 +134,8 @@
       </object>
     </child>
     <action-widgets>
-      <action-widget response="-6">button_cancel</action-widget>
-      <action-widget response="-5">button_save</action-widget>
+      <action-widget response="cancel">button_cancel</action-widget>
+      <action-widget response="ok">button_save</action-widget>
     </action-widgets>
   </template>
 </interface>
diff --git a/gitg/resources/ui/gitg-commit-dialog.ui b/gitg/resources/ui/gitg-commit-dialog.ui
index 3c88b78d..a2014a60 100644
--- a/gitg/resources/ui/gitg-commit-dialog.ui
+++ b/gitg/resources/ui/gitg-commit-dialog.ui
@@ -104,67 +104,6 @@
                 <property name="height">1</property>
               </packing>
             </child>
-            <child>
-              <object class="GtkCheckButton" id="check_button_sign_off">
-                <property name="label" translatable="yes">Add _signed-off-by signature</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="halign">start</property>
-                <property name="draw_indicator">True</property>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">6</property>
-                <property name="width">2</property>
-                <property name="height">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkCheckButton" id="check_button_amend">
-                <property name="label" translatable="yes">_Amend previous commit</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="halign">start</property>
-                <property name="draw_indicator">True</property>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">5</property>
-                <property name="width">2</property>
-                <property name="height">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkScrolledWindow" id="scrolled_window_message">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="hexpand">True</property>
-                <property name="vexpand">True</property>
-                <property name="shadow_type">in</property>
-                <child>
-                  <object class="GtkSourceView" id="source_view_message">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="left_margin">2</property>
-                    <property name="right_margin">2</property>
-                    <property name="auto_indent">True</property>
-                    <property name="show_right_margin">True</property>
-                    <property name="right_margin_position">72</property>
-                    <property name="smart_home_end">after</property>
-                  </object>
-                </child>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">3</property>
-                <property name="width">2</property>
-                <property name="height">1</property>
-              </packing>
-            </child>
             <child>
               <object class="GtkRevealer" id="infobar_revealer">
                 <property name="visible">True</property>
@@ -214,7 +153,34 @@
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">2</property>
-                <property name="width">2</property>
+                <property name="width">3</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkScrolledWindow" id="scrolled_window_message">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hexpand">True</property>
+                <property name="vexpand">True</property>
+                <property name="shadow_type">in</property>
+                <child>
+                  <object class="GtkSourceView" id="source_view_message">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="left_margin">2</property>
+                    <property name="right_margin">2</property>
+                    <property name="auto_indent">True</property>
+                    <property name="show_right_margin">True</property>
+                    <property name="right_margin_position">72</property>
+                    <property name="smart_home_end">after</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">3</property>
+                <property name="width">3</property>
                 <property name="height">1</property>
               </packing>
             </child>
@@ -242,10 +208,83 @@
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">4</property>
+                <property name="width">3</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="check_button_amend">
+                <property name="label" translatable="yes">_Amend previous commit</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="halign">start</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">5</property>
                 <property name="width">2</property>
                 <property name="height">1</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkCheckButton" id="check_button_sign_off">
+                <property name="label" translatable="yes">Add _signed-off-by signature</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="halign">start</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">6</property>
+                <property name="width">2</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkBox">
+                <property name="visible">True</property>
+                <style>
+                  <class name="linked"/>
+                </style>
+                <child>
+                  <object class="GtkButton" id="prev_commit_message_button">
+                    <property name="visible">True</property>
+                    <signal name="clicked" handler="on_prev_commit_message_button_clicked"/>
+                    <child>
+                      <object class="GtkImage">
+                        <property name="icon-name">pan-start-symbolic</property>
+                        <property name="visible">True</property>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkButton" id="next_commit_message_button">
+                    <property name="visible">True</property>
+                    <property name="sensitive">False</property>
+                    <signal name="clicked" handler="on_next_commit_message_button_clicked"/>
+                    <child>
+                      <object class="GtkImage">
+                        <property name="icon-name">pan-end-symbolic</property>
+                        <property name="visible">True</property>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="top_attach">6</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="expand">False</property>
@@ -256,8 +295,8 @@
       </object>
     </child>
     <action-widgets>
-      <action-widget response="-6">cancel-button</action-widget>
-      <action-widget response="-5">ok-button</action-widget>
+      <action-widget response="cancel">cancel-button</action-widget>
+      <action-widget response="ok">ok-button</action-widget>
     </action-widgets>
   </template>
 </interface>
diff --git a/gitg/resources/ui/gitg-preferences-commit.ui b/gitg/resources/ui/gitg-preferences-commit.ui
index eb55547a..67811801 100644
--- a/gitg/resources/ui/gitg-preferences-commit.ui
+++ b/gitg/resources/ui/gitg-preferences-commit.ui
@@ -8,6 +8,20 @@
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
+  <object class="GtkAdjustment" id="spin_button_max_num_commit_messages_adjustment">
+    <property name="lower">0</property>
+    <property name="upper">100</property>
+    <property name="value">10</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="spin_button_max_num_days_commit_messages_adjustment">
+    <property name="lower">0</property>
+    <property name="upper">365</property>
+    <property name="value">30</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
   <object class="GtkAdjustment" id="spin_button_subject_margin_adjustment">
     <property name="upper">100</property>
     <property name="step_increment">1</property>
@@ -176,6 +190,79 @@
                     <property name="height">1</property>
                   </packing>
                 </child>
+
+                <child>
+                  <object class="GtkLabel">
+                    <property name="label" translatable="yes">Maximum number of messages:</property>
+                    <property name="visible">True</property>
+                    <property name="halign">start</property>
+                    <property name="can_focus">False</property>
+                  </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="GtkSpinButton" id="spin_button_max_num_commit_messages">
+                    <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="adjustment">spin_button_max_num_commit_messages_adjustment</property>
+                    <property name="climb_rate">1</property>
+                    <property name="snap_to_ticks">True</property>
+                    <property name="numeric">True</property>
+                    <property name="width_chars">3</property>
+                    <property name="max_width_chars">3</property>
+                    <property name="tooltip_text" translatable="yes">Maximum number of messages to keep for 
commit message history</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">2</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+
+                <child>
+                  <object class="GtkLabel">
+                    <property name="label" translatable="yes">Maximum number of days:</property>
+                    <property name="visible">True</property>
+                    <property name="halign">start</property>
+                    <property name="can_focus">False</property>
+
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">3</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSpinButton" id="spin_button_max_num_days_commit_messages">
+                    <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="adjustment">spin_button_max_num_days_commit_messages_adjustment</property>
+                    <property name="climb_rate">1</property>
+                    <property name="snap_to_ticks">True</property>
+                    <property name="numeric">True</property>
+                    <property name="width_chars">3</property>
+                    <property name="max_width_chars">3</property>
+                    <property name="tooltip_text" translatable="yes">Maximum number of days to keep for 
commit message history</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">3</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
               </object>
               <packing>
                 <property name="left_attach">0</property>
diff --git a/meson.build b/meson.build
index 88cdb836..37bfa85a 100644
--- a/meson.build
+++ b/meson.build
@@ -139,6 +139,7 @@ libsecret_dep = dependency('libsecret-1')
 libsoup_dep = dependency('libsoup-2.4')
 libxml_dep = dependency('libxml-2.0', version: '>= 2.9.0')
 libdazzle_dep = dependency('libdazzle-1.0')
+json_glib_dependency = dependency('json-glib-1.0')
 
 config_dep = valac.find_library('config', dirs: vapi_dir)
 gitg_platform_support_dep = valac.find_library('gitg-platform-support', dirs: vapi_dir)


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