From 3be571ffe11482b97f5f56cd6f8b3d6e55719acb Mon Sep 17 00:00:00 2001 From: Jan Palus Date: Sun, 11 Dec 2016 20:25:16 +0100 Subject: [PATCH] optional patch to restore old typeahead behavior in open dialog borrowed from Arch: https://aur.archlinux.org/cgit/aur.git/tree/?h=gtk3-typeahead --- gtk+3.spec | 5 ++++ typeahead.patch | 79 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 typeahead.patch diff --git a/gtk+3.spec b/gtk+3.spec index b54d1d6..c3b2622 100644 --- a/gtk+3.spec +++ b/gtk+3.spec @@ -6,6 +6,7 @@ %bcond_without papi # PAPI print backend %bcond_without broadway # Broadway target %bcond_with mir # Mir target +%bcond_with typeahead # Typeahead in open dialog %bcond_without wayland # Wayland target %bcond_without static_libs # static library build @@ -25,6 +26,7 @@ Group: X11/Libraries Source0: http://ftp.gnome.org/pub/GNOME/sources/gtk+/3.22/gtk+-%{version}.tar.xz # Source0-md5: 55e0198f100db98f31d1b0f9dc403794 Patch0: %{name}-papi.patch +Patch1: typeahead.patch URL: http://www.gtk.org/ BuildRequires: at-spi2-atk-devel >= 2.6.0 BuildRequires: atk-devel >= 1:2.16.0 @@ -277,6 +279,9 @@ Moduł GTK+ do drukowania przez PAPI. %prep %setup -q -n gtk+-%{version} %patch0 -p1 +%if %{with typeahead} +%patch1 -p1 +%endif # for packaging clean examples # TODO: add am patch to do it like demos/gtk-demo via some configurable dir diff --git a/typeahead.patch b/typeahead.patch new file mode 100644 index 0000000..2f7bdf7 --- /dev/null +++ b/typeahead.patch @@ -0,0 +1,79 @@ +--- a/gtk/gtkfilechooserwidget.c ++++ a/gtk/gtkfilechooserwidget.c +@@ -1391,6 +1391,9 @@ + { + GtkFileChooserWidget *impl = (GtkFileChooserWidget *) widget; + GtkFileChooserWidgetPrivate *priv = impl->priv; ++ gtk_widget_grab_focus (priv->browse_files_tree_view); ++ gboolean ret; ++ g_signal_emit_by_name (priv->browse_files_tree_view, "key-press-event", event, &ret); + + if (should_trigger_location_entry (impl, event)) + { +@@ -1401,12 +1404,6 @@ + return TRUE; + } + } +- else if (gtk_search_entry_handle_event (GTK_SEARCH_ENTRY (priv->search_entry), (GdkEvent *)event)) +- { +- if (priv->operation_mode != OPERATION_MODE_SEARCH) +- operation_mode_set (impl, OPERATION_MODE_SEARCH); +- return TRUE; +- } + + if (GTK_WIDGET_CLASS (gtk_file_chooser_widget_parent_class)->key_press_event (widget, event)) + return TRUE; +@@ -2476,7 +2473,7 @@ + { + GtkFileChooserWidgetPrivate *priv = impl->priv; + +- gtk_tree_view_set_search_column (GTK_TREE_VIEW (priv->browse_files_tree_view), -1); ++ gtk_tree_view_set_search_column (GTK_TREE_VIEW (priv->browse_files_tree_view), MODEL_COL_NAME); + + gtk_tree_view_column_set_sort_column_id (priv->list_name_column, MODEL_COL_NAME); + gtk_tree_view_column_set_sort_column_id (priv->list_time_column, MODEL_COL_TIME); +@@ -4388,6 +4385,7 @@ + gtk_tree_view_set_model (GTK_TREE_VIEW (priv->browse_files_tree_view), + GTK_TREE_MODEL (priv->browse_files_model)); + update_columns (impl, FALSE, _("Modified")); ++ gtk_tree_view_set_enable_search (GTK_TREE_VIEW (priv->browse_files_tree_view), TRUE); + file_list_set_sort_column_ids (impl); + set_sort_column (impl); + profile_msg (" gtk_tree_view_set_model end", NULL); +@@ -7148,10 +7146,6 @@ + { + GList *l, *files, *files_with_info, *infos; + GFile *file; +- gboolean select = FALSE; +- +- if (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (impl->priv->search_model), NULL) == 0) +- select = TRUE; + + files = NULL; + files_with_info = NULL; +@@ -7179,8 +7173,6 @@ + g_list_free_full (infos, g_object_unref); + + gtk_stack_set_visible_child_name (GTK_STACK (impl->priv->browse_files_stack), "list"); +- if (select) +- gtk_widget_grab_focus (impl->priv->browse_files_tree_view); + } + + /* Callback used from GtkSearchEngine when the query is done running */ +@@ -7498,6 +7490,7 @@ + gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (priv->recent_model), + GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, + GTK_SORT_DESCENDING); ++ gtk_tree_view_set_enable_search (GTK_TREE_VIEW (priv->browse_files_tree_view), TRUE); + } + + typedef struct +@@ -7515,7 +7508,7 @@ + + gtk_tree_view_set_model (GTK_TREE_VIEW (priv->browse_files_tree_view), + GTK_TREE_MODEL (priv->recent_model)); +- gtk_tree_view_set_search_column (GTK_TREE_VIEW (priv->browse_files_tree_view), -1); ++ gtk_tree_view_set_search_column (GTK_TREE_VIEW (priv->browse_files_tree_view), MODEL_COL_NAME); + + gtk_tree_view_column_set_sort_column_id (priv->list_name_column, -1); + gtk_tree_view_column_set_sort_column_id (priv->list_time_column, -1); -- 2.44.0