[Commits] [SCM] claws branch, master, updated. 3.17.3-183-g08293cc

ticho at claws-mail.org ticho at claws-mail.org
Wed May 29 19:11:06 CEST 2019


The branch, master has been updated
       via  08293cc6790f8e465383caf9fe9e07cdadaedbe1 (commit)
      from  ac781b594702f1b06b7b24e188c10126f515a09e (commit)

Summary of changes:
 src/summaryview.c |   19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)


- Log -----------------------------------------------------------------
commit 08293cc6790f8e465383caf9fe9e07cdadaedbe1
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Wed May 29 19:10:28 2019 +0200

    Get rid of magic numbers in summary_msginfo_*_flags

diff --git a/src/summaryview.c b/src/summaryview.c
index 40d5514..96016b9 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -3618,9 +3618,14 @@ static void summary_display_msg(SummaryView *summaryview, GtkCMCTreeNode *row)
 }
 
 static gboolean defer_change(gpointer data);
+typedef enum {
+	FLAGS_UNSET,
+	FLAGS_SET,
+	FLAGS_CHANGE
+} ChangeType;
 typedef struct _ChangeData {
 	MsgInfo *info;
-	gint op; /* 0, 1, 2 for unset, set, change */
+	ChangeType op;
 	MsgPermFlags set_flags;
 	MsgTmpFlags  set_tmp_flags;
 	MsgPermFlags unset_flags;
@@ -3635,7 +3640,7 @@ static void summary_msginfo_unset_flags(MsgInfo *msginfo, MsgPermFlags flags, Ms
 	} else {
 		ChangeData *unset_data = g_new0(ChangeData, 1);
 		unset_data->info = msginfo;
-		unset_data->op = 0;
+		unset_data->op = FLAGS_UNSET;
 		unset_data->unset_flags = flags;
 		unset_data->unset_tmp_flags = tmp_flags;
 		debug_print("flags: deferring unset\n");
@@ -3651,7 +3656,7 @@ static void summary_msginfo_set_flags(MsgInfo *msginfo, MsgPermFlags flags, MsgT
 	} else {
 		ChangeData *set_data = g_new0(ChangeData, 1);
 		set_data->info = msginfo;
-		set_data->op = 1;
+		set_data->op = FLAGS_SET;
 		set_data->set_flags = flags;
 		set_data->set_tmp_flags = tmp_flags;
 		debug_print("flags: deferring set\n");
@@ -3670,7 +3675,7 @@ static void summary_msginfo_change_flags(MsgInfo *msginfo,
 	} else {
 		ChangeData *change_data = g_new0(ChangeData, 1);
 		change_data->info = msginfo;
-		change_data->op = 2;
+		change_data->op = FLAGS_CHANGE;
 		change_data->set_flags = add_flags;
 		change_data->set_tmp_flags = add_tmp_flags;
 		change_data->unset_flags = rem_flags;
@@ -3689,13 +3694,13 @@ gboolean defer_change(gpointer data)
 	} else {
 		debug_print("flags: finally doing it\n");
 		switch(chg->op) {
-		case 0:
+		case FLAGS_UNSET:
 			procmsg_msginfo_unset_flags(chg->info, chg->unset_flags, chg->unset_tmp_flags);
 			break;
-		case 1:
+		case FLAGS_SET:
 			procmsg_msginfo_set_flags(chg->info, chg->set_flags, chg->set_tmp_flags);
 			break;
-		case 2:
+		case FLAGS_CHANGE:
 			procmsg_msginfo_change_flags(chg->info, chg->set_flags, chg->set_tmp_flags,
 				chg->unset_flags, chg->unset_tmp_flags);
 			break;

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list