2006-08-02 [colin] 2.4.0cvs18
authorColin Leroy <colin@colino.net>
Wed, 2 Aug 2006 17:04:06 +0000 (17:04 +0000)
committerColin Leroy <colin@colino.net>
Wed, 2 Aug 2006 17:04:06 +0000 (17:04 +0000)
* src/messageview.c
Add Hide quotes menu

ChangeLog
PATCHSETS
configure.ac
src/messageview.c

index f40277d6ac4f03732ae23c860d773efd353a4a78..f2ad8fa218fb062539f9c0618b640012d1a86d60 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-08-02 [colin]     2.4.0cvs18
+
+       * src/messageview.c
+               Add Hide quotes menu
+
 2006-08-02 [colin]     2.4.0cvs17
 
        * src/mainwindow.c
index 6e9827d4504a057d7e39e37c8e524ee8e0c06875..07bfb42a5c28e1d0943243416ee422e4f12bab05 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.25.2.16 -r 1.25.2.17 src/matcher_parser_parse.y;  ) > 2.4.0cvs15.patchset
 ( cvs diff -u -r 1.274.2.130 -r 1.274.2.131 src/mainwindow.c;  ) > 2.4.0cvs16.patchset
 ( cvs diff -u -r 1.274.2.131 -r 1.274.2.132 src/mainwindow.c;  cvs diff -u -r 1.204.2.94 -r 1.204.2.95 src/prefs_common.c;  cvs diff -u -r 1.96.2.129 -r 1.96.2.130 src/textview.c;  cvs diff -u -r 1.12.2.11 -r 1.12.2.12 src/textview.h;  cvs diff -u -r 1.4.2.34 -r 1.4.2.35 src/gtk/about.c;  ) > 2.4.0cvs17.patchset
+( cvs diff -u -r 1.94.2.91 -r 1.94.2.92 src/messageview.c;  ) > 2.4.0cvs18.patchset
index 697f911f7fa1f43fa70310871ca8793e6e4e9f15..5d94ed2ed48420f8a5ea89043c1c5fd8ce5a710e 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=4
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=17
+EXTRA_VERSION=18
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 03ef58a3e63839991e9ccb80ab906d5734f2d777..eb3295f6eeb48e915bc6a94997ff1761ff432371 100644 (file)
@@ -120,6 +120,9 @@ static void view_source_cb          (gpointer        data,
 static void show_all_header_cb         (gpointer        data,
                                         guint           action,
                                         GtkWidget      *widget);
+static void hide_quotes_cb             (gpointer        data,
+                                        guint           action,
+                                        GtkWidget      *widget);
 
 static void compose_cb                 (gpointer        data,
                                         guint           action,
@@ -274,6 +277,10 @@ static GtkItemFactoryEntry msgview_entries[] =
        {N_("/_View/---"),              NULL, NULL, 0, "<Separator>"},
        {N_("/_View/Mess_age source"),  "<control>U", view_source_cb, 0, NULL},
        {N_("/_View/Show all _headers"),"<control>H", show_all_header_cb, 0, "<ToggleItem>"},
+       {N_("/_View/Quotes"),                   NULL, NULL, 0, "<Branch>"},
+       {N_("/_View/Quotes/_Hide all"),         "<control><shift>Q", hide_quotes_cb, 1, "<ToggleItem>"},
+       {N_("/_View/Quotes/Hide from level _2"),NULL, hide_quotes_cb, 2, "<ToggleItem>"},
+       {N_("/_View/Quotes/Hide from level _3"),NULL, hide_quotes_cb, 3, "<ToggleItem>"},
 
        {N_("/_Message"),               NULL, NULL, 0, "<Branch>"},
        {N_("/_Message/Compose _new message"),
@@ -1512,6 +1519,40 @@ static void show_all_header_cb(gpointer data, guint action, GtkWidget *widget)
        main_window_set_menu_sensitive(messageview->mainwin);
 }
 
+#define SET_CHECK_MENU_ACTIVE(path, active) \
+{ \
+       menuitem = gtk_item_factory_get_widget(ifactory, path); \
+       gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), active); \
+}
+
+static void hide_quotes_cb(gpointer data, guint action, GtkWidget *widget)
+{
+       MessageView *messageview = (MessageView *)data;
+       MsgInfo *msginfo = messageview->msginfo;
+       static gboolean updating_menu = FALSE;
+       GtkItemFactory *ifactory = gtk_item_factory_from_widget(messageview->menubar);
+       GtkWidget *menuitem;
+       if (updating_menu)
+               return;
+
+       prefs_common.hide_quotes = 
+                       GTK_CHECK_MENU_ITEM(widget)->active ? action : 0;
+       
+       updating_menu=TRUE;
+       SET_CHECK_MENU_ACTIVE("/View/Quotes/Hide all", FALSE);
+       SET_CHECK_MENU_ACTIVE("/View/Quotes/Hide from level 2", FALSE);
+       SET_CHECK_MENU_ACTIVE("/View/Quotes/Hide from level 3", FALSE);
+       gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), prefs_common.hide_quotes > 0);      
+       updating_menu=FALSE;
+       if (!msginfo) return;
+       messageview->msginfo = NULL;
+       messageview_show(messageview, msginfo,
+                        messageview->all_headers);
+       procmsg_msginfo_free(msginfo);
+       main_window_set_menu_sensitive(messageview->mainwin);
+}
+#undef SET_CHECK_MENU_ACTIVE
+
 static void compose_cb(gpointer data, guint action, GtkWidget *widget)
 {
        MessageView *messageview = (MessageView *)data;
@@ -1626,6 +1667,20 @@ void messageview_set_menu_sensitive(MessageView *messageview)
                gtk_check_menu_item_set_active
                        (GTK_CHECK_MENU_ITEM(menuitem),
                         messageview->mimeview->textview->show_all_headers);
+               if (prefs_common.hide_quotes) {
+                       if (prefs_common.hide_quotes == 1)
+                               menuitem = gtk_item_factory_get_widget(ifactory, 
+                                               "/View/Quotes/Hide all");
+                       if (prefs_common.hide_quotes == 2)
+                               menuitem = gtk_item_factory_get_widget(ifactory, 
+                                               "/View/Quotes/Hide from level 2");
+                       if (prefs_common.hide_quotes == 3)
+                               menuitem = gtk_item_factory_get_widget(ifactory, 
+                                               "/View/Quotes/Hide from level 3");
+                       gtk_check_menu_item_set_active
+                               (GTK_CHECK_MENU_ITEM(menuitem),
+                                TRUE);
+               }
        }
 }