[Commits] [SCM] claws branch, gtk3, updated. 3.16.0-449-g545fa6f

ticho at claws-mail.org ticho at claws-mail.org
Sat Nov 3 19:18:01 CET 2018


The branch, gtk3 has been updated
       via  545fa6f8eb760010a8d87b79659545e91d1d02ec (commit)
       via  93787a6fff7189b19b67e7470ac660a27b44d7e7 (commit)
       via  e342a1632a128138f4f986a6b0be71eb2ec449ca (commit)
      from  914c2e3b3ac39e68ed9f120e6f4f720fd1b8acec (commit)

Summary of changes:
 src/gtk/colorlabel.c |   46 +++++++++++++++++++++++++++++++++++++++++
 src/gtk/colorlabel.h |   10 +++++++++
 src/prefs_account.c  |   37 ++++-----------------------------
 src/prefs_matcher.c  |   56 ++++++++------------------------------------------
 4 files changed, 68 insertions(+), 81 deletions(-)


- Log -----------------------------------------------------------------
commit 545fa6f8eb760010a8d87b79659545e91d1d02ec
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Sat Nov 3 19:16:01 2018 +0100

    Make NNTP account crosspost color pref use colorlabel_get/set_combobox_colormenu_active().

diff --git a/src/prefs_account.c b/src/prefs_account.c
index 80f900d..c08ed98 100644
--- a/src/prefs_account.c
+++ b/src/prefs_account.c
@@ -4341,48 +4341,19 @@ static void crosspost_color_toggled(void)
 
 static void prefs_account_crosspost_set_data_from_colormenu(PrefParam *pparam)
 {
-	GtkWidget *combobox = advanced_page.crosspost_colormenu;
-	GtkTreeModel *model;
-	GtkTreeIter iter;
 	gint color;
+	GtkWidget *combobox = *pparam->widget;
 
-	if (!gtk_combo_box_get_active_iter(GTK_COMBO_BOX(combobox), &iter))
-		return;
-
-	model = gtk_combo_box_get_model(GTK_COMBO_BOX(combobox));
-
-	gtk_tree_model_get(model, &iter,
-			COLORMENU_COL_ID, &color,
-			-1);
-
-	/* If "None" is selected, "color" will be -1, so "0" will get
-	 * saved in prefs, which is correct. */
-	*((gint *)pparam->data) = color + 1;
+	color = colorlabel_get_combobox_colormenu_active(GTK_COMBO_BOX(combobox));
+	*((gint *)pparam->data) = color;
 }
 
 static void prefs_account_crosspost_set_colormenu(PrefParam *pparam)
 {
 	gint color = *((gint *)pparam->data);
-	gint id;
 	GtkWidget *combobox = *pparam->widget;
-	GtkTreeModel *model;
-	GtkTreeIter iter;
-
-	model = gtk_combo_box_get_model(GTK_COMBO_BOX(combobox));
-
-	if (!gtk_tree_model_get_iter_first(model, &iter))
-		return;
-
-	do {
-		gtk_tree_model_get(model, &iter,
-				COLORMENU_COL_ID, &id,
-				-1);
-
-		if (id == color - 1)
-			break;
-	} while (gtk_tree_model_iter_next(model, &iter));
 
-	gtk_combo_box_set_active_iter(GTK_COMBO_BOX(combobox), &iter);
+	colorlabel_set_combobox_colormenu_active(GTK_COMBO_BOX(combobox), color);
 }
 
 static void pop_bfr_smtp_tm_set_sens(GtkWidget *widget, gpointer data)

commit 93787a6fff7189b19b67e7470ac660a27b44d7e7
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Sat Nov 3 19:11:02 2018 +0100

    Reenabled color labels in filtering condition dialogs.

diff --git a/src/prefs_matcher.c b/src/prefs_matcher.c
index 5c423ff..b8764ed 100644
--- a/src/prefs_matcher.c
+++ b/src/prefs_matcher.c
@@ -32,9 +32,6 @@
 #include <string.h>
 #include <errno.h>
 
-#if !GTK_CHECK_VERSION(3, 0, 0)
-#include "gtkcmoptionmenu.h"
-#endif
 #include "main.h"
 #include "prefs_gtk.h"
 #include "prefs_matcher.h"
@@ -99,9 +96,7 @@ static struct Matcher {
 	GtkWidget *addressbook_folder_combo;
 	GtkWidget *case_checkbtn;
 	GtkWidget *regexp_checkbtn;
-#if !GTK_CHECK_VERSION(3, 0, 0)
 	GtkWidget *color_optmenu;
-#endif
 	GtkWidget *calendar;
 	GtkWidget *time_label;
 	GtkWidget *time_entry;
@@ -462,11 +457,8 @@ void prefs_matcher_open(MatcherList *matchers, PrefsMatcherSignal *cb)
 		prefs_matcher_models_create();
 		prefs_matcher_create();
 	} else {
-#if !GTK_CHECK_VERSION(3, 0, 0)
 		/* update color label menu */
-		gtk_cmoption_menu_set_menu(GTK_CMOPTION_MENU(matcher.color_optmenu),
-				colorlabel_create_color_menu());
-#endif
+		colorlabel_refill_combobox_colormenu(GTK_COMBO_BOX(matcher.color_optmenu));
 	}
 
 	manage_window_set_transient(GTK_WINDOW(matcher.window));
@@ -555,9 +547,7 @@ static void prefs_matcher_create(void)
 
 	GtkWidget *test_btn;
 	GtkWidget *addressbook_select_btn;
-#if !GTK_CHECK_VERSION(3, 0, 0)
 	GtkWidget *color_optmenu;
-#endif
 	GtkWidget *calendar;
 	GtkWidget *time_label;
 	GtkWidget *time_entry;
@@ -712,13 +702,9 @@ static void prefs_matcher_create(void)
 	match_combo = gtkut_sc_combobox_create(NULL, TRUE);
 	gtk_box_pack_start(GTK_BOX(match_hbox), match_combo, TRUE, TRUE, 0);
 	
-#if !GTK_CHECK_VERSION(3, 0, 0)
 	/* color labels combo */
-	color_optmenu = gtk_cmoption_menu_new();
-	gtk_cmoption_menu_set_menu(GTK_CMOPTION_MENU(color_optmenu),
-				 colorlabel_create_color_menu());
+	color_optmenu = colorlabel_create_combobox_colormenu();
 	gtk_box_pack_start(GTK_BOX(match_hbox), color_optmenu, FALSE, FALSE, 0);
-#endif
 	
 	/* address header name */
 	header_addr_combo = combobox_text_new(TRUE,
@@ -896,9 +882,7 @@ static void prefs_matcher_create(void)
 #ifndef USE_ALT_ADDRBOOK
 	matcher.addressbook_select_btn = addressbook_select_btn;
 #endif
-#if !GTK_CHECK_VERSION(3, 0, 0)
 	matcher.color_optmenu = color_optmenu;
-#endif
 	matcher.match_label = match_label;
 	matcher.criteria_label2 = criteria_label2;
 	matcher.headers_combo = headers_combo;
@@ -988,9 +972,7 @@ static void prefs_matcher_reset_condition(void)
 		gtk_combo_box_set_active(GTK_COMBO_BOX(matcher.match_combo), 0);
 	if (match_combo2_model_set())
 		gtk_combo_box_set_active(GTK_COMBO_BOX(matcher.match_combo2), 0);
-#if !GTK_CHECK_VERSION(3, 0, 0)
-	gtk_cmoption_menu_set_history(GTK_CMOPTION_MENU(matcher.color_optmenu), 0);
-#endif
+	gtk_combo_box_set_active(GTK_COMBO_BOX(matcher.color_optmenu), 0);
 	gtk_spin_button_set_value(GTK_SPIN_BUTTON(matcher.numeric_entry), 0);
 	gtk_entry_set_text(GTK_ENTRY(matcher.header_entry), "");
 	gtk_entry_set_text(GTK_ENTRY(matcher.header_addr_entry), "");
@@ -1134,11 +1116,9 @@ static gint prefs_matcher_get_criteria_from_matching(gint matching_id)
 	case MATCHCRITERIA_PARTIAL:
 	case MATCHCRITERIA_NOT_PARTIAL:
 		return CRITERIA_PARTIAL;
-#if !GTK_CHECK_VERSION(3, 0, 0)
 	case MATCHCRITERIA_COLORLABEL:
 	case MATCHCRITERIA_NOT_COLORLABEL:
 		return CRITERIA_COLORLABEL;
-#endif
 	case MATCHCRITERIA_IGNORE_THREAD:
 	case MATCHCRITERIA_NOT_IGNORE_THREAD:
 		return CRITERIA_IGNORE_THREAD;
@@ -1263,10 +1243,8 @@ static gint prefs_matcher_get_matching_from_criteria(gint criteria_id)
 		return MATCHCRITERIA_SIGNED;
 	case CRITERIA_PARTIAL:
 		return MATCHCRITERIA_PARTIAL;
-#if !GTK_CHECK_VERSION(3, 0, 0)
 	case CRITERIA_COLORLABEL:
 		return MATCHCRITERIA_COLORLABEL;
-#endif
 	case CRITERIA_IGNORE_THREAD:
 		return MATCHCRITERIA_IGNORE_THREAD;
 	case CRITERIA_WATCH_THREAD:
@@ -1369,10 +1347,8 @@ static gint prefs_matcher_not_criteria(gint matcher_criteria)
 		return MATCHCRITERIA_NOT_SIGNED;
 	case MATCHCRITERIA_PARTIAL:
 		return MATCHCRITERIA_NOT_PARTIAL;
-#if !GTK_CHECK_VERSION(3, 0, 0)
 	case MATCHCRITERIA_COLORLABEL:
 		return MATCHCRITERIA_NOT_COLORLABEL;
-#endif
 	case MATCHCRITERIA_IGNORE_THREAD:
 		return MATCHCRITERIA_NOT_IGNORE_THREAD;
 	case MATCHCRITERIA_WATCH_THREAD:
@@ -1439,10 +1415,8 @@ static gint prefs_matcher_get_criteria(void)
 	case MATCH_HEADER:
 		header = gtk_entry_get_text(GTK_ENTRY(matcher.header_entry));
 		return header_name_to_crit(header);
-#if !GTK_CHECK_VERSION(3, 0, 0)
 	case MATCH_LABEL:
 		return CRITERIA_COLORLABEL;
-#endif
 	case MATCH_PARTIAL:
 		return CRITERIA_PARTIAL;
 	case MATCH_TEST:
@@ -1641,13 +1615,10 @@ static MatcherProp *prefs_matcher_dialog_to_matcher(void)
 			value *= KB_SIZE;
 		break;
 		
-#if !GTK_CHECK_VERSION(3, 0, 0)
 	case CRITERIA_COLORLABEL:
-		value = colorlabel_get_color_menu_active_item
-			(gtk_cmoption_menu_get_menu(GTK_CMOPTION_MENU
-				(matcher.color_optmenu))); 
+		value = colorlabel_get_combobox_colormenu_active(
+				GTK_COMBO_BOX(matcher.color_optmenu));
 		break;
-#endif
 
 	case CRITERIA_HEADER:
 		header = gtk_entry_get_text(GTK_ENTRY(matcher.header_entry));
@@ -2015,10 +1986,8 @@ static void prefs_matcher_criteria_select(GtkWidget *widget,
 				    (value == MATCH_TEST));
 	prefs_matcher_enable_widget(matcher.addressbook_select_btn,
 				    (value == MATCH_ABOOK));
-#if !GTK_CHECK_VERSION(3, 0, 0)
 	prefs_matcher_enable_widget(matcher.color_optmenu,
 				    (value == MATCH_LABEL));
-#endif
 	prefs_matcher_enable_widget(matcher.upper_filler,
 				    MATCH_CASE_REGEXP(value));
 	prefs_matcher_enable_widget(matcher.lower_filler,
@@ -2065,14 +2034,12 @@ static void prefs_matcher_criteria_select(GtkWidget *widget,
 		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(matcher.regexp_checkbtn), FALSE);
 		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(matcher.case_checkbtn), FALSE);
 		break;
-#if !GTK_CHECK_VERSION(3, 0, 0)
 	case MATCH_LABEL:
-		gtk_cmoption_menu_set_history(GTK_CMOPTION_MENU(matcher.color_optmenu), 0);
+		gtk_combo_box_set_active(GTK_COMBO_BOX(matcher.color_optmenu), 0);
 		prefs_matcher_set_model(matcher.match_combo2, matcher.model_set);
 		gtk_label_set_text(GTK_LABEL(matcher.match_label), _("Label"));
 		gtk_label_set_text(GTK_LABEL(matcher.match_label2), _("is"));
 		break;
-#endif
 	case MATCH_PARTIAL:
 		prefs_matcher_set_model(matcher.criteria_combo2, matcher.model_partial);
 		gtk_label_set_text(GTK_LABEL(matcher.criteria_label2), _("Value:"));
@@ -2413,11 +2380,9 @@ static void prefs_matcher_set_criteria(const gint criteria)
 	case CRITERIA_TEST:
 		match_criteria = MATCH_TEST;
 		break;
-#if !GTK_CHECK_VERSION(3, 0, 0)
 	case CRITERIA_COLORLABEL:
 		match_criteria = MATCH_LABEL;
 		break;
-#endif
 	case CRITERIA_TAG:
 	case CRITERIA_TAGGED:
 		match_criteria = MATCH_TAGS;
@@ -2479,7 +2444,6 @@ static gboolean prefs_matcher_selected(GtkTreeSelection *selector,
 	MatcherProp *prop;
 	gboolean negative_cond;
 	gint criteria;
-	GtkWidget *menu;
 	GtkTreeIter iter;
 	gboolean is_valid;
 	struct tm lt;
@@ -2673,15 +2637,11 @@ static gboolean prefs_matcher_selected(GtkTreeSelection *selector,
 		}
 		break;
 
-#if !GTK_CHECK_VERSION(3, 0, 0)
 	case MATCHCRITERIA_NOT_COLORLABEL:
 	case MATCHCRITERIA_COLORLABEL:
-		gtk_cmoption_menu_set_history(GTK_CMOPTION_MENU(matcher.color_optmenu),
-					    prop->value + 1);
-		menu = gtk_cmoption_menu_get_menu(GTK_CMOPTION_MENU(matcher.color_optmenu));
-		g_signal_emit_by_name(G_OBJECT(menu), "selection-done", menu);
+		colorlabel_set_combobox_colormenu_active(
+				GTK_COMBO_BOX(matcher.color_optmenu), prop->value + 1);
 		break;
-#endif
 
 	case MATCHCRITERIA_NOT_HEADER:
 	case MATCHCRITERIA_HEADER:

commit e342a1632a128138f4f986a6b0be71eb2ec449ca
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Sat Nov 3 19:10:24 2018 +0100

    Added colorlabel_get/set_combobox_colormenu_active().

diff --git a/src/gtk/colorlabel.c b/src/gtk/colorlabel.c
index c509c28..5cefbf3 100644
--- a/src/gtk/colorlabel.c
+++ b/src/gtk/colorlabel.c
@@ -512,3 +512,49 @@ void colorlabel_refill_combobox_colormenu(GtkComboBox *combobox)
 				-1);
 	}
 }
+
+gint colorlabel_get_combobox_colormenu_active(GtkComboBox *combobox)
+{
+	gint value;
+	GtkTreeIter iter;
+	GtkTreeModel *model;
+
+	cm_return_val_if_fail(combobox != NULL, 0);
+
+	if (!gtk_combo_box_get_active_iter(GTK_COMBO_BOX(combobox), &iter))
+		return 0;
+
+	model = gtk_combo_box_get_model(GTK_COMBO_BOX(combobox));
+	gtk_tree_model_get(model, &iter,
+			COLORMENU_COL_ID, &value,
+			-1);
+
+	return value + 1;
+}
+
+void colorlabel_set_combobox_colormenu_active(GtkComboBox *combobox,
+		gint color)
+{
+	GtkTreeModel *model;
+	GtkTreeIter iter;
+	gint id;
+
+	cm_return_if_fail(combobox != NULL);
+
+	model = gtk_combo_box_get_model(combobox);
+	cm_return_if_fail(model != NULL);
+
+	if (!gtk_tree_model_get_iter_first(model, &iter))
+		return;
+
+	do {
+		gtk_tree_model_get(model, &iter,
+				COLORMENU_COL_ID, &id,
+				-1);
+
+		if (id == color - 1)
+			break;
+	} while (gtk_tree_model_iter_next(model, &iter));
+
+	gtk_combo_box_set_active_iter(combobox, &iter);
+}
diff --git a/src/gtk/colorlabel.h b/src/gtk/colorlabel.h
index e593a46..cfbebf4 100644
--- a/src/gtk/colorlabel.h
+++ b/src/gtk/colorlabel.h
@@ -59,4 +59,14 @@ GtkWidget *colorlabel_create_combobox_colormenu(void);
  * colors, change. */
 void colorlabel_refill_combobox_colormenu(GtkComboBox *combobox);
 
+/* Returns index of selected color in the colormenu combobox.
+ * 0 if "none" is selected, and 1-16 for colors 0-15. */
+gint colorlabel_get_combobox_colormenu_active(GtkComboBox *combobox);
+
+/* Select specified color entry in the colormenu combobox.
+ * The color parameter corresponds to return value of
+ * colorlabel_get_combobox_colormenu_active(). */
+void colorlabel_set_combobox_colormenu_active(GtkComboBox *combobox,
+		gint color);
+
 #endif /* COLORLABEL_H__ */

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list