diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-07-26 12:30:38 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-07-26 13:16:42 +0800 |
commit | 81e5428a59194dd38cf2a07b2d3f9b4b6f81f6ef (patch) | |
tree | 0211046a4e44ba2a0e82b1c1ce8f9a903552f979 /mail | |
parent | 13cf1d104bbacffaf09393678c12a7efadd53139 (diff) | |
download | gsoc2013-evolution-81e5428a59194dd38cf2a07b2d3f9b4b6f81f6ef.tar.gz gsoc2013-evolution-81e5428a59194dd38cf2a07b2d3f9b4b6f81f6ef.tar.zst gsoc2013-evolution-81e5428a59194dd38cf2a07b2d3f9b4b6f81f6ef.zip |
Coding style and whitespace cleanup.
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-folder-pane.c | 117 | ||||
-rw-r--r-- | mail/e-mail-folder-pane.h | 5 | ||||
-rw-r--r-- | mail/e-mail-message-pane.c | 98 | ||||
-rw-r--r-- | mail/e-mail-message-pane.h | 7 | ||||
-rw-r--r-- | mail/e-mail-notebook-view.c | 607 | ||||
-rw-r--r-- | mail/e-mail-notebook-view.h | 105 | ||||
-rw-r--r-- | mail/e-mail-pane.c | 5 | ||||
-rw-r--r-- | mail/e-mail-pane.h | 46 | ||||
-rw-r--r-- | mail/e-mail-paned-view.c | 647 | ||||
-rw-r--r-- | mail/e-mail-paned-view.h | 92 | ||||
-rw-r--r-- | mail/e-mail-reader.c | 35 | ||||
-rw-r--r-- | mail/e-mail-reader.h | 4 | ||||
-rw-r--r-- | mail/e-mail-tab-picker.c | 24 | ||||
-rw-r--r-- | mail/e-mail-tab-picker.h | 1 | ||||
-rw-r--r-- | mail/e-mail-tab.c | 4 | ||||
-rw-r--r-- | mail/e-mail-tab.h | 2 | ||||
-rw-r--r-- | mail/e-mail-view.c | 244 | ||||
-rw-r--r-- | mail/e-mail-view.h | 120 | ||||
-rw-r--r-- | mail/em-format-html.c | 6 | ||||
-rw-r--r-- | mail/message-list.c | 28 |
20 files changed, 1122 insertions, 1075 deletions
diff --git a/mail/e-mail-folder-pane.c b/mail/e-mail-folder-pane.c index e8857ae785..3d9dfc2ea9 100644 --- a/mail/e-mail-folder-pane.c +++ b/mail/e-mail-folder-pane.c @@ -46,46 +46,24 @@ ((obj), E_TYPE_MAIL_FOLDER_PANE, EMailFolderPanePrivate)) struct _EMailFolderPanePrivate { - int fo; + gint placeholder; }; enum { PROP_0, - PROP_PREVIEW_VISIBLE, + PROP_PREVIEW_VISIBLE }; -static gpointer parent_class; - +G_DEFINE_TYPE (EMailFolderPane, e_mail_folder_pane, E_TYPE_MAIL_PANED_VIEW) static void -mail_folder_pane_dispose (GObject *object) +folder_pane_set_preview_visible (EMailView *view, + gboolean preview_visible) { - EMailFolderPanePrivate *priv; - - priv = E_MAIL_FOLDER_PANE_GET_PRIVATE (object); - - /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -static void -mail_folder_pane_constructed (GObject *object) -{ - /* Chain up to parent's constructed() method. */ - if (G_OBJECT_CLASS (parent_class)->constructed) - G_OBJECT_CLASS (parent_class)->constructed (object); - -} - -static void -folder_pane_set_preview_visible (EMailPanedView *view, - gboolean preview_visible) -{ - return; } static gboolean -folder_pane_get_preview_visible (EMailPanedView *view) +folder_pane_get_preview_visible (EMailView *view) { return FALSE; @@ -93,9 +71,9 @@ folder_pane_get_preview_visible (EMailPanedView *view) static void mail_folder_pane_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) + guint property_id, + GValue *value, + GParamSpec *pspec) { switch (property_id) { case PROP_PREVIEW_VISIBLE: @@ -104,7 +82,6 @@ mail_folder_pane_get_property (GObject *object, FALSE); return; - } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -112,9 +89,9 @@ mail_folder_pane_get_property (GObject *object, static void mail_folder_pane_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) + guint property_id, + const GValue *value, + GParamSpec *pspec) { switch (property_id) { case PROP_PREVIEW_VISIBLE: @@ -124,22 +101,22 @@ mail_folder_pane_set_property (GObject *object, G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } -static void +static guint mfp_open_selected_mail (EMailPanedView *view) { GPtrArray *uids; - int i; + gint i; GtkWindow *window; CamelFolder *folder; const gchar *folder_uri; - GPtrArray *views; - guint ii; + GPtrArray *views; + guint n_views, ii; - uids = e_mail_reader_get_selected_uids (E_MAIL_READER(view)); + uids = e_mail_reader_get_selected_uids (E_MAIL_READER(view)); window = e_mail_reader_get_window (E_MAIL_READER(view)); if (!em_utils_ask_open_many (window, uids->len)) { em_utils_uids_free (uids); - return; + return 0; } folder = e_mail_reader_get_folder (E_MAIL_READER(view)); @@ -148,7 +125,7 @@ mfp_open_selected_mail (EMailPanedView *view) em_utils_folder_is_outbox (folder, folder_uri) || em_utils_folder_is_templates (folder, folder_uri)) { em_utils_edit_messages (folder, uids, TRUE); - return; + return 0; } views = g_ptr_array_new (); @@ -190,78 +167,48 @@ mfp_open_selected_mail (EMailPanedView *view) camel_folder_free_message_info (folder, info); } - - for (i=0; i<views->len; i++) { + n_views = views->len; + for (i = 0; i < n_views; i++) g_signal_emit_by_name (view, "open-mail", views->pdata[i]); - } g_ptr_array_foreach (views, (GFunc) g_free, NULL); g_ptr_array_free (views, TRUE); em_utils_uids_free (uids); + return n_views; } static void -mail_folder_pane_class_init (EMailPanedViewClass *class) +e_mail_folder_pane_class_init (EMailFolderPaneClass *class) { GObjectClass *object_class; + EMailViewClass *mail_view_class; + EMailPanedViewClass *mail_paned_view_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EMailFolderPanePrivate)); object_class = G_OBJECT_CLASS (class); - object_class->dispose = mail_folder_pane_dispose; - object_class->constructed = mail_folder_pane_constructed; object_class->set_property = mail_folder_pane_set_property; object_class->get_property = mail_folder_pane_get_property; - class->open_selected_mail = mfp_open_selected_mail; + mail_view_class = E_MAIL_VIEW_CLASS (class); + mail_view_class->set_preview_visible = folder_pane_set_preview_visible; + mail_view_class->get_preview_visible = folder_pane_get_preview_visible; - E_MAIL_VIEW_CLASS(g_type_class_peek_parent(class))->set_preview_visible = folder_pane_set_preview_visible; - E_MAIL_VIEW_CLASS(g_type_class_peek_parent(class))->get_preview_visible = folder_pane_get_preview_visible; + mail_paned_view_class = E_MAIL_PANED_VIEW_CLASS (class); + mail_paned_view_class->open_selected_mail = mfp_open_selected_mail; g_object_class_override_property ( object_class, PROP_PREVIEW_VISIBLE, "preview-visible"); - } - static void -mail_folder_pane_init (EMailFolderPane *browser) +e_mail_folder_pane_init (EMailFolderPane *browser) { - browser->priv = E_MAIL_FOLDER_PANE_GET_PRIVATE (browser); - -} - -GType -e_mail_folder_pane_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EMailFolderPaneClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) mail_folder_pane_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EMailFolderPane), - 0, /* n_preallocs */ - (GInstanceInitFunc) mail_folder_pane_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_MAIL_PANED_VIEW_TYPE, "EMailFolderPane", &type_info, 0); - - } - - return type; } GtkWidget * @@ -271,7 +218,7 @@ e_mail_folder_pane_new (EShellContent *content) return g_object_new ( E_TYPE_MAIL_FOLDER_PANE, - "shell-content", content, + "shell-content", content, "preview-visible", FALSE, NULL); } diff --git a/mail/e-mail-folder-pane.h b/mail/e-mail-folder-pane.h index 6071ce6417..a7a84a5edb 100644 --- a/mail/e-mail-folder-pane.h +++ b/mail/e-mail-folder-pane.h @@ -22,9 +22,8 @@ #ifndef E_MAIL_FOLDER_PANE_H #define E_MAIL_FOLDER_PANE_H -#include <gtk/gtk.h> #include <shell/e-shell-content.h> -#include "mail/e-mail-paned-view.h" +#include <mail/e-mail-paned-view.h> /* Standard GObject macros */ #define E_TYPE_MAIL_FOLDER_PANE \ @@ -60,7 +59,7 @@ struct _EMailFolderPaneClass { EMailPanedViewClass parent_class; }; -GType e_mail_folder_pane_get_type (void); +GType e_mail_folder_pane_get_type (void); GtkWidget * e_mail_folder_pane_new (EShellContent *content); G_END_DECLS diff --git a/mail/e-mail-message-pane.c b/mail/e-mail-message-pane.c index 0f3488dccb..8ca6802639 100644 --- a/mail/e-mail-message-pane.c +++ b/mail/e-mail-message-pane.c @@ -28,13 +28,12 @@ #include "mail/e-mail-reader.h" -#define e_mail_message_pane_GET_PRIVATE(obj) \ +#define E_MAIL_MESSAGE_PANE_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE \ ((obj), E_TYPE_MAIL_MESSAGE_PANE, EMailMessagePanePrivate)) - struct _EMailMessagePanePrivate { - int fo; + gint placeholder; }; enum { @@ -42,20 +41,19 @@ enum { PROP_PREVIEW_VISIBLE }; -static gpointer parent_class; +G_DEFINE_TYPE (EMailMessagePane, e_mail_message_pane, E_TYPE_MAIL_PANED_VIEW) /* This is too trivial to put in a file. * It gets merged with the EMailReader UI. */ static void mail_message_pane_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) + guint property_id, + const GValue *value, + GParamSpec *pspec) { switch (property_id) { case PROP_PREVIEW_VISIBLE: return; - } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -63,80 +61,66 @@ mail_message_pane_set_property (GObject *object, static void mail_message_pane_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) + guint property_id, + GValue *value, + GParamSpec *pspec) { switch (property_id) { case PROP_PREVIEW_VISIBLE: g_value_set_boolean ( value, TRUE); - return; + return; } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } static void -mail_message_pane_dispose (GObject *object) +mail_message_pane_constructed (GObject *object) { EMailMessagePanePrivate *priv; - priv = e_mail_message_pane_GET_PRIVATE (object); - - - /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); -} + priv = E_MAIL_MESSAGE_PANE_GET_PRIVATE (object); -static void -mail_message_pane_constructed (GObject *object) -{ - EMailMessagePanePrivate *priv; - /* Chain up to parent's constructed() method. */ - if (G_OBJECT_CLASS (parent_class)->constructed) - G_OBJECT_CLASS (parent_class)->constructed (object); - - priv = e_mail_message_pane_GET_PRIVATE (object); + G_OBJECT_CLASS (e_mail_message_pane_parent_class)->constructed (object); gtk_widget_hide (e_mail_reader_get_message_list (E_MAIL_READER(object))); e_mail_paned_view_hide_message_list_pane (E_MAIL_PANED_VIEW(object), FALSE); } static void -message_pane_set_preview_visible (EMailMessagePane *view, - gboolean preview_visible) +message_pane_set_preview_visible (EMailView *view, + gboolean preview_visible) { - e_mail_paned_view_set_preview_visible (E_MAIL_PANED_VIEW(view), TRUE); - - return; + /* Chain up to parent's set_preview_visible() method. */ + E_MAIL_VIEW_CLASS (e_mail_message_pane_parent_class)-> + set_preview_visible (view, TRUE); } static gboolean -message_pane_get_preview_visible (EMailMessagePane *view) +message_pane_get_preview_visible (EMailView *view) { - return TRUE; } static void -mail_message_pane_class_init (EMailMessagePaneClass *class) +e_mail_message_pane_class_init (EMailMessagePaneClass *class) { GObjectClass *object_class; + EMailViewClass *mail_view_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EMailMessagePanePrivate)); object_class = G_OBJECT_CLASS (class); object_class->set_property = mail_message_pane_set_property; object_class->get_property = mail_message_pane_get_property; - object_class->dispose = mail_message_pane_dispose; object_class->constructed = mail_message_pane_constructed; - E_MAIL_VIEW_CLASS(g_type_class_peek_parent(class))->set_preview_visible = message_pane_set_preview_visible; - E_MAIL_VIEW_CLASS(g_type_class_peek_parent(class))->get_preview_visible = message_pane_get_preview_visible; + mail_view_class = E_MAIL_VIEW_CLASS (class); + mail_view_class->set_preview_visible = message_pane_set_preview_visible; + mail_view_class->get_preview_visible = message_pane_get_preview_visible; g_object_class_override_property ( object_class, @@ -145,37 +129,9 @@ mail_message_pane_class_init (EMailMessagePaneClass *class) } static void -mail_message_pane_init (EMailMessagePane *browser) -{ - - browser->priv = e_mail_message_pane_GET_PRIVATE (browser); -} - -GType -e_mail_message_pane_get_type (void) +e_mail_message_pane_init (EMailMessagePane *browser) { - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EMailMessagePaneClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) mail_message_pane_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EMailMessagePane), - 0, /* n_preallocs */ - (GInstanceInitFunc) mail_message_pane_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_MAIL_PANED_VIEW_TYPE , "EMailMessagePane", &type_info, 0); - - } - - return type; + browser->priv = E_MAIL_MESSAGE_PANE_GET_PRIVATE (browser); } GtkWidget * @@ -185,7 +141,7 @@ e_mail_message_pane_new (EShellContent *content) return g_object_new ( E_TYPE_MAIL_MESSAGE_PANE, - "shell-content", content, + "shell-content", content, "preview-visible", TRUE, NULL); } diff --git a/mail/e-mail-message-pane.h b/mail/e-mail-message-pane.h index ce5ea85ab5..f947f79cdf 100644 --- a/mail/e-mail-message-pane.h +++ b/mail/e-mail-message-pane.h @@ -1,5 +1,5 @@ /* - * e-mail-pane.h + * e-mail-message-pane.h * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -22,8 +22,7 @@ #ifndef E_MAIL_MESSAGE_PANE_H #define E_MAIL_MESSAGE_PANE_H -#include <gtk/gtk.h> -#include "e-mail-paned-view.h" +#include <mail/e-mail-paned-view.h> /* Standard GObject macros */ #define E_TYPE_MAIL_MESSAGE_PANE \ @@ -59,7 +58,7 @@ struct _EMailMessagePaneClass { EMailPanedViewClass parent_class; }; -GType e_mail_message_pane_get_type (void); +GType e_mail_message_pane_get_type (void); GtkWidget * e_mail_message_pane_new (EShellContent *content); G_END_DECLS diff --git a/mail/e-mail-notebook-view.c b/mail/e-mail-notebook-view.c index 5403032b79..436804de06 100644 --- a/mail/e-mail-notebook-view.c +++ b/mail/e-mail-notebook-view.c @@ -10,7 +10,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> + * License along with the program; if not, see <http://www.gnu.org/licenses/> * * * Authors: @@ -24,7 +24,6 @@ # include <config.h> #endif - #include <glib.h> #include <glib/gi18n.h> @@ -45,18 +44,22 @@ #include "e-mail-tab-picker.h" #endif +#define E_MAIL_NOTEBOOK_VIEW_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_MAIL_NOTEBOOK_VIEW, EMailNotebookViewPrivate)) + struct _EMailNotebookViewPrivate { GtkNotebook *book; EMailView *current_view; GHashTable *views; gboolean inited; -#if HAVE_CLUTTER +#if HAVE_CLUTTER EMailTabPicker *tab_picker; GtkWidget *embed; ClutterActor *actor; ClutterActor *stage; -#endif +#endif }; enum { @@ -73,43 +76,26 @@ static GType mail_notebook_view_type; #if HAVE_CLUTTER static void mnv_set_current_tab (EMailNotebookView *view, - int page) + gint page) { ClutterAnimation *animation; clutter_actor_set_opacity (view->priv->actor, 0); gtk_notebook_set_current_page (view->priv->book, page); - animation = clutter_actor_animate ((ClutterActor *)view->priv->actor, CLUTTER_EASE_IN_SINE, 500, - "opacity", 255, - NULL); + animation = clutter_actor_animate ( + (ClutterActor *)view->priv->actor, + CLUTTER_EASE_IN_SINE, 500, "opacity", 255, NULL); } #endif -static void -mail_notebook_view_init (EMailNotebookView *shell) -{ - shell->priv = g_new0(EMailNotebookViewPrivate, 1); - - shell->priv->inited = FALSE; - shell->priv->views = g_hash_table_new (g_str_hash, g_str_equal); -} - -static void -e_mail_notebook_view_finalize (GObject *object) -{ - /* EMailNotebookView *shell = (EMailNotebookView *)object; */ - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static int +static gint emnv_get_page_num (EMailNotebookView *view, GtkWidget *widget) { EMailNotebookViewPrivate *priv = view->priv; - int i, n; - + gint i, n; + n = gtk_notebook_get_n_pages (priv->book); for (i=0; i<n; i++) { @@ -130,7 +116,7 @@ mnv_page_changed (GtkNotebook *book, GtkWidget *page, EShellView *shell_view = e_shell_content_get_shell_view (content); EShellSidebar *sidebar = e_shell_view_get_shell_sidebar (shell_view); EMFolderTree *tree; - const char *uri = e_mail_reader_get_folder_uri (E_MAIL_READER(mview)); + const gchar *uri = e_mail_reader_get_folder_uri (E_MAIL_READER(mview)); g_object_get (sidebar, "folder-tree", &tree, NULL); if (uri && E_IS_MAIL_FOLDER_PANE (mview)) @@ -144,7 +130,7 @@ mnv_page_changed (GtkNotebook *book, GtkWidget *page, /* For EMailReader related changes to EShellView*/ g_signal_emit_by_name (view, "changed"); g_signal_emit_by_name (view, "folder-loaded"); - + /* For EMailShellContent related changes */ g_signal_emit_by_name (view, "view-changed"); @@ -155,7 +141,7 @@ static void fix_tab_picker_width (GtkWidget *widget, GtkAllocation *allocation, ClutterActor *actor) { ClutterActor *stage = g_object_get_data ((GObject *)actor, "stage"); - + clutter_actor_set_size (actor, allocation->width-1, -1); clutter_actor_set_size (stage, allocation->width-1, -1); } @@ -167,9 +153,9 @@ fix_height_cb (ClutterActor *actor, { GtkWidget *embed = (GtkWidget *)g_object_get_data ((GObject *)actor, "embed"); ClutterActor *stage = g_object_get_data ((GObject *)actor, "stage"); - + clutter_actor_set_height (stage, clutter_actor_get_height(actor)); - gtk_widget_set_size_request (embed, -1, (int) clutter_actor_get_height(actor)); + gtk_widget_set_size_request (embed, -1, (gint) clutter_actor_get_height(actor)); } static void @@ -207,9 +193,9 @@ tab_picker_preview_mode_notify (EMailTabPicker *picker, /* Show all pages so that the preview clones work correctly */ clutter_actor_set_opacity (preview, 255); clutter_actor_show (preview); - } else { - clutter_actor_hide (preview); - } + } else { + clutter_actor_hide (preview); + } } g_list_free (tabs); } @@ -219,7 +205,7 @@ mnv_tab_anim_frame_cb (ClutterTimeline *timeline, gint frame_num, EMailTab *tab) { - if (!clutter_actor_get_parent (CLUTTER_ACTOR (tab))) { + if (!clutter_actor_get_parent (CLUTTER_ACTOR (tab))) { clutter_timeline_stop (timeline); g_object_unref (timeline); g_object_unref (tab); @@ -250,10 +236,10 @@ mnv_tab_closed_cb (ClutterTimeline *timeline, struct _tab_data *data) { EMailView *page = g_object_get_data ((GObject *)data->tab, "page"); - const char *folder_uri = e_mail_reader_get_folder_uri (E_MAIL_READER(page)); + const gchar *folder_uri = e_mail_reader_get_folder_uri (E_MAIL_READER(page)); EMailView *prev; - int num; - + gint num; + if (E_IS_MAIL_FOLDER_PANE (page)) g_hash_table_remove (data->view->priv->views, folder_uri); prev = page->prev; @@ -263,8 +249,8 @@ mnv_tab_closed_cb (ClutterTimeline *timeline, e_mail_tab_picker_set_current_tab (data->view->priv->tab_picker, num); } - e_mail_tab_picker_remove_tab (data->view->priv->tab_picker, data->tab); - gtk_notebook_remove_page (data->view->priv->book, + e_mail_tab_picker_remove_tab (data->view->priv->tab_picker, data->tab); + gtk_notebook_remove_page (data->view->priv->book, gtk_notebook_page_num (data->view->priv->book, (GtkWidget *)page)); } @@ -273,7 +259,7 @@ static void mnv_tab_closed (EMailTab *tab, EMailNotebookView *view) { EMailNotebookViewPrivate *priv = view->priv; - int page, cur; + gint page, cur; gboolean select = FALSE; ClutterTimeline *timeline; struct _tab_data *data = g_new0 (struct _tab_data, 1); @@ -293,14 +279,15 @@ mnv_tab_closed (EMailTab *tab, EMailNotebookView *view) data->view = view; clutter_actor_set_reactive (CLUTTER_ACTOR (tab), FALSE); - timeline = clutter_timeline_new (150); + timeline = clutter_timeline_new (150); clutter_timeline_set_direction (timeline, CLUTTER_TIMELINE_BACKWARD); - g_signal_connect (timeline, "new-frame", - G_CALLBACK (mnv_tab_anim_frame_cb), tab); - g_signal_connect (timeline, "completed", - G_CALLBACK (mnv_tab_closed_cb), data); - clutter_timeline_start (timeline); - + g_signal_connect ( + timeline, "new-frame", + G_CALLBACK (mnv_tab_anim_frame_cb), tab); + g_signal_connect ( + timeline, "completed", + G_CALLBACK (mnv_tab_closed_cb), data); + clutter_timeline_start (timeline); } static void @@ -309,7 +296,7 @@ tab_activated_cb (EMailTabPicker *picker, EMailNotebookView *view) { EMailView *page = g_object_get_data ((GObject *)tab, "page"); - int num = emnv_get_page_num (view, (GtkWidget *)page); + gint num = emnv_get_page_num (view, (GtkWidget *)page); mnv_set_current_tab (view, num); } @@ -320,10 +307,10 @@ tab_remove_gtk_cb (GtkWidget *button, EMailNotebookView *view) { EMailView *page = g_object_get_data ((GObject *)button, "page"); - const char *folder_uri = e_mail_reader_get_folder_uri (E_MAIL_READER(page)); + const gchar *folder_uri = e_mail_reader_get_folder_uri (E_MAIL_READER(page)); EMailView *prev; - int num; - + gint num; + if (gtk_notebook_get_n_pages(view->priv->book) == 1) return; @@ -335,15 +322,15 @@ tab_remove_gtk_cb (GtkWidget *button, num = emnv_get_page_num (view, (GtkWidget *)prev); gtk_notebook_set_current_page (view->priv->book, num); } - gtk_notebook_remove_page (view->priv->book, + gtk_notebook_remove_page (view->priv->book, gtk_notebook_page_num (view->priv->book, (GtkWidget *)page)); - + } static GtkWidget * -create_tab_label (EMailNotebookView *view, +create_tab_label (EMailNotebookView *view, EMailView *page, - const char *str) + const gchar *str) { GtkWidget *container, *widget; @@ -378,7 +365,7 @@ create_gtk_actor (GtkWidget *vbox) bin = gtk_clutter_actor_get_widget (GTK_CLUTTER_ACTOR (gtk_actor)); gtk_container_add (GTK_CONTAINER (bin), vbox); - + gtk_widget_show (bin); gtk_widget_show(vbox); return gtk_actor; @@ -407,7 +394,7 @@ create_under_clutter (GtkWidget *widget, GtkWidget *paned) clutter_actor_show (actor); stage = gtk_clutter_embed_get_stage ((GtkClutterEmbed *)embed); clutter_container_add_actor ((ClutterContainer *)stage, actor); - + g_object_set_data ((GObject *)actor, "embed", embed); g_object_set_data ((GObject *)actor, "stage", stage); g_object_set_data ((GObject *)actor, "widget", widget); @@ -416,7 +403,7 @@ create_under_clutter (GtkWidget *widget, GtkWidget *paned) g_signal_connect (paned, "size-allocate", G_CALLBACK(fix_clutter_embed_width), actor); clutter_actor_show(stage); - + return embed; } @@ -437,7 +424,7 @@ mail_notebook_view_constructed (GObject *object) container = GTK_WIDGET(object); -#if HAVE_CLUTTER +#if HAVE_CLUTTER widget = gtk_clutter_embed_new (); gtk_widget_show (widget); gtk_box_pack_start (GTK_BOX(container), widget, FALSE, FALSE, 0); @@ -448,29 +435,34 @@ mail_notebook_view_constructed (GObject *object) priv->tab_picker = (EMailTabPicker *)e_mail_tab_picker_new (); clutter_actor_show ((ClutterActor *)priv->tab_picker); - g_signal_connect (priv->tab_picker, "tab-activated", - G_CALLBACK (tab_activated_cb), object); - g_signal_connect (priv->tab_picker, "chooser-clicked", - G_CALLBACK (chooser_clicked_cb), object); - g_signal_connect (priv->tab_picker, "notify::preview-mode", - G_CALLBACK (tab_picker_preview_mode_notify), object); - g_signal_connect (priv->tab_picker, "notify::height", - G_CALLBACK(fix_height_cb), widget); + g_signal_connect ( + priv->tab_picker, "tab-activated", + G_CALLBACK (tab_activated_cb), object); + g_signal_connect ( + priv->tab_picker, "chooser-clicked", + G_CALLBACK (chooser_clicked_cb), object); + g_signal_connect ( + priv->tab_picker, "notify::preview-mode", + G_CALLBACK (tab_picker_preview_mode_notify), object); + g_signal_connect ( + priv->tab_picker, "notify::height", + G_CALLBACK(fix_height_cb), widget); clutter_container_add_actor ((ClutterContainer *)stage, (ClutterActor *)priv->tab_picker); g_object_set_data ((GObject *)priv->tab_picker, "embed", widget); g_object_set_data ((GObject *)priv->tab_picker, "stage", stage); - g_signal_connect (object, "size-allocate", - G_CALLBACK(fix_tab_picker_width), priv->tab_picker); + g_signal_connect ( + object, "size-allocate", + G_CALLBACK(fix_tab_picker_width), priv->tab_picker); clutter_actor_set_height (stage, clutter_actor_get_height((ClutterActor *)priv->tab_picker)); - gtk_widget_set_size_request (widget, -1, (int) clutter_actor_get_height((ClutterActor *)priv->tab_picker)); + gtk_widget_set_size_request (widget, -1, (gint) clutter_actor_get_height((ClutterActor *)priv->tab_picker)); tab = (EMailTab *) e_mail_tab_new_full ("", NULL, 1); clone = e_mail_tab_new_full ("", NULL, 200); - + e_mail_tab_set_can_close ((EMailTab *)clone, FALSE); clutter_actor_set_reactive (clone, FALSE); clutter_actor_show (clone); @@ -484,14 +476,14 @@ mail_notebook_view_constructed (GObject *object) e_mail_tab_picker_set_current_tab (priv->tab_picker, 0); g_object_ref (tab); - timeline = clutter_timeline_new (150); - g_signal_connect (timeline, "new-frame", - G_CALLBACK (mnv_tab_anim_frame_cb), tab); - g_signal_connect (timeline, "completed", - G_CALLBACK (mnv_tab_anim_complete_cb), tab); + timeline = clutter_timeline_new (150); + g_signal_connect ( + timeline, "new-frame", + G_CALLBACK (mnv_tab_anim_frame_cb), tab); + g_signal_connect ( + timeline, "completed", + G_CALLBACK (mnv_tab_anim_complete_cb), tab); clutter_timeline_start (timeline); -#else - #endif widget = gtk_notebook_new (); @@ -502,29 +494,29 @@ mail_notebook_view_constructed (GObject *object) gtk_box_pack_start (GTK_BOX (container), priv->embed, TRUE, TRUE, 0); priv->actor = g_object_get_data((GObject *)priv->embed, "actor"); priv->stage = g_object_get_data((GObject *)priv->actor, "stage"); -#else +#else gtk_box_pack_start (GTK_BOX(container), widget, TRUE, TRUE, 0); #endif #if HAVE_CLUTTER gtk_notebook_set_show_tabs ((GtkNotebook *)widget, FALSE); -#else +#else gtk_notebook_set_scrollable ((GtkNotebook *)widget, TRUE); #endif gtk_notebook_set_show_border ((GtkNotebook *)widget, FALSE); - g_signal_connect (widget, "switch-page", + g_signal_connect (widget, "switch-page", G_CALLBACK(mnv_page_changed), object); priv->current_view = (EMailView *)e_mail_folder_pane_new (E_MAIL_VIEW(object)->content); - e_mail_paned_view_set_preview_visible ((EMailPanedView *)priv->current_view, FALSE); + e_mail_view_set_preview_visible (priv->current_view, FALSE); gtk_widget_show ((GtkWidget *)priv->current_view); - gtk_notebook_append_page (priv->book, (GtkWidget *)priv->current_view, + gtk_notebook_append_page (priv->book, (GtkWidget *)priv->current_view, create_tab_label (E_MAIL_NOTEBOOK_VIEW(object), priv->current_view, _("Please select a folder"))); - + } static void @@ -563,28 +555,155 @@ mail_notebook_view_get_property (GObject *object, G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } +static EShellSearchbar * +mail_notebook_view_get_searchbar (EMailView *view) +{ + EShellView *shell_view; + EShellContent *shell_content; + GtkWidget *widget; + + g_return_val_if_fail ( + E_IS_MAIL_NOTEBOOK_VIEW (view), NULL); + + shell_content = E_MAIL_VIEW (view)->content; + shell_view = e_shell_content_get_shell_view (shell_content); + widget = e_shell_view_get_searchbar (shell_view); + + return E_SHELL_SEARCHBAR (widget); +/* + if (!E_MAIL_NOTEBOOK_VIEW(view)->priv->current_view) + return NULL; + return e_mail_view_get_searchbar (E_MAIL_NOTEBOOK_VIEW(view)->priv->current_view); */ +} + static void -mail_notebook_view_class_init (EMailViewClass *klass) +mail_notebook_view_set_search_strings (EMailView *view, + GSList *search_strings) { - GObjectClass * object_class = G_OBJECT_CLASS (klass); + e_mail_view_set_search_strings (E_MAIL_NOTEBOOK_VIEW (view)->priv->current_view, search_strings); +} - parent_class = g_type_class_peek_parent (klass); +static GalViewInstance * +mail_notebook_view_get_view_instance (EMailView *view) +{ + if (!E_MAIL_NOTEBOOK_VIEW(view)->priv->current_view) + return NULL; + + return e_mail_view_get_view_instance (E_MAIL_NOTEBOOK_VIEW (view)->priv->current_view); +} + +static void +mail_notebook_view_update_view_instance (EMailView *view) +{ + e_mail_view_update_view_instance (E_MAIL_NOTEBOOK_VIEW (view)->priv->current_view); +} + +static void +mail_notebook_view_set_orientation (EMailView *view, + GtkOrientation orientation) +{ + EMailNotebookViewPrivate *priv; + + priv = E_MAIL_NOTEBOOK_VIEW_GET_PRIVATE (view); + + if (!priv->current_view) + return; + + e_mail_view_set_orientation (priv->current_view, orientation); +} + +static GtkOrientation +mail_notebook_view_get_orientation (EMailView *view) +{ + EMailNotebookViewPrivate *priv; + + priv = E_MAIL_NOTEBOOK_VIEW_GET_PRIVATE (view); + + if (!priv->current_view) + return GTK_ORIENTATION_VERTICAL; + + return e_mail_view_get_orientation (priv->current_view); +} + +static void +mail_notebook_view_set_show_deleted (EMailView *view, + gboolean show_deleted) +{ + EMailNotebookViewPrivate *priv; + + priv = E_MAIL_NOTEBOOK_VIEW_GET_PRIVATE (view); + + if (!priv->current_view) + return; + + e_mail_view_set_show_deleted (priv->current_view, show_deleted); +} + +static gboolean +mail_notebook_view_get_show_deleted (EMailView *view) +{ + EMailNotebookViewPrivate *priv; + + priv = E_MAIL_NOTEBOOK_VIEW_GET_PRIVATE (view); + + if (!priv->current_view) + return FALSE; + + return e_mail_view_get_show_deleted (priv->current_view); +} + +static void +mail_notebook_view_set_preview_visible (EMailView *view, + gboolean preview_visible) +{ + EMailNotebookViewPrivate *priv; + + priv = E_MAIL_NOTEBOOK_VIEW_GET_PRIVATE (view); + + if (!priv->current_view) + return; + + e_mail_view_set_preview_visible (priv->current_view, preview_visible); +} + +static gboolean +mail_notebook_view_get_preview_visible (EMailView *view) +{ + EMailNotebookViewPrivate *priv; + + priv = E_MAIL_NOTEBOOK_VIEW_GET_PRIVATE (view); + + if (!priv->current_view) + return FALSE; + + return e_mail_view_get_preview_visible (priv->current_view); +} + +static void +mail_notebook_view_class_init (EMailNotebookViewClass *class) +{ + GObjectClass *object_class; + EMailViewClass *mail_view_class; + + parent_class = g_type_class_peek_parent (class); + g_type_class_add_private (class, sizeof (EMailNotebookViewPrivate)); + + object_class = G_OBJECT_CLASS (class); object_class->constructed = mail_notebook_view_constructed; object_class->set_property = mail_notebook_view_set_property; object_class->get_property = mail_notebook_view_get_property; - - object_class->finalize = e_mail_notebook_view_finalize; - - klass->get_searchbar = e_mail_notebook_view_get_searchbar; - klass->set_search_strings = e_mail_notebook_view_set_search_strings; - klass->get_view_instance = e_mail_notebook_view_get_view_instance; - klass->update_view_instance = e_mail_notebook_view_update_view_instance; - klass->set_orientation = e_mail_notebook_view_set_orientation; - klass->get_orientation = e_mail_notebook_view_get_orientation; - klass->set_show_deleted = e_mail_notebook_view_set_show_deleted; - klass->get_show_deleted = e_mail_notebook_view_get_show_deleted; - klass->set_preview_visible = e_mail_notebook_view_set_preview_visible; - klass->get_preview_visible = e_mail_notebook_view_get_preview_visible; + + mail_view_class = E_MAIL_VIEW_CLASS (class); + mail_view_class->get_searchbar = mail_notebook_view_get_searchbar; + mail_view_class->set_search_strings = mail_notebook_view_set_search_strings; + mail_view_class->get_view_instance = mail_notebook_view_get_view_instance; + mail_view_class->update_view_instance = mail_notebook_view_update_view_instance; + mail_view_class->set_orientation = mail_notebook_view_set_orientation; + mail_view_class->get_orientation = mail_notebook_view_get_orientation; + mail_view_class->set_show_deleted = mail_notebook_view_set_show_deleted; + mail_view_class->get_show_deleted = mail_notebook_view_get_show_deleted; + mail_view_class->set_preview_visible = mail_notebook_view_set_preview_visible; + mail_view_class->get_preview_visible = mail_notebook_view_get_preview_visible; /* Inherited from EMailReader */ g_object_class_override_property ( @@ -613,7 +732,16 @@ mail_notebook_view_class_init (EMailViewClass *klass) G_PARAM_READWRITE)); g_object_class_override_property ( - object_class, PROP_ORIENTATION, "orientation"); */ + object_class, PROP_ORIENTATION, "orientation"); */ +} + +static void +mail_notebook_view_init (EMailNotebookView *view) +{ + view->priv = E_MAIL_NOTEBOOK_VIEW_GET_PRIVATE (view); + + view->priv->inited = FALSE; + view->priv->views = g_hash_table_new (g_str_hash, g_str_equal); } GtkWidget * @@ -622,14 +750,13 @@ e_mail_notebook_view_new (EShellContent *content) g_return_val_if_fail (E_IS_SHELL_CONTENT (content), NULL); return g_object_new ( - E_MAIL_NOTEBOOK_VIEW_TYPE, + E_TYPE_MAIL_NOTEBOOK_VIEW, "shell-content", content, NULL); } static GtkActionGroup * mail_notebook_view_get_action_group (EMailReader *reader) { - EMailNotebookViewPrivate *priv = E_MAIL_NOTEBOOK_VIEW (reader)->priv; EShellContent *shell_content; EShellWindow *shell_window; EShellView *shell_view; @@ -638,19 +765,14 @@ mail_notebook_view_get_action_group (EMailReader *reader) shell_view = e_shell_content_get_shell_view (shell_content); shell_window = e_shell_view_get_shell_window (shell_view); - return E_SHELL_WINDOW_ACTION_GROUP_MAIL (shell_window); -/* - if (!priv->current_view) - return NULL; - - return e_mail_reader_get_action_group (E_MAIL_READER(priv->current_view));*/ + return E_SHELL_WINDOW_ACTION_GROUP_MAIL (shell_window); } static EMFormatHTML * mail_notebook_view_get_formatter (EMailReader *reader) { EMailNotebookViewPrivate *priv = E_MAIL_NOTEBOOK_VIEW (reader)->priv; - + if (!priv->current_view) return NULL; @@ -661,7 +783,7 @@ static gboolean mail_notebook_view_get_hide_deleted (EMailReader *reader) { EMailNotebookViewPrivate *priv = E_MAIL_NOTEBOOK_VIEW (reader)->priv; - + if (!priv->current_view) return FALSE; @@ -672,22 +794,22 @@ static GtkWidget * mail_notebook_view_get_message_list (EMailReader *reader) { EMailNotebookViewPrivate *priv = E_MAIL_NOTEBOOK_VIEW (reader)->priv; - + if (!priv->current_view) return NULL; - return e_mail_reader_get_message_list (E_MAIL_READER(priv->current_view)); + return e_mail_reader_get_message_list (E_MAIL_READER(priv->current_view)); } static GtkMenu * mail_notebook_view_get_popup_menu (EMailReader *reader) { EMailNotebookViewPrivate *priv = E_MAIL_NOTEBOOK_VIEW (reader)->priv; - + if (!priv->current_view) return NULL; - return e_mail_reader_get_popup_menu (E_MAIL_READER(priv->current_view)); + return e_mail_reader_get_popup_menu (E_MAIL_READER(priv->current_view)); } static EShellBackend * @@ -729,16 +851,16 @@ reconnect_folder_loaded_event (EMailReader *child, EMailReader *parent) } static void -mail_netbook_view_open_mail (EMailView *view, const char *uid, EMailNotebookView *nview) +mail_netbook_view_open_mail (EMailView *view, const gchar *uid, EMailNotebookView *nview) { const gchar *folder_uri; - CamelFolder *folder; + CamelFolder *folder; GtkWidget *pane; - int page; + gint page; EMailNotebookViewPrivate *priv = E_MAIL_NOTEBOOK_VIEW (nview)->priv; CamelMessageInfo *info; GtkWidget *preview; - int pos; + gint pos; #if HAVE_CLUTTER EMailTab *tab; @@ -746,17 +868,17 @@ mail_netbook_view_open_mail (EMailView *view, const char *uid, EMailNotebookView ClutterTimeline *timeline; GtkWidget *mlist; - e_mail_tab_set_active (e_mail_tab_picker_get_tab (priv->tab_picker, + e_mail_tab_set_active (e_mail_tab_picker_get_tab (priv->tab_picker, e_mail_tab_picker_get_current_tab (priv->tab_picker)), FALSE); -#endif +#endif pos = emnv_get_page_num (nview, (GtkWidget *)priv->current_view); pane = e_mail_message_pane_new (E_MAIL_VIEW(nview)->content); E_MAIL_VIEW(pane)->prev = priv->current_view; priv->current_view = (EMailView *)pane; - + gtk_widget_show (pane); - + preview = e_mail_paned_view_get_preview (E_MAIL_PANED_VIEW(pane)); folder = e_mail_reader_get_folder (E_MAIL_READER(view)); @@ -764,62 +886,64 @@ mail_netbook_view_open_mail (EMailView *view, const char *uid, EMailNotebookView info = camel_folder_get_message_info (folder, uid); - page = gtk_notebook_insert_page (priv->book, pane, + page = gtk_notebook_insert_page (priv->book, pane, create_tab_label (nview, priv->current_view, - camel_message_info_subject(info)), + camel_message_info_subject(info)), pos+1); #if HAVE_CLUTTER mlist = e_mail_reader_get_message_list (E_MAIL_READER(pane)); mnv_set_current_tab (nview, page); - g_object_set_data ((GObject *)priv->current_view, "stage", priv->stage); - g_object_set_data ((GObject *)mlist, "stage", priv->stage); - g_object_set_data ((GObject *)mlist, "preview-actor", priv->actor); -#else + g_object_set_data ((GObject *)priv->current_view, "stage", priv->stage); + g_object_set_data ((GObject *)mlist, "stage", priv->stage); + g_object_set_data ((GObject *)mlist, "preview-actor", priv->actor); +#else gtk_notebook_set_current_page (priv->book, page); #endif -#if HAVE_CLUTTER +#if HAVE_CLUTTER tab = (EMailTab *)e_mail_tab_new_full (camel_message_info_subject(info), NULL, 1); g_object_set_data ((GObject *)tab, "page", pane); clutter_actor_show((ClutterActor *)tab); clone = e_mail_tab_new_full (camel_message_info_subject(info), NULL, 200); - clutter_actor_set_reactive (clone, FALSE); + clutter_actor_set_reactive (clone, FALSE); clutter_actor_show (clone); e_mail_tab_set_preview_actor (tab, clone); e_mail_tab_set_can_close (tab, TRUE); e_mail_tab_enable_drag (tab, TRUE); e_mail_tab_picker_add_tab (priv->tab_picker, tab, pos+1); - + page = e_mail_tab_picker_get_tab_no (priv->tab_picker, tab); e_mail_tab_picker_set_current_tab (priv->tab_picker, page); - g_signal_connect (tab , "closed", + g_signal_connect (tab , "closed", G_CALLBACK (mnv_tab_closed), nview); g_object_ref (tab); timeline = clutter_timeline_new (150); - g_signal_connect (timeline, "new-frame", - G_CALLBACK (mnv_tab_anim_frame_cb), tab); - g_signal_connect (timeline, "completed", - G_CALLBACK (mnv_tab_anim_complete_cb), tab); + g_signal_connect ( + timeline, "new-frame", + G_CALLBACK (mnv_tab_anim_frame_cb), tab); + g_signal_connect ( + timeline, "completed", + G_CALLBACK (mnv_tab_anim_complete_cb), tab); clutter_timeline_start (timeline); #endif - g_signal_connect ( E_MAIL_READER(pane), "changed", - G_CALLBACK (reconnect_changed_event), - nview); - g_signal_connect ( E_MAIL_READER (pane), "folder-loaded", - G_CALLBACK (reconnect_folder_loaded_event), - nview); + g_signal_connect ( + E_MAIL_READER(pane), "changed", + G_CALLBACK (reconnect_changed_event), nview); + g_signal_connect ( + E_MAIL_READER (pane), "folder-loaded", + G_CALLBACK (reconnect_folder_loaded_event), nview); e_mail_reader_set_folder ( E_MAIL_READER (pane), folder, folder_uri); e_mail_reader_set_group_by_threads ( E_MAIL_READER (pane), - e_mail_reader_get_group_by_threads (E_MAIL_READER(view))); + e_mail_reader_get_group_by_threads (E_MAIL_READER(view))); e_mail_reader_set_message (E_MAIL_READER (pane), uid); camel_message_info_free (info); @@ -832,7 +956,7 @@ mail_notebook_view_set_folder (EMailReader *reader, { EMailNotebookViewPrivate *priv = E_MAIL_NOTEBOOK_VIEW (reader)->priv; GtkWidget *new_view; -#if HAVE_CLUTTER +#if HAVE_CLUTTER EMailTab *tab; ClutterActor *clone; ClutterTimeline *timeline; @@ -843,35 +967,35 @@ mail_notebook_view_set_folder (EMailReader *reader, new_view = g_hash_table_lookup (priv->views, folder_uri); if (new_view) { - int curr = emnv_get_page_num (E_MAIL_NOTEBOOK_VIEW (reader), new_view); -#if HAVE_CLUTTER + gint curr = emnv_get_page_num (E_MAIL_NOTEBOOK_VIEW (reader), new_view); +#if HAVE_CLUTTER EMailTab *tab; if (curr == e_mail_tab_picker_get_current_tab (priv->tab_picker)) return; - e_mail_tab_set_active (e_mail_tab_picker_get_tab (priv->tab_picker, + e_mail_tab_set_active (e_mail_tab_picker_get_tab (priv->tab_picker, e_mail_tab_picker_get_current_tab (priv->tab_picker)), FALSE); #endif priv->current_view = (EMailView *)new_view; -#if HAVE_CLUTTER +#if HAVE_CLUTTER mnv_set_current_tab (E_MAIL_NOTEBOOK_VIEW(reader), curr); #else gtk_notebook_set_current_page (priv->book, curr); #endif -#if HAVE_CLUTTER +#if HAVE_CLUTTER tab = (EMailTab *)g_object_get_data ((GObject *)priv->current_view, "page"); curr = e_mail_tab_picker_get_tab_no (priv->tab_picker, tab); e_mail_tab_picker_set_current_tab (priv->tab_picker, curr); -#endif +#endif return; } if (folder || folder_uri) { - int page; + gint page; GtkWidget *list; if (priv->inited) { @@ -880,21 +1004,26 @@ mail_notebook_view_set_folder (EMailReader *reader, priv->current_view = (EMailView *)e_mail_folder_pane_new (E_MAIL_VIEW(reader)->content); gtk_widget_show ((GtkWidget *)priv->current_view); priv->current_view->prev = old_view; - page = gtk_notebook_append_page (priv->book, (GtkWidget *)priv->current_view, - create_tab_label (E_MAIL_NOTEBOOK_VIEW(reader), - priv->current_view, - camel_folder_get_full_name (folder))); -#if HAVE_CLUTTER + page = gtk_notebook_append_page ( + priv->book, (GtkWidget *)priv->current_view, + create_tab_label ( + E_MAIL_NOTEBOOK_VIEW (reader), + priv->current_view, + camel_folder_get_full_name (folder))); +#if HAVE_CLUTTER mnv_set_current_tab (E_MAIL_NOTEBOOK_VIEW(reader), page); #else - gtk_notebook_set_current_page (priv->book, page); + gtk_notebook_set_current_page (priv->book, page); #endif #if HAVE_CLUTTER - e_mail_tab_set_active (e_mail_tab_picker_get_tab (priv->tab_picker, - e_mail_tab_picker_get_current_tab (priv->tab_picker)), - FALSE); - + e_mail_tab_set_active ( + e_mail_tab_picker_get_tab ( + priv->tab_picker, + e_mail_tab_picker_get_current_tab ( + priv->tab_picker)), + FALSE); + tab = (EMailTab *)e_mail_tab_new_full (camel_folder_get_full_name(folder), NULL, 1); g_object_set_data ((GObject *)tab, "page", priv->current_view); g_object_set_data ((GObject *)priv->current_view, "page", tab); @@ -914,22 +1043,24 @@ mail_notebook_view_set_folder (EMailReader *reader, e_mail_tab_picker_set_current_tab (priv->tab_picker, page); g_object_ref (tab); - timeline = clutter_timeline_new (150); - g_signal_connect (timeline, "new-frame", - G_CALLBACK (mnv_tab_anim_frame_cb), tab); - g_signal_connect (timeline, "completed", - G_CALLBACK (mnv_tab_anim_complete_cb), tab); - clutter_timeline_start (timeline); -#endif + timeline = clutter_timeline_new (150); + g_signal_connect ( + timeline, "new-frame", + G_CALLBACK (mnv_tab_anim_frame_cb), tab); + g_signal_connect ( + timeline, "completed", + G_CALLBACK (mnv_tab_anim_complete_cb), tab); + clutter_timeline_start (timeline); +#endif } else { priv->inited = TRUE; - gtk_notebook_set_tab_label (priv->book, (GtkWidget *)priv->current_view, + gtk_notebook_set_tab_label (priv->book, (GtkWidget *)priv->current_view, create_tab_label (E_MAIL_NOTEBOOK_VIEW(reader), - priv->current_view, + priv->current_view, camel_folder_get_full_name (folder))); -#if HAVE_CLUTTER - tab = e_mail_tab_picker_get_tab(priv->tab_picker, +#if HAVE_CLUTTER + tab = e_mail_tab_picker_get_tab(priv->tab_picker, e_mail_tab_picker_get_current_tab (priv->tab_picker)); g_object_set_data ((GObject *)tab, "page", priv->current_view); g_object_set_data ((GObject *)priv->current_view, "page", tab); @@ -937,18 +1068,18 @@ mail_notebook_view_set_folder (EMailReader *reader, e_mail_tab_set_text (tab, camel_folder_get_full_name(folder)); clone = e_mail_tab_get_preview_actor (tab); e_mail_tab_set_text ((EMailTab *)clone, camel_folder_get_full_name(folder)); -#endif +#endif } - + list = e_mail_reader_get_message_list (E_MAIL_READER(priv->current_view)); -#if HAVE_CLUTTER - g_signal_connect (tab , "closed", +#if HAVE_CLUTTER + g_signal_connect (tab , "closed", G_CALLBACK (mnv_tab_closed), reader); - g_object_set_data ((GObject *)priv->current_view, "stage", priv->stage); - g_object_set_data ((GObject *)list, "stage", priv->stage); - g_object_set_data ((GObject *)list, "actor", priv->actor); - -#endif + g_object_set_data ((GObject *)priv->current_view, "stage", priv->stage); + g_object_set_data ((GObject *)list, "stage", priv->stage); + g_object_set_data ((GObject *)list, "actor", priv->actor); + +#endif e_mail_reader_set_folder (E_MAIL_READER(priv->current_view), folder, folder_uri); g_hash_table_insert (priv->views, g_strdup(folder_uri), priv->current_view); g_signal_connect ( E_MAIL_READER(priv->current_view), "changed", @@ -966,62 +1097,19 @@ static void mail_notebook_view_show_search_bar (EMailReader *reader) { EMailNotebookViewPrivate *priv = E_MAIL_NOTEBOOK_VIEW (reader)->priv; - - e_mail_reader_show_search_bar (E_MAIL_READER(priv->current_view)); -} - -EShellSearchbar * -e_mail_notebook_view_get_searchbar (EMailView *view) -{ - EShellView *shell_view; - EShellContent *shell_content; - GtkWidget *widget; - - g_return_val_if_fail ( - E_IS_MAIL_NOTEBOOK_VIEW (view), NULL); - shell_content = E_MAIL_VIEW (view)->content; - shell_view = e_shell_content_get_shell_view (shell_content); - widget = e_shell_view_get_searchbar (shell_view); - - return E_SHELL_SEARCHBAR (widget); -/* - if (!E_MAIL_NOTEBOOK_VIEW(view)->priv->current_view) - return NULL; - return e_mail_view_get_searchbar (E_MAIL_NOTEBOOK_VIEW(view)->priv->current_view); */ + e_mail_reader_show_search_bar (E_MAIL_READER(priv->current_view)); } -static void +static guint mail_notebook_view_open_selected_mail (EMailReader *reader) { EMailNotebookViewPrivate *priv = E_MAIL_NOTEBOOK_VIEW (reader)->priv; - - if (!priv->current_view) - return ; - - return e_mail_reader_open_selected_mail (E_MAIL_READER(priv->current_view)); -} - -void -e_mail_notebook_view_set_search_strings (EMailView *view, - GSList *search_strings) -{ - e_mail_view_set_search_strings (E_MAIL_NOTEBOOK_VIEW (view)->priv->current_view, search_strings); -} - -GalViewInstance * -e_mail_notebook_view_get_view_instance (EMailView *view) -{ - if (!E_MAIL_NOTEBOOK_VIEW(view)->priv->current_view) - return NULL; - return e_mail_view_get_view_instance (E_MAIL_NOTEBOOK_VIEW (view)->priv->current_view); -} + if (!priv->current_view) + return 0; -void -e_mail_notebook_view_update_view_instance (EMailView *view) -{ - e_mail_view_update_view_instance (E_MAIL_NOTEBOOK_VIEW (view)->priv->current_view); + return e_mail_reader_open_selected_mail (E_MAIL_READER(priv->current_view)); } static void @@ -1068,7 +1156,7 @@ e_mail_notebook_view_register_type (GTypeModule *type_module) }; mail_notebook_view_type = g_type_module_register_type ( - type_module, E_MAIL_VIEW_TYPE, + type_module, E_TYPE_MAIL_VIEW, "EMailNotebookView", &type_info, 0); g_type_module_add_interface ( @@ -1076,54 +1164,3 @@ e_mail_notebook_view_register_type (GTypeModule *type_module) E_TYPE_MAIL_READER, &reader_info); } -void -e_mail_notebook_view_set_show_deleted (EMailNotebookView *view, - gboolean show_deleted) -{ - if (!view->priv->current_view) - return; - - e_mail_view_set_show_deleted (view->priv->current_view, show_deleted); -} -gboolean -e_mail_notebook_view_get_show_deleted (EMailNotebookView *view) -{ - if (!view->priv->current_view) - return FALSE; - - return e_mail_view_get_show_deleted (view->priv->current_view); -} -void -e_mail_notebook_view_set_preview_visible (EMailNotebookView *view, - gboolean preview_visible) -{ - if (!view->priv->current_view) - return ; - - e_mail_view_set_preview_visible (view->priv->current_view, preview_visible); -} -gboolean -e_mail_notebook_view_get_preview_visible (EMailNotebookView *view) -{ - if (!view->priv->current_view) - return FALSE; - - return e_mail_view_get_preview_visible (view->priv->current_view); -} -void -e_mail_notebook_view_set_orientation (EMailNotebookView *view, - GtkOrientation orientation) -{ - if (!view->priv->current_view) - return; - - e_mail_view_set_orientation (view->priv->current_view, orientation); -} -GtkOrientation -e_mail_notebook_view_get_orientation (EMailNotebookView *view) -{ - if (!view->priv->current_view) - return GTK_ORIENTATION_VERTICAL; - - return e_mail_view_get_orientation (view->priv->current_view); -} diff --git a/mail/e-mail-notebook-view.h b/mail/e-mail-notebook-view.h index 957737653b..cdc341ec4a 100644 --- a/mail/e-mail-notebook-view.h +++ b/mail/e-mail-notebook-view.h @@ -10,7 +10,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> + * License along with the program; if not, see <http://www.gnu.org/licenses/> * * * Authors: @@ -20,59 +20,78 @@ * */ -#ifndef _E_MAIL_NOTEBOOK_VIEW_H_ -#define _E_MAIL_NOTEBOOK_VIEW_H_ +#ifndef E_MAIL_NOTEBOOK_VIEW_H +#define E_MAIL_NOTEBOOK_VIEW_H -#include <gtk/gtk.h> -#include "e-mail-view.h" +#include <mail/e-mail-view.h> #include <shell/e-shell-searchbar.h> -#include "widgets/menus/gal-view-instance.h" +#include <menus/gal-view-instance.h> -#define E_MAIL_NOTEBOOK_VIEW_TYPE (e_mail_notebook_view_get_type ()) -#define E_MAIL_NOTEBOOK_VIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_MAIL_NOTEBOOK_VIEW_TYPE, EMailNotebookView)) -#define E_MAIL_NOTEBOOK_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_MAIL_NOTEBOOK_VIEW_TYPE, EMailNotebookViewClass)) -#define E_IS_MAIL_NOTEBOOK_VIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_MAIL_NOTEBOOK_VIEW_TYPE)) -#define E_IS_MAIL_NOTEBOOK_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_MAIL_NOTEBOOK_VIEW_TYPE)) -#define E_MAIL_NOTEBOOK_VIEW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_MAIL_NOTEBOOK_VIEW_TYPE, EMailNotebookViewClass)) +/* Standard GObject macros */ +#define E_TYPE_MAIL_NOTEBOOK_VIEW \ + (e_mail_notebook_view_get_type ()) +#define E_MAIL_NOTEBOOK_VIEW(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_MAIL_NOTEBOOK_VIEW, EMailNotebookView)) +#define E_MAIL_NOTEBOOK_VIEW_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_MAIL_NOTEBOOK_VIEW, EMailNotebookViewClass)) +#define E_IS_MAIL_NOTEBOOK_VIEW(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_MAIL_NOTEBOOK_VIEW)) +#define E_IS_MAIL_NOTEBOOK_VIEW_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_MAIL_NOTEBOOK_VIEW)) +#define E_MAIL_NOTEBOOK_VIEW_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_MAIL_NOTEBOOK_VIEW, EMailNotebookViewClass)) +G_BEGIN_DECLS +typedef struct _EMailNotebookView EMailNotebookView; +typedef struct _EMailNotebookViewClass EMailNotebookViewClass; typedef struct _EMailNotebookViewPrivate EMailNotebookViewPrivate; -typedef struct _EMailNotebookView { +struct _EMailNotebookView { EMailView parent; - EMailNotebookViewPrivate *priv; -} EMailNotebookView; +}; -typedef struct _EMailNotebookViewClass { +struct _EMailNotebookViewClass { EMailViewClass parent_class; +}; -} EMailNotebookViewClass; - -GType e_mail_notebook_view_get_type (void); -void e_mail_notebook_view_register_type (GTypeModule *type_module); -GtkWidget * e_mail_notebook_view_new (EShellContent *content); - -EShellSearchbar * e_mail_notebook_view_get_searchbar (EMailView *view); -void e_mail_notebook_view_set_search_strings (EMailView *view, GSList *search_strings); -GalViewInstance * e_mail_notebook_view_get_view_instance (EMailView *view); -void e_mail_notebook_view_update_view_instance (EMailView *view); - -void -e_mail_notebook_view_set_show_deleted (EMailNotebookView *view, - gboolean show_deleted); -gboolean -e_mail_notebook_view_get_show_deleted (EMailNotebookView *view); +GType e_mail_notebook_view_get_type (void); +void e_mail_notebook_view_register_type + (GTypeModule *type_module); +GtkWidget * e_mail_notebook_view_new (EShellContent *content); +EShellSearchbar * + e_mail_notebook_view_get_searchbar + (EMailNotebookView *view); +void e_mail_notebook_view_set_search_strings + (EMailNotebookView *view, + GSList *search_strings); +GalViewInstance * + e_mail_notebook_view_get_view_instance + (EMailNotebookView *view); +void e_mail_notebook_view_update_view_instance + (EMailNotebookView *view); +void e_mail_notebook_view_set_show_deleted + (EMailNotebookView *view, + gboolean show_deleted); +gboolean e_mail_notebook_view_get_show_deleted + (EMailNotebookView *view); +void e_mail_notebook_view_set_preview_visible + (EMailNotebookView *view, + gboolean preview_visible); +gboolean e_mail_notebook_view_get_preview_visible + (EMailNotebookView *view); +void e_mail_notebook_view_set_orientation + (EMailNotebookView *view, + GtkOrientation orientation); +GtkOrientation e_mail_notebook_view_get_orientation + (EMailNotebookView *view); -void -e_mail_notebook_view_set_preview_visible (EMailNotebookView *view, - gboolean preview_visible); -gboolean -e_mail_notebook_view_get_preview_visible (EMailNotebookView *view); -void -e_mail_notebook_view_set_orientation (EMailNotebookView *view, - GtkOrientation orientation); -GtkOrientation -e_mail_notebook_view_get_orientation (EMailNotebookView *view); +G_END_DECLS -#endif +#endif /* E_MAIL_NOTEBOOK_VIEW_H */ diff --git a/mail/e-mail-pane.c b/mail/e-mail-pane.c index 879a90bce1..e58a645eec 100644 --- a/mail/e-mail-pane.c +++ b/mail/e-mail-pane.c @@ -10,7 +10,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> + * License along with the program; if not, see <http://www.gnu.org/licenses/> * * * Authors: @@ -24,12 +24,10 @@ # include <config.h> #endif - #include <glib.h> #include <glib/gi18n.h> #include "e-mail-pane.h" - G_DEFINE_TYPE (EMailPane, e_mail_pane, GTK_TYPE_VBOX) enum { @@ -72,4 +70,3 @@ e_mail_pane_class_init (EMailPaneClass *klass) } - diff --git a/mail/e-mail-pane.h b/mail/e-mail-pane.h index f8383d2b76..2e20dd772d 100644 --- a/mail/e-mail-pane.h +++ b/mail/e-mail-pane.h @@ -1,4 +1,6 @@ /* + * e-mail-pane.h + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either @@ -10,7 +12,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> + * License along with the program; if not, see <http://www.gnu.org/licenses/> * * * Authors: @@ -20,30 +22,44 @@ * */ -#ifndef _E_MAIL_PANE_H_ -#define _E_MAIL_PANE_H_ +#ifndef E_MAIL_PANE_H +#define E_MAIL_PANE_H #include <gtk/gtk.h> -#define E_MAIL_PANE_TYPE (e_mail_pane_get_type ()) -#define E_MAIL_PANE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_MAIL_PANE_TYPE, MailFolderView)) -#define E_MAIL_PANE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_MAIL_PANE_TYPE, MailFolderViewClass)) -#define IS_E_MAIL_PANE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_MAIL_PANE_TYPE)) -#define IS_E_MAIL_PANE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_MAIL_PANE_TYPE)) -#define E_MAIL_PANE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_MAIL_PANE_TYPE, EMailPaneClass)) +#define E_TYPE_MAIL_PANE \ + (e_mail_pane_get_type ()) +#define E_MAIL_PANE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_MAIL_PANE, MailFolderView)) +#define E_MAIL_PANE_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_MAIL_PANE, MailFolderViewClass)) +#define E_IS_MAIL_PANE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_MAIL_PANE)) +#define E_IS_MAIL_PANE_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_MAIL_PANE)) +#define E_MAIL_PANE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_MAIL_PANE, EMailPaneClass)) +G_BEGIN_DECLS +typedef struct _EMailPane EMailPane; +typedef struct _EMailPaneClass EMailPaneClass; typedef struct _EMailPanePrivate EMailPanePrivate; -typedef struct _EMailPane { +struct _EMailPane { GtkVBox parent; - EMailPanePrivate *priv; -} EMailPane; +}; -typedef struct _EMailPaneClass { +struct _EMailPaneClass { GtkVBoxClass parent_class; +}; -} EMailPaneClass; +G_END_DECLS -#endif +#endif /* E_MAIL_PANE_H */ diff --git a/mail/e-mail-paned-view.c b/mail/e-mail-paned-view.c index 6733e40182..cf13ac5514 100644 --- a/mail/e-mail-paned-view.c +++ b/mail/e-mail-paned-view.c @@ -10,7 +10,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> + * License along with the program; if not, see <http://www.gnu.org/licenses/> * * * Authors: @@ -24,7 +24,6 @@ # include <config.h> #endif - #include <glib.h> #include <glib/gi18n.h> #include "e-mail-paned-view.h" @@ -48,6 +47,10 @@ #include "message-list.h" #include "e-mail-reader-utils.h" +#define E_MAIL_PANED_VIEW_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_MAIL_PANED_VIEW, EMailPanedViewPrivate)) + #define E_SHELL_WINDOW_ACTION_GROUP_MAIL(window) \ E_SHELL_WINDOW_ACTION_GROUP ((window), "mail") @@ -86,14 +89,13 @@ enum { #define STATE_KEY_SELECTED_MESSAGE "SelectedMessage" #define STATE_KEY_PREVIEW_VISIBLE "PreviewVisible" - static EMailViewClass *parent_class; static GType mail_paned_view_type; static void mail_paned_view_save_boolean (EMailPanedView *view, - const gchar *key, - gboolean value) + const gchar *key, + gboolean value) { EShellView *shell_view; EShellContent *shell_content; @@ -121,7 +123,7 @@ mail_paned_view_save_boolean (EMailPanedView *view, static void mail_paned_view_message_list_built_cb (EMailPanedView *view, - MessageList *message_list) + MessageList *message_list) { EMailPanedViewPrivate *priv = view->priv; EShellView *shell_view; @@ -169,8 +171,8 @@ mail_paned_view_message_list_built_cb (EMailPanedView *view, static void mail_paned_view_message_selected_cb (EMailPanedView *view, - const gchar *message_uid, - MessageList *message_list) + const gchar *message_uid, + MessageList *message_list) { EShellContent *shell_content; EShellView *shell_view; @@ -206,8 +208,8 @@ mail_paned_view_message_selected_cb (EMailPanedView *view, static void mail_paned_view_restore_state_cb (EShellWindow *shell_window, - EShellView *shell_view, - EMailPanedView *view) + EShellView *shell_view, + EMailPanedView *view) { EMailPanedViewPrivate *priv; GConfBridge *bridge; @@ -230,6 +232,22 @@ mail_paned_view_restore_state_cb (EShellWindow *shell_window, } static void +mail_paned_display_view_cb (EMailView *view, + GalView *gal_view) +{ + EMailReader *reader; + GtkWidget *message_list; + + reader = E_MAIL_READER (view); + message_list = e_mail_reader_get_message_list (reader); + + if (GAL_IS_VIEW_ETABLE (gal_view)) + gal_view_etable_attach_tree ( + GAL_VIEW_ETABLE (gal_view), + E_TREE (message_list)); +} + +static void mail_paned_view_notify_group_by_threads_cb (EMailReader *reader) { gboolean group_by_threads; @@ -241,28 +259,11 @@ mail_paned_view_notify_group_by_threads_cb (EMailReader *reader) STATE_KEY_GROUP_BY_THREADS, group_by_threads); } -GtkOrientation -e_mail_paned_view_get_orientation (EMailPanedView *view) -{ - return view->priv->orientation; -} - -void -e_mail_paned_view_set_orientation (EMailPanedView *view, - GtkOrientation orientation) -{ - view->priv->orientation = orientation; - - g_object_notify (G_OBJECT (view), "orientation"); - - e_mail_paned_view_update_view_instance (view); -} - static void mail_paned_view_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) + guint property_id, + const GValue *value, + GParamSpec *pspec) { switch (property_id) { case PROP_GROUP_BY_THREADS: @@ -272,20 +273,20 @@ mail_paned_view_set_property (GObject *object, return; case PROP_ORIENTATION: - e_mail_paned_view_set_orientation ( - E_MAIL_PANED_VIEW (object), + e_mail_view_set_orientation ( + E_MAIL_VIEW (object), g_value_get_enum (value)); return; case PROP_PREVIEW_VISIBLE: - e_mail_paned_view_set_preview_visible ( - E_MAIL_PANED_VIEW (object), + e_mail_view_set_preview_visible ( + E_MAIL_VIEW (object), g_value_get_boolean (value)); return; case PROP_SHOW_DELETED: - e_mail_paned_view_set_show_deleted ( - E_MAIL_PANED_VIEW (object), + e_mail_view_set_show_deleted ( + E_MAIL_VIEW (object), g_value_get_boolean (value)); return; } @@ -295,9 +296,9 @@ mail_paned_view_set_property (GObject *object, static void mail_paned_view_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) + guint property_id, + GValue *value, + GParamSpec *pspec) { switch (property_id) { case PROP_GROUP_BY_THREADS: @@ -310,22 +311,22 @@ mail_paned_view_get_property (GObject *object, case PROP_ORIENTATION: g_value_set_enum ( value, - e_mail_paned_view_get_orientation ( - E_MAIL_PANED_VIEW (object))); + e_mail_view_get_orientation ( + E_MAIL_VIEW (object))); return; case PROP_PREVIEW_VISIBLE: g_value_set_boolean ( value, - e_mail_paned_view_get_preview_visible ( - E_MAIL_PANED_VIEW (object))); + e_mail_view_get_preview_visible ( + E_MAIL_VIEW (object))); return; case PROP_SHOW_DELETED: g_value_set_boolean ( value, - e_mail_paned_view_get_show_deleted ( - E_MAIL_PANED_VIEW (object))); + e_mail_view_get_show_deleted ( + E_MAIL_VIEW (object))); return; } @@ -337,7 +338,7 @@ mail_paned_view_dispose (GObject *object) { EMailPanedViewPrivate *priv; - priv = E_MAIL_PANED_VIEW(object)->priv; + priv = E_MAIL_PANED_VIEW (object)->priv; if (priv->paned != NULL) { g_object_unref (priv->paned); @@ -400,7 +401,7 @@ mail_paned_view_get_formatter (EMailReader *reader) static gboolean mail_paned_view_get_hide_deleted (EMailReader *reader) { - return !e_mail_paned_view_get_show_deleted (E_MAIL_PANED_VIEW(reader)); + return !e_mail_view_get_show_deleted (E_MAIL_VIEW (reader)); } static GtkWidget * @@ -539,8 +540,7 @@ mail_paned_view_set_folder (EMailReader *reader, value = FALSE; } - e_mail_paned_view_set_preview_visible ( - E_MAIL_PANED_VIEW (reader), value); + e_mail_view_set_preview_visible (E_MAIL_VIEW (reader), value); g_free (group_name); @@ -558,14 +558,14 @@ mail_paned_view_show_search_bar (EMailReader *reader) gtk_widget_show (priv->search_bar); } -static void -mail_paned_view_open_selected_mail (EMailReader *reader) +static guint +mail_paned_view_reader_open_selected_mail (EMailReader *reader) { EMailPanedViewPrivate *priv; priv = E_MAIL_PANED_VIEW (reader)->priv; - E_MAIL_PANED_VIEW_CLASS(G_OBJECT_GET_CLASS (reader))->open_selected_mail (E_MAIL_PANED_VIEW(reader)); + return E_MAIL_PANED_VIEW_CLASS (G_OBJECT_GET_CLASS (reader))->open_selected_mail (E_MAIL_PANED_VIEW (reader)); } static void @@ -586,10 +586,6 @@ mail_paned_view_constructed (GObject *object) priv = E_MAIL_PANED_VIEW (object)->priv; priv->formatter = em_format_html_display_new (); - /* Chain up to parent's constructed() method. */ - if (G_OBJECT_CLASS (parent_class)->constructed) - G_OBJECT_CLASS (parent_class)->constructed (object); - shell_content = E_MAIL_VIEW (object)->content; shell_view = e_shell_content_get_shell_view (shell_content); shell_window = e_shell_view_get_shell_window (shell_view); @@ -648,12 +644,11 @@ mail_paned_view_constructed (GObject *object) /* Load the view instance. */ - e_mail_paned_view_update_view_instance ( - E_MAIL_PANED_VIEW (object)); + e_mail_view_update_view_instance (E_MAIL_VIEW (object)); /* Message list customizations. */ - e_mail_reader_init_private (E_MAIL_READER(object)); + e_mail_reader_init_private (E_MAIL_READER (object)); reader = E_MAIL_READER (object); message_list = e_mail_reader_get_message_list (reader); @@ -673,253 +668,31 @@ mail_paned_view_constructed (GObject *object) e_mail_reader_connect_headers (reader); } -static void -mpv_open_selected_mail (EMailPanedView *view) -{ - e_mail_reader_open_selected (E_MAIL_READER(view)); -} - -static void -mail_paned_view_init (EMailPanedView *shell) -{ - shell->priv = g_new0(EMailPanedViewPrivate, 1); - - shell->priv->preview_visible = TRUE; - - g_signal_connect ( - shell, "notify::group-by-threads", - G_CALLBACK (mail_paned_view_notify_group_by_threads_cb), - NULL); - -} - -static void -mail_paned_view_class_init (EMailViewClass *klass) -{ - GObjectClass * object_class = G_OBJECT_CLASS (klass); - - parent_class = g_type_class_peek_parent (klass); - object_class->dispose = mail_paned_view_dispose; - object_class->constructed = mail_paned_view_constructed; - object_class->set_property = mail_paned_view_set_property; - object_class->get_property = mail_paned_view_get_property; - - klass->get_searchbar = e_mail_paned_view_get_searchbar; - klass->set_search_strings = e_mail_paned_view_set_search_strings; - klass->get_view_instance = e_mail_paned_view_get_view_instance; - klass->update_view_instance = e_mail_paned_view_update_view_instance; - - klass->set_orientation = e_mail_paned_view_set_orientation; - klass->get_orientation = e_mail_paned_view_get_orientation; - klass->set_show_deleted = e_mail_paned_view_set_show_deleted; - klass->get_show_deleted = e_mail_paned_view_get_show_deleted; - klass->set_preview_visible = e_mail_paned_view_set_preview_visible; - klass->get_preview_visible = e_mail_paned_view_get_preview_visible; - - E_MAIL_PANED_VIEW_CLASS(klass)->open_selected_mail = mpv_open_selected_mail; - - /* Inherited from EMailReader */ - g_object_class_override_property ( - object_class, - PROP_GROUP_BY_THREADS, - "group-by-threads"); - - g_object_class_install_property ( - object_class, - PROP_PREVIEW_VISIBLE, - g_param_spec_boolean ( - "preview-visible", - "Preview is Visible", - "Whether the preview pane is visible", - TRUE, - G_PARAM_READWRITE)); - - g_object_class_install_property ( - object_class, - PROP_SHOW_DELETED, - g_param_spec_boolean ( - "show-deleted", - "Show Deleted", - NULL, - FALSE, - G_PARAM_READWRITE)); - - g_object_class_override_property ( - object_class, PROP_ORIENTATION, "orientation"); -} - -static void -mail_paned_view_reader_init (EMailReaderIface *iface) -{ - iface->get_action_group = mail_paned_view_get_action_group; - iface->get_formatter = mail_paned_view_get_formatter; - iface->get_hide_deleted = mail_paned_view_get_hide_deleted; - iface->get_message_list = mail_paned_view_get_message_list; - iface->get_popup_menu = mail_paned_view_get_popup_menu; - iface->get_shell_backend = mail_paned_view_get_shell_backend; - iface->get_window = mail_paned_view_get_window; - iface->set_folder = mail_paned_view_set_folder; - iface->show_search_bar = mail_paned_view_show_search_bar; - iface->open_selected_mail = mail_paned_view_open_selected_mail; -} - -GType -e_mail_paned_view_get_type (void) -{ - return mail_paned_view_type; -} - -void -e_mail_paned_view_register_type (GTypeModule *type_module) -{ - static const GTypeInfo type_info = { - sizeof (EMailPanedViewClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) mail_paned_view_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EMailPanedView), - 0, /* n_preallocs */ - (GInstanceInitFunc) mail_paned_view_init, - NULL /* value_table */ - }; -#if 0 - static const GInterfaceInfo orientable_info = { - (GInterfaceInitFunc) NULL, - (GInterfaceFinalizeFunc) NULL, - NULL /* interface_data */ - }; -#endif - static const GInterfaceInfo reader_info = { - (GInterfaceInitFunc) mail_paned_view_reader_init, - (GInterfaceFinalizeFunc) NULL, - NULL /* interface_data */ - }; - - mail_paned_view_type = g_type_module_register_type ( - type_module, E_MAIL_VIEW_TYPE, - "EMailPanedView", &type_info, 0); -#if 0 - g_type_module_add_interface ( - type_module, mail_paned_view_type, - GTK_TYPE_ORIENTABLE, &orientable_info); -#endif - g_type_module_add_interface ( - type_module, mail_paned_view_type, - E_TYPE_MAIL_READER, &reader_info); -} - - -GtkWidget * -e_mail_paned_view_new (EShellContent *content) -{ - g_return_val_if_fail (E_IS_SHELL_CONTENT (content), NULL); - - return g_object_new ( - E_MAIL_PANED_VIEW_TYPE, - "shell-content", content, NULL); -} - -gboolean -e_mail_paned_view_get_preview_visible (EMailPanedView *view) -{ - g_return_val_if_fail ( - E_IS_MAIL_PANED_VIEW (view), FALSE); - - return view->priv->preview_visible; -} - -void -e_mail_paned_view_set_preview_visible (EMailPanedView *view, - gboolean preview_visible) -{ - g_return_if_fail (E_IS_MAIL_PANED_VIEW (view)); - - if (preview_visible == view->priv->preview_visible) - return; - - /* If we're showing the preview, tell EMailReader to reload the - * selected message. This should force it to download the full - * message if necessary, so we don't get an empty preview. */ - if (preview_visible) { - EMailReader *reader; - GtkWidget *message_list; - const gchar *cursor_uid; - - reader = E_MAIL_READER (view); - message_list = e_mail_reader_get_message_list (reader); - cursor_uid = MESSAGE_LIST (message_list)->cursor_uid; - - if (cursor_uid != NULL) - e_mail_reader_set_message (reader, cursor_uid); - } - - view->priv->preview_visible = preview_visible; - - mail_paned_view_save_boolean ( - view, - STATE_KEY_PREVIEW_VISIBLE, preview_visible); - - g_object_notify (G_OBJECT (view), "preview-visible"); -} - -EShellSearchbar * -e_mail_paned_view_get_searchbar (EMailPanedView *view) +static EShellSearchbar * +mail_paned_view_get_searchbar (EMailView *view) { EShellView *shell_view; EShellContent *shell_content; GtkWidget *widget; - g_return_val_if_fail ( - E_IS_MAIL_PANED_VIEW (view), NULL); - - shell_content = E_MAIL_VIEW (view)->content; + shell_content = view->content; shell_view = e_shell_content_get_shell_view (shell_content); widget = e_shell_view_get_searchbar (shell_view); return E_SHELL_SEARCHBAR (widget); } -gboolean -e_mail_paned_view_get_show_deleted (EMailPanedView *view) -{ - g_return_val_if_fail ( - E_IS_MAIL_PANED_VIEW (view), FALSE); - - return view->priv->show_deleted; -} - -void -e_mail_paned_view_set_show_deleted (EMailPanedView *view, - gboolean show_deleted) -{ - g_return_if_fail (E_IS_MAIL_PANED_VIEW (view)); - - view->priv->show_deleted = show_deleted; - - g_object_notify (G_OBJECT (view), "show-deleted"); -} - -GalViewInstance * -e_mail_paned_view_get_view_instance (EMailPanedView *view) -{ - g_return_val_if_fail ( - E_IS_MAIL_PANED_VIEW (view), NULL); - - return view->priv->view_instance; -} - -void -e_mail_paned_view_set_search_strings (EMailPanedView *view, - GSList *search_strings) +static void +mail_paned_view_set_search_strings (EMailView *view, + GSList *search_strings) { + EMailPanedViewPrivate *priv; ESearchBar *search_bar; ESearchingTokenizer *tokenizer; - g_return_if_fail (E_IS_MAIL_PANED_VIEW (view)); + priv = E_MAIL_PANED_VIEW_GET_PRIVATE (view); - search_bar = E_SEARCH_BAR (view->priv->search_bar); + search_bar = E_SEARCH_BAR (priv->search_bar); tokenizer = e_search_bar_get_tokenizer (search_bar); e_searching_tokenizer_set_secondary_case_sensitivity (tokenizer, FALSE); @@ -934,25 +707,20 @@ e_mail_paned_view_set_search_strings (EMailPanedView *view, e_search_bar_changed (search_bar); } -static void -mail_paned_display_view_cb (EMailPanedView *view, - GalView *gal_view) +static GalViewInstance * +mail_paned_view_get_view_instance (EMailView *view) { - EMailReader *reader; - GtkWidget *message_list; + EMailPanedViewPrivate *priv; - reader = E_MAIL_READER (view); - message_list = e_mail_reader_get_message_list (reader); + priv = E_MAIL_PANED_VIEW_GET_PRIVATE (view); - if (GAL_IS_VIEW_ETABLE (gal_view)) - gal_view_etable_attach_tree ( - GAL_VIEW_ETABLE (gal_view), - E_TREE (message_list)); + return priv->view_instance; } -void -e_mail_paned_view_update_view_instance (EMailPanedView *view) +static void +mail_paned_view_update_view_instance (EMailView *view) { + EMailPanedViewPrivate *priv; EMailReader *reader; EShell *shell; EShellContent *shell_content; @@ -970,7 +738,9 @@ e_mail_paned_view_update_view_instance (EMailPanedView *view) const gchar *folder_uri; gchar *view_id; - shell_content = E_MAIL_VIEW(view)->content; + priv = E_MAIL_PANED_VIEW_GET_PRIVATE (view); + + shell_content = view->content; shell_view = e_shell_content_get_shell_view (shell_content); shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view); view_collection = shell_view_class->view_collection; @@ -990,9 +760,9 @@ e_mail_paned_view_update_view_instance (EMailPanedView *view) /* If we have a folder, we should also have a URI. */ g_return_if_fail (folder_uri != NULL); - if (view->priv->view_instance != NULL) { - g_object_unref (view->priv->view_instance); - view->priv->view_instance = NULL; + if (priv->view_instance != NULL) { + g_object_unref (priv->view_instance); + priv->view_instance = NULL; } view_id = mail_config_folder_to_safe_url (folder); @@ -1001,7 +771,7 @@ e_mail_paned_view_update_view_instance (EMailPanedView *view) else view_instance = e_shell_view_new_view_instance (shell_view, view_id); - view->priv->view_instance = view_instance; + priv->view_instance = view_instance; orientable = GTK_ORIENTABLE (view); orientation = gtk_orientable_get_orientation (orientable); @@ -1096,29 +866,274 @@ e_mail_paned_view_update_view_instance (EMailPanedView *view) g_signal_connect_swapped ( view_instance, "display-view", - G_CALLBACK (mail_paned_display_view_cb), - view); + G_CALLBACK (mail_paned_display_view_cb), view); mail_paned_display_view_cb ( - view, - gal_view_instance_get_current_view (view_instance)); + view, gal_view_instance_get_current_view (view_instance)); +} + +static void +mail_paned_view_set_orientation (EMailView *view, + GtkOrientation orientation) +{ + EMailPanedViewPrivate *priv; + + priv = E_MAIL_PANED_VIEW_GET_PRIVATE (view); + + priv->orientation = orientation; + + g_object_notify (G_OBJECT (view), "orientation"); + + e_mail_view_update_view_instance (view); +} + +static GtkOrientation +mail_paned_view_get_orientation (EMailView *view) +{ + EMailPanedViewPrivate *priv; + + priv = E_MAIL_PANED_VIEW_GET_PRIVATE (view); + + return priv->orientation; +} + +static void +mail_paned_view_set_show_deleted (EMailView *view, + gboolean show_deleted) +{ + EMailPanedViewPrivate *priv; + + priv = E_MAIL_PANED_VIEW_GET_PRIVATE (view); + + priv->show_deleted = show_deleted; + + g_object_notify (G_OBJECT (view), "show-deleted"); +} + +static gboolean +mail_paned_view_get_show_deleted (EMailView *view) +{ + EMailPanedViewPrivate *priv; + + priv = E_MAIL_PANED_VIEW_GET_PRIVATE (view); + + return priv->show_deleted; +} + +static void +mail_paned_view_set_preview_visible (EMailView *view, + gboolean preview_visible) +{ + EMailPanedViewPrivate *priv; + + priv = E_MAIL_PANED_VIEW_GET_PRIVATE (view); + + if (preview_visible == priv->preview_visible) + return; + + /* If we're showing the preview, tell EMailReader to reload the + * selected message. This should force it to download the full + * message if necessary, so we don't get an empty preview. */ + if (preview_visible) { + EMailReader *reader; + GtkWidget *message_list; + const gchar *cursor_uid; + + reader = E_MAIL_READER (view); + message_list = e_mail_reader_get_message_list (reader); + cursor_uid = MESSAGE_LIST (message_list)->cursor_uid; + + if (cursor_uid != NULL) + e_mail_reader_set_message (reader, cursor_uid); + } + + priv->preview_visible = preview_visible; + + mail_paned_view_save_boolean ( + E_MAIL_PANED_VIEW (view), + STATE_KEY_PREVIEW_VISIBLE, preview_visible); + + g_object_notify (G_OBJECT (view), "preview-visible"); +} + +static gboolean +mail_paned_view_get_preview_visible (EMailView *view) +{ + EMailPanedViewPrivate *priv; + + priv = E_MAIL_PANED_VIEW_GET_PRIVATE (view); + + return priv->preview_visible; +} + +static guint +mail_paned_view_open_selected_mail (EMailPanedView *view) +{ + return e_mail_reader_open_selected (E_MAIL_READER (view)); +} + +static void +mail_paned_view_class_init (EMailPanedViewClass *class) +{ + GObjectClass *object_class; + EMailViewClass *mail_view_class; + + parent_class = g_type_class_peek_parent (class); + g_type_class_add_private (class, sizeof (EMailPanedViewPrivate)); + + object_class = G_OBJECT_CLASS (class); + object_class->dispose = mail_paned_view_dispose; + object_class->constructed = mail_paned_view_constructed; + object_class->set_property = mail_paned_view_set_property; + object_class->get_property = mail_paned_view_get_property; + + mail_view_class = E_MAIL_VIEW_CLASS (class); + mail_view_class->get_searchbar = mail_paned_view_get_searchbar; + mail_view_class->set_search_strings = mail_paned_view_set_search_strings; + mail_view_class->get_view_instance = mail_paned_view_get_view_instance; + mail_view_class->update_view_instance = mail_paned_view_update_view_instance; + + mail_view_class->set_orientation = mail_paned_view_set_orientation; + mail_view_class->get_orientation = mail_paned_view_get_orientation; + mail_view_class->set_show_deleted = mail_paned_view_set_show_deleted; + mail_view_class->get_show_deleted = mail_paned_view_get_show_deleted; + mail_view_class->set_preview_visible = mail_paned_view_set_preview_visible; + mail_view_class->get_preview_visible = mail_paned_view_get_preview_visible; + + class->open_selected_mail = mail_paned_view_open_selected_mail; + + /* Inherited from EMailReader */ + g_object_class_override_property ( + object_class, + PROP_GROUP_BY_THREADS, + "group-by-threads"); + + g_object_class_install_property ( + object_class, + PROP_PREVIEW_VISIBLE, + g_param_spec_boolean ( + "preview-visible", + "Preview is Visible", + "Whether the preview pane is visible", + TRUE, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_SHOW_DELETED, + g_param_spec_boolean ( + "show-deleted", + "Show Deleted", + NULL, + FALSE, + G_PARAM_READWRITE)); + + g_object_class_override_property ( + object_class, PROP_ORIENTATION, "orientation"); +} + +static void +mail_paned_view_reader_init (EMailReaderIface *iface) +{ + iface->get_action_group = mail_paned_view_get_action_group; + iface->get_formatter = mail_paned_view_get_formatter; + iface->get_hide_deleted = mail_paned_view_get_hide_deleted; + iface->get_message_list = mail_paned_view_get_message_list; + iface->get_popup_menu = mail_paned_view_get_popup_menu; + iface->get_shell_backend = mail_paned_view_get_shell_backend; + iface->get_window = mail_paned_view_get_window; + iface->set_folder = mail_paned_view_set_folder; + iface->show_search_bar = mail_paned_view_show_search_bar; + iface->open_selected_mail = mail_paned_view_reader_open_selected_mail; +} + +static void +mail_paned_view_init (EMailPanedView *view) +{ + view->priv = E_MAIL_PANED_VIEW_GET_PRIVATE (view); + + view->priv->preview_visible = TRUE; + + g_signal_connect ( + view, "notify::group-by-threads", + G_CALLBACK (mail_paned_view_notify_group_by_threads_cb), + NULL); +} + +GType +e_mail_paned_view_get_type (void) +{ + return mail_paned_view_type; +} + +void +e_mail_paned_view_register_type (GTypeModule *type_module) +{ + static const GTypeInfo type_info = { + sizeof (EMailPanedViewClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) mail_paned_view_class_init, + (GClassFinalizeFunc) NULL, + NULL, /* class_data */ + sizeof (EMailPanedView), + 0, /* n_preallocs */ + (GInstanceInitFunc) mail_paned_view_init, + NULL /* value_table */ + }; +#if 0 + static const GInterfaceInfo orientable_info = { + (GInterfaceInitFunc) NULL, + (GInterfaceFinalizeFunc) NULL, + NULL /* interface_data */ + }; +#endif + static const GInterfaceInfo reader_info = { + (GInterfaceInitFunc) mail_paned_view_reader_init, + (GInterfaceFinalizeFunc) NULL, + NULL /* interface_data */ + }; + + mail_paned_view_type = g_type_module_register_type ( + type_module, E_TYPE_MAIL_VIEW, + "EMailPanedView", &type_info, 0); +#if 0 + g_type_module_add_interface ( + type_module, mail_paned_view_type, + GTK_TYPE_ORIENTABLE, &orientable_info); +#endif + g_type_module_add_interface ( + type_module, mail_paned_view_type, + E_TYPE_MAIL_READER, &reader_info); +} + +GtkWidget * +e_mail_paned_view_new (EShellContent *content) +{ + g_return_val_if_fail (E_IS_SHELL_CONTENT (content), NULL); + + return g_object_new ( + E_TYPE_MAIL_PANED_VIEW, + "shell-content", content, NULL); } void e_mail_paned_view_hide_message_list_pane (EMailPanedView *view, - gboolean visible) + gboolean visible) { - EMailPanedViewPrivate *priv = view->priv; + g_return_if_fail (E_IS_MAIL_PANED_VIEW (view)); if (visible) - gtk_widget_show (priv->scrolled_window); + gtk_widget_show (view->priv->scrolled_window); else - gtk_widget_hide (priv->scrolled_window); + gtk_widget_hide (view->priv->scrolled_window); } GtkWidget * e_mail_paned_view_get_preview (EMailPanedView *view) { + g_return_val_if_fail (E_IS_MAIL_PANED_VIEW (view), NULL); + return view->priv->preview; } diff --git a/mail/e-mail-paned-view.h b/mail/e-mail-paned-view.h index 8cb5a0e561..09d2299a4f 100644 --- a/mail/e-mail-paned-view.h +++ b/mail/e-mail-paned-view.h @@ -10,7 +10,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> + * License along with the program; if not, see <http://www.gnu.org/licenses/> * * * Authors: @@ -20,11 +20,10 @@ * */ -#ifndef _E_MAIL_PANED_VIEW_H_ -#define _E_MAIL_PANED_VIEW_H_ +#ifndef E_MAIL_PANED_VIEW_H +#define E_MAIL_PANED_VIEW_H -#include <gtk/gtk.h> -#include "e-mail-view.h" +#include <mail/e-mail-view.h> #include <shell/e-shell-content.h> #include <shell/e-shell-searchbar.h> @@ -32,63 +31,50 @@ #include <mail/em-format-html-display.h> -#define E_MAIL_PANED_VIEW_TYPE (e_mail_paned_view_get_type ()) -#define E_MAIL_PANED_VIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_MAIL_PANED_VIEW_TYPE, EMailPanedView)) -#define E_MAIL_PANED_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_MAIL_PANED_VIEW_TYPE, EMailPanedViewClass)) -#define E_IS_MAIL_PANED_VIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_MAIL_PANED_VIEW_TYPE)) -#define E_IS_MAIL_PANED_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_MAIL_PANED_VIEW_TYPE)) -#define E_MAIL_PANED_VIEW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_MAIL_PANED_VIEW_TYPE, EMailPanedViewClass)) +/* Standard GObject macros */ +#define E_TYPE_MAIL_PANED_VIEW \ + (e_mail_paned_view_get_type ()) +#define E_MAIL_PANED_VIEW(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_MAIL_PANED_VIEW, EMailPanedView)) +#define E_MAIL_PANED_VIEW_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_MAIL_PANED_VIEW, EMailPanedViewClass)) +#define E_IS_MAIL_PANED_VIEW(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_MAIL_PANED_VIEW)) +#define E_IS_MAIL_PANED_VIEW_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_MAIL_PANED_VIEW)) +#define E_MAIL_PANED_VIEW_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_MAIL_PANED_VIEW, EMailPanedViewClass)) +G_BEGIN_DECLS +typedef struct _EMailPanedView EMailPanedView; +typedef struct _EMailPanedViewClass EMailPanedViewClass; typedef struct _EMailPanedViewPrivate EMailPanedViewPrivate; -typedef struct _EMailPanedView { +struct _EMailPanedView { EMailView parent; - EMailPanedViewPrivate *priv; -} EMailPanedView; +}; -typedef struct _EMailPanedViewClass { +struct _EMailPanedViewClass { EMailViewClass parent_class; - void (*open_selected_mail) (EMailPanedView *view); - -} EMailPanedViewClass; + guint (*open_selected_mail) (EMailPanedView *view); +}; -GType e_mail_paned_view_get_type (void); -void -e_mail_paned_view_register_type (GTypeModule *type_module); -GtkWidget * -e_mail_paned_view_new (EShellContent *content); -void -e_mail_paned_view_update_view_instance (EMailPanedView *view); -GalViewInstance * -e_mail_paned_view_get_view_instance (EMailPanedView *view); -void -e_mail_paned_view_set_search_strings (EMailPanedView *view, - GSList *search_strings); -void -e_mail_paned_view_set_show_deleted (EMailPanedView *view, - gboolean show_deleted); +GType e_mail_paned_view_get_type (void); +void e_mail_paned_view_register_type (GTypeModule *type_module); +GtkWidget * e_mail_paned_view_new (EShellContent *content); +void e_mail_paned_view_hide_message_list_pane + (EMailPanedView *view, + gboolean visible); +GtkWidget * e_mail_paned_view_get_preview (EMailPanedView *view); -gboolean -e_mail_paned_view_get_show_deleted (EMailPanedView *view); -EShellSearchbar * -e_mail_paned_view_get_searchbar (EMailPanedView *view); -void -e_mail_paned_view_set_preview_visible (EMailPanedView *view, - gboolean preview_visible); -gboolean -e_mail_paned_view_get_preview_visible (EMailPanedView *view); -void -e_mail_paned_view_set_orientation (EMailPanedView *view, - GtkOrientation orientation); -GtkOrientation -e_mail_paned_view_get_orientation (EMailPanedView *view); -void -e_mail_paned_view_hide_message_list_pane (EMailPanedView *view, - gboolean visible); -GtkWidget * -e_mail_paned_view_get_preview (EMailPanedView *view); +G_END_DECLS -#endif +#endif /* E_MAIL_PANED_VIEW_H */ diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index 40622ea695..4c5b3fd039 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -53,7 +53,6 @@ #include "mail/mail-vfolder.h" #include "mail/message-list.h" - #if HAVE_CLUTTER #include <clutter/clutter.h> #include <mx/mx.h> @@ -682,7 +681,7 @@ action_mail_next_cb (GtkAction *action, #if HAVE_CLUTTER ClutterActor *actor; #endif - + direction = MESSAGE_LIST_SELECT_NEXT; flags = 0; mask = 0; @@ -691,13 +690,12 @@ action_mail_next_cb (GtkAction *action, #if HAVE_CLUTTER actor = g_object_get_data ((GObject *)message_list, "preview-actor"); if (actor) { - clutter_actor_set_opacity (actor, 0); - clutter_actor_animate (actor, CLUTTER_EASE_OUT_SINE, 500, - "opacity", 255, - NULL); + clutter_actor_set_opacity (actor, 0); + clutter_actor_animate ( + actor, CLUTTER_EASE_OUT_SINE, + 500, "opacity", 255, NULL); } - -#endif +#endif message_list_select ( MESSAGE_LIST (message_list), direction, flags, mask); } @@ -887,7 +885,7 @@ action_mail_reply_all_check(CamelFolder *folder, const gchar *uid, CamelMimeMess mode = REPLY_MODE_SENDER; else if (response == GTK_RESPONSE_CANCEL) return; - } + } e_mail_reader_reply_to_message (reader, message, mode); } @@ -966,7 +964,7 @@ action_mail_reply_sender_check(CamelFolder *folder, const gchar *uid, CamelMimeM /* get_message_free() will unref the message, so we need to take an extra ref for e_mail_reader_reply_to_message() to own. */ g_object_ref(message); - + /* Don't do the "Are you sure you want to reply in private?" pop-up if it's a Reply-To: munged list message... unless we're ignoring munging */ if (gconf_client_get_bool (gconf, @@ -2190,13 +2188,12 @@ mail_reader_message_selected_timeout_cb (EMailReader *reader) gboolean store_async; MailMsgDispatchFunc disp_func; - string = g_strdup_printf ( _("Retrieving message '%s'"), cursor_uid); #if HAVE_CLUTTER if (!e_shell_get_express_mode(e_shell_get_default())) - e_web_view_load_string (web_view, string); -#else + e_web_view_load_string (web_view, string); +#else e_web_view_load_string (web_view, string); #endif g_free (string); @@ -3037,7 +3034,7 @@ e_mail_reader_init_private (EMailReader *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. */ @@ -3064,7 +3061,7 @@ e_mail_reader_init_private (EMailReader *reader) g_signal_connect_swapped ( message_list, "selection-change", - G_CALLBACK (e_mail_reader_changed), reader); + G_CALLBACK (e_mail_reader_changed), reader); g_object_set_qdata_full ( G_OBJECT (reader), quark_private, @@ -3457,17 +3454,17 @@ e_mail_reader_set_message (EMailReader *reader, iface->set_message (reader, uid); } -void +guint e_mail_reader_open_selected_mail (EMailReader *reader) { EMailReaderIface *iface; - g_return_if_fail (E_IS_MAIL_READER (reader)); + g_return_val_if_fail (E_IS_MAIL_READER (reader), 0); iface = E_MAIL_READER_GET_IFACE (reader); - g_return_if_fail (iface->open_selected_mail != NULL); + g_return_val_if_fail (iface->open_selected_mail != NULL, 0); - iface->open_selected_mail (reader); + return iface->open_selected_mail (reader); } gboolean diff --git a/mail/e-mail-reader.h b/mail/e-mail-reader.h index 911c2bdef5..842d3b0cb5 100644 --- a/mail/e-mail-reader.h +++ b/mail/e-mail-reader.h @@ -99,7 +99,7 @@ struct _EMailReaderIface { const gchar *folder_uri); void (*set_message) (EMailReader *reader, const gchar *uid); - void (*open_selected_mail) (EMailReader *reader); + guint (*open_selected_mail) (EMailReader *reader); /* Signals */ void (*show_search_bar) (EMailReader *reader); @@ -121,7 +121,7 @@ GtkActionGroup * EMFormatHTML * e_mail_reader_get_formatter (EMailReader *reader); gboolean e_mail_reader_get_hide_deleted (EMailReader *reader); GtkWidget * e_mail_reader_get_message_list (EMailReader *reader); -void e_mail_reader_open_selected_mail(EMailReader *reader); +guint e_mail_reader_open_selected_mail(EMailReader *reader); GtkMenu * e_mail_reader_get_popup_menu (EMailReader *reader); GPtrArray * e_mail_reader_get_selected_uids (EMailReader *reader); EShellBackend * e_mail_reader_get_shell_backend (EMailReader *reader); diff --git a/mail/e-mail-tab-picker.c b/mail/e-mail-tab-picker.c index 6e8f12f88b..5137a0c5ed 100644 --- a/mail/e-mail-tab-picker.c +++ b/mail/e-mail-tab-picker.c @@ -154,7 +154,7 @@ e_mail_tab_picker_drop (MxDroppable *droppable, (tab->position + tab->width <= props->position) && !mx_draggable_is_enabled (MX_DRAGGABLE (props->tab))) { - new_position --; + new_position--; break; } @@ -674,7 +674,7 @@ e_mail_tab_picker_allocate (ClutterActor *actor, clutter_actor_get_preferred_width (actor, child_box.y2, NULL, &width); - /* Fill out data - note it's ok to fill out docking here as when it + /* Fill out data - note it's ok to fill out docking here as when it * changes, the tab queues a relayout. */ props->docking = e_mail_tab_get_docking (props->tab); @@ -876,7 +876,7 @@ e_mail_tab_picker_scroll_event_cb (ClutterActor *actor, e_mail_tab_picker_scroll_to (self, priv->scroll_end + 200, 150); break; } - + return TRUE; } @@ -1021,12 +1021,12 @@ e_mail_tab_picker_add_tab (EMailTabPicker *picker, EMailTab *tab, gint position) EMailTabPickerPrivate *priv = picker->priv; if (priv->tabs && (priv->current_tab >= position)) - priv->current_tab ++; + priv->current_tab++; props = g_slice_new (EMailTabPickerProps); props->tab = tab; priv->tabs = g_list_insert (priv->tabs, props, position); - priv->n_tabs ++; + priv->n_tabs++; clutter_actor_set_parent (CLUTTER_ACTOR (tab), CLUTTER_ACTOR (picker)); mx_draggable_set_axis (MX_DRAGGABLE (tab), MX_DRAG_AXIS_X); @@ -1073,21 +1073,21 @@ e_mail_tab_picker_remove_tab (EMailTabPicker *picker, EMailTab *tab) if (priv->current_tab) { if (priv->current_tab > position) - priv->current_tab --; + priv->current_tab--; else if (priv->current_tab == position) e_mail_tab_picker_set_current_tab (picker, priv->current_tab - 1); } else if (priv->tabs->next && (position == 0)) { e_mail_tab_picker_set_current_tab (picker, priv->current_tab + 1); - priv->current_tab --; + priv->current_tab--; } } g_slice_free (EMailTabPickerProps, tab_link->data); priv->tabs = g_list_delete_link (priv->tabs, tab_link); clutter_actor_unparent (CLUTTER_ACTOR (tab)); - priv->n_tabs --; + priv->n_tabs--; clutter_actor_queue_relayout (CLUTTER_ACTOR (picker)); } @@ -1096,9 +1096,9 @@ GList * e_mail_tab_picker_get_tabs (EMailTabPicker *picker) { GList *tab_list, *t; - + EMailTabPickerPrivate *priv = picker->priv; - + tab_list = NULL; for (t = g_list_last (priv->tabs); t; t = t->prev) { @@ -1184,10 +1184,10 @@ e_mail_tab_picker_reorder (EMailTabPicker *picker, } else if ((priv->current_tab > old_position) && (new_position >= priv->current_tab)) - priv->current_tab --; + priv->current_tab--; else if ((priv->current_tab < old_position) && (new_position <= priv->current_tab)) - priv->current_tab ++; + priv->current_tab++; clutter_actor_queue_relayout (CLUTTER_ACTOR (picker)); } diff --git a/mail/e-mail-tab-picker.h b/mail/e-mail-tab-picker.h index 7de3facc9d..0ee2c68fb1 100644 --- a/mail/e-mail-tab-picker.h +++ b/mail/e-mail-tab-picker.h @@ -16,7 +16,6 @@ * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. */ - #ifndef _E_MAIL_TAB_PICKER_H #define _E_MAIL_TAB_PICKER_H diff --git a/mail/e-mail-tab.c b/mail/e-mail-tab.c index 125f174775..d5909ce1cb 100644 --- a/mail/e-mail-tab.c +++ b/mail/e-mail-tab.c @@ -663,7 +663,7 @@ e_mail_tab_get_preferred_height (ClutterActor *actor, padding.top + padding.bottom + priv->spacing + label_nat_height; - /* Sometimes the preview's natural height will be nan due to + /* Sometimes the preview's natural height will be nan due to * keeping of the aspect ratio. This guards against that and stops * Clutter from warning that the natural height is less than the * minimum height. @@ -1853,7 +1853,7 @@ e_mail_tab_alert_cb (EMailTab *tab) name = (priv->private ^ (priv->alert_count % 2)) ? NULL : "private-tab"; if (!priv->preview_mode) clutter_actor_set_name (CLUTTER_ACTOR (tab), name); - priv->alert_count ++; + priv->alert_count++; if (priv->alert_count < 4) return TRUE; diff --git a/mail/e-mail-tab.h b/mail/e-mail-tab.h index 3966d2752c..55d69b8ba7 100644 --- a/mail/e-mail-tab.h +++ b/mail/e-mail-tab.h @@ -1,5 +1,5 @@ /* - * Borrowed from Moblin-Web-Browser: The web browser for Moblin + * Borrowed from Moblin-Web-Browser: The web browser for Moblin * Copyright (c) 2009, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it diff --git a/mail/e-mail-view.c b/mail/e-mail-view.c index a4318ce7bf..a3a642ab7f 100644 --- a/mail/e-mail-view.c +++ b/mail/e-mail-view.c @@ -10,7 +10,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> + * License along with the program; if not, see <http://www.gnu.org/licenses/> * * * Authors: @@ -24,13 +24,17 @@ # include <config.h> #endif - -#include <glib.h> -#include <glib/gi18n.h> #include "e-mail-view.h" +#include <glib/gi18n-lib.h> -G_DEFINE_TYPE (EMailView, e_mail_view, GTK_TYPE_VBOX) +#define E_MAIL_VIEW_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_MAIL_VIEW, EMailViewPrivate)) + +struct _EMailViewPrivate { + gint placeholder; +}; enum { PANE_CLOSE, @@ -44,36 +48,20 @@ enum { PROP_SHELL_VIEW }; -struct _EMailViewPrivate { -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - -static void -e_mail_view_init (EMailView *shell) -{ - shell->priv = g_new0(EMailViewPrivate, 1); - shell->prev = NULL; -} - -static void -e_mail_view_finalize (GObject *object) -{ - /* EMailView *shell = (EMailView *)object; */ +static guint signals[LAST_SIGNAL]; - G_OBJECT_CLASS (e_mail_view_parent_class)->finalize (object); -} +G_DEFINE_TYPE (EMailView, e_mail_view, GTK_TYPE_VBOX) static void mail_view_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) + guint property_id, + const GValue *value, + GParamSpec *pspec) { switch (property_id) { case PROP_SHELL_VIEW: - E_MAIL_VIEW(object)->content = g_value_get_object (value); - + E_MAIL_VIEW(object)->content = + g_value_get_object (value); return; } @@ -82,15 +70,14 @@ mail_view_set_property (GObject *object, static void mail_view_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) + guint property_id, + GValue *value, + GParamSpec *pspec) { switch (property_id) { case PROP_SHELL_VIEW: g_value_set_object ( - value, E_MAIL_VIEW(object)->content); - + value, E_MAIL_VIEW(object)->content); return; } @@ -98,52 +85,43 @@ mail_view_get_property (GObject *object, } static void -e_mail_view_class_init (EMailViewClass *klass) +e_mail_view_class_init (EMailViewClass *class) { - GObjectClass * object_class = G_OBJECT_CLASS (klass); + GObjectClass *object_class; - e_mail_view_parent_class = g_type_class_peek_parent (klass); - object_class->finalize = e_mail_view_finalize; + g_type_class_add_private (class, sizeof (EMailViewPrivate)); + + object_class = G_OBJECT_CLASS (class); object_class->set_property = mail_view_set_property; object_class->get_property = mail_view_get_property; - klass->get_searchbar = NULL; - klass->set_search_strings = NULL; - klass->get_view_instance = NULL; - klass->update_view_instance = NULL; - klass->set_orientation = NULL; - klass->get_orientation = NULL; - klass->set_show_deleted = NULL; - klass->get_show_deleted = NULL; - klass->set_preview_visible = NULL; - klass->get_preview_visible = NULL; - - signals[PANE_CLOSE] = - g_signal_new ("pane-close", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EMailViewClass , pane_close), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - signals[VIEW_CHANGED] = - g_signal_new ("view-changed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EMailViewClass , view_changed), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - signals[OPEN_MAIL] = - g_signal_new ("open-mail", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EMailViewClass , open_mail), - NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, G_TYPE_STRING); + signals[PANE_CLOSE] = g_signal_new ( + "pane-close", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (EMailViewClass , pane_close), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + signals[VIEW_CHANGED] = g_signal_new ( + "view-changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (EMailViewClass , view_changed), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + signals[OPEN_MAIL] = g_signal_new ( + "open-mail", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (EMailViewClass , open_mail), + NULL, NULL, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, G_TYPE_STRING); + /** * EMailView:shell-content * @@ -159,66 +137,144 @@ e_mail_view_class_init (EMailViewClass *klass) E_TYPE_SHELL_CONTENT, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); +} +static void +e_mail_view_init (EMailView *view) +{ + view->priv = E_MAIL_VIEW_GET_PRIVATE (view); } void e_mail_view_update_view_instance (EMailView *view) { - E_MAIL_VIEW_GET_CLASS (view)->update_view_instance (view); + EMailViewClass *class; + + g_return_if_fail (E_IS_MAIL_VIEW (view)); + + class = E_MAIL_VIEW_GET_CLASS (view); + g_return_if_fail (class->update_view_instance != NULL); + + class->update_view_instance (view); } GalViewInstance * e_mail_view_get_view_instance (EMailView *view) { - return E_MAIL_VIEW_GET_CLASS (view)->get_view_instance (view); + EMailViewClass *class; + + g_return_val_if_fail (E_IS_MAIL_VIEW (view), NULL); + + class = E_MAIL_VIEW_GET_CLASS (view); + g_return_val_if_fail (class->get_view_instance != NULL, NULL); + + return class->get_view_instance (view); } void e_mail_view_set_search_strings (EMailView *view, - GSList *search_strings) + GSList *search_strings) { - E_MAIL_VIEW_GET_CLASS (view)->set_search_strings (view, search_strings); + EMailViewClass *class; + + g_return_if_fail (E_IS_MAIL_VIEW (view)); + + class = E_MAIL_VIEW_GET_CLASS (view); + g_return_if_fail (class->set_search_strings != NULL); + + class->set_search_strings (view, search_strings); } EShellSearchbar * e_mail_view_get_searchbar (EMailView *view) { - return E_MAIL_VIEW_GET_CLASS (view)->get_searchbar (view); + EMailViewClass *class; + + g_return_val_if_fail (E_IS_MAIL_VIEW (view), NULL); + + class = E_MAIL_VIEW_GET_CLASS (view); + g_return_val_if_fail (class->get_searchbar != NULL, NULL); + + return class->get_searchbar (view); } -void -e_mail_view_set_orientation (EMailView *view, GtkOrientation orientation) +void +e_mail_view_set_orientation (EMailView *view, + GtkOrientation orientation) { - E_MAIL_VIEW_GET_CLASS (view)->set_orientation (view, orientation); + EMailViewClass *class; + + g_return_if_fail (E_IS_MAIL_VIEW (view)); + + class = E_MAIL_VIEW_GET_CLASS (view); + g_return_if_fail (class->set_orientation != NULL); + + class->set_orientation (view, orientation); } -GtkOrientation +GtkOrientation e_mail_view_get_orientation (EMailView *view) { - return E_MAIL_VIEW_GET_CLASS (view)->get_orientation (view); + EMailViewClass *class; + + g_return_val_if_fail (E_IS_MAIL_VIEW (view), 0); + + class = E_MAIL_VIEW_GET_CLASS (view); + g_return_val_if_fail (class->get_orientation != NULL, 0); + + return class->get_orientation (view); } -void -e_mail_view_set_preview_visible (EMailView *view, gboolean visible) +void +e_mail_view_set_preview_visible (EMailView *view, + gboolean visible) { - E_MAIL_VIEW_GET_CLASS (view)->set_preview_visible (view, visible); + EMailViewClass *class; + + g_return_if_fail (E_IS_MAIL_VIEW (view)); + + class = E_MAIL_VIEW_GET_CLASS (view); + g_return_if_fail (class->set_preview_visible != NULL); + + class->set_preview_visible (view, visible); } -gboolean +gboolean e_mail_view_get_preview_visible (EMailView *view) { - return E_MAIL_VIEW_GET_CLASS (view)->get_preview_visible (view); + EMailViewClass *class; + + g_return_val_if_fail (E_IS_MAIL_VIEW (view), FALSE); + + class = E_MAIL_VIEW_GET_CLASS (view); + g_return_val_if_fail (class->get_preview_visible != NULL, FALSE); + + return class->get_preview_visible (view); } -void -e_mail_view_set_show_deleted (EMailView *view, gboolean show_deleted) +void +e_mail_view_set_show_deleted (EMailView *view, + gboolean show_deleted) { - E_MAIL_VIEW_GET_CLASS (view)->set_show_deleted (view, show_deleted); + EMailViewClass *class; + + g_return_if_fail (E_IS_MAIL_VIEW (view)); + + class = E_MAIL_VIEW_GET_CLASS (view); + g_return_if_fail (class->set_show_deleted != NULL); + + class->set_show_deleted (view, show_deleted); } -gboolean +gboolean e_mail_view_get_show_deleted (EMailView *view) { - return E_MAIL_VIEW_GET_CLASS (view)->get_show_deleted (view); + EMailViewClass *class; + + g_return_val_if_fail (E_IS_MAIL_VIEW (view), FALSE); + + class = E_MAIL_VIEW_GET_CLASS (view); + g_return_val_if_fail (class->get_show_deleted != NULL, FALSE); + + return class->get_show_deleted (view); } diff --git a/mail/e-mail-view.h b/mail/e-mail-view.h index d5b3ded6a7..5c6e6a42b2 100644 --- a/mail/e-mail-view.h +++ b/mail/e-mail-view.h @@ -10,7 +10,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> + * License along with the program; if not, see <http://www.gnu.org/licenses/> * * * Authors: @@ -23,63 +23,87 @@ #ifndef _E_MAIL_VIEW_H_ #define _E_MAIL_VIEW_H_ -#include <gtk/gtk.h> #include <shell/e-shell-content.h> #include <shell/e-shell-searchbar.h> #include "widgets/menus/gal-view-instance.h" -#define E_MAIL_VIEW_TYPE (e_mail_view_get_type ()) -#define E_MAIL_VIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_MAIL_VIEW_TYPE, EMailView)) -#define E_MAIL_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_MAIL_VIEW_TYPE, EMailViewClass)) -#define IS_E_MAIL_VIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_MAIL_VIEW_TYPE)) -#define IS_E_MAIL_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_MAIL_VIEW_TYPE)) -#define E_MAIL_VIEW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_MAIL_VIEW_TYPE, EMailViewClass)) - - +/* Standard GObject macros */ +#define E_TYPE_MAIL_VIEW \ + (e_mail_view_get_type ()) +#define E_MAIL_VIEW(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_MAIL_VIEW, EMailView)) +#define E_MAIL_VIEW_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_MAIL_VIEW, EMailViewClass)) +#define E_IS_MAIL_VIEW(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_MAIL_VIEW)) +#define E_IS_MAIL_VIEW_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_MAIL_VIEW)) +#define E_MAIL_VIEW_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_MAIL_VIEW, EMailViewClass)) + +G_BEGIN_DECLS + +typedef struct _EMailView EMailView; +typedef struct _EMailViewClass EMailViewClass; typedef struct _EMailViewPrivate EMailViewPrivate; -typedef struct _EMailView { +struct _EMailView { GtkVBox parent; EMailViewPrivate *priv; EShellContent *content; - struct _EMailView *prev; -} EMailView; + EMailView *prev; +}; -typedef struct _EMailViewClass { +struct _EMailViewClass { GtkVBoxClass parent_class; - void (*pane_close) (EMailView *); - void (*view_changed) (EMailView *); - void (*open_mail) (EMailView *, const char *); - - EShellSearchbar * (*get_searchbar) (EMailView *view); - void (*set_search_strings) (EMailView *view, GSList *search_strings); - GalViewInstance * (*get_view_instance) (EMailView *view); - void (*update_view_instance) (EMailView *view); - void (*set_orientation) (EMailView *view, GtkOrientation orientation); - GtkOrientation (*get_orientation) (EMailView *); - void (*set_preview_visible) (EMailView *view, gboolean visible); - gboolean (*get_preview_visible) (EMailView *view); - void (*set_show_deleted) (EMailView *view, gboolean show_deleted); - gboolean (*get_show_deleted) (EMailView *view); - -} EMailViewClass; - -GType e_mail_view_get_type (void); - -void e_mail_view_update_view_instance (EMailView *view); -GalViewInstance * e_mail_view_get_view_instance (EMailView *view); - -void e_mail_view_set_search_strings (EMailView *view, GSList *search_strings); - -void e_mail_view_set_orientation (EMailView *view, GtkOrientation orientation); -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); -void e_mail_view_set_show_deleted (EMailView *view, gboolean show_deleted); -gboolean e_mail_view_get_show_deleted (EMailView *view); - -EShellSearchbar * e_mail_view_get_searchbar (EMailView *view); - -#endif + void (*pane_close) (EMailView *view); + void (*view_changed) (EMailView *view); + void (*open_mail) (EMailView *view, + const gchar *); + + EShellSearchbar * + (*get_searchbar) (EMailView *view); + void (*set_search_strings) (EMailView *view, + GSList *search_strings); + GalViewInstance * + (*get_view_instance) (EMailView *view); + void (*update_view_instance) (EMailView *view); + void (*set_orientation) (EMailView *view, + GtkOrientation orientation); + GtkOrientation (*get_orientation) (EMailView *view); + void (*set_preview_visible) (EMailView *view, + gboolean visible); + gboolean (*get_preview_visible) (EMailView *view); + void (*set_show_deleted) (EMailView *view, + gboolean show_deleted); + gboolean (*get_show_deleted) (EMailView *view); +}; + +GType e_mail_view_get_type (void); +void e_mail_view_update_view_instance(EMailView *view); +GalViewInstance * + e_mail_view_get_view_instance (EMailView *view); +void e_mail_view_set_search_strings (EMailView *view, + GSList *search_strings); +void e_mail_view_set_orientation (EMailView *view, + GtkOrientation orientation); +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); +void e_mail_view_set_show_deleted (EMailView *view, + gboolean show_deleted); +gboolean e_mail_view_get_show_deleted (EMailView *view); +EShellSearchbar * + e_mail_view_get_searchbar (EMailView *view); + +G_END_DECLS + +#endif /* E_MAIL_VIEW_H */ diff --git a/mail/em-format-html.c b/mail/em-format-html.c index 95e1572e7c..302d5afc67 100644 --- a/mail/em-format-html.c +++ b/mail/em-format-html.c @@ -344,10 +344,10 @@ efh_format_timeout(struct _format_msg *m) } else { efh->state = EM_FORMAT_HTML_STATE_RENDERING; #if HAVE_CLUTTER - if (p->last_part != m->message && !e_shell_get_express_mode(e_shell_get_default())) { -#else + if (p->last_part != m->message && !e_shell_get_express_mode(e_shell_get_default())) { +#else if (p->last_part != m->message) { -#endif +#endif hstream = gtk_html_begin (GTK_HTML (web_view)); gtk_html_stream_printf (hstream, "<h5>%s</h5>", _("Formatting Message...")); gtk_html_stream_close (hstream, GTK_HTML_STREAM_OK); diff --git a/mail/message-list.c b/mail/message-list.c index 96d2a68cbe..0a2a5d446d 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -2382,7 +2382,7 @@ message_list_init (MessageList *message_list) message_list->priv->timeline = NULL; message_list->priv->search_texture = NULL; #endif - + message_list->normalised_hash = g_hash_table_new_full ( g_str_hash, g_str_equal, (GDestroyNotify) NULL, @@ -4137,10 +4137,10 @@ on_timeline_stopped (ClutterTimeline *timeline, ClutterActor *actor) void message_list_set_search (MessageList *ml, const gchar *search) { -#if HAVE_CLUTTER +#if HAVE_CLUTTER if (ml->priv->timeline == NULL) { ClutterActor *stage = g_object_get_data ((GObject *)ml, "stage"); - + if (stage) { ClutterActor *texture = NULL; ClutterPath *path; @@ -4152,7 +4152,7 @@ message_list_set_search (MessageList *ml, const gchar *search) "system-search", 72, GTK_ICON_LOOKUP_NO_SVG); - + if (info) { texture = clutter_texture_new_from_file (gtk_icon_info_get_filename(info), NULL); gtk_icon_info_free(info); @@ -4174,18 +4174,18 @@ message_list_set_search (MessageList *ml, const gchar *search) clutter_behaviour_apply (behaviour, texture); clutter_timeline_set_loop (ml->priv->timeline, TRUE); - + g_signal_connect(ml->priv->timeline, "started", G_CALLBACK(on_timeline_started), texture); g_signal_connect(ml->priv->timeline, "paused", G_CALLBACK(on_timeline_stopped), texture); //g_signal_connect(ml->priv->timeline, "completed", G_CALLBACK(on_timeline_stopped), texture); - - clutter_timeline_pause (ml->priv->timeline); + + clutter_timeline_pause (ml->priv->timeline); clutter_timeline_stop (ml->priv->timeline); } } #endif - + if (search == NULL || search[0] == '\0') if (ml->search == NULL || ml->search[0] == '\0') return; @@ -4658,15 +4658,15 @@ regen_list_done (struct _regen_list_msg *m) clutter_timeline_stop (m->ml->priv->timeline); } else { ClutterActor *pane = g_object_get_data ((GObject *)m->ml, "actor"); - + if (pane) { - clutter_actor_set_opacity (pane, 0); - clutter_actor_animate (pane, CLUTTER_EASE_OUT_SINE, 150, - "opacity", 255, - NULL); + clutter_actor_set_opacity (pane, 0); + clutter_actor_animate ( + pane, CLUTTER_EASE_OUT_SINE, + 150, "opacity", 255, NULL); } } -#endif +#endif } static void |