[Commits] [SCM] claws branch, gtk3tree, updated. 4.0.0-391-g03c832558
paul at claws-mail.org
paul at claws-mail.org
Wed Nov 3 11:27:10 UTC 2021
The branch, gtk3tree has been updated
via 03c8325582d133a4c174fe91eb9127ce38e0c245 (commit)
from 310b2ad9bd68831bc4c58166e0d219da249bc823 (commit)
Summary of changes:
src/plugins/vcalendar/vcal_folder.c | 41 +++++++++++++++++++++++++++++++++++--
1 file changed, 39 insertions(+), 2 deletions(-)
- Log -----------------------------------------------------------------
commit 03c8325582d133a4c174fe91eb9127ce38e0c245
Author: wwp <subscript at free.fr>
Date: Mon Oct 25 23:38:53 2021 +0200
Subscribe to Webcal: use any URI found in the clipboard.
diff --git a/src/plugins/vcalendar/vcal_folder.c b/src/plugins/vcalendar/vcal_folder.c
index 050fb4e27..5e86ef145 100644
--- a/src/plugins/vcalendar/vcal_folder.c
+++ b/src/plugins/vcalendar/vcal_folder.c
@@ -1,6 +1,6 @@
/*
* Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2019 Colin Leroy <colin at colino.net> and
+ * Copyright (C) 1999-2021 Colin Leroy <colin at colino.net> and
* the Claws Mail team
*
* This program is free software; you can redistribute it and/or modify
@@ -1958,8 +1958,45 @@ static void subscribe_cal_cb(GtkAction *action, gpointer data)
{
gchar *uri = NULL;
gchar *tmp = NULL;
+ gchar *clip_text = NULL, *str = NULL;
+
+ clip_text = gtk_clipboard_wait_for_text(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD));
+
+ if (clip_text) {
+ str = clip_text;
+#if GLIB_CHECK_VERSION(2,66,0)
+ GError *error = NULL;
+ GUri *uri = NULL;
+
+ /* skip any leading white-space */
+ while (str && *str && g_ascii_isspace(*str))
+ str++;
+ uri = g_uri_parse(str, G_URI_FLAGS_PARSE_RELAXED, &error);
+ if (error) {
+ g_warning("could not parse clipboard text for URI: '%s'", error->message);
+ g_error_free(error);
+ }
+ if (uri) {
+ gchar* newstr = g_uri_to_string(uri);
+
+ debug_print("URI: '%s' -> '%s'\n", str, newstr ? newstr : "N/A");
+ if (newstr)
+ g_free(newstr);
+ g_uri_unref(uri);
+ } else {
+#else
+ if (!is_uri_string(str)) {
+#endif
+ /* if no URL, ignore clipboard text */
+ str = NULL;
+ }
+ }
+
+ tmp = input_dialog(_("Subscribe to Webcal"), _("Enter the Webcal URL:"), str ? str : "");
+
+ if (clip_text)
+ g_free(clip_text);
- tmp = input_dialog(_("Subscribe to Webcal"), _("Enter the Webcal URL:"), NULL);
if (tmp == NULL)
return;
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list