diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-03-06 01:33:49 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-06-30 00:41:41 +0800 |
commit | 7aacf983b32ecac26bc9707697da622b3ef164a3 (patch) | |
tree | 754e32b12d21674efa6d55c7a1c8727477197dd4 /mail | |
parent | bca1a2c5ea655a8cfacedadf8a9a6c6b62d2b0ab (diff) | |
download | gsoc2013-evolution-7aacf983b32ecac26bc9707697da622b3ef164a3.tar.gz gsoc2013-evolution-7aacf983b32ecac26bc9707697da622b3ef164a3.tar.zst gsoc2013-evolution-7aacf983b32ecac26bc9707697da622b3ef164a3.zip |
Coding style and whitespace cleanup.
Diffstat (limited to 'mail')
34 files changed, 1320 insertions, 1145 deletions
diff --git a/mail/e-mail-attachment-bar.c b/mail/e-mail-attachment-bar.c index 0a5a3271fe..786fda255c 100644 --- a/mail/e-mail-attachment-bar.c +++ b/mail/e-mail-attachment-bar.c @@ -503,7 +503,8 @@ mail_attachment_bar_init (EMailAttachmentBar *bar) GtkWidget *widget; GtkAction *action; - bar->priv = G_TYPE_INSTANCE_GET_PRIVATE (bar, E_TYPE_MAIL_ATTACHMENT_BAR, EMailAttachmentBarPrivate); + bar->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + bar, E_TYPE_MAIL_ATTACHMENT_BAR, EMailAttachmentBarPrivate); bar->priv->model = e_attachment_store_new (); gtk_box_set_spacing (GTK_BOX (bar), 6); diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c index fb2a384796..c75f7c96a2 100644 --- a/mail/e-mail-backend.c +++ b/mail/e-mail-backend.c @@ -546,7 +546,8 @@ e_mail_backend_class_init (EMailBackendClass *class) static void e_mail_backend_init (EMailBackend *backend) { - backend->priv = G_TYPE_INSTANCE_GET_PRIVATE (backend, E_TYPE_MAIL_BACKEND, EMailBackendPrivate); + backend->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + backend, E_TYPE_MAIL_BACKEND, EMailBackendPrivate); } EMailSession * diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c index b1186aa945..ba0c585f7b 100644 --- a/mail/e-mail-browser.c +++ b/mail/e-mail-browser.c @@ -939,7 +939,8 @@ e_mail_browser_init (EMailBrowser *browser) GConfBridge *bridge; const gchar *prefix; - browser->priv = G_TYPE_INSTANCE_GET_PRIVATE (browser, E_TYPE_MAIL_BROWSER, EMailBrowserPrivate); + browser->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + browser, E_TYPE_MAIL_BROWSER, EMailBrowserPrivate); browser->priv->action_group = gtk_action_group_new ("mail-browser"); browser->priv->formatter = em_format_html_display_new (); diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c index 7fc16943a4..c0c96b5066 100644 --- a/mail/e-mail-display.c +++ b/mail/e-mail-display.c @@ -363,7 +363,8 @@ mail_display_init (EMailDisplay *display) web_view = E_WEB_VIEW (display); - display->priv = G_TYPE_INSTANCE_GET_PRIVATE (display, E_TYPE_MAIL_DISPLAY, EMailDisplayPrivate); + display->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + display, E_TYPE_MAIL_DISPLAY, EMailDisplayPrivate); /* EWebView's action groups are added during its instance * initialization function (like what we're in now), so it diff --git a/mail/e-mail-folder-pane.c b/mail/e-mail-folder-pane.c index beac9cc1ef..12123128e1 100644 --- a/mail/e-mail-folder-pane.c +++ b/mail/e-mail-folder-pane.c @@ -167,7 +167,8 @@ e_mail_folder_pane_class_init (EMailFolderPaneClass *class) static void e_mail_folder_pane_init (EMailFolderPane *browser) { - browser->priv = G_TYPE_INSTANCE_GET_PRIVATE (browser, E_TYPE_MAIL_FOLDER_PANE, EMailFolderPanePrivate); + browser->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + browser, E_TYPE_MAIL_FOLDER_PANE, EMailFolderPanePrivate); } EMailView * diff --git a/mail/e-mail-label-action.c b/mail/e-mail-label-action.c index c7cf71a655..f83055bb34 100644 --- a/mail/e-mail-label-action.c +++ b/mail/e-mail-label-action.c @@ -102,7 +102,8 @@ mail_label_action_class_init (EMailLabelActionClass *class) static void mail_label_action_init (EMailLabelAction *action) { - action->priv = G_TYPE_INSTANCE_GET_PRIVATE (action, E_TYPE_MAIL_LABEL_ACTION, EMailLabelActionPrivate); + action->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + action, E_TYPE_MAIL_LABEL_ACTION, EMailLabelActionPrivate); } GType diff --git a/mail/e-mail-label-dialog.c b/mail/e-mail-label-dialog.c index 4a4728a433..534ab9e705 100644 --- a/mail/e-mail-label-dialog.c +++ b/mail/e-mail-label-dialog.c @@ -181,7 +181,8 @@ mail_label_dialog_init (EMailLabelDialog *dialog) GtkWidget *container; GtkWidget *widget; - dialog->priv = G_TYPE_INSTANCE_GET_PRIVATE (dialog, E_TYPE_MAIL_LABEL_DIALOG, EMailLabelDialogPrivate); + dialog->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + dialog, E_TYPE_MAIL_LABEL_DIALOG, EMailLabelDialogPrivate); content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); diff --git a/mail/e-mail-label-list-store.c b/mail/e-mail-label-list-store.c index 104e392a28..c0774e4f52 100644 --- a/mail/e-mail-label-list-store.c +++ b/mail/e-mail-label-list-store.c @@ -234,7 +234,9 @@ mail_label_list_store_init (EMailLabelListStore *store) (GDestroyNotify) g_free, (GDestroyNotify) gtk_tree_row_reference_free); - store->priv = G_TYPE_INSTANCE_GET_PRIVATE (store, E_TYPE_MAIL_LABEL_LIST_STORE, EMailLabelListStorePrivate); + store->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + store, E_TYPE_MAIL_LABEL_LIST_STORE, + EMailLabelListStorePrivate); store->priv->tag_index = tag_index; /* XXX While it may seem awkward to cram the label name and color diff --git a/mail/e-mail-label-manager.c b/mail/e-mail-label-manager.c index 54b2b7fd90..0a210178aa 100644 --- a/mail/e-mail-label-manager.c +++ b/mail/e-mail-label-manager.c @@ -305,7 +305,8 @@ mail_label_manager_init (EMailLabelManager *manager) GtkWidget *container; GtkWidget *widget; - manager->priv = G_TYPE_INSTANCE_GET_PRIVATE (manager, E_TYPE_MAIL_LABEL_MANAGER, EMailLabelManagerPrivate); + manager->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + manager, E_TYPE_MAIL_LABEL_MANAGER, EMailLabelManagerPrivate); gtk_table_resize (GTK_TABLE (manager), 2, 2); gtk_table_set_col_spacings (GTK_TABLE (manager), 6); diff --git a/mail/e-mail-label-tree-view.c b/mail/e-mail-label-tree-view.c index 3d53108a6e..0d5baab145 100644 --- a/mail/e-mail-label-tree-view.c +++ b/mail/e-mail-label-tree-view.c @@ -75,7 +75,9 @@ mail_label_tree_view_init (EMailLabelTreeView *tree_view) GtkTreeViewColumn *column; GtkCellRenderer *renderer; - tree_view->priv = G_TYPE_INSTANCE_GET_PRIVATE (tree_view, E_TYPE_MAIL_LABEL_TREE_VIEW, EMailLabelTreeViewPrivate); + tree_view->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + tree_view, E_TYPE_MAIL_LABEL_TREE_VIEW, + EMailLabelTreeViewPrivate); column = gtk_tree_view_column_new (); renderer = gtk_cell_renderer_pixbuf_new (); diff --git a/mail/e-mail-message-pane.c b/mail/e-mail-message-pane.c index 75fd4597ee..0a23429cf3 100644 --- a/mail/e-mail-message-pane.c +++ b/mail/e-mail-message-pane.c @@ -76,7 +76,8 @@ e_mail_message_pane_class_init (EMailMessagePaneClass *class) static void e_mail_message_pane_init (EMailMessagePane *browser) { - browser->priv = G_TYPE_INSTANCE_GET_PRIVATE (browser, E_TYPE_MAIL_MESSAGE_PANE, EMailMessagePanePrivate); + browser->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + browser, E_TYPE_MAIL_MESSAGE_PANE, EMailMessagePanePrivate); } EMailView * diff --git a/mail/e-mail-notebook-view.c b/mail/e-mail-notebook-view.c index 1ff0a014f0..bd92b52d14 100644 --- a/mail/e-mail-notebook-view.c +++ b/mail/e-mail-notebook-view.c @@ -1339,7 +1339,8 @@ e_mail_notebook_view_reader_init (EMailReaderInterface *interface) static void e_mail_notebook_view_init (EMailNotebookView *view) { - view->priv = G_TYPE_INSTANCE_GET_PRIVATE (view, E_TYPE_MAIL_NOTEBOOK_VIEW, EMailNotebookViewPrivate); + view->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + view, E_TYPE_MAIL_NOTEBOOK_VIEW, EMailNotebookViewPrivate); view->priv->inited = FALSE; view->priv->views = g_hash_table_new (g_str_hash, g_str_equal); diff --git a/mail/e-mail-paned-view.c b/mail/e-mail-paned-view.c index 05777d254e..2f98ebf61e 100644 --- a/mail/e-mail-paned-view.c +++ b/mail/e-mail-paned-view.c @@ -975,7 +975,8 @@ e_mail_paned_view_reader_init (EMailReaderInterface *interface) static void e_mail_paned_view_init (EMailPanedView *view) { - view->priv = G_TYPE_INSTANCE_GET_PRIVATE (view, E_TYPE_MAIL_PANED_VIEW, EMailPanedViewPrivate); + view->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + view, E_TYPE_MAIL_PANED_VIEW, EMailPanedViewPrivate); view->priv->enable_show_folder = FALSE; g_signal_connect ( diff --git a/mail/e-mail-session.c b/mail/e-mail-session.c index 4f78be0d90..e6afdc05b4 100644 --- a/mail/e-mail-session.c +++ b/mail/e-mail-session.c @@ -997,7 +997,8 @@ e_mail_session_init (EMailSession *session) { GConfClient *client; - session->priv = G_TYPE_INSTANCE_GET_PRIVATE (session, E_TYPE_MAIL_SESSION, EMailSessionPrivate); + session->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + session, E_TYPE_MAIL_SESSION, EMailSessionPrivate); session->priv->folder_cache = mail_folder_cache_new (); /* Initialize the EAccount setup. */ diff --git a/mail/e-mail-sidebar.c b/mail/e-mail-sidebar.c index 19f38f7d30..9f44f9e1a2 100644 --- a/mail/e-mail-sidebar.c +++ b/mail/e-mail-sidebar.c @@ -421,7 +421,8 @@ mail_sidebar_init (EMailSidebar *sidebar) GtkTreeSelection *selection; EMFolderTree *folder_tree; - sidebar->priv = G_TYPE_INSTANCE_GET_PRIVATE (sidebar, E_TYPE_MAIL_SIDEBAR, EMailSidebarPrivate); + sidebar->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + sidebar, E_TYPE_MAIL_SIDEBAR, EMailSidebarPrivate); folder_tree = EM_FOLDER_TREE (sidebar); em_folder_tree_set_excluded (folder_tree, 0); diff --git a/mail/e-mail-tab-picker.c b/mail/e-mail-tab-picker.c index 89b672e782..7c71d0580a 100644 --- a/mail/e-mail-tab-picker.c +++ b/mail/e-mail-tab-picker.c @@ -25,1305 +25,1297 @@ static void mx_droppable_iface_init (MxDroppableIface *iface); static gint e_mail_tab_picker_find_tab_cb (gconstpointer a, gconstpointer b); -G_DEFINE_TYPE_WITH_CODE (EMailTabPicker, - e_mail_tab_picker, - MX_TYPE_WIDGET, - G_IMPLEMENT_INTERFACE (MX_TYPE_DROPPABLE, - mx_droppable_iface_init)) +G_DEFINE_TYPE_WITH_CODE ( + EMailTabPicker, + e_mail_tab_picker, + MX_TYPE_WIDGET, + G_IMPLEMENT_INTERFACE ( + MX_TYPE_DROPPABLE, mx_droppable_iface_init)) enum { - PROP_0, + PROP_0, - PROP_PREVIEW_MODE, - PROP_DROP_ENABLED, + PROP_PREVIEW_MODE, + PROP_DROP_ENABLED, }; enum { - TAB_ACTIVATED, - CHOOSER_CLICKED, + TAB_ACTIVATED, + CHOOSER_CLICKED, - LAST_SIGNAL + LAST_SIGNAL }; static guint signals[LAST_SIGNAL] = { 0, }; typedef struct { - EMailTab *tab; - gfloat position; - gfloat width; - gboolean docking; - gboolean docked; + EMailTab *tab; + gfloat position; + gfloat width; + gboolean docking; + gboolean docked; } EMailTabPickerProps; struct _EMailTabPickerPrivate { - GList *tabs; - gint n_tabs; - ClutterActor *chooser_button; - ClutterActor *close_button; - gint current_tab; - gboolean preview_mode; - gboolean drop_enabled; - gboolean in_drag; - gboolean drag_preview; - - gint width; - gint total_width; - gint max_offset; - gboolean docked_tabs; - - ClutterTimeline *scroll_timeline; - ClutterAlpha *scroll_alpha; - gint scroll_start; - gint scroll_end; - gint scroll_offset; - gboolean keep_current_visible; - MxAdjustment *scroll_adjustment; - ClutterActor *scroll_bar; - - ClutterTimeline *preview_timeline; - gfloat preview_progress; + GList *tabs; + gint n_tabs; + ClutterActor *chooser_button; + ClutterActor *close_button; + gint current_tab; + gboolean preview_mode; + gboolean drop_enabled; + gboolean in_drag; + gboolean drag_preview; + + gint width; + gint total_width; + gint max_offset; + gboolean docked_tabs; + + ClutterTimeline *scroll_timeline; + ClutterAlpha *scroll_alpha; + gint scroll_start; + gint scroll_end; + gint scroll_offset; + gboolean keep_current_visible; + MxAdjustment *scroll_adjustment; + ClutterActor *scroll_bar; + + ClutterTimeline *preview_timeline; + gfloat preview_progress; }; static void e_mail_tab_picker_over_in (MxDroppable *droppable, - MxDraggable *draggable) + MxDraggable *draggable) { } static void e_mail_tab_picker_over_out (MxDroppable *droppable, - MxDraggable *draggable) + MxDraggable *draggable) { } static void -e_mail_tab_picker_drop (MxDroppable *droppable, - MxDraggable *draggable, - gfloat event_x, - gfloat event_y, - gint button, - ClutterModifierType modifiers) +e_mail_tab_picker_drop (MxDroppable *droppable, + MxDraggable *draggable, + gfloat event_x, + gfloat event_y, + gint button, + ClutterModifierType modifiers) { - GList *t; - EMailTabPickerProps *tab; - gint current_position, new_position; - - EMailTabPicker *picker = E_MAIL_TAB_PICKER (droppable); - EMailTabPickerPrivate *priv = picker->priv; - - /* Make sure this is a valid drop */ - if (!priv->drop_enabled) - return; - - if (!E_MAIL_IS_TAB (draggable)) - return; - - if (clutter_actor_get_parent (CLUTTER_ACTOR (draggable)) != - (ClutterActor *)picker) - return; - - /* Get current position and property data structure */ - t = g_list_find_custom (priv->tabs, draggable, e_mail_tab_picker_find_tab_cb); - tab = (EMailTabPickerProps *)t->data; - if (!tab) - { - g_warning ("Tab that's parented to a picker not actually in picker"); - return; - } - current_position = g_list_position (priv->tabs, t); - - /* Work out new position */ - for (new_position = 0, t = priv->tabs; t; t = t->next) - { - EMailTabPickerProps *props = t->data; - - /* Ignore docked tabs */ - if (!props->docked) - { - /* If the tab is beyond the dragged tab and not draggable, - * we don't want to drag past it. - */ - if ((event_x >= props->position + priv->scroll_offset) && - (tab->position + tab->width <= props->position) && - !mx_draggable_is_enabled (MX_DRAGGABLE (props->tab))) - { - new_position--; - break; - } - - /* The same check for dragging left instead of right */ - if ((event_x < props->position + props->width + priv->scroll_offset)&& - (tab->position >= props->position) && - !mx_draggable_is_enabled (MX_DRAGGABLE (props->tab))) - break; - - /* If the tab-end position is after the drop position, - * break - we want to drop before here. - */ - if (props->position + props->width + priv->scroll_offset > event_x) - break; - } + GList *t; + EMailTabPickerProps *tab; + gint current_position, new_position; + + EMailTabPicker *picker = E_MAIL_TAB_PICKER (droppable); + EMailTabPickerPrivate *priv = picker->priv; + + /* Make sure this is a valid drop */ + if (!priv->drop_enabled) + return; - /* Increment the position */ - new_position++; - } + if (!E_MAIL_IS_TAB (draggable)) + return; - /* Re-order */ - e_mail_tab_picker_reorder (picker, current_position, new_position); + if (clutter_actor_get_parent (CLUTTER_ACTOR (draggable)) != (ClutterActor *)picker) + return; + + /* Get current position and property data structure */ + t = g_list_find_custom (priv->tabs, draggable, e_mail_tab_picker_find_tab_cb); + tab = (EMailTabPickerProps *)t->data; + if (!tab) { + g_warning ("Tab that's parented to a picker not actually in picker"); + return; + } + current_position = g_list_position (priv->tabs, t); + + /* Work out new position */ + for (new_position = 0, t = priv->tabs; t; t = t->next) { + EMailTabPickerProps *props = t->data; + + /* Ignore docked tabs */ + if (!props->docked) { + /* If the tab is beyond the dragged tab and not + * draggable, we don't want to drag past it. */ + if ((event_x >= props->position + priv->scroll_offset) && + (tab->position + tab->width <= props->position) && + !mx_draggable_is_enabled (MX_DRAGGABLE (props->tab))) { + new_position--; + break; + } + + /* The same check for dragging left instead of right */ + if ((event_x < props->position + props->width + priv->scroll_offset)&& + (tab->position >= props->position) && + !mx_draggable_is_enabled (MX_DRAGGABLE (props->tab))) + break; + + /* If the tab-end position is after the drop position, + * break - we want to drop before here. */ + if (props->position + props->width + priv->scroll_offset > event_x) + break; + } + + /* Increment the position */ + new_position++; + } + + /* Re-order */ + e_mail_tab_picker_reorder (picker, current_position, new_position); } static void mx_droppable_iface_init (MxDroppableIface *iface) { - iface->over_in = e_mail_tab_picker_over_in; - iface->over_out = e_mail_tab_picker_over_out; - iface->drop = e_mail_tab_picker_drop; + iface->over_in = e_mail_tab_picker_over_in; + iface->over_out = e_mail_tab_picker_over_out; + iface->drop = e_mail_tab_picker_drop; } static void -e_mail_tab_picker_get_property (GObject *object, guint property_id, - GValue *value, GParamSpec *pspec) +e_mail_tab_picker_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) { - EMailTabPicker *tab_picker = E_MAIL_TAB_PICKER (object); - EMailTabPickerPrivate *priv = tab_picker->priv; - - switch (property_id) - { - case PROP_PREVIEW_MODE: - g_value_set_boolean (value, e_mail_tab_picker_get_preview_mode (tab_picker)); - break; - - case PROP_DROP_ENABLED: - g_value_set_boolean (value, priv->drop_enabled); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - } + EMailTabPicker *tab_picker = E_MAIL_TAB_PICKER (object); + EMailTabPickerPrivate *priv = tab_picker->priv; + + switch (property_id) { + case PROP_PREVIEW_MODE: + g_value_set_boolean ( + value, e_mail_tab_picker_get_preview_mode ( + E_MAIL_TAB_PICKER (object))); + return; + + case PROP_DROP_ENABLED: + g_value_set_boolean (value, priv->drop_enabled); + return; + } + + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } static void -e_mail_tab_picker_set_property (GObject *object, guint property_id, - const GValue *value, GParamSpec *pspec) +e_mail_tab_picker_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) { - EMailTabPicker *tab_picker = E_MAIL_TAB_PICKER (object); - EMailTabPickerPrivate *priv = tab_picker->priv; - - switch (property_id) - { - case PROP_PREVIEW_MODE: - e_mail_tab_picker_set_preview_mode (tab_picker, g_value_get_boolean (value)); - break; - - case PROP_DROP_ENABLED: - priv->drop_enabled = g_value_get_boolean (value); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - } + EMailTabPicker *tab_picker = E_MAIL_TAB_PICKER (object); + EMailTabPickerPrivate *priv = tab_picker->priv; + + switch (property_id) { + case PROP_PREVIEW_MODE: + e_mail_tab_picker_set_preview_mode ( + E_MAIL_TAB_PICKER (object), + g_value_get_boolean (value)); + return; + + case PROP_DROP_ENABLED: + priv->drop_enabled = g_value_get_boolean (value); + return; + } + + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } static void e_mail_tab_picker_dispose (GObject *object) { - EMailTabPicker *picker = E_MAIL_TAB_PICKER (object); - EMailTabPickerPrivate *priv = picker->priv; - - if (priv->scroll_bar) - { - clutter_actor_unparent (CLUTTER_ACTOR (priv->scroll_bar)); - priv->scroll_bar = NULL; - } - - if (priv->scroll_timeline) - { - clutter_timeline_stop (priv->scroll_timeline); - g_object_unref (priv->scroll_alpha); - g_object_unref (priv->scroll_timeline); - priv->scroll_timeline = NULL; - priv->scroll_alpha = NULL; - } - - if (priv->preview_timeline) - { - clutter_timeline_stop (priv->preview_timeline); - g_object_unref (priv->preview_timeline); - priv->preview_timeline = NULL; - } - - if (priv->chooser_button) - { - clutter_actor_unparent (CLUTTER_ACTOR (priv->chooser_button)); - priv->chooser_button = NULL; - } - - if (priv->close_button) - { - clutter_actor_unparent (CLUTTER_ACTOR (priv->close_button)); - priv->close_button = NULL; - } - - while (priv->tabs) - { - EMailTabPickerProps *props = priv->tabs->data; - e_mail_tab_picker_remove_tab (picker, props->tab); - } - - G_OBJECT_CLASS (e_mail_tab_picker_parent_class)->dispose (object); -} + EMailTabPicker *picker = E_MAIL_TAB_PICKER (object); + EMailTabPickerPrivate *priv = picker->priv; -static void -e_mail_tab_picker_finalize (GObject *object) -{ - G_OBJECT_CLASS (e_mail_tab_picker_parent_class)->finalize (object); + if (priv->scroll_bar) { + clutter_actor_unparent (CLUTTER_ACTOR (priv->scroll_bar)); + priv->scroll_bar = NULL; + } + + if (priv->scroll_timeline) { + clutter_timeline_stop (priv->scroll_timeline); + g_object_unref (priv->scroll_alpha); + g_object_unref (priv->scroll_timeline); + priv->scroll_timeline = NULL; + priv->scroll_alpha = NULL; + } + + if (priv->preview_timeline) { + clutter_timeline_stop (priv->preview_timeline); + g_object_unref (priv->preview_timeline); + priv->preview_timeline = NULL; + } + + if (priv->chooser_button) { + clutter_actor_unparent (CLUTTER_ACTOR (priv->chooser_button)); + priv->chooser_button = NULL; + } + + if (priv->close_button) { + clutter_actor_unparent (CLUTTER_ACTOR (priv->close_button)); + priv->close_button = NULL; + } + + while (priv->tabs) { + EMailTabPickerProps *props = priv->tabs->data; + e_mail_tab_picker_remove_tab (picker, props->tab); + } + + /* Chain up to parent's dispose() method. */ + G_OBJECT_CLASS (e_mail_tab_picker_parent_class)->dispose (object); } static void e_mail_tab_picker_paint (ClutterActor *actor) { - GList *t; - gfloat width, height, offset; + GList *t; + gfloat width, height, offset; - EMailTabPickerPrivate *priv = E_MAIL_TAB_PICKER (actor)->priv; + EMailTabPickerPrivate *priv = E_MAIL_TAB_PICKER (actor)->priv; - CLUTTER_ACTOR_CLASS (e_mail_tab_picker_parent_class)->paint (actor); + CLUTTER_ACTOR_CLASS (e_mail_tab_picker_parent_class)->paint (actor); - clutter_actor_get_size (actor, &width, &height); + clutter_actor_get_size (actor, &width, &height); - cogl_clip_push_rectangle (0, 0, width, height); + cogl_clip_push_rectangle (0, 0, width, height); - offset = priv->scroll_offset; - cogl_translate (-priv->scroll_offset, 0, 0); + offset = priv->scroll_offset; + cogl_translate (-priv->scroll_offset, 0, 0); - /* Draw normal tabs */ - for (t = priv->tabs; t; t = t->next) - { - EMailTabPickerProps *props = t->data; + /* Draw normal tabs */ + for (t = priv->tabs; t; t = t->next) { + EMailTabPickerProps *props = t->data; - if (props->docked) - continue; - if (props->position + props->width < offset) - continue; - if (props->position > width + offset) - break; + if (props->docked) + continue; + if (props->position + props->width < offset) + continue; + if (props->position > width + offset) + break; - if (CLUTTER_ACTOR_IS_MAPPED (props->tab)) - clutter_actor_paint (CLUTTER_ACTOR (props->tab)); - } + if (CLUTTER_ACTOR_IS_MAPPED (props->tab)) + clutter_actor_paint (CLUTTER_ACTOR (props->tab)); + } - cogl_translate (priv->scroll_offset, 0, 0); + cogl_translate (priv->scroll_offset, 0, 0); - /* Draw docked tabs */ - if (priv->docked_tabs) - { - for (t = priv->tabs; t; t = t->next) - { - EMailTabPickerProps *props = t->data; + /* Draw docked tabs */ + if (priv->docked_tabs) { + for (t = priv->tabs; t; t = t->next) { + EMailTabPickerProps *props = t->data; - if (!props->docked) - continue; + if (!props->docked) + continue; - if (CLUTTER_ACTOR_IS_MAPPED (props->tab)) - clutter_actor_paint (CLUTTER_ACTOR (props->tab)); + if (CLUTTER_ACTOR_IS_MAPPED (props->tab)) + clutter_actor_paint (CLUTTER_ACTOR (props->tab)); + } } - } - - cogl_clip_pop (); - - /* Draw tab chooser button */ - if (CLUTTER_ACTOR_IS_MAPPED (priv->chooser_button)) - clutter_actor_paint (CLUTTER_ACTOR (priv->chooser_button)); - - /* Draw scrollbar */ - if (CLUTTER_ACTOR_IS_MAPPED (priv->scroll_bar)) - { - gfloat height; - clutter_actor_get_preferred_height (CLUTTER_ACTOR (priv->close_button), - -1, NULL, &height); - height *= priv->preview_progress; - if (height >= 1.0) - { - cogl_clip_push_rectangle (0, 0, width, height); - if (CLUTTER_ACTOR_IS_MAPPED (priv->close_button)) - clutter_actor_paint (CLUTTER_ACTOR (priv->close_button)); - clutter_actor_paint (CLUTTER_ACTOR (priv->scroll_bar)); - cogl_clip_pop (); + + cogl_clip_pop (); + + /* Draw tab chooser button */ + if (CLUTTER_ACTOR_IS_MAPPED (priv->chooser_button)) + clutter_actor_paint (CLUTTER_ACTOR (priv->chooser_button)); + + /* Draw scrollbar */ + if (CLUTTER_ACTOR_IS_MAPPED (priv->scroll_bar)) { + gfloat height; + clutter_actor_get_preferred_height ( + CLUTTER_ACTOR (priv->close_button), + -1, NULL, &height); + height *= priv->preview_progress; + if (height >= 1.0) { + cogl_clip_push_rectangle (0, 0, width, height); + if (CLUTTER_ACTOR_IS_MAPPED (priv->close_button)) + clutter_actor_paint (CLUTTER_ACTOR (priv->close_button)); + clutter_actor_paint (CLUTTER_ACTOR (priv->scroll_bar)); + cogl_clip_pop (); + } } - } } static void -e_mail_tab_picker_pick (ClutterActor *actor, - const ClutterColor *color) +e_mail_tab_picker_pick (ClutterActor *actor, + const ClutterColor *color) { - EMailTabPickerPrivate *priv = E_MAIL_TAB_PICKER (actor)->priv; + EMailTabPickerPrivate *priv = E_MAIL_TAB_PICKER (actor)->priv; - /* Chain up to paint background */ - CLUTTER_ACTOR_CLASS (e_mail_tab_picker_parent_class)->pick (actor, color); + /* Chain up to paint background */ + CLUTTER_ACTOR_CLASS (e_mail_tab_picker_parent_class)->pick (actor, color); - if (!priv->in_drag) - e_mail_tab_picker_paint (actor); + if (!priv->in_drag) + e_mail_tab_picker_paint (actor); } static void e_mail_tab_picker_get_preferred_width (ClutterActor *actor, - gfloat for_height, - gfloat *min_width_p, - gfloat *natural_width_p) + gfloat for_height, + gfloat *min_width_p, + gfloat *natural_width_p) { - GList *t; - MxPadding padding; + GList *t; + MxPadding padding; - EMailTabPickerPrivate *priv = E_MAIL_TAB_PICKER (actor)->priv; + EMailTabPickerPrivate *priv = E_MAIL_TAB_PICKER (actor)->priv; - clutter_actor_get_preferred_width (CLUTTER_ACTOR (priv->chooser_button), - for_height, min_width_p, natural_width_p); + clutter_actor_get_preferred_width ( + CLUTTER_ACTOR (priv->chooser_button), + for_height, min_width_p, natural_width_p); - mx_widget_get_padding (MX_WIDGET (actor), &padding); - if (min_width_p) - *min_width_p += padding.left + padding.right; - if (natural_width_p) - *natural_width_p += padding.left + padding.right; + mx_widget_get_padding (MX_WIDGET (actor), &padding); + if (min_width_p) + *min_width_p += padding.left + padding.right; + if (natural_width_p) + *natural_width_p += padding.left + padding.right; - for (t = priv->tabs; t; t = t->next) - { - gfloat min_width, natural_width; + for (t = priv->tabs; t; t = t->next) { + gfloat min_width, natural_width; + EMailTabPickerProps *props = t->data; - EMailTabPickerProps *props = t->data; + clutter_actor_get_preferred_width ( + CLUTTER_ACTOR (props->tab), for_height, + &min_width, &natural_width); - clutter_actor_get_preferred_width (CLUTTER_ACTOR (props->tab), for_height, - &min_width, &natural_width); - - if (min_width_p && !t->prev) - *min_width_p += min_width; - if (natural_width_p) - *natural_width_p += natural_width; - } + if (min_width_p && !t->prev) + *min_width_p += min_width; + if (natural_width_p) + *natural_width_p += natural_width; + } } void e_mail_tab_picker_get_preferred_height (EMailTabPicker *tab_picker, - gfloat for_width, - gfloat *min_height_p, - gfloat *natural_height_p, - gboolean with_previews) + gfloat for_width, + gfloat *min_height_p, + gfloat *natural_height_p, + gboolean with_previews) { - MxPadding padding; - - ClutterActor *actor = CLUTTER_ACTOR (tab_picker); - EMailTabPickerPrivate *priv = tab_picker->priv; - - clutter_actor_get_preferred_height (CLUTTER_ACTOR (priv->chooser_button), - for_width, min_height_p, natural_height_p); - - if (priv->tabs) - { - gfloat min_height, natural_height, scroll_height; - - EMailTabPickerProps *props = priv->tabs->data; - - /* Get the height of the first tab - it's assumed that tabs are - * fixed height. - */ - if (with_previews) - { - clutter_actor_get_preferred_height (CLUTTER_ACTOR (props->tab), - for_width, - &min_height, - &natural_height); - if (CLUTTER_ACTOR_IS_VISIBLE (priv->scroll_bar)) - { - /* Add the height of the scrollbar-section */ - clutter_actor_get_preferred_height ( - CLUTTER_ACTOR (priv->close_button), -1, NULL, &scroll_height); - scroll_height *= priv->preview_progress; - - min_height += scroll_height; - natural_height += scroll_height; - } + MxPadding padding; + + ClutterActor *actor = CLUTTER_ACTOR (tab_picker); + EMailTabPickerPrivate *priv = tab_picker->priv; + + clutter_actor_get_preferred_height ( + CLUTTER_ACTOR (priv->chooser_button), + for_width, min_height_p, natural_height_p); + + if (priv->tabs) { + gfloat min_height, natural_height, scroll_height; + EMailTabPickerProps *props = priv->tabs->data; + + /* Get the height of the first tab - it's assumed that + * tabs are fixed height. */ + if (with_previews) { + clutter_actor_get_preferred_height ( + CLUTTER_ACTOR (props->tab), + for_width, &min_height, + &natural_height); + + if (CLUTTER_ACTOR_IS_VISIBLE (priv->scroll_bar)) { + /* Add the height of the scrollbar-section */ + clutter_actor_get_preferred_height ( + CLUTTER_ACTOR (priv->close_button), + -1, NULL, &scroll_height); + scroll_height *= priv->preview_progress; + + min_height += scroll_height; + natural_height += scroll_height; + } + } else + e_mail_tab_get_height_no_preview ( + props->tab, for_width, + &min_height, &natural_height); + + if (min_height_p && (*min_height_p < min_height)) + *min_height_p = min_height; + if (natural_height_p && (*natural_height_p < natural_height)) + *natural_height_p = natural_height; } - else - e_mail_tab_get_height_no_preview (props->tab, for_width, - &min_height, &natural_height); - - if (min_height_p && (*min_height_p < min_height)) - *min_height_p = min_height; - if (natural_height_p && (*natural_height_p < natural_height)) - *natural_height_p = natural_height; - } - - mx_widget_get_padding (MX_WIDGET (actor), &padding); - if (min_height_p) - *min_height_p += padding.top + padding.bottom; - if (natural_height_p) - *natural_height_p += padding.top + padding.bottom; + + mx_widget_get_padding (MX_WIDGET (actor), &padding); + if (min_height_p) + *min_height_p += padding.top + padding.bottom; + if (natural_height_p) + *natural_height_p += padding.top + padding.bottom; } static void _e_mail_tab_picker_get_preferred_height (ClutterActor *actor, - gfloat for_width, - gfloat *min_height_p, - gfloat *natural_height_p) + gfloat for_width, + gfloat *min_height_p, + gfloat *natural_height_p) { - e_mail_tab_picker_get_preferred_height (E_MAIL_TAB_PICKER (actor), for_width, - min_height_p, natural_height_p, TRUE); + e_mail_tab_picker_get_preferred_height ( + E_MAIL_TAB_PICKER (actor), for_width, + min_height_p, natural_height_p, TRUE); } static void -e_mail_tab_picker_allocate_docked (EMailTabPicker *tab_picker, - const ClutterActorBox *picker_box_p, - const ClutterActorBox *chooser_box_p, - ClutterAllocationFlags flags) +e_mail_tab_picker_allocate_docked (EMailTabPicker *tab_picker, + const ClutterActorBox *picker_box_p, + const ClutterActorBox *chooser_box_p, + ClutterAllocationFlags flags) { - GList *t; - MxPadding padding; - ClutterActorBox picker_box, chooser_box, child_box; - gfloat offset, width, left, right, height; - - EMailTabPickerPrivate *priv = tab_picker->priv; - - if (!picker_box_p) - { - clutter_actor_get_allocation_box (CLUTTER_ACTOR (tab_picker), - &picker_box); - picker_box_p = &picker_box; - } - if (!chooser_box_p) - { - clutter_actor_get_allocation_box (CLUTTER_ACTOR (priv->chooser_button), - &chooser_box); - chooser_box_p = &chooser_box; - } - - mx_widget_get_padding (MX_WIDGET (tab_picker), &padding); - - /* Calculate available width and height */ - width = picker_box_p->x2 - picker_box_p->x1 - padding.right; - - e_mail_tab_picker_get_preferred_height (tab_picker, -1, NULL, &height, FALSE); - child_box.y2 = picker_box_p->y2 - picker_box_p->y1 - padding.bottom; - child_box.y1 = child_box.y2 - height; - - /* Don't dock over the chooser button */ - width -= chooser_box_p->x2 - chooser_box_p->x1; - - offset = priv->scroll_offset; - - left = 0; - right = width; - priv->docked_tabs = FALSE; - - for (t = g_list_last (priv->tabs); t; t = t->prev) - { - EMailTabPickerProps *props = t->data; - - props->docked = FALSE; - - if (!props->docking) - continue; - - if (props->position < offset) - { - /* Dock left */ - priv->docked_tabs = TRUE; - props->docked = TRUE; - child_box.x1 = left; - child_box.x2 = child_box.x1 + props->width; - left += props->width; - } - else if (props->position + props->width > width + offset) - { - /* Dock right */ - priv->docked_tabs = TRUE; - props->docked = TRUE; - child_box.x2 = right; - child_box.x1 = child_box.x2 - props->width; - right -= props->width; + GList *t; + MxPadding padding; + ClutterActorBox picker_box, chooser_box, child_box; + gfloat offset, width, left, right, height; + + EMailTabPickerPrivate *priv = tab_picker->priv; + + if (!picker_box_p) { + clutter_actor_get_allocation_box ( + CLUTTER_ACTOR (tab_picker), &picker_box); + picker_box_p = &picker_box; } - else - { - child_box.x1 = props->position; - child_box.x2 = child_box.x1 + props->width; + + if (!chooser_box_p) { + clutter_actor_get_allocation_box ( + CLUTTER_ACTOR (priv->chooser_button), &chooser_box); + chooser_box_p = &chooser_box; } - clutter_actor_allocate (CLUTTER_ACTOR (props->tab), &child_box, flags); - } + mx_widget_get_padding (MX_WIDGET (tab_picker), &padding); + + /* Calculate available width and height */ + width = picker_box_p->x2 - picker_box_p->x1 - padding.right; + + e_mail_tab_picker_get_preferred_height ( + tab_picker, -1, NULL, &height, FALSE); + child_box.y2 = picker_box_p->y2 - picker_box_p->y1 - padding.bottom; + child_box.y1 = child_box.y2 - height; + + /* Don't dock over the chooser button */ + width -= chooser_box_p->x2 - chooser_box_p->x1; + + offset = priv->scroll_offset; + + left = 0; + right = width; + priv->docked_tabs = FALSE; + + for (t = g_list_last (priv->tabs); t; t = t->prev) { + EMailTabPickerProps *props = t->data; + + props->docked = FALSE; + + if (!props->docking) + continue; + + if (props->position < offset) { + /* Dock left */ + priv->docked_tabs = TRUE; + props->docked = TRUE; + child_box.x1 = left; + child_box.x2 = child_box.x1 + props->width; + left += props->width; + } else if (props->position + props->width > width + offset) { + /* Dock right */ + priv->docked_tabs = TRUE; + props->docked = TRUE; + child_box.x2 = right; + child_box.x1 = child_box.x2 - props->width; + right -= props->width; + } else { + child_box.x1 = props->position; + child_box.x2 = child_box.x1 + props->width; + } + + clutter_actor_allocate ( + CLUTTER_ACTOR (props->tab), &child_box, flags); + } } static void e_mail_tab_picker_scroll_new_frame_cb (ClutterTimeline *timeline, - guint msecs, - EMailTabPicker *tab_picker) + guint msecs, + EMailTabPicker *tab_picker) { - EMailTabPickerPrivate *priv = tab_picker->priv; - gdouble alpha = clutter_alpha_get_alpha (priv->scroll_alpha); - - priv->scroll_offset = (priv->scroll_start * (1.0 - alpha)) + - (priv->scroll_end * alpha); - mx_adjustment_set_value (priv->scroll_adjustment, priv->scroll_offset); - e_mail_tab_picker_allocate_docked (tab_picker, NULL, NULL, 0); - clutter_actor_queue_redraw (CLUTTER_ACTOR (tab_picker)); + EMailTabPickerPrivate *priv = tab_picker->priv; + gdouble alpha = clutter_alpha_get_alpha (priv->scroll_alpha); + + priv->scroll_offset = + (priv->scroll_start * (1.0 - alpha)) + + (priv->scroll_end * alpha); + mx_adjustment_set_value (priv->scroll_adjustment, priv->scroll_offset); + e_mail_tab_picker_allocate_docked (tab_picker, NULL, NULL, 0); + clutter_actor_queue_redraw (CLUTTER_ACTOR (tab_picker)); } static void e_mail_tab_picker_scroll_completed_cb (ClutterTimeline *timeline, - EMailTabPicker *tab_picker) + EMailTabPicker *tab_picker) { - EMailTabPickerPrivate *priv = tab_picker->priv; + EMailTabPickerPrivate *priv = tab_picker->priv; - priv->scroll_offset = priv->scroll_end; - mx_adjustment_set_value (priv->scroll_adjustment, priv->scroll_offset); - e_mail_tab_picker_allocate_docked (tab_picker, NULL, NULL, 0); - clutter_actor_queue_redraw (CLUTTER_ACTOR (tab_picker)); + priv->scroll_offset = priv->scroll_end; + mx_adjustment_set_value (priv->scroll_adjustment, priv->scroll_offset); + e_mail_tab_picker_allocate_docked (tab_picker, NULL, NULL, 0); + clutter_actor_queue_redraw (CLUTTER_ACTOR (tab_picker)); - g_object_unref (priv->scroll_alpha); - g_object_unref (priv->scroll_timeline); - priv->scroll_alpha = NULL; - priv->scroll_timeline = NULL; + g_object_unref (priv->scroll_alpha); + g_object_unref (priv->scroll_timeline); + priv->scroll_alpha = NULL; + priv->scroll_timeline = NULL; } static void e_mail_tab_picker_scroll_to (EMailTabPicker *tab_picker, - gint destination, - guint duration) + gint destination, + guint duration) { - EMailTabPickerPrivate *priv = tab_picker->priv; - - priv->scroll_start = priv->scroll_offset; - priv->scroll_end = CLAMP (destination, 0, priv->max_offset); - - if (priv->scroll_timeline) - { - clutter_timeline_stop (priv->scroll_timeline); - clutter_timeline_rewind (priv->scroll_timeline); - clutter_timeline_set_duration (priv->scroll_timeline, duration); - } - else - { - if (priv->scroll_end == priv->scroll_offset) - return; - - priv->scroll_timeline = clutter_timeline_new (duration); - priv->scroll_alpha = clutter_alpha_new_full (priv->scroll_timeline, - CLUTTER_EASE_OUT_QUAD); - g_signal_connect (priv->scroll_timeline, "new_frame", + EMailTabPickerPrivate *priv = tab_picker->priv; + + priv->scroll_start = priv->scroll_offset; + priv->scroll_end = CLAMP (destination, 0, priv->max_offset); + + if (priv->scroll_timeline) { + clutter_timeline_stop (priv->scroll_timeline); + clutter_timeline_rewind (priv->scroll_timeline); + clutter_timeline_set_duration (priv->scroll_timeline, duration); + } else { + if (priv->scroll_end == priv->scroll_offset) + return; + + priv->scroll_timeline = clutter_timeline_new (duration); + priv->scroll_alpha = clutter_alpha_new_full ( + priv->scroll_timeline, CLUTTER_EASE_OUT_QUAD); + g_signal_connect ( + priv->scroll_timeline, "new_frame", G_CALLBACK (e_mail_tab_picker_scroll_new_frame_cb), tab_picker); - g_signal_connect (priv->scroll_timeline, "completed", + g_signal_connect ( + priv->scroll_timeline, "completed", G_CALLBACK (e_mail_tab_picker_scroll_completed_cb), tab_picker); - } + } - clutter_timeline_start (priv->scroll_timeline); + clutter_timeline_start (priv->scroll_timeline); } static void -e_mail_tab_picker_allocate (ClutterActor *actor, - const ClutterActorBox *box, - ClutterAllocationFlags flags) +e_mail_tab_picker_allocate (ClutterActor *actor, + const ClutterActorBox *box, + ClutterAllocationFlags flags) { - GList *t; - MxPadding padding; - gint old_max_offset, old_scroll_offset; - ClutterActorBox child_box, scroll_box; - gfloat width, total_width, height; - - EMailTabPicker *tab_picker = E_MAIL_TAB_PICKER (actor); - EMailTabPickerPrivate *priv = tab_picker->priv; - - mx_widget_get_padding (MX_WIDGET (actor), &padding); - - /* Allocate for scroll-bar and close button */ - clutter_actor_get_preferred_size (CLUTTER_ACTOR (priv->close_button), - NULL, NULL, &width, &height); - child_box.x1 = 0; - child_box.x2 = box->x2 - box->x1 - padding.right; - child_box.y1 = 0; - child_box.y2 = child_box.y1 + height; - clutter_actor_allocate (CLUTTER_ACTOR (priv->close_button), - &child_box, - flags); - - /* FIXME: Make this a property */ -#define SPACING 4.0 - /* Work out allocation for scroll-bar, but allocate it later */ - scroll_box = child_box; - scroll_box.x2 -= width + SPACING; - scroll_box.x1 += SPACING; - scroll_box.y1 += SPACING; - scroll_box.y2 -= SPACING; - - child_box.y1 += (height * priv->preview_progress) + padding.top; - - /* Allocate for tabs */ - total_width = 0; - child_box.x1 = padding.left; - e_mail_tab_picker_get_preferred_height (tab_picker, -1, NULL, &height, FALSE); - for (t = priv->tabs; t; t = t->next) - { - EMailTabPickerProps *props = t->data; - ClutterActor *actor = CLUTTER_ACTOR (props->tab); - - 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 - * changes, the tab queues a relayout. - */ - props->docking = e_mail_tab_get_docking (props->tab); - props->position = child_box.x1; - props->width = width; - - total_width += width; - - /* Don't stretch tabs without a preview to fit tabs with a preview */ - if (e_mail_tab_get_preview_actor (props->tab)) - child_box.y2 = box->y2 - box->y1 - padding.bottom; - else + GList *t; + MxPadding padding; + gint old_max_offset, old_scroll_offset; + ClutterActorBox child_box, scroll_box; + gfloat width, total_width, height; + + EMailTabPicker *tab_picker = E_MAIL_TAB_PICKER (actor); + EMailTabPickerPrivate *priv = tab_picker->priv; + + mx_widget_get_padding (MX_WIDGET (actor), &padding); + + /* Allocate for scroll-bar and close button */ + clutter_actor_get_preferred_size ( + CLUTTER_ACTOR (priv->close_button), + NULL, NULL, &width, &height); + child_box.x1 = 0; + child_box.x2 = box->x2 - box->x1 - padding.right; + child_box.y1 = 0; child_box.y2 = child_box.y1 + height; + clutter_actor_allocate ( + CLUTTER_ACTOR (priv->close_button), &child_box, flags); - child_box.x2 = child_box.x1 + width; - clutter_actor_allocate (actor, &child_box, flags); - - child_box.x1 = child_box.x2; - } - - /* Allocate for the chooser button */ - clutter_actor_get_preferred_width (CLUTTER_ACTOR (priv->chooser_button), - box->y2 - box->y1, NULL, &width); - - child_box.x2 = box->x2 - box->x1 - padding.right; - child_box.x1 = child_box.x2 - width; - child_box.y1 = 0; - child_box.y2 = child_box.y1 + height; - clutter_actor_allocate (CLUTTER_ACTOR (priv->chooser_button), - &child_box, flags); - - /* Cache some useful size values */ - priv->width = (gint)(box->x2 - box->x1); - - priv->total_width = (gint)(total_width + padding.left + padding.right); - - old_max_offset = priv->max_offset; - priv->max_offset = priv->total_width - priv->width + - (gint)(child_box.x2 - child_box.x1); - if (priv->max_offset < 0) - priv->max_offset = 0; - - /* Allocate for tab picker */ - old_scroll_offset = priv->scroll_offset; - priv->scroll_offset = CLAMP (priv->scroll_offset, 0, priv->max_offset); - e_mail_tab_picker_allocate_docked (tab_picker, box, &child_box, flags); + /* FIXME: Make this a property */ +#define SPACING 4.0 + /* Work out allocation for scroll-bar, but allocate it later */ + scroll_box = child_box; + scroll_box.x2 -= width + SPACING; + scroll_box.x1 += SPACING; + scroll_box.y1 += SPACING; + scroll_box.y2 -= SPACING; + + child_box.y1 += (height * priv->preview_progress) + padding.top; + + /* Allocate for tabs */ + total_width = 0; + child_box.x1 = padding.left; + e_mail_tab_picker_get_preferred_height ( + tab_picker, -1, NULL, &height, FALSE); + for (t = priv->tabs; t; t = t->next) { + EMailTabPickerProps *props = t->data; + ClutterActor *actor = CLUTTER_ACTOR (props->tab); + + 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 changes, the tab queues a relayout. */ + props->docking = e_mail_tab_get_docking (props->tab); + props->position = child_box.x1; + props->width = width; + + total_width += width; + + /* Don't stretch tabs without a preview to fit tabs + * with a preview. */ + if (e_mail_tab_get_preview_actor (props->tab)) + child_box.y2 = box->y2 - box->y1 - padding.bottom; + else + child_box.y2 = child_box.y1 + height; + + child_box.x2 = child_box.x1 + width; + clutter_actor_allocate (actor, &child_box, flags); + + child_box.x1 = child_box.x2; + } - /* Chain up (store box) */ - CLUTTER_ACTOR_CLASS (e_mail_tab_picker_parent_class)-> - allocate (actor, box, flags); + /* Allocate for the chooser button */ + clutter_actor_get_preferred_width ( + CLUTTER_ACTOR (priv->chooser_button), + box->y2 - box->y1, NULL, &width); - /* Sync up the scroll-bar properties */ - g_object_set (G_OBJECT (priv->scroll_adjustment), - "page-increment", (gdouble)(box->x2 - box->x1), - "page-size", (gdouble)(box->x2 - box->x1), - "upper", (gdouble)total_width, + child_box.x2 = box->x2 - box->x1 - padding.right; + child_box.x1 = child_box.x2 - width; + child_box.y1 = 0; + child_box.y2 = child_box.y1 + height; + clutter_actor_allocate ( + CLUTTER_ACTOR (priv->chooser_button), &child_box, flags); + + /* Cache some useful size values */ + priv->width = (gint)(box->x2 - box->x1); + + priv->total_width = (gint)(total_width + padding.left + padding.right); + + old_max_offset = priv->max_offset; + priv->max_offset = + priv->total_width - priv->width + + (gint) (child_box.x2 - child_box.x1); + if (priv->max_offset < 0) + priv->max_offset = 0; + + /* Allocate for tab picker */ + old_scroll_offset = priv->scroll_offset; + priv->scroll_offset = CLAMP (priv->scroll_offset, 0, priv->max_offset); + e_mail_tab_picker_allocate_docked (tab_picker, box, &child_box, flags); + + /* Chain up (store box) */ + CLUTTER_ACTOR_CLASS (e_mail_tab_picker_parent_class)-> + allocate (actor, box, flags); + + /* Sync up the scroll-bar properties */ + g_object_set ( + priv->scroll_adjustment, + "page-increment", (gdouble)(box->x2 - box->x1), + "page-size", (gdouble)(box->x2 - box->x1), + "upper", (gdouble)total_width, NULL); - if ((priv->max_offset != old_max_offset) || - (priv->scroll_offset != old_scroll_offset)) - mx_adjustment_set_value (priv->scroll_adjustment, - (gdouble)priv->scroll_offset); + if ((priv->max_offset != old_max_offset) || + (priv->scroll_offset != old_scroll_offset)) + mx_adjustment_set_value ( + priv->scroll_adjustment, + (gdouble)priv->scroll_offset); + + /* Allocate for scroll-bar */ + clutter_actor_allocate ( + CLUTTER_ACTOR (priv->scroll_bar), &scroll_box, flags); - /* Allocate for scroll-bar */ - clutter_actor_allocate (CLUTTER_ACTOR (priv->scroll_bar), &scroll_box, flags); + /* Keep current tab visible */ + if (priv->keep_current_visible) { + EMailTabPickerProps *current; - /* Keep current tab visible */ - if (priv->keep_current_visible) - { - EMailTabPickerProps *current = - g_list_nth_data (priv->tabs, priv->current_tab); + current = g_list_nth_data (priv->tabs, priv->current_tab); - if ((current->position < priv->scroll_offset) || - (current->position + current->width >= priv->max_offset)) - e_mail_tab_picker_scroll_to (tab_picker, current->position, 150); - } + if ((current->position < priv->scroll_offset) || + (current->position + current->width >= priv->max_offset)) + e_mail_tab_picker_scroll_to ( + tab_picker, current->position, 150); + } } static void e_mail_tab_picker_map (ClutterActor *actor) { - GList *t; - EMailTabPickerPrivate *priv = E_MAIL_TAB_PICKER (actor)->priv; + GList *t; + EMailTabPickerPrivate *priv = E_MAIL_TAB_PICKER (actor)->priv; - CLUTTER_ACTOR_CLASS (e_mail_tab_picker_parent_class)->map (actor); + CLUTTER_ACTOR_CLASS (e_mail_tab_picker_parent_class)->map (actor); - clutter_actor_map (CLUTTER_ACTOR (priv->chooser_button)); - clutter_actor_map (CLUTTER_ACTOR (priv->close_button)); - clutter_actor_map (CLUTTER_ACTOR (priv->scroll_bar)); + clutter_actor_map (CLUTTER_ACTOR (priv->chooser_button)); + clutter_actor_map (CLUTTER_ACTOR (priv->close_button)); + clutter_actor_map (CLUTTER_ACTOR (priv->scroll_bar)); - for (t = priv->tabs; t; t = t->next) - { - EMailTabPickerProps *props = t->data; - clutter_actor_map (CLUTTER_ACTOR (props->tab)); - } + for (t = priv->tabs; t; t = t->next) { + EMailTabPickerProps *props = t->data; + clutter_actor_map (CLUTTER_ACTOR (props->tab)); + } } static void e_mail_tab_picker_unmap (ClutterActor *actor) { - GList *t; - EMailTabPickerPrivate *priv = E_MAIL_TAB_PICKER (actor)->priv; + GList *t; + EMailTabPickerPrivate *priv = E_MAIL_TAB_PICKER (actor)->priv; - CLUTTER_ACTOR_CLASS (e_mail_tab_picker_parent_class)->unmap (actor); + CLUTTER_ACTOR_CLASS (e_mail_tab_picker_parent_class)->unmap (actor); - clutter_actor_unmap (CLUTTER_ACTOR (priv->chooser_button)); - clutter_actor_unmap (CLUTTER_ACTOR (priv->close_button)); - clutter_actor_unmap (CLUTTER_ACTOR (priv->scroll_bar)); + clutter_actor_unmap (CLUTTER_ACTOR (priv->chooser_button)); + clutter_actor_unmap (CLUTTER_ACTOR (priv->close_button)); + clutter_actor_unmap (CLUTTER_ACTOR (priv->scroll_bar)); - for (t = priv->tabs; t; t = t->next) - { - EMailTabPickerProps *props = t->data; - clutter_actor_unmap (CLUTTER_ACTOR (props->tab)); - } + for (t = priv->tabs; t; t = t->next) { + EMailTabPickerProps *props = t->data; + clutter_actor_unmap (CLUTTER_ACTOR (props->tab)); + } } static void -e_mail_tab_picker_class_init (EMailTabPickerClass *klass) +e_mail_tab_picker_class_init (EMailTabPickerClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); - ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); - - g_type_class_add_private (klass, sizeof (EMailTabPickerPrivate)); - - object_class->get_property = e_mail_tab_picker_get_property; - object_class->set_property = e_mail_tab_picker_set_property; - object_class->dispose = e_mail_tab_picker_dispose; - object_class->finalize = e_mail_tab_picker_finalize; - - actor_class->paint = e_mail_tab_picker_paint; - actor_class->pick = e_mail_tab_picker_pick; - actor_class->get_preferred_width = e_mail_tab_picker_get_preferred_width; - actor_class->get_preferred_height = _e_mail_tab_picker_get_preferred_height; - actor_class->allocate = e_mail_tab_picker_allocate; - actor_class->map = e_mail_tab_picker_map; - actor_class->unmap = e_mail_tab_picker_unmap; - - g_object_class_install_property (object_class, - PROP_PREVIEW_MODE, - g_param_spec_boolean ("preview-mode", - "Preview mode", - "Whether to display " - "in preview mode.", - FALSE, - G_PARAM_READWRITE | - G_PARAM_STATIC_NAME | - G_PARAM_STATIC_NICK | - G_PARAM_STATIC_BLURB)); - - g_object_class_override_property (object_class, - PROP_DROP_ENABLED, - "drop-enabled"); - - signals[TAB_ACTIVATED] = - g_signal_new ("tab-activated", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMailTabPickerClass, tab_activated), - NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, E_MAIL_TYPE_TAB); - - signals[CHOOSER_CLICKED] = - g_signal_new ("chooser-clicked", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMailTabPickerClass, chooser_clicked), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); + GObjectClass *object_class = G_OBJECT_CLASS (class); + ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (class); + + g_type_class_add_private (class, sizeof (EMailTabPickerPrivate)); + + object_class->get_property = e_mail_tab_picker_get_property; + object_class->set_property = e_mail_tab_picker_set_property; + object_class->dispose = e_mail_tab_picker_dispose; + + actor_class->paint = e_mail_tab_picker_paint; + actor_class->pick = e_mail_tab_picker_pick; + actor_class->get_preferred_width = e_mail_tab_picker_get_preferred_width; + actor_class->get_preferred_height = _e_mail_tab_picker_get_preferred_height; + actor_class->allocate = e_mail_tab_picker_allocate; + actor_class->map = e_mail_tab_picker_map; + actor_class->unmap = e_mail_tab_picker_unmap; + + g_object_class_install_property ( + object_class, + PROP_PREVIEW_MODE, + g_param_spec_boolean ( + "preview-mode", + "Preview mode", + "Whether to display " + "in preview mode.", + FALSE, + G_PARAM_READWRITE | + G_PARAM_STATIC_NAME | + G_PARAM_STATIC_NICK | + G_PARAM_STATIC_BLURB)); + + g_object_class_override_property ( + object_class, + PROP_DROP_ENABLED, + "drop-enabled"); + + signals[TAB_ACTIVATED] = g_signal_new ( + "tab-activated", + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EMailTabPickerClass, tab_activated), + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, + E_MAIL_TYPE_TAB); + + signals[CHOOSER_CLICKED] = g_signal_new ( + "chooser-clicked", + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EMailTabPickerClass, chooser_clicked), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); } static void e_mail_tab_picker_chooser_clicked_cb (ClutterActor *button, - EMailTabPicker *self) + EMailTabPicker *self) { - g_signal_emit (self, signals[CHOOSER_CLICKED], 0); + g_signal_emit (self, signals[CHOOSER_CLICKED], 0); } static gboolean -e_mail_tab_picker_scroll_event_cb (ClutterActor *actor, - ClutterScrollEvent *event, - gpointer user_data) +e_mail_tab_picker_scroll_event_cb (ClutterActor *actor, + ClutterScrollEvent *event, + gpointer user_data) { - EMailTabPicker *self = E_MAIL_TAB_PICKER (actor); - EMailTabPickerPrivate *priv = self->priv; - - priv->keep_current_visible = FALSE; - - switch (event->direction) - { - case CLUTTER_SCROLL_UP : - case CLUTTER_SCROLL_LEFT : - e_mail_tab_picker_scroll_to (self, priv->scroll_end - 200, 150); - break; - - case CLUTTER_SCROLL_DOWN : - case CLUTTER_SCROLL_RIGHT : - e_mail_tab_picker_scroll_to (self, priv->scroll_end + 200, 150); - break; - } + EMailTabPicker *self = E_MAIL_TAB_PICKER (actor); + EMailTabPickerPrivate *priv = self->priv; + + priv->keep_current_visible = FALSE; + + switch (event->direction) { + case CLUTTER_SCROLL_UP : + case CLUTTER_SCROLL_LEFT : + e_mail_tab_picker_scroll_to ( + self, priv->scroll_end - 200, 150); + break; + + case CLUTTER_SCROLL_DOWN : + case CLUTTER_SCROLL_RIGHT : + e_mail_tab_picker_scroll_to ( + self, priv->scroll_end + 200, 150); + break; + } - return TRUE; + return TRUE; } static void -e_mail_tab_picker_scroll_value_cb (MxAdjustment *adjustment, - GParamSpec *pspec, - EMailTabPicker *picker) +e_mail_tab_picker_scroll_value_cb (MxAdjustment *adjustment, + GParamSpec *pspec, + EMailTabPicker *picker) { - EMailTabPickerPrivate *priv = picker->priv; - gdouble value = mx_adjustment_get_value (adjustment); - - if ((gint)value != priv->scroll_offset) - { - priv->keep_current_visible = FALSE; - priv->scroll_offset = (gint)value; - clutter_actor_queue_relayout (CLUTTER_ACTOR (picker)); - } + EMailTabPickerPrivate *priv = picker->priv; + gdouble value = mx_adjustment_get_value (adjustment); + + if ((gint) value != priv->scroll_offset) { + priv->keep_current_visible = FALSE; + priv->scroll_offset = (gint)value; + clutter_actor_queue_relayout (CLUTTER_ACTOR (picker)); + } } static void e_mail_tab_picker_init (EMailTabPicker *self) { - EMailTabPickerPrivate *priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, E_MAIL_TYPE_TAB_PICKER, EMailTabPickerPrivate); - - clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE); - - priv->chooser_button = mx_button_new (); - clutter_actor_set_name (CLUTTER_ACTOR (priv->chooser_button), - "chooser-button"); - clutter_actor_set_parent (CLUTTER_ACTOR (priv->chooser_button), - CLUTTER_ACTOR (self)); - - priv->close_button = mx_button_new (); - clutter_actor_set_name (CLUTTER_ACTOR (priv->close_button), - "chooser-close-button"); - clutter_actor_set_parent (CLUTTER_ACTOR (priv->close_button), - CLUTTER_ACTOR (self)); - clutter_actor_hide (CLUTTER_ACTOR (priv->close_button)); - - priv->scroll_adjustment = mx_adjustment_new_with_values (0, 0, 0, 100, 200, 200); - priv->scroll_bar = mx_scroll_bar_new_with_adjustment (priv->scroll_adjustment); - g_object_unref (priv->scroll_adjustment); - clutter_actor_set_parent (CLUTTER_ACTOR (priv->scroll_bar), - CLUTTER_ACTOR (self)); - clutter_actor_hide (CLUTTER_ACTOR (priv->scroll_bar)); - - g_signal_connect (priv->chooser_button, "clicked", - G_CALLBACK (e_mail_tab_picker_chooser_clicked_cb), self); - g_signal_connect (priv->close_button, "clicked", - G_CALLBACK (e_mail_tab_picker_chooser_clicked_cb), self); - g_signal_connect (self, "scroll-event", - G_CALLBACK (e_mail_tab_picker_scroll_event_cb), NULL); + EMailTabPickerPrivate *priv; + + priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + self, E_MAIL_TYPE_TAB_PICKER, EMailTabPickerPrivate); + + clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE); + + priv->chooser_button = mx_button_new (); + clutter_actor_set_name ( + CLUTTER_ACTOR (priv->chooser_button), "chooser-button"); + clutter_actor_set_parent ( + CLUTTER_ACTOR (priv->chooser_button), CLUTTER_ACTOR (self)); + + priv->close_button = mx_button_new (); + clutter_actor_set_name ( + CLUTTER_ACTOR (priv->close_button), "chooser-close-button"); + clutter_actor_set_parent ( + CLUTTER_ACTOR (priv->close_button), CLUTTER_ACTOR (self)); + clutter_actor_hide (CLUTTER_ACTOR (priv->close_button)); + + priv->scroll_adjustment = + mx_adjustment_new_with_values (0, 0, 0, 100, 200, 200); + priv->scroll_bar = + mx_scroll_bar_new_with_adjustment (priv->scroll_adjustment); + g_object_unref (priv->scroll_adjustment); + clutter_actor_set_parent ( + CLUTTER_ACTOR (priv->scroll_bar), CLUTTER_ACTOR (self)); + clutter_actor_hide (CLUTTER_ACTOR (priv->scroll_bar)); + + g_signal_connect ( + priv->chooser_button, "clicked", + G_CALLBACK (e_mail_tab_picker_chooser_clicked_cb), self); + g_signal_connect ( + priv->close_button, "clicked", + G_CALLBACK (e_mail_tab_picker_chooser_clicked_cb), self); + g_signal_connect ( + self, "scroll-event", + G_CALLBACK (e_mail_tab_picker_scroll_event_cb), NULL); } static gint e_mail_tab_picker_find_tab_cb (gconstpointer a, gconstpointer b) { - EMailTabPickerProps *props = (EMailTabPickerProps *)a; - EMailTab *tab = (EMailTab *)b; + EMailTabPickerProps *props = (EMailTabPickerProps *)a; + EMailTab *tab = (EMailTab *)b; - if (props->tab == tab) - return 0; - else - return -1; + return (props->tab == tab) ? 0 : -1; } static void e_mail_tab_picker_tab_clicked_cb (EMailTab *tab, EMailTabPicker *self) { - EMailTabPickerPrivate *priv = self->priv; - EMailTab *old_tab = - ((EMailTabPickerProps *)g_list_nth_data (priv->tabs, priv->current_tab))->tab; - GList *new_tab_link = g_list_find_custom (priv->tabs, tab, - e_mail_tab_picker_find_tab_cb); - - if (!new_tab_link) - return; - - priv->keep_current_visible = TRUE; - - /* If the same tab is clicked, make sure we remain active and return */ - if (tab == old_tab) - { - e_mail_tab_set_active (tab, TRUE); - if (priv->preview_mode) - g_signal_emit (self, signals[TAB_ACTIVATED], 0, tab); - return; - } + EMailTabPickerPrivate *priv = self->priv; + EMailTab *old_tab; + GList *new_tab_link; + + old_tab = ((EMailTabPickerProps *) g_list_nth_data ( + priv->tabs, priv->current_tab))->tab; + new_tab_link = g_list_find_custom ( + priv->tabs, tab, e_mail_tab_picker_find_tab_cb); + + if (!new_tab_link) + return; + + priv->keep_current_visible = TRUE; + + /* If the same tab is clicked, make sure we remain active and return */ + if (tab == old_tab) { + e_mail_tab_set_active (tab, TRUE); + if (priv->preview_mode) + g_signal_emit (self, signals[TAB_ACTIVATED], 0, tab); + return; + } - /* Deselect old tab */ - e_mail_tab_set_active (old_tab, FALSE); + /* Deselect old tab */ + e_mail_tab_set_active (old_tab, FALSE); - /* Set new tab */ - priv->current_tab = g_list_position (priv->tabs, new_tab_link); - g_signal_emit (self, signals[TAB_ACTIVATED], 0, tab); + /* Set new tab */ + priv->current_tab = g_list_position (priv->tabs, new_tab_link); + g_signal_emit (self, signals[TAB_ACTIVATED], 0, tab); } ClutterActor * e_mail_tab_picker_new (void) { - return g_object_new (E_MAIL_TYPE_TAB_PICKER, NULL); + return g_object_new (E_MAIL_TYPE_TAB_PICKER, NULL); } static void -e_mail_tab_picker_tab_drag_begin_cb (MxDraggable *draggable, - gfloat event_x, - gfloat event_y, - gint event_button, - ClutterModifierType modifiers, - EMailTabPicker *picker) +e_mail_tab_picker_tab_drag_begin_cb (MxDraggable *draggable, + gfloat event_x, + gfloat event_y, + gint event_button, + ClutterModifierType modifiers, + EMailTabPicker *picker) { - EMailTabPickerPrivate *priv = picker->priv; - priv->in_drag = TRUE; - - if (!priv->preview_mode) - { - e_mail_tab_picker_set_preview_mode (picker, TRUE); - priv->drag_preview = TRUE; - } + EMailTabPickerPrivate *priv = picker->priv; + priv->in_drag = TRUE; + + if (!priv->preview_mode) { + e_mail_tab_picker_set_preview_mode (picker, TRUE); + priv->drag_preview = TRUE; + } } static void -e_mail_tab_picker_tab_drag_end_cb (MxDraggable *draggable, - gfloat event_x, - gfloat event_y, - EMailTabPicker *picker) +e_mail_tab_picker_tab_drag_end_cb (MxDraggable *draggable, + gfloat event_x, + gfloat event_y, + EMailTabPicker *picker) { - EMailTabPickerPrivate *priv = picker->priv; - priv->in_drag = FALSE; - - if (priv->drag_preview) - { - e_mail_tab_picker_set_preview_mode (picker, FALSE); - priv->drag_preview = FALSE; - } + EMailTabPickerPrivate *priv = picker->priv; + priv->in_drag = FALSE; + + if (priv->drag_preview) { + e_mail_tab_picker_set_preview_mode (picker, FALSE); + priv->drag_preview = FALSE; + } } void -e_mail_tab_picker_add_tab (EMailTabPicker *picker, EMailTab *tab, gint position) +e_mail_tab_picker_add_tab (EMailTabPicker *picker, + EMailTab *tab, + gint position) { - EMailTabPickerProps *props; - EMailTabPickerPrivate *priv = picker->priv; - - if (priv->tabs && (priv->current_tab >= position)) - priv->current_tab++; - - props = g_slice_new (EMailTabPickerProps); - props->tab = tab; - priv->tabs = g_list_insert (priv->tabs, props, position); - priv->n_tabs++; - - clutter_actor_set_parent (CLUTTER_ACTOR (tab), CLUTTER_ACTOR (picker)); - mx_draggable_set_axis (MX_DRAGGABLE (tab), MX_DRAG_AXIS_X); - - g_signal_connect_after (tab, "clicked", - G_CALLBACK (e_mail_tab_picker_tab_clicked_cb), picker); - g_signal_connect (tab, "drag-begin", - G_CALLBACK (e_mail_tab_picker_tab_drag_begin_cb), picker); - g_signal_connect (tab, "drag-end", - G_CALLBACK (e_mail_tab_picker_tab_drag_end_cb), picker); - - e_mail_tab_set_preview_mode (tab, priv->preview_mode); - clutter_actor_queue_relayout (CLUTTER_ACTOR (picker)); + EMailTabPickerProps *props; + EMailTabPickerPrivate *priv = picker->priv; + + if (priv->tabs && (priv->current_tab >= position)) + priv->current_tab++; + + props = g_slice_new (EMailTabPickerProps); + props->tab = tab; + priv->tabs = g_list_insert (priv->tabs, props, position); + priv->n_tabs++; + + clutter_actor_set_parent (CLUTTER_ACTOR (tab), CLUTTER_ACTOR (picker)); + mx_draggable_set_axis (MX_DRAGGABLE (tab), MX_DRAG_AXIS_X); + + g_signal_connect_after ( + tab, "clicked", + G_CALLBACK (e_mail_tab_picker_tab_clicked_cb), picker); + g_signal_connect ( + tab, "drag-begin", + G_CALLBACK (e_mail_tab_picker_tab_drag_begin_cb), picker); + g_signal_connect ( + tab, "drag-end", + G_CALLBACK (e_mail_tab_picker_tab_drag_end_cb), picker); + + e_mail_tab_set_preview_mode (tab, priv->preview_mode); + clutter_actor_queue_relayout (CLUTTER_ACTOR (picker)); } void e_mail_tab_picker_remove_tab (EMailTabPicker *picker, EMailTab *tab) { - GList *tab_link; - EMailTabPickerPrivate *priv = picker->priv; - - tab_link = g_list_find_custom (priv->tabs, tab, e_mail_tab_picker_find_tab_cb); - - if (!tab_link) - return; - - g_signal_handlers_disconnect_by_func (tab, - e_mail_tab_picker_tab_clicked_cb, - picker); - g_signal_handlers_disconnect_by_func (tab, - e_mail_tab_picker_tab_drag_begin_cb, - picker); - g_signal_handlers_disconnect_by_func (tab, - e_mail_tab_picker_tab_drag_end_cb, - picker); - - /* We don't want to do this during dispose, checking if chooser_button - * exists is a way of checking if we're in dispose without keeping an - * extra variable around. - */ - if (priv->chooser_button) - { - gint position = g_list_position (priv->tabs, tab_link); - if (priv->current_tab) - { - if (priv->current_tab > position) - priv->current_tab--; - else if (priv->current_tab == position) - e_mail_tab_picker_set_current_tab (picker, priv->current_tab - 1); + GList *tab_link; + EMailTabPickerPrivate *priv = picker->priv; + + tab_link = g_list_find_custom ( + priv->tabs, tab, e_mail_tab_picker_find_tab_cb); + + if (!tab_link) + return; + + g_signal_handlers_disconnect_by_func ( + tab, e_mail_tab_picker_tab_clicked_cb, picker); + g_signal_handlers_disconnect_by_func ( + tab, e_mail_tab_picker_tab_drag_begin_cb, picker); + g_signal_handlers_disconnect_by_func ( + tab, e_mail_tab_picker_tab_drag_end_cb, picker); + + /* We don't want to do this during dispose, checking if chooser_button + * exists is a way of checking if we're in dispose without keeping an + * extra variable around. */ + if (priv->chooser_button) { + gint position = g_list_position (priv->tabs, tab_link); + if (priv->current_tab) { + if (priv->current_tab > position) + 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--; + } } - else if (priv->tabs->next && (position == 0)) - { - e_mail_tab_picker_set_current_tab (picker, priv->current_tab + 1); - 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--; + 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--; - clutter_actor_queue_relayout (CLUTTER_ACTOR (picker)); + clutter_actor_queue_relayout (CLUTTER_ACTOR (picker)); } GList * e_mail_tab_picker_get_tabs (EMailTabPicker *picker) { - GList *tab_list, *t; + GList *tab_list, *t; - EMailTabPickerPrivate *priv = picker->priv; + EMailTabPickerPrivate *priv = picker->priv; - tab_list = NULL; - for (t = g_list_last (priv->tabs); t; t = t->prev) - { - EMailTabPickerProps *props = t->data; - tab_list = g_list_prepend (tab_list, props->tab); - } + tab_list = NULL; + for (t = g_list_last (priv->tabs); t; t = t->prev) { + EMailTabPickerProps *props = t->data; + tab_list = g_list_prepend (tab_list, props->tab); + } - return tab_list; + return tab_list; } EMailTab * e_mail_tab_picker_get_tab (EMailTabPicker *picker, gint tab) { - EMailTabPickerProps *props = g_list_nth_data (picker->priv->tabs, tab); - return props->tab; + EMailTabPickerProps *props = g_list_nth_data (picker->priv->tabs, tab); + return props->tab; } gint e_mail_tab_picker_get_tab_no (EMailTabPicker *picker, EMailTab *tab) { - GList *tab_link = g_list_find_custom (picker->priv->tabs, tab, - e_mail_tab_picker_find_tab_cb); - return g_list_position (picker->priv->tabs, tab_link); + GList *tab_link; + + tab_link = g_list_find_custom ( + picker->priv->tabs, tab, + e_mail_tab_picker_find_tab_cb); + + return g_list_position (picker->priv->tabs, tab_link); } gint e_mail_tab_picker_get_current_tab (EMailTabPicker *picker) { - return picker->priv->current_tab; + return picker->priv->current_tab; } void e_mail_tab_picker_set_current_tab (EMailTabPicker *picker, gint tab_no) { - EMailTabPickerPrivate *priv = picker->priv; - EMailTabPickerProps *props; + EMailTabPickerPrivate *priv = picker->priv; + EMailTabPickerProps *props; - printf("OLD %d new %d\n", priv->current_tab, tab_no); - if (priv->n_tabs == 0) - return; + printf("OLD %d new %d\n", priv->current_tab, tab_no); + if (priv->n_tabs == 0) + return; - if (ABS (tab_no) >= priv->n_tabs) - return; + if (ABS (tab_no) >= priv->n_tabs) + return; - if (tab_no < 0) - tab_no = priv->n_tabs + tab_no; + if (tab_no < 0) + tab_no = priv->n_tabs + tab_no; - props = g_list_nth_data (priv->tabs, (guint)tab_no); + props = g_list_nth_data (priv->tabs, (guint)tab_no); - if (props) - { - e_mail_tab_picker_tab_clicked_cb (props->tab, picker); - e_mail_tab_set_active (props->tab, TRUE); - } + if (props) { + e_mail_tab_picker_tab_clicked_cb (props->tab, picker); + e_mail_tab_set_active (props->tab, TRUE); + } } void e_mail_tab_picker_reorder (EMailTabPicker *picker, - gint old_position, - gint new_position) + gint old_position, + gint new_position) { - GList *link; - gpointer data; - - EMailTabPickerPrivate *priv = picker->priv; - - if (old_position == new_position) - return; - - if (!(link = g_list_nth (priv->tabs, old_position))) - return; - - data = link->data; - priv->tabs = g_list_delete_link (priv->tabs, link); - priv->tabs = g_list_insert (priv->tabs, data, new_position); - - if (priv->current_tab == old_position) - { - if (new_position < 0) - priv->current_tab = priv->n_tabs - 1; - else - priv->current_tab = CLAMP (new_position, 0, priv->n_tabs - 1); - } - else if ((priv->current_tab > old_position) && - (new_position >= priv->current_tab)) - priv->current_tab--; - else if ((priv->current_tab < old_position) && - (new_position <= priv->current_tab)) - priv->current_tab++; - - clutter_actor_queue_relayout (CLUTTER_ACTOR (picker)); + GList *link; + gpointer data; + + EMailTabPickerPrivate *priv = picker->priv; + + if (old_position == new_position) + return; + + if (!(link = g_list_nth (priv->tabs, old_position))) + return; + + data = link->data; + priv->tabs = g_list_delete_link (priv->tabs, link); + priv->tabs = g_list_insert (priv->tabs, data, new_position); + + if (priv->current_tab == old_position) { + if (new_position < 0) + priv->current_tab = priv->n_tabs - 1; + else + priv->current_tab = CLAMP ( + new_position, 0, priv->n_tabs - 1); + } else if ((priv->current_tab > old_position) && + (new_position >= priv->current_tab)) + priv->current_tab--; + else if ((priv->current_tab < old_position) && + (new_position <= priv->current_tab)) + priv->current_tab++; + + clutter_actor_queue_relayout (CLUTTER_ACTOR (picker)); } gint e_mail_tab_picker_get_n_tabs (EMailTabPicker *picker) { - return picker->priv->n_tabs; + return picker->priv->n_tabs; } static void preview_new_frame_cb (ClutterTimeline *timeline, - guint msecs, - EMailTabPicker *picker) + guint msecs, + EMailTabPicker *picker) { - picker->priv->preview_progress = clutter_timeline_get_progress (timeline); - clutter_actor_queue_relayout (CLUTTER_ACTOR (picker)); + picker->priv->preview_progress = + clutter_timeline_get_progress (timeline); + clutter_actor_queue_relayout (CLUTTER_ACTOR (picker)); } static void preview_completed_cb (ClutterTimeline *timeline, - EMailTabPicker *picker) + EMailTabPicker *picker) { - EMailTabPickerPrivate *priv = picker->priv; - - if (priv->preview_timeline) - { - g_object_unref (priv->preview_timeline); - priv->preview_timeline = NULL; - - if (priv->preview_mode) - { - priv->preview_progress = 1.0; - clutter_actor_hide (CLUTTER_ACTOR (priv->chooser_button)); - } - else - { - priv->preview_progress = 0.0; - clutter_actor_hide (CLUTTER_ACTOR (priv->scroll_bar)); - clutter_actor_hide (CLUTTER_ACTOR (priv->close_button)); + EMailTabPickerPrivate *priv = picker->priv; + + if (priv->preview_timeline) { + g_object_unref (priv->preview_timeline); + priv->preview_timeline = NULL; + + if (priv->preview_mode) { + priv->preview_progress = 1.0; + clutter_actor_hide ( + CLUTTER_ACTOR (priv->chooser_button)); + } else { + priv->preview_progress = 0.0; + clutter_actor_hide (CLUTTER_ACTOR (priv->scroll_bar)); + clutter_actor_hide (CLUTTER_ACTOR (priv->close_button)); + } + + clutter_actor_queue_relayout (CLUTTER_ACTOR (picker)); } - clutter_actor_queue_relayout (CLUTTER_ACTOR (picker)); - } } void e_mail_tab_picker_set_preview_mode (EMailTabPicker *picker, gboolean preview) { - GList *t; + GList *t; - EMailTabPickerPrivate *priv = picker->priv; + EMailTabPickerPrivate *priv = picker->priv; - if (priv->preview_mode == preview) - return; + if (priv->preview_mode == preview) + return; - priv->preview_mode = preview; + priv->preview_mode = preview; - /* Put all tabs in preview mode */ - for (t = priv->tabs; t; t = t->next) - { - EMailTabPickerProps *prop = t->data; - e_mail_tab_set_preview_mode (prop->tab, preview); - } + /* Put all tabs in preview mode */ + for (t = priv->tabs; t; t = t->next) { + EMailTabPickerProps *prop = t->data; + e_mail_tab_set_preview_mode (prop->tab, preview); + } - /* Slide in the scroll-bar */ - if (!priv->preview_timeline) - { - if (preview) - clutter_actor_show (CLUTTER_ACTOR (priv->scroll_bar)); + /* Slide in the scroll-bar */ + if (!priv->preview_timeline) { + if (preview) + clutter_actor_show (CLUTTER_ACTOR (priv->scroll_bar)); - priv->preview_timeline = clutter_timeline_new (150); - g_signal_connect (priv->preview_timeline, "new-frame", + priv->preview_timeline = clutter_timeline_new (150); + g_signal_connect ( + priv->preview_timeline, "new-frame", G_CALLBACK (preview_new_frame_cb), picker); - g_signal_connect (priv->preview_timeline, "completed", + g_signal_connect ( + priv->preview_timeline, "completed", G_CALLBACK (preview_completed_cb), picker); - clutter_timeline_start (priv->preview_timeline); - } - clutter_timeline_set_direction (priv->preview_timeline, - preview ? CLUTTER_TIMELINE_FORWARD : - CLUTTER_TIMELINE_BACKWARD); - - /* Connect/disconnect the scrollbar */ - if (preview) - g_signal_connect (priv->scroll_adjustment, "notify::value", - G_CALLBACK (e_mail_tab_picker_scroll_value_cb), picker); - else - g_signal_handlers_disconnect_by_func (priv->scroll_adjustment, - e_mail_tab_picker_scroll_value_cb, - picker); - - if (preview) - { - /* Fade out the chooser button show close button */ - clutter_actor_animate (CLUTTER_ACTOR (priv->chooser_button), - CLUTTER_EASE_IN_OUT_QUAD, 150, - "opacity", 0x00, - NULL); - clutter_actor_show (CLUTTER_ACTOR (priv->close_button)); - } - else - { - /* Fade in the chooser button */ - clutter_actor_show (CLUTTER_ACTOR (priv->chooser_button)); - clutter_actor_animate (CLUTTER_ACTOR (priv->chooser_button), - CLUTTER_EASE_IN_OUT_QUAD, 150, - "opacity", 0xff, - NULL); - } - clutter_actor_set_reactive (CLUTTER_ACTOR (priv->chooser_button), !preview); - - /* Remove the hover state, which likely got stuck when we clicked it */ - if (!preview) - mx_stylable_set_style_pseudo_class (MX_STYLABLE (priv->chooser_button), - NULL); - - g_object_notify (G_OBJECT (picker), "preview-mode"); + clutter_timeline_start (priv->preview_timeline); + } + + clutter_timeline_set_direction ( + priv->preview_timeline, + preview ? CLUTTER_TIMELINE_FORWARD : + CLUTTER_TIMELINE_BACKWARD); + + /* Connect/disconnect the scrollbar */ + if (preview) + g_signal_connect ( + priv->scroll_adjustment, "notify::value", + G_CALLBACK (e_mail_tab_picker_scroll_value_cb), picker); + else + g_signal_handlers_disconnect_by_func ( + priv->scroll_adjustment, + e_mail_tab_picker_scroll_value_cb, picker); + + if (preview) { + /* Fade out the chooser button show close button */ + clutter_actor_animate ( + CLUTTER_ACTOR (priv->chooser_button), + CLUTTER_EASE_IN_OUT_QUAD, 150, + "opacity", 0x00, NULL); + clutter_actor_show (CLUTTER_ACTOR (priv->close_button)); + } else { + /* Fade in the chooser button */ + clutter_actor_show (CLUTTER_ACTOR (priv->chooser_button)); + clutter_actor_animate ( + CLUTTER_ACTOR (priv->chooser_button), + CLUTTER_EASE_IN_OUT_QUAD, 150, + "opacity", 0xff, NULL); + } + + clutter_actor_set_reactive ( + CLUTTER_ACTOR (priv->chooser_button), !preview); + + /* Remove the hover state, which likely got stuck when we clicked it */ + if (!preview) + mx_stylable_set_style_pseudo_class ( + MX_STYLABLE (priv->chooser_button), NULL); + + g_object_notify (G_OBJECT (picker), "preview-mode"); } gboolean e_mail_tab_picker_get_preview_mode (EMailTabPicker *picker) { - EMailTabPickerPrivate *priv = picker->priv; - return priv->preview_mode; + EMailTabPickerPrivate *priv = picker->priv; + return priv->preview_mode; } void e_mail_tab_picker_enable_drop (EMailTabPicker *picker, gboolean enable) { - EMailTabPickerPrivate *priv = picker->priv; + EMailTabPickerPrivate *priv = picker->priv; - if (priv->drop_enabled == enable) - return; + if (priv->drop_enabled == enable) + return; - priv->drop_enabled = enable; - if (enable) - mx_droppable_enable (MX_DROPPABLE (picker)); - else - mx_droppable_disable (MX_DROPPABLE (picker)); + priv->drop_enabled = enable; + if (enable) + mx_droppable_enable (MX_DROPPABLE (picker)); + else + mx_droppable_disable (MX_DROPPABLE (picker)); - g_object_notify (G_OBJECT (picker), "enabled"); + g_object_notify (G_OBJECT (picker), "enabled"); } diff --git a/mail/e-mail-tab.c b/mail/e-mail-tab.c index aefe49f1df..a0dfad2602 100644 --- a/mail/e-mail-tab.c +++ b/mail/e-mail-tab.c @@ -1306,8 +1306,10 @@ e_mail_tab_init (EMailTab *self) { ClutterActor *text; GtkSettings *settings; + EMailTabPrivate *priv; - EMailTabPrivate *priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, E_MAIL_TYPE_TAB, EMailTabPrivate); + priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + self, E_MAIL_TYPE_TAB, EMailTabPrivate); priv->width = -1; priv->anim_length = 200; diff --git a/mail/e-mail-tag-editor.c b/mail/e-mail-tag-editor.c index 5cc29b5bde..d1ef428bc3 100644 --- a/mail/e-mail-tag-editor.c +++ b/mail/e-mail-tag-editor.c @@ -281,7 +281,8 @@ mail_tag_editor_init (EMailTagEditor *editor) GtkCellRenderer *renderer; GtkListStore *store; - editor->priv = G_TYPE_INSTANCE_GET_PRIVATE (editor, E_TYPE_MAIL_TAG_EDITOR, EMailTagEditorPrivate); + editor->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + editor, E_TYPE_MAIL_TAG_EDITOR, EMailTagEditorPrivate); dialog = GTK_DIALOG (editor); window = GTK_WINDOW (editor); diff --git a/mail/e-mail-view.c b/mail/e-mail-view.c index 0db537bd02..d1a3503329 100644 --- a/mail/e-mail-view.c +++ b/mail/e-mail-view.c @@ -319,7 +319,8 @@ e_mail_view_class_init (EMailViewClass *class) static void e_mail_view_init (EMailView *view) { - view->priv = G_TYPE_INSTANCE_GET_PRIVATE (view, E_TYPE_MAIL_VIEW, EMailViewPrivate); + view->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + view, E_TYPE_MAIL_VIEW, EMailViewPrivate); } EShellView * diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c index 0c2e2744c0..d4a892efde 100644 --- a/mail/em-account-editor.c +++ b/mail/em-account-editor.c @@ -429,7 +429,8 @@ emae_class_init (GObjectClass *class) static void emae_init (EMAccountEditor *emae) { - emae->priv = G_TYPE_INSTANCE_GET_PRIVATE (emae, EM_TYPE_ACCOUNT_EDITOR, EMAccountEditorPrivate); + emae->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + emae, EM_TYPE_ACCOUNT_EDITOR, EMAccountEditorPrivate); emae->priv->selected_server = NULL; emae->emae_check_servers = emae_check_servers; diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index 40609f0f24..752a78af07 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -69,7 +69,8 @@ #define gmtime_r(tp,tmp) (gmtime(tp)?(*(tmp)=*gmtime(tp),(tmp)):0) #endif -#define GCONF_KEY_TEMPLATE_PLACEHOLDERS "/apps/evolution/mail/template_placeholders" +#define GCONF_KEY_TEMPLATE_PLACEHOLDERS \ + "/apps/evolution/mail/template_placeholders" typedef struct _AsyncContext AsyncContext; typedef struct _ForwardData ForwardData; @@ -126,13 +127,14 @@ forward_data_free (ForwardData *data) } static gboolean -ask_confirm_for_unwanted_html_mail (EMsgComposer *composer, EDestination **recipients) +ask_confirm_for_unwanted_html_mail (EMsgComposer *composer, + EDestination **recipients) { gboolean res; GString *str; gint i; - str = g_string_new(""); + str = g_string_new (""); for (i = 0; recipients[i] != NULL; ++i) { if (!e_destination_get_html_mail_pref (recipients[i])) { const gchar *name; @@ -144,8 +146,10 @@ ask_confirm_for_unwanted_html_mail (EMsgComposer *composer, EDestination **recip } if (str->len) - res = em_utils_prompt_user((GtkWindow *)composer,"/apps/evolution/mail/prompts/unwanted_html", - "mail:ask-send-html", str->str, NULL); + res = em_utils_prompt_user ( + GTK_WINDOW (composer), + "/apps/evolution/mail/prompts/unwanted_html", + "mail:ask-send-html", str->str, NULL); else res = TRUE; @@ -157,12 +161,15 @@ ask_confirm_for_unwanted_html_mail (EMsgComposer *composer, EDestination **recip static gboolean ask_confirm_for_empty_subject (EMsgComposer *composer) { - return em_utils_prompt_user((GtkWindow *)composer, "/apps/evolution/mail/prompts/empty_subject", - "mail:ask-send-no-subject", NULL); + return em_utils_prompt_user ( + GTK_WINDOW (composer), + "/apps/evolution/mail/prompts/empty_subject", + "mail:ask-send-no-subject", NULL); } static gboolean -ask_confirm_for_only_bcc (EMsgComposer *composer, gboolean hidden_list_case) +ask_confirm_for_only_bcc (EMsgComposer *composer, + gboolean hidden_list_case) { /* If the user is mailing a hidden contact list, it is possible for them to create a message with only Bcc recipients without really @@ -170,8 +177,12 @@ ask_confirm_for_only_bcc (EMsgComposer *composer, gboolean hidden_list_case) this dialog to provide slightly different text in that case, to better explain what the hell is going on. */ - return em_utils_prompt_user((GtkWindow *)composer, "/apps/evolution/mail/prompts/only_bcc", - hidden_list_case?"mail:ask-send-only-bcc-contact":"mail:ask-send-only-bcc", NULL); + return em_utils_prompt_user ( + GTK_WINDOW (composer), + "/apps/evolution/mail/prompts/only_bcc", + hidden_list_case ? + "mail:ask-send-only-bcc-contact" : + "mail:ask-send-only-bcc", NULL); } static gboolean @@ -1112,10 +1123,14 @@ edit_message (EShell *shell, gconf = gconf_client_get_default (); /* Get the list from gconf */ - clue_list = gconf_client_get_list ( gconf, GCONF_KEY_TEMPLATE_PLACEHOLDERS, GCONF_VALUE_STRING, NULL ); + clue_list = gconf_client_get_list ( + gconf, GCONF_KEY_TEMPLATE_PLACEHOLDERS, + GCONF_VALUE_STRING, NULL ); g_object_unref (gconf); - traverse_parts (clue_list, message, camel_medium_get_content (CAMEL_MEDIUM (message))); + traverse_parts ( + clue_list, message, + camel_medium_get_content (CAMEL_MEDIUM (message))); g_slist_foreach (clue_list, (GFunc) g_free, NULL); g_slist_free (clue_list); @@ -1140,7 +1155,11 @@ edit_message (EShell *shell, return (GtkWidget *)composer; } -typedef enum { QUOTING_ATTRIBUTION, QUOTING_FORWARD, QUOTING_ORIGINAL } QuotingTextEnum; +typedef enum { + QUOTING_ATTRIBUTION, + QUOTING_FORWARD, + QUOTING_ORIGINAL +} QuotingTextEnum; static struct { const gchar * gconf_key; @@ -1151,7 +1170,8 @@ static struct { /* Note to translators: this is the attribution string used when quoting messages. * each ${Variable} gets replaced with a value. To see a full list of available * variables, see mail/em-composer-utils.c:attribvars array */ - N_("On ${AbbrevWeekdayName}, ${Year}-${Month}-${Day} at ${24Hour}:${Minute} ${TimeZone}, ${Sender} wrote:") + N_("On ${AbbrevWeekdayName}, ${Year}-${Month}-${Day} at " + "${24Hour}:${Minute} ${TimeZone}, ${Sender} wrote:") }, [QUOTING_FORWARD] = @@ -1421,7 +1441,8 @@ forward_non_attached (EShell *shell, subject = mail_tool_generate_forward_subject (message); forward = quoting_text (QUOTING_FORWARD); - text = em_utils_message_to_html (message, forward, flags, NULL, NULL, &validity_found); + text = em_utils_message_to_html ( + message, forward, flags, NULL, NULL, &validity_found); if (text) { composer = create_new_composer (shell, subject, from_uri); @@ -1773,15 +1794,23 @@ em_utils_send_receipt (EMailSession *session, CamelStream *stream; CamelFolder *out_folder; CamelMessageInfo *info; - const gchar *message_id = camel_medium_get_header (CAMEL_MEDIUM (message), "Message-ID"); - const gchar *message_date = camel_medium_get_header (CAMEL_MEDIUM (message), "Date"); - const gchar *message_subject = camel_mime_message_get_subject (message); - const gchar *receipt_address = camel_medium_get_header (CAMEL_MEDIUM (message), "Disposition-Notification-To"); + const gchar *message_id; + const gchar *message_date; + const gchar *message_subject; + const gchar *receipt_address; gchar *fake_msgid; gchar *hostname; gchar *self_address, *receipt_subject; gchar *ua, *recipient; + message_id = camel_medium_get_header ( + CAMEL_MEDIUM (message), "Message-ID"); + message_date = camel_medium_get_header ( + CAMEL_MEDIUM (message), "Date"); + message_subject = camel_mime_message_get_subject (message); + receipt_address = camel_medium_get_header ( + CAMEL_MEDIUM (message), "Disposition-Notification-To"); + if (!receipt_address) return; @@ -1817,16 +1846,18 @@ em_utils_send_receipt (EMailSession *session, camel_content_type_unref (type); stream = camel_stream_mem_new (); camel_stream_printf (stream, - /* Translators: First %s is an email address, second %s is the subject of the email, third %s is the date */ - _("Your message to %s about \"%s\" on %s has been read."), - self_address, message_subject, message_date); + /* Translators: First %s is an email address, second %s + * is the subject of the email, third %s is the date. */ + _("Your message to %s about \"%s\" on %s has been read."), + self_address, message_subject, message_date); camel_data_wrapper_construct_from_stream_sync ( receipt_text, stream, NULL, NULL); g_object_unref (stream); part = camel_mime_part_new (); camel_medium_set_content (CAMEL_MEDIUM (part), receipt_text); - camel_mime_part_set_encoding (part, CAMEL_TRANSFER_ENCODING_QUOTEDPRINTABLE); + camel_mime_part_set_encoding ( + part, CAMEL_TRANSFER_ENCODING_QUOTEDPRINTABLE); g_object_unref (receipt_text); camel_multipart_add_part (body, part); g_object_unref (part); @@ -1835,7 +1866,9 @@ em_utils_send_receipt (EMailSession *session, receipt_data = camel_data_wrapper_new (); part = camel_mime_part_new (); - ua = g_strdup_printf ("%s; %s", hostname, "Evolution " VERSION SUB_VERSION " " VERSION_COMMENT); + ua = g_strdup_printf ( + "%s; %s", hostname, "Evolution " + VERSION SUB_VERSION " " VERSION_COMMENT); recipient = g_strdup_printf ("rfc822; %s", self_address); type = camel_content_type_new ("message", "disposition-notification"); @@ -1868,7 +1901,8 @@ em_utils_send_receipt (EMailSession *session, g_object_unref (body); /* Translators: %s is the subject of the email message */ - receipt_subject = g_strdup_printf (_("Delivery Notification for: \"%s\""), message_subject); + receipt_subject = g_strdup_printf ( + _("Delivery Notification for: \"%s\""), message_subject); camel_mime_message_set_subject (receipt, receipt_subject); g_free (receipt_subject); @@ -1882,10 +1916,21 @@ em_utils_send_receipt (EMailSession *session, camel_mime_message_set_recipients (receipt, CAMEL_RECIPIENT_TYPE_TO, addr); g_object_unref (addr); - camel_medium_set_header (CAMEL_MEDIUM (receipt), "Return-Path", "<>"); - camel_medium_set_header (CAMEL_MEDIUM (receipt), "X-Evolution-Account", account->uid); - camel_medium_set_header (CAMEL_MEDIUM (receipt), "X-Evolution-Transport", account->transport->url); - camel_medium_set_header (CAMEL_MEDIUM (receipt), "X-Evolution-Fcc", account->sent_folder_uri); + camel_medium_set_header ( + CAMEL_MEDIUM (receipt), + "Return-Path", "<>"); + camel_medium_set_header ( + CAMEL_MEDIUM (receipt), + "X-Evolution-Account", + account->uid); + camel_medium_set_header ( + CAMEL_MEDIUM (receipt), + "X-Evolution-Transport", + account->transport->url); + camel_medium_set_header ( + CAMEL_MEDIUM (receipt), + "X-Evolution-Fcc", + account->sent_folder_uri); /* Send the receipt */ info = camel_message_info_new (NULL); @@ -1966,7 +2011,8 @@ reply_get_composer (EShell *shell, /* Set the subject of the new message. */ if ((subject = (gchar *) camel_mime_message_get_subject (message))) { - if (g_ascii_strncasecmp (subject, "Re: ", 4) != 0 && g_ascii_strncasecmp (subject, "Re : ", 5) != 0) + if (g_ascii_strncasecmp (subject, "Re: ", 4) != 0 && + g_ascii_strncasecmp (subject, "Re : ", 5) != 0) subject = g_strdup_printf ("Re: %s", subject); else if (g_ascii_strncasecmp (subject, "Re : ", 5) == 0) subject = g_strdup_printf ("Re: %s", subject + 5); @@ -2085,7 +2131,8 @@ em_utils_is_munged_list_message (CamelMimeMessage *message) list = camel_internet_address_new (); if (get_reply_list (message, list) && - camel_address_length (CAMEL_ADDRESS (list)) == camel_address_length (CAMEL_ADDRESS (reply_to))) { + camel_address_length (CAMEL_ADDRESS (list)) == + camel_address_length (CAMEL_ADDRESS (reply_to))) { gint i; const gchar *r_name, *r_addr; const gchar *l_name, *l_addr; @@ -2132,7 +2179,9 @@ get_reply_to (CamelMimeMessage *message) } static void -get_reply_sender (CamelMimeMessage *message, CamelInternetAddress *to, CamelNNTPAddress *postto) +get_reply_sender (CamelMimeMessage *message, + CamelInternetAddress *to, + CamelNNTPAddress *postto) { CamelInternetAddress *reply_to; const gchar *name, *addr, *posthdr; @@ -2155,13 +2204,17 @@ get_reply_sender (CamelMimeMessage *message, CamelInternetAddress *to, CamelNNTP } void -em_utils_get_reply_sender (CamelMimeMessage *message, CamelInternetAddress *to, CamelNNTPAddress *postto) +em_utils_get_reply_sender (CamelMimeMessage *message, + CamelInternetAddress *to, + CamelNNTPAddress *postto) { get_reply_sender (message, to, postto); } static void -get_reply_from (CamelMimeMessage *message, CamelInternetAddress *to, CamelNNTPAddress *postto) +get_reply_from (CamelMimeMessage *message, + CamelInternetAddress *to, + CamelNNTPAddress *postto) { CamelInternetAddress *from; const gchar *name, *addr, *posthdr; @@ -2184,7 +2237,9 @@ get_reply_from (CamelMimeMessage *message, CamelInternetAddress *to, CamelNNTPAd } static void -concat_unique_addrs (CamelInternetAddress *dest, CamelInternetAddress *src, GHashTable *rcpt_hash) +concat_unique_addrs (CamelInternetAddress *dest, + CamelInternetAddress *src, + GHashTable *rcpt_hash) { const gchar *name, *addr; gint i; @@ -2198,7 +2253,10 @@ concat_unique_addrs (CamelInternetAddress *dest, CamelInternetAddress *src, GHas } static void -get_reply_all (CamelMimeMessage *message, CamelInternetAddress *to, CamelInternetAddress *cc, CamelNNTPAddress *postto) +get_reply_all (CamelMimeMessage *message, + CamelInternetAddress *to, + CamelInternetAddress *cc, + CamelNNTPAddress *postto) { CamelInternetAddress *reply_to, *to_addrs, *cc_addrs; const gchar *name, *addr, *posthdr; @@ -2236,14 +2294,16 @@ get_reply_all (CamelMimeMessage *message, CamelInternetAddress *to, CamelInterne concat_unique_addrs (cc, to_addrs, rcpt_hash); concat_unique_addrs (cc, cc_addrs, rcpt_hash); - /* promote the first Cc: address to To: if To: is empty */ - if (camel_address_length ((CamelAddress *) to) == 0 && camel_address_length ((CamelAddress *)cc) > 0) { + /* Promote the first Cc: address to To: if To: is empty. */ + if (camel_address_length ((CamelAddress *) to) == 0 && + camel_address_length ((CamelAddress *)cc) > 0) { camel_internet_address_get (cc, 0, &name, &addr); camel_internet_address_add (to, name, addr); camel_address_remove ((CamelAddress *)cc, 0); } - /* if To: is still empty, may we removed duplicates (i.e. ourself), so add the original To if it was set */ + /* If To: is still empty, may we removed duplicates (i.e. ourself), + * so add the original To if it was set. */ if (camel_address_length ((CamelAddress *)to) == 0 && (camel_internet_address_get (to_addrs, 0, &name, &addr) || camel_internet_address_get (cc_addrs, 0, &name, &addr))) { @@ -2254,7 +2314,10 @@ get_reply_all (CamelMimeMessage *message, CamelInternetAddress *to, CamelInterne } void -em_utils_get_reply_all (CamelMimeMessage *message, CamelInternetAddress *to, CamelInternetAddress *cc, CamelNNTPAddress *postto) +em_utils_get_reply_all (CamelMimeMessage *message, + CamelInternetAddress *to, + CamelInternetAddress *cc, + CamelNNTPAddress *postto) { get_reply_all (message, to, cc, postto); } @@ -2276,7 +2339,9 @@ enum { ATTRIB_TM_YDAY }; -typedef void (* AttribFormatter) (GString *str, const gchar *attr, CamelMimeMessage *message); +typedef void (*AttribFormatter) (GString *str, + const gchar *attr, + CamelMimeMessage *message); static void format_sender (GString *str, const gchar *attr, CamelMimeMessage *message) @@ -2310,26 +2375,26 @@ static struct { AttribFormatter formatter; /* custom formatter */ } v; } attribvars[] = { - { "{Sender}", ATTRIB_CUSTOM, { NULL, format_sender } }, - { "{SenderName}", ATTRIB_CUSTOM, { NULL, format_sender } }, - { "{SenderEMail}", ATTRIB_CUSTOM, { NULL, format_sender } }, - { "{AbbrevWeekdayName}", ATTRIB_STRFTIME, { "%a", NULL } }, - { "{WeekdayName}", ATTRIB_STRFTIME, { "%A", NULL } }, - { "{AbbrevMonthName}", ATTRIB_STRFTIME, { "%b", NULL } }, - { "{MonthName}", ATTRIB_STRFTIME, { "%B", NULL } }, - { "{AmPmUpper}", ATTRIB_STRFTIME, { "%p", NULL } }, - { "{AmPmLower}", ATTRIB_STRFTIME, { "%P", NULL } }, - { "{Day}", ATTRIB_TM_MDAY, { "%02d", NULL } }, /* %d 01-31 */ - { "{ Day}", ATTRIB_TM_MDAY, { "% 2d", NULL } }, /* %e 1-31 */ - { "{24Hour}", ATTRIB_TM_24HOUR, { "%02d", NULL } }, /* %H 00-23 */ - { "{12Hour}", ATTRIB_TM_12HOUR, { "%02d", NULL } }, /* %I 00-12 */ - { "{DayOfYear}", ATTRIB_TM_YDAY, { "%d", NULL } }, /* %j 1-366 */ - { "{Month}", ATTRIB_TM_MON, { "%02d", NULL } }, /* %m 01-12 */ - { "{Minute}", ATTRIB_TM_MIN, { "%02d", NULL } }, /* %M 00-59 */ - { "{Seconds}", ATTRIB_TM_SEC, { "%02d", NULL } }, /* %S 00-61 */ - { "{2DigitYear}", ATTRIB_TM_2YEAR, { "%02d", NULL } }, /* %y */ - { "{Year}", ATTRIB_TM_YEAR, { "%04d", NULL } }, /* %Y */ - { "{TimeZone}", ATTRIB_TIMEZONE, { "%+05d", NULL } } + { "{Sender}", ATTRIB_CUSTOM, { NULL, format_sender } }, + { "{SenderName}", ATTRIB_CUSTOM, { NULL, format_sender } }, + { "{SenderEMail}", ATTRIB_CUSTOM, { NULL, format_sender } }, + { "{AbbrevWeekdayName}", ATTRIB_STRFTIME, { "%a", NULL } }, + { "{WeekdayName}", ATTRIB_STRFTIME, { "%A", NULL } }, + { "{AbbrevMonthName}", ATTRIB_STRFTIME, { "%b", NULL } }, + { "{MonthName}", ATTRIB_STRFTIME, { "%B", NULL } }, + { "{AmPmUpper}", ATTRIB_STRFTIME, { "%p", NULL } }, + { "{AmPmLower}", ATTRIB_STRFTIME, { "%P", NULL } }, + { "{Day}", ATTRIB_TM_MDAY, { "%02d", NULL } }, /* %d 01-31 */ + { "{ Day}", ATTRIB_TM_MDAY, { "% 2d", NULL } }, /* %e 1-31 */ + { "{24Hour}", ATTRIB_TM_24HOUR, { "%02d", NULL } }, /* %H 00-23 */ + { "{12Hour}", ATTRIB_TM_12HOUR, { "%02d", NULL } }, /* %I 00-12 */ + { "{DayOfYear}", ATTRIB_TM_YDAY, { "%d", NULL } }, /* %j 1-366 */ + { "{Month}", ATTRIB_TM_MON, { "%02d", NULL } }, /* %m 01-12 */ + { "{Minute}", ATTRIB_TM_MIN, { "%02d", NULL } }, /* %M 00-59 */ + { "{Seconds}", ATTRIB_TM_SEC, { "%02d", NULL } }, /* %S 00-61 */ + { "{2DigitYear}", ATTRIB_TM_2YEAR, { "%02d", NULL } }, /* %y */ + { "{Year}", ATTRIB_TM_YEAR, { "%04d", NULL } }, /* %Y */ + { "{TimeZone}", ATTRIB_TIMEZONE, { "%+05d", NULL } } }; static gchar * @@ -2482,7 +2547,9 @@ composer_set_body (EMsgComposer *composer, break; case E_MAIL_REPLY_STYLE_OUTLOOK: original = quoting_text (QUOTING_ORIGINAL); - text = em_utils_message_to_html (message, original, EM_FORMAT_QUOTE_HEADERS, source, start_bottom ? "<BR>" : NULL, &validity_found); + text = em_utils_message_to_html ( + message, original, EM_FORMAT_QUOTE_HEADERS, source, + start_bottom ? "<BR>" : NULL, &validity_found); e_msg_composer_set_body_text (composer, text, TRUE); has_body_text = text && *text; g_free (text); @@ -2494,7 +2561,9 @@ composer_set_body (EMsgComposer *composer, default: /* do what any sane user would want when replying... */ credits = attribution_format (message); - text = em_utils_message_to_html (message, credits, EM_FORMAT_QUOTE_CITE, source, start_bottom ? "<BR>" : NULL, &validity_found); + text = em_utils_message_to_html ( + message, credits, EM_FORMAT_QUOTE_CITE, source, + start_bottom ? "<BR>" : NULL, &validity_found); g_free (credits); e_msg_composer_set_body_text (composer, text, TRUE); has_body_text = text && *text; @@ -2511,7 +2580,8 @@ composer_set_body (EMsgComposer *composer, before the signature. We added there an empty line already. */ gtkhtml_editor_run_command (editor, "block-selection"); gtkhtml_editor_run_command (editor, "cursor-bod"); - if (gconf_client_get_bool (client, "/apps/evolution/mail/composer/top_signature", NULL) + if (gconf_client_get_bool ( + client, "/apps/evolution/mail/composer/top_signature", NULL) || !gtkhtml_editor_search_by_data (editor, 1, "ClueFlow", "signature", "1")) gtkhtml_editor_run_command (editor, "cursor-eod"); else @@ -2536,7 +2606,9 @@ em_utils_construct_composer_text (CamelMimeMessage *message, EMFormat *source) gboolean start_bottom = 0; credits = attribution_format (message); - text = em_utils_message_to_html (message, credits, EM_FORMAT_QUOTE_CITE, source, start_bottom ? "<BR>" : NULL, NULL); + text = em_utils_message_to_html ( + message, credits, EM_FORMAT_QUOTE_CITE, source, + start_bottom ? "<BR>" : NULL, NULL); g_free (credits); return text; diff --git a/mail/em-filter-context.c b/mail/em-filter-context.c index f7756960ec..57d182a4eb 100644 --- a/mail/em-filter-context.c +++ b/mail/em-filter-context.c @@ -280,7 +280,8 @@ em_filter_context_class_init (EMFilterContextClass *class) static void em_filter_context_init (EMFilterContext *context) { - context->priv = G_TYPE_INSTANCE_GET_PRIVATE (context, EM_TYPE_FILTER_CONTEXT, EMFilterContextPrivate); + context->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + context, EM_TYPE_FILTER_CONTEXT, EMFilterContextPrivate); e_rule_context_add_part_set ( E_RULE_CONTEXT (context), diff --git a/mail/em-filter-folder-element.c b/mail/em-filter-folder-element.c index 70c9da6aa6..59a44f1813 100644 --- a/mail/em-filter-folder-element.c +++ b/mail/em-filter-folder-element.c @@ -181,7 +181,9 @@ em_filter_folder_element_class_init (EMFilterFolderElementClass *class) static void em_filter_folder_element_init (EMFilterFolderElement *element) { - element->priv = G_TYPE_INSTANCE_GET_PRIVATE (element, EM_TYPE_FILTER_FOLDER_ELEMENT, EMFilterFolderElementPrivate); + element->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + element, EM_TYPE_FILTER_FOLDER_ELEMENT, + EMFilterFolderElementPrivate); } EFilterElement * diff --git a/mail/em-folder-selection-button.c b/mail/em-folder-selection-button.c index e6b11c278f..d122868fc0 100644 --- a/mail/em-folder-selection-button.c +++ b/mail/em-folder-selection-button.c @@ -361,7 +361,9 @@ em_folder_selection_button_init (EMFolderSelectionButton *emfsb) { GtkWidget *box; - emfsb->priv = G_TYPE_INSTANCE_GET_PRIVATE (emfsb, EM_TYPE_FOLDER_SELECTION_BUTTON, EMFolderSelectionButtonPrivate); + emfsb->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + emfsb, EM_TYPE_FOLDER_SELECTION_BUTTON, + EMFolderSelectionButtonPrivate); emfsb->priv->multiple_select = FALSE; diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c index 6668eae77d..d95b7db5ef 100644 --- a/mail/em-folder-tree-model.c +++ b/mail/em-folder-tree-model.c @@ -529,7 +529,8 @@ em_folder_tree_model_init (EMFolderTreeModel *model) (GDestroyNotify) g_free, (GDestroyNotify) gtk_tree_row_reference_free); - model->priv = G_TYPE_INSTANCE_GET_PRIVATE (model, EM_TYPE_FOLDER_TREE_MODEL, EMFolderTreeModelPrivate); + model->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + model, EM_TYPE_FOLDER_TREE_MODEL, EMFolderTreeModelPrivate); model->priv->store_index = store_index; model->priv->uri_index = uri_index; diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index ee853331bf..81803b53a3 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -1453,7 +1453,8 @@ folder_tree_init (EMFolderTree *folder_tree) select_uris_table = g_hash_table_new (g_str_hash, g_str_equal); - folder_tree->priv = G_TYPE_INSTANCE_GET_PRIVATE (folder_tree, EM_TYPE_FOLDER_TREE, EMFolderTreePrivate); + folder_tree->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + folder_tree, EM_TYPE_FOLDER_TREE, EMFolderTreePrivate); folder_tree->priv->select_uris_table = select_uris_table; tree_view = GTK_TREE_VIEW (folder_tree); @@ -2423,28 +2424,33 @@ tree_autoscroll (EMFolderTree *folder_tree) GtkTreeView *tree_view; GdkRectangle rect; GdkWindow *window; + gdouble value; gint offset, y; - /* get the y pointer position relative to the treeview */ + /* Get the y pointer position relative to the treeview. */ tree_view = GTK_TREE_VIEW (folder_tree); window = gtk_tree_view_get_bin_window (tree_view); gdk_window_get_pointer (window, NULL, &y, NULL); - /* rect is in coorinates relative to the scrolled window relative to the treeview */ + /* Rect is in coorinates relative to the scrolled window, + * relative to the treeview. */ gtk_tree_view_get_visible_rect (tree_view, &rect); - /* move y into the same coordinate system as rect */ + /* Move y into the same coordinate system as rect. */ y += rect.y; - /* see if we are near the top edge */ - if ((offset = y - (rect.y + 2 * SCROLL_EDGE_SIZE)) > 0) { - /* see if we are near the bottom edge */ - if ((offset = y - (rect.y + rect.height - 2 * SCROLL_EDGE_SIZE)) < 0) + /* See if we are near the top edge. */ + offset = y - (rect.y + 2 * SCROLL_EDGE_SIZE); + if (offset > 0) { + /* See if we are near the bottom edge. */ + offset = y - (rect.y + rect.height - 2 * SCROLL_EDGE_SIZE); + if (offset < 0) return TRUE; } adjustment = gtk_tree_view_get_vadjustment (tree_view); - gtk_adjustment_set_value (adjustment, MAX (gtk_adjustment_get_value (adjustment) + offset, 0.0)); + value = gtk_adjustment_get_value (adjustment); + gtk_adjustment_set_value (adjustment, MAX (value + offset, 0.0)); return TRUE; } diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c index 9d4ff55897..b0cb833c5f 100644 --- a/mail/em-format-html-display.c +++ b/mail/em-format-html-display.c @@ -679,7 +679,8 @@ efhd_init (EMFormatHTMLDisplay *efhd) web_view = em_format_html_get_web_view (EM_FORMAT_HTML (efhd)); - efhd->priv = G_TYPE_INSTANCE_GET_PRIVATE (efhd, EM_TYPE_FORMAT_HTML_DISPLAY, EMFormatHTMLDisplayPrivate); + efhd->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + efhd, EM_TYPE_FORMAT_HTML_DISPLAY, EMFormatHTMLDisplayPrivate); efhd->priv->attachment_views = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); e_mail_display_set_formatter ( diff --git a/mail/em-format-html.c b/mail/em-format-html.c index 780a02a17a..a5f485eef7 100644 --- a/mail/em-format-html.c +++ b/mail/em-format-html.c @@ -938,7 +938,8 @@ efh_init (EMFormatHTML *efh, EWebView *web_view; GdkColor *color; - efh->priv = G_TYPE_INSTANCE_GET_PRIVATE (efh, EM_TYPE_FORMAT_HTML, EMFormatHTMLPrivate); + efh->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + efh, EM_TYPE_FORMAT_HTML, EMFormatHTMLPrivate); g_queue_init (&efh->pending_object_list); g_queue_init (&efh->priv->pending_jobs); diff --git a/mail/em-subscription-editor.c b/mail/em-subscription-editor.c index 8b0400ffe0..99aa6f5247 100644 --- a/mail/em-subscription-editor.c +++ b/mail/em-subscription-editor.c @@ -1095,7 +1095,9 @@ em_subscription_editor_init (EMSubscriptionEditor *editor) GtkWidget *box; const gchar *tooltip; - editor->priv = G_TYPE_INSTANCE_GET_PRIVATE (editor, EM_TYPE_SUBSCRIPTION_EDITOR, EMSubscriptionEditorPrivate); + editor->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + editor, EM_TYPE_SUBSCRIPTION_EDITOR, + EMSubscriptionEditorPrivate); editor->priv->stores = g_ptr_array_new_with_free_func ( (GDestroyNotify) store_data_free); diff --git a/mail/em-utils.c b/mail/em-utils.c index 09692f0b1b..15008abd51 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -317,21 +317,28 @@ em_utils_edit_filters (GtkWidget *parent, em_filter_source_element_names[1].name = _("Outgoing"); } - filter_editor = (GtkWidget *) em_filter_editor_new (fc, em_filter_source_element_names); + filter_editor = (GtkWidget *) em_filter_editor_new ( + fc, em_filter_source_element_names); if (parent != NULL) gtk_window_set_transient_for ( GTK_WINDOW (filter_editor), GTK_WINDOW (parent)); - gtk_window_set_title (GTK_WINDOW (filter_editor), _("Message Filters")); - g_object_set_data_full ((GObject *) filter_editor, "context", fc, (GDestroyNotify) g_object_unref); - g_signal_connect (filter_editor, "response", G_CALLBACK (em_filter_editor_response), NULL); + gtk_window_set_title ( + GTK_WINDOW (filter_editor), _("Message Filters")); + g_object_set_data_full ( + G_OBJECT (filter_editor), "context", fc, + (GDestroyNotify) g_object_unref); + g_signal_connect ( + filter_editor, "response", + G_CALLBACK (em_filter_editor_response), NULL); gtk_widget_show (GTK_WIDGET (filter_editor)); } /* * Picked this from e-d-s/libedataserver/e-data. - * But it allows more characters to occur in filenames, especially when saving attachment. + * But it allows more characters to occur in filenames, especially + * when saving attachment. */ void em_filename_make_safe (gchar *string) @@ -491,7 +498,9 @@ exit: * @folder and @uids. **/ void -em_utils_flag_for_followup_clear (GtkWindow *parent, CamelFolder *folder, GPtrArray *uids) +em_utils_flag_for_followup_clear (GtkWindow *parent, + CamelFolder *folder, + GPtrArray *uids) { gint i; @@ -527,7 +536,9 @@ em_utils_flag_for_followup_clear (GtkWindow *parent, CamelFolder *folder, GPtrAr * Flag-for-Followup. **/ void -em_utils_flag_for_followup_completed (GtkWindow *parent, CamelFolder *folder, GPtrArray *uids) +em_utils_flag_for_followup_completed (GtkWindow *parent, + CamelFolder *folder, + GPtrArray *uids) { gchar *now; gint i; @@ -558,10 +569,13 @@ em_utils_flag_for_followup_completed (GtkWindow *parent, CamelFolder *folder, GP em_utils_uids_free (uids); } -/* This kind of sucks, because for various reasons most callers need to run synchronously - in the gui thread, however this could take a long, blocking time, to run */ +/* This kind of sucks, because for various reasons most callers need to run + * synchronously in the gui thread, however this could take a long, blocking + * time to run. */ static gint -em_utils_write_messages_to_stream (CamelFolder *folder, GPtrArray *uids, CamelStream *stream) +em_utils_write_messages_to_stream (CamelFolder *folder, + GPtrArray *uids, + CamelStream *stream) { CamelStream *filtered_stream; CamelMimeFilter *from_filter; @@ -585,13 +599,17 @@ em_utils_write_messages_to_stream (CamelFolder *folder, GPtrArray *uids, CamelSt break; } - /* we need to flush after each stream write since we are writing to the same stream */ + /* We need to flush after each stream write since we are + * writing to the same stream. */ from = camel_mime_message_build_mbox_from (message); if (camel_stream_write_string (stream, from, NULL, NULL) == -1 || camel_stream_flush (stream, NULL, NULL) == -1 - || camel_data_wrapper_write_to_stream_sync ((CamelDataWrapper *)message, (CamelStream *)filtered_stream, NULL, NULL) == -1 - || camel_stream_flush ((CamelStream *)filtered_stream, NULL, NULL) == -1) + || camel_data_wrapper_write_to_stream_sync ( + (CamelDataWrapper *) message, (CamelStream *) + filtered_stream, NULL, NULL) == -1 + || camel_stream_flush ( + (CamelStream *) filtered_stream, NULL, NULL) == -1) res = -1; g_free (from); @@ -606,10 +624,12 @@ em_utils_write_messages_to_stream (CamelFolder *folder, GPtrArray *uids, CamelSt return res; } -/* This kind of sucks, because for various reasons most callers need to run synchronously - in the gui thread, however this could take a long, blocking time, to run */ +/* This kind of sucks, because for various reasons most callers need to run + * synchronously in the gui thread, however this could take a long, blocking + * time to run. */ static gint -em_utils_read_messages_from_stream (CamelFolder *folder, CamelStream *stream) +em_utils_read_messages_from_stream (CamelFolder *folder, + CamelStream *stream) { CamelMimeParser *mp = camel_mime_parser_new (); gboolean success = TRUE; @@ -854,7 +874,9 @@ em_utils_selection_get_uidlist (GtkSelectionData *selection_data, * up when the application quits. **/ void -em_utils_selection_set_urilist (GtkSelectionData *data, CamelFolder *folder, GPtrArray *uids) +em_utils_selection_set_urilist (GtkSelectionData *data, + CamelFolder *folder, + GPtrArray *uids) { gchar *tmpdir; CamelStream *fstream; @@ -1301,7 +1323,8 @@ em_utils_message_to_html (CamelMimeMessage *message, /* FIXME: we should be getting this from the current view, not the global setting. */ gconf = gconf_client_get_default (); - charset = gconf_client_get_string (gconf, "/apps/evolution/mail/display/charset", NULL); + charset = gconf_client_get_string ( + gconf, "/apps/evolution/mail/display/charset", NULL); em_format_set_default_charset ((EMFormat *) emfq, charset); g_object_unref (gconf); g_free (charset); @@ -1367,7 +1390,9 @@ em_utils_empty_trash (GtkWidget *parent, g_return_if_fail (E_IS_MAIL_SESSION (session)); - if (!em_utils_prompt_user((GtkWindow *) parent, "/apps/evolution/mail/prompts/empty_trash", "mail:ask-empty-trash", NULL)) + if (!em_utils_prompt_user ((GtkWindow *) parent, + "/apps/evolution/mail/prompts/empty_trash", + "mail:ask-empty-trash", NULL)) return; accounts = e_get_account_list (); @@ -1647,11 +1672,15 @@ try_open_e_book (EBook *book, gboolean only_if_exists, GError **error) if (!e_book_open_async (book, only_if_exists, try_open_e_book_cb, &data)) { e_flag_free (flag); g_clear_error (error); - g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_OTHER_ERROR, "Failed to call e_book_open_async."); + g_set_error ( + error, E_BOOK_ERROR, + E_BOOK_ERROR_OTHER_ERROR, + "Failed to call e_book_open_async."); return FALSE; } - while (canceled = camel_operation_cancel_check (NULL), !canceled && !e_flag_is_set (flag)) { + while (canceled = camel_operation_cancel_check (NULL), + !canceled && !e_flag_is_set (flag)) { GTimeVal wait; g_get_current_time (&wait); @@ -1662,9 +1691,13 @@ try_open_e_book (EBook *book, gboolean only_if_exists, GError **error) if (canceled) { g_clear_error (error); - g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_CANCELLED, "Operation has been canceled."); - /* if the operation is cancelled sucessfully set the flag else wait. file, groupwise,.. backend's operations - are not cancellable */ + g_set_error ( + error, E_BOOK_ERROR, + E_BOOK_ERROR_CANCELLED, + "Operation has been canceled."); + /* if the operation is cancelled sucessfully set the flag + * else wait. file, groupwise,.. backend's operations + * are not cancellable */ if (e_book_cancel_async_op (book, NULL)) e_flag_set (flag); } @@ -1678,13 +1711,26 @@ try_open_e_book (EBook *book, gboolean only_if_exists, GError **error) #define NOT_FOUND_BOOK (GINT_TO_POINTER (1)) G_LOCK_DEFINE_STATIC (contact_cache); -static GHashTable *contact_cache = NULL; /* key is lowercased contact email; value is EBook pointer (just for comparison) where it comes from */ -static GHashTable *emu_books_hash = NULL; /* key is source ID; value is pointer to EBook */ -static GHashTable *emu_broken_books_hash = NULL; /* key is source ID; value is same pointer as key; this is hash of broken books, which failed to open for some reason */ + +/* key is lowercased contact email; value is EBook pointer + * (just for comparison) where it comes from */ +static GHashTable *contact_cache = NULL; + +/* key is source ID; value is pointer to EBook */ +static GHashTable *emu_books_hash = NULL; + +/* key is source ID; value is same pointer as key; this is hash of + * broken books, which failed to open for some reason */ +static GHashTable *emu_broken_books_hash = NULL; + static ESourceList *emu_books_source_list = NULL; static gboolean -search_address_in_addressbooks (const gchar *address, gboolean local_only, gboolean (*check_contact) (EContact *contact, gpointer user_data), gpointer user_data) +search_address_in_addressbooks (const gchar *address, + gboolean local_only, + gboolean (*check_contact) (EContact *contact, + gpointer user_data), + gpointer user_data) { gboolean found = FALSE, stop = FALSE, found_any = FALSE; gchar *lowercase_addr; @@ -1698,10 +1744,15 @@ search_address_in_addressbooks (const gchar *address, gboolean local_only, gbool G_LOCK (contact_cache); if (!emu_books_source_list) { - mail_call_main (MAIL_CALL_p_p, (MailMainFunc)emu_addr_setup, &emu_books_source_list); - emu_books_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); - emu_broken_books_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); - contact_cache = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); + mail_call_main ( + MAIL_CALL_p_p, (MailMainFunc) + emu_addr_setup, &emu_books_source_list); + emu_books_hash = g_hash_table_new_full ( + g_str_hash, g_str_equal, g_free, g_object_unref); + emu_broken_books_hash = g_hash_table_new_full ( + g_str_hash, g_str_equal, g_free, NULL); + contact_cache = g_hash_table_new_full ( + g_str_hash, g_str_equal, g_free, NULL); } if (!emu_books_source_list) { @@ -1725,7 +1776,9 @@ search_address_in_addressbooks (const gchar *address, gboolean local_only, gbool if (!group) continue; - if (local_only && !(e_source_group_peek_base_uri (group) && g_str_has_prefix (e_source_group_peek_base_uri (group), "local:"))) + if (local_only && !(e_source_group_peek_base_uri (group) && + g_str_has_prefix ( + e_source_group_peek_base_uri (group), "local:"))) continue; for (s = e_source_group_peek_sources (group); s; s = g_slist_next (s)) { @@ -1747,8 +1800,10 @@ search_address_in_addressbooks (const gchar *address, gboolean local_only, gbool GError *err = NULL; /* failed to load this book last time, skip it now */ - if (g_hash_table_lookup (emu_broken_books_hash, e_source_peek_uid (source)) != NULL) { - d(printf ("%s: skipping broken book '%s'\n", G_STRFUNC, e_source_peek_name (source))); + if (g_hash_table_lookup (emu_broken_books_hash, + e_source_peek_uid (source)) != NULL) { + d(printf ("%s: skipping broken book '%s'\n", + G_STRFUNC, e_source_peek_name (source))); continue; } @@ -1769,7 +1824,10 @@ search_address_in_addressbooks (const gchar *address, gboolean local_only, gbool g_hash_table_insert (emu_broken_books_hash, source_uid, source_uid); - g_warning ("%s: Unable to create addressbook '%s': %s", G_STRFUNC, e_source_peek_name (source), err->message); + g_warning ( + "%s: Unable to create addressbook '%s': %s", + G_STRFUNC, e_source_peek_name (source), + err->message); } g_clear_error (&err); } else if (!stop && !try_open_e_book (book, TRUE, &err)) { @@ -1783,7 +1841,10 @@ search_address_in_addressbooks (const gchar *address, gboolean local_only, gbool g_hash_table_insert (emu_broken_books_hash, source_uid, source_uid); - g_warning ("%s: Unable to open addressbook '%s': %s", G_STRFUNC, e_source_peek_name (source), err->message); + g_warning ( + "%s: Unable to open addressbook '%s': %s", + G_STRFUNC, e_source_peek_name (source), + err->message); } g_clear_error (&err); } @@ -1820,7 +1881,10 @@ search_address_in_addressbooks (const gchar *address, gboolean local_only, gbool g_hash_table_insert (emu_broken_books_hash, source_uid, source_uid); - g_warning ("%s: Can't get contacts from '%s': %s", G_STRFUNC, e_source_peek_name (source), err->message); + g_warning ( + "%s: Can't get contacts from '%s': %s", + G_STRFUNC, e_source_peek_name (source), + err->message); } g_clear_error (&err); } @@ -1937,7 +2001,8 @@ em_utils_contact_photo (CamelInternetAddress *cia, gboolean local_only) } /* !p means the address had not been found in the cache */ - if (!p && search_address_in_addressbooks (addr, local_only, extract_photo_data, &photo)) { + if (!p && search_address_in_addressbooks ( + addr, local_only, extract_photo_data, &photo)) { PhotoInfo *pi; if (photo && photo->type != E_CONTACT_PHOTO_TYPE_INLINED) { @@ -2034,7 +2099,8 @@ emu_remove_from_mail_cache_1 (const gchar *address) g_slist_free (l); } -/* frees all data created by call of em_utils_in_addressbook or em_utils_contact_photo */ +/* frees all data created by call of em_utils_in_addressbook() or + * em_utils_contact_photo() */ void emu_free_mail_cache (void) { @@ -2190,7 +2256,10 @@ em_utils_generate_account_hash (void) } if (!acnt) - g_hash_table_insert (account_hash, (gchar *) account->id->address, (gpointer) account); + g_hash_table_insert ( + account_hash, (gchar *) + account->id->address, + (gpointer) account); } e_iterator_next (iter); diff --git a/mail/em-vfolder-context.c b/mail/em-vfolder-context.c index d59715b78d..5f78da434a 100644 --- a/mail/em-vfolder-context.c +++ b/mail/em-vfolder-context.c @@ -171,7 +171,8 @@ em_vfolder_context_class_init (EMVFolderContextClass *class) static void em_vfolder_context_init (EMVFolderContext *context) { - context->priv = G_TYPE_INSTANCE_GET_PRIVATE (context, EM_TYPE_VFOLDER_CONTEXT, EMVFolderContextPrivate); + context->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + context, EM_TYPE_VFOLDER_CONTEXT, EMVFolderContextPrivate); e_rule_context_add_part_set ( E_RULE_CONTEXT (context), "partset", E_TYPE_FILTER_PART, diff --git a/mail/em-vfolder-rule.c b/mail/em-vfolder-rule.c index a1b7f53be7..22c0690c79 100644 --- a/mail/em-vfolder-rule.c +++ b/mail/em-vfolder-rule.c @@ -193,7 +193,8 @@ em_vfolder_rule_class_init (EMVFolderRuleClass *class) static void em_vfolder_rule_init (EMVFolderRule *rule) { - rule->priv = G_TYPE_INSTANCE_GET_PRIVATE (rule, EM_TYPE_VFOLDER_RULE, EMVFolderRulePrivate); + rule->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + rule, EM_TYPE_VFOLDER_RULE, EMVFolderRulePrivate); rule->with = EM_VFOLDER_RULE_WITH_SPECIFIC; rule->rule.source = g_strdup ("incoming"); diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index e7563ced8b..06acae76ec 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -1050,7 +1050,8 @@ mail_folder_cache_init (MailFolderCache *self) const gchar *buf; guint timeout; - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, MAIL_TYPE_FOLDER_CACHE, MailFolderCachePrivate); + self->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + self, MAIL_TYPE_FOLDER_CACHE, MailFolderCachePrivate); /* initialize values */ self->priv->stores = g_hash_table_new (NULL, NULL); diff --git a/mail/message-list.c b/mail/message-list.c index 64b530d798..7aad12b6c8 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -2464,7 +2464,8 @@ message_list_init (MessageList *message_list) GtkTargetList *target_list; GdkAtom matom; - message_list->priv = G_TYPE_INSTANCE_GET_PRIVATE (message_list, MESSAGE_LIST_TYPE, MessageListPrivate); + message_list->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + message_list, MESSAGE_LIST_TYPE, MessageListPrivate); #if HAVE_CLUTTER message_list->priv->timeline = NULL; |