aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-08-26 22:20:12 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-08-27 01:14:01 +0800
commit87a3fac95cfdcb3dde4e0b75718239de20d8812f (patch)
treee69869f6e7c25fa37a44cab806ad4cec66a64354 /mail
parent5270b3042f2f5b3e122d7c2ac4f365109458dd19 (diff)
downloadgsoc2013-evolution-87a3fac95cfdcb3dde4e0b75718239de20d8812f.tar
gsoc2013-evolution-87a3fac95cfdcb3dde4e0b75718239de20d8812f.tar.gz
gsoc2013-evolution-87a3fac95cfdcb3dde4e0b75718239de20d8812f.tar.bz2
gsoc2013-evolution-87a3fac95cfdcb3dde4e0b75718239de20d8812f.tar.lz
gsoc2013-evolution-87a3fac95cfdcb3dde4e0b75718239de20d8812f.tar.xz
gsoc2013-evolution-87a3fac95cfdcb3dde4e0b75718239de20d8812f.tar.zst
gsoc2013-evolution-87a3fac95cfdcb3dde4e0b75718239de20d8812f.zip
Mail module + EMailView cleanups.
Diffstat (limited to 'mail')
-rw-r--r--mail/e-mail-notebook-view.c10
-rw-r--r--mail/e-mail-view.c70
-rw-r--r--mail/e-mail-view.h4
3 files changed, 71 insertions, 13 deletions
diff --git a/mail/e-mail-notebook-view.c b/mail/e-mail-notebook-view.c
index a10c37031c..41cab950bc 100644
--- a/mail/e-mail-notebook-view.c
+++ b/mail/e-mail-notebook-view.c
@@ -140,7 +140,7 @@ mnv_page_changed (GtkNotebook *book,
em_folder_tree_set_selected (folder_tree, uri, FALSE);
if (mview != priv->current_view) {
- mview->prev = priv->current_view;
+ e_mail_view_set_previous_view (mview, priv->current_view);
priv->current_view = mview;
}
@@ -268,7 +268,7 @@ mnv_tab_closed_cb (ClutterTimeline *timeline,
if (E_IS_MAIL_FOLDER_PANE (page))
g_hash_table_remove (data->view->priv->views, folder_uri);
- prev = page->prev;
+ prev = e_mail_view_get_previous_view (page);
if (prev) {
num = emnv_get_page_num (data->view, (GtkWidget *)prev);
mnv_set_current_tab (data->view, num);
@@ -343,7 +343,7 @@ tab_remove_gtk_cb (GtkWidget *button,
if (E_IS_MAIL_FOLDER_PANE (page))
g_hash_table_remove (view->priv->views, folder_uri);
- prev = page->prev;
+ prev = e_mail_view_get_previous_view (page);
if (prev) {
num = emnv_get_page_num (view, (GtkWidget *)prev);
gtk_notebook_set_current_page (view->priv->book, num);
@@ -865,7 +865,7 @@ mail_netbook_view_open_mail (EMailView *view,
shell_view = e_mail_view_get_shell_view (E_MAIL_VIEW (nview));
pos = emnv_get_page_num (nview, GTK_WIDGET (priv->current_view));
pane = e_mail_message_pane_new (shell_view);
- pane->prev = priv->current_view;
+ e_mail_view_set_previous_view (pane, priv->current_view);
E_MAIL_MESSAGE_PANE(pane)->parent_folder_view = priv->current_view;
priv->current_view = pane;
@@ -1086,7 +1086,7 @@ mail_notebook_view_set_folder (EMailReader *reader,
shell_view = e_mail_view_get_shell_view (E_MAIL_VIEW (reader));
priv->current_view = e_mail_folder_pane_new (shell_view);
gtk_widget_show ((GtkWidget *)priv->current_view);
- priv->current_view->prev = old_view;
+ e_mail_view_set_previous_view (priv->current_view, old_view);
page = gtk_notebook_append_page (
priv->book, (GtkWidget *)priv->current_view,
create_tab_label (
diff --git a/mail/e-mail-view.c b/mail/e-mail-view.c
index 909f38b33d..62e0b0c733 100644
--- a/mail/e-mail-view.c
+++ b/mail/e-mail-view.c
@@ -35,26 +35,28 @@
struct _EMailViewPrivate {
EShellView *shell_view;
GtkOrientation orientation;
+ EMailView *previous_view;
guint preview_visible : 1;
guint show_deleted : 1;
};
enum {
- PANE_CLOSE,
- VIEW_CHANGED,
- OPEN_MAIL,
- LAST_SIGNAL
-};
-
-enum {
PROP_0,
PROP_ORIENTATION,
PROP_PREVIEW_VISIBLE,
+ PROP_PREVIOUS_VIEW,
PROP_SHELL_VIEW,
PROP_SHOW_DELETED
};
+enum {
+ PANE_CLOSE,
+ VIEW_CHANGED,
+ OPEN_MAIL,
+ LAST_SIGNAL
+};
+
static guint signals[LAST_SIGNAL];
G_DEFINE_TYPE (EMailView, e_mail_view, GTK_TYPE_VBOX)
@@ -88,6 +90,12 @@ mail_view_set_property (GObject *object,
g_value_get_boolean (value));
return;
+ case PROP_PREVIOUS_VIEW:
+ e_mail_view_set_previous_view (
+ E_MAIL_VIEW (object),
+ g_value_get_object (value));
+ return;
+
case PROP_SHELL_VIEW:
mail_view_set_shell_view (
E_MAIL_VIEW (object),
@@ -123,6 +131,12 @@ mail_view_get_property (GObject *object,
E_MAIL_VIEW (object)));
return;
+ case PROP_PREVIOUS_VIEW:
+ g_value_set_object (
+ value, e_mail_view_get_previous_view (
+ E_MAIL_VIEW (object)));
+ return;
+
case PROP_SHELL_VIEW:
g_value_set_object (
value, e_mail_view_get_shell_view (
@@ -151,6 +165,11 @@ mail_view_dispose (GObject *object)
priv->shell_view = NULL;
}
+ if (priv->previous_view != NULL) {
+ g_object_unref (priv->previous_view);
+ priv->previous_view = NULL;
+ }
+
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (e_mail_view_parent_class)->dispose (object);
}
@@ -271,6 +290,16 @@ e_mail_view_class_init (EMailViewClass *class)
g_object_class_install_property (
object_class,
+ PROP_PREVIOUS_VIEW,
+ g_param_spec_object (
+ "previous-view",
+ "Previous View",
+ NULL,
+ E_TYPE_MAIL_VIEW,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
PROP_SHELL_VIEW,
g_param_spec_object (
"shell-view",
@@ -399,6 +428,33 @@ e_mail_view_set_preview_visible (EMailView *view,
class->set_preview_visible (view, visible);
}
+EMailView *
+e_mail_view_get_previous_view (EMailView *view)
+{
+ g_return_val_if_fail (E_IS_MAIL_VIEW (view), NULL);
+
+ return view->priv->previous_view;
+}
+
+void
+e_mail_view_set_previous_view (EMailView *view,
+ EMailView *previous_view)
+{
+ g_return_if_fail (E_IS_MAIL_VIEW (view));
+
+ if (previous_view != NULL) {
+ g_return_if_fail (E_IS_MAIL_VIEW (previous_view));
+ g_object_ref (previous_view);
+ }
+
+ if (view->priv->previous_view != NULL)
+ g_object_unref (view->priv->previous_view);
+
+ view->priv->previous_view = previous_view;
+
+ g_object_notify (G_OBJECT (view), "previous-view");
+}
+
gboolean
e_mail_view_get_show_deleted (EMailView *view)
{
diff --git a/mail/e-mail-view.h b/mail/e-mail-view.h
index da4e5e2688..6c697bda44 100644
--- a/mail/e-mail-view.h
+++ b/mail/e-mail-view.h
@@ -55,7 +55,6 @@ typedef struct _EMailViewPrivate EMailViewPrivate;
struct _EMailView {
GtkVBox parent;
EMailViewPrivate *priv;
- EMailView *prev;
};
struct _EMailViewClass {
@@ -97,6 +96,9 @@ GtkOrientation e_mail_view_get_orientation (EMailView *);
void e_mail_view_set_preview_visible (EMailView *view,
gboolean visible);
gboolean e_mail_view_get_preview_visible (EMailView *view);
+EMailView * e_mail_view_get_previous_view (EMailView *view);
+void e_mail_view_set_previous_view (EMailView *view,
+ EMailView *previous_view);
gboolean e_mail_view_get_show_deleted (EMailView *view);
void e_mail_view_set_show_deleted (EMailView *view,
gboolean show_deleted);