2006-06-05 [colin] 2.2.1cvs2
authorColin Leroy <colin@colino.net>
Mon, 5 Jun 2006 14:15:28 +0000 (14:15 +0000)
committerColin Leroy <colin@colino.net>
Mon, 5 Jun 2006 14:15:28 +0000 (14:15 +0000)
* src/prefs_folder_item.c
* src/folderview.c
Allow recursive setting of properties
for whole mailboxes
* src/matcher.c
Don't freeze on 'test' filtering rule

ChangeLog
PATCHSETS
configure.ac
src/folderview.c
src/matcher.c
src/prefs_folder_item.c

index 2e848d7ca5f55dac4af8754f8937d13779276ae9..b93c1ae2de6d45c376c9095c7c19c71e200b48a8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-06-05 [colin]     2.2.1cvs2
+
+       * src/prefs_folder_item.c
+       * src/folderview.c
+               Allow recursive setting of properties 
+               for whole mailboxes
+       * src/matcher.c
+               Don't freeze on 'test' filtering rule
+
 2006-06-05 [colin]     2.2.1cvs1
 
        * configure.ac
index 9252f6ab720e0eee5ba8f8343ff29a27634a6783..68dafbc344ba2705a9dd4e112c62ffa2cf504cbc 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.395.2.215 -r 1.395.2.216 src/summaryview.c;  ) > 2.2.0cvs81.patchset
 ( cvs diff -u -r 1.1.2.9 -r 1.1.2.10 manual/glossary.xml;  cvs diff -u -r 1.1.2.5 -r 1.1.2.6 manual/account.xml;  cvs diff -u -r 1.1.2.7 -r 1.1.2.8 manual/fr/glossary.xml;  cvs diff -u -r 1.1.2.3 -r 1.1.2.4 manual/fr/account.xml;  ) > 2.2.0cvs82.patchset
 ( cvs diff -u -r 1.654.2.1597 -r 1.654.2.1598 configure.ac;  ) > 2.2.1cvs1.patchset
+( cvs diff -u -r 1.52.2.19 -r 1.52.2.20 src/prefs_folder_item.c;  cvs diff -u -r 1.207.2.100 -r 1.207.2.101 src/folderview.c;  cvs diff -u -r 1.75.2.23 -r 1.75.2.24 src/matcher.c;  ) > 2.2.1cvs2.patchset
index 1af7ec6c88e0757c907e30324794250a950988fd..668073a105992965098353a15e0fb945aee20d6d 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=2
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=1
+EXTRA_VERSION=2
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 449bcde69eb97de6c48aaa956d57a49f16345a42..a03f47e75ba90df06c8e44442cd18010fef85fa2 100644 (file)
@@ -1813,7 +1813,7 @@ static gboolean folderview_button_pressed(GtkWidget *ctree, GdkEventButton *even
        SET_SENS("/Mark all read", item->unread_msgs >= 1);
        SET_SENS("/Search folder...", item->total_msgs >= 1 && 
                 folderview->selected == folderview->opened);
-       SET_SENS("/Properties...", item->node->parent != NULL);
+       SET_SENS("/Properties...", TRUE);
        SET_SENS("/Processing...", item->node->parent != NULL);
        if (item == folder->trash || item == special_trash
            || folder_has_parent_of_type(item, F_TRASH)) {
@@ -2181,9 +2181,6 @@ static void folderview_property_cb(FolderView *folderview, guint action,
        g_return_if_fail(item != NULL);
        g_return_if_fail(item->folder != NULL);
 
-       if (folder_item_parent(item) == NULL)
-               return;
-
        prefs_folder_item_open(item);
 }
 
index 1c38987195c52e1eb459675fb4ae4ef5775c713c..96fc0ee61ef623bc38fb0cf49dee4d565a4e5258 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
 #include <glib.h>
 #include <glib/gi18n.h>
 #include <ctype.h>
 #include <stdlib.h>
 #include <errno.h>
 
+#ifdef USE_PTHREAD
+#include <pthread.h>
+#endif
+
 #include "defs.h"
 #include "utils.h"
 #include "procheader.h"
@@ -410,6 +418,29 @@ static gboolean matcherprop_string_decode_match(MatcherProp *prop, const gchar *
        return res;
 }
 
+#ifdef USE_PTHREAD
+typedef struct _thread_data {
+       const gchar *cmd;
+       gboolean done;
+} thread_data;
+#endif
+
+#ifdef USE_PTHREAD
+void *matcher_test_thread(void *data)
+{
+       thread_data *td = (thread_data *)data;
+       int result = -1;
+
+       pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
+       pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
+
+       result = system(td->cmd);
+       if (result) perror("system");
+       td->done = TRUE; /* let the caller thread join() */
+       return GINT_TO_POINTER(result);
+}
+#endif
+
 /*!
  *\brief       Execute a command defined in the matcher structure
  *
@@ -424,6 +455,12 @@ static gboolean matcherprop_match_test(const MatcherProp *prop,
        gchar *file;
        gchar *cmd;
        gint retval;
+#ifdef USE_PTHREAD
+       pthread_t pt;
+       thread_data *td = g_new0(thread_data, 1);
+       void *res = NULL;
+       time_t start_time = time(NULL);
+#endif
 
        file = procmsg_get_message_file(info);
        if (file == NULL)
@@ -434,7 +471,31 @@ static gboolean matcherprop_match_test(const MatcherProp *prop,
        if (cmd == NULL)
                return FALSE;
 
+#if (defined USE_PTHREAD && defined __GLIBC__ && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)))
+       td->cmd = cmd;
+       td->done = FALSE;
+       if (pthread_create(&pt, PTHREAD_CREATE_JOINABLE, 
+                       matcher_test_thread, td) != 0)
+               retval = system(cmd);
+       else {
+               printf("waiting for test thread\n");
+               while(!td->done) {
+                       /* don't let the interface freeze while waiting */
+                       sylpheed_do_idle();
+                       if (time(NULL) - start_time > 30) {
+                               pthread_cancel(pt);
+                               td->done = TRUE;
+                               retval = -1;
+                       }
+               }
+               pthread_join(pt, &res);
+               retval = GPOINTER_TO_INT(res);
+               printf(" test thread returned %d\n", retval);
+       }
+       g_free(td);
+#else
        retval = system(cmd);
+#endif
        debug_print("Command exit code: %d\n", retval);
 
        g_free(cmd);
index 6b5197febab7a511f45d2e31223e00884d0c7cb7..088d30352cfa431e6034a2cdf98b3f00e172e61e 100644 (file)
@@ -341,6 +341,9 @@ static void general_save_folder_prefs(FolderItem *folder, FolderItemGeneralPage
        gchar *buf;
        gboolean all = FALSE;
 
+       if (folder->path == NULL)
+               return;
+
        g_return_if_fail(prefs != NULL);
 
        if (page->item == folder) 
@@ -706,6 +709,9 @@ static void compose_save_folder_prefs(FolderItem *folder, FolderItemComposePage
        GtkWidget *menuitem;
        gboolean all = FALSE;
 
+       if (folder->path == NULL)
+               return;
+
        if (page->item == folder) 
                all = TRUE;
 
@@ -879,7 +885,10 @@ void prefs_folder_item_open(FolderItem *item)
                register_compose_page();
        }
 
-       id = folder_item_get_identifier (item);
+       if (item->path)
+               id = folder_item_get_identifier (item);
+       else 
+               id = g_strdup(item->name);
        title = g_strdup_printf (_("Properties for folder %s"), id);
        g_free (id);
        prefswindow_open(title, prefs_pages, item,