2005-11-29 [colin] 1.9.100cvs42
authorColin Leroy <colin@colino.net>
Tue, 29 Nov 2005 17:31:18 +0000 (17:31 +0000)
committerColin Leroy <colin@colino.net>
Tue, 29 Nov 2005 17:31:18 +0000 (17:31 +0000)
* src/compose.c
Add Windows-1252 (Closes bug #863, windows-1252 encoding
option missing from message view window)
Fix double text D'n'D with gtk-2.8
* src/matcher.c
Fix ~message, ~headers_part, ~body_part rules
* src/messageview.c
Add Windows-1252 (Closes bug #863)
Fix accels
* src/gtk/gtkaspell.c
Properly destroy accels in all menus

ChangeLog
PATCHSETS
configure.ac
src/compose.c
src/gtk/gtkaspell.c
src/matcher.c
src/messageview.c

index 2190b22..40501fc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2005-11-29 [colin]     1.9.100cvs42
+
+       * src/compose.c
+               Add Windows-1252 (Closes bug #863, windows-1252 encoding 
+               option missing from message view window)
+               Fix double text D'n'D with gtk-2.8
+       * src/matcher.c
+               Fix ~message, ~headers_part, ~body_part rules
+       * src/messageview.c
+               Add Windows-1252 (Closes bug #863)
+               Fix accels
+       * src/gtk/gtkaspell.c
+               Properly destroy accels in all menus
+
 2005-11-29 [mones]     1.9.100cvs41
 
        * po/es.po
index 66189e1..e58795a 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.100.2.28 -r 1.100.2.29 AUTHORS;  cvs diff -u -r 1.58.2.16 -r 1.58.2.17 po/de.po;  cvs diff -u -r 1.1.2.4 -r 1.1.2.5 src/gtk/authors.h;  ) > 1.9.100cvs39.patchset
 ( cvs diff -u -r 1.2.2.14 -r 1.2.2.15 src/mh_gtk.c;  ) > 1.9.100cvs40.patchset
 ( cvs diff -u -r 1.60.2.19 -r 1.60.2.20 po/es.po;  ) > 1.9.100cvs41.patchset
+( cvs diff -u -r 1.382.2.197 -r 1.382.2.198 src/compose.c;  cvs diff -u -r 1.75.2.10 -r 1.75.2.11 src/matcher.c;  cvs diff -u -r 1.94.2.70 -r 1.94.2.71 src/messageview.c;  cvs diff -u -r 1.9.2.32 -r 1.9.2.33 src/gtk/gtkaspell.c;  ) > 1.9.100cvs42.patchset
index c07db50..f914d9b 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=100
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=41
+EXTRA_VERSION=42
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 15f5de5..5b210ee 100644 (file)
@@ -670,6 +670,8 @@ static GtkItemFactoryEntry compose_entries[] =
         ENC_ACTION(C_ISO_8859_1)},
        {N_("/_Options/Character _encoding/Western European (ISO-8859-15)"),
         ENC_ACTION(C_ISO_8859_15)},
+       {N_("/_Options/Character _encoding/Western European (Windows-1252)"),
+        ENC_ACTION(C_WINDOWS_1252)},
        {N_("/_Options/Character _encoding/---"), NULL, NULL, 0, "<Separator>"},
 
        {N_("/_Options/Character _encoding/Central European (ISO-8859-_2)"),
@@ -7864,19 +7866,23 @@ static void compose_insert_drag_received_cb (GtkWidget          *widget,
        if (gdk_atom_name(data->type) && !strcmp(gdk_atom_name(data->type), "text/uri-list")) {
                list = uri_list_extract_filenames((const gchar *)data->data);
                for (tmp = list; tmp != NULL; tmp = tmp->next) {
-                               compose_insert_file(compose, (const gchar *)tmp->data);
+                       compose_insert_file(compose, (const gchar *)tmp->data);
                }
                list_free_strings(list);
                g_list_free(list);
                gtk_drag_finish(drag_context, TRUE, FALSE, time);
                return;
        } else {
+#if GTK_CHECK_VERSION(2, 8, 0)
+               /* do nothing, handled by GTK */
+#else
                gchar *tmpfile = get_tmp_file();
                str_write_to_file((const gchar *)data->data, tmpfile);
                compose_insert_file(compose, tmpfile);
                g_unlink(tmpfile);
                g_free(tmpfile);
                gtk_drag_finish(drag_context, TRUE, FALSE, time);
+#endif
                return;
        }
        gtk_drag_finish(drag_context, TRUE, FALSE, time);
index f2abc66..7c04466 100644 (file)
@@ -569,6 +569,9 @@ static void button_press_intercept_cb(GtkTextView *gtktext,
        }
        g_slist_free(spell_menu);
        
+       g_signal_connect(G_OBJECT(menu), "deactivate",
+                                G_CALLBACK(destroy_menu), 
+                                gtkaspell);
        if (suggest)
                g_signal_connect(G_OBJECT(menu),
                        "key_press_event",
index 9a6d368..1e290c1 100644 (file)
@@ -661,58 +661,59 @@ static gboolean matcherprop_criteria_message(MatcherProp *matcher)
 }
 
 /*!
- *\brief       Check if a list of conditions match a header
+ *\brief       Check if a list of conditions matches one header in
+ *             a message file.
  *
- *\param       matchers One set of conditions
- *\param       buf Name of header
+ *\param       matchers List of conditions
+ *\param       fp Message file
  *
- *\return      gboolean TRUE if matching should stop
+ *\return      gboolean TRUE if one of the headers is matched by
+ *             the list of conditions. 
  */
-static gboolean matcherlist_match_one_header(MatcherList *matchers,
-                                            gchar *buf)
+static gboolean matcherlist_match_headers(MatcherList *matchers, FILE *fp)
 {
        GSList *l;
+       gchar buf[BUFFSIZE];
 
        for (l = matchers->matchers ; l != NULL ; l = g_slist_next(l)) {
                MatcherProp *matcher = (MatcherProp *) l->data;
-               
-               /* see if a single condition matches */
-               if (matcherprop_criteria_headers(matcher) ||
-                   matcherprop_criteria_message(matcher)) {
-                       if (matcherprop_match_one_header(matcher, buf)) {
-                               matcher->result = TRUE;
+
+               while (procheader_get_one_field(buf, sizeof(buf), fp, NULL) != -1) {
+
+                       /* if the criteria is ~headers_part or ~message, ZERO lines
+                        * must NOT match for the rule to match. */
+                       if (matcher->criteria == MATCHCRITERIA_NOT_HEADERS_PART ||
+                           matcher->criteria == MATCHCRITERIA_NOT_MESSAGE) {
+                               if (matcherprop_match_one_header(matcher, buf)) {
+                                       matcher->result = TRUE;
+                                       continue; /* must check all lines */
+                               } else {
+                                       matcher->result = FALSE;
+                                       break; /* no need to check more */
+                               }
+                       /* else, just one line matching is enough for the rule to match
+                        */
+                       } else if (matcherprop_criteria_headers(matcher) ||
+                                  matcherprop_criteria_message(matcher)){
+                               if (matcherprop_match_one_header(matcher, buf)) {
+                                       matcher->result = TRUE;
+                                       break; /* no need to check more */
+                               }
                        }
                }
 
+               /* if the rule matched and the matchers are OR, no need to
+                * check the others */
                if (matcherprop_criteria_headers(matcher)) {
                        if (matcher->result) {
                                if (!matchers->bool_and)
                                        return TRUE;
                        }
                }
-       }
-
-       return FALSE;
-}
-
-/*!
- *\brief       Check if a list of conditions matches one header in
- *             a message file.
- *
- *\param       matchers List of conditions
- *\param       fp Message file
- *
- *\return      gboolean TRUE if one of the headers is matched by
- *             the list of conditions. 
- */
-static gboolean matcherlist_match_headers(MatcherList *matchers, FILE *fp)
-{
-       gchar buf[BUFFSIZE];
-
-       while (procheader_get_one_field(buf, sizeof(buf), fp, NULL) != -1)
-               if (matcherlist_match_one_header(matchers, buf))
-                       return TRUE;
 
+               /* go back to beginning of file */
+               rewind(fp);
+       }
        return FALSE;
 }
 
@@ -757,52 +758,54 @@ static gboolean matcherprop_match_line(MatcherProp *matcher, const gchar *line)
 }
 
 /*!
- *\brief       Check if a list of conditions matches a (line) string
+ *\brief       Check if a line in a message file's body matches
+ *             the criteria
  *
- *\param       matchers List of matchers
- *\param       line String to match
+ *\param       matchers List of conditions
+ *\param       fp Message file
  *
- *\return      gboolean TRUE if string matches list of criteria
+ *\return      gboolean TRUE if succesful match
  */
-static gboolean matcherlist_match_line(MatcherList *matchers, const gchar *line)
+static gboolean matcherlist_match_body(MatcherList *matchers, FILE *fp)
 {
        GSList *l;
-
+       gchar buf[BUFFSIZE];
+       
        for (l = matchers->matchers ; l != NULL ; l = g_slist_next(l)) {
                MatcherProp *matcher = (MatcherProp *) l->data;
-
-               if (matcherprop_criteria_body(matcher) ||
-                   matcherprop_criteria_message(matcher)) {
-                       if (matcherprop_match_line(matcher, line)) {
-                               matcher->result = TRUE;
+               while (fgets(buf, sizeof(buf), fp) != NULL) {
+                       
+                       /* if the criteria is ~body_part or ~message, ZERO lines
+                        * must NOT match for the rule to match. */
+                       if (matcher->criteria == MATCHCRITERIA_NOT_BODY_PART ||
+                           matcher->criteria == MATCHCRITERIA_NOT_MESSAGE) {
+                               if (matcherprop_match_line(matcher, buf)) {
+                                       matcher->result = TRUE;
+                                       continue; /* must check all lines */
+                               } else {
+                                       matcher->result = FALSE;
+                                       break; /* no need to check more */
+                               }
+                       /* else, just one line has to match */
+                       } else if (matcherprop_criteria_body(matcher) ||
+                                  matcherprop_criteria_message(matcher)) {
+                               if (matcherprop_match_line(matcher, buf)) {
+                                       matcher->result = TRUE;
+                                       break; /* no need to check more */
+                               }
                        }
                }
-                       
+
+               /* if the matchers are OR'ed and the rule matched,
+                * no need to check the others. */
                if (matcher->result) {
                        if (!matchers->bool_and)
                                return TRUE;
                }
-       }
-       return FALSE;
-}
-
-/*!
- *\brief       Check if a line in a message file's body matches
- *             the criteria
- *
- *\param       matchers List of conditions
- *\param       fp Message file
- *
- *\return      gboolean TRUE if succesful match
- */
-static gboolean matcherlist_match_body(MatcherList *matchers, FILE *fp)
-{
-       gchar buf[BUFFSIZE];
-
-       while (fgets(buf, sizeof(buf), fp) != NULL)
-               if (matcherlist_match_line(matchers, buf))
-                       return TRUE;
 
+               /* restart at beginning */
+               rewind(fp);
+       }
        return FALSE;
 }
 
index 26d779a..7f3ebe8 100644 (file)
@@ -187,6 +187,8 @@ static GtkItemFactoryEntry msgview_entries[] =
         ENC_ACTION(C_ISO_8859_1)},
        {N_("/_View/Character _encoding/Western European (ISO-8859-15)"),
         ENC_ACTION(C_ISO_8859_15)},
+       {N_("/_View/Character _encoding/Western European (Windows-1252)"),
+        ENC_ACTION(C_WINDOWS_1252)},
        ENC_SEPARATOR,
        {N_("/_View/Character _encoding/Central European (ISO-8859-_2)"),
         ENC_ACTION(C_ISO_8859_2)},
@@ -1079,6 +1081,10 @@ static gboolean key_pressed(GtkWidget *widget, GdkEventKey *event,
                messageview_destroy(messageview);
                return TRUE;
        }
+
+       if ((event->state & (GDK_MOD1_MASK|GDK_CONTROL_MASK)) != 0)
+               return FALSE;
+
        g_signal_stop_emission_by_name(G_OBJECT(widget),
                                        "key_press_event");
        mimeview_pass_key_press_event(messageview->mimeview, event);