[Xfce4-commits] <thunar:master> Add function thunar_g_vfs_is_uri_scheme_supported (const gchar *).

Jannis Pohlmann jannis at xfce.org
Thu Sep 3 16:06:02 CEST 2009


Updating branch refs/heads/master
         to 8fc1f1d497b935da3f2e36b353bfa7b9011f351e (commit)
       from ce5907275f341662275bcf1ff38f8b18142e28bc (commit)

commit 8fc1f1d497b935da3f2e36b353bfa7b9011f351e
Author: Jannis Pohlmann <jannis at xfce.org>
Date:   Thu Sep 3 15:59:25 2009 +0200

    Add function thunar_g_vfs_is_uri_scheme_supported (const gchar *).
    
    This function checks whether an URI scheme is supported on the system or
    not. It will be used by Thunar to find out whether to show/hide
    important system paths like trash:// and network:// in the side pane and
    in the go to menu.

 thunar/thunar-gio-extensions.c |   22 ++++++++++++++++++++++
 thunar/thunar-gio-extensions.h |    2 ++
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/thunar/thunar-gio-extensions.c b/thunar/thunar-gio-extensions.c
index 907b402..599ce87 100644
--- a/thunar/thunar-gio-extensions.c
+++ b/thunar/thunar-gio-extensions.c
@@ -218,6 +218,28 @@ thunar_g_file_get_location (GFile *file)
 
 
 
+gboolean
+thunar_g_vfs_is_uri_scheme_supported (const gchar *scheme)
+{
+  const gchar * const *supported_schemes;
+  gboolean             supported = FALSE;
+  guint                n;
+  GVfs                *gvfs;
+
+  _thunar_return_val_if_fail (scheme != NULL && *scheme != '\0', FALSE);
+
+  gvfs = g_vfs_get_default ();
+  supported_schemes = g_vfs_get_supported_uri_schemes (gvfs);
+
+  for (n = 0; !supported && supported_schemes[n] != NULL; ++n) 
+    if (g_strcmp0 (supported_schemes[n], scheme) == 0)
+      supported = TRUE;
+
+  return supported;
+}
+
+
+
 GType
 thunar_g_file_list_get_type (void)
 {
diff --git a/thunar/thunar-gio-extensions.h b/thunar/thunar-gio-extensions.h
index 0b09fa2..69219cc 100644
--- a/thunar/thunar-gio-extensions.h
+++ b/thunar/thunar-gio-extensions.h
@@ -45,6 +45,8 @@ gboolean  thunar_g_file_write_key_file           (GFile          *file,
 
 gchar    *thunar_g_file_get_location             (GFile          *file);
 
+gboolean  thunar_g_vfs_is_uri_scheme_supported   (const gchar    *scheme);
+
 /**
  * THUNAR_TYPE_G_FILE_LIST:
  *



More information about the Xfce4-commits mailing list