chore: consolidate is_in_favs() methods

This commit is contained in:
aclist 2026-05-01 21:46:13 +09:00
parent eb4ee41742
commit 29aeb550b3
3 changed files with 6 additions and 11 deletions

View File

@ -40,11 +40,11 @@ def get_favorites(path: Path) -> list[str]:
return conf["ip_list"]
def is_in_favs(record: str, path: Path) -> bool:
favs = get_favorites(path)
if record in favs:
return True
return False
# def is_in_favs(record: str, path: Path) -> bool:
# favs = get_favorites(path)
# if record in favs:
# return True
# return False
def enum_to_key(enum: Preferences) -> str:

View File

@ -2,7 +2,6 @@ import inspect
import logging
from typing import Any, Callable, TYPE_CHECKING
from warnings import deprecated
import dzgui.util._json as JSON # noqa
@ -373,9 +372,6 @@ class Controller(GObject.GObject):
return False
return True
# def is_in_favs(self) -> bool:
# return self.config_man.is_in_favs()
def get_config_man(self) -> ConfigManager:
return self.config_man

View File

@ -271,8 +271,7 @@ class ServerTreeView(ContextMixin, TreeView):
def is_in_favs(self) -> bool:
record = self.get_record_string()
ips = self.controller.get_config_man().lookup(Preferences.IP_LIST)
if record in ips:
if self.controller.get_config_man().is_in_favs(record):
return True
return False