[evolution/tabs-rewrite-v1: 15/31] Make the update-actions work across tabs.
- From: Srinivasa Ragavan <sragavan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/tabs-rewrite-v1: 15/31] Make the update-actions work across tabs.
- Date: Tue, 20 Jul 2010 11:44:07 +0000 (UTC)
commit 07d4ecf0142228eefa77c417541346ff1957b30d
Author: Srinivasa Ragavan <sragavan gnome org>
Date: Tue Jul 13 13:01:11 2010 +0530
Make the update-actions work across tabs.
mail/e-mail-notebook-view.c | 31 ++++++++++++++++++++++++++++++
mail/e-mail-reader.c | 36 +++++++++++++++++++++++++++++++++++
modules/mail/e-mail-shell-content.c | 18 +++++++++++++++++
3 files changed, 85 insertions(+), 0 deletions(-)
---
diff --git a/mail/e-mail-notebook-view.c b/mail/e-mail-notebook-view.c
index 16353cd..5fa6c68 100644
--- a/mail/e-mail-notebook-view.c
+++ b/mail/e-mail-notebook-view.c
@@ -63,6 +63,16 @@ e_mail_notebook_view_finalize (GObject *object)
}
static void
+mnv_page_changed (GtkNotebook *book, GtkNotebookPage *page,
+ guint page_num, EMailNotebookView *view)
+{
+ EMailView *mview = gtk_notebook_get_nth_page (book, page_num);
+
+ view->priv->current_view = mview;
+ g_signal_emit_by_name (view, "changed");
+}
+
+static void
mail_notebook_view_constructed (GObject *object)
{
GtkWidget *widget, *container;
@@ -77,6 +87,8 @@ mail_notebook_view_constructed (GObject *object)
gtk_widget_show (widget);
gtk_box_pack_start (GTK_BOX(container), widget, TRUE, TRUE, 0);
+ g_signal_connect (widget, "switch-page", G_CALLBACK(mnv_page_changed), object);
+
priv->current_view = e_mail_paned_view_new (E_MAIL_VIEW(object)->content);
gtk_widget_show (priv->current_view);
gtk_notebook_append_page (priv->book, priv->current_view, gtk_label_new ("Please select a folder"));
@@ -222,6 +234,18 @@ emnv_get_page_num (EMailNotebookView *view,
}
static void
+reconnect_changed_event (EMailReader *child, EMailReader *parent)
+{
+ g_signal_emit_by_name (parent, "changed");
+}
+
+static void
+reconnect_folder_loaded_event (EMailReader *child, EMailReader *parent)
+{
+ g_signal_emit_by_name (parent, "folder-loaded");
+}
+
+static void
mail_notebook_view_set_folder (EMailReader *reader,
CamelFolder *folder,
const gchar *folder_uri)
@@ -244,11 +268,18 @@ mail_notebook_view_set_folder (EMailReader *reader,
int page;
new_view = e_mail_paned_view_new (E_MAIL_VIEW(reader)->content);
+ priv->current_view = (EMailView *)new_view;
gtk_widget_show (new_view);
page = gtk_notebook_append_page (priv->book, new_view, gtk_label_new (camel_folder_get_full_name(folder)));
e_mail_reader_set_folder (E_MAIL_READER(new_view), folder, folder_uri);
gtk_notebook_set_current_page (priv->book, page);
g_hash_table_insert (priv->views, g_strdup(folder_uri), new_view);
+ g_signal_connect ( E_MAIL_READER(new_view), "changed",
+ G_CALLBACK (reconnect_changed_event),
+ reader);
+ g_signal_connect ( E_MAIL_READER (new_view), "folder-loaded",
+ G_CALLBACK (reconnect_folder_loaded_event),
+ reader);
}
}
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 17cae89..7c29700 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -3001,9 +3001,45 @@ e_mail_reader_init (EMailReader *reader)
void
e_mail_reader_init_private (EMailReader *reader)
{
+ EMFormatHTML *formatter;
+ EWebView *web_view;
+ GtkWidget *message_list;
+
+ g_return_if_fail (E_IS_MAIL_READER (reader));
+
+ formatter = e_mail_reader_get_formatter (reader);
+ message_list = e_mail_reader_get_message_list (reader);
+
+ web_view = em_format_html_get_web_view (formatter);
quark_private = g_quark_from_static_string ("EMailReader-private");
+ /* Connect signals. */
+
+ g_signal_connect_swapped (
+ web_view, "key-press-event",
+ G_CALLBACK (mail_reader_key_press_event_cb), reader);
+
+ g_signal_connect_swapped (
+ message_list, "message-selected",
+ G_CALLBACK (mail_reader_message_selected_cb), reader);
+
+ g_signal_connect_swapped (
+ message_list, "message-list-built",
+ G_CALLBACK (mail_reader_emit_folder_loaded), reader);
+
+ g_signal_connect_swapped (
+ message_list, "double-click",
+ G_CALLBACK (mail_reader_double_click_cb), reader);
+
+ g_signal_connect_swapped (
+ message_list, "key-press",
+ G_CALLBACK (mail_reader_key_press_cb), reader);
+
+ g_signal_connect_swapped (
+ message_list, "selection-change",
+ G_CALLBACK (e_mail_reader_changed), reader);
+
g_object_set_qdata_full (
G_OBJECT (reader), quark_private,
g_slice_new0 (EMailReaderPrivate),
diff --git a/modules/mail/e-mail-shell-content.c b/modules/mail/e-mail-shell-content.c
index 3cdcee2..acc2e49 100644
--- a/modules/mail/e-mail-shell-content.c
+++ b/modules/mail/e-mail-shell-content.c
@@ -70,6 +70,18 @@ mail_shell_content_dispose (GObject *object)
}
static void
+reconnect_changed_event (EMailReader *child, EMailReader *parent)
+{
+ g_signal_emit_by_name (parent, "changed");
+}
+
+static void
+reconnect_folder_loaded_event (EMailReader *child, EMailReader *parent)
+{
+ g_signal_emit_by_name (parent, "folder-loaded");
+}
+
+static void
mail_shell_content_constructed (GObject *object)
{
EMailShellContentPrivate *priv;
@@ -98,6 +110,12 @@ mail_shell_content_constructed (GObject *object)
E_MAIL_SHELL_CONTENT(object)->view = (EMailView *)widget;
gtk_container_add (GTK_CONTAINER (container), widget);
gtk_widget_show (widget);
+ g_signal_connect ( E_MAIL_READER(widget), "changed",
+ G_CALLBACK (reconnect_changed_event),
+ object);
+ g_signal_connect ( E_MAIL_READER (widget), "folder-loaded",
+ G_CALLBACK (reconnect_folder_loaded_event),
+ object);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]