[geany/geany-plugins] c15664: Merge pull request #920 from techee/focus_sidebar

Frank Lanitz git-noreply at xxxxx
Sun Oct 6 08:33:29 UTC 2019


Branch:      refs/heads/master
Author:      Frank Lanitz <frank at frank.uvena.de>
Committer:   GitHub <noreply at github.com>
Date:        Sun, 06 Oct 2019 08:33:29 UTC
Commit:      c156641259643ef4e32d067dd0b346e558a1a973
             https://github.com/geany/geany-plugins/commit/c156641259643ef4e32d067dd0b346e558a1a973

Log Message:
-----------
Merge pull request #920 from techee/focus_sidebar

projectorganizer: Add a keybinding for for focusing the sidebar


Modified Paths:
--------------
    projectorganizer/src/prjorg-menu.c
    projectorganizer/src/prjorg-sidebar.c
    projectorganizer/src/prjorg-sidebar.h

Modified: projectorganizer/src/prjorg-menu.c
4 lines changed, 4 insertions(+), 0 deletions(-)
===================================================================
@@ -42,6 +42,7 @@ enum
 	KB_FIND_IN_PROJECT,
 	KB_FIND_FILE,
 	KB_FIND_TAG,
+	KB_FOCUS_SIDEBAR,
 	KB_COUNT
 };
 
@@ -417,6 +418,9 @@ void prjorg_menu_init(void)
 	keybindings_set_item(key_group, KB_SWAP_HEADER_SOURCE, NULL,
 		0, 0, "swap_header_source", _("Swap header/source"), s_shs_item);
 
+    keybindings_set_item(key_group, KB_FOCUS_SIDEBAR, (GeanyKeyCallback)prjorg_sidebar_focus_project_tab,
+		0, 0, "focus_project_sidebar", _("Focus Project Sidebar"), NULL);
+
 	s_context_sep_item = gtk_separator_menu_item_new();
 	gtk_widget_show(s_context_sep_item);
 	gtk_menu_shell_prepend(GTK_MENU_SHELL(geany->main_widgets->editor_menu), s_context_sep_item);


Modified: projectorganizer/src/prjorg-sidebar.c
19 lines changed, 19 insertions(+), 0 deletions(-)
===================================================================
@@ -1493,6 +1493,25 @@ void prjorg_sidebar_find_tag_in_active(void)
 }
 
 
+void prjorg_sidebar_focus_project_tab(void)
+{
+	GtkNotebook *notebook = GTK_NOTEBOOK(geany_data->main_widgets->sidebar_notebook);
+	gint pagenum = gtk_notebook_get_n_pages(notebook);
+	gint i;
+
+	for (i = 0; i < pagenum; i++)
+	{
+		GtkWidget *page = gtk_notebook_get_nth_page(notebook, i);
+		if (page == s_file_view_vbox)
+		{
+			gtk_notebook_set_current_page(notebook, i);
+			gtk_widget_grab_focus(s_file_view);
+			break;
+		}
+	}
+}
+
+
 static void sidebar_realized_cb (GtkWidget *widget) {
 	if (s_pending_reload)
 		prjorg_sidebar_update(TRUE);


Modified: projectorganizer/src/prjorg-sidebar.h
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -29,6 +29,7 @@ void prjorg_sidebar_find_tag_in_active(void);
 
 void prjorg_sidebar_update(gboolean reload);
 
+void prjorg_sidebar_focus_project_tab(void);
 
 
 #endif



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list