2011-10-07 [colin] 3.7.10cvs21
[claws.git] / src / prefs_matcher.c
index 5f81798..c615f76 100644 (file)
@@ -32,7 +32,9 @@
 #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"
@@ -93,7 +95,9 @@ static struct Matcher {
 #ifndef G_OS_WIN32
        GtkWidget *regexp_checkbtn;
 #endif
+#if !GTK_CHECK_VERSION(3, 0, 0)
        GtkWidget *color_optmenu;
+#endif
 
        GtkWidget *test_btn;
        GtkWidget *addressbook_select_btn;
@@ -429,9 +433,11 @@ 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
        }
 
        manage_window_set_transient(GTK_WINDOW(matcher.window));
@@ -523,7 +529,9 @@ static void prefs_matcher_create(void)
        GtkWidget *test_btn;
        GtkWidget *addressbook_select_btn;
 
+#if !GTK_CHECK_VERSION(3, 0, 0)
        GtkWidget *color_optmenu;
+#endif
 
        static GdkGeometry geometry;
        GtkSizeGroup *size_group;
@@ -665,11 +673,13 @@ 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());
        gtk_box_pack_start(GTK_BOX(match_hbox), color_optmenu, FALSE, FALSE, 0);
+#endif
        
        /* address header name */
        header_addr_combo = combobox_text_new(TRUE,
@@ -824,7 +834,9 @@ static void prefs_matcher_create(void)
        matcher.bool_op_combo = bool_op_combo;
        matcher.test_btn = test_btn;
        matcher.addressbook_select_btn = addressbook_select_btn;
+#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;
@@ -914,7 +926,9 @@ 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_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), "");
@@ -1055,9 +1069,11 @@ 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;
@@ -1168,8 +1184,10 @@ 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:
@@ -1260,8 +1278,10 @@ 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:
@@ -1323,8 +1343,10 @@ 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:
@@ -1508,11 +1530,13 @@ 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))); 
                break;
+#endif
 
        case CRITERIA_HEADER:
                header = gtk_entry_get_text(GTK_ENTRY(matcher.header_entry));
@@ -1870,8 +1894,10 @@ 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,
@@ -1913,12 +1939,14 @@ static void prefs_matcher_criteria_select(GtkWidget *widget,
 #endif
                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);
                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:"));
@@ -2248,9 +2276,11 @@ 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,6 +2509,7 @@ 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),
@@ -2486,6 +2517,7 @@ static gboolean prefs_matcher_selected(GtkTreeSelection *selector,
                menu = gtk_cmoption_menu_get_menu(GTK_CMOPTION_MENU(matcher.color_optmenu));
                g_signal_emit_by_name(G_OBJECT(menu), "selection-done", menu);
                break;
+#endif
 
        case MATCHCRITERIA_NOT_HEADER:
        case MATCHCRITERIA_HEADER: