[Commits] [SCM] claws branch, gtk3, updated. 4.0.0-101-g7e9c97707
wwp at claws-mail.org
wwp at claws-mail.org
Thu Sep 2 09:37:19 UTC 2021
The branch, gtk3 has been updated
via 7e9c97707e10bdd7b18387e4c65431b746bb4a48 (commit)
from 2247e8a07da010429c08a2bed3e079b092a5853b (commit)
Summary of changes:
src/uri_opener.c | 62 +++++++++++++++++++++++++++-----------------------------
1 file changed, 30 insertions(+), 32 deletions(-)
- Log -----------------------------------------------------------------
commit 7e9c97707e10bdd7b18387e4c65431b746bb4a48
Author: wwp <subscript at free.fr>
Date: Thu Sep 2 11:36:02 2021 +0200
Allow CTRL+c over multiple selection in URL list dialog,
remove unused row selection over button press code.
diff --git a/src/uri_opener.c b/src/uri_opener.c
index eaf1caac6..34326d9a5 100644
--- a/src/uri_opener.c
+++ b/src/uri_opener.c
@@ -417,7 +417,7 @@ static void uri_opener_open_cb(GtkWidget *widget,
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(opener.urilist));
selected = gtk_tree_selection_get_selected_rows(selection, &model);
cm_return_if_fail(selected);
-
+
for(cur = selected; cur != NULL; cur = g_list_next(cur))
{
if(!gtk_tree_model_get_iter(model, &sel, (GtkTreePath *)cur->data))
@@ -448,54 +448,52 @@ static void uri_opener_select_all_cb(GtkWidget *widget,
static void uri_opener_list_copy_cb(gpointer action, gpointer data)
{
- GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(opener.urilist));
- GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(opener.urilist));
- GList *selected = gtk_tree_selection_get_selected_rows(selection, &model);;
ClickableText *uri;
GtkTreeIter sel;
+ GtkTreeModel *model;
+ GtkTreeSelection *selection;
+ GList *selected, *cur;
+ GString *uri_list_str = NULL;
- cm_return_if_fail(model);
- cm_return_if_fail(selection);
+ selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(opener.urilist));
+ selected = gtk_tree_selection_get_selected_rows(selection, &model);
cm_return_if_fail(selected);
- gtk_tree_model_get_iter(model, &sel, (GtkTreePath *)selected->data);
- gtk_tree_model_get(model, &sel, URI_OPENER_DATA, &uri, -1);
+ for(cur = selected; cur != NULL; cur = g_list_next(cur))
+ {
+ if(!gtk_tree_model_get_iter(model, &sel, (GtkTreePath *)cur->data))
+ continue;
+
+ gtk_tree_model_get(model, &sel,
+ URI_OPENER_DATA, &uri,
+ -1);
+ if (!uri)
+ continue;
- if (uri) {
+ if (!uri_list_str)
+ uri_list_str = g_string_new((const gchar*)uri->uri);
+ else
+ g_string_append_printf(uri_list_str, "\n%s", uri->uri);
+ }
+ if (uri_list_str) {
GtkClipboard *clip, *clip2;
- gint len = strlen(uri->uri);
clip = gtk_widget_get_clipboard (opener.window, GDK_SELECTION_PRIMARY);
clip2 = gtk_widget_get_clipboard (opener.window, GDK_SELECTION_CLIPBOARD);
- gtk_clipboard_set_text (clip, uri->uri, len);
- gtk_clipboard_set_text (clip2, uri->uri, len);
+ gtk_clipboard_set_text (clip, uri_list_str->str, uri_list_str->len);
+ gtk_clipboard_set_text (clip2, uri_list_str->str, uri_list_str->len);
+
+ g_string_free(uri_list_str, TRUE);
}
+
+ g_list_foreach(selected, (GFunc)gtk_tree_path_free, NULL);
+ g_list_free(selected);
}
static gint uri_opener_list_btn_pressed(GtkWidget *widget, GdkEventButton *event,
GtkTreeView *list_view)
{
if (event) {
- /* left- or right-button click */
- if (event->button == 1 || event->button == 3) {
- GtkTreePath *path = NULL;
-
- if (gtk_tree_view_get_path_at_pos(list_view, event->x, event->y,
- &path, NULL, NULL, NULL)) {
- GtkTreeModel *model = gtk_tree_view_get_model(list_view);
-
- if (path && model) {
- GtkTreeSelection *selection;
-
- /* select row */
- selection = gtk_tree_view_get_selection(list_view);
- gtk_tree_selection_select_path(selection, path);
- }
- }
- if (path)
- gtk_tree_path_free(path);
- }
-
/* right-button click */
if (event->button == 3) {
GtkTreeModel *model = gtk_tree_view_get_model(list_view);
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list