From: =?utf-8?q?Jeremy_B=C3=ADcha?= <jeremy.bicha@canonical.com>
Date: Sun, 13 Apr 2025 12:10:45 -0400
Subject: Revert "db_settings_dialog: Get db real path"

This reverts commit 97f78359fa286addb3c14dd1302b0e56733ba1a4.

asyncio requires pygobject 3.52
---
 gsecrets/utils.py                            |  8 ++------
 gsecrets/widgets/database_settings_dialog.py | 20 ++++++--------------
 2 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/gsecrets/utils.py b/gsecrets/utils.py
index 7b3d19a..74ce40e 100644
--- a/gsecrets/utils.py
+++ b/gsecrets/utils.py
@@ -91,12 +91,8 @@ async def get_host_path(gfile: Gio.File) -> str | None:
         logging.exception("Could not query file info")
         return gfile.get_path()
 
-    try:
-        host_path = info.get_attribute_string(ATTRIBUTE_HOST_PATH)
-    except GLib.Error:
-        logging.exception("Could not query file attribute")
-    else:
-        return host_path or gfile.get_path()
+    if host_path := info.get_attribute_string(ATTRIBUTE_HOST_PATH):
+        return host_path
 
     return gfile.get_path()
 
diff --git a/gsecrets/widgets/database_settings_dialog.py b/gsecrets/widgets/database_settings_dialog.py
index b81a994..3c18950 100644
--- a/gsecrets/widgets/database_settings_dialog.py
+++ b/gsecrets/widgets/database_settings_dialog.py
@@ -2,17 +2,17 @@
 from __future__ import annotations
 
 import logging
+import os
 import threading
 import typing
 from gettext import gettext as _
-from pathlib import Path, PurePath
+from pathlib import Path
 
 from gi.repository import Adw, Gio, GLib, GObject, Gtk
 
 from gsecrets.utils import (
     compare_passwords,
     format_time,
-    get_host_path,
 )
 
 if typing.TYPE_CHECKING:
@@ -270,18 +270,10 @@ class DatabaseSettingsDialog(Adw.PreferencesDialog):
         # Path
         path = self.database_manager.path
         gfile = Gio.File.new_for_path(path)
-
-        async def set_path():
-            path = PurePath(await get_host_path(gfile))
-
-            home = str(Path.home())
-            if path.is_relative_to(home):
-                self.path_row.props.subtitle = "~/" + str(path.relative_to(home))
-            else:
-                self.path_row.props.subtitle = str(path)
-
-        app = Gio.Application.get_default()
-        app.create_asyncio_task(set_path())
+        if "/home/" in path:
+            self.path_row.props.subtitle = "~/" + os.path.relpath(path)
+        else:
+            self.path_row.props.subtitle = path
 
         # Size
         def query_info_cb(gfile, result):
