[pan2] clear last-visited (group/article) on middle-click
- From: Heinrich MÃller <henmull src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pan2] clear last-visited (group/article) on middle-click
- Date: Mon, 18 Jun 2012 17:36:24 +0000 (UTC)
commit 05250d54f9911e39e49cfb1faf8deb2b51ed3e2d
Author: Heinrich MÃller <henmull src gnome org>
Date: Mon Jun 18 19:35:31 2012 +0200
clear last-visited (group/article) on middle-click
pan/gui/body-pane.cc | 14 ++++++++++++--
pan/gui/body-pane.h | 6 ++++++
pan/gui/gui.cc | 11 +----------
pan/gui/header-pane.cc | 8 ++++++--
pan/gui/header-pane.h | 7 +++++++
5 files changed, 32 insertions(+), 14 deletions(-)
---
diff --git a/pan/gui/body-pane.cc b/pan/gui/body-pane.cc
index 4b8b7a7..329377b 100644
--- a/pan/gui/body-pane.cc
+++ b/pan/gui/body-pane.cc
@@ -1293,6 +1293,8 @@ BodyPane :: set_article (const Article& a)
refresh ();
+ set_cleared(false);
+
_data.mark_read (_article);
}
@@ -1303,6 +1305,8 @@ BodyPane :: clear ()
g_object_unref (_message);
_message = 0;
+ set_cleared(true);
+
refresh ();
}
@@ -1668,7 +1672,8 @@ BodyPane :: BodyPane (Data& data, ArticleCache& cache, Prefs& prefs, GroupPrefs
// _gpgerr(GPG_DECODE),
#endif
_attachments(0),
- _current_attachment(0)
+ _current_attachment(0),
+ _cleared (true)
{
GtkWidget * w, * l, * hbox;
@@ -1777,6 +1782,11 @@ BodyPane :: BodyPane (Data& data, ArticleCache& cache, Prefs& prefs, GroupPrefs
gtk_widget_show_all (_root);
}
+namespace
+{
+
+}
+
BodyPane :: ~BodyPane ()
{
_prefs.remove_listener (this);
@@ -1794,7 +1804,7 @@ BodyPane :: ~BodyPane ()
g_free(*it);
// store last opened message in prefs
- _prefs.set_string("last-opened-msg", get_message_id ().to_view());
+ _prefs.set_string("last-opened-msg", get_cleared() ? "" : get_message_id().to_view());
}
diff --git a/pan/gui/body-pane.h b/pan/gui/body-pane.h
index 4478218..b41e296 100644
--- a/pan/gui/body-pane.h
+++ b/pan/gui/body-pane.h
@@ -161,6 +161,12 @@ namespace pan
std::set<char*> _attach_names;
MenuSelection _selection;
+ bool _cleared;
+
+ public:
+ void set_cleared(bool val) { _cleared = val; }
+ bool get_cleared() { return _cleared; }
+
public:
const char* _current_attachment;
diff --git a/pan/gui/gui.cc b/pan/gui/gui.cc
index 041397f..d0222f1 100644
--- a/pan/gui/gui.cc
+++ b/pan/gui/gui.cc
@@ -203,15 +203,6 @@ GUI :: root_realized_cb (GtkWidget*, gpointer self_gpointer)
#endif
gui->_body_pane->set_text_from_message(msg);
-// Article article;
-// PartBatch part_batch;
-// last_msg = last_msg.substr(last_msg.strchr('<')+1, last_msg.strchr('>'));
-// std::cerr<<"msg "<<last_msg<<"\n";
-// part_batch.init (last_msg, 1, 0);
-// part_batch.add_part (0, last_msg, 0);
-// article.set_parts(part_batch);
-// Task * t = new TaskArticle (_data, _data, article, _cache, _data, this);
-// _queue.add_task (t, Queue::TOP);
}
}
@@ -1018,7 +1009,7 @@ void GUI :: do_clear_header_pane ()
{
gtk_window_set_title (get_window(_root), _("Pan"));
_header_pane->set_group (Quark());
-
+// _header_pane->set_cleared(true);
}
void GUI :: do_clear_body_pane ()
diff --git a/pan/gui/header-pane.cc b/pan/gui/header-pane.cc
index 05bdeea..d782671 100644
--- a/pan/gui/header-pane.cc
+++ b/pan/gui/header-pane.cc
@@ -582,6 +582,9 @@ HeaderPane :: rebuild ()
bool
HeaderPane :: set_group (const Quark& new_group)
{
+
+ set_cleared(new_group.empty());
+
const Quark old_group (_group);
bool change (old_group != new_group);
@@ -1761,7 +1764,7 @@ HeaderPane :: ~HeaderPane ()
}
g_list_free (columns);
- _prefs.set_string("last-visited-group", _group.to_view());
+ _prefs.set_string("last-visited-group", get_cleared() ? "" : _group.to_view());
set_group (Quark());
for (guint i=0; i<ICON_QTY; ++i)
@@ -1876,7 +1879,8 @@ HeaderPane :: HeaderPane (ActionManager & action_manager,
_tree_store (0),
_selection_changed_idle_tag (0),
_cache (cache),
- _gui (gui)
+ _gui (gui),
+ _cleared (true)
{
// init the icons
for (guint i=0; i<ICON_QTY; ++i)
diff --git a/pan/gui/header-pane.h b/pan/gui/header-pane.h
index 8be7260..461d088 100644
--- a/pan/gui/header-pane.h
+++ b/pan/gui/header-pane.h
@@ -381,6 +381,13 @@ namespace pan
const TreeIterFunctor & iterate_func,
const ArticleTester & test_func,
RowActionFunctor & success_func);
+ private:
+
+ bool _cleared;
+
+ public:
+ void set_cleared(bool val) { _cleared = val; }
+ bool get_cleared() { return _cleared; }
};
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]