LarsGit223 requested changes on this pull request. Fine for me, except that ```cb_table_convert_change_document``` should also be a static function.
> @@ -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 } +}; I guess that's fine now. > @@ -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) Should still be static. Unless you prefer it that way. > @@ -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 && ( Ok, when the events are fired, a document is most likely just opened or switched to so there most likely cannot be a selection (yet). > @@ -70,6 +70,6 @@ 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); See above. Should be static and removed from the header file. -- 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-plugins/pull/922#pullrequestreview-299566518