[Commits] [SCM] claws branch, gtk3, updated. 4.0.0-208-gc78b7acfa

wwp at claws-mail.org wwp at claws-mail.org
Wed Sep 22 14:02:38 CEST 2021


The branch, gtk3 has been updated
       via  c78b7acfa576f8a4edb645edbf58b310a7af83bb (commit)
      from  686ce43bd9b1576ec10b5c2c224c780167b8d12d (commit)

Summary of changes:
 src/plugins/rssyl/rssyl_cb_menu.c | 39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)


- Log -----------------------------------------------------------------
commit c78b7acfa576f8a4edb645edbf58b310a7af83bb
Author: wwp <subscript at free.fr>
Date:   Wed Sep 22 14:02:28 2021 +0200

    Add new RSSyl feed: use any URI found in the clipboard.

diff --git a/src/plugins/rssyl/rssyl_cb_menu.c b/src/plugins/rssyl/rssyl_cb_menu.c
index c36496465..6c08fc377 100644
--- a/src/plugins/rssyl/rssyl_cb_menu.c
+++ b/src/plugins/rssyl/rssyl_cb_menu.c
@@ -54,6 +54,7 @@ void rssyl_new_feed_cb(GtkAction *action,
 	FolderView *folderview = (FolderView*)data;
 	FolderItem *item;
 	gchar *url;
+	gchar *clip_text = NULL, *str = NULL;
 
 	debug_print("RSSyl: new_feed_cb\n");
 
@@ -63,9 +64,45 @@ void rssyl_new_feed_cb(GtkAction *action,
 	g_return_if_fail(item != NULL);
 	g_return_if_fail(item->folder != 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;
+		}
+	}
+
 	url = input_dialog(_("Subscribe feed"),
 			_("Input the URL of the news feed you wish to subscribe:"),
-			"");
+			str ? str : "");
+
+	if (clip_text)
+		g_free(clip_text);
+
 	if( url == NULL )	/* User cancelled */
 		return;
 

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list