def on_treeview_folders_cursor_changed(self, widget):
selected_row = get_treeview_selected_row(self.ui.treeview_folders)
if selected_row:
folder_name = self.model_folders.get_key(selected_row)
# Check if the folder still exists
# (model erased while the cursor moves through the Gtk.TreeView)
if folder_name in self.folders:
folder_info = self.folders[folder_name]
# Clear any previous application icon
self.model_applications.clear()
# Add new application icons
applications = folder_info.get_applications()
for application in applications:
desktop_file = applications[application]
if desktop_file or preferences.get(
preferences.PREFERENCES_SHOW_MISSING):
application_file = applications[application]
application_info = ApplicationInfo(
application,
application_file.getName()
if desktop_file else 'Missing desktop file',
application_file.getComment()
if desktop_file else application,
application_file.getIcon()
if desktop_file else None,
# Always show any application, also if hidden
True)
self.model_applications.add_data(application_info)
# Disable folder content saving
self.ui.action_files_save.set_sensitive(False)
评论列表
文章目录