[geany/geany] 373852: Fix plugin manager UI synchronization on double click

Colomban Wendling git-noreply at xxxxx
Tue Apr 3 21:53:39 UTC 2018

Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Sat, 10 Mar 2018 22:37:31 UTC
Commit:      373852c737a4181dd576c02ffe085a915b79a953

Log Message:
Fix plugin manager UI synchronization on double click

When toggling a plugin, we temporarily set the tree store's row entry
for the plugin pointer to NULL as we destroy and reload the selected
plugin, and its pointer would be invalid in the meantime.  This results
in the filter we use to display search results to temporarily hide the
row, changing the actual number of rows and thus, depending on timing,
this will or will not change the selected row (it will when double
clicking, not when single-clicking), in a seemingly more or less random
fashion as we use a sorted model.

Finally, as we manually update the buttons visibility for the toggled
plugin (as we otherwise do only for changing selection, which should
not happen in this case -- well, most of the time as you can see), this
can lead to the buttons to be updated for a now unselected row, getting
those out of sync.

The fix here is not to actually hide rows with a NULL plugin, because
it can only happen in 2 cases, where we actually want to see it:

1. while toggling a plugin, as explained above, in which case it had to
   match the search already.
2. when there is no plugins and we want to display a "No plugins
   available" message, and the search should not affect this.

This incidentally also fix the "No plugins available" so it's actually
visible, instead of always hidden.

Fixes #1781.

Modified Paths:

Modified: src/plugins.c
2 lines changed, 1 insertions(+), 1 deletions(-)
@@ -1767,7 +1767,7 @@ static gboolean pm_tree_filter_func(GtkTreeModel *model, GtkTreeIter *iter, gpoi
 	gtk_tree_model_get(model, iter, PLUGIN_COLUMN_PLUGIN, &plugin, -1);
 	if (!plugin)
-		return FALSE;
+		return TRUE;
 	key = gtk_entry_get_text(GTK_ENTRY(pm_widgets.filter_entry));
 	filename = g_path_get_basename(plugin->filename);

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