#!/usr/bin/env python3 # Copyright (C) 2024-2025 Mike Gabriel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # This script removes obsolete app names from com.lomiri.content.hub.source # and com.lomiri.content.hub.destination gsettings user configurations. from gi.repository import Gio peers=["pictures", "videos"] deprecated_appnames=["gallery-app", "gallery.ubports"] for peer in peers: # Retrieve source peers as list of strings src_gsettings = Gio.Settings.new("com.lomiri.content.hub.source") src_peers_current = src_gsettings.get_strv(peer) # Retrieve destination peers as list of strings dst_gsettings = Gio.Settings.new("com.lomiri.content.hub.destination") dst_peers_current = dst_gsettings.get_strv(peer) #print ("SRC_CURRENT ({peer}): {src_peers_current}".format(peer=peer, src_peers_current=src_peers_current)) #print ("DST_CURRENT ({peer}): {dst_peers_current}".format(peer=peer, dst_peers_current=dst_peers_current)) src_peers_updated=[] dst_peers_updated=[] for src_peer in src_peers_current: if src_peer not in deprecated_appnames: src_peers_updated.append(src_peer) for dst_peer in dst_peers_current: if dst_peer not in deprecated_appnames: dst_peers_updated.append(dst_peer) #print ("SRC_CURRENT ({peer}): {src_peers_updated}".format(peer=peer, src_peers_updated=src_peers_updated)) #print ("DST_CURRENT ({peer}): {dst_peers_updated}".format(peer=peer, dst_peers_updated=dst_peers_updated)) src_gsettings.set_strv(peer, src_peers_updated) dst_gsettings.set_strv(peer, dst_peers_updated)