[Commits] [SCM] claws branch, gtk3, updated. 4.0.0-338-ge26fd7e6d

wwp at claws-mail.org wwp at claws-mail.org
Mon Oct 25 23:40:43 CEST 2021


The branch, gtk3 has been updated
       via  e26fd7e6d4604d6e1dce78cfcdaa8be1cc7d9fc7 (commit)
      from  c64353ee158b1cc4447cb23bde4d803af6e61153 (commit)

Summary of changes:
 src/plugins/vcalendar/vcal_folder.c | 41 +++++++++++++++++++++++++++++++++++--
 1 file changed, 39 insertions(+), 2 deletions(-)


- Log -----------------------------------------------------------------
commit e26fd7e6d4604d6e1dce78cfcdaa8be1cc7d9fc7
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 161796ebc..e8a34e405 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