[Commits] [SCM] claws branch, gtk3, updated. 3.16.0-134-g3a6cbce

ticho at claws-mail.org ticho at claws-mail.org
Thu Mar 29 18:00:02 CEST 2018


The branch, gtk3 has been updated
       via  3a6cbced6a165f88a5425cf6e439006d54b77914 (commit)
       via  dcf173517d2de2369b89608451d3c970e40f6350 (commit)
       via  1951a3c95326b63c4ddcbd1136e1e0f3c5c0db2a (commit)
       via  a9c2aa1702119098180150dcc5bc84f3f3970c2f (commit)
       via  a7cdcbf8b2d2ca45eebe1221065dab75255d5276 (commit)
      from  69e78a5c4ea363205d4bbe2cbc56aea45768acd6 (commit)

Summary of changes:
 src/addressadd.c                      |    5 +++
 src/gtk/quicksearch.c                 |   65 +++++++++------------------------
 src/gtk/quicksearch.h                 |    2 +-
 src/mainwindow.c                      |   33 ++++-------------
 src/plugins/att_remover/att_remover.c |   37 ++++++++++++++-----
 src/plugins/perl/perl_plugin.c        |    9 +++--
 6 files changed, 62 insertions(+), 89 deletions(-)


- Log -----------------------------------------------------------------
commit 3a6cbced6a165f88a5425cf6e439006d54b77914
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Fri Mar 9 19:24:44 2018 +0100

    Change how main window's keyboard accelerators are bypassed when quicksearch has focus.
    
    Instead of artificially forwarding the keypress to quicksearch
    (only when Shift is pressed), we emit a new "key-press-event"
    signal directly to the quicksearch entry, and block the original
    signal before it reaches the accelerator handling.
    
    Closes bug #3984: Copy-paste in find/filter field works incorrectly

diff --git a/src/gtk/quicksearch.c b/src/gtk/quicksearch.c
index 3242aa7..289314b 100644
--- a/src/gtk/quicksearch.c
+++ b/src/gtk/quicksearch.c
@@ -332,7 +332,18 @@ static void searchbar_changed_cb(GtkWidget *widget, QuickSearch *qs)
 static gboolean searchbar_pressed(GtkWidget *widget, GdkEventKey *event,
 			      	  QuickSearch *quicksearch)
 {
-	if (event && (event->keyval == GDK_KEY_Escape)) {
+	if (event != NULL && (event->keyval == GDK_KEY_ISO_Left_Tab)) {
+		/* Shift+Tab moves focus "back" */
+		gtk_widget_grab_focus(quicksearch->search_type);
+		return TRUE;
+	}
+	if (event != NULL && (event->keyval == GDK_KEY_Tab)) {
+		/* Just Tab moves focus "forwards" */
+		gtk_widget_grab_focus(quicksearch->clear_search);
+		return TRUE;
+	}
+
+	if (event != NULL && (event->keyval == GDK_KEY_Escape)) {
 		gchar *str;
 
 		quicksearch->in_typing = FALSE;
@@ -869,6 +880,11 @@ GtkWidget *quicksearch_get_widget(QuickSearch *quicksearch)
 	return quicksearch->hbox_search;
 }
 
+GtkWidget *quicksearch_get_entry(QuickSearch *quicksearch)
+{
+	return gtk_bin_get_child(GTK_BIN(quicksearch->search_string_entry));
+}
+
 void quicksearch_show(QuickSearch *quicksearch)
 {
 	MainWindow *mainwin = mainwindow_get_mainwindow();
@@ -989,53 +1005,6 @@ gboolean quicksearch_is_running(QuickSearch *quicksearch)
 	return quicksearch->running;
 }
 
-void quicksearch_pass_key(QuickSearch *quicksearch, guint val, GdkModifierType mod)
-{
-	GtkEntry *entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN((quicksearch->search_string_entry))));
-	glong curpos = gtk_editable_get_position(GTK_EDITABLE(entry));
-	guint32 c;
-	char *str = g_strdup(gtk_entry_get_text(entry));
-	char *begin = str;
-	char *end = NULL;
-	char *new = NULL;
-	char key[7] = "";
-	gint char_len = 0;
-
-	if (gtk_editable_get_selection_bounds(GTK_EDITABLE(entry), NULL, NULL)) {
-		/* remove selection */
-		gtk_editable_delete_selection(GTK_EDITABLE(entry));
-		curpos = gtk_editable_get_position(GTK_EDITABLE(entry));
-		/* refresh string */
-		g_free(str);
-		str = g_strdup(gtk_entry_get_text(entry));
-		begin = str;
-	}
-
-	if (!(c = gdk_keyval_to_unicode(val))) {
-		g_free(str);
-		return;
-	}
-	char_len = g_unichar_to_utf8(c, key);
-	if (char_len < 0)
-		return;
-	key[char_len] = '\0';
-	if (curpos < g_utf8_strlen(str, -1)) {
-		gchar *stop = g_utf8_offset_to_pointer(begin, curpos);
-		end = g_strdup(g_utf8_offset_to_pointer(str, curpos));
-		*stop = '\0';
-		new = g_strdup_printf("%s%s%s", begin, key, end);
-		gtk_entry_set_text(entry, new);
-		g_free(end);
-	} else {
-		new = g_strdup_printf("%s%s", begin, key);
-		gtk_entry_set_text(entry, new);
-	}
-	g_free(str);
-	g_free(new);
-	gtk_editable_set_position(GTK_EDITABLE(entry), curpos+1);
-
-}
-
 gboolean quicksearch_is_in_typing(QuickSearch *quicksearch)
 {
 	return quicksearch->in_typing;
diff --git a/src/gtk/quicksearch.h b/src/gtk/quicksearch.h
index c1a26bf..9aada6e 100644
--- a/src/gtk/quicksearch.h
+++ b/src/gtk/quicksearch.h
@@ -30,6 +30,7 @@ typedef void (*QuickSearchExecuteCallback) (QuickSearch *quicksearch, gpointer d
 
 QuickSearch *quicksearch_new();
 GtkWidget *quicksearch_get_widget(QuickSearch *quicksearch);
+GtkWidget *quicksearch_get_entry(QuickSearch *quicksearch);
 void quicksearch_show(QuickSearch *quicksearch);
 void quicksearch_hide(QuickSearch *quicksearch);
 void quicksearch_set(QuickSearch *quicksearch, AdvancedSearchType type, const gchar *matchstring);
@@ -45,7 +46,6 @@ gboolean quicksearch_run_on_folder(QuickSearch* quicksearch, FolderItem *folderI
 
 gboolean quicksearch_is_running(QuickSearch *quicksearch);
 gboolean quicksearch_has_focus(QuickSearch *quicksearch);
-void quicksearch_pass_key(QuickSearch *quicksearch, guint val, GdkModifierType mod);
 gboolean quicksearch_is_fast(QuickSearch *quicksearch);
 gboolean quicksearch_is_in_typing(QuickSearch *quicksearch);
 void quicksearch_relayout(QuickSearch *quicksearch);
diff --git a/src/mainwindow.c b/src/mainwindow.c
index 7551ab1..20cebec 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -30,6 +30,7 @@
 #include "folderview.h"
 #include "folder_item_prefs.h"
 #include "foldersel.h"
+#include "quicksearch.h"
 #include "summaryview.h"
 #include "summary_search.h"
 #include "messageview.h"
@@ -921,27 +922,8 @@ static GtkRadioActionEntry mainwin_radio_dec_entries[] =
 };
 
 static gboolean offline_ask_sync = TRUE;
-static guint lastkey;
 static gboolean is_obscured = FALSE;
 
-static gboolean main_window_accel_activate (GtkAccelGroup *accelgroup,
-                                            GObject *arg1,
-                                            guint value,
-                                            GdkModifierType mod,
-                                            gpointer user_data) 
-{
-	MainWindow *mainwin = (MainWindow *)user_data;
-
-	if (mainwin->summaryview &&
-	    mainwin->summaryview->quicksearch &&
-	    quicksearch_has_focus(mainwin->summaryview->quicksearch) &&
-	    (mod == 0 || mod == GDK_SHIFT_MASK)) {
-		quicksearch_pass_key(mainwin->summaryview->quicksearch, lastkey, mod);
-		return TRUE;
-	}
-	return FALSE;
-}
-
 #define N_COLOR_LABELS colorlabel_get_color_count()
 
 static void mainwindow_colorlabel_menu_item_activate_item_cb(GtkMenuItem *menu_item,
@@ -1379,14 +1361,16 @@ static gboolean mainwindow_key_pressed (GtkWidget *widget, GdkEventKey *event,
 				    gpointer data)
 {
 	MainWindow *mainwin = (MainWindow*) data;
-	
+
 	if (!mainwin || !event) 
 		return FALSE;
 
 	if (quicksearch_has_focus(mainwin->summaryview->quicksearch))
 	{
-		lastkey = event->keyval;
-		return FALSE;
+		GtkWidget *entry =
+			quicksearch_get_entry(mainwin->summaryview->quicksearch);
+		g_signal_emit_by_name(entry, "key-press-event", event, data);
+		return TRUE;
 	}
 
 	switch (event->keyval) {
@@ -2174,10 +2158,7 @@ MainWindow *main_window_create()
 #define	ADD_MENU_ACCEL_GROUP_TO_WINDOW(menu,win)			\
 	gtk_window_add_accel_group					\
 		(GTK_WINDOW(win), 					\
-		 gtk_ui_manager_get_accel_group(gtkut_ui_manager())); 	\
-	g_signal_connect(G_OBJECT(gtk_ui_manager_get_accel_group(gtkut_ui_manager())), \
-			"accel_activate", 				\
-		       	G_CALLBACK(main_window_accel_activate), mainwin);
+		 gtk_ui_manager_get_accel_group(gtkut_ui_manager()));
 
 	ADD_MENU_ACCEL_GROUP_TO_WINDOW(summaryview->popupmenu, mainwin->window);
 	

commit dcf173517d2de2369b89608451d3c970e40f6350
Author: wwp <wwp at free.fr>
Date:   Wed Mar 28 23:06:15 2018 +0200

    Attachment remover: notify the user about what has been done when processing
    multiple selections.

diff --git a/src/plugins/att_remover/att_remover.c b/src/plugins/att_remover/att_remover.c
index 4684a29..ad4cf8f 100644
--- a/src/plugins/att_remover/att_remover.c
+++ b/src/plugins/att_remover/att_remover.c
@@ -418,6 +418,8 @@ static void remove_attachments(GSList *msglist)
 	SummaryView *summaryview = mainwin->summaryview;
 	GSList *cur;
 	gint msgnum = -1;
+	gint stripped_msgs = 0;
+	gint total_msgs = 0;
 	
 	if (alertpanel_full(_("Destroy attachments"),
                   _("Do you really want to remove all attachments from "
@@ -437,10 +439,12 @@ static void remove_attachments(GSList *msglist)
 		MsgInfo *newmsg = NULL;
 		MimeInfo *info = NULL;
 		MimeInfo *partinfo = NULL;
+		MimeInfo *nextpartinfo = NULL;
 
 		if (!msginfo)
 			continue;
-		
+		total_msgs++;			/* count all processed messages */
+
 		newmsg = procmsg_msginfo_copy(msginfo);
 		info = procmime_scan_message(newmsg);
 	
@@ -448,12 +452,27 @@ static void remove_attachments(GSList *msglist)
 			procmsg_msginfo_free(&newmsg);
 			continue;
 		}
-		partinfo->node->next = NULL;
-		partinfo->node->children = NULL;
-		info->node->children->data = partinfo;
+		/* only strip attachments where there is at least one */
+		nextpartinfo = procmime_mimeinfo_next(partinfo);
+		if (nextpartinfo) {
+			partinfo->node->next = NULL;
+			partinfo->node->children = NULL;
+			info->node->children->data = partinfo;
+
+			msgnum = save_new_message(msginfo, newmsg, info, FALSE);
 
-		msgnum = save_new_message(msginfo, newmsg, info, FALSE);		
+			stripped_msgs++;	/* count messages with removed attachment(s) */
+		}
 	}
+	if (stripped_msgs == 0) {
+		alertpanel_notice(_("The selected messages don't have any attachments."));
+	} else {
+		if (stripped_msgs != total_msgs)
+			alertpanel_notice(_("Attachments removed from %d of the %d selected messages."),
+							stripped_msgs, total_msgs);
+		else
+			alertpanel_notice(_("Attachments removed from all %d selected messages."), total_msgs);
+	}	
 
 	inc_unlock();
 	folder_item_update_thaw();
@@ -482,12 +501,10 @@ static void remove_attachments_ui(GtkAction *action, gpointer data)
 		
 		if (!partinfo) {
 			alertpanel_notice(_("This message doesn't have any attachments."));
-			g_slist_free(msglist);
-			return;
+		} else {
+			AttRemoverData.msginfo = msglist->data;
+			remove_attachments_dialog(&AttRemoverData);
 		}
-		
-		AttRemoverData.msginfo = msglist->data;
-		remove_attachments_dialog(&AttRemoverData);
 	} else
 		remove_attachments(msglist);
 

commit 1951a3c95326b63c4ddcbd1136e1e0f3c5c0db2a
Author: Michael Rasmussen <mir at datanom.net>
Date:   Wed Mar 28 13:06:26 2018 +0200

    Adapt identical behaviour to native address book. See commit 47e0437b8b
    
    Signed-off-by: Michael Rasmussen <mir at datanom.net>

diff --git a/src/addressadd.c b/src/addressadd.c
index 7ce59cc..f0f8a4c 100644
--- a/src/addressadd.c
+++ b/src/addressadd.c
@@ -466,6 +466,9 @@ static void addressadd_load_data() {
 				ADDRADD_COL_PTR, fi,
 				-1);
 	}
+
+	if (gtk_tree_model_get_iter_first(model, &iter))
+                gtk_tree_selection_select_iter(sel, &iter);
 }
 #endif
 

commit a9c2aa1702119098180150dcc5bc84f3f3970c2f
Author: Michael Rasmussen <mir at datanom.net>
Date:   Wed Mar 28 13:04:48 2018 +0200

    Fix broken build from commit 47e0437b8b
    
    Signed-off-by: Michael Rasmussen <mir at datanom.net>

diff --git a/src/addressadd.c b/src/addressadd.c
index 1b5c574..7ce59cc 100644
--- a/src/addressadd.c
+++ b/src/addressadd.c
@@ -452,11 +452,13 @@ static void addressadd_load_data() {
 	GtkTreeIter iter;
 	GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
 	GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
+	gchar *name;
 
 	addressadd_tree_clear();
 
 	list = addressbook_dbus_get_books(&error);
 	for (; list; list = g_slist_next(list)) {
+		name = (gchar *) list->data;
 		fi = addressadd_create_folderinfo(name);
 		gtk_tree_store_append(GTK_TREE_STORE(model), &iter, NULL);
 		gtk_tree_store_set(GTK_TREE_STORE(model), &iter,

commit a7cdcbf8b2d2ca45eebe1221065dab75255d5276
Author: wwp <wwp at free.fr>
Date:   Mon Mar 26 14:01:26 2018 +0200

    Remove key and free attribute value only if they are valid,
    clears CID 1220202.

diff --git a/src/plugins/perl/perl_plugin.c b/src/plugins/perl/perl_plugin.c
index 3d68b8a..9c69566 100644
--- a/src/plugins/perl/perl_plugin.c
+++ b/src/plugins/perl/perl_plugin.c
@@ -430,10 +430,11 @@ static void insert_attribute_hash(gchar *attr)
   if((tl = g_hash_table_lookup(attribute_hash,attr)) != NULL) {
     gpointer origkey;
     gpointer value;
-    g_hash_table_lookup_extended(attribute_hash,attr,&origkey,&value);
-    g_hash_table_remove(attribute_hash,origkey);
-    free_attribute_hash_key(origkey,value,NULL);
-    debug_print("Existing key `%s' freed.\n",attr);
+    if (g_hash_table_lookup_extended(attribute_hash,attr,&origkey,&value)) {
+	  g_hash_table_remove(attribute_hash,origkey);
+      free_attribute_hash_key(origkey,value,NULL);
+      debug_print("Existing key `%s' freed.\n",attr);
+    }
   }
 
   tl = g_new0(PerlPluginTimedSList,1);

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list