[geany/geany] 55382d: Comment out copied contents opening `Tools->Configuration Files`

Nick Treleaven git-noreply at xxxxx
Tue Jun 4 15:25:10 UTC 2019


Branch:      refs/heads/master
Author:      Nick Treleaven <n at trelsoft.com>
Committer:   Nick Treleaven <n at trelsoft.com>
Date:        Tue, 04 Jun 2019 15:25:10 UTC
Commit:      55382df297e287bb46793bdcfa19aafe04c0cc14
             https://github.com/geany/geany/commit/55382df297e287bb46793bdcfa19aafe04c0cc14

Log Message:
-----------
Comment out copied contents opening `Tools->Configuration Files`

Discourage the user from overriding system settings unnecessarily.


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

Modified: src/ui_utils.c
15 lines changed, 13 insertions(+), 2 deletions(-)
===================================================================
@@ -36,6 +36,7 @@
 #include "filetypes.h"
 #include "geanymenubuttonaction.h"
 #include "keyfile.h"
+#include "keybindings.h"
 #include "main.h"
 #include "msgwindow.h"
 #include "prefs.h"
@@ -2096,6 +2097,7 @@ static void on_config_file_clicked(GtkWidget *widget, gpointer user_data)
 		gchar *global_file;
 		gchar *base_name = NULL;
 		gchar *global_content = NULL;
+		GeanyDocument *doc = NULL;
 
 		/* get the path inside app->configdir - can contain subdirectories */
 		if (g_str_has_prefix(file_name, app->configdir))
@@ -2115,8 +2117,17 @@ static void on_config_file_clicked(GtkWidget *widget, gpointer user_data)
 		if (g_file_test(global_file, G_FILE_TEST_EXISTS))
 			g_file_get_contents(global_file, &global_content, NULL, NULL);
 
-		document_new_file(utf8_filename, ft, global_content);
-
+		doc = document_new_file(utf8_filename, ft, global_content);
+		if (global_content)
+		{
+			sci_select_all(doc->editor->sci);
+			keybindings_send_command(GEANY_KEY_GROUP_FORMAT,
+				GEANY_KEYS_FORMAT_COMMENTLINETOGGLE);
+			sci_set_current_line(doc->editor->sci, 0);
+			document_set_text_changed(doc, FALSE);
+			sci_empty_undo_buffer(doc->editor->sci);
+			ui_document_show_hide(doc); /* update the document menu */
+		}
 		utils_free_pointers(4, utf8_filename, base_name, global_file, global_content, NULL);
 	}
 }



--------------
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