[gitg/wip/albfan/type-to-search] Add typeahead find feature
- From: Alberto Fanjul <albfan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg/wip/albfan/type-to-search] Add typeahead find feature
- Date: Fri, 19 Apr 2019 10:39:47 +0000 (UTC)
commit d8a198ab2f82556a918ccf13a3b6e205d375d558
Author: Alberto Fanjul <albertofanjul gmail com>
Date: Fri Apr 19 05:58:37 2019 +0200
Add typeahead find feature
Search on commit list will start as soon as you type
gitg/gitg-window.vala | 9 +++++++++
gitg/history/gitg-history.vala | 1 -
gitg/resources/ui/gitg-commit-submodule-history-view.ui | 1 +
gitg/resources/ui/gitg-history-paned.ui | 1 +
gitg/resources/ui/gitg-window.ui | 1 +
5 files changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/gitg/gitg-window.vala b/gitg/gitg-window.vala
index 10eb95ea..47fd2d91 100644
--- a/gitg/gitg-window.vala
+++ b/gitg/gitg-window.vala
@@ -266,6 +266,15 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
}
}
+ [GtkCallback]
+ public bool on_key_pressed (Gtk.Widget widget, Gdk.EventKey event) {
+ bool ret = d_search_bar.handle_event(event);
+ if (ret) {
+ d_search_bar.search_mode_enabled = true;
+ }
+ return ret;
+ }
+
construct
{
if (Gitg.PlatformSupport.use_native_window_controls())
diff --git a/gitg/history/gitg-history.vala b/gitg/history/gitg-history.vala
index c34eab2d..df15767f 100644
--- a/gitg/history/gitg-history.vala
+++ b/gitg/history/gitg-history.vala
@@ -1134,7 +1134,6 @@ namespace GitgHistory
set
{
d_main.commit_list_view.set_search_entry(value);
- d_main.commit_list_view.set_enable_search(value != null);
if (value != null)
{
diff --git a/gitg/resources/ui/gitg-commit-submodule-history-view.ui
b/gitg/resources/ui/gitg-commit-submodule-history-view.ui
index d7d5934a..16d64958 100644
--- a/gitg/resources/ui/gitg-commit-submodule-history-view.ui
+++ b/gitg/resources/ui/gitg-commit-submodule-history-view.ui
@@ -19,6 +19,7 @@
<property name="has_focus">True</property>
<property name="fixed-height-mode">True</property>
<property name="headers-visible">False</property>
+ <property name="enable-search">False</property>
<child>
<object class="GtkTreeViewColumn" id="column_commit_list_subject">
<property name="title" translatable="yes">Subject</property>
diff --git a/gitg/resources/ui/gitg-history-paned.ui b/gitg/resources/ui/gitg-history-paned.ui
index 3f0e37f0..03894169 100644
--- a/gitg/resources/ui/gitg-history-paned.ui
+++ b/gitg/resources/ui/gitg-history-paned.ui
@@ -88,6 +88,7 @@
<property name="has_focus">True</property>
<property name="fixed-height-mode">True</property>
<property name="headers-visible">False</property>
+ <property name="enable-search">False</property>
<child>
<object class="GtkTreeViewColumn" id="column_commit_list_subject">
<property name="title" translatable="yes">Subject</property>
diff --git a/gitg/resources/ui/gitg-window.ui b/gitg/resources/ui/gitg-window.ui
index 115b957f..6259dbd3 100644
--- a/gitg/resources/ui/gitg-window.ui
+++ b/gitg/resources/ui/gitg-window.ui
@@ -9,6 +9,7 @@
<property name="default_width">1000</property>
<property name="default_height">600</property>
<property name="icon_name">gitg</property>
+ <signal name="key-press-event" after="yes" handler="on_key_pressed"/>
<child type="titlebar">
<object class="GtkHeaderBar" id="d_header_bar">
<property name="visible">True</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]