<p>Or maybe <code>project-save</code>?</p>
<p>For the <code>project-before-save</code> event the following code would have been run (with <code>conterm=FALSE</code>):</p>
<pre><code> guint i = 0;

        plugin_idle_add(geany_plugin, settings_saved, GINT_TO_POINTER(conterm));

        foreach_document(i)
        {
                if (utils_attrib(documents[i], SCOPE_LOCK))
                        documents[i]->readonly = FALSE;
        }
</code></pre>
<p>And function <code>settings_saved</code> looks like this:</p>
<pre><code>static gboolean settings_saved(gpointer gdata)
{
        guint i = 0;

        foreach_document(i)
        {
                documents[i]->readonly = scintilla_send_message(documents[i]->editor->sci,
                        SCI_GETREADONLY, 0, 0);
        }

        if (gdata)
        {
                conterm_load_config();
                conterm_apply_config();
        }

        return FALSE;
}
</code></pre>
<p>The code in <code>if (gdata)</code> is not executed in this case as <code>gdata</code> would be <code>FALSE</code>. The function is also called on the event <code>save-settings</code> and then <code>conterm</code>/<code>gdata</code> is set to <code>TRUE</code> and the config will be reloaded. This still works fine. If I e.g. change the terminal background color in the preferences the change is applied immediately.</p>
<p>I wonder what this READONLY check is good for. Can the document status change by changing/saving the project?</p>
<p>As I never have seen the six years old code in action I can't see any difference and it looks useless to me.</p>
<p>Maybe there were plans to also save some scope settings in the project then it would make sense to also reload the config at that point. But all settings which scope loads in <code>conterm_load_config();</code> come from <code>geany.conf</code>.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/geany/geany-plugins/pull/751#issuecomment-394943434">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABDrJ0WFYH-6-tsvX6SA-QxUSgf-P7Vhks5t52aygaJpZM4UbRTM">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABDrJ93rT5gtL-x-ZGDu51CbNOYvZE1cks5t52aygaJpZM4UbRTM.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","potentialAction":{"@type":"ViewAction","target":"https://github.com/geany/geany-plugins/pull/751#issuecomment-394943434","url":"https://github.com/geany/geany-plugins/pull/751#issuecomment-394943434","name":"View Pull Request"},"description":"View this Pull Request on GitHub","publisher":{"@type":"Organization","name":"GitHub","url":"https://github.com"}}</script>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/geany/geany-plugins","title":"geany/geany-plugins","subtitle":"GitHub repository","main_image_url":"https://assets-cdn.github.com/images/email/message_cards/header.png","avatar_image_url":"https://assets-cdn.github.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/geany/geany-plugins"}},"updates":{"snippets":[{"icon":"PERSON","message":"@LarsGit223 in #751: Or maybe ```project-save```?\r\n\r\nFor the ```project-before-save``` event the following code would have been run (with ```conterm=FALSE```):\r\n```\r\n\tguint i = 0;\r\n\r\n\tplugin_idle_add(geany_plugin, settings_saved, GINT_TO_POINTER(conterm));\r\n\r\n\tforeach_document(i)\r\n\t{\r\n\t\tif (utils_attrib(documents[i], SCOPE_LOCK))\r\n\t\t\tdocuments[i]-\u003ereadonly = FALSE;\r\n\t}\r\n```\r\nAnd function ```settings_saved``` looks like this:\r\n```\r\nstatic gboolean settings_saved(gpointer gdata)\r\n{\r\n\tguint i = 0;\r\n\r\n\tforeach_document(i)\r\n\t{\r\n\t\tdocuments[i]-\u003ereadonly = scintilla_send_message(documents[i]-\u003eeditor-\u003esci,\r\n\t\t\tSCI_GETREADONLY, 0, 0);\r\n\t}\r\n\r\n\tif (gdata)\r\n\t{\r\n\t\tconterm_load_config();\r\n\t\tconterm_apply_config();\r\n\t}\r\n\r\n\treturn FALSE;\r\n}\r\n```\r\nThe code in ```if (gdata)``` is not executed in this case as ```gdata``` would be ```FALSE```. The function is also called on the event ```save-settings``` and then ```conterm```/```gdata``` is set to ```TRUE``` and the config will be reloaded. This still works fine. If I e.g. change the terminal background color in the preferences the change is applied immediately.\r\n\r\nI wonder what this READONLY check is good for. Can the document status change by changing/saving the project?\r\n\r\nAs I never have seen the six years old code in action I can't see any difference and it looks useless to me.\r\n\r\nMaybe there were plans to also save some scope settings in the project then it would make sense to also reload the config at that point. But all settings which scope loads in ```conterm_load_config();``` come from ```geany.conf```."}],"action":{"name":"View Pull Request","url":"https://github.com/geany/geany-plugins/pull/751#issuecomment-394943434"}}}</script>
<script type="application/ld+json">{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"hideOriginalBody": "false",
"originator": "37567f93-e2a7-4e2a-ad37-a9160fc62647",
"title": "Re: [geany/geany-plugins] scope: removed invalid signal 'project-before-save' and callback function (#751)",
"sections": [
{
"text": "",
"activityTitle": "**LarsGit223**",
"activityImage": "https://assets-cdn.github.com/images/email/message_cards/avatar.png",
"activitySubtitle": "@LarsGit223",
"facts": [

]
}
],
"potentialAction": [
{
"name": "Add a comment",
"@type": "ActionCard",
"inputs": [
{
"isMultiLine": true,
"@type": "TextInput",
"id": "IssueComment",
"isRequired": false
}
],
"actions": [
{
"name": "Comment",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"IssueComment\",\n\"repositoryFullName\": \"geany/geany-plugins\",\n\"issueId\": 751,\n\"IssueComment\": \"{{IssueComment.value}}\"\n}"
}
]
},
{
"name": "Close pull request",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"PullRequestClose\",\n\"repositoryFullName\": \"geany/geany-plugins\",\n\"pullRequestId\": 751\n}"
},
{
"targets": [
{
"os": "default",
"uri": "https://github.com/geany/geany-plugins/pull/751#issuecomment-394943434"
}
],
"@type": "OpenUri",
"name": "View on GitHub"
},
{
"name": "Unsubscribe",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"MuteNotification\",\n\"threadId\": 342693068\n}"
}
],
"themeColor": "26292E"
}</script>