aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-01-05 07:22:59 +0100
committerPřemysl Eric Janouch <p@janouch.name>2022-01-05 07:59:18 +0100
commitd889acc31579fa8b1bfe484f8e49ec313c9cdcd4 (patch)
treecd6dbfe5d995f012087de87f2e67dc7a17b14604
parent6142bf9c53469bd0f0f0ad3023de610b1970d7ea (diff)
downloadfiv-d889acc31579fa8b1bfe484f8e49ec313c9cdcd4.tar.gz
fiv-d889acc31579fa8b1bfe484f8e49ec313c9cdcd4.tar.xz
fiv-d889acc31579fa8b1bfe484f8e49ec313c9cdcd4.zip
Show available protocols in open location dialog
-rw-r--r--fiv-sidebar.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/fiv-sidebar.c b/fiv-sidebar.c
index 6d07456..c29ef4d 100644
--- a/fiv-sidebar.c
+++ b/fiv-sidebar.c
@@ -309,15 +309,27 @@ on_show_enter_location(
g_signal_connect(entry, "changed",
G_CALLBACK(on_enter_location_changed), self);
+ // Can't have it ellipsized and word-wrapped at the same time.
+ GtkWidget *protocols = gtk_label_new("");
+ gtk_label_set_ellipsize(GTK_LABEL(protocols), PANGO_ELLIPSIZE_END);
+ gtk_label_set_xalign(GTK_LABEL(protocols), 0);
+
+ gchar *protos = g_strjoinv(
+ ", ", (gchar **) g_vfs_get_supported_uri_schemes(g_vfs_get_default()));
+ gchar *label = g_strdup_printf("<i>Available protocols:</i> %s", protos);
+ g_free(protos);
+ gtk_label_set_markup(GTK_LABEL(protocols), label);
+ g_free(label);
+
GtkWidget *content = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
gtk_container_add(GTK_CONTAINER(content), entry);
+ gtk_container_add(GTK_CONTAINER(content), protocols);
gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), TRUE);
gtk_window_set_default_size(GTK_WINDOW(dialog), 800, -1);
-
- GdkGeometry geometry = {.max_width = G_MAXSHORT, .max_height = -1};
- gtk_window_set_geometry_hints(
- GTK_WINDOW(dialog), NULL, &geometry, GDK_HINT_MAX_SIZE);
+ gtk_window_set_geometry_hints(GTK_WINDOW(dialog), NULL,
+ &(GdkGeometry) {.max_width = G_MAXSHORT, .max_height = -1},
+ GDK_HINT_MAX_SIZE);
gtk_widget_show_all(dialog);
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {