2005-08-04 [colin] 1.9.13cvs13
authorColin Leroy <colin@colino.net>
Thu, 4 Aug 2005 18:01:14 +0000 (18:01 +0000)
committerColin Leroy <colin@colino.net>
Thu, 4 Aug 2005 18:01:14 +0000 (18:01 +0000)
* src/compose.c
Remove dead code
Add colourisation of quotes and signatures
* src/folderview.c
Fix possible crashes
* src/messageview.c
Change an assert that is no problem
* src/news.c
* src/news_gtk.c
* src/news_gtk.h
Fix offline mode
* src/gtk/quicksearch.c
Fix a possible crash

ChangeLog-gtk2.claws
PATCHSETS
configure.ac
src/compose.c
src/folderview.c
src/gtk/quicksearch.c
src/messageview.c
src/news.c
src/news_gtk.c
src/news_gtk.h

index e2f163d89a0be748ce3754758e73a7d543ea3d34..9bc033fa3048c17b50ea2a0b1b630c3c31de184f 100644 (file)
@@ -1,3 +1,19 @@
+2005-08-04 [colin]     1.9.13cvs13
+
+       * src/compose.c
+               Remove dead code
+               Add colourisation of quotes and signatures
+       * src/folderview.c
+               Fix possible crashes
+       * src/messageview.c
+               Change an assert that is no problem
+       * src/news.c
+       * src/news_gtk.c
+       * src/news_gtk.h
+               Fix offline mode
+       * src/gtk/quicksearch.c
+               Fix a possible crash
+
 2005-08-03 [colin]     1.9.13cvs12
 
        * src/prefs_account.c
index cf9cb094c931754435590865ad0e405a2c7d7842..652d1d76fa38f9bc83fc9e861934582885703d01 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.27.2.11 -r 1.27.2.12 src/addr_compl.c;  cvs diff -u -r 1.382.2.144 -r 1.382.2.145 src/compose.c;  cvs diff -u -r 1.8.2.7 -r 1.8.2.8 src/headerview.c;  cvs diff -u -r 1.115.2.47 -r 1.115.2.48 src/main.c;  cvs diff -u -r 1.56.2.36 -r 1.56.2.37 src/pop.c;  cvs diff -u -r 1.105.2.28 -r 1.105.2.29 src/prefs_account.c;  cvs diff -u -r 1.49.2.51 -r 1.49.2.52 src/procmime.c;  cvs diff -u -r 1.150.2.32 -r 1.150.2.33 src/procmsg.c;  cvs diff -u -r 1.22.2.10 -r 1.22.2.11 src/quote_fmt_parse.y;  cvs diff -u -r 1.96.2.66 -r 1.96.2.67 src/textview.c;  cvs diff -u -r 1.3.2.2 -r 1.3.2.3 src/common/quoted-printable.c;  cvs diff -u -r 1.36.2.37 -r 1.36.2.38 src/common/utils.c;  cvs diff -u -r 1.20.2.19 -r 1.20.2.20 src/common/utils.h;  cvs diff -u -r 1.1.4.8 -r 1.1.4.9 src/common/xml.c;  cvs diff -u -r 1.4.2.14 -r 1.4.2.15 src/gtk/about.c;  ) > 1.9.13cvs10.patchset
 ( cvs diff -u -r 1.60.2.22 -r 1.60.2.23 src/addressbook.c;  cvs diff -u -r 1.14.2.6 -r 1.14.2.7 src/editaddress.c;  cvs diff -u -r 1.11.2.6 -r 1.11.2.7 src/editgroup.c;  cvs diff -u -r 1.96.2.67 -r 1.96.2.68 src/textview.c;  ) > 1.9.13cvs11.patchset
 ( cvs diff -u -r 1.105.2.29 -r 1.105.2.30 src/prefs_account.c;  ) > 1.9.13cvs12.patchset
+( cvs diff -u -r 1.382.2.145 -r 1.382.2.146 src/compose.c;  cvs diff -u -r 1.207.2.50 -r 1.207.2.51 src/folderview.c;  cvs diff -u -r 1.94.2.58 -r 1.94.2.59 src/messageview.c;  cvs diff -u -r 1.101.2.11 -r 1.101.2.12 src/news.c;  cvs diff -u -r 1.2.2.7 -r 1.2.2.8 src/news_gtk.c;  cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/news_gtk.h;  cvs diff -u -r 1.1.2.19 -r 1.1.2.20 src/gtk/quicksearch.c;  ) > 1.9.13cvs13.patchset
index dfbad387eff0f1ab4f256e6bc77aa389233087d1..6dbf0d332da19fd8e3939fac41273d554f562c40 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=13
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=12
+EXTRA_VERSION=13
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index dea84c25562f46c89185f5e641cd76d94a385c7f..64f3aaa8fec69fcbd9f4c7aa2d6d6ca02602532f 100644 (file)
@@ -182,8 +182,6 @@ typedef enum
 
 #define MAX_REFERENCES_LEN     999
 
-static GdkColor quote_color = {0, 0, 0, 0xbfff};
-
 static GList *compose_list = NULL;
 
 Compose *compose_generic_new                   (PrefsAccount   *account,
@@ -404,26 +402,6 @@ static void compose_toggle_autowrap_cb     (gpointer        data,
                                         guint           action,
                                         GtkWidget      *widget);
 
-#if 0
-static void compose_toggle_to_cb       (gpointer        data,
-                                        guint           action,
-                                        GtkWidget      *widget);
-static void compose_toggle_cc_cb       (gpointer        data,
-                                        guint           action,
-                                        GtkWidget      *widget);
-static void compose_toggle_bcc_cb      (gpointer        data,
-                                        guint           action,
-                                        GtkWidget      *widget);
-static void compose_toggle_replyto_cb  (gpointer        data,
-                                        guint           action,
-                                        GtkWidget      *widget);
-static void compose_toggle_followupto_cb(gpointer       data,
-                                        guint           action,
-                                        GtkWidget      *widget);
-static void compose_toggle_attach_cb   (gpointer        data,
-                                        guint           action,
-                                        GtkWidget      *widget);
-#endif
 static void compose_toggle_ruler_cb    (gpointer        data,
                                         guint           action,
                                         GtkWidget      *widget);
@@ -477,22 +455,6 @@ static gboolean compose_drag_drop      (GtkWidget *widget,
                                             GdkDragContext *drag_context,
                                             gint x, gint y,
                                             guint time, gpointer user_data);
-#if 0
-static void to_activated               (GtkWidget      *widget,
-                                        Compose        *compose);
-static void newsgroups_activated       (GtkWidget      *widget,
-                                        Compose        *compose);
-static void cc_activated               (GtkWidget      *widget,
-                                        Compose        *compose);
-static void bcc_activated              (GtkWidget      *widget,
-                                        Compose        *compose);
-static void replyto_activated          (GtkWidget      *widget,
-                                        Compose        *compose);
-static void followupto_activated       (GtkWidget      *widget,
-                                        Compose        *compose);
-static void subject_activated          (GtkWidget      *widget,
-                                        Compose        *compose);
-#endif
 
 static void text_inserted              (GtkTextBuffer  *buffer,
                                         GtkTextIter    *iter,
@@ -796,6 +758,41 @@ static gboolean compose_put_existing_to_front(MsgInfo *info)
        return FALSE;
 }
 
+static GdkColor quote_color = 
+       {(gulong)0, (gushort)0, (gushort)0, (gushort)0};
+
+static GdkColor signature_color = {
+       (gulong)0,
+       (gushort)0x7fff,
+       (gushort)0x7fff,
+       (gushort)0x7fff
+};
+
+static void compose_create_tags(GtkTextView *text, Compose *compose)
+{
+       GtkTextBuffer *buffer;
+       GdkColor black = {(gulong)0, (gushort)0, (gushort)0, (gushort)0};
+
+       buffer = gtk_text_view_get_buffer(text);
+       
+       if (prefs_common.enable_color) {
+               /* grab the quote colors, converting from an int to a GdkColor */
+               gtkut_convert_int_to_gdk_color(prefs_common.quote_level1_col,
+                                              &quote_color);
+               gtkut_convert_int_to_gdk_color(prefs_common.signature_col,
+                                              &signature_color);
+       } else {
+               signature_color = quote_color = black;
+       }
+
+       gtk_text_buffer_create_tag(buffer, "quote",
+                                  "foreground-gdk", &quote_color,
+                                  NULL);
+       gtk_text_buffer_create_tag(buffer, "signature",
+                                  "foreground-gdk", &signature_color,
+                                  NULL);
+}
+
 Compose *compose_new(PrefsAccount *account, const gchar *mailto,
                     GPtrArray *attach_files)
 {
@@ -835,6 +832,7 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI
 
        textview = GTK_TEXT_VIEW(compose->text);
        textbuf = gtk_text_view_get_buffer(textview);
+       compose_create_tags(textview, compose);
 
        undo_block(compose->undostruct);
 #ifdef USE_ASPELL
@@ -1093,7 +1091,8 @@ static void compose_generic_reply(MsgInfo *msginfo, gboolean quote,
 
        textview = (GTK_TEXT_VIEW(compose->text));
        textbuf = gtk_text_view_get_buffer(textview);
-       
+       compose_create_tags(textview, compose);
+
        undo_block(compose->undostruct);
 #ifdef USE_ASPELL
        if (msginfo->folder && msginfo->folder->prefs && 
@@ -1128,8 +1127,7 @@ static void compose_generic_reply(MsgInfo *msginfo, gboolean quote,
        gtk_text_buffer_get_iter_at_offset(textbuf, &iter, cursor_pos);
        gtk_text_buffer_place_cursor(textbuf, &iter);
        
-       if (quote && prefs_common.linewrap_quote)
-               compose_wrap_all(compose);
+       compose_wrap_all(compose);
 
        gtk_widget_grab_focus(compose->text);
 
@@ -1185,6 +1183,7 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo,
 
        textview = GTK_TEXT_VIEW(compose->text);
        textbuf = gtk_text_view_get_buffer(textview);
+       compose_create_tags(textview, compose);
 
        if (as_attach) {
                gchar *msgfile;
@@ -1222,18 +1221,11 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo,
        if (account->auto_sig)
                compose_insert_sig(compose, FALSE);
 
-       if (prefs_common.linewrap_quote)
-               compose_wrap_all(compose);
+       compose_wrap_all(compose);
 
        gtk_text_buffer_get_start_iter(textbuf, &iter);
        gtk_text_buffer_place_cursor(textbuf, &iter);
 
-#if 0 /* NEW COMPOSE GUI */
-       if (account->protocol != A_NNTP)
-               gtk_widget_grab_focus(compose->to_entry);
-       else
-               gtk_widget_grab_focus(compose->newsgroups_entry);
-#endif
        gtk_widget_grab_focus(compose->header_last->entry);
 
        if (!no_extedit && prefs_common.auto_exteditor)
@@ -1286,6 +1278,7 @@ Compose *compose_forward_multiple(PrefsAccount *account, GSList *msginfo_list)
 
        textview = GTK_TEXT_VIEW(compose->text);
        textbuf = gtk_text_view_get_buffer(textview);
+       compose_create_tags(textview, compose);
 
        for (msginfo = msginfo_list; msginfo != NULL; msginfo = msginfo->next) {
                msgfile = procmsg_get_message_file_path((MsgInfo *)msginfo->data);
@@ -1300,21 +1293,13 @@ Compose *compose_forward_multiple(PrefsAccount *account, GSList *msginfo_list)
        if (account->auto_sig)
                compose_insert_sig(compose, FALSE);
 
-       if (prefs_common.linewrap_quote)
-               compose_wrap_all(compose);
+       compose_wrap_all(compose);
 
        gtk_text_buffer_get_start_iter(textbuf, &iter);
        gtk_text_buffer_place_cursor(textbuf, &iter);
 
        gtk_widget_grab_focus(compose->header_last->entry);
        
-#if 0 /* NEW COMPOSE GUI */
-       if (account->protocol != A_NNTP)
-               gtk_widget_grab_focus(compose->to_entry);
-       else
-               gtk_widget_grab_focus(compose->newsgroups_entry);
-#endif
-
        return compose;
 }
 
@@ -1420,6 +1405,8 @@ void compose_reedit(MsgInfo *msginfo)
 
        textview = GTK_TEXT_VIEW(compose->text);
        textbuf = gtk_text_view_get_buffer(textview);
+       compose_create_tags(textview, compose);
+
        mark = gtk_text_buffer_get_insert(textbuf);
        gtk_text_buffer_get_iter_at_mark(textbuf, &iter, mark);
 
@@ -1476,7 +1463,7 @@ Compose *compose_redirect(PrefsAccount *account, MsgInfo *msginfo)
 
        compose = compose_create(account, COMPOSE_REDIRECT);
        ifactory = gtk_item_factory_from_widget(compose->menubar);
-
+       compose_create_tags(GTK_TEXT_VIEW(compose->text), compose);
        compose->replyinfo = NULL;
        compose->fwdinfo = NULL;
 
@@ -1945,6 +1932,8 @@ static gchar *compose_quote_fmt(Compose *compose, MsgInfo *msginfo,
        gint len;
        gboolean prev_autowrap;
        const gchar *trimmed_body = body;
+       GtkTextView *text = GTK_TEXT_VIEW(compose->text);
+       GtkTextBuffer *buffer = gtk_text_view_get_buffer(text);
        
        if (!msginfo)
                msginfo = &dummyinfo;
@@ -1981,18 +1970,16 @@ static gchar *compose_quote_fmt(Compose *compose, MsgInfo *msginfo,
        prev_autowrap = compose->autowrap;
        compose->autowrap = FALSE;
 
+       g_signal_handlers_block_by_func(G_OBJECT(buffer),
+                               G_CALLBACK(compose_changed_cb),
+                               compose);
+       g_signal_handlers_block_by_func(G_OBJECT(buffer),
+                               G_CALLBACK(text_inserted),
+                               compose);
        for (p = buf; *p != '\0'; ) {
-               GtkTextView *text = GTK_TEXT_VIEW(compose->text);
-               GtkTextBuffer *buffer = gtk_text_view_get_buffer(text);
                GtkTextMark *mark;
                GtkTextIter iter;
 
-               g_signal_handlers_block_by_func(G_OBJECT(buffer),
-                                       G_CALLBACK(compose_changed_cb),
-                                       compose);
-               g_signal_handlers_block_by_func(G_OBJECT(buffer),
-                                       G_CALLBACK(text_inserted),
-                                       compose);
                
                mark = gtk_text_buffer_get_insert(buffer);
                gtk_text_buffer_get_iter_at_mark(buffer, &iter, mark);
@@ -2002,13 +1989,6 @@ static gchar *compose_quote_fmt(Compose *compose, MsgInfo *msginfo,
 
                gtk_text_buffer_insert(buffer, &iter, p, len);
 
-               g_signal_handlers_unblock_by_func(G_OBJECT(buffer),
-                                       G_CALLBACK(compose_changed_cb),
-                                       compose);
-               g_signal_handlers_unblock_by_func(G_OBJECT(buffer),
-                                       G_CALLBACK(text_inserted),
-                                       compose);
-               
                if (lastp)
                        p = lastp + 1;
                else
@@ -2019,6 +1999,14 @@ static gchar *compose_quote_fmt(Compose *compose, MsgInfo *msginfo,
        if (compose->autowrap)
                compose_wrap_all(compose);
 
+       g_signal_handlers_unblock_by_func(G_OBJECT(buffer),
+                               G_CALLBACK(compose_changed_cb),
+                               compose);
+       g_signal_handlers_unblock_by_func(G_OBJECT(buffer),
+                               G_CALLBACK(text_inserted),
+                               compose);
+
+
        return buf;
 }
 
@@ -2193,7 +2181,7 @@ static void compose_insert_sig(Compose *compose, gboolean replace)
        GtkTextView *text = GTK_TEXT_VIEW(compose->text);
        GtkTextBuffer *buffer = gtk_text_view_get_buffer(text);
        GtkTextMark *mark;
-       GtkTextIter iter;
+       GtkTextIter iter, iter_end;
        gint cur_pos;
        gboolean prev_autowrap;
 
@@ -2239,7 +2227,14 @@ static void compose_insert_sig(Compose *compose, gboolean replace)
        if (!compose->sig_str || (replace && !compose->account->auto_sig))
                compose->sig_str = g_strdup("");
 
+       cur_pos = gtk_text_iter_get_offset(&iter);
        gtk_text_buffer_insert(buffer, &iter, compose->sig_str, -1);
+       /* skip \n\n */
+       gtk_text_buffer_get_iter_at_offset(buffer, &iter, cur_pos);
+       gtk_text_iter_forward_char(&iter);
+       gtk_text_iter_forward_char(&iter);
+       gtk_text_buffer_get_end_iter(buffer, &iter_end);
+       gtk_text_buffer_apply_tag_by_name(buffer,"signature",&iter, &iter_end);
 
        if (cur_pos > gtk_text_buffer_get_char_count (buffer))
                cur_pos = gtk_text_buffer_get_char_count (buffer);
@@ -2411,14 +2406,6 @@ static void compose_attach_append(Compose *compose, const gchar *file,
        }
        fclose(fp);
 
-#if 0 /* NEW COMPOSE GUI */
-       if (!compose->use_attach) {
-               GtkItemFactory *ifactory;
-
-               ifactory = gtk_item_factory_from_widget(compose->menubar);
-               menu_set_active(ifactory, "/View/Attachment", TRUE);
-       }
-#endif
        ainfo = g_new0(AttachInfo, 1);
        auto_ainfo = g_auto_pointer_new_with_free
                        (ainfo, (GFreeFunc) compose_attach_info_free); 
@@ -2955,6 +2942,7 @@ static void compose_wrap_paragraph(Compose *compose, GtkTextIter *par_iter)
        gint quote_len;
        gboolean wrap_quote = prefs_common.linewrap_quote;
        gboolean prev_autowrap = compose->autowrap;
+       gint startq_offset = -1, noq_offset = -1;
 
        compose->autowrap = FALSE;
 
@@ -2990,20 +2978,32 @@ static void compose_wrap_paragraph(Compose *compose, GtkTextIter *par_iter)
                quote_str = compose_get_quote_str(buffer, &iter, &quote_len);
                if (quote_str) {
                        if (!wrap_quote) {
+                               if (startq_offset == -1) {
+                                       startq_offset = gtk_text_iter_get_offset(&iter);
+                               }
                                gtk_text_iter_forward_line(&iter);
-                               g_free(quote_str);
-                               continue;
+                               g_free(quote_str);
+                               goto colorize;
                        }
                        debug_print("compose_wrap_paragraph(): quote_str = '%s'\n", quote_str);
+                       startq_offset = gtk_text_iter_get_offset(&iter);
+               } else {
+                       if (startq_offset == -1)
+                               noq_offset = gtk_text_iter_get_offset(&iter);
                }
 
+               if (prev_autowrap == FALSE) {
+                       gtk_text_iter_forward_line(&iter);
+                       g_free(quote_str);
+                       goto colorize;
+               }
                if (compose_get_line_break_pos(buffer, &iter, &break_pos,
                                               prefs_common.linewrap_len,
                                               quote_len)) {
                        GtkTextIter prev, next, cur;
 
                        gtk_text_buffer_insert(buffer, &break_pos, "\n", 1);
-
+                       
                        /* remove trailing spaces */
                        cur = break_pos;
                        gtk_text_iter_backward_char(&cur);
@@ -3039,6 +3039,24 @@ static void compose_wrap_paragraph(Compose *compose, GtkTextIter *par_iter)
                }
 
                g_free(quote_str);
+colorize:
+               if (startq_offset != -1) {
+                       GtkTextIter startquote, endquote;
+                       gtk_text_buffer_get_iter_at_offset(
+                               buffer, &startquote, startq_offset);
+                       endquote = iter;
+                       gtk_text_buffer_apply_tag_by_name(
+                               buffer, "quote", &startquote, &endquote);
+                       startq_offset = -1;
+               } else if (noq_offset != -1) {
+                       GtkTextIter startnoquote, endnoquote;
+                       gtk_text_buffer_get_iter_at_offset(
+                               buffer, &startnoquote, noq_offset);
+                       endnoquote = iter;
+                       gtk_text_buffer_remove_tag_by_name(
+                               buffer, "quote", &startnoquote, &endnoquote);
+                       noq_offset = -1;
+               }
        }
 
        if (par_iter)
@@ -3124,53 +3142,6 @@ static void compose_select_account(Compose *compose, PrefsAccount *account,
        compose_set_title(compose);
 
        ifactory = gtk_item_factory_from_widget(compose->menubar);
-#if 0
-       if (account->protocol == A_NNTP) {
-               gtk_widget_show(compose->newsgroups_hbox);
-               gtk_widget_show(compose->newsgroups_entry);
-               gtk_table_set_row_spacing(GTK_TABLE(compose->table), 2, 4);
-               compose->use_newsgroups = TRUE;
-
-               menu_set_active(ifactory, "/View/To", FALSE);
-               menu_set_sensitive(ifactory, "/View/To", TRUE);
-               menu_set_active(ifactory, "/View/Cc", FALSE);
-               menu_set_sensitive(ifactory, "/View/Cc", TRUE);
-               menu_set_sensitive(ifactory, "/View/Followup to", TRUE);
-       } else {
-               gtk_widget_hide(compose->newsgroups_hbox);
-               gtk_widget_hide(compose->newsgroups_entry);
-               gtk_table_set_row_spacing(GTK_TABLE(compose->table), 2, 0);
-               gtk_widget_queue_resize(compose->table_vbox);
-               compose->use_newsgroups = FALSE;
-
-               menu_set_active(ifactory, "/View/To", TRUE);
-               menu_set_sensitive(ifactory, "/View/To", FALSE);
-               menu_set_active(ifactory, "/View/Cc", TRUE);
-               menu_set_sensitive(ifactory, "/View/Cc", FALSE);
-               menu_set_active(ifactory, "/View/Followup to", FALSE);
-               menu_set_sensitive(ifactory, "/View/Followup to", FALSE);
-       }
-
-       if (account->set_autocc) {
-               compose_entry_show(compose, COMPOSE_ENTRY_CC);
-               if (account->auto_cc && compose->mode != COMPOSE_REEDIT)
-                       compose_entry_set(compose, account->auto_cc,
-                                         COMPOSE_ENTRY_CC);
-       }
-       if (account->set_autobcc) {
-               compose_entry_show(compose, COMPOSE_ENTRY_BCC);
-               if (account->auto_bcc && compose->mode != COMPOSE_REEDIT)
-                       compose_entry_set(compose, account->auto_bcc,
-                                         COMPOSE_ENTRY_BCC);
-       }
-       if (account->set_autoreplyto) {
-               compose_entry_show(compose, COMPOSE_ENTRY_REPLY_TO);
-               if (account->auto_replyto && compose->mode != COMPOSE_REEDIT)
-                       compose_entry_set(compose, account->auto_replyto,
-                                         COMPOSE_ENTRY_REPLY_TO);
-       }
-
-#endif
 
        if (account->default_sign && compose->mode != COMPOSE_REDIRECT)
                menu_set_active(ifactory, "/Options/Sign", TRUE);
@@ -4495,24 +4466,8 @@ static GtkWidget *compose_create_header(Compose *compose)
        GtkWidget *label;
        GtkWidget *hbox;
        GtkWidget *from_optmenu_hbox;
-#if 0 /* NEW COMPOSE GUI */
-       GtkWidget *to_entry;
-       GtkWidget *to_hbox;
-       GtkWidget *newsgroups_entry;
-       GtkWidget *newsgroups_hbox;
-#endif
        GtkWidget *header_scrolledwin;
        GtkWidget *header_table;
-#if 0 /* NEW COMPOSE GUI */
-       GtkWidget *cc_entry;
-       GtkWidget *cc_hbox;
-       GtkWidget *bcc_entry;
-       GtkWidget *bcc_hbox;
-       GtkWidget *reply_entry;
-       GtkWidget *reply_hbox;
-       GtkWidget *followup_entry;
-       GtkWidget *followup_hbox;
-#endif
 
        gint count = 0;
 
@@ -4537,9 +4492,6 @@ static GtkWidget *compose_create_header(Compose *compose)
        from_optmenu_hbox = compose_account_option_menu_create(compose);
        gtk_table_attach(GTK_TABLE(header_table), from_optmenu_hbox,
                                  1, 2, count, count + 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
-#if 0 /* NEW COMPOSE GUI */
-       gtk_table_set_row_spacing(GTK_TABLE(table), 0, 4);
-#endif
        count++;
 
        compose->header_table = header_table;
@@ -4548,80 +4500,7 @@ static GtkWidget *compose_create_header(Compose *compose)
 
        compose_create_header_entry(compose);
 
-#if 0 /* NEW COMPOSE GUI */
-       compose_add_entry_field(table, &to_hbox, &to_entry, &count,
-                               "To:", TRUE); 
-       gtk_table_set_row_spacing(GTK_TABLE(table), 0, 4);
-       compose_add_entry_field(table, &newsgroups_hbox, &newsgroups_entry,
-                               &count, "Newsgroups:", FALSE);
-       gtk_table_set_row_spacing(GTK_TABLE(table), 1, 4);
-
-       gtk_table_set_row_spacing(GTK_TABLE(table), 2, 4);
-
-       compose_add_entry_field(table, &cc_hbox, &cc_entry, &count,
-                               "Cc:", TRUE);
-       gtk_table_set_row_spacing(GTK_TABLE(table), 3, 4);
-       compose_add_entry_field(table, &bcc_hbox, &bcc_entry, &count,
-                               "Bcc:", TRUE);
-       gtk_table_set_row_spacing(GTK_TABLE(table), 4, 4);
-       compose_add_entry_field(table, &reply_hbox, &reply_entry, &count,
-                               "Reply-To:", TRUE);
-       gtk_table_set_row_spacing(GTK_TABLE(table), 5, 4);
-       compose_add_entry_field(table, &followup_hbox, &followup_entry, &count,
-                               "Followup-To:", FALSE);
-       gtk_table_set_row_spacing(GTK_TABLE(table), 6, 4);
-
-       gtk_table_set_col_spacings(GTK_TABLE(table), 4);
-
-       g_signal_connect(G_OBJECT(to_entry), "activate",
-                        G_CALLBACK(to_activated), compose);
-       g_signal_connect(G_OBJECT(newsgroups_entry), "activate",
-                        G_CALLBACK(newsgroups_activated), compose);
-       g_signal_connect(G_OBJECT(subject_entry), "activate",
-                        G_CALLBACK(subject_activated), compose);
-       g_signal_connect(G_OBJECT(cc_entry), "activate",
-                        G_CALLBACK(cc_activated), compose);
-       g_signal_connect(G_OBJECT(bcc_entry), "activate",
-                        G_CALLBACK(bcc_activated), compose);
-       g_signal_connect(G_OBJECT(reply_entry), "activate",
-                        G_CALLBACK(replyto_activated), compose);
-       g_signal_connect(G_OBJECT(followup_entry), "activate",
-                        G_CALLBACK(followupto_activated), compose);
-
-       g_signal_connect(G_OBJECT(subject_entry), "grab_focus",
-                        G_CALLBACK(compose_grab_focus_cb), compose);
-       g_signal_connect(G_OBJECT(to_entry), "grab_focus",
-                        G_CALLBACK(compose_grab_focus_cb), compose);
-       g_signal_connect(G_OBJECT(newsgroups_entry), "grab_focus",
-                        G_CALLBACK(compose_grab_focus_cb), compose);
-       g_signal_connect(G_OBJECT(cc_entry), "grab_focus",
-                        G_CALLBACK(compose_grab_focus_cb), compose);
-       g_signal_connect(G_OBJECT(bcc_entry), "grab_focus",
-                        G_CALLBACK(compose_grab_focus_cb), compose);
-       g_signal_connect(G_OBJECT(reply_entry), "grab_focus",
-                        G_CALLBACK(compose_grab_focus_cb), compose);
-       g_signal_connect(G_OBJECT(followup_entry), "grab_focus",
-                        G_CALLBACK(compose_grab_focus_cb), compose);
-#endif
-
        compose->table            = NULL;
-#if 0 /* NEW COMPOSE GUI */
-       compose->table            = table;
-       compose->to_hbox          = to_hbox;
-       compose->to_entry         = to_entry;
-       compose->newsgroups_hbox  = newsgroups_hbox;
-       compose->newsgroups_entry = newsgroups_entry;
-#endif
-#if 0 /* NEW COMPOSE GUI */
-       compose->cc_hbox          = cc_hbox;
-       compose->cc_entry         = cc_entry;
-       compose->bcc_hbox         = bcc_hbox;
-       compose->bcc_entry        = bcc_entry;
-       compose->reply_hbox       = reply_hbox;
-       compose->reply_entry      = reply_entry;
-       compose->followup_hbox    = followup_hbox;
-       compose->followup_entry   = followup_entry;
-#endif
 
        return header_scrolledwin ;
 }
@@ -5892,14 +5771,8 @@ static void compose_attach_property_create(gboolean *cancelled)
        optmenu_menu = gtk_menu_new();
        MENUITEM_ADD(optmenu_menu, menuitem, "7bit", ENC_7BIT);
        gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), optmenu_menu);
-#if 0
-       gtk_widget_set_sensitive(menuitem, FALSE);
-#endif
        MENUITEM_ADD(optmenu_menu, menuitem, "8bit", ENC_8BIT);
        gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), optmenu_menu);
-#if 0
-       gtk_widget_set_sensitive(menuitem, FALSE);
-#endif
        MENUITEM_ADD(optmenu_menu, menuitem, "quoted-printable",
                     ENC_QUOTED_PRINTABLE);
        gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), optmenu_menu);
@@ -7270,70 +7143,6 @@ static void compose_header_drag_received_cb (GtkWidget           *widget,
        gtk_drag_finish(drag_context, TRUE, FALSE, time);
 }
 
-#if 0 /* NEW COMPOSE GUI */
-static void to_activated(GtkWidget *widget, Compose *compose)
-{
-       if (GTK_WIDGET_VISIBLE(compose->newsgroups_entry))
-               gtk_widget_grab_focus(compose->newsgroups_entry);
-       else
-               gtk_widget_grab_focus(compose->subject_entry);
-}
-
-static void newsgroups_activated(GtkWidget *widget, Compose *compose)
-{
-       gtk_widget_grab_focus(compose->subject_entry);
-}
-
-static void subject_activated(GtkWidget *widget, Compose *compose)
-{
-       if (GTK_WIDGET_VISIBLE(compose->cc_entry))
-               gtk_widget_grab_focus(compose->cc_entry);
-       else if (GTK_WIDGET_VISIBLE(compose->bcc_entry))
-               gtk_widget_grab_focus(compose->bcc_entry);
-       else if (GTK_WIDGET_VISIBLE(compose->reply_entry))
-               gtk_widget_grab_focus(compose->reply_entry);
-       else if (GTK_WIDGET_VISIBLE(compose->followup_entry))
-               gtk_widget_grab_focus(compose->followup_entry);
-       else
-               gtk_widget_grab_focus(compose->text);
-}
-
-static void cc_activated(GtkWidget *widget, Compose *compose)
-{
-       if (GTK_WIDGET_VISIBLE(compose->bcc_entry))
-               gtk_widget_grab_focus(compose->bcc_entry);
-       else if (GTK_WIDGET_VISIBLE(compose->reply_entry))
-               gtk_widget_grab_focus(compose->reply_entry);
-       else if (GTK_WIDGET_VISIBLE(compose->followup_entry))
-               gtk_widget_grab_focus(compose->followup_entry);
-       else
-               gtk_widget_grab_focus(compose->text);
-}
-
-static void bcc_activated(GtkWidget *widget, Compose *compose)
-{
-       if (GTK_WIDGET_VISIBLE(compose->reply_entry))
-               gtk_widget_grab_focus(compose->reply_entry);
-       else if (GTK_WIDGET_VISIBLE(compose->followup_entry))
-               gtk_widget_grab_focus(compose->followup_entry);
-       else
-               gtk_widget_grab_focus(compose->text);
-}
-
-static void replyto_activated(GtkWidget *widget, Compose *compose)
-{
-       if (GTK_WIDGET_VISIBLE(compose->followup_entry))
-               gtk_widget_grab_focus(compose->followup_entry);
-       else
-               gtk_widget_grab_focus(compose->text);
-}
-
-static void followupto_activated(GtkWidget *widget, Compose *compose)
-{
-       gtk_widget_grab_focus(compose->text);
-}
-#endif
-
 static void compose_toggle_return_receipt_cb(gpointer data, guint action,
                                             GtkWidget *widget)
 {
@@ -7427,11 +7236,6 @@ static void text_inserted(GtkTextBuffer *buffer, GtkTextIter *iter,
                                (G_OBJECT(compose->text), "paste_as_quotation"));
        GtkTextMark *mark;
 
-       /* CLAWS: pass to default handler only if not pasting as quotation, and 
-        * no autowrap */
-       if (!paste_as_quotation && !compose->autowrap) 
-               return;
-
        g_return_if_fail(text != NULL);
 
        g_signal_handlers_block_by_func(G_OBJECT(buffer),
index 5a2be29bee78ce63eaa9eb7b00d46366035560fd..10e6d919e72e1a7ca95a4ab2b2effa56c7f9afa1 100644 (file)
@@ -989,7 +989,12 @@ static gboolean folderview_have_new_children_sub(FolderView *folderview,
                                                 FolderItem *item,
                                                 gboolean in_sub)
 {
-       GNode *node = item->folder->node;
+       GNode *node = NULL;
+       
+       if (!item || !item->folder || !item->folder->node)
+               return FALSE;
+               
+       node = item->folder->node;
        
        node = g_node_find(node, G_PRE_ORDER, G_TRAVERSE_ALL, item);
        node = node->children;
@@ -1063,7 +1068,12 @@ static gboolean folderview_have_matching_children_sub(FolderView *folderview,
                                                      FolderItem *item,
                                                      gboolean in_sub)
 {
-       GNode *node = item->folder->node;
+       GNode *node = NULL;
+
+       if (!item || !item->folder || !item->folder->node)
+               return FALSE;
+
+       node = item->folder->node;
        
        node = g_node_find(node, G_PRE_ORDER, G_TRAVERSE_ALL, item);
        node = node->children;
@@ -1819,7 +1829,10 @@ void folderview_create_folder_node_recursive(FolderView *folderview, FolderItem
        GNode *srcnode;
 
        folderview_create_folder_node(folderview, item);
-       
+
+       if (!item || !item->folder || !item->folder->node)
+               return;
+
        srcnode = item->folder->node;   
        srcnode = g_node_find(srcnode, G_PRE_ORDER, G_TRAVERSE_ALL, item);
        srcnode = srcnode->children;
index 949a33f06ca3d8433874d47b8b9d7e7f8b9ac3e5..381237030500f810e1961b3aa6114756113bde5e 100644 (file)
@@ -760,7 +760,8 @@ static void quicksearch_reset_folder_items(QuickSearch *quicksearch,
                                    FolderItem *folder_item)
 {
        FolderItem *cur = NULL;
-       GNode *node = folder_item->node->children;
+       GNode *node = (folder_item && folder_item->node) ? 
+                       folder_item->node->children : NULL;
        
        for (; node != NULL; node = node->next) {
                cur = FOLDER_ITEM(node->data);
index 3eb2873865a954d17eb77e3406412e3e0d78d861..a6730f589a573eae711b0a0f735a425813a082d3 100644 (file)
@@ -905,7 +905,8 @@ static void messageview_update(MessageView *msgview)
                GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
                MsgInfo *msginfo = gtk_ctree_node_get_row_data(ctree, 
                                                      summaryview->selected);
-               g_return_if_fail(msginfo != NULL);
+               if (msginfo == NULL)
+                       return;
 
                messageview_show(msgview, msginfo, 
                                 msgview->all_headers);
index bfdeabdb30edb63648a008a551e52170a71bf645..28e08fbf0eb14ddaa775a736b0f1ba84d6f6baa9 100644 (file)
@@ -33,6 +33,7 @@
 #include <time.h>
 
 #include "news.h"
+#include "news_gtk.h"
 #include "nntp.h"
 #include "socket.h"
 #include "recv.h"
@@ -259,8 +260,9 @@ static NNTPSession *news_session_get(Folder *folder)
        g_return_val_if_fail(FOLDER_CLASS(folder) == &news_class, NULL);
        g_return_val_if_fail(folder->account != NULL, NULL);
 
-       if (prefs_common.work_offline)
+       if (prefs_common.work_offline && !news_gtk_should_override()) {
                return NULL;
+       }
 
        if (!rfolder->session) {
                rfolder->session = news_session_new_for_folder(folder);
index 85ccbca5231a5eab77bd67bc7966246ddb056cbb..7b90cd47bbed4fb0438f66994645050a730868de 100644 (file)
@@ -35,6 +35,8 @@
 #include "account.h"
 #include "alertpanel.h"
 #include "grouplistdialog.h"
+#include "prefs_common.h"
+#include "news_gtk.h"
 #include "common/hooks.h"
 #include "inc.h"
 
@@ -69,6 +71,30 @@ static FolderViewPopup news_popup =
        set_sensitivity
 };
 
+gboolean news_gtk_should_override(void)
+{
+       static time_t overridden_yes = 0;
+       static time_t overridden_no  = 0;
+       gboolean answer = TRUE;
+
+       if (prefs_common.work_offline) {
+               if (time(NULL) - overridden_yes < 600)
+                        return TRUE;
+               else if (time(NULL) - overridden_no < 3)
+                        return FALSE;
+               
+               answer = (alertpanel(_("Offline warning"), 
+                              _("You're working offline. Override during 10 minutes?"),
+                              GTK_STOCK_YES, GTK_STOCK_NO, NULL) == G_ALERTDEFAULT);
+               
+               if (answer == TRUE)
+                       overridden_yes = time(NULL);
+               else
+                       overridden_no  = time(NULL);
+       }
+       return answer;
+}
+
 void news_gtk_init(void)
 {
        guint i, n_entries;
@@ -305,16 +331,10 @@ static void download_cb(FolderView *folderview, guint action,
        item = gtk_ctree_node_get_row_data(ctree, folderview->selected);
        g_return_if_fail(item != NULL);
        g_return_if_fail(item->folder != NULL);
-#if 0
-       if (!prefs_common.online_mode) {
-               if (alertpanel(_("Offline"),
-                              _("You are offline. Go online?"),
-                              _("Yes"), _("No"), NULL) == G_ALERTDEFAULT)
-                       main_window_toggle_online(folderview->mainwin, TRUE);
-               else
-                       return;
-       }
-#endif
+
+       if (prefs_common.work_offline && !news_gtk_should_override())
+               return;
+
        main_window_cursor_wait(mainwin);
        inc_lock();
        main_window_lock(mainwin);
index 8cbf08bcdacec35c8b0d97df417f3f4435f2813b..d5a6581d413dab8699063f6339f55494009ef1c0 100644 (file)
@@ -21,5 +21,6 @@
 #define NEWS_GTK_H
 
 void news_gtk_init(void);
+gboolean news_gtk_should_override(void);
 
 #endif /* NEWS_GTK_H */