[Commits] [SCM] claws branch, master, updated. 3.18.0-271-gf77e02c92
wwp at claws-mail.org
wwp at claws-mail.org
Mon Oct 25 23:39:39 CEST 2021
The branch, master has been updated
via f77e02c92d8b229b8035019462c49c03a0bb8cc9 (commit)
from a57e95710c105af765b9dae51db5e9455f80cc47 (commit)
Summary of changes:
src/plugins/vcalendar/vcal_folder.c | 41 +++++++++++++++++++++++++++++++++++--
1 file changed, 39 insertions(+), 2 deletions(-)
- Log -----------------------------------------------------------------
commit f77e02c92d8b229b8035019462c49c03a0bb8cc9
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 9c07fbec2..d80951adf 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-2015 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