elementary / photos

Photo viewer and organizer designed for elementary OS
https://elementary.io
GNU Lesser General Public License v2.1
107 stars 39 forks source link

Fix empty Open with context submenus #723

Closed jeremypw closed 1 year ago

jeremypw commented 1 year ago

Extracted from #675 to reduce diff.

When running as a Flatpak the "Open with" submenus currently return no items but still appear as an empty menu. This issue occurs on the Collection, Library and Direct pages. This PR fixes that.

This is effectively the same code repeated three times in different classes as virtually the same code appears 3 times in master.

DRYing is therefore possible but is left for a future PR (unless requested here). Most of the extra lines are due to code style improvements. The only change in logic is to return the number of items added to the submenu and set the sensitivity of the corresponding menu-item accordingly.