[geany/geany] df27d1: Setup VTE stash group in init_pref_groups() (PR #3156)

Thomas Martitz git-noreply at geany.org
Mon Apr 11 22:59:31 UTC 2022


Branch:      refs/heads/master
Author:      Thomas Martitz <thomas.martitz at mailbox.org>
Committer:   Thomas Martitz <thomas.martitz at mailbox.org>
Date:        Mon, 11 Apr 2022 22:59:31 UTC
Commit:      df27d1b226bd7261be5482b06d3a69123ff0c514
             https://github.com/geany/geany/commit/df27d1b226bd7261be5482b06d3a69123ff0c514

Log Message:
-----------
Setup VTE stash group in init_pref_groups() (PR #3156)

Like with all other stash groups, the VTE one is now set up in
init_pref_groups(), along with the terminal various pref group.

Since be739e2 ("session.conf split follow-up #3"), the send_cmd_prefix
pref was read from the configuration before setting up the stash group,
which caused the "Follow path of the current file" feature to crash
Geany. I.e. the fix is to set up the stash group even earlier.

In my optionion, it's also beneficial that the overall stash groups
do not depend on loading libvte or not. For example, previously the
terminal various pref group was only added when loading libvte was not
disabled. When it was disabled the end result was inconsistent with
the manual. Now the terminal group appears unconditionally.

Fixes be739e2 ("session.conf split follow-up #3")
Fixes #3151


Modified Paths:
--------------
    src/keyfile.c

Modified: src/keyfile.c
21 lines changed, 11 insertions(+), 10 deletions(-)
===================================================================
@@ -299,6 +299,17 @@ static void init_pref_groups(void)
 		"socket_remote_cmd_port", SOCKET_WINDOWS_REMOTE_CMD_PORT);
 #endif
 
+#ifdef HAVE_VTE
+	/* various VTE prefs. */
+	group = stash_group_new("VTE");
+	configuration_add_various_pref_group(group, "terminal");
+
+	stash_group_add_string(group, &vte_config.send_cmd_prefix,
+		"send_cmd_prefix", "");
+	stash_group_add_boolean(group, &vte_config.send_selection_unsafe,
+		"send_selection_unsafe", FALSE);
+#endif
+
 	/* Note: Interface-related various prefs are in ui_init_prefs() */
 
 	/* various build-menu prefs */
@@ -911,7 +922,6 @@ static void load_dialog_prefs(GKeyFile *config)
 	if (vte_info.load_vte && vte_info.load_vte_cmdline /* not disabled on the cmdline */)
 	{
 		VteConfig *vc = &vte_config;
-		StashGroup *group;
 		struct passwd *pw = getpwuid(getuid());
 		const gchar *shell = (pw != NULL) ? pw->pw_shell : "/bin/sh";
 
@@ -943,15 +953,6 @@ static void load_dialog_prefs(GKeyFile *config)
 		vc->scrollback_lines = utils_get_setting_integer(config, "VTE", "scrollback_lines", 500);
 		get_setting_color(config, "VTE", "colour_fore", &vc->colour_fore, "#ffffff");
 		get_setting_color(config, "VTE", "colour_back", &vc->colour_back, "#000000");
-
-		/* various VTE prefs.
-		 * this can't be done in init_pref_groups() because we need to know the value of
-		 * vte_info.load_vte, and `vc` to be initialized */
-		group = stash_group_new("VTE");
-		configuration_add_various_pref_group(group, "terminal");
-
-		stash_group_add_string(group, &vc->send_cmd_prefix, "send_cmd_prefix", "");
-		stash_group_add_boolean(group, &vc->send_selection_unsafe, "send_selection_unsafe", FALSE);
 	}
 #endif
 	/* templates */



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


More information about the Commits mailing list