* src/prefs_toolbar.[ch]
authorAlfons Hoogervorst <alfons@proteus.demon.nl>
Tue, 13 May 2003 11:15:22 +0000 (11:15 +0000)
committerAlfons Hoogervorst <alfons@proteus.demon.nl>
Tue, 13 May 2003 11:15:22 +0000 (11:15 +0000)
* src/summaryview.[ch]
* src/toolbar.[ch]
change misleading text in toolbar prefs;
add toolbar action for ignore thread (toggles ignore thread flag);
clean up a little bit;

ChangeLog.claws
configure.ac
src/prefs_toolbar.c
src/prefs_toolbar.h
src/summaryview.c
src/summaryview.h
src/toolbar.c
src/toolbar.h

index 3dcf8b3..c2fe029 100644 (file)
@@ -1,3 +1,12 @@
+2003-05-13 [alfons]    0.8.11claws150
+
+       * src/prefs_toolbar.[ch]
+       * src/summaryview.[ch]
+       * src/toolbar.[ch]
+               change misleading text in toolbar prefs;
+               add toolbar action for ignore thread (toggles ignore thread flag);
+               clean up a little bit;
+
 2003-05-12 [paul]
 
        * tools/convert_mbox.pl
index 0888d1f..5a6b4ea 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=11
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws149
+EXTRA_VERSION=claws150
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 131b2d5..a5d88c3 100644 (file)
@@ -679,7 +679,7 @@ static void prefs_toolbar_create(ToolbarPage *prefs_toolbar)
        top_hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(main_vbox), top_hbox, TRUE, TRUE, 0);
   
-       compose_frame = gtk_frame_new(_("Available toolbar items"));
+       compose_frame = gtk_frame_new(_("Available toolbar icons"));
        gtk_box_pack_start(GTK_BOX(top_hbox), compose_frame, TRUE, TRUE, 0);
        gtk_container_set_border_width(GTK_CONTAINER(compose_frame), 5);
 
@@ -865,7 +865,7 @@ ToolbarPage *prefs_toolbar_mainwindow;
 ToolbarPage *prefs_toolbar_composewindow;
 ToolbarPage *prefs_toolbar_messageview;
 
-void prefs_toolbar_init()
+void prefs_toolbar_init(void)
 {
        ToolbarPage *page;
 
@@ -897,7 +897,7 @@ void prefs_toolbar_init()
        prefs_toolbar_composewindow = page;
 }
 
-void prefs_toolbar_done()
+void prefs_toolbar_done(void)
 {
        prefs_gtk_unregister_page((PrefsPage *) prefs_toolbar_mainwindow);
        g_free(prefs_toolbar_mainwindow);
index b82fc45..fb2adb3 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef __PREFS_CUSTOM_TOOLBAR_H__
 #define __PREFS_CUSTOM_TOOLBAR_H__
 
-void prefs_toolbar_init();
-void prefs_toolbar_done();
+void prefs_toolbar_init                (void);
+void prefs_toolbar_done                (void);
 
 #endif /* __PREFS_CUSTOM_TOOLBAR_H__ */ 
index ab542d5..10a53e5 100644 (file)
@@ -228,8 +228,8 @@ static void summary_execute_delete_func     (GtkCTree               *ctree,
                                         gpointer                data);
 
 static void summary_thread_init                (SummaryView            *summaryview);
-static void summary_ignore_thread      (SummaryView            *summaryview);
-static void summary_unignore_thread    (SummaryView            *summaryview);
+static void summary_ignore_thread      (SummaryView            *summaryview);
+static void summary_unignore_thread     (SummaryView            *summaryview);
 
 static void summary_unthread_for_exec          (SummaryView    *summaryview);
 static void summary_unthread_for_exec_func     (GtkCTree       *ctree,
@@ -5085,9 +5085,10 @@ static void summary_ignore_thread(SummaryView *summaryview)
 
        folder_item_update_freeze();
 
-       for (cur = GTK_CLIST(ctree)->selection; cur != NULL; cur = cur->next) {
-               gtk_ctree_pre_recursive(ctree, GTK_CTREE_NODE(cur->data), GTK_CTREE_FUNC(summary_ignore_thread_func), summaryview);
-       }
+       for (cur = GTK_CLIST(ctree)->selection; cur != NULL; cur = cur->next)
+               gtk_ctree_pre_recursive(ctree, GTK_CTREE_NODE(cur->data), 
+                                       GTK_CTREE_FUNC(summary_ignore_thread_func), 
+                                       summaryview);
 
        folder_item_update_thaw();
 
@@ -5122,15 +5123,46 @@ static void summary_unignore_thread(SummaryView *summaryview)
 
        folder_item_update_freeze();
 
-       for (cur = GTK_CLIST(ctree)->selection; cur != NULL; cur = cur->next) {
-               gtk_ctree_pre_recursive(ctree, GTK_CTREE_NODE(cur->data), GTK_CTREE_FUNC(summary_unignore_thread_func), summaryview);
-       }
+       for (cur = GTK_CLIST(ctree)->selection; cur != NULL; cur = cur->next)
+               gtk_ctree_pre_recursive(ctree, GTK_CTREE_NODE(cur->data), 
+                                       GTK_CTREE_FUNC(summary_unignore_thread_func), 
+                                       summaryview);
 
        folder_item_update_thaw();
 
        summary_status_show(summaryview);
 }
 
+static void summary_check_ignore_thread_func
+               (GtkCTree *ctree, GtkCTreeNode *row, gpointer data)
+{
+       MsgInfo *msginfo;
+       gint *found_ignore = (gint *) data;
+
+       if (*found_ignore) return;
+       else {
+               msginfo = gtk_ctree_node_get_row_data(ctree, row);
+               *found_ignore = MSG_IS_IGNORE_THREAD(msginfo->flags);
+       }               
+}
+
+void summary_toggle_ignore_thread(SummaryView *summaryview)
+{
+       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GList *cur;
+       gint found_ignore = 0;
+
+       for (cur = GTK_CLIST(ctree)->selection; cur != NULL; cur = cur->next)
+               gtk_ctree_pre_recursive(ctree, GTK_CTREE_NODE(cur->data),
+                                       GTK_CTREE_FUNC(summary_check_ignore_thread_func),
+                                       &found_ignore);
+
+       if (found_ignore) 
+               summary_unignore_thread(summaryview);
+       else 
+               summary_ignore_thread(summaryview);
+}
+
 #if 0 /* OLD PROCESSING */
 static gboolean processing_apply_func(GNode *node, gpointer data)
 {
index 2d162ab..d0b35a7 100644 (file)
@@ -203,6 +203,7 @@ void summary_unthread                 (SummaryView          *summaryview);
 
 void summary_expand_threads      (SummaryView          *summaryview);
 void summary_collapse_threads    (SummaryView          *summaryview);
+void summary_toggle_ignore_thread (SummaryView         *summaryview);
 
 void summary_filter              (SummaryView          *summaryview);
 void summary_filter_open         (SummaryView          *summaryview,
index 005ec4a..e1bc2cb 100644 (file)
@@ -115,6 +115,9 @@ static void toolbar_forward_cb                      (GtkWidget      *widget,
 static void toolbar_next_unread_cb             (GtkWidget      *widget,
                                                 gpointer        data);
 
+static void toolbar_ignore_thread_cb           (GtkWidget      *widget,
+                                                gpointer        data);
+
 static void toolbar_actions_execute_cb         (GtkWidget      *widget,
                                                 gpointer        data);
 
@@ -158,6 +161,7 @@ struct {
        { "A_DELETE",        N_("Delete Message")                       },
        { "A_EXECUTE",       N_("Execute")                              },
        { "A_GOTO_NEXT",     N_("Goto Next Message")                    },
+       { "A_IGNORE_THREAD", N_("Ignore thread")                        },
 
        { "A_SEND",          N_("Send Message")                         },
        { "A_SENDL",         N_("Put into queue folder and send later") },
@@ -278,31 +282,32 @@ GList *toolbar_get_action_items(ToolbarType source)
        gint i = 0;
        
        if (source == TOOLBAR_MAIN) {
-               gint main_items[14] = { A_RECEIVE_ALL,   A_RECEIVE_CUR,   A_SEND_QUEUED,
-                                       A_COMPOSE_EMAIL, A_REPLY_MESSAGE, A_REPLY_SENDER,  
-                                       A_REPLY_ALL,     A_REPLY_ML,      A_FORWARD,       
-                                       A_DELETE,        A_EXECUTE,       A_GOTO_NEXT,      
+               gint main_items[]   = { A_RECEIVE_ALL,   A_RECEIVE_CUR,   A_SEND_QUEUED,
+                                       A_COMPOSE_EMAIL, A_REPLY_MESSAGE, A_REPLY_SENDER, 
+                                       A_REPLY_ALL,     A_REPLY_ML,      A_FORWARD, 
+                                       A_DELETE,        A_EXECUTE,       A_GOTO_NEXT, 
+                                       A_IGNORE_THREAD, 
                                        A_ADDRBOOK,      A_SYL_ACTIONS };
 
-               for (i = 0; i < sizeof(main_items)/sizeof(main_items[0]); i++) 
+               for (i = 0; i < sizeof main_items / sizeof main_items[0]; i++) 
                        items = g_list_append(items, gettext(toolbar_text[main_items[i]].descr));
        }
        else if (source == TOOLBAR_COMPOSE) {
-               gint comp_items[10] = { A_SEND,          A_SENDL,        A_DRAFT,
+               gint comp_items[] =   { A_SEND,          A_SENDL,        A_DRAFT,
                                        A_INSERT,        A_ATTACH,       A_SIG,
                                        A_EXTEDITOR,     A_LINEWRAP,     A_ADDRBOOK,
                                        A_SYL_ACTIONS };        
 
-               for (i = 0; i < sizeof(comp_items)/sizeof(comp_items[0]); i++) 
+               for (i = 0; i < sizeof comp_items / sizeof comp_items[0]; i++) 
                        items = g_list_append(items, gettext(toolbar_text[comp_items[i]].descr));
        }
        else if (source == TOOLBAR_MSGVIEW) {
-               gint msgv_items[10] = { A_COMPOSE_EMAIL, A_REPLY_MESSAGE, A_REPLY_SENDER,
+               gint msgv_items[] =   { A_COMPOSE_EMAIL, A_REPLY_MESSAGE, A_REPLY_SENDER,
                                        A_REPLY_ALL,     A_REPLY_ML,      A_FORWARD,
                                        A_DELETE,        A_GOTO_NEXT,     A_ADDRBOOK,
                                        A_SYL_ACTIONS };        
 
-               for (i = 0; i < sizeof(msgv_items)/sizeof(msgv_items[0]); i++) 
+               for (i = 0; i < sizeof msgv_items / sizeof msgv_items[0]; i++) 
                        items = g_list_append(items, gettext(toolbar_text[msgv_items[i]].descr));
        }
 
@@ -1236,6 +1241,29 @@ static void toolbar_next_unread_cb(GtkWidget *widget, gpointer data)
        }
 }
 
+static void toolbar_ignore_thread_cb(GtkWidget *widget, gpointer data)
+{
+       ToolbarItem *toolbar_item = (ToolbarItem*)data;
+       MainWindow *mainwin;
+       MessageView *msgview;
+
+       g_return_if_fail(toolbar_item != NULL);
+
+       switch (toolbar_item->type) {
+       case TOOLBAR_MAIN:
+               mainwin = (MainWindow *) toolbar_item->parent;
+               summary_toggle_ignore_thread(mainwin->summaryview);
+               break;
+       case TOOLBAR_MSGVIEW:
+               /* TODO: see toolbar_next_unread_cb() if you need
+                * this in the message view */
+               break;
+       default:
+               debug_print("toolbar event not supported\n");
+               break;
+       }
+}
+
 static void toolbar_send_cb(GtkWidget *widget, gpointer data)
 {
        compose_toolbar_cb(A_SEND, data);
@@ -1375,6 +1403,7 @@ static void toolbar_buttons_cb(GtkWidget   *widget,
                { A_DELETE,             toolbar_delete_cb               },
                { A_EXECUTE,            toolbar_exec_cb                 },
                { A_GOTO_NEXT,          toolbar_next_unread_cb          },
+               { A_IGNORE_THREAD,      toolbar_ignore_thread_cb        },
 
                { A_SEND,               toolbar_send_cb                 },
                { A_SENDL,              toolbar_send_later_cb           },
index 2d6cb54..cfa3c5c 100644 (file)
@@ -145,6 +145,7 @@ enum {
        A_DELETE,
        A_EXECUTE,
        A_GOTO_NEXT,
+       A_IGNORE_THREAD,
 
        /* compose toolbar */
        A_SEND,