[pan2] activate action 'get-new-headers-when-entering-group' only for non-virtual groups



commit 88fe336467a1393399e248f0d68b375f1cf1cdf6
Author: Heinrich MÃller <henmull src gnome org>
Date:   Thu Jan 3 16:30:38 2013 +0100

    activate action 'get-new-headers-when-entering-group' only for non-virtual groups

 pan/gui/group-pane.cc |   27 +++++++++++++++++----------
 pan/gui/group-pane.h  |    1 +
 pan/gui/gui.cc        |   18 +++++++++++-------
 3 files changed, 29 insertions(+), 17 deletions(-)
---
diff --git a/pan/gui/group-pane.cc b/pan/gui/group-pane.cc
index 547b7c2..6e66888 100644
--- a/pan/gui/group-pane.cc
+++ b/pan/gui/group-pane.cc
@@ -947,6 +947,22 @@ GroupPane :: create_filter_entry ()
   return entry;
 }
 
+bool
+GroupPane :: is_virtual_group (const Quark& group)
+{
+  bool is_virtual = false;
+
+  for (int i(0); i != G_N_ELEMENTS(folders_groupnames); ++i)
+  {
+          if (group == folders_groupnames[i])
+          {
+                  is_virtual = true;
+                  break;
+          }
+  }
+  return is_virtual;
+}
+
 void
 GroupPane :: on_selection_changed (GtkTreeSelection*, gpointer pane_gpointer)
 {
@@ -969,18 +985,9 @@ GroupPane :: on_selection_changed (GtkTreeSelection*, gpointer pane_gpointer)
     self->_action_manager.sensitize_action (actions_that_require_a_group[i], have_group);
 
   // disable some functions for virtual mailbox folder
-  bool is_virtual = false;
-  for (int i(0); i != G_N_ELEMENTS(folders_groupnames); ++i)
-  {
-	  if (group == folders_groupnames[i])
-	  {
-		  is_virtual = true;
-		  break;
-	  }
-  }
 
   for (int i=0, n=G_N_ELEMENTS(actions_in_nonvirtual_group); i<n; ++i)
-    self->_action_manager.hide_action (actions_in_nonvirtual_group[i], is_virtual);
+    self->_action_manager.hide_action (actions_in_nonvirtual_group[i], is_virtual_group(group));
 }
 
 GroupPane :: GroupPane (ActionManager& action_manager, Data& data, Prefs& prefs, GroupPrefs& group_prefs):
diff --git a/pan/gui/group-pane.h b/pan/gui/group-pane.h
index cba539a..e961e78 100644
--- a/pan/gui/group-pane.h
+++ b/pan/gui/group-pane.h
@@ -76,6 +76,7 @@ namespace pan
 
     public:
       void read_group (const StringView&);
+      static bool is_virtual_group (const Quark& group);
 
     private:
       static void do_popup_menu (GtkWidget*, GdkEventButton*, gpointer);
diff --git a/pan/gui/gui.cc b/pan/gui/gui.cc
index f5f7ea1..8d4cd61 100644
--- a/pan/gui/gui.cc
+++ b/pan/gui/gui.cc
@@ -2044,14 +2044,18 @@ void GUI :: do_read_selected_group ()
   // otherwise if get-new-headers is turned on, queue an xover-new task.
   unsigned long unread(0), total(0);
 
-  if (changed && !group.empty()){// && _queue.is_online()) {
+  if (changed && !group.empty()){
     _data.get_group_counts (group, unread, total);
-    if (!total)
-      activate_action ("download-headers");
-    else if (_prefs.get_flag("get-new-headers-when-entering-group", true)) {
-      if (_prefs.get_flag ("mark-group-read-before-xover", false))
-        _data.mark_group_read (group);
-      _queue.add_task (new TaskXOver (_data, group, TaskXOver::NEW), Queue::TOP);
+    const bool virtual_group (GroupPane::is_virtual_group(group));
+    if (!virtual_group)
+    {
+      if (!total)
+        activate_action ("download-headers");
+      else if (_prefs.get_flag("get-new-headers-when-entering-group", true)) {
+        if (_prefs.get_flag ("mark-group-read-before-xover", false))
+          _data.mark_group_read (group);
+        _queue.add_task (new TaskXOver (_data, group, TaskXOver::NEW), Queue::TOP);
+      }
     }
   }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]