2012-11-18 [colin] 3.9.0cvs6-stable
[claws.git] / src / prefs_filtering_action.c
index 678cf596c4f2f80462d2a7060f9772ab1c10e7b3..86cc619df0a30c9660446f1002c28117505789ac 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2003-2011 the Claws Mail team
+ * Copyright (C) 2003-2012 the Claws Mail team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@
 
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
+#include "claws-features.h"
 #endif
 
 #include "defs.h"
 #include "matcher_parser.h"
 #include "colorlabel.h"
 #include "combobox.h"
+#include "account.h"
+#ifndef USE_NEW_ADDRBOOK
+       #include "addressbook.h"
+#endif
 
 enum {
        PFA_ACTION,
@@ -76,7 +81,9 @@ static gint prefs_filtering_action_deleted(GtkWidget *widget,
 static void prefs_filtering_action_type_selection_changed(GtkWidget *widget,
     gpointer user_data);
 static void prefs_filtering_action_select_dest(void);
+#ifndef USE_NEW_ADDRBOOK
 static void prefs_filtering_action_select_addressbook(void);
+#endif
 static void prefs_filtering_action_up(void);
 static void prefs_filtering_action_down(void);
 static void prefs_filtering_action_set_dialog(GSList *action_list);
@@ -120,7 +127,9 @@ static struct FilteringAction_ {
 #endif
        GtkWidget *header_combo;
        GtkWidget *header_entry;
+#ifndef USE_NEW_ADDRBOOK
        GtkWidget *addressbook_btn;
+#endif
        GtkWidget *score_entry;
        GtkWidget *tags_combo;
 
@@ -340,7 +349,9 @@ static void prefs_filtering_action_create(void)
        GtkWidget *account_combo;
        GtkWidget *header_combo;
        GtkWidget *header_entry;
+#ifndef USE_NEW_ADDRBOOK
        GtkWidget *addressbook_btn;
+#endif
        GtkWidget *dest_entry;
        GtkWidget *dest_btn;
        GtkWidget *score_entry;
@@ -532,6 +543,7 @@ static void prefs_filtering_action_create(void)
                gtk_combo_box_append_text(GTK_COMBO_BOX(tags_combo), (gpointer) name);
                g_free(name);
        }
+       g_slist_free(tags);
 
        prefs_filtering_action_check_widget_width(tags_combo);
        gtk_combo_box_set_active(GTK_COMBO_BOX(tags_combo), 0);
@@ -548,11 +560,13 @@ static void prefs_filtering_action_create(void)
                          G_CALLBACK(prefs_filtering_action_select_dest),
                          NULL);
 
+#ifndef USE_NEW_ADDRBOOK
        addressbook_btn = gtk_button_new_with_label (_("Select ..."));
        gtk_box_pack_start (GTK_BOX (hbox1), addressbook_btn, FALSE, FALSE, 0);
        g_signal_connect (G_OBJECT (addressbook_btn), "clicked",
                          G_CALLBACK(prefs_filtering_action_select_addressbook),
                          NULL);
+#endif
 
        exec_btn = gtk_button_new_from_stock(GTK_STOCK_INFO);
        gtk_box_pack_start (GTK_BOX (hbox1), exec_btn, FALSE, FALSE, 0);
@@ -645,7 +659,9 @@ static void prefs_filtering_action_create(void)
        filtering_action.score_entry = score_entry;
        filtering_action.header_combo = header_combo;
        filtering_action.header_entry = header_entry;
+#ifndef USE_NEW_ADDRBOOK
        filtering_action.addressbook_btn = addressbook_btn;
+#endif
        filtering_action.ok_btn = ok_btn;
        filtering_action.action_list_view = action_list_view;
        
@@ -1231,7 +1247,8 @@ static gchar *exec_desc_strings[] = {
 
 static DescriptionWindow exec_desc_win = { 
        NULL,
-        NULL, 
+        NULL,
+       TRUE,
         2,
         N_("Filtering Action: 'Execute'"),
        N_("'Execute' allows you to send a message or message element "
@@ -1263,6 +1280,7 @@ static void prefs_filtering_action_select_dest(void)
        g_free(path);
 }
 
+#ifndef USE_NEW_ADDRBOOK
 static void prefs_filtering_action_select_addressbook(void)
 {
        const gchar *folderpath = NULL;
@@ -1275,6 +1293,7 @@ static void prefs_filtering_action_select_addressbook(void)
                g_free(new_path);
        } 
 }
+#endif
 
 static void prefs_filtering_action_enable_widget(GtkWidget* widget, const gboolean enable)
 {
@@ -1282,7 +1301,11 @@ static void prefs_filtering_action_enable_widget(GtkWidget* widget, const gboole
 
        if(enable == TRUE)
        {
-               if(GTK_IS_COMBO_BOX(widget) && gtk_combo_box_get_has_entry(GTK_COMBO_BOX(widget)))
+#if !GTK_CHECK_VERSION(2,24,0)
+               if(GTK_IS_COMBO_BOX(widget) || GTK_IS_COMBO_BOX_ENTRY(widget))
+#else
+               if(GTK_IS_COMBO_BOX(widget))
+#endif
                        gtk_combo_box_set_active(GTK_COMBO_BOX(widget), 0);
                else if(GTK_IS_SPIN_BUTTON(widget))
                        gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), 0);
@@ -1360,10 +1383,10 @@ static void prefs_filtering_action_type_selection_changed(GtkWidget *combo,
 
        prefs_filtering_action_enable_widget(filtering_action.header_combo,
                                        (value == ACTION_ADD_TO_ADDRESSBOOK));  
-
+#ifndef USE_NEW_ADDRBOOK
        prefs_filtering_action_enable_widget(filtering_action.addressbook_btn,
                                        (value == ACTION_ADD_TO_ADDRESSBOOK));
-
+#endif
        prefs_filtering_action_enable_widget(filtering_action.score_entry,
                                                ACTION_SCORE(value));