Merge pull request #86 from JosephMcc/focus-1

Focus view when opening files from the filebrowser or documents panel
This commit is contained in:
JosephMcc 2017-02-15 16:05:44 -08:00 committed by GitHub
commit e1a7919ebd
4 changed files with 18 additions and 3 deletions

View File

@ -593,14 +593,15 @@ button_press_event (GtkWidget *widget,
if (event->type == GDK_2BUTTON_PRESS)
{
/* Chain up, must be before activating the selected
items because this will cause the view to grab focus */
widget_parent->button_press_event (widget, event);
if (view->priv->double_click_path[1] &&
gtk_tree_path_compare (view->priv->double_click_path[0], view->priv->double_click_path[1]) == 0)
{
activate_selected_items (view);
}
/* Chain up */
widget_parent->button_press_event (widget, event);
}
else
{

View File

@ -193,6 +193,9 @@ load_file_list (XedWindow *window,
{
_xed_tab_load (tab, l->data, encoding, line_pos, create);
/* make sure the view has focus */
gtk_widget_grab_focus (GTK_WIDGET (xed_tab_get_view (tab)));
l = g_slist_next (l);
jump_to = FALSE;

View File

@ -716,6 +716,14 @@ xed_documents_panel_init (XedDocumentsPanel *panel)
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (panel->priv->treeview), FALSE);
gtk_tree_view_set_reorderable (GTK_TREE_VIEW (panel->priv->treeview), TRUE);
/* Disable search because each time the selection is changed, the
active tab is changed which focusses the view, and thus would remove
the search entry, rendering it useless */
gtk_tree_view_set_enable_search (GTK_TREE_VIEW (panel->priv->treeview), FALSE);
/* Disable focus so it doesn't steel focus each time from the view */
gtk_widget_set_can_focus (panel->priv->treeview, FALSE);
g_object_set (panel->priv->treeview, "has-tooltip", TRUE, NULL);
gtk_widget_show (panel->priv->treeview);

View File

@ -3970,6 +3970,9 @@ xed_window_set_active_tab (XedWindow *window,
page_num = gtk_notebook_page_num (GTK_NOTEBOOK(window->priv->notebook), GTK_WIDGET(tab));
g_return_if_fail(page_num != -1);
gtk_notebook_set_current_page (GTK_NOTEBOOK(window->priv->notebook), page_num);
/* Make sure to grab focus if the page didn't change */
gtk_widget_grab_focus (GTK_WIDGET (xed_tab_get_view (tab)));
}
/**