<p><b>@LarsGit223</b> requested changes on this pull request.</p>
<hr>
<p>In <a href="https://github.com/geany/geany-plugins/pull/922#discussion_r331789146">tableconvert/src/tableconvert.c</a>:</p>
<pre style='color:#555'>> @@ -338,6 +351,31 @@ void cb_table_convert_type(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gp
convert_to_table(TRUE, GPOINTER_TO_INT(gdata));
}
+void cb_table_convert_change_document(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer gdata)
</pre>
<p>This is a local function so IMHO it should be static and only declared in <code>tableconvert.c</code> not in <code>tableconvert.h</code>.</p>
<hr>
<p>In <a href="https://github.com/geany/geany-plugins/pull/922#discussion_r331789202">tableconvert/src/tableconvert.c</a>:</p>
<pre style='color:#555'>> @@ -338,6 +351,31 @@ void cb_table_convert_type(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gp
convert_to_table(TRUE, GPOINTER_TO_INT(gdata));
}
+void cb_table_convert_change_document(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer gdata)
+{
+ set_activate_state();
+}
+
+void set_activate_state()
+{
</pre>
<p>The same here. This is only a static function.</p>
<hr>
<p>In <a href="https://github.com/geany/geany-plugins/pull/922#discussion_r331789254">tableconvert/src/tableconvert.h</a>:</p>
<pre style='color:#555'>> @@ -71,5 +71,7 @@ extern TableConvertRule tablerules[];
extern void cb_table_convert(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer gdata);
extern void cb_table_convert_type(G_GNUC_UNUSED GtkMenuItem *menuitem, gpointer gdata);
extern void convert_to_table(gboolean header, gint file_type);
+extern void cb_table_convert_change_document(G_GNUC_UNUSED GtkMenuItem *menuitem, gpointer gdata);
+extern void set_activate_state();
</pre>
<p>I suggest to move this two function declarations above to the beginning of <code>tableconvert.c</code>. And I would remove the not required <code>extern</code>.</p>
<hr>
<p>In <a href="https://github.com/geany/geany-plugins/pull/922#discussion_r331789354">tableconvert/src/tableconvert.c</a>:</p>
<pre style='color:#555'>> @@ -338,6 +351,31 @@ void cb_table_convert_type(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gp
convert_to_table(TRUE, GPOINTER_TO_INT(gdata));
}
+void cb_table_convert_change_document(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer gdata)
+{
+ set_activate_state();
+}
+
+void set_activate_state()
+{
+ // getting document
+ GeanyDocument *doc = NULL;
+ doc = document_get_current();
+
+ if (
+ doc != NULL && (
</pre>
<p>This should also check if there is a current selection or not. The function <code>convert_to_table()</code> is only doing something if there is a selection (<code>if (sci_has_selection(doc->editor->sci)) ...</code>).</p>
<hr>
<p>In <a href="https://github.com/geany/geany-plugins/pull/922#discussion_r331789414">tableconvert/src/tableconvert.c</a>:</p>
<pre style='color:#555'>> @@ -35,6 +35,19 @@ PLUGIN_SET_TRANSLATABLE_INFO(
GeanyPlugin *geany_plugin;
GeanyData *geany_data;
+
+PluginCallback plugin_callbacks[] =
+{
+ { "editor-notify", (GCallback) &cb_table_convert_change_document, FALSE, NULL },
+ { "document-activate", (GCallback) &cb_table_convert_change_document, FALSE, NULL },
+ { "document-filetype-set", (GCallback) &cb_table_convert_change_document, FALSE, NULL },
+ { "document-new", (GCallback) &cb_table_convert_change_document, FALSE, NULL},
+ { "geany-startup-complete", (GCallback) &cb_table_convert_change_document, FALSE, NULL },
+ { "document-close", (GCallback) &cb_table_convert_change_document, FALSE, NULL},
+ { NULL, NULL, FALSE, NULL }
+};
</pre>
<p>Do you really need all of this callbacks? I guess at least <code>geany-startup-complete</code> is not required or am I overseeing something?</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/922?email_source=notifications&email_token=AAIOWJZLKITT5NJBVXN4FH3QNHRI3A5CNFSM4I53SLH2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCHAKN3Y#pullrequestreview-297838319">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAIOWJ6BSW3L3BOTQYAVAN3QNHRI3ANCNFSM4I53SLHQ">mute the thread</a>.<img src="https://github.com/notifications/beacon/AAIOWJZK3I76NRZZOH3AGJTQNHRI3A5CNFSM4I53SLH2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCHAKN3Y.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/922?email_source=notifications\u0026email_token=AAIOWJZLKITT5NJBVXN4FH3QNHRI3A5CNFSM4I53SLH2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCHAKN3Y#pullrequestreview-297838319",
"url": "https://github.com/geany/geany-plugins/pull/922?email_source=notifications\u0026email_token=AAIOWJZLKITT5NJBVXN4FH3QNHRI3A5CNFSM4I53SLH2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCHAKN3Y#pullrequestreview-297838319",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>