[gtk+/gtk-3-20] GtkPlacesView: check for network:// URI support before using it
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-20] GtkPlacesView: check for network:// URI support before using it
- Date: Thu, 5 May 2016 19:23:34 +0000 (UTC)
commit 86855f7531ecc427ede1a93e317673c92edfe6e9
Author: Руслан Ижбулатов <lrn1986 gmail com>
Date: Sun May 1 19:00:25 2016 +0000
GtkPlacesView: check for network:// URI support before using it
Specifically, this URI is not supported on Windows, but GFile will
do its "best" and turn it into GLocalFile("$pwd/network"), with
spectacularly bad results.
https://bugzilla.gnome.org/show_bug.cgi?id=765858
gtk/gtkplacesview.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkplacesview.c b/gtk/gtkplacesview.c
index b91394f..162434a 100644
--- a/gtk/gtkplacesview.c
+++ b/gtk/gtkplacesview.c
@@ -19,6 +19,7 @@
#include "config.h"
#include <gio/gio.h>
+#include <gio/gvfs.h>
#include <gtk/gtk.h>
#include "gtkintl.h"
@@ -1003,8 +1004,19 @@ fetch_networks (GtkPlacesView *view)
{
GtkPlacesViewPrivate *priv;
GFile *network_file;
+ const gchar * const *supported_uris;
+ gboolean found;
priv = gtk_places_view_get_instance_private (view);
+ supported_uris = g_vfs_get_supported_uri_schemes (g_vfs_get_default ());
+
+ for (found = FALSE; !found && supported_uris && supported_uris[0]; supported_uris++)
+ if (g_strcmp0 (supported_uris[0], "network") == 0)
+ found = TRUE;
+
+ if (!found)
+ return;
+
network_file = g_file_new_for_uri ("network:///");
g_cancellable_cancel (priv->networks_fetching_cancellable);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]