def METHOD_NAME(self, key, w):
    if key == "vaddresses":
        addresses = [
            x.strip() if "://" in x or x.strip() == "dynamic" else "tcp://%s" % (x.strip(),)
            for x in w.get_text().split(",")
        ]
        self.set_value("addresses", ",".join(addresses))
    elif key == "vfolders":
        # Generate dict of { folder_id : bool } where bool is True if
        # folder should be shared with this device
        folders = {}
        for b in self["vfolders"].get_children():
            folders[b.get_tooltip_text()] = b.get_active()
        # Go over all Folders/<folder>/Devices/<device> keys in config
        # and set them as needed
        nid = self.get_value("deviceID")
        for r in self.config["folders"]:
            rid = r["id"]
            found = False
            for n in r["devices"]:
                if n["deviceID"] == nid:
                    if rid not in folders or not folders[rid]:
                        # Remove this /<device> key (unshare folder with device)
                        r["devices"].remove(n)
                        break
                    found = True
            if (not found) and (rid in folders) and folders[rid]:
                # Add new /<device> key (share folder with device)
                r["devices"].append(
                    {"addresses": None, "deviceID": nid, "name": "", "certName": "", "compression": "metadata"}
                )
    else:
        EditorDialog.METHOD_NAME(self, key, w)