[Github-comments] [geany/geany] WIP: Split geany.conf into geany.conf (preferences) and session.conf (recent files and VTE session) (#2776)

Thomas Martitz notifications at xxxxx
Sun Apr 4 19:13:47 UTC 2021


@kugel- requested changes on this pull request.



> @@ -1187,6 +1214,22 @@ gboolean configuration_load(void)
 }
 
 
+gboolean configuration_load(void)
+{
+	gboolean prefs_loaded = read_config_file(PREFERENCES_FILE, PREFERENCES);
+	/* backwards-compatibility: try to read session from preferences if session file doesn't exist */
+	gchar *session_filename = SESSION_FILE;
+	gchar *session_file = g_build_filename(app->configdir, session_filename, NULL);

`g_free(session_file)` is missing

> -	load_dialog_prefs(config);
-	load_ui_prefs(config);
-	project_load_prefs(config);
-	configuration_load_session_files(config, TRUE);
-
+	switch (payload)
+	{
+		case PREFERENCES:
+			load_dialog_prefs(config);
+			load_ui_prefs(config);
+			project_load_prefs(config);
+			break;
+		case SESSION:
+			configuration_load_session_files(config, TRUE);
+			break;
+	}
 	/* this signal can be used e.g. to delay building UI elements until settings have been read */
 	g_signal_emit_by_name(geany_object, "load-settings", config);

The signal should be emitted only once, arguably for the PREFERENCES payload. Might add another signal for load-session ?

>  {
 	GKeyFile *config = g_key_file_new();
-	gchar *configfile = g_build_filename(app->configdir, "geany.conf", NULL);
+	gchar *configfile = g_build_filename(app->configdir, filename, NULL);
 	gchar *data;
 
 	g_key_file_load_from_file(config, configfile, G_KEY_FILE_NONE, NULL);
 
 	/* this signal can be used e.g. to prepare any settings before Stash code reads them below */
 	g_signal_emit_by_name(geany_object, "save-settings", config);

The signal should be emitted only once, arguably for the PREFERENCES payload. Might add another signal for save-session?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/2776#pullrequestreview-627564285
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20210404/32e453c6/attachment.htm>


More information about the Github-comments mailing list