diff options
Diffstat (limited to 'mail')
49 files changed, 2680 insertions, 2213 deletions
diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c index db5150bebd..95084c6d28 100644 --- a/mail/e-mail-browser.c +++ b/mail/e-mail-browser.c @@ -270,9 +270,11 @@ mail_browser_message_selected_cb (EMailBrowser *browser, EMailReader *reader; EWebView *web_view; const gchar *title; + guint32 state; reader = E_MAIL_READER (browser); - e_mail_reader_update_actions (reader, e_mail_reader_check_state (reader)); + state = e_mail_reader_check_state (reader); + e_mail_reader_update_actions (reader, state); if (uid == NULL) return; @@ -293,7 +295,8 @@ mail_browser_message_selected_cb (EMailBrowser *browser, gtk_window_set_title (GTK_WINDOW (browser), title); gtk_widget_grab_focus (GTK_WIDGET (web_view)); - camel_message_info_set_flags (info, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN); + camel_message_info_set_flags ( + info, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN); camel_folder_free_message_info (folder, info); } diff --git a/mail/e-mail-folder-utils.c b/mail/e-mail-folder-utils.c index 72afb08c6f..7c84957f6a 100644 --- a/mail/e-mail-folder-utils.c +++ b/mail/e-mail-folder-utils.c @@ -767,7 +767,8 @@ mail_folder_remove_recursive (CamelStore *store, } static void -follow_cancel_cb (GCancellable *cancellable, GCancellable *transparent_cancellable) +follow_cancel_cb (GCancellable *cancellable, + GCancellable *transparent_cancellable) { g_cancellable_cancel (transparent_cancellable); } diff --git a/mail/e-mail-migrate.c b/mail/e-mail-migrate.c index 6ac8f89b7f..07b2a8bb2c 100644 --- a/mail/e-mail-migrate.c +++ b/mail/e-mail-migrate.c @@ -124,7 +124,8 @@ static GtkLabel *label; static GtkProgressBar *progress; static void -em_migrate_setup_progress_dialog (const gchar *title, const gchar *desc) +em_migrate_setup_progress_dialog (const gchar *title, + const gchar *desc) { GtkWidget *vbox, *hbox, *w; gchar *markup; @@ -238,7 +239,10 @@ static gint open_flags[3] = { }; static gboolean -cp (const gchar *src, const gchar *dest, gboolean show_progress, gint mode) +cp (const gchar *src, + const gchar *dest, + gboolean show_progress, + gint mode) { guchar readbuf[65536]; gssize nread, nwritten; @@ -417,7 +421,8 @@ emm_setup_initial (const gchar *data_dir) } static gboolean -is_in_plugs_list (GSList *list, const gchar *value) +is_in_plugs_list (GSList *list, + const gchar *value) { GSList *l; @@ -636,7 +641,8 @@ migrate_folders (CamelStore *store, /* This could be in CamelStore.ch */ static void -count_folders (CamelFolderInfo *fi, gint *count) +count_folders (CamelFolderInfo *fi, + gint *count) { while (fi) { *count = *count + 1; @@ -697,7 +703,7 @@ migrate_to_db (EShellBackend *shell_backend) EMailBackend *mail_backend; EMailSession *mail_session; EIterator *iter; - gint i=0, len; + gint i = 0, len; CamelStore *store = NULL; CamelFolderInfo *info; CamelURL *url; @@ -724,7 +730,7 @@ migrate_to_db (EShellBackend *shell_backend) "folders has been moved to SQLite since Evolution 2.24.\n\nPlease be " "patient while Evolution migrates your folders...")); - em_migrate_set_progress ( (double) i/(len+1)); + em_migrate_set_progress ( (double) i / (len + 1)); store = setup_local_store (shell_backend, session); url = camel_service_get_camel_url (CAMEL_SERVICE (store)); @@ -753,14 +759,14 @@ migrate_to_db (EShellBackend *shell_backend) g_main_context_iteration (NULL, TRUE); } i++; - em_migrate_set_progress ( (double) i/(len+1)); + em_migrate_set_progress ( (double) i / (len + 1)); while (e_iterator_is_valid (iter)) { EAccount *account = (EAccount *) e_iterator_get (iter); EAccountService *service; service = account->source; - em_migrate_set_progress ( (double) i/(len+1)); + em_migrate_set_progress ( (double) i / (len + 1)); if (account->enabled && service->url != NULL && service->url[0] && strncmp (service->url, "mbox:", 5) != 0) { @@ -796,8 +802,6 @@ migrate_to_db (EShellBackend *shell_backend) } - //camel_session_set_online ((CamelSession *) session, TRUE); - g_object_unref (iter); em_migrate_close_progress_dialog (); diff --git a/mail/e-mail-notebook-view.c b/mail/e-mail-notebook-view.c index 1d158fd398..e737b88bfe 100644 --- a/mail/e-mail-notebook-view.c +++ b/mail/e-mail-notebook-view.c @@ -100,7 +100,7 @@ emnv_get_page_num (EMailNotebookView *view, n = gtk_notebook_get_n_pages (priv->book); - for (i=0; i<n; i++) { + for (i = 0; i < n; i++) { GtkWidget *curr = gtk_notebook_get_nth_page (priv->book, i); if (curr == widget) return i; @@ -164,8 +164,8 @@ fix_tab_picker_width (GtkWidget *widget, { ClutterActor *stage = g_object_get_data ((GObject *)actor, "stage"); - clutter_actor_set_size (actor, allocation->width-1, -1); - clutter_actor_set_size (stage, allocation->width-1, -1); + clutter_actor_set_size (actor, allocation->width - 1, -1); + clutter_actor_set_size (stage, allocation->width - 1, -1); } static void @@ -230,8 +230,8 @@ tab_picker_preview_mode_notify (EMailTabPicker *picker, static void mnv_tab_anim_frame_cb (ClutterTimeline *timeline, - gint frame_num, - EMailTab *tab) + gint frame_num, + EMailTab *tab) { if (!clutter_actor_get_parent (CLUTTER_ACTOR (tab))) { clutter_timeline_stop (timeline); @@ -246,7 +246,7 @@ mnv_tab_anim_frame_cb (ClutterTimeline *timeline, static void mnv_tab_anim_complete_cb (ClutterTimeline *timeline, - EMailTab *tab) + EMailTab *tab) { e_mail_tab_set_width (tab, 200); g_object_unref (tab); @@ -261,7 +261,7 @@ struct _tab_data { static void mnv_tab_closed_cb (ClutterTimeline *timeline, - struct _tab_data *data) + struct _tab_data *data) { EMailView *page = g_object_get_data ((GObject *)data->tab, "page"); EMailView *prev; @@ -291,7 +291,8 @@ mnv_tab_closed_cb (ClutterTimeline *timeline, } static void -mnv_tab_closed (EMailTab *tab, EMailNotebookView *view) +mnv_tab_closed (EMailTab *tab, + EMailNotebookView *view) { EMailNotebookViewPrivate *priv = view->priv; gint page, cur; @@ -327,8 +328,8 @@ mnv_tab_closed (EMailTab *tab, EMailNotebookView *view) static void tab_activated_cb (EMailTabPicker *picker, - EMailTab *tab, - EMailNotebookView *view) + EMailTab *tab, + EMailNotebookView *view) { EMailView *page = g_object_get_data ((GObject *)tab, "page"); gint num = emnv_get_page_num (view, (GtkWidget *) page); @@ -339,7 +340,7 @@ tab_activated_cb (EMailTabPicker *picker, static void tab_remove_gtk_cb (GtkWidget *button, - EMailNotebookView *view) + EMailNotebookView *view) { EMailView *page = g_object_get_data ((GObject *)button, "page"); EMailView *prev; @@ -370,8 +371,8 @@ tab_remove_gtk_cb (GtkWidget *button, static void adjust_label_size_request (GtkWidget *view, - GtkAllocation *allocation, - GtkWidget *label) + GtkAllocation *allocation, + GtkWidget *label) { GtkRequisition requisition; gint max_width = allocation->width / 2; @@ -387,7 +388,7 @@ adjust_label_size_request (GtkWidget *view, static void disconnect_label_adjusting (EMailNotebookView *view, - GtkWidget *label) + GtkWidget *label) { g_signal_handlers_disconnect_by_func ( view, @@ -397,8 +398,8 @@ disconnect_label_adjusting (EMailNotebookView *view, static GtkWidget * create_tab_label (EMailNotebookView *view, - EMailView *page, - const gchar *str) + EMailView *page, + const gchar *str) { GtkWidget *container, *widget; GtkAllocation allocation; @@ -468,11 +469,12 @@ fix_clutter_embed_width (GtkWidget *widget, GtkAllocation galoc; gtk_widget_get_allocation (embed, &galoc); - clutter_actor_set_size (actor, allocation->width-1, galoc.height); + clutter_actor_set_size (actor, allocation->width - 1, galoc.height); } static GtkWidget * -create_under_clutter (GtkWidget *widget, GtkWidget *paned) +create_under_clutter (GtkWidget *widget, + GtkWidget *paned) { GtkWidget *embed; ClutterActor *stage, *actor; @@ -941,7 +943,8 @@ mail_notebook_view_get_window (EMailReader *reader) } static void -reconnect_changed_event (EMailReader *child, EMailReader *parent) +reconnect_changed_event (EMailReader *child, + EMailReader *parent) { g_signal_emit_by_name (parent, "changed"); } @@ -1023,7 +1026,7 @@ mail_netbook_view_open_mail (EMailView *view, e_mail_tab_set_preview_actor (tab, clone); e_mail_tab_set_can_close (tab, TRUE); - e_mail_tab_picker_add_tab (priv->tab_picker, tab, pos+1); + e_mail_tab_picker_add_tab (priv->tab_picker, tab, pos + 1); e_mail_tab_enable_drag (tab, TRUE); page = e_mail_tab_picker_get_tab_no (priv->tab_picker, tab); @@ -1062,7 +1065,8 @@ mail_netbook_view_open_mail (EMailView *view, #if HAVE_CLUTTER static ClutterActor * -build_histogram (GtkWidget *widget, CamelFolder *folder) +build_histogram (GtkWidget *widget, + CamelFolder *folder) { gint week_time = 60 * 60 * 24 * 7; gint weeks[54]; @@ -1075,7 +1079,7 @@ build_histogram (GtkWidget *widget, CamelFolder *folder) gint x = 0; time_t now = time (NULL); - for (i=0; i<54; i++) + for (i = 0; i < 54; i++) weeks[i] = 0; uids = camel_folder_get_uids (folder); @@ -1098,12 +1102,12 @@ build_histogram (GtkWidget *widget, CamelFolder *folder) } } - for (i=0; i< 53; i++) { + for (i = 0; i< 53; i++) { if (weeks[i] > max) max = weeks[i]; } - ratio = 50.0/max; + ratio = 50.0 / max; camel_folder_free_uids (folder, uids); @@ -1119,7 +1123,7 @@ build_histogram (GtkWidget *widget, CamelFolder *folder) cairo_set_source_rgba (cr, 0.3, 0.2, 0.4, 1.0); - for (i=51; i>=0; i--) { + for (i = 51; i >= 0; i--) { x+=3; cairo_line_to (cr, x, 50 - (weeks[i]*ratio)); @@ -1131,7 +1135,7 @@ build_histogram (GtkWidget *widget, CamelFolder *folder) cairo_save (cr); cairo_set_source_rgba (cr, 0.8, 0.5, 0.3, 1.0); - cairo_arc (cr, x, 50 - (weeks[0] * ratio), 3, 0, 2*M_PI); + cairo_arc (cr, x, 50 - (weeks[0] * ratio), 3, 0, 2 *M_PI); cairo_fill (cr); cairo_restore (cr); @@ -1409,7 +1413,7 @@ e_mail_notebook_view_reader_init (EMailReaderInterface *interface) } static void -e_mail_notebook_view_init (EMailNotebookView *view) +e_mail_notebook_view_init (EMailNotebookView *view) { view->priv = G_TYPE_INSTANCE_GET_PRIVATE ( view, E_TYPE_MAIL_NOTEBOOK_VIEW, EMailNotebookViewPrivate); @@ -1419,7 +1423,8 @@ e_mail_notebook_view_init (EMailNotebookView *view) } static void -emnv_show_folder (EMailNotebookView *view, gpointer not_used) +emnv_show_folder (EMailNotebookView *view, + gpointer not_used) { gint pos; EMailNotebookViewPrivate *priv = view->priv; @@ -1438,7 +1443,8 @@ emnv_show_folder (EMailNotebookView *view, gpointer not_used) } static void -emnv_show_prevtab (EMailNotebookView *view, gpointer not_used) +emnv_show_prevtab (EMailNotebookView *view, + gpointer not_used) { gint pos; EMailNotebookViewPrivate *priv = view->priv; @@ -1450,19 +1456,20 @@ emnv_show_prevtab (EMailNotebookView *view, gpointer not_used) #if HAVE_CLUTTER pos = e_mail_tab_picker_get_current_tab (priv->tab_picker); if (pos > 0) { - e_mail_tab_picker_set_current_tab (priv->tab_picker, pos-1); - mnv_set_current_tab (E_MAIL_NOTEBOOK_VIEW (view), pos-1); + e_mail_tab_picker_set_current_tab (priv->tab_picker, pos - 1); + mnv_set_current_tab (E_MAIL_NOTEBOOK_VIEW (view), pos - 1); } #else pos = gtk_notebook_get_current_page (priv->book); if (pos > 0 ) - gtk_notebook_set_current_page (priv->book, pos-1); + gtk_notebook_set_current_page (priv->book, pos - 1); #endif } static void -emnv_show_nexttab (EMailNotebookView *view, gpointer not_used) +emnv_show_nexttab (EMailNotebookView *view, + gpointer not_used) { gint pos; EMailNotebookViewPrivate *priv = view->priv; @@ -1470,20 +1477,21 @@ emnv_show_nexttab (EMailNotebookView *view, gpointer not_used) #if HAVE_CLUTTER pos = e_mail_tab_picker_get_current_tab (priv->tab_picker); - if (pos < (gtk_notebook_get_n_pages (priv->book)-1)) { - e_mail_tab_picker_set_current_tab (priv->tab_picker, pos+1); - mnv_set_current_tab (E_MAIL_NOTEBOOK_VIEW (view), pos+1); + if (pos < (gtk_notebook_get_n_pages (priv->book) - 1)) { + e_mail_tab_picker_set_current_tab (priv->tab_picker, pos + 1); + mnv_set_current_tab (E_MAIL_NOTEBOOK_VIEW (view), pos + 1); } #else pos = gtk_notebook_get_current_page (priv->book); - if (pos < (gtk_notebook_get_n_pages (priv->book)-1)) - gtk_notebook_set_current_page (priv->book, pos+1); + if (pos < (gtk_notebook_get_n_pages (priv->book) - 1)) + gtk_notebook_set_current_page (priv->book, pos + 1); #endif } static void -emnv_close_tab (EMailNotebookView *view, gpointer not_used) +emnv_close_tab (EMailNotebookView *view, + gpointer not_used) { EMailNotebookViewPrivate *priv = view->priv; diff --git a/mail/e-mail-pane.c b/mail/e-mail-pane.c index 6fa88afd0f..c982ab0267 100644 --- a/mail/e-mail-pane.c +++ b/mail/e-mail-pane.c @@ -37,7 +37,7 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; static void -e_mail_pane_init (EMailPane *shell) +e_mail_pane_init (EMailPane *shell) { shell->priv = g_new0 (EMailPanePrivate, 1); } diff --git a/mail/e-mail-paned-view.c b/mail/e-mail-paned-view.c index d9c44efd2c..c9ebb8a050 100644 --- a/mail/e-mail-paned-view.c +++ b/mail/e-mail-paned-view.c @@ -1052,7 +1052,8 @@ e_mail_paned_view_get_preview (EMailPanedView *view) } void -e_mail_paned_view_set_enable_show_folder (EMailPanedView *view, gboolean set) +e_mail_paned_view_set_enable_show_folder (EMailPanedView *view, + gboolean set) { view->priv->enable_show_folder = set ? 1 : 0; } diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c index adc5110851..4cc9465c7d 100644 --- a/mail/e-mail-reader-utils.c +++ b/mail/e-mail-reader-utils.c @@ -347,7 +347,8 @@ e_mail_reader_mark_selected (EMailReader *reader, return ii; } static void -copy_tree_state (EMailReader *src_reader, EMailReader *des_reader) +copy_tree_state (EMailReader *src_reader, + EMailReader *des_reader) { GtkWidget *src_mlist, *des_mlist; gchar *state; diff --git a/mail/e-mail-reader-utils.h b/mail/e-mail-reader-utils.h index da27112cd7..b566da16a7 100644 --- a/mail/e-mail-reader-utils.h +++ b/mail/e-mail-reader-utils.h @@ -32,8 +32,8 @@ typedef struct _EMailReaderHeader EMailReaderHeader; struct _EMailReaderHeader { gchar *name; - guint enabled:1; - guint is_default:1; + guint enabled : 1; + guint is_default : 1; }; gboolean e_mail_reader_confirm_delete (EMailReader *reader); diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index 0408d9539b..430f71dc4f 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -1511,7 +1511,7 @@ action_mail_reply_sender_cb (GtkAction *action, static void action_mail_reply_recipient_cb (GtkAction *action, - EMailReader *reader) + EMailReader *reader) { e_mail_reader_reply_to_message (reader, NULL, E_MAIL_REPLY_TO_RECIPIENT); check_close_browser_reader (reader); @@ -2538,7 +2538,7 @@ mail_reader_message_loaded_cb (CamelFolder *folder, if (!message_list) { /* for cases where message fetching took so long that - user closed the message window before this was called */ + * user closed the message window before this was called */ goto exit; } diff --git a/mail/e-mail-session.c b/mail/e-mail-session.c index ffcbb57e58..1003086d5b 100644 --- a/mail/e-mail-session.c +++ b/mail/e-mail-session.c @@ -125,9 +125,9 @@ struct _user_message_msg { gchar *prompt; EFlag *done; - guint allow_cancel:1; - guint result:1; - guint ismain:1; + guint allow_cancel : 1; + guint result : 1; + guint ismain : 1; }; static void user_message_exec (struct _user_message_msg *m, @@ -462,7 +462,7 @@ set_socks_proxy_from_gconf (CamelSession *session) } static void -proxy_gconf_notify_cb (GConfClient* client, +proxy_gconf_notify_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data) @@ -850,7 +850,7 @@ mail_session_get_password (CamelSession *session, config_service = account->transport; } - remember = config_service?config_service->save_passwd:FALSE; + remember = config_service ? config_service->save_passwd : FALSE; if (!config_service || (config_service && !config_service->get_password_canceled)) { diff --git a/mail/e-mail-store.c b/mail/e-mail-store.c index 7c79e1ca54..ea44e4238b 100644 --- a/mail/e-mail-store.c +++ b/mail/e-mail-store.c @@ -285,7 +285,7 @@ e_mail_store_add_by_account (EMailSession *session, transport_only = !account->source || !account->source->url || !*account->source->url; if (transport_only) goto handle_transport; - + /* Load the service, but don't connect. Check its provider, * and if this belongs in the folder tree model, add it. */ diff --git a/mail/e-mail-tab-picker.c b/mail/e-mail-tab-picker.c index 160a03df6a..cc257284dc 100644 --- a/mail/e-mail-tab-picker.c +++ b/mail/e-mail-tab-picker.c @@ -153,7 +153,7 @@ e_mail_tab_picker_drop (MxDroppable *droppable, } /* The same check for dragging left instead of right */ - if ((event_x < props->position + props->width + priv->scroll_offset)&& + if ((event_x < props->position + props->width + priv->scroll_offset) && (tab->position >= props->position) && !mx_draggable_is_enabled (MX_DRAGGABLE (props->tab))) break; @@ -802,9 +802,7 @@ e_mail_tab_picker_class_init (EMailTabPickerClass *class) "in preview mode.", FALSE, G_PARAM_READWRITE | - G_PARAM_STATIC_NAME | - G_PARAM_STATIC_NICK | - G_PARAM_STATIC_BLURB)); + G_PARAM_STATIC_STRINGS)); g_object_class_override_property ( object_class, @@ -924,7 +922,8 @@ e_mail_tab_picker_init (EMailTabPicker *self) } static gint -e_mail_tab_picker_find_tab_cb (gconstpointer a, gconstpointer b) +e_mail_tab_picker_find_tab_cb (gconstpointer a, + gconstpointer b) { EMailTabPickerProps *props = (EMailTabPickerProps *) a; EMailTab *tab = (EMailTab *) b; @@ -933,7 +932,8 @@ e_mail_tab_picker_find_tab_cb (gconstpointer a, gconstpointer b) } static void -e_mail_tab_picker_tab_clicked_cb (EMailTab *tab, EMailTabPicker *self) +e_mail_tab_picker_tab_clicked_cb (EMailTab *tab, + EMailTabPicker *self) { EMailTabPickerPrivate *priv = self->priv; EMailTab *old_tab; @@ -1037,7 +1037,8 @@ e_mail_tab_picker_add_tab (EMailTabPicker *picker, } void -e_mail_tab_picker_remove_tab (EMailTabPicker *picker, EMailTab *tab) +e_mail_tab_picker_remove_tab (EMailTabPicker *picker, + EMailTab *tab) { GList *tab_link; EMailTabPickerPrivate *priv = picker->priv; @@ -1098,14 +1099,16 @@ e_mail_tab_picker_get_tabs (EMailTabPicker *picker) } EMailTab * -e_mail_tab_picker_get_tab (EMailTabPicker *picker, gint tab) +e_mail_tab_picker_get_tab (EMailTabPicker *picker, + gint 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) +e_mail_tab_picker_get_tab_no (EMailTabPicker *picker, + EMailTab *tab) { GList *tab_link; @@ -1123,7 +1126,8 @@ e_mail_tab_picker_get_current_tab (EMailTabPicker *picker) } void -e_mail_tab_picker_set_current_tab (EMailTabPicker *picker, gint tab_no) +e_mail_tab_picker_set_current_tab (EMailTabPicker *picker, + gint tab_no) { EMailTabPickerPrivate *priv = picker->priv; EMailTabPickerProps *props; @@ -1223,7 +1227,8 @@ preview_completed_cb (ClutterTimeline *timeline, } void -e_mail_tab_picker_set_preview_mode (EMailTabPicker *picker, gboolean preview) +e_mail_tab_picker_set_preview_mode (EMailTabPicker *picker, + gboolean preview) { GList *t; @@ -1305,7 +1310,8 @@ e_mail_tab_picker_get_preview_mode (EMailTabPicker *picker) } void -e_mail_tab_picker_enable_drop (EMailTabPicker *picker, gboolean enable) +e_mail_tab_picker_enable_drop (EMailTabPicker *picker, + gboolean enable) { EMailTabPickerPrivate *priv = picker->priv; diff --git a/mail/e-mail-tab.c b/mail/e-mail-tab.c index 213e545da7..cb461c28f3 100644 --- a/mail/e-mail-tab.c +++ b/mail/e-mail-tab.c @@ -29,43 +29,38 @@ static void mx_draggable_iface_init (MxDraggableIface *iface); -G_DEFINE_TYPE_WITH_CODE (EMailTab, - e_mail_tab, - MX_TYPE_WIDGET, - G_IMPLEMENT_INTERFACE (MX_TYPE_DRAGGABLE, - mx_draggable_iface_init)) - -enum -{ - PROP_0, - - PROP_ICON, - PROP_TEXT, - PROP_CAN_CLOSE, - PROP_TAB_WIDTH, - PROP_DOCKING, - PROP_PREVIEW, - PROP_PREVIEW_MODE, - PROP_PREVIEW_DURATION, - PROP_SPACING, - PROP_PRIVATE, - PROP_ACTIVE, - - PROP_DRAG_THRESHOLD, - PROP_DRAG_AXIS, - // PROP_DRAG_CONTAINMENT_TYPE, - PROP_DRAG_CONTAINMENT_AREA, - PROP_DRAG_ENABLED, - PROP_DRAG_ACTOR, +G_DEFINE_TYPE_WITH_CODE ( + EMailTab, + e_mail_tab, + MX_TYPE_WIDGET, + G_IMPLEMENT_INTERFACE ( + MX_TYPE_DRAGGABLE, mx_draggable_iface_init)) + +enum { + PROP_0, + PROP_ICON, + PROP_TEXT, + PROP_CAN_CLOSE, + PROP_TAB_WIDTH, + PROP_DOCKING, + PROP_PREVIEW, + PROP_PREVIEW_MODE, + PROP_PREVIEW_DURATION, + PROP_SPACING, + PROP_PRIVATE, + PROP_ACTIVE, + PROP_DRAG_THRESHOLD, + PROP_DRAG_AXIS, + PROP_DRAG_CONTAINMENT_AREA, + PROP_DRAG_ENABLED, + PROP_DRAG_ACTOR, }; -enum -{ - CLICKED, - CLOSED, - TRANSITION_COMPLETE, - - LAST_SIGNAL +enum { + CLICKED, + CLOSED, + TRANSITION_COMPLETE, + LAST_SIGNAL }; /* Animation stage lengths */ @@ -76,1825 +71,1834 @@ static guint signals[LAST_SIGNAL] = { 0, }; static void e_mail_tab_close_clicked_cb (MxButton *button, EMailTab *self); -struct _EMailTabPrivate -{ - ClutterActor *icon; - ClutterActor *default_icon; - ClutterActor *label; - ClutterActor *close_button; - gboolean can_close; - gint width; - gboolean docking; - gfloat spacing; - gboolean private; - guint alert_count; - guint alert_source; - gboolean has_text; - - guint active : 1; - guint pressed : 1; - guint hover : 1; - - ClutterActor *preview; - gboolean preview_mode; - ClutterTimeline *preview_timeline; - gdouble preview_height_progress; - guint anim_length; - - ClutterActor *old_bg; - - ClutterActor *drag_actor; - ClutterActorBox drag_area; - gboolean drag_enabled; - MxDragAxis drag_axis; - // MxDragContainment containment; - gint drag_threshold; - gulong drag_threshold_handler; - gfloat press_x; - gfloat press_y; - gboolean in_drag; +struct _EMailTabPrivate { + ClutterActor *icon; + ClutterActor *default_icon; + ClutterActor *label; + ClutterActor *close_button; + gboolean can_close; + gint width; + gboolean docking; + gfloat spacing; + gboolean private; + guint alert_count; + guint alert_source; + gboolean has_text; + + guint active : 1; + guint pressed : 1; + guint hover : 1; + + ClutterActor *preview; + gboolean preview_mode; + ClutterTimeline *preview_timeline; + gdouble preview_height_progress; + guint anim_length; + + ClutterActor *old_bg; + + ClutterActor *drag_actor; + ClutterActorBox drag_area; + gboolean drag_enabled; + MxDragAxis drag_axis; + gint drag_threshold; + gulong drag_threshold_handler; + gfloat press_x; + gfloat press_y; + gboolean in_drag; }; static void -e_mail_tab_drag_begin (MxDraggable *draggable, - gfloat event_x, - gfloat event_y, - gint event_button, - ClutterModifierType modifiers) -{ - gfloat x, y; - - EMailTabPrivate *priv = E_MAIL_TAB (draggable)->priv; - ClutterActor *self = CLUTTER_ACTOR (draggable); - ClutterActor *actor = mx_draggable_get_drag_actor (draggable); - ClutterActor *stage = clutter_actor_get_stage (self); - - priv->in_drag = TRUE; - - clutter_actor_get_transformed_position (self, &x, &y); - clutter_actor_set_position (actor, x, y); - - /* Start up animation */ - if (CLUTTER_IS_TEXTURE (actor)) - { - /* TODO: Some neat deformation effect? */ - } - else - { - /* Fade in */ - clutter_actor_set_opacity (actor, 0x00); - clutter_actor_animate (actor, CLUTTER_LINEAR, 150, - "opacity", 0xff, - NULL); - } - clutter_container_add_actor (CLUTTER_CONTAINER (stage), actor); +e_mail_tab_drag_begin (MxDraggable *draggable, + gfloat event_x, + gfloat event_y, + gint event_button, + ClutterModifierType modifiers) +{ + gfloat x, y; + + EMailTabPrivate *priv = E_MAIL_TAB (draggable)->priv; + ClutterActor *self = CLUTTER_ACTOR (draggable); + ClutterActor *actor = mx_draggable_get_drag_actor (draggable); + ClutterActor *stage = clutter_actor_get_stage (self); + + priv->in_drag = TRUE; + + clutter_actor_get_transformed_position (self, &x, &y); + clutter_actor_set_position (actor, x, y); + + /* Start up animation */ + if (CLUTTER_IS_TEXTURE (actor)) { + /* TODO: Some neat deformation effect? */ + } else { + /* Fade in */ + clutter_actor_set_opacity (actor, 0x00); + clutter_actor_animate ( + actor, CLUTTER_LINEAR, 150, + "opacity", 0xff, + NULL); + } + + clutter_container_add_actor (CLUTTER_CONTAINER (stage), actor); } static void e_mail_tab_drag_motion (MxDraggable *draggable, - gfloat delta_x, - gfloat delta_y) + gfloat delta_x, + gfloat delta_y) { - ClutterActor *actor = mx_draggable_get_drag_actor (draggable); - clutter_actor_move_by (actor, delta_x, delta_y); + ClutterActor *actor = mx_draggable_get_drag_actor (draggable); + clutter_actor_move_by (actor, delta_x, delta_y); } static void e_mail_tab_drag_end_anim_cb (ClutterAnimation *animation, - EMailTab *tab) + EMailTab *tab) { - ClutterActor *actor = - CLUTTER_ACTOR (clutter_animation_get_object (animation)); - ClutterActor *parent = clutter_actor_get_parent (actor); + ClutterActor *actor = + CLUTTER_ACTOR (clutter_animation_get_object (animation)); + ClutterActor *parent = clutter_actor_get_parent (actor); - if (parent) - clutter_container_remove_actor (CLUTTER_CONTAINER (parent), actor); + if (parent) + clutter_container_remove_actor ( + CLUTTER_CONTAINER (parent), actor); } static void e_mail_tab_drag_end (MxDraggable *draggable, - gfloat event_x, - gfloat event_y) -{ - EMailTab *self = E_MAIL_TAB (draggable); - EMailTabPrivate *priv = self->priv; - - priv->in_drag = FALSE; - - if (priv->drag_actor) - { - ClutterActor *parent = clutter_actor_get_parent (priv->drag_actor); - if (parent) - { - /* Animate drop */ - if (CLUTTER_IS_TEXTURE (priv->drag_actor)) - { - /* TODO: Some neat deformation effect? */ - clutter_container_remove_actor (CLUTTER_CONTAINER (parent), - priv->drag_actor); - } - else - { - clutter_actor_animate (priv->drag_actor, CLUTTER_LINEAR, 150, - "opacity", 0x00, - "signal::completed", - G_CALLBACK (e_mail_tab_drag_end_anim_cb), - self, - NULL); - } + gfloat event_x, + gfloat event_y) +{ + EMailTab *self = E_MAIL_TAB (draggable); + EMailTabPrivate *priv = self->priv; + + priv->in_drag = FALSE; + + if (priv->drag_actor) { + ClutterActor *parent = clutter_actor_get_parent (priv->drag_actor); + if (parent) { + /* Animate drop */ + if (CLUTTER_IS_TEXTURE (priv->drag_actor)) { + /* TODO: Some neat deformation effect? */ + clutter_container_remove_actor ( + CLUTTER_CONTAINER (parent), + priv->drag_actor); + } else { + clutter_actor_animate ( + priv->drag_actor, + CLUTTER_LINEAR, 150, + "opacity", 0x00, + "signal::completed", + G_CALLBACK (e_mail_tab_drag_end_anim_cb), + self, NULL); + } + } + + g_object_unref (priv->drag_actor); + priv->drag_actor = NULL; } - g_object_unref (priv->drag_actor); - priv->drag_actor = NULL; - } } static void mx_draggable_iface_init (MxDraggableIface *iface) { - iface->drag_begin = e_mail_tab_drag_begin; - iface->drag_motion = e_mail_tab_drag_motion; - iface->drag_end = e_mail_tab_drag_end; + iface->drag_begin = e_mail_tab_drag_begin; + iface->drag_motion = e_mail_tab_drag_motion; + iface->drag_end = e_mail_tab_drag_end; } static void -e_mail_tab_get_property (GObject *object, guint property_id, - GValue *value, GParamSpec *pspec) -{ - EMailTab *tab = E_MAIL_TAB (object); - EMailTabPrivate *priv = tab->priv; - - switch (property_id) - { - case PROP_ICON: - g_value_set_object (value, e_mail_tab_get_icon (tab)); - break; - - case PROP_TEXT: - g_value_set_string (value, e_mail_tab_get_text (tab)); - break; - - case PROP_CAN_CLOSE: - g_value_set_boolean (value, e_mail_tab_get_can_close (tab)); - break; - - case PROP_TAB_WIDTH: - g_value_set_int (value, e_mail_tab_get_width (tab)); - break; - - case PROP_DOCKING: - g_value_set_boolean (value, e_mail_tab_get_docking (tab)); - break; - - case PROP_PREVIEW: - g_value_set_object (value, e_mail_tab_get_preview_actor (tab)); - break; - - case PROP_PREVIEW_MODE: - g_value_set_boolean (value, e_mail_tab_get_preview_mode (tab)); - break; - - case PROP_PREVIEW_DURATION: - g_value_set_uint (value, e_mail_tab_get_preview_duration (tab)); - break; - - case PROP_SPACING: - g_value_set_float (value, e_mail_tab_get_spacing (tab)); - break; - - case PROP_PRIVATE: - g_value_set_boolean (value, e_mail_tab_get_private (tab)); - break; - - case PROP_ACTIVE: - g_value_set_boolean (value, e_mail_tab_get_active (tab)); - break; - - case PROP_DRAG_THRESHOLD: - g_value_set_uint (value, (guint) priv->drag_threshold); - break; - - case PROP_DRAG_AXIS: - g_value_set_enum (value, priv->drag_axis); - break; - -// case PROP_DRAG_CONTAINMENT_TYPE: - // g_value_set_enum (value, priv->containment); - // break; - - case PROP_DRAG_CONTAINMENT_AREA: - g_value_set_boxed (value, &priv->drag_area); - break; - - case PROP_DRAG_ENABLED: - g_value_set_boolean (value, priv->drag_enabled); - break; - - case PROP_DRAG_ACTOR: - if (!priv->drag_actor) - { - ClutterActor *fbo = - /*clutter_texture_new_from_actor (CLUTTER_ACTOR (tab));*/ - NULL; - if (fbo) - { - /* This is where we'd setup deformations, or something along - * those lines. - */ - priv->drag_actor = g_object_ref_sink (fbo); - } - else - priv->drag_actor = - g_object_ref_sink (clutter_clone_new (CLUTTER_ACTOR (tab))); - } - g_value_set_object (value, priv->drag_actor); - break; +e_mail_tab_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + EMailTab *tab = E_MAIL_TAB (object); + EMailTabPrivate *priv = tab->priv; + + switch (property_id) { + case PROP_ICON: + g_value_set_object (value, e_mail_tab_get_icon (tab)); + break; + + case PROP_TEXT: + g_value_set_string (value, e_mail_tab_get_text (tab)); + break; + + case PROP_CAN_CLOSE: + g_value_set_boolean (value, e_mail_tab_get_can_close (tab)); + break; + + case PROP_TAB_WIDTH: + g_value_set_int (value, e_mail_tab_get_width (tab)); + break; + + case PROP_DOCKING: + g_value_set_boolean (value, e_mail_tab_get_docking (tab)); + break; + + case PROP_PREVIEW: + g_value_set_object (value, e_mail_tab_get_preview_actor (tab)); + break; + + case PROP_PREVIEW_MODE: + g_value_set_boolean (value, e_mail_tab_get_preview_mode (tab)); + break; + + case PROP_PREVIEW_DURATION: + g_value_set_uint (value, e_mail_tab_get_preview_duration (tab)); + break; + + case PROP_SPACING: + g_value_set_float (value, e_mail_tab_get_spacing (tab)); + break; + + case PROP_PRIVATE: + g_value_set_boolean (value, e_mail_tab_get_private (tab)); + break; + + case PROP_ACTIVE: + g_value_set_boolean (value, e_mail_tab_get_active (tab)); + break; + + case PROP_DRAG_THRESHOLD: + g_value_set_uint (value, (guint) priv->drag_threshold); + break; + + case PROP_DRAG_AXIS: + g_value_set_enum (value, priv->drag_axis); + break; + + case PROP_DRAG_CONTAINMENT_AREA: + g_value_set_boxed (value, &priv->drag_area); + break; + + case PROP_DRAG_ENABLED: + g_value_set_boolean (value, priv->drag_enabled); + break; + + case PROP_DRAG_ACTOR: + if (!priv->drag_actor) + priv->drag_actor = g_object_ref_sink ( + clutter_clone_new (CLUTTER_ACTOR (tab))); + g_value_set_object (value, priv->drag_actor); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } +} - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - } +static void +e_mail_tab_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + EMailTab *tab = E_MAIL_TAB (object); + EMailTabPrivate *priv = tab->priv; + + switch (property_id) { + case PROP_ICON: + e_mail_tab_set_icon ( + tab, g_value_get_object (value)); + break; + + case PROP_TEXT: + e_mail_tab_set_text ( + tab, g_value_get_string (value)); + break; + + case PROP_CAN_CLOSE: + e_mail_tab_set_can_close ( + tab, g_value_get_boolean (value)); + + case PROP_TAB_WIDTH: + e_mail_tab_set_width ( + tab, g_value_get_int (value)); + break; + + case PROP_DOCKING: + e_mail_tab_set_docking ( + tab, g_value_get_boolean (value)); + break; + + case PROP_PREVIEW: + e_mail_tab_set_preview_actor ( + tab, g_value_get_object (value)); + break; + + case PROP_PREVIEW_MODE: + e_mail_tab_set_preview_mode ( + tab, g_value_get_boolean (value)); + break; + + case PROP_PREVIEW_DURATION: + e_mail_tab_set_preview_duration ( + tab, g_value_get_uint (value)); + break; + + case PROP_SPACING: + e_mail_tab_set_spacing ( + tab, g_value_get_float (value)); + break; + + case PROP_PRIVATE: + e_mail_tab_set_private ( + tab, g_value_get_boolean (value)); + break; + + case PROP_ACTIVE: + e_mail_tab_set_active ( + tab, g_value_get_boolean (value)); + break; + + case PROP_DRAG_THRESHOLD: + break; + + case PROP_DRAG_AXIS: + priv->drag_axis = g_value_get_enum (value); + break; + + case PROP_DRAG_CONTAINMENT_AREA: + { + ClutterActorBox *box = g_value_get_boxed (value); + + if (box) + priv->drag_area = *box; + else + memset ( + &priv->drag_area, 0, + sizeof (ClutterActorBox)); + break; + } + + case PROP_DRAG_ENABLED: + priv->drag_enabled = g_value_get_boolean (value); + break; + + case PROP_DRAG_ACTOR: + { + ClutterActor *new_actor = g_value_get_object (value); + + if (priv->drag_actor) { + ClutterActor *parent; + + parent = clutter_actor_get_parent (priv->drag_actor); + + /* We know it's a container because we added it ourselves */ + if (parent) + clutter_container_remove_actor ( + CLUTTER_CONTAINER (parent), + priv->drag_actor); + + g_object_unref (priv->drag_actor); + priv->drag_actor = NULL; + } + + if (new_actor) + priv->drag_actor = g_object_ref_sink (new_actor); + + break; + } + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } } static void -e_mail_tab_set_property (GObject *object, guint property_id, - const GValue *value, GParamSpec *pspec) +e_mail_tab_dispose_old_bg (EMailTab *tab) { - EMailTab *tab = E_MAIL_TAB (object); - EMailTabPrivate *priv = tab->priv; + EMailTabPrivate *priv = tab->priv; - switch (property_id) - { - case PROP_ICON: - e_mail_tab_set_icon (tab, g_value_get_object (value)); - break; + if (priv->old_bg) { + ClutterActor *parent; - case PROP_TEXT: - e_mail_tab_set_text (tab, g_value_get_string (value)); - break; - - case PROP_CAN_CLOSE: - e_mail_tab_set_can_close (tab, g_value_get_boolean (value)); - - case PROP_TAB_WIDTH: - e_mail_tab_set_width (tab, g_value_get_int (value)); - break; - - case PROP_DOCKING: - e_mail_tab_set_docking (tab, g_value_get_boolean (value)); - break; - - case PROP_PREVIEW: - e_mail_tab_set_preview_actor (tab, - CLUTTER_ACTOR (g_value_get_object (value))); - break; - - case PROP_PREVIEW_MODE: - e_mail_tab_set_preview_mode (tab, g_value_get_boolean (value)); - break; - - case PROP_PREVIEW_DURATION: - e_mail_tab_set_preview_duration (tab, g_value_get_uint (value)); - break; - - case PROP_SPACING: - e_mail_tab_set_spacing (tab, g_value_get_float (value)); - break; - - case PROP_PRIVATE: - e_mail_tab_set_private (tab, g_value_get_boolean (value)); - break; - - case PROP_ACTIVE: - e_mail_tab_set_active (tab, g_value_get_boolean (value)); - break; - - case PROP_DRAG_THRESHOLD: - break; + parent = clutter_actor_get_parent (priv->old_bg); + if (parent == (ClutterActor *) tab) + clutter_actor_unparent (priv->old_bg); + g_object_unref (priv->old_bg); + priv->old_bg = NULL; + } +} - case PROP_DRAG_AXIS: - priv->drag_axis = g_value_get_enum (value); - break; +static void +e_mail_tab_dispose (GObject *object) +{ + EMailTab *tab = E_MAIL_TAB (object); + EMailTabPrivate *priv = tab->priv; -// case PROP_DRAG_CONTAINMENT_TYPE: - // priv->containment = g_value_get_enum (value); - // break; + e_mail_tab_dispose_old_bg (tab); - case PROP_DRAG_CONTAINMENT_AREA: - { - ClutterActorBox *box = g_value_get_boxed (value); + if (priv->icon) { + clutter_actor_unparent (priv->icon); + priv->icon = NULL; + } - if (box) - priv->drag_area = *box; - else - memset (&priv->drag_area, 0, sizeof (ClutterActorBox)); + if (priv->default_icon) { + g_object_unref (priv->default_icon); + priv->default_icon = NULL; + } - break; - } + if (priv->label) { + clutter_actor_unparent (CLUTTER_ACTOR (priv->label)); + priv->label = NULL; + } - case PROP_DRAG_ENABLED: - priv->drag_enabled = g_value_get_boolean (value); - break; + if (priv->close_button) { + clutter_actor_unparent (CLUTTER_ACTOR (priv->close_button)); + priv->close_button = NULL; + } - case PROP_DRAG_ACTOR: - { - ClutterActor *new_actor = g_value_get_object (value); + if (priv->preview) { + clutter_actor_unparent (priv->preview); + priv->preview = NULL; + } - if (priv->drag_actor) - { - ClutterActor *parent = clutter_actor_get_parent (priv->drag_actor); + if (priv->alert_source) { + g_source_remove (priv->alert_source); + priv->alert_source = 0; + } - /* We know it's a container because we added it ourselves */ - if (parent) - clutter_container_remove_actor (CLUTTER_CONTAINER (parent), - priv->drag_actor); + if (priv->drag_actor) { + ClutterActor *parent; - g_object_unref (priv->drag_actor); - priv->drag_actor = NULL; - } + parent = clutter_actor_get_parent (priv->drag_actor); + if (parent) + clutter_container_remove_actor ( + CLUTTER_CONTAINER (parent), + priv->drag_actor); - if (new_actor) - priv->drag_actor = g_object_ref_sink (new_actor); + g_object_unref (priv->drag_actor); + priv->drag_actor = NULL; + } - break; - } + if (priv->drag_threshold_handler) + g_signal_handler_disconnect ( + gtk_settings_get_default (), + priv->drag_threshold_handler); + priv->drag_threshold_handler = 0; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - } + G_OBJECT_CLASS (e_mail_tab_parent_class)->dispose (object); } static void -e_mail_tab_dispose_old_bg (EMailTab *tab) -{ - EMailTabPrivate *priv = tab->priv; - - if (priv->old_bg) - { - if (clutter_actor_get_parent (priv->old_bg) == (ClutterActor *) tab) - clutter_actor_unparent (priv->old_bg); - g_object_unref (priv->old_bg); - priv->old_bg = NULL; - } +e_mail_tab_get_preferred_width (ClutterActor *actor, + gfloat for_height, + gfloat *min_width_p, + gfloat *natural_width_p) +{ + MxPadding padding; + EMailTabPrivate *priv = E_MAIL_TAB (actor)->priv; + + /* Get padding */ + 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; + + if (priv->width >= 0) { + if (natural_width_p) + *natural_width_p += priv->width; + } else { + gfloat min_width, nat_width, acc_min_width, acc_nat_width; + + acc_min_width = acc_nat_width = 0; + + if (priv->has_text) + clutter_actor_get_preferred_size ( + CLUTTER_ACTOR (priv->label), + &acc_min_width, NULL, + &acc_nat_width, NULL); + + if (priv->icon) + clutter_actor_get_preferred_size ( + priv->icon, + &min_width, NULL, + &nat_width, NULL); + acc_min_width += min_width; + acc_nat_width += nat_width; + + if (priv->can_close) + clutter_actor_get_preferred_size ( + CLUTTER_ACTOR (priv->close_button), + &min_width, NULL, + &nat_width, NULL); + acc_min_width += min_width; + acc_nat_width += nat_width; + + if (priv->preview && priv->preview_mode) { + clutter_actor_get_preferred_size ( + priv->preview, + &min_width, NULL, + &nat_width, NULL); + + if (min_width > acc_min_width) + acc_min_width = min_width; + if (nat_width > acc_nat_width) + acc_nat_width = nat_width; + } + + if (min_width_p) + *min_width_p += acc_min_width; + if (natural_width_p) + *natural_width_p += acc_nat_width; + } } -static void -e_mail_tab_dispose (GObject *object) -{ - EMailTab *tab = E_MAIL_TAB (object); - EMailTabPrivate *priv = tab->priv; - - e_mail_tab_dispose_old_bg (tab); - - if (priv->icon) - { - clutter_actor_unparent (priv->icon); - priv->icon = NULL; - } - - if (priv->default_icon) - { - g_object_unref (priv->default_icon); - priv->default_icon = NULL; - } - - if (priv->label) - { - clutter_actor_unparent (CLUTTER_ACTOR (priv->label)); - priv->label = NULL; - } - - if (priv->close_button) - { - clutter_actor_unparent (CLUTTER_ACTOR (priv->close_button)); - priv->close_button = NULL; - } - - if (priv->preview) - { - clutter_actor_unparent (priv->preview); - priv->preview = NULL; - } - - if (priv->alert_source) - { - g_source_remove (priv->alert_source); - priv->alert_source = 0; - } - - if (priv->drag_actor) - { - ClutterActor *parent = clutter_actor_get_parent (priv->drag_actor); - if (parent) - clutter_container_remove_actor (CLUTTER_CONTAINER (parent), - priv->drag_actor); - g_object_unref (priv->drag_actor); - priv->drag_actor = NULL; - } - - if (priv->drag_threshold_handler) - { - g_signal_handler_disconnect (gtk_settings_get_default (), - priv->drag_threshold_handler); - priv->drag_threshold_handler = 0; - } - - G_OBJECT_CLASS (e_mail_tab_parent_class)->dispose (object); +void +e_mail_tab_get_height_no_preview (EMailTab *tab, + gfloat for_width, + gfloat *min_height_p, + gfloat *natural_height_p) +{ + MxPadding padding; + gfloat min_height, nat_height, tmp_min_height, tmp_nat_height; + + ClutterActor *actor = CLUTTER_ACTOR (tab); + EMailTabPrivate *priv = tab->priv; + + /* Get padding */ + 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; + + min_height = nat_height = 0; + if (priv->has_text) + clutter_actor_get_preferred_height ( + CLUTTER_ACTOR (priv->label), -1, + &min_height, &nat_height); + + if (priv->icon) { + clutter_actor_get_preferred_height ( + priv->icon, -1, &tmp_min_height, &tmp_nat_height); + if (tmp_min_height > min_height) + min_height = tmp_min_height; + if (tmp_nat_height > nat_height) + nat_height = tmp_nat_height; + } + + if (priv->can_close) { + clutter_actor_get_preferred_height ( + CLUTTER_ACTOR (priv->close_button), + -1, &tmp_min_height, &tmp_nat_height); + + if (tmp_min_height > min_height) + min_height = tmp_min_height; + if (tmp_nat_height > nat_height) + nat_height = tmp_nat_height; + } + + if (min_height_p) + *min_height_p += min_height; + if (natural_height_p) + *natural_height_p += nat_height; } static void -e_mail_tab_finalize (GObject *object) -{ - G_OBJECT_CLASS (e_mail_tab_parent_class)->finalize (object); +e_mail_tab_get_preferred_height (ClutterActor *actor, + gfloat for_width, + gfloat *min_height_p, + gfloat *natural_height_p) +{ + EMailTab *tab = E_MAIL_TAB (actor); + EMailTabPrivate *priv = tab->priv; + + e_mail_tab_get_height_no_preview ( + tab, for_width, min_height_p, natural_height_p); + + if (priv->preview) { + MxPadding padding; + gfloat min_height, nat_height; + gfloat label_min_height, label_nat_height; + + /* Get preview + padding height */ + mx_widget_get_padding (MX_WIDGET (actor), &padding); + + clutter_actor_get_preferred_height ( + priv->preview, + (gfloat) priv->width, + &min_height, &nat_height); + + /* Add label height */ + clutter_actor_get_preferred_height ( + CLUTTER_ACTOR (priv->label), -1, + &label_min_height, &label_nat_height); + + min_height = + (min_height * priv->preview_height_progress) + + padding.top + padding.bottom + priv->spacing + + label_min_height; + + nat_height = + (nat_height * priv->preview_height_progress) + + padding.top + padding.bottom + priv->spacing + + label_nat_height; + + /* Sometimes the preview's natural height will be nan due to + * keeping of the aspect ratio. This guards against that and + * stops Clutter from warning that the natural height is less + * than the minimum height. */ + if (isnan (nat_height)) + nat_height = min_height; + + if (min_height_p && (min_height > *min_height_p)) + *min_height_p = min_height; + if (natural_height_p && (nat_height > *natural_height_p)) + *natural_height_p = nat_height; + } } static void -e_mail_tab_get_preferred_width (ClutterActor *actor, - gfloat for_height, - gfloat *min_width_p, - gfloat *natural_width_p) -{ - MxPadding padding; - EMailTabPrivate *priv = E_MAIL_TAB (actor)->priv; - - /* Get padding */ - 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; - - if (priv->width >= 0) - { - if (natural_width_p) - *natural_width_p += priv->width; - } - else - { - gfloat min_width, nat_width, acc_min_width, acc_nat_width; - - acc_min_width = acc_nat_width = 0; - - if (priv->has_text) - clutter_actor_get_preferred_size (CLUTTER_ACTOR (priv->label), - &acc_min_width, NULL, - &acc_nat_width, NULL); - - if (priv->icon) - { - clutter_actor_get_preferred_size (priv->icon, - &min_width, NULL, - &nat_width, NULL); - acc_min_width += min_width; - acc_nat_width += nat_width; +e_mail_tab_allocate (ClutterActor *actor, + const ClutterActorBox *box, + ClutterAllocationFlags flags) +{ + MxPadding padding; + ClutterActorBox child_box; + gfloat icon_width, icon_height; + gfloat label_width, label_height; + gfloat close_width, close_height; + gfloat preview_width, preview_height; + + EMailTabPrivate *priv = E_MAIL_TAB (actor)->priv; + + /* Chain up to store box */ + CLUTTER_ACTOR_CLASS (e_mail_tab_parent_class)->allocate (actor, box, flags); + + /* Possibly synchronise an axis if we're dragging */ + if (priv->in_drag) { + ClutterActor *drag_actor = + mx_draggable_get_drag_actor (MX_DRAGGABLE (actor)); + + if (drag_actor) { + gfloat x, y; + clutter_actor_get_transformed_position (actor, &x, &y); + + switch (mx_draggable_get_axis (MX_DRAGGABLE (actor))) { + case MX_DRAG_AXIS_X : + /* Synchronise y axis */ + clutter_actor_set_y (drag_actor, y); + break; + case MX_DRAG_AXIS_Y : + /* Synchronise x axis */ + clutter_actor_set_x (drag_actor, x); + break; + default: + break; + } + } } - if (priv->can_close) - { - clutter_actor_get_preferred_size (CLUTTER_ACTOR (priv->close_button), - &min_width, NULL, - &nat_width, NULL); - acc_min_width += min_width; - acc_nat_width += nat_width; + /* Allocate old background texture */ + if (priv->old_bg) { + child_box.x1 = 0; + child_box.y1 = 0; + child_box.x2 = box->x2 - box->x1; + child_box.y2 = box->y2 - box->y1; + clutter_actor_allocate (priv->old_bg, &child_box, flags); } - if (priv->preview && priv->preview_mode) - { - clutter_actor_get_preferred_size (priv->preview, - &min_width, NULL, - &nat_width, NULL); - if (min_width > acc_min_width) - acc_min_width = min_width; - if (nat_width > acc_nat_width) - acc_nat_width = nat_width; + mx_widget_get_padding (MX_WIDGET (actor), &padding); + + /* Get the preferred width/height of the icon, + * label and close-button first. */ + if (priv->icon) + clutter_actor_get_preferred_size ( + priv->icon, NULL, NULL, + &icon_width, &icon_height); + + clutter_actor_get_preferred_size ( + CLUTTER_ACTOR (priv->label), NULL, NULL, + &label_width, &label_height); + + if (priv->can_close) + clutter_actor_get_preferred_size ( + CLUTTER_ACTOR (priv->close_button), + NULL, NULL, &close_width, &close_height); + + /* Allocate for icon */ + if (priv->icon) { + child_box.x1 = padding.left; + child_box.x2 = child_box.x1 + icon_width; + child_box.y1 = E_MAIL_PIXBOUND ((box->y2 - box->y1) / 2 - icon_height / 2); + child_box.y2 = child_box.y1 + icon_height; + clutter_actor_allocate (priv->icon, &child_box, flags); } - if (min_width_p) - *min_width_p += acc_min_width; - if (natural_width_p) - *natural_width_p += acc_nat_width; - } -} - -void -e_mail_tab_get_height_no_preview (EMailTab *tab, - gfloat for_width, - gfloat *min_height_p, - gfloat *natural_height_p) -{ - MxPadding padding; - gfloat min_height, nat_height, tmp_min_height, tmp_nat_height; - - ClutterActor *actor = CLUTTER_ACTOR (tab); - EMailTabPrivate *priv = tab->priv; - - /* Get padding */ - 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; - - min_height = nat_height = 0; - if (priv->has_text) - clutter_actor_get_preferred_height (CLUTTER_ACTOR (priv->label), -1, - &min_height, &nat_height); - - if (priv->icon) - { - clutter_actor_get_preferred_height (priv->icon, -1, - &tmp_min_height, &tmp_nat_height); - if (tmp_min_height > min_height) - min_height = tmp_min_height; - if (tmp_nat_height > nat_height) - nat_height = tmp_nat_height; - } - - if (priv->can_close) - { - clutter_actor_get_preferred_height (CLUTTER_ACTOR (priv->close_button), - -1, &tmp_min_height, &tmp_nat_height); - if (tmp_min_height > min_height) - min_height = tmp_min_height; - if (tmp_nat_height > nat_height) - nat_height = tmp_nat_height; - } - - if (min_height_p) - *min_height_p += min_height; - if (natural_height_p) - *natural_height_p += nat_height; -} + /* Allocate for close button */ + if (priv->can_close) { + child_box.x2 = box->x2 - box->x1 - padding.right; + child_box.x1 = child_box.x2 - close_width; + child_box.y1 = E_MAIL_PIXBOUND ((box->y2 - box->y1) / 2 - close_height / 2); + child_box.y2 = child_box.y1 + close_height; + clutter_actor_allocate ( + CLUTTER_ACTOR (priv->close_button), + &child_box, flags); + } -static void -e_mail_tab_get_preferred_height (ClutterActor *actor, - gfloat for_width, - gfloat *min_height_p, - gfloat *natural_height_p) -{ - EMailTab *tab = E_MAIL_TAB (actor); - EMailTabPrivate *priv = tab->priv; - - e_mail_tab_get_height_no_preview (tab, for_width, - min_height_p, natural_height_p); - - if (priv->preview) - { - MxPadding padding; - gfloat min_height, nat_height, label_min_height, label_nat_height; - - /* Get preview + padding height */ - mx_widget_get_padding (MX_WIDGET (actor), &padding); - - clutter_actor_get_preferred_height (priv->preview, - (gfloat) priv->width, - &min_height, - &nat_height); - - /* Add label height */ - clutter_actor_get_preferred_height (CLUTTER_ACTOR (priv->label), -1, - &label_min_height, &label_nat_height); - - min_height = (min_height * priv->preview_height_progress) + - padding.top + padding.bottom + priv->spacing + - label_min_height; - nat_height = (nat_height * priv->preview_height_progress) + - padding.top + padding.bottom + priv->spacing + - label_nat_height; - - /* Sometimes the preview's natural height will be nan due to - * keeping of the aspect ratio. This guards against that and stops - * Clutter from warning that the natural height is less than the - * minimum height. - */ - if (isnan (nat_height)) - nat_height = min_height; - - if (min_height_p && (min_height > *min_height_p)) - *min_height_p = min_height; - if (natural_height_p && (nat_height > *natural_height_p)) - *natural_height_p = nat_height; - } -} + /* Allocate for preview widget */ + preview_height = 0; + if (priv->preview) { + preview_width = + (box->x2 - box->x1 - + padding.left - padding.right); + preview_height = + (box->y2 - box->y1 - + padding.top - padding.bottom - + priv->spacing - label_height); + + child_box.x1 = E_MAIL_PIXBOUND (padding.left); + child_box.y1 = E_MAIL_PIXBOUND (padding.top); + child_box.x2 = child_box.x1 + preview_width; + child_box.y2 = child_box.y1 + preview_height; + + clutter_actor_allocate (priv->preview, &child_box, flags); + } -static void -e_mail_tab_allocate (ClutterActor *actor, - const ClutterActorBox *box, - ClutterAllocationFlags flags) -{ - MxPadding padding; - ClutterActorBox child_box; - gfloat icon_width, icon_height, label_width, label_height, - close_width, close_height, preview_width, preview_height; - - EMailTabPrivate *priv = E_MAIL_TAB (actor)->priv; - - /* Chain up to store box */ - CLUTTER_ACTOR_CLASS (e_mail_tab_parent_class)->allocate (actor, box, flags); - - /* Possibly synchronise an axis if we're dragging */ - if (priv->in_drag) - { - ClutterActor *drag_actor = - mx_draggable_get_drag_actor (MX_DRAGGABLE (actor)); - - if (drag_actor) - { - gfloat x, y; - clutter_actor_get_transformed_position (actor, &x, &y); - switch (mx_draggable_get_axis (MX_DRAGGABLE (actor))) - { - case MX_DRAG_AXIS_X : - /* Synchronise y axis */ - clutter_actor_set_y (drag_actor, y); - break; - case MX_DRAG_AXIS_Y : - /* Synchronise x axis */ - clutter_actor_set_x (drag_actor, x); - break; - default : - break; - } + /* Allocate for label */ + if ((priv->preview_height_progress <= TAB_S1_ANIM) || (!priv->preview)) { + if (priv->icon) + child_box.x1 = E_MAIL_PIXBOUND (padding.left + icon_width + priv->spacing); + else + child_box.x1 = E_MAIL_PIXBOUND (padding.left); + child_box.x2 = (box->x2 - box->x1 - padding.right); + child_box.y1 = E_MAIL_PIXBOUND ((box->y2 - box->y1) / 2 - label_height / 2); + child_box.y2 = child_box.y1 + label_height; + + /* If close button is visible, don't overlap it */ + if (priv->can_close) + child_box.x2 -= close_width + priv->spacing; + } else { + /* Put label underneath preview */ + child_box.x1 = E_MAIL_PIXBOUND (padding.left); + child_box.x2 = (box->x2 - box->x1 - padding.right); + child_box.y1 = E_MAIL_PIXBOUND ( + padding.top + preview_height + priv->spacing); + child_box.y2 = child_box.y1 + label_height; } - } - - /* Allocate old background texture */ - if (priv->old_bg) - { - child_box.x1 = 0; - child_box.y1 = 0; - child_box.x2 = box->x2 - box->x1; - child_box.y2 = box->y2 - box->y1; - clutter_actor_allocate (priv->old_bg, &child_box, flags); - } - - mx_widget_get_padding (MX_WIDGET (actor), &padding); - - /* Get the preferred width/height of the icon, label and close-button first */ - if (priv->icon) - clutter_actor_get_preferred_size (priv->icon, NULL, NULL, - &icon_width, &icon_height); - clutter_actor_get_preferred_size (CLUTTER_ACTOR (priv->label), NULL, NULL, - &label_width, &label_height); - if (priv->can_close) - clutter_actor_get_preferred_size (CLUTTER_ACTOR (priv->close_button), - NULL, NULL, &close_width, &close_height); - - /* Allocate for icon */ - if (priv->icon) - { - child_box.x1 = padding.left; - child_box.x2 = child_box.x1 + icon_width; - child_box.y1 = E_MAIL_PIXBOUND ((box->y2 - box->y1)/2 - icon_height/2); - child_box.y2 = child_box.y1 + icon_height; - clutter_actor_allocate (priv->icon, &child_box, flags); - } - - /* Allocate for close button */ - if (priv->can_close) - { - child_box.x2 = box->x2 - box->x1 - padding.right; - child_box.x1 = child_box.x2 - close_width; - child_box.y1 = E_MAIL_PIXBOUND ((box->y2 - box->y1)/2 - close_height/2); - child_box.y2 = child_box.y1 + close_height; - clutter_actor_allocate (CLUTTER_ACTOR (priv->close_button), - &child_box, - flags); - } - - /* Allocate for preview widget */ - preview_height = 0; - if (priv->preview) - { - preview_width = (box->x2 - box->x1 - padding.left - padding.right); - preview_height = (box->y2 - box->y1 - padding.top - padding.bottom - - priv->spacing - label_height); - - child_box.x1 = E_MAIL_PIXBOUND (padding.left); - child_box.y1 = E_MAIL_PIXBOUND (padding.top); - child_box.x2 = child_box.x1 + preview_width; - child_box.y2 = child_box.y1 + preview_height; - clutter_actor_allocate (priv->preview, &child_box, flags); - } - - /* Allocate for label */ - if ((priv->preview_height_progress <= TAB_S1_ANIM) || (!priv->preview)) - { - if (priv->icon) - child_box.x1 = E_MAIL_PIXBOUND (padding.left + icon_width + priv->spacing); - else - child_box.x1 = E_MAIL_PIXBOUND (padding.left); - child_box.x2 = (box->x2 - box->x1 - padding.right); - child_box.y1 = E_MAIL_PIXBOUND ((box->y2 - box->y1)/2 - label_height/2); - child_box.y2 = child_box.y1 + label_height; - - /* If close button is visible, don't overlap it */ - if (priv->can_close) - child_box.x2 -= close_width + priv->spacing; - } - else - { - /* Put label underneath preview */ - child_box.x1 = E_MAIL_PIXBOUND (padding.left); - child_box.x2 = (box->x2 - box->x1 - padding.right); - child_box.y1 = E_MAIL_PIXBOUND (padding.top + preview_height + - priv->spacing); - child_box.y2 = child_box.y1 + label_height; - } - - clutter_actor_allocate (CLUTTER_ACTOR (priv->label), &child_box, flags); - - /* If we're in preview mode, re-allocate the background so it doesn't - * encompass the label. (A bit hacky?) - */ - if (priv->preview && CLUTTER_ACTOR_IS_VISIBLE (priv->preview)) - { - gfloat max_height = padding.top + padding.bottom + preview_height; - if (box->y2 - box->y1 > max_height) - { - MxWidget *widget = MX_WIDGET (actor); - ClutterActor *background = mx_widget_get_border_image (widget); - - if (!background) - background = mx_widget_get_background_image (widget); - - child_box.x1 = 0; - child_box.x2 = box->x2 - box->x1; - child_box.y1 = 0; - child_box.y2 = max_height; - - if (background) - clutter_actor_allocate (background, &child_box, flags); - if (priv->old_bg && (priv->old_bg != background)) - clutter_actor_allocate (priv->old_bg, &child_box, flags); + + clutter_actor_allocate (CLUTTER_ACTOR (priv->label), &child_box, flags); + + /* If we're in preview mode, re-allocate the background so it doesn't + * encompass the label. (A bit hacky?) + */ + if (priv->preview && CLUTTER_ACTOR_IS_VISIBLE (priv->preview)) { + gfloat max_height = padding.top + padding.bottom + preview_height; + if (box->y2 - box->y1 > max_height) { + MxWidget *widget = MX_WIDGET (actor); + ClutterActor *background = mx_widget_get_border_image (widget); + + if (!background) + background = mx_widget_get_background_image (widget); + + child_box.x1 = 0; + child_box.x2 = box->x2 - box->x1; + child_box.y1 = 0; + child_box.y2 = max_height; + + if (background) + clutter_actor_allocate ( + background, &child_box, flags); + + if (priv->old_bg && (priv->old_bg != background)) + clutter_actor_allocate ( + priv->old_bg, &child_box, flags); + } } - } } static void e_mail_tab_paint (ClutterActor *actor) { - EMailTabPrivate *priv = E_MAIL_TAB (actor)->priv; + EMailTabPrivate *priv = E_MAIL_TAB (actor)->priv; - /* Chain up to paint background */ - CLUTTER_ACTOR_CLASS (e_mail_tab_parent_class)->paint (actor); + /* Chain up to paint background */ + CLUTTER_ACTOR_CLASS (e_mail_tab_parent_class)->paint (actor); - if (priv->old_bg) - clutter_actor_paint (priv->old_bg); + if (priv->old_bg) + clutter_actor_paint (priv->old_bg); - if (priv->icon) - clutter_actor_paint (priv->icon); + if (priv->icon) + clutter_actor_paint (priv->icon); - clutter_actor_paint (CLUTTER_ACTOR (priv->label)); + clutter_actor_paint (CLUTTER_ACTOR (priv->label)); - if (priv->can_close) - clutter_actor_paint (CLUTTER_ACTOR (priv->close_button)); + if (priv->can_close) + clutter_actor_paint (CLUTTER_ACTOR (priv->close_button)); - if (priv->preview) - clutter_actor_paint (CLUTTER_ACTOR (priv->preview)); + if (priv->preview) + clutter_actor_paint (CLUTTER_ACTOR (priv->preview)); } static void -e_mail_tab_pick (ClutterActor *actor, const ClutterColor *c) +e_mail_tab_pick (ClutterActor *actor, + const ClutterColor *c) { - CLUTTER_ACTOR_CLASS (e_mail_tab_parent_class)->pick (actor, c); + CLUTTER_ACTOR_CLASS (e_mail_tab_parent_class)->pick (actor, c); - if (clutter_actor_should_pick_paint (actor)) - e_mail_tab_paint (actor); + if (clutter_actor_should_pick_paint (actor)) + e_mail_tab_paint (actor); } static void e_mail_tab_map (ClutterActor *actor) { - EMailTabPrivate *priv = E_MAIL_TAB (actor)->priv; - - CLUTTER_ACTOR_CLASS (e_mail_tab_parent_class)->map (actor); - - clutter_actor_map (CLUTTER_ACTOR (priv->label)); - clutter_actor_map (CLUTTER_ACTOR (priv->close_button)); - if (priv->icon) - clutter_actor_map (priv->icon); - if (priv->preview) - clutter_actor_map (priv->preview); - if (priv->old_bg) - clutter_actor_map (priv->old_bg); + EMailTabPrivate *priv = E_MAIL_TAB (actor)->priv; + + CLUTTER_ACTOR_CLASS (e_mail_tab_parent_class)->map (actor); + + clutter_actor_map (CLUTTER_ACTOR (priv->label)); + clutter_actor_map (CLUTTER_ACTOR (priv->close_button)); + + if (priv->icon) + clutter_actor_map (priv->icon); + if (priv->preview) + clutter_actor_map (priv->preview); + if (priv->old_bg) + clutter_actor_map (priv->old_bg); } static void e_mail_tab_unmap (ClutterActor *actor) { - EMailTabPrivate *priv = E_MAIL_TAB (actor)->priv; - - CLUTTER_ACTOR_CLASS (e_mail_tab_parent_class)->unmap (actor); - - clutter_actor_unmap (CLUTTER_ACTOR (priv->label)); - clutter_actor_unmap (CLUTTER_ACTOR (priv->close_button)); - if (priv->icon) - clutter_actor_unmap (priv->icon); - if (priv->preview) - clutter_actor_unmap (priv->preview); - if (priv->old_bg) - clutter_actor_unmap (priv->old_bg); + EMailTabPrivate *priv = E_MAIL_TAB (actor)->priv; + + CLUTTER_ACTOR_CLASS (e_mail_tab_parent_class)->unmap (actor); + + clutter_actor_unmap (CLUTTER_ACTOR (priv->label)); + clutter_actor_unmap (CLUTTER_ACTOR (priv->close_button)); + + if (priv->icon) + clutter_actor_unmap (priv->icon); + if (priv->preview) + clutter_actor_unmap (priv->preview); + if (priv->old_bg) + clutter_actor_unmap (priv->old_bg); } static gboolean -e_mail_tab_button_press_event (ClutterActor *actor, - ClutterButtonEvent *event) +e_mail_tab_button_press_event (ClutterActor *actor, + ClutterButtonEvent *event) { - EMailTabPrivate *priv = E_MAIL_TAB (actor)->priv; + EMailTabPrivate *priv = E_MAIL_TAB (actor)->priv; - if (event->button == 1) - { - mx_stylable_set_style_pseudo_class (MX_STYLABLE (actor), "active"); - clutter_grab_pointer (actor); - priv->pressed = TRUE; + if (event->button == 1) { + mx_stylable_set_style_pseudo_class ( + MX_STYLABLE (actor), "active"); + clutter_grab_pointer (actor); + priv->pressed = TRUE; - priv->press_x = event->x; - priv->press_y = event->y; - } + priv->press_x = event->x; + priv->press_y = event->y; + } - /* We have to always return false, or dragging won't work */ - return FALSE; + /* We have to always return false, or dragging won't work */ + return FALSE; } static gboolean -e_mail_tab_button_release_event (ClutterActor *actor, - ClutterButtonEvent *event) +e_mail_tab_button_release_event (ClutterActor *actor, + ClutterButtonEvent *event) { - EMailTab *tab = E_MAIL_TAB (actor); - EMailTabPrivate *priv = tab->priv; - - if (priv->pressed) - { - clutter_ungrab_pointer (); - priv->pressed = FALSE; - - /* Note, no need to set the pseudo class here as clicking always results - * in being set active. - */ - if (priv->hover) - { - if (!priv->active) - e_mail_tab_set_active (tab, TRUE); - - g_signal_emit (actor, signals[CLICKED], 0); + EMailTab *tab = E_MAIL_TAB (actor); + EMailTabPrivate *priv = tab->priv; + + if (priv->pressed) { + clutter_ungrab_pointer (); + priv->pressed = FALSE; + + /* Note, no need to set the pseudo class here as clicking + * always results in being set active. */ + if (priv->hover) { + if (!priv->active) + e_mail_tab_set_active (tab, TRUE); + + g_signal_emit (actor, signals[CLICKED], 0); + } } - } - return FALSE; + return FALSE; } static gboolean -e_mail_tab_motion_event (ClutterActor *actor, - ClutterMotionEvent *event) -{ - EMailTab *tab = E_MAIL_TAB (actor); - EMailTabPrivate *priv = tab->priv; - - if (priv->pressed && priv->drag_enabled) - { - if ((ABS (event->x - priv->press_x) >= priv->drag_threshold) || - (ABS (event->y - priv->press_y) >= priv->drag_threshold)) - { - /* Ungrab the pointer so that the MxDraggable code can take over */ - clutter_ungrab_pointer (); - priv->pressed = FALSE; - if (!priv->active) - { - if (priv->hover) - mx_stylable_set_style_pseudo_class (MX_STYLABLE (actor), - "hover"); - else - mx_stylable_set_style_pseudo_class (MX_STYLABLE (actor), NULL); - } +e_mail_tab_motion_event (ClutterActor *actor, + ClutterMotionEvent *event) +{ + EMailTab *tab = E_MAIL_TAB (actor); + EMailTabPrivate *priv = tab->priv; + + if (priv->pressed && priv->drag_enabled) { + if ((ABS (event->x - priv->press_x) >= priv->drag_threshold) || + (ABS (event->y - priv->press_y) >= priv->drag_threshold)) { + /* Ungrab the pointer so that the MxDraggable code can take over */ + clutter_ungrab_pointer (); + priv->pressed = FALSE; + if (!priv->active) { + if (priv->hover) + mx_stylable_set_style_pseudo_class ( + MX_STYLABLE (actor), "hover"); + else + mx_stylable_set_style_pseudo_class ( + MX_STYLABLE (actor), NULL); + } + } } - } - return FALSE; + return FALSE; } static gboolean -e_mail_tab_enter_event (ClutterActor *actor, - ClutterCrossingEvent *event) +e_mail_tab_enter_event (ClutterActor *actor, + ClutterCrossingEvent *event) { - EMailTabPrivate *priv = E_MAIL_TAB (actor)->priv; + EMailTabPrivate *priv = E_MAIL_TAB (actor)->priv; - if (event->source != actor) - return FALSE; + if (event->source != actor) + return FALSE; - priv->hover = TRUE; + priv->hover = TRUE; - if (priv->pressed) - mx_stylable_set_style_pseudo_class (MX_STYLABLE (actor), "active"); - else if (!priv->active) - mx_stylable_set_style_pseudo_class (MX_STYLABLE (actor), "hover"); + if (priv->pressed) + mx_stylable_set_style_pseudo_class ( + MX_STYLABLE (actor), "active"); + else if (!priv->active) + mx_stylable_set_style_pseudo_class ( + MX_STYLABLE (actor), "hover"); - return FALSE; + return FALSE; } static gboolean -e_mail_tab_leave_event (ClutterActor *actor, - ClutterCrossingEvent *event) +e_mail_tab_leave_event (ClutterActor *actor, + ClutterCrossingEvent *event) { - EMailTabPrivate *priv = E_MAIL_TAB (actor)->priv; + EMailTabPrivate *priv = E_MAIL_TAB (actor)->priv; - if ((event->source != actor) || - (event->related == (ClutterActor *) priv->close_button)) - return FALSE; + if ((event->source != actor) || + (event->related == (ClutterActor *) priv->close_button)) + return FALSE; - priv->hover = FALSE; + priv->hover = FALSE; - if (!priv->active) - mx_stylable_set_style_pseudo_class (MX_STYLABLE (actor), NULL); + if (!priv->active) + mx_stylable_set_style_pseudo_class (MX_STYLABLE (actor), NULL); - return FALSE; + return FALSE; } static void -e_mail_tab_class_init (EMailTabClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); - - g_type_class_add_private (klass, sizeof (EMailTabPrivate)); - - object_class->get_property = e_mail_tab_get_property; - object_class->set_property = e_mail_tab_set_property; - object_class->dispose = e_mail_tab_dispose; - object_class->finalize = e_mail_tab_finalize; - - actor_class->get_preferred_width = e_mail_tab_get_preferred_width; - actor_class->get_preferred_height = e_mail_tab_get_preferred_height; - actor_class->button_press_event = e_mail_tab_button_press_event; - actor_class->button_release_event = e_mail_tab_button_release_event; - actor_class->motion_event = e_mail_tab_motion_event; - actor_class->enter_event = e_mail_tab_enter_event; - actor_class->leave_event = e_mail_tab_leave_event; - actor_class->allocate = e_mail_tab_allocate; - actor_class->paint = e_mail_tab_paint; - actor_class->pick = e_mail_tab_pick; - actor_class->map = e_mail_tab_map; - actor_class->unmap = e_mail_tab_unmap; - - g_object_class_install_property (object_class, - PROP_ICON, - g_param_spec_object ("icon", - "Icon", - "Icon actor.", - CLUTTER_TYPE_ACTOR, - G_PARAM_READWRITE | - G_PARAM_STATIC_NAME | - G_PARAM_STATIC_NICK | - G_PARAM_STATIC_BLURB)); - - g_object_class_install_property (object_class, - PROP_TEXT, - g_param_spec_string ("text", - "Text", - "Tab text.", - "", - G_PARAM_READWRITE | - G_PARAM_STATIC_NAME | - G_PARAM_STATIC_NICK | - G_PARAM_STATIC_BLURB)); - - g_object_class_install_property (object_class, - PROP_CAN_CLOSE, - g_param_spec_boolean ("can-close", - "Can close", - "Whether the tab can " - "close.", - TRUE, - G_PARAM_READWRITE | - G_PARAM_STATIC_NAME | - G_PARAM_STATIC_NICK | - G_PARAM_STATIC_BLURB)); - - g_object_class_install_property (object_class, - PROP_TAB_WIDTH, - g_param_spec_int ("tab-width", - "Tab width", - "Tab width.", - -1, G_MAXINT, -1, - G_PARAM_READWRITE | - G_PARAM_STATIC_NAME | - G_PARAM_STATIC_NICK | - G_PARAM_STATIC_BLURB)); - - g_object_class_install_property (object_class, - PROP_DOCKING, - g_param_spec_boolean ("docking", - "Docking", - "Whether the tab " - "should dock to edges " - "when scrolled.", - FALSE, - G_PARAM_READWRITE | - G_PARAM_STATIC_NAME | - G_PARAM_STATIC_NICK | - G_PARAM_STATIC_BLURB)); - - g_object_class_install_property (object_class, - PROP_PREVIEW, - g_param_spec_object ("preview", - "Preview actor", - "ClutterActor used " - "when in preview mode.", - CLUTTER_TYPE_ACTOR, - G_PARAM_READWRITE | - G_PARAM_STATIC_NAME | - G_PARAM_STATIC_NICK | - G_PARAM_STATIC_BLURB)); - - 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_install_property (object_class, - PROP_PREVIEW_DURATION, - g_param_spec_uint ("preview-duration", - "Preview duration", - "How long the transition " - "between preview mode " - "states lasts, in ms.", - 0, G_MAXUINT, 200, - G_PARAM_READWRITE | - G_PARAM_STATIC_NAME | - G_PARAM_STATIC_NICK | - G_PARAM_STATIC_BLURB)); - - g_object_class_install_property (object_class, - PROP_SPACING, - g_param_spec_float ("spacing", - "Spacing", - "Spacing between " - "tab elements.", - 0, G_MAXFLOAT, - 6.0, - G_PARAM_READWRITE | - G_PARAM_STATIC_NAME | - G_PARAM_STATIC_NICK | - G_PARAM_STATIC_BLURB)); - - g_object_class_install_property (object_class, - PROP_PRIVATE, - g_param_spec_boolean ("private", - "Private", - "Set if the tab is " - "'private'.", - FALSE, - G_PARAM_READWRITE | - G_PARAM_STATIC_NAME | - G_PARAM_STATIC_NICK | - G_PARAM_STATIC_BLURB)); - - g_object_class_install_property (object_class, - PROP_ACTIVE, - g_param_spec_boolean ("active", - "Active", - "Set if the tab is " - "active.", - FALSE, - G_PARAM_READWRITE | - G_PARAM_STATIC_NAME | - G_PARAM_STATIC_NICK | - G_PARAM_STATIC_BLURB)); - - g_object_class_override_property (object_class, - PROP_DRAG_THRESHOLD, - "drag-threshold"); - g_object_class_override_property (object_class, - PROP_DRAG_AXIS, - "axis"); - // g_object_class_override_property (object_class, - // PROP_DRAG_CONTAINMENT_TYPE, - // "containment-type"); - g_object_class_override_property (object_class, - PROP_DRAG_CONTAINMENT_AREA, - "containment-area"); - g_object_class_override_property (object_class, - PROP_DRAG_ENABLED, - "drag-enabled"); - g_object_class_override_property (object_class, - PROP_DRAG_ACTOR, - "drag-actor"); - - signals[CLICKED] = - g_signal_new ("clicked", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMailTabClass, clicked), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - signals[CLOSED] = - g_signal_new ("closed", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMailTabClass, closed), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - signals[TRANSITION_COMPLETE] = - g_signal_new ("transition-complete", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMailTabClass, transition_complete), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); +e_mail_tab_class_init (EMailTabClass *class) +{ + GObjectClass *object_class = G_OBJECT_CLASS (class); + ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (class); + + g_type_class_add_private (class, sizeof (EMailTabPrivate)); + + object_class->get_property = e_mail_tab_get_property; + object_class->set_property = e_mail_tab_set_property; + object_class->dispose = e_mail_tab_dispose; + + actor_class->get_preferred_width = e_mail_tab_get_preferred_width; + actor_class->get_preferred_height = e_mail_tab_get_preferred_height; + actor_class->button_press_event = e_mail_tab_button_press_event; + actor_class->button_release_event = e_mail_tab_button_release_event; + actor_class->motion_event = e_mail_tab_motion_event; + actor_class->enter_event = e_mail_tab_enter_event; + actor_class->leave_event = e_mail_tab_leave_event; + actor_class->allocate = e_mail_tab_allocate; + actor_class->paint = e_mail_tab_paint; + actor_class->pick = e_mail_tab_pick; + actor_class->map = e_mail_tab_map; + actor_class->unmap = e_mail_tab_unmap; + + g_object_class_install_property ( + object_class, + PROP_ICON, + g_param_spec_object ( + "icon", + "Icon", + "Icon actor.", + CLUTTER_TYPE_ACTOR, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property ( + object_class, + PROP_TEXT, + g_param_spec_string ( + "text", + "Text", + "Tab text.", + "", + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property ( + object_class, + PROP_CAN_CLOSE, + g_param_spec_boolean ( + "can-close", + "Can close", + "Whether the tab can " + "close.", + TRUE, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property ( + object_class, + PROP_TAB_WIDTH, + g_param_spec_int ( + "tab-width", + "Tab width", + "Tab width.", + -1, G_MAXINT, -1, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property ( + object_class, + PROP_DOCKING, + g_param_spec_boolean ( + "docking", + "Docking", + "Whether the tab should dock to edges when scrolled.", + FALSE, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property ( + object_class, + PROP_PREVIEW, + g_param_spec_object ( + "preview", + "Preview actor", + "ClutterActor used " + "when in preview mode.", + CLUTTER_TYPE_ACTOR, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); + + 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_STRINGS)); + + g_object_class_install_property ( + object_class, + PROP_PREVIEW_DURATION, + g_param_spec_uint ( + "preview-duration", + "Preview duration", + "How long the transition " + "between preview mode " + "states lasts, in ms.", + 0, G_MAXUINT, 200, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property ( + object_class, + PROP_SPACING, + g_param_spec_float ( + "spacing", + "Spacing", + "Spacing between " + "tab elements.", + 0, G_MAXFLOAT, + 6.0, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property ( + object_class, + PROP_PRIVATE, + g_param_spec_boolean ( + "private", + "Private", + "Set if the tab is " + "'private'.", + FALSE, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property ( + object_class, + PROP_ACTIVE, + g_param_spec_boolean ( + "active", + "Active", + "Set if the tab is " + "active.", + FALSE, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); + + g_object_class_override_property ( + object_class, + PROP_DRAG_THRESHOLD, + "drag-threshold"); + + g_object_class_override_property ( + object_class, + PROP_DRAG_AXIS, + "axis"); + + g_object_class_override_property ( + object_class, + PROP_DRAG_CONTAINMENT_AREA, + "containment-area"); + + g_object_class_override_property ( + object_class, + PROP_DRAG_ENABLED, + "drag-enabled"); + + g_object_class_override_property ( + object_class, + PROP_DRAG_ACTOR, + "drag-actor"); + + signals[CLICKED] = g_signal_new ( + "clicked", + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EMailTabClass, clicked), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + signals[CLOSED] = g_signal_new ( + "closed", + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EMailTabClass, closed), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + signals[TRANSITION_COMPLETE] = g_signal_new ( + "transition-complete", + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EMailTabClass, transition_complete), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); } static void -e_mail_tab_close_clicked_cb (MxButton *button, EMailTab *self) +e_mail_tab_close_clicked_cb (MxButton *button, + EMailTab *self) { - g_signal_emit (self, signals[CLOSED], 0); + g_signal_emit (self, signals[CLOSED], 0); } static void e_mail_tab_anim_completed_cb (ClutterAnimation *animation, - EMailTab *tab) + EMailTab *tab) { - e_mail_tab_dispose_old_bg (tab); + e_mail_tab_dispose_old_bg (tab); } static void e_mail_tab_style_changed_cb (MxWidget *widget) { - EMailTabPrivate *priv = E_MAIL_TAB (widget)->priv; - - /* Don't transition on hover */ - if (g_strcmp0 (mx_stylable_get_style_pseudo_class (MX_STYLABLE (widget)), - "hover") == 0) - return; - - if (priv->old_bg) - { - if (!clutter_actor_get_parent (priv->old_bg)) - { - ClutterActorBox box; - ClutterActor *background; - ClutterActor *actor = CLUTTER_ACTOR (widget); - - clutter_actor_set_parent (priv->old_bg, actor); - - /* Try to allocate the same size as the background widget, - * otherwise allocate the same size as the widget itself. - */ - background = mx_widget_get_border_image (widget); - if (!background) - background = mx_widget_get_background_image (widget); - - if (background) - clutter_actor_get_allocation_box (background, &box); - else - { - clutter_actor_get_allocation_box (actor, &box); - box.x2 -= box.x1; - box.y2 -= box.y1; - box.x1 = 0; - box.y1 = 0; - } - - clutter_actor_allocate (priv->old_bg, &box, 0); + EMailTabPrivate *priv = E_MAIL_TAB (widget)->priv; + + /* Don't transition on hover */ + if (g_strcmp0 (mx_stylable_get_style_pseudo_class ( + MX_STYLABLE (widget)), "hover") == 0) + return; + + if (priv->old_bg) { + if (!clutter_actor_get_parent (priv->old_bg)) { + ClutterActorBox box; + ClutterActor *background; + ClutterActor *actor = CLUTTER_ACTOR (widget); + + clutter_actor_set_parent (priv->old_bg, actor); + + /* Try to allocate the same size as the background + * widget, otherwise allocate the same size as the + * widget itself. */ + background = mx_widget_get_border_image (widget); + if (!background) + background = mx_widget_get_background_image (widget); + + if (background) + clutter_actor_get_allocation_box (background, &box); + else { + clutter_actor_get_allocation_box (actor, &box); + box.x2 -= box.x1; + box.y2 -= box.y1; + box.x1 = 0; + box.y1 = 0; + } + + clutter_actor_allocate (priv->old_bg, &box, 0); + } + + clutter_actor_animate ( + priv->old_bg, CLUTTER_LINEAR, 150, + "opacity", 0, "signal::completed", + G_CALLBACK (e_mail_tab_anim_completed_cb), + widget, NULL); } - - clutter_actor_animate (priv->old_bg, - CLUTTER_LINEAR, - 150, - "opacity", 0, - "signal::completed", - G_CALLBACK (e_mail_tab_anim_completed_cb), - widget, - NULL); - } } static void e_mail_tab_stylable_changed_cb (MxStylable *stylable) { - EMailTab *tab = E_MAIL_TAB (stylable); - EMailTabPrivate *priv = tab->priv; + EMailTab *tab = E_MAIL_TAB (stylable); + EMailTabPrivate *priv = tab->priv; - e_mail_tab_dispose_old_bg (tab); + e_mail_tab_dispose_old_bg (tab); - priv->old_bg = mx_widget_get_border_image (MX_WIDGET (tab)); - if (priv->old_bg) - g_object_ref (priv->old_bg); + priv->old_bg = mx_widget_get_border_image (MX_WIDGET (tab)); + if (priv->old_bg) + g_object_ref (priv->old_bg); } static void -e_mail_tab_dnd_notify_cb (GObject *settings, - GParamSpec *pspec, - EMailTab *tab) +e_mail_tab_dnd_notify_cb (GObject *settings, + GParamSpec *pspec, + EMailTab *tab) { - g_object_get (settings, - "gtk-dnd-drag-threshold", &tab->priv->drag_threshold, + g_object_get ( + settings, + "gtk-dnd-drag-threshold", &tab->priv->drag_threshold, NULL); } static void e_mail_tab_init (EMailTab *self) { - ClutterActor *text; - GtkSettings *settings; - EMailTabPrivate *priv; + ClutterActor *text; + GtkSettings *settings; + EMailTabPrivate *priv; - priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE ( self, E_MAIL_TYPE_TAB, EMailTabPrivate); - priv->width = -1; - priv->anim_length = 200; - priv->spacing = 6.0; - priv->can_close = TRUE; - - priv->label = mx_label_new (); - g_object_set (G_OBJECT (priv->label), "clip-to-allocation", TRUE, NULL); - text = mx_label_get_clutter_text (MX_LABEL (priv->label)); - clutter_text_set_ellipsize (CLUTTER_TEXT (text), PANGO_ELLIPSIZE_END); - clutter_actor_set_parent (CLUTTER_ACTOR (priv->label), - CLUTTER_ACTOR (self)); - - priv->close_button = mx_button_new (); - clutter_actor_set_name (CLUTTER_ACTOR (priv->close_button), - "tab-close-button"); - clutter_actor_set_parent (CLUTTER_ACTOR (priv->close_button), - CLUTTER_ACTOR (self)); - - g_signal_connect (priv->close_button, "clicked", - G_CALLBACK (e_mail_tab_close_clicked_cb), self); - - /* Connect up styling signals */ - g_signal_connect (self, "style-changed", - G_CALLBACK (e_mail_tab_style_changed_cb), NULL); - g_signal_connect (self, "stylable-changed", - G_CALLBACK (e_mail_tab_stylable_changed_cb), NULL); - - clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE); - - settings = gtk_settings_get_default (); - priv->drag_threshold_handler = - g_signal_connect (settings, "notify::gtk-dnd-drag-threshold", - G_CALLBACK (e_mail_tab_dnd_notify_cb), self); - g_object_get (G_OBJECT (settings), - "gtk-dnd-drag-threshold", &priv->drag_threshold, + priv->width = -1; + priv->anim_length = 200; + priv->spacing = 6.0; + priv->can_close = TRUE; + + priv->label = mx_label_new (); + g_object_set (priv->label, "clip-to-allocation", TRUE, NULL); + text = mx_label_get_clutter_text (MX_LABEL (priv->label)); + clutter_text_set_ellipsize (CLUTTER_TEXT (text), PANGO_ELLIPSIZE_END); + clutter_actor_set_parent ( + CLUTTER_ACTOR (priv->label), CLUTTER_ACTOR (self)); + + priv->close_button = mx_button_new (); + clutter_actor_set_name ( + CLUTTER_ACTOR (priv->close_button), "tab-close-button"); + clutter_actor_set_parent ( + CLUTTER_ACTOR (priv->close_button), CLUTTER_ACTOR (self)); + + g_signal_connect ( + priv->close_button, "clicked", + G_CALLBACK (e_mail_tab_close_clicked_cb), self); + + /* Connect up styling signals */ + g_signal_connect ( + self, "style-changed", + G_CALLBACK (e_mail_tab_style_changed_cb), NULL); + g_signal_connect ( + self, "stylable-changed", + G_CALLBACK (e_mail_tab_stylable_changed_cb), NULL); + + clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE); + + settings = gtk_settings_get_default (); + priv->drag_threshold_handler = g_signal_connect ( + settings, "notify::gtk-dnd-drag-threshold", + G_CALLBACK (e_mail_tab_dnd_notify_cb), self); + g_object_get ( + G_OBJECT (settings), + "gtk-dnd-drag-threshold", &priv->drag_threshold, NULL); } ClutterActor * e_mail_tab_new (void) { - return g_object_new (E_MAIL_TYPE_TAB, NULL); + return g_object_new (E_MAIL_TYPE_TAB, NULL); } ClutterActor * -e_mail_tab_new_full (const gchar *text, ClutterActor *icon, gint width) -{ - return g_object_new (E_MAIL_TYPE_TAB, - "text", text, - "icon", icon, - "tab-width", width, NULL); +e_mail_tab_new_full (const gchar *text, + ClutterActor *icon, + gint width) +{ + return g_object_new ( + E_MAIL_TYPE_TAB, + "text", text, + "icon", icon, + "tab-width", width, + NULL); } void -e_mail_tab_set_text (EMailTab *tab, const gchar *text) +e_mail_tab_set_text (EMailTab *tab, + const gchar *text) { - EMailTabPrivate *priv = tab->priv; + EMailTabPrivate *priv = tab->priv; - if (!text) - text = ""; + if (!text) + text = ""; - priv->has_text = (text[0] != '\0'); + priv->has_text = (text[0] != '\0'); - if (priv->label) - mx_label_set_text (MX_LABEL (priv->label), text); + if (priv->label) + mx_label_set_text (MX_LABEL (priv->label), text); - g_object_notify (G_OBJECT (tab), "text"); + g_object_notify (G_OBJECT (tab), "text"); } void -e_mail_tab_set_default_icon (EMailTab *tab, - ClutterActor *icon) +e_mail_tab_set_default_icon (EMailTab *tab, + ClutterActor *icon) { - EMailTabPrivate *priv = tab->priv; - gboolean changed = !priv->icon || (priv->icon == priv->default_icon); + EMailTabPrivate *priv = tab->priv; + gboolean changed = !priv->icon || (priv->icon == priv->default_icon); - if (icon) - g_object_ref_sink (icon); + if (icon) + g_object_ref_sink (icon); - if (priv->default_icon) - g_object_unref (priv->default_icon); + if (priv->default_icon) + g_object_unref (priv->default_icon); - priv->default_icon = icon; + priv->default_icon = icon; - if (changed) - e_mail_tab_set_icon (tab, NULL); + if (changed) + e_mail_tab_set_icon (tab, NULL); } void -e_mail_tab_set_icon (EMailTab *tab, ClutterActor *icon) +e_mail_tab_set_icon (EMailTab *tab, + ClutterActor *icon) { - EMailTabPrivate *priv = tab->priv; + EMailTabPrivate *priv = tab->priv; - /* passing NULL for icon will use default icon if available */ + /* passing NULL for icon will use default icon if available */ - if (priv->icon) - clutter_actor_unparent (priv->icon); + if (priv->icon) + clutter_actor_unparent (priv->icon); - if (icon) - priv->icon = icon; - else - priv->icon = priv->default_icon; + if (icon) + priv->icon = icon; + else + priv->icon = priv->default_icon; - if (priv->icon) - { - clutter_actor_set_parent (priv->icon, CLUTTER_ACTOR (tab)); - } + if (priv->icon) + clutter_actor_set_parent (priv->icon, CLUTTER_ACTOR (tab)); - clutter_actor_queue_relayout (CLUTTER_ACTOR (tab)); + clutter_actor_queue_relayout (CLUTTER_ACTOR (tab)); - g_object_notify (G_OBJECT (tab), "icon"); + g_object_notify (G_OBJECT (tab), "icon"); } const gchar * e_mail_tab_get_text (EMailTab *tab) { - EMailTabPrivate *priv = tab->priv; + EMailTabPrivate *priv = tab->priv; - if (priv->label) - return mx_label_get_text (MX_LABEL (priv->label)); - else - return NULL; + if (priv->label) + return mx_label_get_text (MX_LABEL (priv->label)); + else + return NULL; } ClutterActor * e_mail_tab_get_icon (EMailTab *tab) { - EMailTabPrivate *priv = tab->priv; - return priv->icon == priv->default_icon ? NULL : priv->icon; + EMailTabPrivate *priv = tab->priv; + return priv->icon == priv->default_icon ? NULL : priv->icon; } void -e_mail_tab_set_can_close (EMailTab *tab, gboolean can_close) +e_mail_tab_set_can_close (EMailTab *tab, + gboolean can_close) { - EMailTabPrivate *priv = tab->priv; + EMailTabPrivate *priv = tab->priv; - if (priv->can_close == can_close) - return; + if (priv->can_close == can_close) + return; - priv->can_close = can_close; + priv->can_close = can_close; - clutter_actor_queue_relayout (CLUTTER_ACTOR (tab)); + clutter_actor_queue_relayout (CLUTTER_ACTOR (tab)); - g_object_notify (G_OBJECT (tab), "can-close"); + g_object_notify (G_OBJECT (tab), "can-close"); } gboolean e_mail_tab_get_can_close (EMailTab *tab) { - return tab->priv->can_close; + return tab->priv->can_close; } void e_mail_tab_set_width (EMailTab *tab, - gint width) + gint width) { - EMailTabPrivate *priv = tab->priv; + EMailTabPrivate *priv = tab->priv; - if (priv->width == width) - return; + if (priv->width == width) + return; - priv->width = width; + priv->width = width; - clutter_actor_queue_relayout (CLUTTER_ACTOR (tab)); + clutter_actor_queue_relayout (CLUTTER_ACTOR (tab)); - g_object_notify (G_OBJECT (tab), "tab-width"); + g_object_notify (G_OBJECT (tab), "tab-width"); } gint e_mail_tab_get_width (EMailTab *tab) { - EMailTabPrivate *priv = tab->priv; - return priv->width; + EMailTabPrivate *priv = tab->priv; + return priv->width; } void -e_mail_tab_set_docking (EMailTab *tab, - gboolean docking) +e_mail_tab_set_docking (EMailTab *tab, + gboolean docking) { - EMailTabPrivate *priv = tab->priv; + EMailTabPrivate *priv = tab->priv; - if (priv->docking == docking) - return; + if (priv->docking == docking) + return; - priv->docking = docking; + priv->docking = docking; - clutter_actor_queue_relayout (CLUTTER_ACTOR (tab)); + clutter_actor_queue_relayout (CLUTTER_ACTOR (tab)); - g_object_notify (G_OBJECT (tab), "docking"); + g_object_notify (G_OBJECT (tab), "docking"); } gboolean e_mail_tab_get_docking (EMailTab *tab) { - EMailTabPrivate *priv = tab->priv; - return priv->docking; + EMailTabPrivate *priv = tab->priv; + return priv->docking; } void -e_mail_tab_set_preview_actor (EMailTab *tab, ClutterActor *actor) +e_mail_tab_set_preview_actor (EMailTab *tab, + ClutterActor *actor) { - EMailTabPrivate *priv = tab->priv; + EMailTabPrivate *priv = tab->priv; - if (priv->preview) - clutter_actor_unparent (priv->preview); + if (priv->preview) + clutter_actor_unparent (priv->preview); - priv->preview = actor; + priv->preview = actor; - if (actor) - { - clutter_actor_set_parent (actor, CLUTTER_ACTOR (tab)); + if (actor) { + clutter_actor_set_parent (actor, CLUTTER_ACTOR (tab)); - clutter_actor_set_opacity (actor, priv->preview_mode ? 0xff : 0x00); - if (!priv->preview_mode) - clutter_actor_hide (actor); - } + clutter_actor_set_opacity ( + actor, priv->preview_mode ? 0xff : 0x00); + if (!priv->preview_mode) + clutter_actor_hide (actor); + } - clutter_actor_queue_relayout (CLUTTER_ACTOR (tab)); + clutter_actor_queue_relayout (CLUTTER_ACTOR (tab)); - g_object_notify (G_OBJECT (tab), "preview"); + g_object_notify (G_OBJECT (tab), "preview"); } ClutterActor * e_mail_tab_get_preview_actor (EMailTab *tab) { - EMailTabPrivate *priv = tab->priv; - return priv->preview; + EMailTabPrivate *priv = tab->priv; + return priv->preview; } static void preview_new_frame_cb (ClutterTimeline *timeline, - guint msecs, - EMailTab *tab) -{ - gboolean forwards; - EMailTabPrivate *priv = tab->priv; - - forwards = (clutter_timeline_get_direction (timeline) == - CLUTTER_TIMELINE_FORWARD) ? TRUE : FALSE; - if (priv->preview_mode) - forwards = !forwards; - - priv->preview_height_progress = clutter_timeline_get_progress (timeline); - if (forwards) - priv->preview_height_progress = 1.0 - priv->preview_height_progress; - - if (priv->preview) - clutter_actor_queue_relayout (CLUTTER_ACTOR (tab)); + guint msecs, + EMailTab *tab) +{ + gboolean forwards; + EMailTabPrivate *priv = tab->priv; + + forwards = + (clutter_timeline_get_direction (timeline) == + CLUTTER_TIMELINE_FORWARD); + if (priv->preview_mode) + forwards = !forwards; + + priv->preview_height_progress = + clutter_timeline_get_progress (timeline); + if (forwards) + priv->preview_height_progress = + 1.0 - priv->preview_height_progress; + + if (priv->preview) + clutter_actor_queue_relayout (CLUTTER_ACTOR (tab)); } static void preview_completed_cb (ClutterTimeline *timeline, - EMailTab *tab) -{ - EMailTabPrivate *priv = tab->priv; - - if (priv->preview_timeline) - { - clutter_timeline_stop (priv->preview_timeline); - g_object_unref (priv->preview_timeline); - priv->preview_timeline = NULL; - - if (priv->preview_mode) - priv->preview_height_progress = 1.0; - else - { - priv->preview_height_progress = 0.0; - if (priv->preview) - clutter_actor_hide (priv->preview); - if (priv->can_close) - clutter_actor_set_reactive (CLUTTER_ACTOR (priv->close_button), + EMailTab *tab) +{ + EMailTabPrivate *priv = tab->priv; + + if (priv->preview_timeline) { + clutter_timeline_stop (priv->preview_timeline); + g_object_unref (priv->preview_timeline); + priv->preview_timeline = NULL; + + if (priv->preview_mode) + priv->preview_height_progress = 1.0; + else { + priv->preview_height_progress = 0.0; + if (priv->preview) + clutter_actor_hide (priv->preview); + if (priv->can_close) + clutter_actor_set_reactive ( + CLUTTER_ACTOR (priv->close_button), TRUE); + } + + /* Remove style hint if we're not in preview mode */ + if (priv->preview) { + if (!priv->preview_mode) + clutter_actor_set_name ( + CLUTTER_ACTOR (tab), + priv->private ? "private-tab" : NULL); + } else { + /* If there's no preview actor, disable the tab */ + clutter_actor_set_reactive ( + CLUTTER_ACTOR (tab), !priv->preview_mode); + } + + if (priv->preview) + clutter_actor_queue_relayout (CLUTTER_ACTOR (tab)); + + g_signal_emit (tab, signals[TRANSITION_COMPLETE], 0); } - - /* Remove style hint if we're not in preview mode */ - if (priv->preview) - { - if (!priv->preview_mode) - clutter_actor_set_name (CLUTTER_ACTOR (tab), - priv->private ? "private-tab" : NULL); - } - else - { - /* If there's no preview actor, disable the tab */ - clutter_actor_set_reactive (CLUTTER_ACTOR (tab), !priv->preview_mode); - } - - if (priv->preview) - clutter_actor_queue_relayout (CLUTTER_ACTOR (tab)); - - g_signal_emit (tab, signals[TRANSITION_COMPLETE], 0); - } } static void preview_s1_started_cb (ClutterTimeline *timeline, - EMailTab *tab) + EMailTab *tab) { - EMailTabPrivate *priv = tab->priv; - - if (!priv->preview) - clutter_actor_animate_with_timeline (CLUTTER_ACTOR (priv->label), - CLUTTER_EASE_IN_OUT_QUAD, - timeline, - "opacity", 0xff, - NULL); + EMailTabPrivate *priv = tab->priv; + + if (!priv->preview) + clutter_actor_animate_with_timeline ( + CLUTTER_ACTOR (priv->label), + CLUTTER_EASE_IN_OUT_QUAD, + timeline, + "opacity", 0xff, + NULL); } static void preview_s2_started_cb (ClutterTimeline *timeline, - EMailTab *tab) + EMailTab *tab) { - EMailTabPrivate *priv = tab->priv; - - if (priv->preview) - clutter_actor_animate_with_timeline (CLUTTER_ACTOR (priv->label), - CLUTTER_EASE_IN_OUT_QUAD, - timeline, - "opacity", 0xff, - NULL); + EMailTabPrivate *priv = tab->priv; + + if (priv->preview) + clutter_actor_animate_with_timeline ( + CLUTTER_ACTOR (priv->label), + CLUTTER_EASE_IN_OUT_QUAD, + timeline, + "opacity", 0xff, + NULL); } void -e_mail_tab_set_preview_mode (EMailTab *tab, gboolean preview) +e_mail_tab_set_preview_mode (EMailTab *tab, + gboolean preview) { - EMailTabPrivate *priv = tab->priv; + EMailTabPrivate *priv = tab->priv; - if (priv->preview_mode != preview) - { - ClutterTimeline *timeline, *timeline2; - gdouble progress, total_duration, duration1, duration2; + if (priv->preview_mode != preview) { + ClutterTimeline *timeline, *timeline2; + gdouble progress, total_duration, duration1, duration2; - priv->preview_mode = preview; + priv->preview_mode = preview; - /* Disable the close button in preview mode */ - if (preview && priv->can_close) - clutter_actor_set_reactive (CLUTTER_ACTOR (priv->close_button), FALSE); + /* Disable the close button in preview mode */ + if (preview && priv->can_close) + clutter_actor_set_reactive (CLUTTER_ACTOR (priv->close_button), FALSE); #define DEBUG_MULT 1 - if (priv->preview_timeline) - { - progress = 1.0 - - clutter_timeline_get_progress (priv->preview_timeline); - clutter_timeline_stop (priv->preview_timeline); - g_object_unref (priv->preview_timeline); - } - else - progress = 0.0; - - total_duration = priv->anim_length * (1.0 - progress) * DEBUG_MULT; - duration1 = total_duration * TAB_S1_ANIM; - duration2 = total_duration * TAB_S2_ANIM; - - priv->preview_timeline = - clutter_timeline_new (priv->anim_length * DEBUG_MULT); - clutter_timeline_skip (priv->preview_timeline, - clutter_timeline_get_duration (priv->preview_timeline) * progress); - - g_signal_connect (priv->preview_timeline, "completed", + if (priv->preview_timeline) { + progress = 1.0 - clutter_timeline_get_progress ( + priv->preview_timeline); + clutter_timeline_stop (priv->preview_timeline); + g_object_unref (priv->preview_timeline); + } else + progress = 0.0; + + total_duration = priv->anim_length * (1.0 - progress) * DEBUG_MULT; + duration1 = total_duration * TAB_S1_ANIM; + duration2 = total_duration * TAB_S2_ANIM; + + priv->preview_timeline = + clutter_timeline_new (priv->anim_length * DEBUG_MULT); + clutter_timeline_skip ( + priv->preview_timeline, clutter_timeline_get_duration ( + priv->preview_timeline) * progress); + + g_signal_connect ( + priv->preview_timeline, "completed", G_CALLBACK (preview_completed_cb), tab); - clutter_timeline_start (priv->preview_timeline); + clutter_timeline_start (priv->preview_timeline); - if (!priv->preview) - { - clutter_actor_animate_with_timeline (CLUTTER_ACTOR (tab), - CLUTTER_EASE_IN_OUT_QUAD, - priv->preview_timeline, - "opacity", preview ? 0x00 : 0xff, - NULL); - return; - } + if (!priv->preview) { + clutter_actor_animate_with_timeline ( + CLUTTER_ACTOR (tab), + CLUTTER_EASE_IN_OUT_QUAD, + priv->preview_timeline, + "opacity", preview ? 0x00 : 0xff, + NULL); + return; + } - g_signal_connect (priv->preview_timeline, "new-frame", + g_signal_connect ( + priv->preview_timeline, "new-frame", G_CALLBACK (preview_new_frame_cb), tab); - timeline = clutter_timeline_new ((guint) duration1); - timeline2 = clutter_timeline_new ((guint) duration2); + timeline = clutter_timeline_new ((guint) duration1); + timeline2 = clutter_timeline_new ((guint) duration2); - g_signal_connect (timeline, "started", + g_signal_connect ( + timeline, "started", G_CALLBACK (preview_s1_started_cb), tab); - g_signal_connect (timeline2, "started", + g_signal_connect ( + timeline2, "started", G_CALLBACK (preview_s2_started_cb), tab); - if (preview) - clutter_timeline_set_delay (timeline2, duration1); - else - clutter_timeline_set_delay (timeline, duration2); - - /* clutter_actor_animate_with_timeline will start the timelines */ - clutter_actor_animate_with_timeline (CLUTTER_ACTOR (priv->label), - CLUTTER_EASE_IN_OUT_QUAD, - preview ? timeline : timeline2, - "opacity", 0x00, - NULL); - if (priv->icon) - clutter_actor_animate_with_timeline (priv->icon, - CLUTTER_EASE_IN_OUT_QUAD, - timeline, - "opacity", preview ? 0x00 : 0xff, - NULL); - if (priv->can_close) - clutter_actor_animate_with_timeline (CLUTTER_ACTOR (priv->close_button), - CLUTTER_EASE_IN_OUT_QUAD, - timeline, - "opacity", preview ? 0x00 : 0xff, - NULL); - - if (priv->preview) - { - clutter_actor_show (priv->preview); - clutter_actor_animate_with_timeline (priv->preview, - CLUTTER_EASE_IN_OUT_QUAD, - timeline2, - "opacity", preview ? 0xff : 0x00, - NULL); + if (preview) + clutter_timeline_set_delay (timeline2, duration1); + else + clutter_timeline_set_delay (timeline, duration2); + + /* clutter_actor_animate_with_timeline will start the timelines */ + clutter_actor_animate_with_timeline ( + CLUTTER_ACTOR (priv->label), + CLUTTER_EASE_IN_OUT_QUAD, + preview ? timeline : timeline2, + "opacity", 0x00, NULL); + + if (priv->icon) + clutter_actor_animate_with_timeline ( + priv->icon, + CLUTTER_EASE_IN_OUT_QUAD, + timeline, + "opacity", preview ? 0x00 : 0xff, + NULL); + + if (priv->can_close) + clutter_actor_animate_with_timeline ( + CLUTTER_ACTOR (priv->close_button), + CLUTTER_EASE_IN_OUT_QUAD, + timeline, + "opacity", preview ? 0x00 : 0xff, + NULL); + + if (priv->preview) + clutter_actor_show (priv->preview); + clutter_actor_animate_with_timeline ( + priv->preview, + CLUTTER_EASE_IN_OUT_QUAD, + timeline2, + "opacity", preview ? 0xff : 0x00, + NULL); + + /* The animations have references on these, drop ours */ + g_object_unref (timeline); + g_object_unref (timeline2); + + /* Add an actor name, for style */ + clutter_actor_set_name ( + CLUTTER_ACTOR (tab), + priv->private ? "private-preview-tab" : + "preview-tab"); } - - /* The animations have references on these, drop ours */ - g_object_unref (timeline); - g_object_unref (timeline2); - - /* Add an actor name, for style */ - clutter_actor_set_name (CLUTTER_ACTOR (tab), - priv->private ? "private-preview-tab" : - "preview-tab"); - } } gboolean e_mail_tab_get_preview_mode (EMailTab *tab) { - EMailTabPrivate *priv = tab->priv; - return priv->preview_mode; + EMailTabPrivate *priv = tab->priv; + return priv->preview_mode; } void -e_mail_tab_set_preview_duration (EMailTab *tab, guint duration) +e_mail_tab_set_preview_duration (EMailTab *tab, + guint duration) { - EMailTabPrivate *priv = tab->priv; + EMailTabPrivate *priv = tab->priv; - if (priv->anim_length != duration) - { - priv->anim_length = duration; - g_object_notify (G_OBJECT (tab), "preview-duration"); - } + if (priv->anim_length != duration) { + priv->anim_length = duration; + g_object_notify (G_OBJECT (tab), "preview-duration"); + } } guint e_mail_tab_get_preview_duration (EMailTab *tab) { - EMailTabPrivate *priv = tab->priv; - return priv->anim_length; + EMailTabPrivate *priv = tab->priv; + return priv->anim_length; } void -e_mail_tab_set_spacing (EMailTab *tab, gfloat spacing) +e_mail_tab_set_spacing (EMailTab *tab, + gfloat spacing) { - EMailTabPrivate *priv = tab->priv; - - if (priv->spacing != spacing) - { - priv->spacing = spacing; - g_object_notify (G_OBJECT (tab), "spacing"); - clutter_actor_queue_relayout (CLUTTER_ACTOR (tab)); - } + EMailTabPrivate *priv = tab->priv; + + if (priv->spacing != spacing) { + priv->spacing = spacing; + g_object_notify (G_OBJECT (tab), "spacing"); + clutter_actor_queue_relayout (CLUTTER_ACTOR (tab)); + } } gfloat e_mail_tab_get_spacing (EMailTab *tab) { - EMailTabPrivate *priv = tab->priv; - return priv->spacing; + EMailTabPrivate *priv = tab->priv; + return priv->spacing; } void -e_mail_tab_set_private (EMailTab *tab, gboolean private) +e_mail_tab_set_private (EMailTab *tab, + gboolean private) { - EMailTabPrivate *priv = tab->priv; + EMailTabPrivate *priv = tab->priv; - if (priv->private == private) - return; + if (priv->private == private) + return; - priv->private = private; + priv->private = private; - if (!priv->preview_mode) - clutter_actor_set_name (CLUTTER_ACTOR (tab), - private ? "private-tab" : NULL); + if (!priv->preview_mode) + clutter_actor_set_name ( + CLUTTER_ACTOR (tab), private ? "private-tab" : NULL); - g_object_notify (G_OBJECT (tab), "private"); + g_object_notify (G_OBJECT (tab), "private"); } gboolean e_mail_tab_get_private (EMailTab *tab) { - EMailTabPrivate *priv = tab->priv; - return priv->private; + EMailTabPrivate *priv = tab->priv; + return priv->private; } void -e_mail_tab_set_active (EMailTab *tab, gboolean active) +e_mail_tab_set_active (EMailTab *tab, + gboolean active) { - EMailTabPrivate *priv = tab->priv; + EMailTabPrivate *priv = tab->priv; - if (priv->active == active) - return; + if (priv->active == active) + return; - priv->active = active; + priv->active = active; - g_object_notify (G_OBJECT (tab), "active"); + g_object_notify (G_OBJECT (tab), "active"); - if (active) - mx_stylable_set_style_pseudo_class (MX_STYLABLE (tab), "active"); - else if (!priv->pressed) - { - if (priv->hover) - mx_stylable_set_style_pseudo_class (MX_STYLABLE (tab), "hover"); - else - mx_stylable_set_style_pseudo_class (MX_STYLABLE (tab), NULL); - } + if (active) + mx_stylable_set_style_pseudo_class (MX_STYLABLE (tab), "active"); + else if (!priv->pressed) { + if (priv->hover) + mx_stylable_set_style_pseudo_class (MX_STYLABLE (tab), "hover"); + else + mx_stylable_set_style_pseudo_class (MX_STYLABLE (tab), NULL); + } } gboolean e_mail_tab_get_active (EMailTab *tab) { - EMailTabPrivate *priv = tab->priv; - return priv->active; + EMailTabPrivate *priv = tab->priv; + return priv->active; } static gboolean e_mail_tab_alert_cb (EMailTab *tab) { - const gchar *name; - EMailTabPrivate *priv = tab->priv; + const gchar *name; + EMailTabPrivate *priv = tab->priv; - /* FIXME: Work in preview mode */ + /* FIXME: Work in preview mode */ - /* Alternate between private mode and non-private to alert */ - name = (priv->private ^ (priv->alert_count % 2)) ? NULL : "private-tab"; - if (!priv->preview_mode) - clutter_actor_set_name (CLUTTER_ACTOR (tab), name); - priv->alert_count++; + /* Alternate between private mode and non-private to alert */ + name = (priv->private ^ (priv->alert_count % 2)) ? NULL : "private-tab"; + if (!priv->preview_mode) + clutter_actor_set_name (CLUTTER_ACTOR (tab), name); + priv->alert_count++; - if (priv->alert_count < 4) - return TRUE; + if (priv->alert_count < 4) + return TRUE; - /* This call isn't needed, it should be in the correct state as long as - * the above check always checks for < (an even number) - */ - /*if (!priv->preview_mode) - clutter_actor_set_name (CLUTTER_ACTOR (tab), - priv->private ? "private-tab" : NULL);*/ - priv->alert_source = 0; + /* This call isn't needed, it should be in the correct state as long as + * the above check always checks for < (an even number) + */ + /*if (!priv->preview_mode) + clutter_actor_set_name (CLUTTER_ACTOR (tab), + priv->private ? "private-tab" : NULL);*/ + priv->alert_source = 0; - return FALSE; + return FALSE; } void e_mail_tab_alert (EMailTab *tab) { - EMailTabPrivate *priv = tab->priv; - - priv->alert_count = 0; - if (!priv->alert_source) - priv->alert_source = - g_timeout_add_full (G_PRIORITY_HIGH, - 500, - (GSourceFunc) e_mail_tab_alert_cb, - tab, - NULL); + EMailTabPrivate *priv = tab->priv; + + priv->alert_count = 0; + if (!priv->alert_source) + priv->alert_source = + g_timeout_add_full (G_PRIORITY_HIGH, + 500, + (GSourceFunc) e_mail_tab_alert_cb, + tab, + NULL); } void -e_mail_tab_enable_drag (EMailTab *tab, gboolean enable) +e_mail_tab_enable_drag (EMailTab *tab, + gboolean enable) { - EMailTabPrivate *priv = tab->priv; + EMailTabPrivate *priv = tab->priv; - if (priv->drag_enabled == enable) - return; + if (priv->drag_enabled == enable) + return; - priv->drag_enabled = enable; - if (enable) - mx_draggable_enable (MX_DRAGGABLE (tab)); - else - mx_draggable_disable (MX_DRAGGABLE (tab)); + priv->drag_enabled = enable; + if (enable) + mx_draggable_enable (MX_DRAGGABLE (tab)); + else + mx_draggable_disable (MX_DRAGGABLE (tab)); } diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c index 93e61a2d9f..b9589d51c3 100644 --- a/mail/em-account-editor.c +++ b/mail/em-account-editor.c @@ -23,16 +23,15 @@ */ /* - work before merge can occur: - - verify behaviour. - work out what to do with the startup assistant. - - also need to work out: - how to remove unecessary items from a service url once - configured (removing settings from other types). - -*/ + * work before merge can occur: + * + * verify behaviour. + * work out what to do with the startup assistant. + * + * also need to work out: + * how to remove unecessary items from a service url once + * configured (removing settings from other types). + */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -105,7 +104,7 @@ struct _receive_options_item { EMConfigItem item; /* Only CAMEL_PROVIDER_CONF_ENTRYs GtkEntrys are stored here. - The auto-detect camel provider code will probably be removed */ + * The auto-detect camel provider code will probably be removed */ GHashTable *extra_table; }; @@ -216,10 +215,10 @@ struct _EMAccountEditorPrivate { GHashTable *widgets; /* for assistant page preparation */ - guint identity_set:1; - guint receive_set:1; - guint send_set:1; - guint management_set:1; + guint identity_set : 1; + guint receive_set : 1; + guint send_set : 1; + guint management_set : 1; ServerData *selected_server; }; @@ -586,7 +585,7 @@ static gboolean is_email (const gchar *address) { /* This is supposed to check if the address's domain could be - an FQDN but alas, it's not worth the pain and suffering. */ + * an FQDN but alas, it's not worth the pain and suffering. */ const gchar *at; at = strchr (address, '@'); @@ -598,7 +597,8 @@ is_email (const gchar *address) } static CamelURL * -emae_account_url (EMAccountEditor *emae, gint urlid) +emae_account_url (EMAccountEditor *emae, + gint urlid) { EAccount *account; CamelURL *url = NULL; @@ -621,7 +621,8 @@ emae_account_url (EMAccountEditor *emae, gint urlid) /* ********************************************************************** */ static void -default_folders_clicked (GtkButton *button, gpointer user_data) +default_folders_clicked (GtkButton *button, + gpointer user_data) { EMAccountEditor *emae = user_data; const gchar *uri; @@ -639,10 +640,12 @@ default_folders_clicked (GtkButton *button, gpointer user_data) } /* The camel provider auto-detect interface should be deprecated. - But it still needs to be replaced with something of similar functionality. - Just using the normal econfig plugin mechanism should be adequate. */ + * But it still needs to be replaced with something of similar functionality. + * Just using the normal econfig plugin mechanism should be adequate. */ static void -emae_auto_detect_free (gpointer key, gpointer value, gpointer user_data) +emae_auto_detect_free (gpointer key, + gpointer value, + gpointer user_data) { g_free (key); g_free (value); @@ -686,7 +689,7 @@ emae_auto_detect (EMAccountEditor *emae) g_return_if_fail (entries[i].type == CAMEL_PROVIDER_CONF_ENTRY); w = NULL; - for (l = emae->priv->extra_items;l;l=g_slist_next (l)) { + for (l = emae->priv->extra_items; l; l = g_slist_next (l)) { item = l->data; if (item->extra_table && (w = g_hash_table_lookup (item->extra_table, entries[i].name))) break; @@ -700,7 +703,8 @@ emae_auto_detect (EMAccountEditor *emae) } static gint -provider_compare (const CamelProvider *p1, const CamelProvider *p2) +provider_compare (const CamelProvider *p1, + const CamelProvider *p2) { /* sort providers based on "location" (ie. local or remote) */ if (p1->flags & CAMEL_PROVIDER_IS_REMOTE) { @@ -715,7 +719,9 @@ provider_compare (const CamelProvider *p1, const CamelProvider *p2) } static void -emae_signature_added (ESignatureList *signatures, ESignature *sig, EMAccountEditor *emae) +emae_signature_added (ESignatureList *signatures, + ESignature *sig, + EMAccountEditor *emae) { GtkTreeModel *model; GtkTreeIter iter; @@ -730,11 +736,16 @@ emae_signature_added (ESignatureList *signatures, ESignature *sig, EMAccountEdit gtk_list_store_append ((GtkListStore *) model, &iter); gtk_list_store_set ((GtkListStore *) model, &iter, 0, name, 1, uid, -1); - gtk_combo_box_set_active (emae->priv->signatures_dropdown, gtk_tree_model_iter_n_children (model, NULL)-1); + gtk_combo_box_set_active ( + emae->priv->signatures_dropdown, + gtk_tree_model_iter_n_children (model, NULL) - 1); } static gint -emae_signature_get_iter (EMAccountEditor *emae, ESignature *sig, GtkTreeModel **modelp, GtkTreeIter *iter) +emae_signature_get_iter (EMAccountEditor *emae, + ESignature *sig, + GtkTreeModel **modelp, + GtkTreeIter *iter) { GtkTreeModel *model; gint found = 0; @@ -760,7 +771,9 @@ emae_signature_get_iter (EMAccountEditor *emae, ESignature *sig, GtkTreeModel ** } static void -emae_signature_removed (ESignatureList *signatures, ESignature *sig, EMAccountEditor *emae) +emae_signature_removed (ESignatureList *signatures, + ESignature *sig, + EMAccountEditor *emae) { GtkTreeIter iter; GtkTreeModel *model; @@ -770,7 +783,9 @@ emae_signature_removed (ESignatureList *signatures, ESignature *sig, EMAccountEd } static void -emae_signature_changed (ESignatureList *signatures, ESignature *sig, EMAccountEditor *emae) +emae_signature_changed (ESignatureList *signatures, + ESignature *sig, + EMAccountEditor *emae) { GtkTreeIter iter; GtkTreeModel *model; @@ -783,7 +798,8 @@ emae_signature_changed (ESignatureList *signatures, ESignature *sig, EMAccountEd } static void -emae_signaturetype_changed (GtkComboBox *dropdown, EMAccountEditor *emae) +emae_signaturetype_changed (GtkComboBox *dropdown, + EMAccountEditor *emae) { EAccount *account; gint id = gtk_combo_box_get_active (dropdown); @@ -804,7 +820,8 @@ emae_signaturetype_changed (GtkComboBox *dropdown, EMAccountEditor *emae) } static void -emae_signature_new (GtkWidget *widget, EMAccountEditor *emae) +emae_signature_new (GtkWidget *widget, + EMAccountEditor *emae) { GtkWidget *editor; gpointer parent; @@ -818,14 +835,15 @@ emae_signature_new (GtkWidget *widget, EMAccountEditor *emae) } static GtkWidget * -emae_setup_signatures (EMAccountEditor *emae, GtkBuilder *builder) +emae_setup_signatures (EMAccountEditor *emae, + GtkBuilder *builder) { EMAccountEditorPrivate *p = emae->priv; EAccount *account; GtkComboBox *dropdown = (GtkComboBox *)e_builder_get_widget (builder, "signature_dropdown"); GtkCellRenderer *cell = gtk_cell_renderer_text_new (); GtkListStore *store; - gint i, active=0; + gint i, active = 0; GtkTreeIter iter; ESignatureList *signatures; EIterator *it; @@ -890,7 +908,8 @@ emae_setup_signatures (EMAccountEditor *emae, GtkBuilder *builder) } static void -emae_receipt_policy_changed (GtkComboBox *dropdown, EMAccountEditor *emae) +emae_receipt_policy_changed (GtkComboBox *dropdown, + EMAccountEditor *emae) { EAccount *account; gint id = gtk_combo_box_get_active (dropdown); @@ -910,7 +929,8 @@ emae_receipt_policy_changed (GtkComboBox *dropdown, EMAccountEditor *emae) } static GtkWidget * -emae_setup_receipt_policy (EMAccountEditor *emae, GtkBuilder *builder) +emae_setup_receipt_policy (EMAccountEditor *emae, + GtkBuilder *builder) { EAccount *account; GtkComboBox *dropdown = (GtkComboBox *)e_builder_get_widget (builder, "receipt_policy_dropdown"); @@ -960,7 +980,8 @@ emae_setup_receipt_policy (EMAccountEditor *emae, GtkBuilder *builder) } static void -emae_account_entry_changed (GtkEntry *entry, EMAccountEditor *emae) +emae_account_entry_changed (GtkEntry *entry, + EMAccountEditor *emae) { EAccount *account; gchar *text; @@ -978,7 +999,10 @@ emae_account_entry_changed (GtkEntry *entry, EMAccountEditor *emae) } static GtkEntry * -emae_account_entry (EMAccountEditor *emae, const gchar *name, gint item, GtkBuilder *builder) +emae_account_entry (EMAccountEditor *emae, + const gchar *name, + gint item, + GtkBuilder *builder) { EAccount *account; GtkEntry *entry; @@ -997,7 +1021,8 @@ emae_account_entry (EMAccountEditor *emae, const gchar *name, gint item, GtkBuil } static void -emae_account_toggle_changed (GtkToggleButton *toggle, EMAccountEditor *emae) +emae_account_toggle_changed (GtkToggleButton *toggle, + EMAccountEditor *emae) { EAccount *account; gboolean active; @@ -1011,7 +1036,9 @@ emae_account_toggle_changed (GtkToggleButton *toggle, EMAccountEditor *emae) } static void -emae_account_toggle_widget (EMAccountEditor *emae, GtkToggleButton *toggle, gint item) +emae_account_toggle_widget (EMAccountEditor *emae, + GtkToggleButton *toggle, + gint item) { EAccount *account; gboolean active; @@ -1035,7 +1062,10 @@ emae_account_toggle_widget (EMAccountEditor *emae, GtkToggleButton *toggle, gint } static GtkToggleButton * -emae_account_toggle (EMAccountEditor *emae, const gchar *name, gint item, GtkBuilder *builder) +emae_account_toggle (EMAccountEditor *emae, + const gchar *name, + gint item, + GtkBuilder *builder) { GtkToggleButton *toggle; @@ -1046,7 +1076,8 @@ emae_account_toggle (EMAccountEditor *emae, const gchar *name, gint item, GtkBui } static void -emae_account_spinint_changed (GtkSpinButton *spin, EMAccountEditor *emae) +emae_account_spinint_changed (GtkSpinButton *spin, + EMAccountEditor *emae) { EAccount *account; gpointer data; @@ -1060,7 +1091,9 @@ emae_account_spinint_changed (GtkSpinButton *spin, EMAccountEditor *emae) } static void -emae_account_spinint_widget (EMAccountEditor *emae, GtkSpinButton *spin, gint item) +emae_account_spinint_widget (EMAccountEditor *emae, + GtkSpinButton *spin, + gint item) { EAccount *account; gboolean writable; @@ -1083,21 +1116,9 @@ emae_account_spinint_widget (EMAccountEditor *emae, GtkSpinButton *spin, gint it G_CALLBACK (emae_account_spinint_changed), emae); } -#if 0 -static GtkSpinButton * -emae_account_spinint (EMAccountEditor *emae, const gchar *name, gint item) -{ - GtkSpinButton *spin; - - spin = (GtkSpinButton *) e_builder_get_widget (emae->priv->xml, name); - emae_account_spinint_widget (emae, spin, item); - - return spin; -} -#endif - static void -emae_account_folder_changed (EMFolderSelectionButton *folder, EMAccountEditor *emae) +emae_account_folder_changed (EMFolderSelectionButton *folder, + EMAccountEditor *emae) { EAccount *account; gpointer data; @@ -1111,7 +1132,11 @@ emae_account_folder_changed (EMFolderSelectionButton *folder, EMAccountEditor *e } static EMFolderSelectionButton * -emae_account_folder (EMAccountEditor *emae, const gchar *name, gint item, gint deffolder, GtkBuilder *builder) +emae_account_folder (EMAccountEditor *emae, + const gchar *name, + gint item, + gint deffolder, + GtkBuilder *builder) { EAccount *account; EMFolderSelectionButton *folder; @@ -1168,7 +1193,9 @@ smime_changed (EMAccountEditor *emae) } static void -smime_sign_key_selected (GtkWidget *dialog, const gchar *key, EMAccountEditor *emae) +smime_sign_key_selected (GtkWidget *dialog, + const gchar *key, + EMAccountEditor *emae) { EMAccountEditorPrivate *priv = emae->priv; @@ -1181,7 +1208,8 @@ smime_sign_key_selected (GtkWidget *dialog, const gchar *key, EMAccountEditor *e } static void -smime_sign_key_select (GtkWidget *button, EMAccountEditor *emae) +smime_sign_key_select (GtkWidget *button, + EMAccountEditor *emae) { EMAccountEditorPrivate *priv = emae->priv; GtkWidget *w; @@ -1194,7 +1222,8 @@ smime_sign_key_select (GtkWidget *button, EMAccountEditor *emae) } static void -smime_sign_key_clear (GtkWidget *w, EMAccountEditor *emae) +smime_sign_key_clear (GtkWidget *w, + EMAccountEditor *emae) { EMAccountEditorPrivate *priv = emae->priv; @@ -1203,7 +1232,9 @@ smime_sign_key_clear (GtkWidget *w, EMAccountEditor *emae) } static void -smime_encrypt_key_selected (GtkWidget *dialog, const gchar *key, EMAccountEditor *emae) +smime_encrypt_key_selected (GtkWidget *dialog, + const gchar *key, + EMAccountEditor *emae) { EMAccountEditorPrivate *priv = emae->priv; @@ -1216,7 +1247,8 @@ smime_encrypt_key_selected (GtkWidget *dialog, const gchar *key, EMAccountEditor } static void -smime_encrypt_key_select (GtkWidget *button, EMAccountEditor *emae) +smime_encrypt_key_select (GtkWidget *button, + EMAccountEditor *emae) { EMAccountEditorPrivate *priv = emae->priv; GtkWidget *w; @@ -1229,7 +1261,8 @@ smime_encrypt_key_select (GtkWidget *button, EMAccountEditor *emae) } static void -smime_encrypt_key_clear (GtkWidget *w, EMAccountEditor *emae) +smime_encrypt_key_clear (GtkWidget *w, + EMAccountEditor *emae) { EMAccountEditorPrivate *priv = emae->priv; @@ -1239,7 +1272,8 @@ smime_encrypt_key_clear (GtkWidget *w, EMAccountEditor *emae) #endif static void -emae_url_set_host (CamelURL *url, const gchar *txt) +emae_url_set_host (CamelURL *url, + const gchar *txt) { gchar *host; @@ -1252,15 +1286,16 @@ emae_url_set_host (CamelURL *url, const gchar *txt) } static void -emae_url_set_port (CamelURL *url, const gchar *port) +emae_url_set_port (CamelURL *url, + const gchar *port) { if (port && *port) camel_url_set_port (url, atoi (port)); } /* This is used to map a funciton which will set on the url a string value. - if widgets[0] is set, it is the entry which will be called against setval () - We need our own function for host:port decoding, as above */ + * if widgets[0] is set, it is the entry which will be called against setval () + * We need our own function for host:port decoding, as above */ struct _provider_host_info { guint32 flag; void (*setval)(CamelURL *, const gchar *); @@ -1393,7 +1428,8 @@ static struct _service_info { }; static void -emae_uri_changed (EMAccountEditorService *service, CamelURL *url) +emae_uri_changed (EMAccountEditorService *service, + CamelURL *url) { EAccount *account; gchar *uri; @@ -1413,7 +1449,9 @@ emae_uri_changed (EMAccountEditorService *service, CamelURL *url) } static void -emae_service_url_changed (EMAccountEditorService *service, void (*setval)(CamelURL *, const gchar *), GtkWidget *entry) +emae_service_url_changed (EMAccountEditorService *service, + void (*setval)(CamelURL *, const gchar *), + GtkWidget *entry) { GtkComboBox *dropdown; gint id; @@ -1433,7 +1471,7 @@ emae_service_url_changed (EMAccountEditorService *service, void (*setval)(CamelU g_strstrip (text); - setval (url, (text && text[0])?text:NULL); + setval (url, (text && text[0]) ? text : NULL); if (text && text[0] && setval == camel_url_set_user) { dropdown = service->authtype; @@ -1456,7 +1494,9 @@ emae_service_url_changed (EMAccountEditorService *service, void (*setval)(CamelU } static void -emae_service_url_path_changed (EMAccountEditorService *service, void (*setval)(CamelURL *, const gchar *), GtkWidget *widget) +emae_service_url_path_changed (EMAccountEditorService *service, + void (*setval)(CamelURL *, const gchar *), + GtkWidget *widget) { GtkComboBox *dropdown; gint id; @@ -1467,7 +1507,7 @@ emae_service_url_path_changed (EMAccountEditorService *service, void (*setval)(C CamelURL *url = emae_account_url (service->emae, emae_service_info[service->type].account_uri_key); const gchar *text = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget)); - setval (url, (text && text[0])?text:NULL); + setval (url, (text && text[0]) ? text : NULL); if (text && text[0] && setval == camel_url_set_user) { dropdown = service->authtype; @@ -1489,25 +1529,29 @@ emae_service_url_path_changed (EMAccountEditorService *service, void (*setval)(C } static void -emae_hostname_changed (GtkEntry *entry, EMAccountEditorService *service) +emae_hostname_changed (GtkEntry *entry, + EMAccountEditorService *service) { emae_service_url_changed (service, emae_url_set_host, GTK_WIDGET (entry)); } static void -emae_port_changed (EPortEntry *pentry, EMAccountEditorService *service) +emae_port_changed (EPortEntry *pentry, + EMAccountEditorService *service) { emae_service_url_changed (service, emae_url_set_port, GTK_WIDGET (pentry)); } static void -emae_username_changed (GtkEntry *entry, EMAccountEditorService *service) +emae_username_changed (GtkEntry *entry, + EMAccountEditorService *service) { emae_service_url_changed (service, camel_url_set_user, GTK_WIDGET (entry)); } static void -emae_path_changed (GtkWidget *widget, EMAccountEditorService *service) +emae_path_changed (GtkWidget *widget, + EMAccountEditorService *service) { emae_service_url_path_changed (service, camel_url_set_path, widget); } @@ -1587,7 +1631,8 @@ emae_setup_settings (EMAccountEditorService *service) config = E_CONFIG (service->emae->priv->config); target = (EMConfigTargetAccount *) config->target; - em_config_target_new_account_update_settings (config, target, service->emae->priv->source.settings); + em_config_target_new_account_update_settings ( + config, target, service->emae->priv->source.settings); } static void @@ -1624,16 +1669,16 @@ emae_service_provider_changed (EMAccountEditorService *service) if (service->port && service->provider->port_entries) e_port_entry_set_camel_entries (service->port, service->provider->port_entries); - for (i=0;emae_service_info[service->type].host_info[i].flag;i++) { + for (i = 0; emae_service_info[service->type].host_info[i].flag; i++) { GtkWidget *w; gint hide; struct _provider_host_info *info = &emae_service_info[service->type].host_info[i]; enable = CAMEL_PROVIDER_ALLOWS (service->provider, info->flag); hide = CAMEL_PROVIDER_HIDDEN (service->provider, info->flag); - show = (enable && !hide)?gtk_widget_show:gtk_widget_hide; + show = (enable && !hide) ? gtk_widget_show : gtk_widget_hide; - for (j=0; j < G_N_ELEMENTS (info->widgets); j++) { + for (j = 0; j < G_N_ELEMENTS (info->widgets); j++) { if (info->widgets[j] && (w = G_STRUCT_MEMBER (GtkWidget *, service, info->widgets[j]))) { show (w); if (j == 0) { @@ -1642,10 +1687,10 @@ emae_service_provider_changed (EMAccountEditorService *service) if (info->setval && !hide) { if (GTK_IS_ENTRY (w)) - info->setval (url, enable?gtk_entry_get_text ((GtkEntry *) w):NULL); + info->setval (url, enable ? gtk_entry_get_text ((GtkEntry *) w) : NULL); else if (E_IS_PORT_ENTRY (w)) info->setval (url, enable?g_strdup_printf("%i", - e_port_entry_get_port (E_PORT_ENTRY (w))):NULL); + e_port_entry_get_port (E_PORT_ENTRY (w))) : NULL); } } } @@ -1661,7 +1706,7 @@ emae_service_provider_changed (EMAccountEditorService *service) /* try to keep the authmech from the current url, or clear it */ if (url->authmech) { if (service->provider->authtypes) { - for (ll = service->provider->authtypes;ll;ll = g_list_next (ll)) + for (ll = service->provider->authtypes; ll; ll = g_list_next (ll)) if (!strcmp (url->authmech, ((CamelServiceAuthType *) ll->data)->authproto)) break; if (ll == NULL) @@ -1695,8 +1740,8 @@ emae_service_provider_changed (EMAccountEditorService *service) #endif /* This must be done AFTER use_ssl is set; changing use_ssl overwrites - the old port, which could be SSL port, but also could be some special - port and we would otherwise lost it */ + * the old port, which could be SSL port, but also could be some special + * port and we would otherwise lost it */ if (url->port && service->provider->port_entries) e_port_entry_set_port (service->port, old_port); @@ -1716,7 +1761,8 @@ emae_service_provider_changed (EMAccountEditorService *service) } static void -emae_provider_changed (GtkComboBox *dropdown, EMAccountEditorService *service) +emae_provider_changed (GtkComboBox *dropdown, + EMAccountEditorService *service) { gint id = gtk_combo_box_get_active (dropdown); GtkTreeModel *model; @@ -1740,7 +1786,8 @@ emae_provider_changed (GtkComboBox *dropdown, EMAccountEditorService *service) } static void -emae_refresh_providers (EMAccountEditor *emae, EMAccountEditorService *service) +emae_refresh_providers (EMAccountEditor *emae, + EMAccountEditorService *service) { EAccount *account; GtkListStore *store; @@ -1765,8 +1812,8 @@ emae_refresh_providers (EMAccountEditor *emae, EMAccountEditorService *service) gint len; if (colon) { - len = colon-uri; - current = g_alloca (len+1); + len = colon - uri; + current = g_alloca (len + 1); memcpy (current, uri, len); current[len] = 0; } @@ -1787,7 +1834,7 @@ emae_refresh_providers (EMAccountEditor *emae, EMAccountEditorService *service) i++; } - for (l=emae->priv->providers; l; l=l->next) { + for (l = emae->priv->providers; l; l = l->next) { CamelProvider *provider = l->data; if (!((strcmp (provider->domain, "mail") == 0 @@ -1841,7 +1888,8 @@ emae_refresh_providers (EMAccountEditor *emae, EMAccountEditorService *service) } static void -emae_authtype_changed (GtkComboBox *dropdown, EMAccountEditorService *service) +emae_authtype_changed (GtkComboBox *dropdown, + EMAccountEditorService *service) { EAccount *account; gint id = gtk_combo_box_get_active (dropdown); @@ -1879,7 +1927,8 @@ emae_authtype_changed (GtkComboBox *dropdown, EMAccountEditorService *service) } static void -emae_needs_auth (GtkToggleButton *toggle, EMAccountEditorService *service) +emae_needs_auth (GtkToggleButton *toggle, + EMAccountEditorService *service) { gint need = gtk_toggle_button_get_active (toggle); @@ -1899,7 +1948,8 @@ emae_needs_auth (GtkToggleButton *toggle, EMAccountEditorService *service) static void emae_check_authtype (GtkWidget *w, EMAccountEditorService *service); static void -emae_refresh_authtype (EMAccountEditor *emae, EMAccountEditorService *service) +emae_refresh_authtype (EMAccountEditor *emae, + EMAccountEditorService *service) { EAccount *account; GtkListStore *store; @@ -1924,13 +1974,13 @@ emae_refresh_authtype (EMAccountEditor *emae, EMAccountEditorService *service) url = camel_url_new (uri, NULL); if (service->provider) { - for (i=0, l=service->provider->authtypes; l; l=l->next, i++) { + for (i = 0, l = service->provider->authtypes; l; l = l->next, i++) { CamelServiceAuthType *authtype = l->data; gint avail; /* if we have some already shown */ if (service->auth_types) { - for (ll = service->auth_types;ll;ll = g_list_next (ll)) + for (ll = service->auth_types; ll; ll = g_list_next (ll)) if (!strcmp (authtype->authproto, ((CamelServiceAuthType *) ll->data)->authproto)) break; avail = ll != NULL; @@ -2046,7 +2096,9 @@ emae_check_authtype (GtkWidget *w, session = e_mail_backend_get_session (backend); uid = g_strdup_printf ("emae-check-authtype-%p", service); - url = camel_url_new (e_account_get_string (account, emae_service_info[service->type].account_uri_key), NULL); + url_string = (gchar *) e_account_get_string ( + account, emae_service_info[service->type].account_uri_key); + url = camel_url_new (url_string, NULL); if (service->settings) camel_settings_save_to_url (service->settings, url); url_string = camel_url_to_string (url, 0); @@ -2196,7 +2248,7 @@ emae_setup_service (EMAccountEditor *emae, emae_refresh_authtype (emae, service); /* Set the port after SSL is set, because it would overwrite the - port value (through emae_ssl_changed signal) */ + * port value (through emae_ssl_changed signal) */ if (url->port && service->provider->port_entries) { e_port_entry_set_port (service->port, url->port); } @@ -2287,7 +2339,10 @@ static struct { }; static void -emae_queue_widgets (EMAccountEditor *emae, GtkBuilder *builder, const gchar *first, ...) +emae_queue_widgets (EMAccountEditor *emae, + GtkBuilder *builder, + const gchar *first, + ...) { va_list ap; @@ -2328,7 +2383,7 @@ emae_identity_page (EConfig *ec, e_load_ui_builder_definition (builder, "mail-config.ui"); /* Management & Identity fields, in the assistant the management frame is relocated to the last page later on */ - for (i=0;i<G_N_ELEMENTS (emae_identity_entries);i++) + for (i = 0; i < G_N_ELEMENTS (emae_identity_entries); i++) priv->identity_entries[i] = emae_account_entry (emae, emae_identity_entries[i].name, emae_identity_entries[i].item, builder); priv->management_frame = e_builder_get_widget (builder, "management-section"); @@ -2799,7 +2854,7 @@ emae_receive_options_item (EConfig *ec, gtk_widget_show_all (box); - gtk_table_attach ((GtkTable *) parent, box, 0, 2, row, row+1, GTK_EXPAND|GTK_FILL, 0, 0, 0); + gtk_table_attach ((GtkTable *) parent, box, 0, 2, row, row + 1, GTK_EXPAND | GTK_FILL, 0, 0, 0); return box; } @@ -2867,7 +2922,7 @@ section: table = GTK_TABLE (parent); g_object_get (table, "n-rows", &row, NULL); - for (;entries[ii].type != CAMEL_PROVIDER_CONF_END && entries[ii].type != CAMEL_PROVIDER_CONF_SECTION_END; ii++) { + for (; entries[ii].type != CAMEL_PROVIDER_CONF_END && entries[ii].type != CAMEL_PROVIDER_CONF_SECTION_END; ii++) { switch (entries[ii].type) { case CAMEL_PROVIDER_CONF_SECTION_START: case CAMEL_PROVIDER_CONF_SECTION_END: @@ -2996,7 +3051,7 @@ emae_send_page (EConfig *ec, /* no transport options page at all for these types of providers */ if (priv->source.provider && CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (priv->source.provider)) { - memset (&priv->transport.frame, 0, ((gchar *)&priv->transport.check_dialog)-((gchar *)&priv->transport.frame)); + memset (&priv->transport.frame, 0, ((gchar *) &priv->transport.check_dialog) - ((gchar *) &priv->transport.frame)); return NULL; } @@ -3052,7 +3107,10 @@ emae_real_url_toggled (GtkToggleButton *check, } static void -set_real_folder_path (GtkButton *folder_button, CamelSettings *settings, const gchar *settings_prop, EAccount *account) +set_real_folder_path (GtkButton *folder_button, + CamelSettings *settings, + const gchar *settings_prop, + EAccount *account) { gchar *path = NULL, *uri; gchar *encoded_name; @@ -3092,7 +3150,9 @@ set_real_folder_path (GtkButton *folder_button, CamelSettings *settings, const g } static void -update_real_folder_cb (GtkButton *folder_button, GParamSpec *par_spec, EMAccountEditor *emae) +update_real_folder_cb (GtkButton *folder_button, + GParamSpec *par_spec, + EMAccountEditor *emae) { EMFolderSelectionButton *sel_button; CamelSettings *settings; @@ -3333,7 +3393,8 @@ emae_defaults_page (EConfig *ec, } static void -emae_account_hash_algo_combo_changed_cb (GtkComboBox *combobox, EMAccountEditor *emae) +emae_account_hash_algo_combo_changed_cb (GtkComboBox *combobox, + EMAccountEditor *emae) { EAccount *account; gpointer data; @@ -3359,7 +3420,10 @@ emae_account_hash_algo_combo_changed_cb (GtkComboBox *combobox, EMAccountEditor } static GtkComboBox * -emae_account_hash_algo_combo (EMAccountEditor *emae, const gchar *name, gint item, GtkBuilder *builder) +emae_account_hash_algo_combo (EMAccountEditor *emae, + const gchar *name, + gint item, + GtkBuilder *builder) { EAccount *account; GtkComboBox *combobox; @@ -3468,7 +3532,8 @@ emae_security_page (EConfig *ec, * Allow some level of post creation customisation in plugins. */ GtkWidget * -em_account_editor_get_widget (EMAccountEditor *emae, const gchar *name) +em_account_editor_get_widget (EMAccountEditor *emae, + const gchar *name) { GtkWidget *wid; @@ -3612,17 +3677,21 @@ static EMConfigItem emae_assistant_items[] = { static gboolean emae_assistant_items_translated = FALSE; static void -emae_free (EConfig *ec, GSList *items, gpointer data) +emae_free (EConfig *ec, + GSList *items, + gpointer data) { g_slist_free (items); } static void -emae_free_auto (EConfig *ec, GSList *items, gpointer data) +emae_free_auto (EConfig *ec, + GSList *items, + gpointer data) { GSList *l, *n; - for (l=items;l;) { + for (l = items; l;) { struct _receive_options_item *item = l->data; n = g_slist_next (l); @@ -3636,7 +3705,8 @@ emae_free_auto (EConfig *ec, GSList *items, gpointer data) } static gboolean -emae_service_complete (EMAccountEditor *emae, EMAccountEditorService *service) +emae_service_complete (EMAccountEditor *emae, + EMAccountEditorService *service) { EAccount *account; CamelURL *url; @@ -3683,7 +3753,7 @@ emae_check_servers (const gchar *email) server++; - for (i=0; i<len; i++) { + for (i = 0; i < len; i++) { if (strstr (server, mail_servers[i].key) != NULL) return &mail_servers[i]; } @@ -3692,7 +3762,8 @@ emae_check_servers (const gchar *email) } static void -emae_check_set_authtype (GtkComboBox *dropdown, const gchar *auth) +emae_check_set_authtype (GtkComboBox *dropdown, + const gchar *auth) { GtkTreeModel *model; GtkTreeIter iter; @@ -3715,7 +3786,9 @@ emae_check_set_authtype (GtkComboBox *dropdown, const gchar *auth) } static gboolean -emae_check_complete (EConfig *ec, const gchar *pageid, gpointer data) +emae_check_complete (EConfig *ec, + const gchar *pageid, + gpointer data) { EMAccountEditor *emae = data; EAccount *account; @@ -3731,7 +3804,7 @@ emae_check_complete (EConfig *ec, const gchar *pageid, gpointer data) new_account = (original_account == NULL); /* We use the page-check of various pages to 'prepare' or - pre-load their values, only in the assistant */ + * pre-load their values, only in the assistant */ if (pageid && ((EConfig *) emae->priv->config)->type == E_CONFIG_ASSISTANT) { if (!strcmp (pageid, "00.identity")) { @@ -3759,9 +3832,9 @@ emae_check_complete (EConfig *ec, const gchar *pageid, gpointer data) emae->priv->receive_set = 1; tmp = (gchar *) e_account_get_string (account, E_ACCOUNT_ID_ADDRESS); at = strchr (tmp, '@'); - user = g_alloca (at-tmp+1); - memcpy (user, tmp, at-tmp); - user[at-tmp] = 0; + user = g_alloca (at - tmp + 1); + memcpy (user, tmp, at - tmp); + user[at - tmp] = 0; at++; sdata = emae->priv->selected_server = emae->emae_check_servers (tmp); @@ -3812,9 +3885,9 @@ emae_check_complete (EConfig *ec, const gchar *pageid, gpointer data) emae->priv->send_set = 1; tmp = e_account_get_string (account, E_ACCOUNT_ID_ADDRESS); at = strchr (tmp, '@'); - user = g_alloca (at-tmp+1); - memcpy (user, tmp, at-tmp); - user[at-tmp] = 0; + user = g_alloca (at - tmp + 1); + memcpy (user, tmp, at - tmp); + user[at - tmp] = 0; at++; sdata = emae->priv->selected_server; @@ -3879,9 +3952,9 @@ emae_check_complete (EConfig *ec, const gchar *pageid, gpointer data) } /* - Setting a flag on the Account if it is marked as default. It is done in this way instead of - using a temporary variable so as to keep track of which account is marked as default in case of - editing multiple accounts at a time + * Setting a flag on the Account if it is marked as default. It is done in this way instead of + * using a temporary variable so as to keep track of which account is marked as default in case of + * editing multiple accounts at a time */ if (gtk_toggle_button_get_active (emae->priv->default_account)) g_object_set_data (G_OBJECT (account), "default_flagged", GINT_TO_POINTER(1)); @@ -3936,13 +4009,17 @@ emae_check_complete (EConfig *ec, const gchar *pageid, gpointer data) } gboolean -em_account_editor_check (EMAccountEditor *emae, const gchar *page) +em_account_editor_check (EMAccountEditor *emae, + const gchar *page) { return emae_check_complete ((EConfig *) emae->config, page, emae); } static void -forget_password_if_needed (EAccount *original_account, EAccount *modified_account, e_account_item_t save_pass_itm, e_account_item_t url_itm) +forget_password_if_needed (EAccount *original_account, + EAccount *modified_account, + e_account_item_t save_pass_itm, + e_account_item_t url_itm) { const gchar *orig_url, *modif_url; @@ -4026,7 +4103,7 @@ emae_commit (EConfig *ec, account = modified_account; /* HACK: this will add the account to the folder tree. - We should just be listening to the account list directly for changed events */ + * We should just be listening to the account list directly for changed events */ if (account->enabled && emae->priv->source.provider && (emae->priv->source.provider->flags & CAMEL_PROVIDER_IS_STORAGE)) { @@ -4076,7 +4153,7 @@ em_account_editor_construct (EMAccountEditor *emae, ec = em_config_new (E_CONFIG_BOOK, id); items = emae_editor_items; if (!emae_editor_items_translated) { - for (i=0;items[i].path;i++) { + for (i = 0; items[i].path; i++) { if (items[i].label) items[i].label = gettext (items[i].label); } @@ -4086,7 +4163,7 @@ em_account_editor_construct (EMAccountEditor *emae, ec = em_config_new (E_CONFIG_ASSISTANT, id); items = emae_assistant_items; if (!emae_assistant_items_translated) { - for (i=0;items[i].path;i++) { + for (i = 0; items[i].path; i++) { if (items[i].label) items[i].label = _(items[i].label); } @@ -4101,7 +4178,7 @@ em_account_editor_construct (EMAccountEditor *emae, emae->config = priv->config = ec; l = NULL; - for (i=0;items[i].path;i++) + for (i = 0; items[i].path; i++) l = g_slist_prepend (l, &items[i]); e_config_add_items ((EConfig *) ec, l, emae_free, emae); @@ -4109,10 +4186,10 @@ em_account_editor_construct (EMAccountEditor *emae, l = NULL; have = g_hash_table_new (g_str_hash, g_str_equal); index = 20; - for (prov=priv->providers;prov;prov=g_list_next (prov)) { + for (prov = priv->providers; prov; prov = g_list_next (prov)) { CamelProviderConfEntry *entries = ((CamelProvider *) prov->data)->extra_conf; - for (i=0;entries && entries[i].type != CAMEL_PROVIDER_CONF_END;i++) { + for (i = 0; entries && entries[i].type != CAMEL_PROVIDER_CONF_END; i++) { struct _receive_options_item *item; const gchar *name = entries[i].name; gint myindex = index; diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index 12fdd96490..8c98040ada 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -179,10 +179,10 @@ 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 - realizing it. To try to avoid being totally confusing, I've changed - this dialog to provide slightly different text in that case, to - better explain what the hell is going on. */ + * them to create a message with only Bcc recipients without really + * realizing it. To try to avoid being totally confusing, I've changed + * this dialog to provide slightly different text in that case, to + * better explain what the hell is going on. */ return em_utils_prompt_user ( GTK_WINDOW (composer), @@ -1028,7 +1028,9 @@ em_utils_compose_new_message_with_mailto (EShell *shell, } static gboolean -replace_variables (GSList *clues, CamelMimeMessage *message, gchar **pstr) +replace_variables (GSList *clues, + CamelMimeMessage *message, + gchar **pstr) { gint i; gboolean string_changed = FALSE, count1 = FALSE; @@ -1057,7 +1059,7 @@ replace_variables (GSList *clues, CamelMimeMessage *message, gchar **pstr) for (list = clues; list; list = g_slist_next (list)) { gchar **temp = g_strsplit (list->data, "=", 2); - if (!g_ascii_strcasecmp (temp[0], out+1)) { + if (!g_ascii_strcasecmp (temp[0], out + 1)) { g_free (str); str = g_strconcat (temp_str[0], temp[1], temp_str[1], NULL); count1 = TRUE; @@ -1068,7 +1070,7 @@ replace_variables (GSList *clues, CamelMimeMessage *message, gchar **pstr) } if (!count1) { - if (getenv (out+1)) { + if (getenv (out + 1)) { g_free (str); str = g_strconcat ( temp_str[0], @@ -1113,7 +1115,9 @@ replace_variables (GSList *clues, CamelMimeMessage *message, gchar **pstr) } static void -traverse_parts (GSList *clues, CamelMimeMessage *message, CamelDataWrapper *content) +traverse_parts (GSList *clues, + CamelMimeMessage *message, + CamelDataWrapper *content) { g_return_if_fail (message != NULL); @@ -1401,7 +1405,8 @@ em_utils_edit_messages (EMailReader *reader, } static void -emu_update_composers_security (EMsgComposer *composer, guint32 validity_found) +emu_update_composers_security (EMsgComposer *composer, + guint32 validity_found) { GtkToggleAction *action; @@ -1426,7 +1431,8 @@ emu_update_composers_security (EMsgComposer *composer, guint32 validity_found) } static void -real_update_forwarded_flag (gpointer uid, gpointer folder) +real_update_forwarded_flag (gpointer uid, + gpointer folder) { if (uid && folder) camel_folder_set_message_flags ( @@ -1788,8 +1794,8 @@ redirect_get_composer (EShell *shell, medium = CAMEL_MEDIUM (message); /* QMail will refuse to send a message if it finds one of - it's Delivered-To headers in the message, so remove all - Delivered-To headers. Fixes bug #23635. */ + * it's Delivered-To headers in the message, so remove all + * Delivered-To headers. Fixes bug #23635. */ while (camel_medium_get_header (medium, "Delivered-To")) camel_medium_remove_header (medium, "Delivered-To"); @@ -2204,7 +2210,7 @@ reply_get_composer (EShell *shell, store_url = camel_url_to_string ( url, CAMEL_URL_HIDE_ALL); if (store_url[strlen (store_url) - 1] == '/') - store_url[strlen (store_url)-1] = '\0'; + store_url[strlen (store_url) - 1] = '\0'; } post = camel_address_encode ((CamelAddress *) postto); @@ -2245,7 +2251,8 @@ reply_get_composer (EShell *shell, } static gboolean -get_reply_list (CamelMimeMessage *message, CamelInternetAddress *to) +get_reply_list (CamelMimeMessage *message, + CamelInternetAddress *to) { const gchar *header, *p; gchar *addr; @@ -2571,7 +2578,9 @@ typedef void (*AttribFormatter) (GString *str, CamelMimeMessage *message); static void -format_sender (GString *str, const gchar *attr, CamelMimeMessage *message) +format_sender (GString *str, + const gchar *attr, + CamelMimeMessage *message) { CamelInternetAddress *sender; const gchar *name, *addr = NULL; @@ -2821,8 +2830,8 @@ composer_set_body (EMsgComposer *composer, const gchar *key; /* If we are placing signature on top, then move cursor to the end, - otherwise try to find the signature place and place cursor just - before the signature. We added there an empty line already. */ + * otherwise try to find the signature place and place cursor just + * before the signature. We added there an empty line already. */ gtkhtml_editor_run_command (editor, "block-selection"); gtkhtml_editor_run_command (editor, "cursor-bod"); @@ -2844,7 +2853,8 @@ composer_set_body (EMsgComposer *composer, } gchar * -em_utils_construct_composer_text (CamelMimeMessage *message, EMFormat *source) +em_utils_construct_composer_text (CamelMimeMessage *message, + EMFormat *source) { gchar *text, *credits; gboolean start_bottom = 0; @@ -2882,7 +2892,7 @@ em_utils_reply_to_message (EShell *shell, EMailReplyType type, EMailReplyStyle style, EMFormat *source_formatter, - CamelInternetAddress *address) + CamelInternetAddress *address) { CamelInternetAddress *to, *cc; CamelNNTPAddress *postto = NULL; diff --git a/mail/em-config.c b/mail/em-config.c index 464c9d814b..c9bcf0a7a4 100644 --- a/mail/em-config.c +++ b/mail/em-config.c @@ -45,7 +45,9 @@ struct _EMConfigPrivate { }; static void -emp_account_changed (struct _EAccount *ea, gint id, EMConfig *emc) +emp_account_changed (EAccount *ea, + gint id, + EMConfig *emc) { e_config_target_changed ((EConfig *) emc, E_CONFIG_TARGET_CHANGED_STATE); } @@ -86,7 +88,8 @@ em_config_set_target (EConfig *ep, s->modified_account, "changed", G_CALLBACK (emp_account_changed), ep); - em_config_target_new_account_update_settings (ep, s, s->settings); + em_config_target_new_account_update_settings ( + ep, s, s->settings); break; } } } @@ -239,7 +242,9 @@ em_config_target_new_account (EMConfig *emp, } void -em_config_target_new_account_update_settings (EConfig *ep, EMConfigTargetAccount *target, CamelSettings *settings) +em_config_target_new_account_update_settings (EConfig *ep, + EMConfigTargetAccount *target, + CamelSettings *settings) { g_return_if_fail (ep != NULL); g_return_if_fail (target != NULL); @@ -248,7 +253,8 @@ em_config_target_new_account_update_settings (EConfig *ep, EMConfigTargetAccount g_object_ref (settings); if (target->settings != NULL) { - g_signal_handlers_disconnect_by_func (target->settings, G_CALLBACK (emp_account_changed), ep); + g_signal_handlers_disconnect_by_func ( + target->settings, emp_account_changed, ep); g_object_unref (target->settings); } diff --git a/mail/em-event.c b/mail/em-event.c index 3fb3176aab..7a99618727 100644 --- a/mail/em-event.c +++ b/mail/em-event.c @@ -35,7 +35,8 @@ static EMEvent *em_event; G_DEFINE_TYPE (EMEvent, em_event, E_TYPE_EVENT) static void -eme_target_free (EEvent *ep, EEventTarget *t) +eme_target_free (EEvent *ep, + EEventTarget *t) { switch (t->type) { case EM_EVENT_TARGET_FOLDER: { diff --git a/mail/em-filter-editor.c b/mail/em-filter-editor.c index 1efdca622a..b92e202b96 100644 --- a/mail/em-filter-editor.c +++ b/mail/em-filter-editor.c @@ -139,7 +139,8 @@ free_sources (gpointer data) } static void -select_source (GtkComboBox *combobox, EMFilterEditor *fe) +select_source (GtkComboBox *combobox, + EMFilterEditor *fe) { gchar *source; gint idx; diff --git a/mail/em-filter-rule.c b/mail/em-filter-rule.c index 7fec5abccd..6cd287b0ea 100644 --- a/mail/em-filter-rule.c +++ b/mail/em-filter-rule.c @@ -45,7 +45,7 @@ static GtkWidget *get_widget (EFilterRule *fr, ERuleContext *rc); static void em_filter_rule_class_init (EMFilterRuleClass *klass); static void em_filter_rule_init (EMFilterRule *ff); -static void em_filter_rule_finalise (GObject *obj); +static void em_filter_rule_finalize (GObject *obj); static EFilterRuleClass *parent_class = NULL; @@ -81,7 +81,7 @@ em_filter_rule_class_init (EMFilterRuleClass *klass) parent_class = g_type_class_ref (E_TYPE_FILTER_RULE); - object_class->finalize = em_filter_rule_finalise; + object_class->finalize = em_filter_rule_finalize; /* override methods */ fr_class->validate = validate; @@ -109,7 +109,7 @@ unref_list (GList *l) } static void -em_filter_rule_finalise (GObject *obj) +em_filter_rule_finalize (GObject *obj) { EMFilterRule *ff =(EMFilterRule *) obj; @@ -133,7 +133,8 @@ em_filter_rule_new (void) } void -em_filter_rule_add_action (EMFilterRule *fr, EFilterPart *fp) +em_filter_rule_add_action (EMFilterRule *fr, + EFilterPart *fp) { fr->actions = g_list_append (fr->actions, fp); @@ -141,7 +142,8 @@ em_filter_rule_add_action (EMFilterRule *fr, EFilterPart *fp) } void -em_filter_rule_remove_action (EMFilterRule *fr, EFilterPart *fp) +em_filter_rule_remove_action (EMFilterRule *fr, + EFilterPart *fp) { fr->actions = g_list_remove (fr->actions, fp); @@ -149,7 +151,9 @@ em_filter_rule_remove_action (EMFilterRule *fr, EFilterPart *fp) } void -em_filter_rule_replace_action (EMFilterRule *fr, EFilterPart *fp, EFilterPart *new) +em_filter_rule_replace_action (EMFilterRule *fr, + EFilterPart *fp, + EFilterPart *new) { GList *l; @@ -164,7 +168,8 @@ em_filter_rule_replace_action (EMFilterRule *fr, EFilterPart *fp, EFilterPart *n } void -em_filter_rule_build_action (EMFilterRule *fr, GString *out) +em_filter_rule_build_action (EMFilterRule *fr, + GString *out) { g_string_append(out, "(begin\n"); e_filter_part_build_code_list (fr->actions, out); @@ -172,7 +177,8 @@ em_filter_rule_build_action (EMFilterRule *fr, GString *out) } static gint -validate (EFilterRule *fr, EAlert **alert) +validate (EFilterRule *fr, + EAlert **alert) { EMFilterRule *ff =(EMFilterRule *) fr; GList *parts; @@ -191,7 +197,8 @@ validate (EFilterRule *fr, EAlert **alert) } static gint -list_eq (GList *al, GList *bl) +list_eq (GList *al, + GList *bl) { gint truth = TRUE; @@ -207,7 +214,8 @@ list_eq (GList *al, GList *bl) } static gint -filter_eq (EFilterRule *fr, EFilterRule *cm) +filter_eq (EFilterRule *fr, + EFilterRule *cm) { return E_FILTER_RULE_CLASS (parent_class)->eq (fr, cm) && list_eq (((EMFilterRule *) fr)->actions,((EMFilterRule *) cm)->actions); @@ -236,7 +244,9 @@ xml_encode (EFilterRule *fr) } static void -load_set (xmlNodePtr node, EMFilterRule *ff, ERuleContext *rc) +load_set (xmlNodePtr node, + EMFilterRule *ff, + ERuleContext *rc) { xmlNodePtr work; gchar *rulename; @@ -263,7 +273,9 @@ load_set (xmlNodePtr node, EMFilterRule *ff, ERuleContext *rc) } static gint -xml_decode (EFilterRule *fr, xmlNodePtr node, ERuleContext *rc) +xml_decode (EFilterRule *fr, + xmlNodePtr node, + ERuleContext *rc) { EMFilterRule *ff =(EMFilterRule *) fr; xmlNodePtr work; @@ -285,7 +297,8 @@ xml_decode (EFilterRule *fr, xmlNodePtr node, ERuleContext *rc) } static void -rule_copy (EFilterRule *dest, EFilterRule *src) +rule_copy (EFilterRule *dest, + EFilterRule *src) { EMFilterRule *fdest, *fsrc; GList *node; @@ -324,7 +337,8 @@ struct _part_data { }; static void -part_combobox_changed (GtkComboBox *combobox, struct _part_data *data) +part_combobox_changed (GtkComboBox *combobox, + struct _part_data *data) { EFilterPart *part = NULL; EFilterPart *newpart; @@ -345,7 +359,7 @@ part_combobox_changed (GtkComboBox *combobox, struct _part_data *data) return; /* here we do a widget shuffle, throw away the old widget/rulepart, - and create another */ + * and create another */ if (data->partwidget) gtk_container_remove (GTK_CONTAINER (data->container), data->partwidget); @@ -362,7 +376,9 @@ part_combobox_changed (GtkComboBox *combobox, struct _part_data *data) } static GtkWidget * -get_rule_part_widget (EMFilterContext *f, EFilterPart *newpart, EFilterRule *fr) +get_rule_part_widget (EMFilterContext *f, + EFilterPart *newpart, + EFilterRule *fr) { EFilterPart *part = NULL; GtkWidget *combobox; @@ -416,7 +432,8 @@ struct _rule_data { }; static void -less_parts (GtkWidget *button, struct _rule_data *data) +less_parts (GtkWidget *button, + struct _rule_data *data) { EFilterPart *part; GtkWidget *rule; @@ -444,7 +461,10 @@ less_parts (GtkWidget *button, struct _rule_data *data) } static void -attach_rule (GtkWidget *rule, struct _rule_data *data, EFilterPart *part, gint row) +attach_rule (GtkWidget *rule, + struct _rule_data *data, + EFilterPart *part, + gint row) { GtkWidget *remove; @@ -454,14 +474,15 @@ attach_rule (GtkWidget *rule, struct _rule_data *data, EFilterPart *part, gint r remove = gtk_button_new_from_stock (GTK_STOCK_REMOVE); g_object_set_data((GObject *)remove, "rule", rule); /*gtk_button_set_relief(GTK_BUTTON(remove), GTK_RELIEF_NONE);*/ - g_signal_connect(remove, "clicked", G_CALLBACK(less_parts), data); + g_signal_connect (remove, "clicked", G_CALLBACK(less_parts), data); gtk_table_attach (GTK_TABLE (data->parts), remove, 1, 2, row, row + 1, 0, 0, 0, 0); gtk_widget_show (remove); } static void -do_grab_focus_cb (GtkWidget *widget, gpointer data) +do_grab_focus_cb (GtkWidget *widget, + gpointer data) { gboolean *done = (gboolean *) data; @@ -477,7 +498,8 @@ do_grab_focus_cb (GtkWidget *widget, gpointer data) } static void -more_parts (GtkWidget *button, struct _rule_data *data) +more_parts (GtkWidget *button, + struct _rule_data *data) { EFilterPart *new; @@ -519,7 +541,8 @@ more_parts (GtkWidget *button, struct _rule_data *data) } static GtkWidget * -get_widget (EFilterRule *fr, ERuleContext *rc) +get_widget (EFilterRule *fr, + ERuleContext *rc) { GtkWidget *widget, *hbox, *add, *label; GtkWidget *parts, *inframe, *w; @@ -570,7 +593,7 @@ get_widget (EFilterRule *fr, ERuleContext *rc) gtk_button_set_image ( GTK_BUTTON (add), gtk_image_new_from_stock ( GTK_STOCK_ADD, GTK_ICON_SIZE_BUTTON)); - g_signal_connect(add, "clicked", G_CALLBACK(more_parts), data); + g_signal_connect (add, "clicked", G_CALLBACK(more_parts), data); gtk_box_pack_start (GTK_BOX (hbox), add, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (inframe), hbox, FALSE, FALSE, 3); diff --git a/mail/em-folder-properties.c b/mail/em-folder-properties.c index 059ce867d7..a89abcd036 100644 --- a/mail/em-folder-properties.c +++ b/mail/em-folder-properties.c @@ -71,7 +71,9 @@ async_context_free (AsyncContext *context) } static void -emfp_free (EConfig *ec, GSList *items, gpointer data) +emfp_free (EConfig *ec, + GSList *items, + gpointer data) { g_slist_free (items); } @@ -103,7 +105,7 @@ add_numbered_row (GtkTable *table, gtk_widget_show (label); gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); gtk_table_attach ( - table, label, 1, 2, row, row+1, + table, label, 1, 2, row, row + 1, GTK_FILL | GTK_EXPAND, 0, 0, 0); g_free (str); @@ -276,7 +278,7 @@ emfp_dialog_run (AsyncContext *context) g_object_unref (client); /* - Do the calculation only for those accounts that support VTRASHes + * Do the calculation only for those accounts that support VTRASHes */ if (parent_store->flags & CAMEL_STORE_VTRASH) { if (CAMEL_IS_VTRASH_FOLDER (context->folder)) diff --git a/mail/em-folder-selector.c b/mail/em-folder-selector.c index d8acab7f5f..94f83c2b0e 100644 --- a/mail/em-folder-selector.c +++ b/mail/em-folder-selector.c @@ -212,7 +212,9 @@ em_folder_selector_init (EMFolderSelector *emfs) } static void -emfs_response (GtkWidget *dialog, gint response, EMFolderSelector *emfs) +emfs_response (GtkWidget *dialog, + gint response, + EMFolderSelector *emfs) { EMFolderTree *folder_tree; EMailBackend *backend; @@ -234,7 +236,8 @@ emfs_response (GtkWidget *dialog, gint response, EMFolderSelector *emfs) } static void -emfs_create_name_changed (GtkEntry *entry, EMFolderSelector *emfs) +emfs_create_name_changed (GtkEntry *entry, + EMFolderSelector *emfs) { EMFolderTree *folder_tree; gchar *path; @@ -386,7 +389,8 @@ em_folder_selector_new (GtkWindow *parent, } static void -emfs_create_name_activate (GtkEntry *entry, EMFolderSelector *emfs) +emfs_create_name_activate (GtkEntry *entry, + EMFolderSelector *emfs) { if (gtk_entry_get_text_length (emfs->name_entry) > 0) { EMFolderTree *folder_tree; diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c index 6c9fc55338..eb26ad5fff 100644 --- a/mail/em-folder-tree-model.c +++ b/mail/em-folder-tree-model.c @@ -856,7 +856,7 @@ folder_subscribed_cb (CamelStore *store, return; /* Get our parent folder's path. */ - dirname = g_alloca (strlen (fi->full_name)+1); + dirname = g_alloca (strlen (fi->full_name) + 1); strcpy (dirname, fi->full_name); p = strrchr (dirname, '/'); if (p == NULL) { diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 85a0acbcb1..061c3540f7 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -689,7 +689,8 @@ exit: } static gboolean -subdirs_contain_unread (GtkTreeModel *model, GtkTreeIter *root) +subdirs_contain_unread (GtkTreeModel *model, + GtkTreeIter *root) { guint unread; GtkTreeIter iter; @@ -2011,9 +2012,9 @@ struct _DragDataReceivedAsync { guint32 action; guint info; - guint move:1; - guint moved:1; - guint aborted:1; + guint move : 1; + guint moved : 1; + guint aborted : 1; }; static void @@ -2318,7 +2319,7 @@ folder_tree_drop_target (EMFolderTree *folder_tree, COL_UINT_FLAGS, &src_flags, -1); /* can't dnd onto itself or below itself - bad things happen, - no point dragging to where we were either */ + * no point dragging to where we were either */ if (gtk_tree_path_compare (path, src_path) == 0 || gtk_tree_path_is_descendant (path, src_path) || (gtk_tree_path_is_ancestor (path, src_path) @@ -2716,10 +2717,10 @@ em_folder_tree_enable_drag_and_drop (EMFolderTree *folder_tree) tree_view = GTK_TREE_VIEW (folder_tree); if (!setup) { - for (i=0; i<NUM_DRAG_TYPES; i++) + for (i = 0; i < NUM_DRAG_TYPES; i++) drag_atoms[i] = gdk_atom_intern (drag_types[i].target, FALSE); - for (i=0; i<NUM_DROP_TYPES; i++) + for (i = 0; i < NUM_DROP_TYPES; i++) drop_atoms[i] = gdk_atom_intern (drop_types[i].target, FALSE); setup = 1; @@ -2759,7 +2760,8 @@ em_folder_tree_enable_drag_and_drop (EMFolderTree *folder_tree) } void -em_folder_tree_set_excluded (EMFolderTree *folder_tree, guint32 flags) +em_folder_tree_set_excluded (EMFolderTree *folder_tree, + guint32 flags) { g_return_if_fail (EM_IS_FOLDER_TREE (folder_tree)); @@ -2798,7 +2800,7 @@ em_folder_tree_get_selected_uris (EMFolderTree *folder_tree) } rows = gtk_tree_selection_get_selected_rows (selection, &model); - for (l=rows; l; l=g_list_next (l)) { + for (l = rows; l; l = g_list_next (l)) { GtkTreeIter iter; GtkTreePath *path = l->data; @@ -2860,7 +2862,7 @@ em_folder_tree_set_selected_list (EMFolderTree *folder_tree, if (!expand_only) folder_tree_clear_selected_list (folder_tree); - for (;list;list = list->next) { + for (; list; list = list->next) { CamelStore *store; struct _selected_uri *u; const gchar *folder_uri; @@ -2911,7 +2913,8 @@ em_folder_tree_set_selected_list (EMFolderTree *folder_tree, #if 0 static void -dump_fi (CamelFolderInfo *fi, gint depth) +dump_fi (CamelFolderInfo *fi, + gint depth) { gint i; @@ -2946,7 +2949,8 @@ em_folder_tree_set_selected (EMFolderTree *folder_tree, } void -em_folder_tree_select_next_path (EMFolderTree *folder_tree, gboolean skip_read_folders) +em_folder_tree_select_next_path (EMFolderTree *folder_tree, + gboolean skip_read_folders) { GtkTreeView *tree_view; GtkTreeSelection *selection; @@ -3212,7 +3216,8 @@ em_folder_tree_get_selected (EMFolderTree *folder_tree, } gboolean -em_folder_tree_store_root_selected (EMFolderTree *folder_tree, CamelStore **out_store) +em_folder_tree_store_root_selected (EMFolderTree *folder_tree, + CamelStore **out_store) { GtkTreeView *tree_view; GtkTreeSelection *selection; @@ -3317,14 +3322,16 @@ em_folder_tree_get_selected_store (EMFolderTree *folder_tree) } void -em_folder_tree_set_skip_double_click (EMFolderTree *folder_tree, gboolean skip) +em_folder_tree_set_skip_double_click (EMFolderTree *folder_tree, + gboolean skip) { folder_tree->priv->skip_double_click = skip; } /* stores come first, then by uri */ static gint -sort_by_store_and_uri (gconstpointer name1, gconstpointer name2) +sort_by_store_and_uri (gconstpointer name1, + gconstpointer name2) { const gchar *n1 = name1, *n2 = name2; gboolean is_store1, is_store2; diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c index 346bd978a1..f693212c60 100644 --- a/mail/em-folder-utils.c +++ b/mail/em-folder-utils.c @@ -108,7 +108,8 @@ struct _EMCopyFolders { }; static gchar * -emft_copy_folders__desc (struct _EMCopyFolders *m, gint complete) +emft_copy_folders__desc (struct _EMCopyFolders *m, + gint complete) { if (m->delete) return g_strdup_printf (_("Moving folder %s"), m->frombase); @@ -132,7 +133,7 @@ emft_copy_folders__exec (struct _EMCopyFolders *m, CAMEL_STORE_FOLDER_INFO_SUBSCRIBED; /* If we're copying, then we need to copy every subfolder. If we're - *moving*, though, then we only need to rename the top-level folder */ + * *moving*, though, then we only need to rename the top-level folder */ if (!m->delete) flags |= CAMEL_STORE_FOLDER_INFO_RECURSIVE; @@ -164,8 +165,8 @@ emft_copy_folders__exec (struct _EMCopyFolders *m, gint deleted = 0; /* We still get immediate children even without the - CAMEL_STORE_FOLDER_INFO_RECURSIVE flag. But we only - want to process the children too if we're *copying* */ + * CAMEL_STORE_FOLDER_INFO_RECURSIVE flag. But we only + * want to process the children too if we're *copying * */ if (info->child && !m->delete) pending = g_list_append (pending, info->child); @@ -260,8 +261,8 @@ emft_copy_folders__exec (struct _EMCopyFolders *m, d(printf ("deleting folder '%s'\n", info->full_name)); /* FIXME: we need to do something with the exception - since otherwise the users sees a failed operation - with no error message or even any warnings */ + * since otherwise the users sees a failed operation + * with no error message or even any warnings */ if (CAMEL_IS_SUBSCRIBABLE (m->fromstore)) camel_subscribable_unsubscribe_folder_sync ( CAMEL_SUBSCRIBABLE (m->fromstore), diff --git a/mail/em-format-hook.c b/mail/em-format-hook.c index f49c370a6e..51608ca07d 100644 --- a/mail/em-format-hook.c +++ b/mail/em-format-hook.c @@ -39,15 +39,14 @@ static GHashTable *emfh_types; /* Mail formatter handler plugin */ /* - <hook class="org.gnome.evolution.mail.format:1.0"> - <group id="EMFormatHTML"> - <item flags="inline,inline_disposition" - mime_type="text/vcard" - format="format_vcard"/> - </group> - </hook> - -*/ + * <hook class="org.gnome.evolution.mail.format:1.0"> + * <group id="EMFormatHTML"> + * <item flags="inline,inline_disposition" + * mime_type="text/vcard" + * format="format_vcard"/> + * </group> + * </hook> + */ static gpointer emfh_parent_class; #define emfh ((EMFormatHook *)eph) @@ -103,7 +102,9 @@ emfh_free_group (struct _EMFormatHookGroup *group) } static struct _EMFormatHookItem * -emfh_construct_item (EPluginHook *eph, EMFormatHookGroup *group, xmlNodePtr root) +emfh_construct_item (EPluginHook *eph, + EMFormatHookGroup *group, + xmlNodePtr root) { struct _EMFormatHookItem *item; @@ -130,7 +131,8 @@ error: } static struct _EMFormatHookGroup * -emfh_construct_group (EPluginHook *eph, xmlNodePtr root) +emfh_construct_group (EPluginHook *eph, + xmlNodePtr root) { struct _EMFormatHookGroup *group; xmlNodePtr node; @@ -161,7 +163,9 @@ error: } static gint -emfh_construct (EPluginHook *eph, EPlugin *ep, xmlNodePtr root) +emfh_construct (EPluginHook *eph, + EPlugin *ep, + xmlNodePtr root) { xmlNodePtr node; @@ -183,7 +187,7 @@ emfh_construct (EPluginHook *eph, EPlugin *ep, xmlNodePtr root) && (klass = g_hash_table_lookup (emfh_types, group->id))) { GSList *l = group->items; - for (;l;l=g_slist_next (l)) { + for (; l; l = g_slist_next (l)) { EMFormatHookItem *item = l->data; /* TODO: only add handlers if enabled? */ /* Well, disabling is handled by the callback, @@ -209,7 +213,8 @@ emfh_construct (EPluginHook *eph, EPlugin *ep, xmlNodePtr root) } static void -emfh_enable (EPluginHook *eph, gint state) +emfh_enable (EPluginHook *eph, + gint state) { GSList *g, *l; EMFormatClass *klass; @@ -218,11 +223,11 @@ emfh_enable (EPluginHook *eph, gint state) if (emfh_types == NULL) return; - for (;g;g=g_slist_next (g)) { + for (; g; g = g_slist_next (g)) { struct _EMFormatHookGroup *group = g->data; klass = g_hash_table_lookup (emfh_types, group->id); - for (l=group->items;l;l=g_slist_next (l)) { + for (l = group->items; l; l = g_slist_next (l)) { EMFormatHookItem *item = l->data; if (state) @@ -234,7 +239,7 @@ emfh_enable (EPluginHook *eph, gint state) } static void -emfh_finalise (GObject *o) +emfh_finalize (GObject *o) { EPluginHook *eph = (EPluginHook *) o; @@ -247,7 +252,7 @@ emfh_finalise (GObject *o) static void emfh_class_init (EPluginHookClass *klass) { - ((GObjectClass *) klass)->finalize = emfh_finalise; + ((GObjectClass *) klass)->finalize = emfh_finalize; klass->construct = emfh_construct; klass->enable = emfh_enable; klass->id = "org.gnome.evolution.mail.format:1.0"; diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c index 65fa9e522f..dcaafed57d 100644 --- a/mail/em-format-html-display.c +++ b/mail/em-format-html-display.c @@ -124,7 +124,7 @@ struct _attach_puri { GtkWidget *forward, *down; /* currently no way to correlate this data to the frame :( */ GtkHTML *frame; - guint shown:1; + guint shown : 1; /* Embedded Frame */ GtkHTMLEmbedded *html; @@ -193,7 +193,7 @@ efhd_xpkcs7mime_viewcert_clicked (GtkWidget *button, /* oddly enough certificate_viewer_show doesn't ... */ gtk_widget_show (w); - g_signal_connect(w, "response", G_CALLBACK(gtk_widget_destroy), NULL); + g_signal_connect (w, "response", G_CALLBACK(gtk_widget_destroy), NULL); if (w && po->widget) gtk_window_set_transient_for ((GtkWindow *) w, (GtkWindow *) po->widget); @@ -236,12 +236,12 @@ efhd_xpkcs7mime_add_cert_table (GtkWidget *vbox, w = gtk_label_new (l); gtk_misc_set_alignment ((GtkMisc *) w, 0.0, 0.5); g_free (la); - gtk_table_attach (table, w, 0, 1, n, n+1, GTK_FILL, GTK_FILL, 3, 3); + gtk_table_attach (table, w, 0, 1, n, n + 1, GTK_FILL, GTK_FILL, 3, 3); #if defined (HAVE_NSS) && defined (ENABLE_SMIME) w = gtk_button_new_with_mnemonic(_("_View Certificate")); - gtk_table_attach (table, w, 1, 2, n, n+1, 0, 0, 3, 3); + gtk_table_attach (table, w, 1, 2, n, n + 1, 0, 0, 3, 3); g_object_set_data((GObject *)w, "e-cert-info", info); - g_signal_connect(w, "clicked", G_CALLBACK(efhd_xpkcs7mime_viewcert_clicked), po); + g_signal_connect (w, "clicked", G_CALLBACK(efhd_xpkcs7mime_viewcert_clicked), po); if (info->cert_data) ec = e_cert_new (CERT_DupCertificate (info->cert_data)); @@ -252,7 +252,7 @@ efhd_xpkcs7mime_add_cert_table (GtkWidget *vbox, g_object_unref (ec); #else w = gtk_label_new (_("This certificate is not viewable")); - gtk_table_attach (table, w, 1, 2, n, n+1, 0, 0, 3, 3); + gtk_table_attach (table, w, 1, 2, n, n + 1, 0, 0, 3, 3); #endif n++; } @@ -346,7 +346,7 @@ efhd_xpkcs7mime_validity_clicked (GtkWidget *button, g_object_unref (builder); - g_signal_connect(po->widget, "response", G_CALLBACK(efhd_xpkcs7mime_info_response), po); + g_signal_connect (po->widget, "response", G_CALLBACK(efhd_xpkcs7mime_info_response), po); gtk_widget_show (po->widget); } @@ -386,25 +386,35 @@ efhd_xpkcs7mime_button (EMFormatHTML *efh, } static gboolean -remove_attachment_view_cb (gpointer message_part_id, gpointer attachment_view, gpointer gone_attachment_view) +remove_attachment_view_cb (gpointer message_part_id, + gpointer attachment_view, + gpointer gone_attachment_view) { return attachment_view == gone_attachment_view; } static void -efhd_attachment_view_gone_cb (gpointer efh, GObject *gone_attachment_view) +efhd_attachment_view_gone_cb (gpointer efh, + GObject *gone_attachment_view) { EMFormatHTMLDisplay *efhd = EM_FORMAT_HTML_DISPLAY (efh); g_return_if_fail (efhd != NULL); - g_hash_table_foreach_remove (efhd->priv->attachment_views, remove_attachment_view_cb, gone_attachment_view); + g_hash_table_foreach_remove ( + efhd->priv->attachment_views, + remove_attachment_view_cb, + gone_attachment_view); } static void -weak_unref_attachment_view_cb (gpointer message_part_id, gpointer attachment_view, gpointer efh) +weak_unref_attachment_view_cb (gpointer message_part_id, + gpointer attachment_view, + gpointer efh) { - g_object_weak_unref (G_OBJECT (attachment_view), efhd_attachment_view_gone_cb, efh); + g_object_weak_unref ( + G_OBJECT (attachment_view), + efhd_attachment_view_gone_cb, efh); } static void @@ -1106,7 +1116,9 @@ attachment_button_realized (GtkWidget *widget) /* attachment button callback */ static gboolean -efhd_attachment_button (EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject) +efhd_attachment_button (EMFormatHTML *efh, + GtkHTMLEmbedded *eb, + EMFormatHTMLPObject *pobject) { EMFormatHTMLDisplay *efhd = (EMFormatHTMLDisplay *) efh; struct _attach_puri *info; @@ -1134,7 +1146,7 @@ efhd_attachment_button (EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObj size = ci->size; /* what if its not encoded in base64 ? is it a case to consider? */ if (ci->encoding && !g_ascii_strcasecmp (ci->encoding, "base64")) - size = size/1.37; + size = size / 1.37; } camel_message_info_free (mi); } @@ -1222,7 +1234,9 @@ efhd_attachment_frame (EMFormat *emf, } static void -set_size_request_cb (gpointer message_part_id, gpointer widget, gpointer width) +set_size_request_cb (gpointer message_part_id, + gpointer widget, + gpointer width) { gtk_widget_set_size_request (widget, GPOINTER_TO_INT (width), -1); } @@ -1311,7 +1325,8 @@ efhd_message_add_bar (EMFormat *emf, } static void -efhd_optional_button_show (GtkWidget *widget, GtkWidget *w) +efhd_optional_button_show (GtkWidget *widget, + GtkWidget *w) { GtkWidget *label = g_object_get_data (G_OBJECT (widget), "text-label"); @@ -1325,7 +1340,9 @@ efhd_optional_button_show (GtkWidget *widget, GtkWidget *w) } static void -efhd_resize (GtkWidget *w, GtkAllocation *event, EMFormatHTML *efh) +efhd_resize (GtkWidget *w, + GtkAllocation *event, + EMFormatHTML *efh) { EWebView *web_view; GtkAllocation allocation; @@ -1337,7 +1354,9 @@ efhd_resize (GtkWidget *w, GtkAllocation *event, EMFormatHTML *efh) /* optional render attachment button callback */ static gboolean -efhd_attachment_optional (EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject) +efhd_attachment_optional (EMFormatHTML *efh, + GtkHTMLEmbedded *eb, + EMFormatHTMLPObject *pobject) { struct _attach_puri *info; GtkWidget *hbox, *vbox, *button, *mainbox, *scroll, *label, *img; @@ -1371,7 +1390,9 @@ efhd_attachment_optional (EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPO gtk_widget_show_all (hbox); gtk_container_add (GTK_CONTAINER (button), GTK_WIDGET (hbox)); if (info->handle) - g_signal_connect(G_OBJECT (button), "clicked", G_CALLBACK(efhd_optional_button_show), scroll); + g_signal_connect ( + button, "clicked", + G_CALLBACK (efhd_optional_button_show), scroll); else { gtk_widget_set_sensitive (button, FALSE); gtk_widget_set_can_focus (button, FALSE); @@ -1450,7 +1471,8 @@ efhd_free_attach_puri_data (EMFormatPURI *puri) /* returned object owned by html_display, thus do not unref it */ EAttachmentView * -em_format_html_display_get_attachment_view (EMFormatHTMLDisplay *html_display, const gchar *message_part_id) +em_format_html_display_get_attachment_view (EMFormatHTMLDisplay *html_display, + const gchar *message_part_id) { gpointer aview; diff --git a/mail/em-format-html-print.c b/mail/em-format-html-print.c index e6da0c983a..dbfe011759 100644 --- a/mail/em-format-html-print.c +++ b/mail/em-format-html-print.c @@ -84,7 +84,7 @@ efhp_init (GObject *o) web_view = em_format_html_get_web_view (EM_FORMAT_HTML (efhp)); /* gtk widgets don't like to be realized outside top level widget - so we put new html widget into gtk window */ + * so we put new html widget into gtk window */ efhp->window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_container_add (GTK_CONTAINER (efhp->window), GTK_WIDGET (web_view)); gtk_widget_realize (GTK_WIDGET (web_view)); diff --git a/mail/em-format-html.c b/mail/em-format-html.c index 797f7194d9..a1be319390 100644 --- a/mail/em-format-html.c +++ b/mail/em-format-html.c @@ -262,7 +262,7 @@ efh_format_exec (struct _format_msg *m, if (m->estream) { /* Closing this base stream can queue more jobs, so we need - to check the list again after we've finished */ + * to check the list again after we've finished */ d(printf("out of jobs, closing root stream\n")); camel_stream_write_string ( (CamelStream *) m->estream, @@ -413,7 +413,8 @@ efh_free_cache (struct _EMFormatHTMLCache *efhc) } static void -efh_gtkhtml_destroy (GtkHTML *html, EMFormatHTML *efh) +efh_gtkhtml_destroy (GtkHTML *html, + EMFormatHTML *efh) { if (efh->priv->format_timeout_id != 0) { g_source_remove (efh->priv->format_timeout_id); @@ -433,7 +434,8 @@ efh_gtkhtml_destroy (GtkHTML *html, EMFormatHTML *efh) } static struct _EMFormatHTMLCache * -efh_insert_cache (EMFormatHTML *efh, const gchar *partid) +efh_insert_cache (EMFormatHTML *efh, + const gchar *partid) { struct _EMFormatHTMLCache *efhc; @@ -994,14 +996,14 @@ efh_class_init (EMFormatHTMLClass *class) user_cache_dir = e_get_user_cache_dir (); emfh_http_cache = camel_data_cache_new (user_cache_dir, NULL); if (emfh_http_cache) { - camel_data_cache_set_expire_age (emfh_http_cache, 24*60*60); - camel_data_cache_set_expire_access (emfh_http_cache, 2*60*60); + camel_data_cache_set_expire_age (emfh_http_cache, 24 *60 *60); + camel_data_cache_set_expire_access (emfh_http_cache, 2 *60 *60); } } static void efh_init (EMFormatHTML *efh, - EMFormatHTMLClass *class) + EMFormatHTMLClass *class) { EWebView *web_view; GdkColor *color; @@ -1303,7 +1305,7 @@ em_format_html_get_headers_state (EMFormatHTML *efh) void em_format_html_set_headers_state (EMFormatHTML *efh, - EMFormatHTMLHeadersState state) + EMFormatHTMLHeadersState state) { g_return_if_fail (EM_IS_FORMAT_HTML (efh)); @@ -1322,7 +1324,7 @@ em_format_html_get_headers_collapsable (EMFormatHTML *efh) void em_format_html_set_headers_collapsable (EMFormatHTML *efh, - gboolean collapsable) + gboolean collapsable) { g_return_if_fail (EM_IS_FORMAT_HTML (efh)); @@ -1365,7 +1367,11 @@ em_format_html_file_part (EMFormatHTML *efh, /* all this api is a pain in the bum ... */ EMFormatHTMLPObject * -em_format_html_add_pobject (EMFormatHTML *efh, gsize size, const gchar *classid, CamelMimePart *part, EMFormatHTMLPObjectFunc func) +em_format_html_add_pobject (EMFormatHTML *efh, + gsize size, + const gchar *classid, + CamelMimePart *part, + EMFormatHTMLPObjectFunc func) { EMFormatHTMLPObject *pobj; @@ -1466,7 +1472,8 @@ em_format_html_clear_pobject (EMFormatHTML *emf) struct _EMFormatHTMLJob * em_format_html_job_new (EMFormatHTML *emfh, - void (*callback) (struct _EMFormatHTMLJob *job, GCancellable *cancellable), + void (*callback) (struct _EMFormatHTMLJob *job, + GCancellable *cancellable), gpointer data) { struct _EMFormatHTMLJob *job = g_malloc0 (sizeof (*job)); @@ -1482,7 +1489,8 @@ em_format_html_job_new (EMFormatHTML *emfh, } void -em_format_html_job_queue (EMFormatHTML *emfh, struct _EMFormatHTMLJob *job) +em_format_html_job_queue (EMFormatHTML *emfh, + struct _EMFormatHTMLJob *job) { g_mutex_lock (emfh->priv->lock); g_queue_push_tail (&emfh->priv->pending_jobs, job); @@ -1533,9 +1541,12 @@ emfh_gethttp (struct _EMFormatHTMLJob *job, || policy == E_MAIL_IMAGE_LOADING_POLICY_ALWAYS || (policy == E_MAIL_IMAGE_LOADING_POLICY_SOMETIMES && em_utils_in_addressbook ((CamelInternetAddress *) camel_mime_message_get_from (job->format->parent.message), FALSE)))) { - /* TODO: Ideally we would put the http requests into another queue and only send them out - if the user selects 'load images', when they do. The problem is how to maintain this - state with multiple renderings, and how to adjust the thread dispatch/setup routine to handle it */ + /* TODO: Ideally we would put the http requests into + * another queue and only send them out if the user + * selects 'load images', when they do. The problem + * is how to maintain this state with multiple + * renderings, and how to adjust the thread + * dispatch/setup routine to handle it */ camel_url_free (url); goto done; } @@ -1590,7 +1601,7 @@ emfh_gethttp (struct _EMFormatHTMLJob *job, camel_stream_write (job->stream, buffer, n, cancellable, NULL); } - } while (n>0); + } while (n > 0); /* indicates success */ if (n == 0) @@ -1613,7 +1624,10 @@ badurl: /* ********************************************************************** */ static void -efh_url_requested (GtkHTML *html, const gchar *url, GtkHTMLStream *handle, EMFormatHTML *efh) +efh_url_requested (GtkHTML *html, + const gchar *url, + GtkHTMLStream *handle, + EMFormatHTML *efh) { EMFormatPURI *puri; struct _EMFormatHTMLJob *job = NULL; @@ -1623,14 +1637,14 @@ efh_url_requested (GtkHTML *html, const gchar *url, GtkHTMLStream *handle, EMFor puri = em_format_find_visible_puri ((EMFormat *) efh, url); if (puri) { CamelDataWrapper *dw = camel_medium_get_content ((CamelMedium *) puri->part); - CamelContentType *ct = dw?dw->mime_type:NULL; + CamelContentType *ct = dw ? dw->mime_type : NULL; /* GtkHTML only handles text and images. - application/octet-stream parts are the only ones - which are snooped for other content. So only try - to pass these to it - any other types are badly - formed or intentionally malicious emails. They - will still show as attachments anyway */ + * application/octet-stream parts are the only ones + * which are snooped for other content. So only try + * to pass these to it - any other types are badly + * formed or intentionally malicious emails. They + * will still show as attachments anyway */ if (ct && (camel_content_type_is(ct, "text", "*") || camel_content_type_is(ct, "image", "*") @@ -1676,7 +1690,9 @@ efh_url_requested (GtkHTML *html, const gchar *url, GtkHTMLStream *handle, EMFor } static gboolean -efh_object_requested (GtkHTML *html, GtkHTMLEmbedded *eb, EMFormatHTML *efh) +efh_object_requested (GtkHTML *html, + GtkHTMLEmbedded *eb, + EMFormatHTML *efh) { EMFormatHTMLPObject *pobject; gint res = FALSE; @@ -1725,7 +1741,7 @@ static const gchar *smime_sign_colour[4] = { }; /* TODO: this could probably be virtual on em-format-html - then we only need one version of each type handler */ + * then we only need one version of each type handler */ static void efh_format_secure (EMFormat *emf, CamelStream *stream, @@ -1740,9 +1756,9 @@ efh_format_secure (EMFormat *emf, format_class->format_secure (emf, stream, part, valid, cancellable); /* To explain, if the validity is the same, then we are the - base validity and now have a combined sign/encrypt validity - we can display. Primarily a new verification context is - created when we have an embeded message. */ + * base validity and now have a combined sign/encrypt validity + * we can display. Primarily a new verification context is + * created when we have an embeded message. */ if (emf->valid == valid && (valid->encrypt.status != CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE || valid->sign.status != CAMEL_CIPHER_VALIDITY_SIGN_NONE)) { @@ -1844,15 +1860,15 @@ efh_text_plain (EMFormat *emf, flags |= CAMEL_MIME_FILTER_TOHTML_FORMAT_FLOWED; /* This scans the text part for inline-encoded data, creates - a multipart of all the parts inside it. */ + * a multipart of all the parts inside it. */ /* FIXME: We should discard this multipart if it only contains - the original text, but it makes this hash lookup more complex */ + * the original text, but it makes this hash lookup more complex */ /* TODO: We could probably put this in the superclass, since - no knowledge of html is required - but this messes with - filters a bit. Perhaps the superclass should just deal with - html anyway and be done with it ... */ + * no knowledge of html is required - but this messes with + * filters a bit. Perhaps the superclass should just deal with + * html anyway and be done with it ... */ efhc = g_hash_table_lookup ( efh->priv->text_inline_parts, @@ -1914,7 +1930,7 @@ efh_text_plain (EMFormat *emf, len = emf->part_id->len; count = camel_multipart_get_number (mp); - for (i=0;i<count;i++) { + for (i = 0; i < count; i++) { CamelMimePart *newpart = camel_multipart_get_part (mp, i); if (!newpart) @@ -2068,9 +2084,9 @@ efh_text_html (EMFormat *emf, /* TODO: perhaps we don't need to calculate this anymore now base is handled better */ /* calculate our own location string so add_puri doesn't do it - for us. our iframes are special cases, we need to use the - proper base url to access them, but other children parts - shouldn't blindly inherit the container's location. */ + * for us. our iframes are special cases, we need to use the + * proper base url to access them, but other children parts + * shouldn't blindly inherit the container's location. */ location = camel_mime_part_get_content_location (part); if (location == NULL) { if (emf->base) @@ -2187,7 +2203,7 @@ efh_message_external (EMFormat *emf, s = d = url; while (*s) { /* FIXME: use camel_isspace */ - if (!isspace ((guchar)*s)) + if (!isspace ((guchar) * s)) *d++ = *s; s++; } @@ -2341,7 +2357,7 @@ efh_multipart_related (EMFormat *emf, nparts = camel_multipart_get_number (mp); content_type = camel_mime_part_get_content_type (part); start = camel_content_type_param (content_type, "start"); - if (start && strlen (start)>2) { + if (start && strlen (start) > 2) { gint len; const gchar *cid; @@ -2349,7 +2365,7 @@ efh_multipart_related (EMFormat *emf, len = strlen (start) - 2; start++; - for (i=0; i<nparts; i++) { + for (i = 0; i < nparts; i++) { body_part = camel_multipart_get_part (mp, i); cid = camel_mime_part_get_content_id (body_part); @@ -2469,8 +2485,8 @@ static EMFormatHandler type_builtin_table[] = { { (gchar *) "multipart/related", efh_multipart_related }, /* This is where one adds those busted, non-registered types, - that some idiot mailer writers out there decide to pull out - of their proverbials at random. */ + * that some idiot mailer writers out there decide to pull out + * of their proverbials at random. */ { (gchar *) "image/jpg", efh_image }, { (gchar *) "image/pjpeg", efh_image }, @@ -2560,11 +2576,14 @@ static const gchar *addrspec_hdrs[] = { }; static gchar * -efh_format_address (EMFormatHTML *efh, GString *out, struct _camel_header_address *a, gchar *field) +efh_format_address (EMFormatHTML *efh, + GString *out, + struct _camel_header_address *a, + gchar *field) { guint32 flags = CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES; gchar *name, *mailto, *addr; - gint i=0; + gint i = 0; gboolean wrap = FALSE; gchar *str = NULL; gint limit = mail_config_get_address_count (); @@ -2632,7 +2651,7 @@ efh_format_address (EMFormatHTML *efh, GString *out, struct _camel_header_addres g_string_append (out, ", "); /* Let us add a '...' if we have more addresses */ - if (limit > 0 && wrap && a && (i>(limit-1))) { + if (limit > 0 && wrap && a && (i > (limit - 1))) { gchar *evolution_imagesdir = g_filename_to_uri (EVOLUTION_IMAGESDIR, NULL, NULL); if (!strcmp (field, _("To"))) { @@ -2656,7 +2675,7 @@ efh_format_address (EMFormatHTML *efh, GString *out, struct _camel_header_addres } - if (limit > 0 && i>(limit)) { + if (limit > 0 && i > (limit)) { gchar *evolution_imagesdir = g_filename_to_uri (EVOLUTION_IMAGESDIR, NULL, NULL); if (!strcmp (field, _("To"))) { @@ -2715,7 +2734,7 @@ efh_format_header (EMFormat *emf, gchar *str_field = NULL; gint i; - name = g_alloca (strlen (header->name)+1); + name = g_alloca (strlen (header->name) + 1); strcpy (name, header->name); canon_header_name (name); @@ -2802,8 +2821,8 @@ efh_format_header (EMFormat *emf, if (hide_real_date) { /* Show only the local-formatted date, losing all timezone - information like Outlook does. Should we attempt to show - it somehow? */ + * information like Outlook does. Should we attempt to show + * it somehow? */ txt = value = date_str; } else { txt = value = g_strdup_printf ("%s (<I>%s</I>)", html, date_str); @@ -2838,7 +2857,7 @@ efh_format_header (EMFormat *emf, txt = html->str; g_string_free (html, FALSE); - flags |= EM_FORMAT_HEADER_BOLD|EM_FORMAT_HTML_HEADER_HTML; + flags |= EM_FORMAT_HEADER_BOLD | EM_FORMAT_HTML_HEADER_HTML; } else if (!strcmp (name, "Received") || !strncmp (name, "X-", 2)) { /* don't unfold Received nor extension headers */ txt = value = camel_header_decode_string (header->value, charset); @@ -3331,7 +3350,8 @@ em_format_html_format_cert_infos (CamelCipherCertInfo *first_cinfo) /* unref returned pointer with g_object_unref(), if not NULL */ CamelStream * -em_format_html_get_cached_image (EMFormatHTML *efh, const gchar *image_uri) +em_format_html_get_cached_image (EMFormatHTML *efh, + const gchar *image_uri) { g_return_val_if_fail (efh != NULL, NULL); g_return_val_if_fail (image_uri != NULL, NULL); diff --git a/mail/em-format-html.h b/mail/em-format-html.h index d544201df0..ab66504cec 100644 --- a/mail/em-format-html.h +++ b/mail/em-format-html.h @@ -59,9 +59,9 @@ typedef struct _EMFormatHTMLClass EMFormatHTMLClass; typedef struct _EMFormatHTMLPrivate EMFormatHTMLPrivate; enum _em_format_html_header_flags { - EM_FORMAT_HTML_HEADER_TO = 1<<0, - EM_FORMAT_HTML_HEADER_CC = 1<<1, - EM_FORMAT_HTML_HEADER_BCC = 1<<2 + EM_FORMAT_HTML_HEADER_TO = 1 << 0, + EM_FORMAT_HTML_HEADER_CC = 1 << 1, + EM_FORMAT_HTML_HEADER_BCC = 1 << 2 }; typedef enum { @@ -85,8 +85,8 @@ typedef enum { } EMFormatHTMLColorType; /* A HTMLJob will be executed in another thread, in sequence. - It's job is to write to its stream, close it if successful, - then exit. */ + * It's job is to write to its stream, close it if successful, + * then exit. */ typedef struct _EMFormatHTMLJob EMFormatHTMLJob; @@ -119,7 +119,7 @@ struct _EMFormatHTMLJob { CamelStream *stream; /* We need to track the state of the visibility tree at - the point this uri was generated */ + * the point this uri was generated */ GNode *puri_level; CamelURL *base; diff --git a/mail/em-html-stream.c b/mail/em-html-stream.c index ccc9f82eba..a633946541 100644 --- a/mail/em-html-stream.c +++ b/mail/em-html-stream.c @@ -63,7 +63,7 @@ html_stream_dispose (GObject *object) EMHTMLStream *emhs = EM_HTML_STREAM (object); if (emhs->html_stream) { - /* set 'in finalise' flag */ + /* set 'in finalize' flag */ camel_stream_close (CAMEL_STREAM (emhs), NULL, NULL); } } @@ -150,7 +150,7 @@ em_html_stream_init (EMHTMLStream *emhs) } /* TODO: Could pass NULL for html_stream, and do a gtk_html_begin - on first data -> less flashing */ + * on first data -> less flashing */ CamelStream * em_html_stream_new (GtkHTML *html, GtkHTMLStream *html_stream) @@ -173,7 +173,8 @@ em_html_stream_new (GtkHTML *html, } void -em_html_stream_set_flags (EMHTMLStream *emhs, GtkHTMLBeginFlags flags) +em_html_stream_set_flags (EMHTMLStream *emhs, + GtkHTMLBeginFlags flags) { g_return_if_fail (EM_IS_HTML_STREAM (emhs)); diff --git a/mail/em-subscription-editor.c b/mail/em-subscription-editor.c index baaeb34b3b..e2452d70bf 100644 --- a/mail/em-subscription-editor.c +++ b/mail/em-subscription-editor.c @@ -147,7 +147,7 @@ static void subscription_editor_populate (EMSubscriptionEditor *editor, CamelFolderInfo *folder_info, GtkTreeIter *parent, - GSList **expand_paths) + GSList **expand_paths) { GtkListStore *list_store; GtkTreeStore *tree_store; @@ -202,7 +202,8 @@ subscription_editor_populate (EMSubscriptionEditor *editor, } static void -expand_paths_cb (gpointer path, gpointer tree_view) +expand_paths_cb (gpointer path, + gpointer tree_view) { gtk_tree_view_expand_to_path (tree_view, path); } diff --git a/mail/em-sync-stream.c b/mail/em-sync-stream.c index 9c52cd703b..06f96ecd83 100644 --- a/mail/em-sync-stream.c +++ b/mail/em-sync-stream.c @@ -234,7 +234,8 @@ em_sync_stream_init (EMSyncStream *emss) } void -em_sync_stream_set_buffer_size (EMSyncStream *emss, gsize size) +em_sync_stream_set_buffer_size (EMSyncStream *emss, + gsize size) { if (emss->buffer != NULL) g_string_free (emss->buffer, TRUE); diff --git a/mail/em-utils.c b/mail/em-utils.c index 3b42e9b200..968165385a 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -249,7 +249,9 @@ em_utils_check_user_can_send_mail (void) static GtkWidget *filter_editor = NULL; static void -em_filter_editor_response (GtkWidget *dialog, gint button, gpointer user_data) +em_filter_editor_response (GtkWidget *dialog, + gint button, + gpointer user_data) { EMFilterContext *fc; @@ -366,7 +368,7 @@ em_filename_make_safe (gchar *string) * written? */ if (!g_unichar_isprint (c) || ( c < 0xff && strchr (unsafe_chars, c&0xff ))) { - while (ts<p) + while (ts < p) *ts++ = '_'; } } @@ -592,7 +594,7 @@ em_utils_write_messages_to_stream (CamelFolder *folder, CAMEL_STREAM_FILTER (filtered_stream), from_filter); g_object_unref (from_filter); - for (i=0; i<uids->len; i++) { + for (i = 0; i < uids->len; i++) { CamelMimeMessage *message; gchar *from; @@ -793,8 +795,8 @@ em_utils_selection_set_uidlist (GtkSelectionData *selection_data, g_byte_array_append ( array, (guchar *) folder_uri, strlen (folder_uri) + 1); - for (i=0; i<uids->len; i++) - g_byte_array_append (array, uids->pdata[i], strlen (uids->pdata[i])+1); + for (i = 0; i < uids->len; i++) + g_byte_array_append (array, uids->pdata[i], strlen (uids->pdata[i]) + 1); target = gtk_selection_data_get_target (selection_data); gtk_selection_data_set ( @@ -849,7 +851,7 @@ em_utils_selection_get_uidlist (GtkSelectionData *selection_data, inptr++; if (start > (gchar *) data) - g_ptr_array_add (uids, g_strndup (start, inptr-start)); + g_ptr_array_add (uids, g_strndup (start, inptr - start)); inptr++; } @@ -975,7 +977,7 @@ em_utils_selection_get_urilist (GtkSelectionData *selection_data, uris = gtk_selection_data_get_uris (selection_data); - for (i=0;res == 0 && uris[i];i++) { + for (i = 0; res == 0 && uris[i]; i++) { g_strstrip (uris[i]); if (uris[i][0] == '#') continue; @@ -1793,7 +1795,8 @@ search_address_in_addressbooks (const gchar *address, } gboolean -em_utils_in_addressbook (CamelInternetAddress *iaddr, gboolean local_only) +em_utils_in_addressbook (CamelInternetAddress *iaddr, + gboolean local_only) { const gchar *addr; @@ -1805,7 +1808,8 @@ em_utils_in_addressbook (CamelInternetAddress *iaddr, gboolean local_only) } static gboolean -extract_photo_data (EContact *contact, gpointer user_data) +extract_photo_data (EContact *contact, + gpointer user_data) { EContactPhoto **photo = user_data; @@ -1841,7 +1845,8 @@ G_LOCK_DEFINE_STATIC (photos_cache); static GSList *photos_cache = NULL; /* list of PhotoInfo-s */ CamelMimePart * -em_utils_contact_photo (CamelInternetAddress *cia, gboolean local_only) +em_utils_contact_photo (CamelInternetAddress *cia, + gboolean local_only) { const gchar *addr = NULL; CamelMimePart *part = NULL; @@ -1914,8 +1919,8 @@ em_utils_contact_photo (CamelInternetAddress *cia, gboolean local_only) return part; } -/* list of email addresses (strings) to remove from local cache of photos and contacts, - but only if the photo doesn't exist or is an not-found contact */ +/* list of email addresses (strings) to remove from local cache of photos and + * contacts, but only if the photo doesn't exist or is an not-found contact */ void emu_remove_from_mail_cache (const GSList *addresses) { diff --git a/mail/em-vfolder-rule.c b/mail/em-vfolder-rule.c index 4c3a150081..be18f2c248 100644 --- a/mail/em-vfolder-rule.c +++ b/mail/em-vfolder-rule.c @@ -236,7 +236,7 @@ em_vfolder_rule_find_source (EMVFolderRule *rule, g_return_val_if_fail (EM_IS_VFOLDER_RULE (rule), NULL); /* only does a simple string or address comparison, should - probably do a decoded url comparison */ + * probably do a decoded url comparison */ link = g_queue_find_custom ( &rule->sources, uri, (GCompareFunc) strcmp); @@ -279,7 +279,8 @@ em_vfolder_rule_next_source (EMVFolderRule *rule, } static gint -validate (EFilterRule *fr, EAlert **alert) +validate (EFilterRule *fr, + EAlert **alert) { g_return_val_if_fail (fr != NULL, 0); g_warn_if_fail (alert == NULL || *alert == NULL); @@ -291,7 +292,7 @@ validate (EFilterRule *fr, EAlert **alert) } /* We have to have at least one source set in the "specific" case. - Do not translate this string! */ + * Do not translate this string! */ if (((EMVFolderRule *) fr)->with == EM_VFOLDER_RULE_WITH_SPECIFIC && g_queue_is_empty (&((EMVFolderRule *) fr)->sources)) { if (alert) @@ -303,7 +304,8 @@ validate (EFilterRule *fr, EAlert **alert) } static gint -queue_eq (GQueue *queue_a, GQueue *queue_b) +queue_eq (GQueue *queue_a, + GQueue *queue_b) { GList *link_a; GList *link_b; @@ -326,7 +328,8 @@ queue_eq (GQueue *queue_a, GQueue *queue_b) } static gint -vfolder_eq (EFilterRule *fr, EFilterRule *cm) +vfolder_eq (EFilterRule *fr, + EFilterRule *cm) { return E_FILTER_RULE_CLASS (em_vfolder_rule_parent_class)->eq (fr, cm) && queue_eq ( @@ -362,7 +365,8 @@ xml_encode (EFilterRule *fr) } static void -set_with (EMVFolderRule *vr, const gchar *name) +set_with (EMVFolderRule *vr, + const gchar *name) { gint i; @@ -377,7 +381,9 @@ set_with (EMVFolderRule *vr, const gchar *name) } static gint -xml_decode (EFilterRule *fr, xmlNodePtr node, struct _ERuleContext *f) +xml_decode (EFilterRule *fr, + xmlNodePtr node, + ERuleContext *f) { xmlNodePtr set, work; gint result; @@ -422,7 +428,8 @@ xml_decode (EFilterRule *fr, xmlNodePtr node, struct _ERuleContext *f) } static void -rule_copy (EFilterRule *dest, EFilterRule *src) +rule_copy (EFilterRule *dest, + EFilterRule *src) { EMVFolderRule *vdest, *vsrc; GList *head, *link; @@ -483,7 +490,8 @@ set_sensitive (struct _source_data *data) } static void -select_source (GtkWidget *list, struct _source_data *data) +select_source (GtkWidget *list, + struct _source_data *data) { GtkTreeViewColumn *column; GtkTreePath *path; @@ -499,7 +507,8 @@ select_source (GtkWidget *list, struct _source_data *data) } static void -select_source_with_changed (GtkWidget *widget, struct _source_data *data) +select_source_with_changed (GtkWidget *widget, + struct _source_data *data) { em_vfolder_rule_with_t with = 0; GSList *group = NULL; @@ -510,7 +519,7 @@ select_source_with_changed (GtkWidget *widget, struct _source_data *data) group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget)); - for (i=0; i< g_slist_length (group); i++) { + for (i = 0; i< g_slist_length (group); i++) { if (g_slist_nth_data (group, with = i) == widget) break; } @@ -587,7 +596,8 @@ vfr_folder_response (EMFolderSelector *selector, } static void -source_add (GtkWidget *widget, struct _source_data *data) +source_add (GtkWidget *widget, + struct _source_data *data) { EMFolderTree *folder_tree; EMFolderTreeModel *model; @@ -620,7 +630,8 @@ source_add (GtkWidget *widget, struct _source_data *data) } static void -source_remove (GtkWidget *widget, struct _source_data *data) +source_remove (GtkWidget *widget, + struct _source_data *data) { GtkTreeSelection *selection; const gchar *source; @@ -672,7 +683,8 @@ source_remove (GtkWidget *widget, struct _source_data *data) } static GtkWidget * -get_widget (EFilterRule *fr, ERuleContext *rc) +get_widget (EFilterRule *fr, + ERuleContext *rc) { EMVFolderRule *vr =(EMVFolderRule *) fr; GtkWidget *widget, *frame; @@ -701,7 +713,7 @@ get_widget (EFilterRule *fr, ERuleContext *rc) for (i = 0; i < BUTTON_LAST; i++) { data->buttons[i] =(GtkButton *) e_builder_get_widget (builder, edit_buttons[i].name); - g_signal_connect(data->buttons[i], "clicked", edit_buttons[i].func, data); + g_signal_connect (data->buttons[i], "clicked", edit_buttons[i].func, data); } object = gtk_builder_get_object (builder, "source_list"); @@ -718,7 +730,7 @@ get_widget (EFilterRule *fr, ERuleContext *rc) g_free (nice); } - g_signal_connect(data->list, "cursor-changed", G_CALLBACK(select_source), data); + g_signal_connect (data->list, "cursor-changed", G_CALLBACK(select_source), data); rb = (GtkRadioButton *)e_builder_get_widget (builder, "local_rb"); g_signal_connect ( diff --git a/mail/importers/elm-importer.c b/mail/importers/elm-importer.c index 75cf996e14..832bf749ea 100644 --- a/mail/importers/elm-importer.c +++ b/mail/importers/elm-importer.c @@ -122,7 +122,8 @@ parse_elm_rc (const gchar *elmrc) } static gchar * -elm_get_rc (EImport *ei, const gchar *name) +elm_get_rc (EImport *ei, + const gchar *name) { GHashTable *prefs; gchar *elmrc; @@ -142,7 +143,9 @@ elm_get_rc (EImport *ei, const gchar *name) } static gboolean -elm_supported (EImport *ei, EImportTarget *target, EImportImporter *im) +elm_supported (EImport *ei, + EImportTarget *target, + EImportImporter *im) { const gchar *maildir; gchar *elmdir; @@ -246,7 +249,10 @@ elm_import_free (struct _elm_import_msg *m) } static void -elm_status (CamelOperation *op, const gchar *what, gint pc, gpointer data) +elm_status (CamelOperation *op, + const gchar *what, + gint pc, + gpointer data) { struct _elm_import_msg *importer = data; @@ -288,7 +294,8 @@ static MailMsgInfo elm_import_info = { }; static gint -mail_importer_elm_import (EImport *ei, EImportTarget *target) +mail_importer_elm_import (EImport *ei, + EImportTarget *target) { struct _elm_import_msg *m; gint id; @@ -314,7 +321,8 @@ mail_importer_elm_import (EImport *ei, EImportTarget *target) } static void -checkbox_toggle_cb (GtkToggleButton *tb, EImportTarget *target) +checkbox_toggle_cb (GtkToggleButton *tb, + EImportTarget *target) { g_datalist_set_data ( &target->data, "elm-do-mail", @@ -322,7 +330,9 @@ checkbox_toggle_cb (GtkToggleButton *tb, EImportTarget *target) } static GtkWidget * -elm_getwidget (EImport *ei, EImportTarget *target, EImportImporter *im) +elm_getwidget (EImport *ei, + EImportTarget *target, + EImportImporter *im) { GtkWidget *box, *w; GConfClient *gconf; @@ -340,7 +350,7 @@ elm_getwidget (EImport *ei, EImportTarget *target, EImportImporter *im) w = gtk_check_button_new_with_label(_("Mail")); gtk_toggle_button_set_active ((GtkToggleButton *) w, !done_mail); - g_signal_connect(w, "toggled", G_CALLBACK(checkbox_toggle_cb), target); + g_signal_connect (w, "toggled", G_CALLBACK(checkbox_toggle_cb), target); gtk_box_pack_start ((GtkBox *) box, w, FALSE, FALSE, 0); gtk_widget_show_all (box); @@ -349,7 +359,9 @@ elm_getwidget (EImport *ei, EImportTarget *target, EImportImporter *im) } static void -elm_import (EImport *ei, EImportTarget *target, EImportImporter *im) +elm_import (EImport *ei, + EImportTarget *target, + EImportImporter *im) { if (GPOINTER_TO_INT(g_datalist_get_data(&target->data, "elm-do-mail"))) mail_importer_elm_import (ei, target); @@ -358,7 +370,9 @@ elm_import (EImport *ei, EImportTarget *target, EImportImporter *im) } static void -elm_cancel (EImport *ei, EImportTarget *target, EImportImporter *im) +elm_cancel (EImport *ei, + EImportTarget *target, + EImportImporter *im) { struct _elm_import_msg *m = g_datalist_get_data(&target->data, "elm-msg"); diff --git a/mail/importers/evolution-mbox-importer.c b/mail/importers/evolution-mbox-importer.c index 4b3a258e18..3c97bd953b 100644 --- a/mail/importers/evolution-mbox-importer.c +++ b/mail/importers/evolution-mbox-importer.c @@ -71,14 +71,17 @@ typedef struct { } MboxImporter; static void -folder_selected (EMFolderSelectionButton *button, EImportTargetURI *target) +folder_selected (EMFolderSelectionButton *button, + EImportTargetURI *target) { g_free (target->uri_dest); target->uri_dest = g_strdup (em_folder_selection_button_get_folder_uri (button)); } static GtkWidget * -mbox_getwidget (EImport *ei, EImportTarget *target, EImportImporter *im) +mbox_getwidget (EImport *ei, + EImportTarget *target, + EImportImporter *im) { EShell *shell; EShellBackend *shell_backend; @@ -159,7 +162,9 @@ mbox_getwidget (EImport *ei, EImportTarget *target, EImportImporter *im) } static gboolean -mbox_supported (EImport *ei, EImportTarget *target, EImportImporter *im) +mbox_supported (EImport *ei, + EImportTarget *target, + EImportImporter *im) { gchar signature[6]; gboolean ret = FALSE; @@ -190,7 +195,10 @@ mbox_supported (EImport *ei, EImportTarget *target, EImportImporter *im) } static void -mbox_status (CamelOperation *op, const gchar *what, gint pc, gpointer data) +mbox_status (CamelOperation *op, + const gchar *what, + gint pc, + gpointer data) { MboxImporter *importer = data; @@ -224,7 +232,8 @@ mbox_status_timeout (gpointer data) } static void -mbox_import_done (gpointer data, GError **error) +mbox_import_done (gpointer data, + GError **error) { MboxImporter *importer = data; @@ -238,7 +247,9 @@ mbox_import_done (gpointer data, GError **error) } static void -mbox_import (EImport *ei, EImportTarget *target, EImportImporter *im) +mbox_import (EImport *ei, + EImportTarget *target, + EImportImporter *im) { EShell *shell; EShellBackend *shell_backend; @@ -276,7 +287,9 @@ mbox_import (EImport *ei, EImportTarget *target, EImportImporter *im) } static void -mbox_cancel (EImport *ei, EImportTarget *target, EImportImporter *im) +mbox_cancel (EImport *ei, + EImportTarget *target, + EImportImporter *im) { MboxImporter *importer = g_datalist_get_data(&target->data, "mbox-data"); @@ -296,7 +309,8 @@ mbox_importer_set_preview_funcs (MboxImporterCreatePreviewFunc create_func, } static void -preview_selection_changed_cb (GtkTreeSelection *selection, EWebViewPreview *preview) +preview_selection_changed_cb (GtkTreeSelection *selection, + EWebViewPreview *preview) { GtkTreeIter iter; GtkTreeModel *model = NULL; @@ -325,7 +339,9 @@ preview_selection_changed_cb (GtkTreeSelection *selection, EWebViewPreview *prev } static GtkWidget * -mbox_get_preview (EImport *ei, EImportTarget *target, EImportImporter *im) +mbox_get_preview (EImport *ei, + EImportTarget *target, + EImportImporter *im) { GtkWidget *preview = NULL; EImportTargetURI *s = (EImportTargetURI *) target; @@ -345,7 +361,7 @@ mbox_get_preview (EImport *ei, EImportTarget *target, EImportImporter *im) return NULL; } - fd = g_open (filename, O_RDONLY|O_BINARY, 0); + fd = g_open (filename, O_RDONLY | O_BINARY, 0); if (fd == -1) { g_warning ( "Cannot find source file to import '%s': %s", diff --git a/mail/importers/mail-importer.c b/mail/importers/mail-importer.c index c2619e08a1..e28de37b3c 100644 --- a/mail/importers/mail-importer.c +++ b/mail/importers/mail-importer.c @@ -95,7 +95,7 @@ decode_status (const gchar *status) static guint32 decode_mozilla_status (const gchar *tmp) { - unsigned long status = strtoul (tmp, NULL, 16); + gulong status = strtoul (tmp, NULL, 16); guint32 flags = 0; gint i; @@ -134,7 +134,7 @@ import_mbox_exec (struct _import_mbox_msg *m, return; if (S_ISREG (st.st_mode)) { - fd = g_open (m->path, O_RDONLY|O_BINARY, 0); + fd = g_open (m->path, O_RDONLY | O_BINARY, 0); if (fd == -1) { g_warning ( "cannot find source file to import '%s': %s", @@ -242,7 +242,8 @@ mail_importer_import_mbox (EMailSession *session, const gchar *path, const gchar *folderuri, GCancellable *cancellable, - void (*done)(gpointer data, GError **), + void (*done) (gpointer data, + GError **error), gpointer data) { struct _import_mbox_msg *m; @@ -290,7 +291,7 @@ struct _import_folders_data { EMailSession *session; GCancellable *cancellable; - guint elmfmt:1; + guint elmfmt : 1; }; static void @@ -315,7 +316,7 @@ import_folders_rec (struct _import_folders_data *m, camel_operation_push_message (m->cancellable, _("Scanning %s"), utf8_filename); g_free (utf8_filename); - while ( (d=g_dir_read_name (dir))) { + while ( (d = g_dir_read_name (dir))) { if (d[0] == '.') continue; @@ -333,7 +334,7 @@ import_folders_rec (struct _import_folders_data *m, if (folderparent == NULL) { gint i; - for (i=0;m->special_folders[i].orig;i++) + for (i = 0; m->special_folders[i].orig; i++) if (strcmp (m->special_folders[i].orig, folder) == 0) { folder = m->special_folders[i].new; break; diff --git a/mail/importers/mail-importer.h b/mail/importers/mail-importer.h index 93d1897877..d66ed464ec 100644 --- a/mail/importers/mail-importer.h +++ b/mail/importers/mail-importer.h @@ -34,7 +34,7 @@ typedef void (*MboxImporterCreatePreviewFunc)(GObject *preview, GtkWidget **prev typedef void (*MboxImporterFillPreviewFunc)(GObject *preview, CamelMimeMessage *msg); /* 'create_func' is a function to create a view. 'fill_func' is to fill view with a preview of a message 'msg' - (mail importer cannot link to em-format-html-display directly) */ + * (mail importer cannot link to em-format-html-display directly) */ void mbox_importer_set_preview_funcs (MboxImporterCreatePreviewFunc create_func, MboxImporterFillPreviewFunc fill_func); EImportImporter *elm_importer_peek (void); diff --git a/mail/importers/pine-importer.c b/mail/importers/pine-importer.c index 9be96ba182..710e02b40e 100644 --- a/mail/importers/pine-importer.c +++ b/mail/importers/pine-importer.c @@ -64,7 +64,9 @@ struct _pine_import_msg { }; static gboolean -pine_supported (EImport *ei, EImportTarget *target, EImportImporter *im) +pine_supported (EImport *ei, + EImportTarget *target, + EImportImporter *im) { gchar *maildir, *addrfile; gboolean md_exists, addr_exists; @@ -84,21 +86,22 @@ pine_supported (EImport *ei, EImportTarget *target, EImportImporter *im) } /* -See: http://www.washington.edu/pine/tech-notes/low-level.html - -addressbook line is: - <nickname>TAB<fullname>TAB<address>TAB<fcc>TAB<comments> -lists, address is: - "(" <address>, <address>, <address>, ... ")" - -<address> is rfc822 address, or alias address. -if rfc822 address includes a phrase, then that overrides <fullname> - -FIXME: we dont handle aliases in lists. -*/ + * See: http://www.washington.edu/pine/tech-notes/low-level.html + * + * addressbook line is: + * <nickname>TAB<fullname>TAB<address>TAB<fcc>TAB<comments> + * lists, address is: + * "(" <address>, <address>, <address>, ... ")" + * + * <address> is rfc822 address, or alias address. + * if rfc822 address includes a phrase, then that overrides <fullname> + * + * FIXME: we dont handle aliases in lists. + */ static void -import_contact (EBookClient *book_client, gchar *line) +import_contact (EBookClient *book_client, + gchar *line) { gchar **strings, *addr, **addrs; gint i; @@ -118,16 +121,16 @@ import_contact (EBookClient *book_client, gchar *line) addr = strings[2]; len = strlen (addr); - if (addr[0] == '(' && addr[len-1] == ')') { + if (addr[0] == '(' && addr[len - 1] == ')') { addr[0] = 0; - addr[len-1] = 0; + addr[len - 1] = 0; addrs = g_strsplit(addr+1, ",", 0); list = NULL; /* XXX So ... this api is just insane ... we set * plain strings as the contact email if it * is a normal contact, but need to do this * XML crap for mailing lists. */ - for (i=0;addrs[i];i++) { + for (i = 0; addrs[i]; i++) { EDestination *d; EVCardAttribute *attr; @@ -228,15 +231,15 @@ import_contacts (void) line = g_string_new(""); g_string_set_size (line, 256); offset = 0; - while (fgets (line->str+offset, 256, fp)) { + while (fgets (line->str + offset, 256, fp)) { gsize len; - len = strlen (line->str+offset)+offset; - if (line->str[len-1] == '\n') - g_string_truncate (line, len-1); + len = strlen (line->str + offset) + offset; + if (line->str[len - 1] == '\n') + g_string_truncate (line, len - 1); else if (!feof (fp)) { offset = len; - g_string_set_size (line, len+256); + g_string_set_size (line, len + 256); continue; } else { g_string_truncate (line, len); @@ -428,7 +431,9 @@ checkbox_addr_toggle_cb (GtkToggleButton *tb, } static GtkWidget * -pine_getwidget (EImport *ei, EImportTarget *target, EImportImporter *im) +pine_getwidget (EImport *ei, + EImportTarget *target, + EImportImporter *im) { GtkWidget *box, *w; GConfClient *gconf; @@ -452,12 +457,12 @@ pine_getwidget (EImport *ei, EImportTarget *target, EImportImporter *im) w = gtk_check_button_new_with_label(_("Mail")); gtk_toggle_button_set_active ((GtkToggleButton *) w, !done_mail); - g_signal_connect(w, "toggled", G_CALLBACK(checkbox_mail_toggle_cb), target); + g_signal_connect (w, "toggled", G_CALLBACK(checkbox_mail_toggle_cb), target); gtk_box_pack_start ((GtkBox *) box, w, FALSE, FALSE, 0); w = gtk_check_button_new_with_label(_("Address Book")); gtk_toggle_button_set_active ((GtkToggleButton *) w, !done_addr); - g_signal_connect(w, "toggled", G_CALLBACK(checkbox_addr_toggle_cb), target); + g_signal_connect (w, "toggled", G_CALLBACK(checkbox_addr_toggle_cb), target); gtk_box_pack_start ((GtkBox *) box, w, FALSE, FALSE, 0); gtk_widget_show_all (box); @@ -466,7 +471,9 @@ pine_getwidget (EImport *ei, EImportTarget *target, EImportImporter *im) } static void -pine_import (EImport *ei, EImportTarget *target, EImportImporter *im) +pine_import (EImport *ei, + EImportTarget *target, + EImportImporter *im) { if (GPOINTER_TO_INT(g_datalist_get_data(&target->data, "pine-do-mail")) || GPOINTER_TO_INT(g_datalist_get_data(&target->data, "pine-do-addr"))) @@ -476,7 +483,9 @@ pine_import (EImport *ei, EImportTarget *target, EImportImporter *im) } static void -pine_cancel (EImport *ei, EImportTarget *target, EImportImporter *im) +pine_cancel (EImport *ei, + EImportTarget *target, + EImportImporter *im) { struct _pine_import_msg *m = g_datalist_get_data(&target->data, "pine-msg"); diff --git a/mail/mail-autofilter.c b/mail/mail-autofilter.c index 45b074d6cf..3fc90d5f94 100644 --- a/mail/mail-autofilter.c +++ b/mail/mail-autofilter.c @@ -90,7 +90,7 @@ strip_re (const gchar *subject) break; if ((s[0] == 'r' || s[0] == 'R') && (s[1] == 'e' || s[1] == 'E')) { - p = s+2; + p = s + 2; while (isdigit (*p) || (ispunct (*p) && (*p != ':'))) p++; if (*p == ':') { @@ -104,26 +104,10 @@ strip_re (const gchar *subject) return (gchar *) s; } -#if 0 -gint -reg_match (gchar *str, gchar *regstr) -{ - regex_t reg; - gint error; - gint ret; - - error = regcomp (®, regstr, REG_EXTENDED|REG_ICASE|REG_NOSUB); - if (error != 0) { - return 0; - } - error = regexec (®, str, 0, NULL, 0); - regfree (®); - return (error == 0); -} -#endif - static void -rule_add_subject (ERuleContext *context, EFilterRule *rule, const gchar *text) +rule_add_subject (ERuleContext *context, + EFilterRule *rule, + const gchar *text) { EFilterPart *part; EFilterElement *element; @@ -140,7 +124,9 @@ rule_add_subject (ERuleContext *context, EFilterRule *rule, const gchar *text) } static void -rule_add_sender (ERuleContext *context, EFilterRule *rule, const gchar *text) +rule_add_sender (ERuleContext *context, + EFilterRule *rule, + const gchar *text) { EFilterPart *part; EFilterElement *element; @@ -157,9 +143,11 @@ rule_add_sender (ERuleContext *context, EFilterRule *rule, const gchar *text) } /* do a bunch of things on the subject to try and detect mailing lists, remove - unneeded stuff, etc */ + * unneeded stuff, etc */ static void -rule_match_subject (ERuleContext *context, EFilterRule *rule, const gchar *subject) +rule_match_subject (ERuleContext *context, + EFilterRule *rule, + const gchar *subject) { const gchar *s; const gchar *s1, *s2; @@ -186,11 +174,11 @@ rule_match_subject (ERuleContext *context, EFilterRule *rule, const gchar *subje s1 = strchr (s, ':'); if (s1) { tmp = g_alloca (s1 - s + 1); - memcpy (tmp, s, s1-s); + memcpy (tmp, s, s1 - s); tmp[s1 - s] = 0; g_strstrip (tmp); rule_add_subject (context, rule, tmp); - s = s1+1; + s = s1 + 1; } /* just lump the rest together */ @@ -201,7 +189,9 @@ rule_match_subject (ERuleContext *context, EFilterRule *rule, const gchar *subje } static void -rule_match_mlist (ERuleContext *context, EFilterRule *rule, const gchar *mlist) +rule_match_mlist (ERuleContext *context, + EFilterRule *rule, + const gchar *mlist) { EFilterPart *part; EFilterElement *element; diff --git a/mail/mail-config.c b/mail/mail-config.c index 2428c4bfae..7356772e99 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -215,7 +215,8 @@ mail_config_get_sync_timeout (void) } gchar * -mail_config_folder_to_cachename (CamelFolder *folder, const gchar *prefix) +mail_config_folder_to_cachename (CamelFolder *folder, + const gchar *prefix) { gchar *folder_uri, *basename, *filename; const gchar *config_dir; diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index e8f183f339..0e1ac98413 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -358,7 +358,7 @@ folder_changed_cb (CamelFolder *folder, && folder != local_sent && changes && (changes->uid_added->len > 0)) { /* for each added message, check to see that it is - brand new, not junk and not already deleted */ + * brand new, not junk and not already deleted */ for (i = 0; i < changes->uid_added->len; i++) { info = camel_folder_get_message_info ( folder, changes->uid_added->pdata[i]); @@ -451,7 +451,9 @@ free_folder_info (struct _folder_info *mfi) } static void -setup_folder (MailFolderCache *self, CamelFolderInfo *fi, struct _store_info *si) +setup_folder (MailFolderCache *self, + CamelFolderInfo *fi, + struct _store_info *si) { struct _folder_info *mfi; struct _folder_update *up; @@ -482,7 +484,9 @@ setup_folder (MailFolderCache *self, CamelFolderInfo *fi, struct _store_info *si } static void -create_folders (MailFolderCache *self, CamelFolderInfo *fi, struct _store_info *si) +create_folders (MailFolderCache *self, + CamelFolderInfo *fi, + struct _store_info *si) { while (fi) { setup_folder (self, fi, si); @@ -600,7 +604,7 @@ rename_folders (MailFolderCache *self, } up->full_name = g_strdup (mfi->full_name); - up->unread = fi->unread==-1?0:fi->unread; + up->unread = fi->unread==-1 ? 0 : fi->unread; up->store = g_object_ref (si->store); if ((fi->flags & CAMEL_FOLDER_NOSELECT) == 0) @@ -638,7 +642,8 @@ rename_folders (MailFolderCache *self, } static void -get_folders (CamelFolderInfo *fi, GPtrArray *folders) +get_folders (CamelFolderInfo *fi, + GPtrArray *folders) { while (fi) { g_ptr_array_add (folders, fi); @@ -651,7 +656,8 @@ get_folders (CamelFolderInfo *fi, GPtrArray *folders) } static gint -folder_cmp (gconstpointer ap, gconstpointer bp) +folder_cmp (gconstpointer ap, + gconstpointer bp) { const CamelFolderInfo *a = ((CamelFolderInfo **) ap)[0]; const CamelFolderInfo *b = ((CamelFolderInfo **) bp)[0]; @@ -675,12 +681,12 @@ store_folder_renamed_cb (CamelStore *store, gint i; /* Ok, so for some reason the folderinfo we have comes in all messed up from - imap, should find out why ... this makes it workable */ + * imap, should find out why ... this makes it workable */ get_folders (info, folders); qsort (folders->pdata, folders->len, sizeof (folders->pdata[0]), folder_cmp); top = folders->pdata[0]; - for (i=0;i<folders->len;i++) { + for (i = 0; i < folders->len; i++) { rename_folders (self, si, old_name, top->full_name, folders->pdata[i]); } @@ -698,14 +704,18 @@ struct _update_data { }; static void -unset_folder_info_hash (gchar *path, struct _folder_info *mfi, gpointer data) +unset_folder_info_hash (gchar *path, + struct _folder_info *mfi, + gpointer data) { - MailFolderCache *self = (MailFolderCache*) data; + MailFolderCache *self = (MailFolderCache *) data; unset_folder_info (self, mfi, FALSE, FALSE); } static void -free_folder_info_hash (gchar *path, struct _folder_info *mfi, gpointer data) +free_folder_info_hash (gchar *path, + struct _folder_info *mfi, + gpointer data) { free_folder_info (mfi); } @@ -902,7 +912,7 @@ storeinfo_find_folder_info (CamelStore *store, static void mail_folder_cache_finalize (GObject *object) { - MailFolderCache *cache = (MailFolderCache*) object; + MailFolderCache *cache = (MailFolderCache *) object; g_hash_table_destroy (cache->priv->stores); g_mutex_free (cache->priv->stores_mutex); @@ -1350,7 +1360,7 @@ mail_folder_cache_get_folder_info_flags (MailFolderCache *self, } /* Returns whether folder 'folder' has children based on folder_info->child property. - If not found returns FALSE and sets 'found' to FALSE, if not NULL. */ + * If not found returns FALSE and sets 'found' to FALSE, if not NULL. */ gboolean mail_folder_cache_get_folder_has_children (MailFolderCache *self, CamelFolder *folder, diff --git a/mail/mail-mt.c b/mail/mail-mt.c index 724498c359..d904eed546 100644 --- a/mail/mail-mt.c +++ b/mail/mail-mt.c @@ -303,7 +303,8 @@ mail_msg_active (void) static GHookList cancel_hook_list; GHook * -mail_cancel_hook_add (GHookFunc func, gpointer data) +mail_cancel_hook_add (GHookFunc func, + gpointer data) { GHook *hook; @@ -440,7 +441,8 @@ mail_msg_init (void) } static gint -mail_msg_compare (const MailMsg *msg1, const MailMsg *msg2) +mail_msg_compare (const MailMsg *msg1, + const MailMsg *msg2) { gint priority1 = msg1->priority; gint priority2 = msg2->priority; @@ -598,7 +600,9 @@ static MailMsgInfo mail_call_info = { }; gpointer -mail_call_main (mail_call_t type, MailMainFunc func, ...) +mail_call_main (mail_call_t type, + MailMainFunc func, + ...) { GCancellable *cancellable; struct _call_msg *m; diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 8bfc050149..bf57a97ca7 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -301,7 +301,7 @@ fetch_mail_exec (struct _fetch_mail_msg *m, if (fm->delete && (!error || !*error)) { /* not keep on server - just delete all * the actual messages on the server */ - for (i=0;i<folder_uids->len;i++) { + for (i = 0; i < folder_uids->len; i++) { camel_folder_delete_message ( folder, folder_uids->pdata[i]); } @@ -321,15 +321,15 @@ fetch_mail_exec (struct _fetch_mail_msg *m, } /* we unref the source folder here since we - may now block in finalize (we try to - disconnect cleanly) */ + * may now block in finalize (we try to + * disconnect cleanly) */ g_object_unref (fm->source_folder); fm->source_folder = NULL; } fail: /* we unref this here as it may have more work to do (syncing - folders and whatnot) before we are really done */ + * folders and whatnot) before we are really done */ /* should this be cancellable too? (i.e. above unregister above) */ if (fm->driver) { g_object_unref (fm->driver); @@ -337,7 +337,7 @@ fail: } /* also disconnect if not a local delivery mbox; - there is no need to keep the connection alive forever */ + * there is no need to keep the connection alive forever */ if (!is_local_delivery) em_utils_disconnect_service_sync ( CAMEL_SERVICE (m->store), TRUE, cancellable, NULL); @@ -595,7 +595,7 @@ mail_send_message (struct _send_queue_msg *m, info = camel_message_info_new (NULL); camel_message_info_set_flags (info, CAMEL_MESSAGE_SEEN, ~0); - for (header = xev;header;header=header->next) { + for (header = xev; header; header = header->next) { gchar *uri; if (strcmp(header->name, "X-Evolution-PostTo") != 0) @@ -822,7 +822,7 @@ send_queue_exec (struct _send_queue_msg *m, send_uids->len); camel_operation_progress ( - cancellable, (i+1) * 100 / send_uids->len); + cancellable, (i + 1) * 100 / send_uids->len); mail_send_message ( m, m->queue, send_uids->pdata[i], m->transport, @@ -1064,7 +1064,8 @@ mail_transfer_messages (EMailSession *session, gboolean delete_from_source, const gchar *dest_uri, guint32 dest_flags, - void (*done) (gboolean ok, gpointer data), + void (*done) (gboolean ok, + gpointer data), gpointer data) { struct _transfer_msg *m; @@ -1140,7 +1141,8 @@ static MailMsgInfo sync_folder_info = { void mail_sync_folder (CamelFolder *folder, - void (*done) (CamelFolder *folder, gpointer data), + void (*done) (CamelFolder *folder, + gpointer data), gpointer data) { struct _sync_folder_msg *m; @@ -1216,7 +1218,8 @@ static MailMsgInfo sync_store_info = { void mail_sync_store (CamelStore *store, gint expunge, - void (*done) (CamelStore *store, gpointer data), + void (*done) (CamelStore *store, + gpointer data), gpointer data) { struct _sync_store_msg *m; @@ -1260,7 +1263,8 @@ static MailMsgInfo refresh_folder_info = { void mail_refresh_folder (CamelFolder *folder, - void (*done) (CamelFolder *folder, gpointer data), + void (*done) (CamelFolder *folder, + gpointer data), gpointer data) { struct _sync_folder_msg *m; diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c index 2446c1c92e..5fda76d103 100644 --- a/mail/mail-send-recv.c +++ b/mail/mail-send-recv.c @@ -64,7 +64,7 @@ /* This stuff below is independent of the stuff above */ /* this stuff is used to keep track of which folders filters have accessed, and - what not. the thaw/refreeze thing doesn't really seem to work though */ + * what not. the thaw/refreeze thing doesn't really seem to work though */ struct _folder_info { gchar *uri; CamelFolder *folder; @@ -187,7 +187,8 @@ setup_send_data (void) } static void -receive_cancel (GtkButton *button, struct _send_info *info) +receive_cancel (GtkButton *button, + struct _send_info *info) { if (info->state == SEND_ACTIVE) { camel_operation_cancel (CAMEL_OPERATION (info->cancellable)); @@ -223,13 +224,17 @@ free_send_data (void) } static void -cancel_send_info (gpointer key, struct _send_info *info, gpointer data) +cancel_send_info (gpointer key, + struct _send_info *info, + gpointer data) { receive_cancel (GTK_BUTTON (info->cancel_button), info); } static void -hide_send_info (gpointer key, struct _send_info *info, gpointer data) +hide_send_info (gpointer key, + struct _send_info *info, + gpointer data) { info->cancel_button = NULL; info->progress_bar = NULL; @@ -242,7 +247,8 @@ hide_send_info (gpointer key, struct _send_info *info, gpointer data) } static void -dialog_destroy_cb (struct _send_data *data, GObject *deadbeef) +dialog_destroy_cb (struct _send_data *data, + GObject *deadbeef) { g_hash_table_foreach (data->active, (GHFunc) hide_send_info, NULL); data->gd = NULL; @@ -250,7 +256,9 @@ dialog_destroy_cb (struct _send_data *data, GObject *deadbeef) } static void -dialog_response (GtkDialog *gd, gint button, struct _send_data *data) +dialog_response (GtkDialog *gd, + gint button, + struct _send_data *data) { switch (button) { case GTK_RESPONSE_CANCEL: @@ -310,7 +318,9 @@ operation_status_timeout (gpointer data) } static void -set_send_status (struct _send_info *info, const gchar *desc, gint pc) +set_send_status (struct _send_info *info, + const gchar *desc, + gint pc) { g_static_mutex_lock (&status_lock); @@ -322,7 +332,8 @@ set_send_status (struct _send_info *info, const gchar *desc, gint pc) } static void -set_send_account (struct _send_info *info, const gchar *account_url) +set_send_account (struct _send_info *info, + const gchar *account_url) { g_static_mutex_lock (&status_lock); @@ -391,7 +402,7 @@ get_receive_type (CamelURL *url) CamelProvider *provider; /* mbox pointing to a file is a 'Local delivery' source - which requires special processing */ + * which requires special processing */ if (em_utils_is_local_delivery_mbox_file (url)) return SEND_RECEIVE; @@ -592,19 +603,19 @@ build_dialog (GtkWindow *parent, gtk_table_attach ( GTK_TABLE (table), recv_icon, - 0, 1, row, row+2, 0, 0, 0, 0); + 0, 1, row, row + 2, 0, 0, 0, 0); gtk_table_attach ( GTK_TABLE (table), label, - 1, 2, row, row+1, GTK_EXPAND | GTK_FILL, 0, 0, 0); + 1, 2, row, row + 1, GTK_EXPAND | GTK_FILL, 0, 0, 0); gtk_table_attach ( GTK_TABLE (table), progress_bar, - 2, 3, row, row+2, 0, 0, 0, 0); + 2, 3, row, row + 2, 0, 0, 0, 0); gtk_table_attach ( GTK_TABLE (table), cancel_button, - 3, 4, row, row+2, 0, 0, 0, 0); + 3, 4, row, row + 2, 0, 0, 0, 0); gtk_table_attach ( GTK_TABLE (table), status_label, - 1, 2, row+1, row+2, GTK_EXPAND | GTK_FILL, 0, 0, 0); + 1, 2, row + 1, row + 2, GTK_EXPAND | GTK_FILL, 0, 0, 0); info->progress_bar = progress_bar; info->status_label = status_label; @@ -686,19 +697,19 @@ build_dialog (GtkWindow *parent, gtk_table_attach ( GTK_TABLE (table), send_icon, - 0, 1, row, row+2, 0, 0, 0, 0); + 0, 1, row, row + 2, 0, 0, 0, 0); gtk_table_attach ( GTK_TABLE (table), label, - 1, 2, row, row+1, GTK_EXPAND | GTK_FILL, 0, 0, 0); + 1, 2, row, row + 1, GTK_EXPAND | GTK_FILL, 0, 0, 0); gtk_table_attach ( GTK_TABLE (table), progress_bar, - 2, 3, row, row+2, 0, 0, 0, 0); + 2, 3, row, row + 2, 0, 0, 0, 0); gtk_table_attach ( GTK_TABLE (table), cancel_button, - 3, 4, row, row+2, 0, 0, 0, 0); + 3, 4, row, row + 2, 0, 0, 0, 0); gtk_table_attach ( GTK_TABLE (table), status_label, - 1, 2, row+1, row+2, GTK_EXPAND | GTK_FILL, 0, 0, 0); + 1, 2, row + 1, row + 2, GTK_EXPAND | GTK_FILL, 0, 0, 0); info->progress_bar = progress_bar; info->cancel_button = cancel_button; @@ -726,7 +737,9 @@ build_dialog (GtkWindow *parent, } static void -update_folders (gchar *uri, struct _folder_info *info, gpointer data) +update_folders (gchar *uri, + struct _folder_info *info, + gpointer data) { time_t now = *((time_t *) data); @@ -734,7 +747,7 @@ update_folders (gchar *uri, struct _folder_info *info, gpointer data) /* let it flow through to the folders every 10 seconds */ /* we back off slowly as we progress */ - if (now > info->update+10+info->count*5) { + if (now > info->update + 10 + info->count *5) { d(printf("upating a folder: %s\n", info->uri)); /*camel_folder_thaw(info->folder); camel_folder_freeze (info->folder);*/ @@ -756,7 +769,7 @@ receive_status (CamelFilterDriver *driver, /* let it flow through to the folder, every now and then too? */ g_hash_table_foreach (info->data->folders, (GHFunc) update_folders, &now); - if (info->data->inbox && now > info->data->inbox_update+20) { + if (info->data->inbox && now > info->data->inbox_update + 20) { d(printf("updating inbox too\n")); /* this doesn't seem to work right :( */ /*camel_folder_thaw(info->data->inbox); @@ -765,8 +778,8 @@ receive_status (CamelFilterDriver *driver, } /* we just pile them onto the port, assuming it can handle it. - We could also have a receiver port and see if they've been processed - yet, so if this is necessary its not too hard to add */ + * We could also have a receiver port and see if they've been processed + * yet, so if this is necessary its not too hard to add */ /* the mail_gui_port receiver will free everything for us */ switch (status) { case CAMEL_FILTER_STATUS_START: @@ -851,9 +864,9 @@ receive_done (gpointer data) } /* although we dont do anythign smart here yet, there is no need for this interface to - be available to anyone else. - This can also be used to hook into which folders are being updated, and occasionally - let them refresh */ + * be available to anyone else. + * This can also be used to hook into which folders are being updated, and occasionally + * let them refresh */ static CamelFolder * receive_get_folder (CamelFilterDriver *d, const gchar *uri, @@ -904,7 +917,9 @@ receive_get_folder (CamelFilterDriver *d, /* ********************************************************************** */ static void -get_folders (CamelStore *store, GPtrArray *folders, CamelFolderInfo *info) +get_folders (CamelStore *store, + GPtrArray *folders, + CamelFolderInfo *info) { while (info) { if (camel_store_can_refresh_folder (store, info, NULL)) { @@ -923,7 +938,8 @@ get_folders (CamelStore *store, GPtrArray *folders, CamelFolderInfo *info) } static void -main_op_cancelled_cb (GCancellable *main_op, GCancellable *refresh_op) +main_op_cancelled_cb (GCancellable *main_op, + GCancellable *refresh_op) { g_cancellable_cancel (refresh_op); } @@ -962,7 +978,7 @@ refresh_folders_exec (struct _refresh_folders_msg *m, camel_operation_push_message (m->info->cancellable, _("Updating...")); - for (i=0;i<m->folders->len;i++) { + for (i = 0; i < m->folders->len; i++) { folder = e_mail_session_uri_to_folder_sync ( m->info->session, m->folders->pdata[i], 0, @@ -1003,7 +1019,7 @@ refresh_folders_free (struct _refresh_folders_msg *m) { gint i; - for (i=0;i<m->folders->len;i++) + for (i = 0; i < m->folders->len; i++) g_free (m->folders->pdata[i]); g_ptr_array_free (m->folders, TRUE); @@ -1068,7 +1084,9 @@ receive_update_got_store (CamelStore *store, } static GtkWidget * -send_receive (GtkWindow *parent, EMailSession *session, gboolean allow_send) +send_receive (GtkWindow *parent, + EMailSession *session, + gboolean allow_send) { CamelFolder *local_outbox; struct _send_data *data; @@ -1142,13 +1160,15 @@ send_receive (GtkWindow *parent, EMailSession *session, gboolean allow_send) } GtkWidget * -mail_send_receive (GtkWindow *parent, EMailSession *session) +mail_send_receive (GtkWindow *parent, + EMailSession *session) { return send_receive (parent, session, TRUE); } GtkWidget * -mail_receive (GtkWindow *parent, EMailSession *session) +mail_receive (GtkWindow *parent, + EMailSession *session) { return send_receive (parent, session, FALSE); } @@ -1174,7 +1194,9 @@ auto_timeout (gpointer data) } static void -auto_account_removed (EAccountList *eal, EAccount *ea, gpointer dummy) +auto_account_removed (EAccountList *eal, + EAccount *ea, + gpointer dummy) { struct _auto_data *info = g_object_get_data((GObject *)ea, "mail-autoreceive"); @@ -1187,7 +1209,7 @@ auto_account_removed (EAccountList *eal, EAccount *ea, gpointer dummy) } static void -auto_account_finalised (struct _auto_data *info) +auto_account_finalized (struct _auto_data *info) { if (info->session != NULL) g_object_unref (info->session); @@ -1204,7 +1226,7 @@ auto_account_commit (struct _auto_data *info) check = info->account->enabled && e_account_get_bool (info->account, E_ACCOUNT_SOURCE_AUTO_CHECK) && e_account_get_string (info->account, E_ACCOUNT_SOURCE_URL); - period = e_account_get_int (info->account, E_ACCOUNT_SOURCE_AUTO_CHECK_TIME)*60; + period = e_account_get_int (info->account, E_ACCOUNT_SOURCE_AUTO_CHECK_TIME) * 60; period = MAX (60, period); if (info->timeout_id @@ -1230,12 +1252,14 @@ auto_account_added (EAccountList *eal, info->session = g_object_ref (session); g_object_set_data_full ( G_OBJECT (ea), "mail-autoreceive", info, - (GDestroyNotify) auto_account_finalised); + (GDestroyNotify) auto_account_finalized); auto_account_commit (info); } static void -auto_account_changed (EAccountList *eal, EAccount *ea, gpointer dummy) +auto_account_changed (EAccountList *eal, + EAccount *ea, + gpointer dummy) { struct _auto_data *info = g_object_get_data((GObject *)ea, "mail-autoreceive"); diff --git a/mail/mail-tools.c b/mail/mail-tools.c index 476ed67fdb..9ef758f06f 100644 --- a/mail/mail-tools.c +++ b/mail/mail-tools.c @@ -180,11 +180,11 @@ mail_tool_remove_xevolution_headers (CamelMimeMessage *message) { struct _camel_header_raw *scan, *list = NULL; - for (scan = ((CamelMimePart *) message)->headers;scan;scan=scan->next) + for (scan = ((CamelMimePart *) message)->headers; scan; scan = scan->next) if (!strncmp(scan->name, "X-Evolution", 11)) camel_header_raw_append (&list, scan->name, scan->value, scan->offset); - for (scan=list;scan;scan=scan->next) + for (scan = list; scan; scan = scan->next) camel_medium_remove_header ((CamelMedium *) message, scan->name); return list; @@ -198,7 +198,7 @@ mail_tool_restore_xevolution_headers (CamelMimeMessage *message, medium = CAMEL_MEDIUM (message); - for (;xev;xev=xev->next) + for (; xev; xev = xev->next) camel_medium_add_header (medium, xev->name, xev->value); } diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index 71431e3fe0..78d0863e0c 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -68,7 +68,7 @@ static GQueue source_folders_local = G_QUEUE_INIT; static GHashTable *vfolder_hash; /* This is a slightly hacky solution to shutting down, we poll this variable in various - loops, and just quit processing if it is set. */ + * loops, and just quit processing if it is set. */ static volatile gint vfolder_shutdown; /* are we shutting down? */ static void rule_changed (EFilterRule *rule, CamelFolder *folder); @@ -347,7 +347,8 @@ mv_find_folder (GQueue *queue, } static gint -uri_is_ignore (EMailBackend *backend, const gchar *uri) +uri_is_ignore (EMailBackend *backend, + const gchar *uri) { EMailSession *session; CamelSession *camel_session; @@ -608,7 +609,7 @@ mail_vfolder_delete_folder (EMailBackend *backend, source = NULL; while ((source = em_vfolder_rule_next_source (vf_rule, source))) { /* Remove all sources that match, ignore changed events though - because the adduri call above does the work async */ + * because the adduri call above does the work async */ if (e_mail_folder_uri_equal (CAMEL_SESSION (session), uri, source)) { vf = g_hash_table_lookup ( vfolder_hash, rule->name); @@ -739,7 +740,7 @@ mail_vfolder_rename_folder (CamelStore *store, source = NULL; while ((source = em_vfolder_rule_next_source (vf_rule, source))) { /* Remove all sources that match, ignore changed events though - because the adduri call above does the work async */ + * because the adduri call above does the work async */ if (e_mail_folder_uri_equal (session, old_uri, source)) { vf = g_hash_table_lookup (vfolder_hash, rule->name); if (!vf) { @@ -832,7 +833,8 @@ rule_add_sources (EMailSession *session, } static void -rule_changed (EFilterRule *rule, CamelFolder *folder) +rule_changed (EFilterRule *rule, + CamelFolder *folder) { EMailBackend *backend; EMailSession *session; @@ -915,7 +917,7 @@ context_rule_added (ERuleContext *ctx, folder = camel_store_get_folder_sync ( vfolder_store, rule->name, 0, NULL, NULL); if (folder) { - g_signal_connect(rule, "changed", G_CALLBACK(rule_changed), folder); + g_signal_connect (rule, "changed", G_CALLBACK(rule_changed), folder); G_LOCK (vfolder); g_hash_table_insert (vfolder_hash, g_strdup (rule->name), folder); @@ -1025,10 +1027,10 @@ store_folder_renamed_cb (CamelStore *store, } g_signal_handlers_disconnect_matched ( - rule, G_SIGNAL_MATCH_FUNC|G_SIGNAL_MATCH_DATA, + rule, G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, 0, 0, NULL, rule_changed, folder); e_filter_rule_set_name (rule, info->full_name); - g_signal_connect(rule, "changed", G_CALLBACK(rule_changed), folder); + g_signal_connect (rule, "changed", G_CALLBACK(rule_changed), folder); config_dir = mail_session_get_config_dir (); user = g_build_filename (config_dir, "vfolders.xml", NULL); @@ -1251,7 +1253,9 @@ vfolder_edit (EShellView *shell_view) } static void -vfolder_edit_response_cb (GtkWidget *dialog, gint response_id, gpointer user_data) +vfolder_edit_response_cb (GtkWidget *dialog, + gint response_id, + gpointer user_data) { if (response_id == GTK_RESPONSE_OK) { EFilterRule *rule = g_object_get_data (G_OBJECT (dialog), "vfolder-rule"); @@ -1335,7 +1339,9 @@ vfolder_edit_rule (EMailBackend *backend, } static void -new_rule_clicked (GtkWidget *w, gint button, gpointer data) +new_rule_clicked (GtkWidget *w, + gint button, + gpointer data) { if (button == GTK_RESPONSE_OK) { const gchar *config_dir; @@ -1369,7 +1375,8 @@ new_rule_clicked (GtkWidget *w, gint button, gpointer data) } static void -new_rule_changed_cb (EFilterRule *rule, GtkDialog *dialog) +new_rule_changed_cb (EFilterRule *rule, + GtkDialog *dialog) { g_return_if_fail (rule != NULL); g_return_if_fail (dialog != NULL); @@ -1387,7 +1394,8 @@ vfolder_create_part (const gchar *name) /* clones a filter/search rule into a matching vfolder rule * (assuming the same system definitions) */ EFilterRule * -vfolder_clone_rule (EMailBackend *backend, EFilterRule *in) +vfolder_clone_rule (EMailBackend *backend, + EFilterRule *in) { EFilterRule *rule; xmlNodePtr xml; @@ -1429,9 +1437,9 @@ vfolder_gui_add_rule (EMVFolderRule *rule) gtk_box_pack_start (GTK_BOX (container), w, TRUE, TRUE, 0); gtk_widget_show ((GtkWidget *) gd); g_object_set_data_full(G_OBJECT(gd), "rule", rule, (GDestroyNotify)g_object_unref); - g_signal_connect(rule, "changed", G_CALLBACK (new_rule_changed_cb), gd); - new_rule_changed_cb ((EFilterRule*) rule, gd); - g_signal_connect(gd, "response", G_CALLBACK(new_rule_clicked), NULL); + g_signal_connect (rule, "changed", G_CALLBACK (new_rule_changed_cb), gd); + new_rule_changed_cb ((EFilterRule *) rule, gd); + g_signal_connect (gd, "response", G_CALLBACK(new_rule_clicked), NULL); gtk_widget_show ((GtkWidget *) gd); } @@ -1445,7 +1453,7 @@ vfolder_gui_add_from_message (EMailSession *session, g_return_if_fail (CAMEL_IS_MIME_MESSAGE (message)); - rule = (EMVFolderRule*) em_vfolder_rule_from_message ( + rule = (EMVFolderRule *) em_vfolder_rule_from_message ( context, message, flags, folder); vfolder_gui_add_rule (rule); } @@ -1460,13 +1468,15 @@ vfolder_gui_add_from_address (EMailSession *session, g_return_if_fail (addr != NULL); - rule = (EMVFolderRule*) em_vfolder_rule_from_address ( + rule = (EMVFolderRule *) em_vfolder_rule_from_address ( context, addr, flags, folder); vfolder_gui_add_rule (rule); } static void -vfolder_foreach_cb (gpointer key, gpointer data, gpointer user_data) +vfolder_foreach_cb (gpointer key, + gpointer data, + gpointer user_data) { CamelFolder *folder = CAMEL_FOLDER (data); diff --git a/mail/message-list.c b/mail/message-list.c index 2529e10e7f..1c634b91b8 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -309,7 +309,8 @@ e_mail_address_free (EMailAddress *addr) } static gint -e_mail_address_compare (gconstpointer address1, gconstpointer address2) +e_mail_address_compare (gconstpointer address1, + gconstpointer address2) { const EMailAddress *addr1 = address1; const EMailAddress *addr2 = address2; @@ -368,7 +369,9 @@ e_mail_address_compare (gconstpointer address1, gconstpointer address2) #endif /* SMART_ADDRESS_COMPARE */ static gint -address_compare (gconstpointer address1, gconstpointer address2, gpointer cmp_cache) +address_compare (gconstpointer address1, + gconstpointer address2, + gpointer cmp_cache) { #ifdef SMART_ADDRESS_COMPARE EMailAddress *addr1, *addr2; @@ -411,7 +414,8 @@ filter_size (gint size) /* Gets the uid of the message displayed at a given view row */ static const gchar * -get_message_uid (MessageList *message_list, ETreePath node) +get_message_uid (MessageList *message_list, + ETreePath node) { CamelMessageInfo *info; @@ -427,7 +431,8 @@ get_message_uid (MessageList *message_list, ETreePath node) * view row. */ static CamelMessageInfo * -get_message_info (MessageList *message_list, ETreePath node) +get_message_info (MessageList *message_list, + ETreePath node) { CamelMessageInfo *info; @@ -439,7 +444,9 @@ get_message_info (MessageList *message_list, ETreePath node) } static const gchar * -get_normalised_string (MessageList *message_list, CamelMessageInfo *info, gint col) +get_normalised_string (MessageList *message_list, + CamelMessageInfo *info, + gint col) { const gchar *string, *str; gchar *normalised; @@ -517,7 +524,8 @@ get_normalised_string (MessageList *message_list, CamelMessageInfo *info, gint c } static void -clear_selection (MessageList *ml, struct _MLSelection *selection) +clear_selection (MessageList *ml, + struct _MLSelection *selection) { if (selection->uids) { em_utils_uids_free (selection->uids); @@ -530,7 +538,11 @@ clear_selection (MessageList *ml, struct _MLSelection *selection) } static ETreePath -ml_search_forward (MessageList *ml, gint start, gint end, guint32 flags, guint32 mask) +ml_search_forward (MessageList *ml, + gint start, + gint end, + guint32 flags, + guint32 mask) { ETreePath path; gint row; @@ -551,7 +563,11 @@ ml_search_forward (MessageList *ml, gint start, gint end, guint32 flags, guint32 } static ETreePath -ml_search_backward (MessageList *ml, gint start, gint end, guint32 flags, guint32 mask) +ml_search_backward (MessageList *ml, + gint start, + gint end, + guint32 flags, + guint32 mask) { ETreePath path; gint row; @@ -572,7 +588,10 @@ ml_search_backward (MessageList *ml, gint start, gint end, guint32 flags, guint3 } static ETreePath -ml_search_path (MessageList *ml, MessageListSelectDirection direction, guint32 flags, guint32 mask) +ml_search_path (MessageList *ml, + MessageListSelectDirection direction, + guint32 flags, + guint32 mask) { ETreePath node; gint row, count; @@ -592,20 +611,21 @@ ml_search_path (MessageList *ml, MessageListSelectDirection direction, guint32 f if ((direction & MESSAGE_LIST_SELECT_DIRECTION) == MESSAGE_LIST_SELECT_NEXT) node = ml_search_forward (ml, row + 1, count - 1, flags, mask); else - node = ml_search_backward (ml, row-1, 0, flags, mask); + node = ml_search_backward (ml, row - 1, 0, flags, mask); if (node == NULL && (direction & MESSAGE_LIST_SELECT_WRAP)) { if ((direction & MESSAGE_LIST_SELECT_DIRECTION) == MESSAGE_LIST_SELECT_NEXT) node = ml_search_forward (ml, 0, row, flags, mask); else - node = ml_search_backward (ml, count-1, row, flags, mask); + node = ml_search_backward (ml, count - 1, row, flags, mask); } return node; } static void -select_path (MessageList *ml, ETreePath path) +select_path (MessageList *ml, + ETreePath path) { ETree *tree; ETreeTableAdapter *etta; @@ -643,7 +663,10 @@ select_path (MessageList *ml, ETreePath path) * Returns %TRUE if a new message has been selected or %FALSE otherwise. **/ gboolean -message_list_select (MessageList *ml, MessageListSelectDirection direction, guint32 flags, guint32 mask) +message_list_select (MessageList *ml, + MessageListSelectDirection direction, + guint32 flags, + guint32 mask) { ETreePath path; @@ -673,7 +696,10 @@ message_list_select (MessageList *ml, MessageListSelectDirection direction, guin * Return value: **/ gboolean -message_list_can_select (MessageList *ml, MessageListSelectDirection direction, guint32 flags, guint32 mask) +message_list_can_select (MessageList *ml, + MessageListSelectDirection direction, + guint32 flags, + guint32 mask) { return ml_search_path (ml, direction, flags, mask) != NULL; } @@ -771,7 +797,7 @@ message_list_select_next_thread (MessageList *ml) count = e_table_model_row_count ((ETableModel *) etta); /* find the next node which has a root parent (i.e. toplevel node) */ - for (i=row+1;i<count-1;i++) { + for (i = row + 1; i < count - 1; i++) { node = e_tree_table_adapter_node_at_row (etta, i); if (node && e_tree_model_node_is_root (ml->model, e_tree_model_node_get_parent (ml->model, node))) { @@ -862,16 +888,20 @@ typedef struct thread_select_info { } thread_select_info_t; static gboolean -select_node (ETreeModel *model, ETreePath path, gpointer user_data) +select_node (ETreeModel *model, + ETreePath path, + gpointer user_data) { thread_select_info_t *tsi = (thread_select_info_t *) user_data; g_ptr_array_add (tsi->paths, path); - return FALSE; /*not done yet*/ + return FALSE; /*not done yet */ } static void -select_thread (MessageList *message_list, void (*selector)(ETreePath, gpointer)) +select_thread (MessageList *message_list, + void (*selector) (ETreePath, + gpointer)) { ETree *tree; ETreeSelectionModel *etsm; @@ -891,7 +921,8 @@ select_thread (MessageList *message_list, void (*selector)(ETreePath, gpointer)) } static void -thread_select_foreach (ETreePath path, gpointer user_data) +thread_select_foreach (ETreePath path, + gpointer user_data) { thread_select_info_t *tsi = (thread_select_info_t *) user_data; ETreeModel *model = tsi->ml->model; @@ -922,7 +953,8 @@ message_list_select_thread (MessageList *message_list) } static void -subthread_select_foreach (ETreePath path, gpointer user_data) +subthread_select_foreach (ETreePath path, + gpointer user_data) { thread_select_info_t *tsi = (thread_select_info_t *) user_data; ETreeModel *model = tsi->ml->model; @@ -959,7 +991,8 @@ message_list_invert_selection (MessageList *message_list) } void -message_list_copy (MessageList *ml, gboolean cut) +message_list_copy (MessageList *ml, + gboolean cut) { MessageListPrivate *p = ml->priv; GPtrArray *uids; @@ -973,7 +1006,7 @@ message_list_copy (MessageList *ml, gboolean cut) gint i; camel_folder_freeze (ml->folder); - for (i=0;i<uids->len;i++) + for (i = 0; i < uids->len; i++) camel_folder_set_message_flags ( ml->folder, uids->pdata[i], CAMEL_MESSAGE_SEEN | @@ -1005,7 +1038,8 @@ message_list_paste (MessageList *ml) * SimpleTableModel::col_count */ static gint -ml_column_count (ETreeModel *etm, gpointer data) +ml_column_count (ETreeModel *etm, + gpointer data) { return COL_LAST; } @@ -1014,7 +1048,8 @@ ml_column_count (ETreeModel *etm, gpointer data) * SimpleTableModel::has_save_id */ static gboolean -ml_has_save_id (ETreeModel *etm, gpointer data) +ml_has_save_id (ETreeModel *etm, + gpointer data) { return TRUE; } @@ -1023,7 +1058,9 @@ ml_has_save_id (ETreeModel *etm, gpointer data) * SimpleTableModel::get_save_id */ static gchar * -ml_get_save_id (ETreeModel *etm, ETreePath path, gpointer data) +ml_get_save_id (ETreeModel *etm, + ETreePath path, + gpointer data) { CamelMessageInfo *info; @@ -1031,7 +1068,7 @@ ml_get_save_id (ETreeModel *etm, ETreePath path, gpointer data) return g_strdup("root"); /* Note: etable can ask for the save_id while we're clearing it, - which is the only time data should be null */ + * which is the only time data should be null */ info = e_tree_memory_node_get_data (E_TREE_MEMORY (etm), path); if (info == NULL) return NULL; @@ -1043,7 +1080,8 @@ ml_get_save_id (ETreeModel *etm, ETreePath path, gpointer data) * SimpleTableModel::has_save_id */ static gboolean -ml_has_get_node_by_id (ETreeModel *etm, gpointer data) +ml_has_get_node_by_id (ETreeModel *etm, + gpointer data) { return TRUE; } @@ -1052,7 +1090,9 @@ ml_has_get_node_by_id (ETreeModel *etm, gpointer data) * SimpleTableModel::get_save_id */ static ETreePath -ml_get_node_by_id (ETreeModel *etm, const gchar *save_id, gpointer data) +ml_get_node_by_id (ETreeModel *etm, + const gchar *save_id, + gpointer data) { MessageList *ml; @@ -1065,7 +1105,10 @@ ml_get_node_by_id (ETreeModel *etm, const gchar *save_id, gpointer data) } static gpointer -ml_duplicate_value (ETreeModel *etm, gint col, gconstpointer value, gpointer data) +ml_duplicate_value (ETreeModel *etm, + gint col, + gconstpointer value, + gpointer data) { switch (col) { case COL_MESSAGE_STATUS: @@ -1099,7 +1142,10 @@ ml_duplicate_value (ETreeModel *etm, gint col, gconstpointer value, gpointer dat } static void -ml_free_value (ETreeModel *etm, gint col, gpointer value, gpointer data) +ml_free_value (ETreeModel *etm, + gint col, + gpointer value, + gpointer data) { switch (col) { case COL_MESSAGE_STATUS: @@ -1138,7 +1184,9 @@ ml_free_value (ETreeModel *etm, gint col, gpointer value, gpointer data) } static gpointer -ml_initialize_value (ETreeModel *etm, gint col, gpointer data) +ml_initialize_value (ETreeModel *etm, + gint col, + gpointer data) { switch (col) { case COL_MESSAGE_STATUS: @@ -1173,7 +1221,10 @@ ml_initialize_value (ETreeModel *etm, gint col, gpointer data) } static gboolean -ml_value_is_empty (ETreeModel *etm, gint col, gconstpointer value, gpointer data) +ml_value_is_empty (ETreeModel *etm, + gint col, + gconstpointer value, + gpointer data) { switch (col) { case COL_MESSAGE_STATUS: @@ -1226,7 +1277,10 @@ static const gchar *score_map[] = { }; static gchar * -ml_value_to_string (ETreeModel *etm, gint col, gconstpointer value, gpointer data) +ml_value_to_string (ETreeModel *etm, + gint col, + gconstpointer value, + gpointer data) { guint i; @@ -1276,15 +1330,20 @@ ml_value_to_string (ETreeModel *etm, gint col, gconstpointer value, gpointer dat } static GdkPixbuf * -ml_tree_icon_at (ETreeModel *etm, ETreePath path, gpointer model_data) +ml_tree_icon_at (ETreeModel *etm, + ETreePath path, + gpointer model_data) { /* we dont really need an icon ... */ return NULL; } static void -for_node_and_subtree_if_collapsed (MessageList *ml, ETreePath node, CamelMessageInfo *mi, - ETreePathFunc func, gpointer data) +for_node_and_subtree_if_collapsed (MessageList *ml, + ETreePath node, + CamelMessageInfo *mi, + ETreePathFunc func, + gpointer data) { ETreeModel *etm = ml->model; ETreePath child; @@ -1300,7 +1359,9 @@ for_node_and_subtree_if_collapsed (MessageList *ml, ETreePath node, CamelMessage } static gboolean -unread_foreach (ETreeModel *etm, ETreePath node, gpointer data) +unread_foreach (ETreeModel *etm, + ETreePath node, + gpointer data) { gboolean *saw_unread = data; CamelMessageInfo *info; @@ -1323,7 +1384,9 @@ struct LatestData { }; static gboolean -latest_foreach (ETreeModel *etm, ETreePath node, gpointer data) +latest_foreach (ETreeModel *etm, + ETreePath node, + gpointer data) { struct LatestData *ld = data; CamelMessageInfo *info; @@ -1393,7 +1456,8 @@ struct LabelsData { }; static void -add_label_if_known (struct LabelsData *ld, const gchar *tag) +add_label_if_known (struct LabelsData *ld, + const gchar *tag) { GtkTreeIter label_defn; @@ -1406,7 +1470,9 @@ add_label_if_known (struct LabelsData *ld, const gchar *tag) } static gboolean -add_all_labels_foreach (ETreeModel *etm, ETreePath node, gpointer data) +add_all_labels_foreach (ETreeModel *etm, + ETreePath node, + gpointer data) { struct LabelsData *ld = data; CamelMessageInfo *msg_info; @@ -1554,7 +1620,7 @@ ml_tree_value_at_ex (ETreeModel *etm, const gchar *tag, *cmp; /* FIXME: this all should be methods off of message-tag-followup class, - FIXME: the tag names should be namespaced :( */ + * FIXME: the tag names should be namespaced :( */ tag = camel_message_info_user_tag(msg_info, "follow-up"); cmp = camel_message_info_user_tag(msg_info, "completed-on"); if (tag && tag[0]) { @@ -1768,7 +1834,10 @@ ml_tree_value_at_ex (ETreeModel *etm, } static gpointer -ml_tree_value_at (ETreeModel *etm, ETreePath path, gint col, gpointer model_data) +ml_tree_value_at (ETreeModel *etm, + ETreePath path, + gint col, + gpointer model_data) { MessageList *message_list = model_data; CamelMessageInfo *msg_info; @@ -1784,7 +1853,10 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, gint col, gpointer model_data } static gpointer -ml_tree_sort_value_at (ETreeModel *etm, ETreePath path, gint col, gpointer model_data) +ml_tree_sort_value_at (ETreeModel *etm, + ETreePath path, + gint col, + gpointer model_data) { MessageList *message_list = model_data; struct LatestData ld; @@ -1806,14 +1878,20 @@ ml_tree_sort_value_at (ETreeModel *etm, ETreePath path, gint col, gpointer model } static void -ml_tree_set_value_at (ETreeModel *etm, ETreePath path, gint col, - gconstpointer val, gpointer model_data) +ml_tree_set_value_at (ETreeModel *etm, + ETreePath path, + gint col, + gconstpointer val, + gpointer model_data) { g_warning ("This shouldn't be reached\n"); } static gboolean -ml_tree_is_cell_editable (ETreeModel *etm, ETreePath path, gint col, gpointer model_data) +ml_tree_is_cell_editable (ETreeModel *etm, + ETreePath path, + gint col, + gpointer model_data) { return FALSE; } @@ -1905,13 +1983,13 @@ static ECell * create_composite_cell (gint col) cell_date = e_cell_date_new (NULL, GTK_JUSTIFY_RIGHT); e_cell_date_set_format_component (E_CELL_DATE (cell_date), "mail"); - g_object_set (G_OBJECT (cell_date), + g_object_set (cell_date, "bold_column", COL_UNREAD, "color_column", COL_COLOUR, NULL); cell_from = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); - g_object_set (G_OBJECT (cell_from), + g_object_set (cell_from, "bold_column", COL_UNREAD, "color_column", COL_COLOUR, NULL); @@ -1923,9 +2001,8 @@ static ECell * create_composite_cell (gint col) g_object_unref (cell_attach); g_object_unref (cell_date); - cell_sub = e_cell_text_new (fixed_name? fixed_name:NULL, GTK_JUSTIFY_LEFT); - g_object_set (G_OBJECT (cell_sub), -/* "bold_column", COL_UNREAD, */ + cell_sub = e_cell_text_new (fixed_name? fixed_name : NULL, GTK_JUSTIFY_LEFT); + g_object_set (cell_sub, "color_column", COL_COLOUR, NULL); cell_tree = e_cell_tree_new (TRUE, cell_sub); @@ -1945,10 +2022,11 @@ static ECell * create_composite_cell (gint col) } static void -composite_cell_set_strike_col (ECell *cell, gint col) +composite_cell_set_strike_col (ECell *cell, + gint col) { - g_object_set (G_OBJECT (g_object_get_data(G_OBJECT (cell), "cell_date")), "strikeout_column", col, NULL); - g_object_set (G_OBJECT (g_object_get_data(G_OBJECT (cell), "cell_from")), "strikeout_column", col, NULL); + g_object_set (g_object_get_data(G_OBJECT (cell), "cell_date"), "strikeout_column", col, NULL); + g_object_set (g_object_get_data(G_OBJECT (cell), "cell_from"), "strikeout_column", col, NULL); } static ETableExtras * @@ -1994,7 +2072,7 @@ message_list_create_extras (void) /* date cell */ cell = e_cell_date_new (NULL, GTK_JUSTIFY_LEFT); e_cell_date_set_format_component (E_CELL_DATE (cell), "mail"); - g_object_set (G_OBJECT (cell), + g_object_set (cell, "bold_column", COL_UNREAD, "color_column", COL_COLOUR, NULL); @@ -2003,7 +2081,7 @@ message_list_create_extras (void) /* text cell */ cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); - g_object_set (G_OBJECT (cell), + g_object_set (cell, "bold_column", COL_UNREAD, "color_column", COL_COLOUR, NULL); @@ -2016,7 +2094,7 @@ message_list_create_extras (void) /* size cell */ cell = e_cell_size_new (NULL, GTK_JUSTIFY_RIGHT); - g_object_set (G_OBJECT (cell), + g_object_set (cell, "bold_column", COL_UNREAD, "color_column", COL_COLOUR, NULL); @@ -2055,7 +2133,8 @@ save_tree_state (MessageList *ml) } static void -load_tree_state (MessageList *ml, xmlDoc *expand_state) +load_tree_state (MessageList *ml, + xmlDoc *expand_state) { if (ml->folder == NULL) return; @@ -2081,7 +2160,8 @@ message_list_save_state (MessageList *ml) } static void -message_list_setup_etree (MessageList *message_list, gboolean outgoing) +message_list_setup_etree (MessageList *message_list, + gboolean outgoing) { /* build the spec based on the folder, and possibly from a saved file */ /* otherwise, leave default */ @@ -2100,7 +2180,11 @@ message_list_setup_etree (MessageList *message_list, gboolean outgoing) } static void -ml_selection_get (GtkWidget *widget, GtkSelectionData *data, guint info, guint time_stamp, MessageList *ml) +ml_selection_get (GtkWidget *widget, + GtkSelectionData *data, + guint info, + guint time_stamp, + MessageList *ml) { struct _MLSelection *selection; @@ -2121,7 +2205,9 @@ ml_selection_get (GtkWidget *widget, GtkSelectionData *data, guint info, guint t } static gboolean -ml_selection_clear_event (GtkWidget *widget, GdkEventSelection *event, MessageList *ml) +ml_selection_clear_event (GtkWidget *widget, + GdkEventSelection *event, + MessageList *ml) { MessageListPrivate *p = ml->priv; @@ -2157,9 +2243,15 @@ ml_selection_received (GtkWidget *widget, } static void -ml_tree_drag_data_get (ETree *tree, gint row, ETreePath path, gint col, - GdkDragContext *context, GtkSelectionData *data, - guint info, guint time, MessageList *ml) +ml_tree_drag_data_get (ETree *tree, + gint row, + ETreePath path, + gint col, + GdkDragContext *context, + GtkSelectionData *data, + guint info, + guint time, + MessageList *ml) { GPtrArray *uids; @@ -2195,9 +2287,9 @@ struct _drop_msg { guint32 action; guint info; - guint move:1; - guint moved:1; - guint aborted:1; + guint move : 1; + guint moved : 1; + guint aborted : 1; }; static gchar * @@ -2324,7 +2416,8 @@ struct search_child_struct { }; static void -search_child_cb (GtkWidget *widget, gpointer data) +search_child_cb (GtkWidget *widget, + gpointer data) { struct search_child_struct *search = (struct search_child_struct *) data; @@ -2332,7 +2425,8 @@ search_child_cb (GtkWidget *widget, gpointer data) } static gboolean -is_tree_widget_children (ETree *tree, gconstpointer widget) +is_tree_widget_children (ETree *tree, + gconstpointer widget) { struct search_child_struct search; @@ -2345,7 +2439,12 @@ is_tree_widget_children (ETree *tree, gconstpointer widget) } static gboolean -ml_tree_drag_motion (ETree *tree, GdkDragContext *context, gint x, gint y, guint time, MessageList *ml) +ml_tree_drag_motion (ETree *tree, + GdkDragContext *context, + gint x, + gint y, + guint time, + MessageList *ml) { GList *targets; GdkDragAction action, actions = 0; @@ -2399,13 +2498,16 @@ ml_tree_drag_motion (ETree *tree, GdkDragContext *context, gint x, gint y, guint } static void -on_model_row_changed (ETableModel *model, gint row, MessageList *ml) +on_model_row_changed (ETableModel *model, + gint row, + MessageList *ml) { ml->priv->any_row_changed = TRUE; } static gboolean -ml_tree_sorting_changed (ETreeTableAdapter *adapter, MessageList *ml) +ml_tree_sorting_changed (ETreeTableAdapter *adapter, + MessageList *ml) { g_return_val_if_fail (ml != NULL, FALSE); @@ -2479,9 +2581,9 @@ message_list_init (MessageList *message_list) gtk_selection_add_target (p->invisible, GDK_SELECTION_CLIPBOARD, matom, 0); gtk_selection_add_target (p->invisible, GDK_SELECTION_CLIPBOARD, GDK_SELECTION_TYPE_STRING, 2); - g_signal_connect(p->invisible, "selection_get", G_CALLBACK(ml_selection_get), message_list); - g_signal_connect(p->invisible, "selection_clear_event", G_CALLBACK(ml_selection_clear_event), message_list); - g_signal_connect(p->invisible, "selection_received", G_CALLBACK(ml_selection_received), message_list); + g_signal_connect (p->invisible, "selection_get", G_CALLBACK(ml_selection_get), message_list); + g_signal_connect (p->invisible, "selection_clear_event", G_CALLBACK(ml_selection_clear_event), message_list); + g_signal_connect (p->invisible, "selection_received", G_CALLBACK(ml_selection_received), message_list); /* FIXME This is currently unused. */ target_list = gtk_target_list_new (NULL, 0); @@ -2729,7 +2831,9 @@ message_list_selectable_init (ESelectableInterface *interface) } static gboolean -read_boolean_with_default (GConfClient *gconf, const gchar *key, gboolean def_value) +read_boolean_with_default (GConfClient *gconf, + const gchar *key, + gboolean def_value) { GConfValue *value; gboolean res; @@ -2828,7 +2932,7 @@ message_list_construct (MessageList *message_list) e_tree_drag_source_set ( E_TREE (message_list), GDK_BUTTON1_MASK, ml_drag_types, G_N_ELEMENTS (ml_drag_types), - GDK_ACTION_MOVE|GDK_ACTION_COPY); + GDK_ACTION_MOVE | GDK_ACTION_COPY); g_signal_connect ( message_list, "tree_drag_data_get", @@ -2837,7 +2941,7 @@ message_list_construct (MessageList *message_list) e_tree_drag_dest_set ( E_TREE (message_list), GTK_DEST_DEFAULT_ALL, ml_drop_types, G_N_ELEMENTS (ml_drop_types), - GDK_ACTION_MOVE|GDK_ACTION_COPY); + GDK_ACTION_MOVE | GDK_ACTION_COPY); g_signal_connect ( message_list, "tree_drag_data_received", @@ -2920,7 +3024,9 @@ message_list_get_backend (MessageList *message_list) } static void -clear_info (gchar *key, ETreePath *node, MessageList *ml) +clear_info (gchar *key, + ETreePath *node, + MessageList *ml) { CamelMessageInfo *info; @@ -2930,13 +3036,14 @@ clear_info (gchar *key, ETreePath *node, MessageList *ml) } static void -clear_tree (MessageList *ml, gboolean tfree) +clear_tree (MessageList *ml, + gboolean tfree) { ETreeModel *etm = ml->model; #ifdef TIMEIT struct timeval start, end; - unsigned long diff; + gulong diff; printf("Clearing tree\n"); gettimeofday (&start, NULL); @@ -2963,8 +3070,8 @@ clear_tree (MessageList *ml, gboolean tfree) e_tree_model_rebuilt (E_TREE_MODEL (etm)); #ifdef TIMEIT gettimeofday (&end, NULL); - diff = end.tv_sec * 1000 + end.tv_usec/1000; - diff -= start.tv_sec * 1000 + start.tv_usec/1000; + diff = end.tv_sec * 1000 + end.tv_usec / 1000; + diff -= start.tv_sec * 1000 + start.tv_usec / 1000; printf("Clearing tree took %ld.%03ld seconds\n", diff / 1000, diff % 1000); #endif @@ -2987,7 +3094,8 @@ folder_store_supports_vjunk_folder (CamelFolder *folder) /* Check if the given node is selectable in the current message list, * which depends on the type of the folder (normal, junk, trash). */ static gboolean -is_node_selectable (MessageList *ml, CamelMessageInfo *info) +is_node_selectable (MessageList *ml, + CamelMessageInfo *info) { gboolean is_junk_folder; gboolean is_trash_folder; @@ -3073,7 +3181,7 @@ find_next_selectable (MessageList *ml) } /* We didn't find any undeleted entries _below_ the currently selected one - * so let's try to find one _above_ */ + * * so let's try to find one _above_ */ vrow = vrow_orig - 1; while (vrow >= 0) { @@ -3164,7 +3272,9 @@ static void build_subtree (MessageList *ml, ETreePath parent, CamelFolderThreadN static void build_subtree_diff (MessageList *ml, ETreePath parent, ETreePath path, CamelFolderThreadNode *c, gint *row); static void -build_tree (MessageList *ml, CamelFolderThread *thread, CamelFolderChangeInfo *changes) +build_tree (MessageList *ml, + CamelFolderThread *thread, + CamelFolderChangeInfo *changes) { gint row = 0; ETreeModel *etm = ml->model; @@ -3177,7 +3287,7 @@ build_tree (MessageList *ml, CamelFolderThread *thread, CamelFolderChangeInfo *c #endif #ifdef TIMEIT struct timeval start, end; - unsigned long diff; + gulong diff; printf("Building tree\n"); gettimeofday (&start, NULL); @@ -3185,8 +3295,8 @@ build_tree (MessageList *ml, CamelFolderThread *thread, CamelFolderChangeInfo *c #ifdef TIMEIT gettimeofday (&end, NULL); - diff = end.tv_sec * 1000 + end.tv_usec/1000; - diff -= start.tv_sec * 1000 + start.tv_usec/1000; + diff = end.tv_sec * 1000 + end.tv_usec / 1000; + diff -= start.tv_sec * 1000 + start.tv_usec / 1000; printf("Loading tree state took %ld.%03ld seconds\n", diff / 1000, diff % 1000); #endif @@ -3238,18 +3348,21 @@ build_tree (MessageList *ml, CamelFolderThread *thread, CamelFolderChangeInfo *c #ifdef TIMEIT gettimeofday (&end, NULL); - diff = end.tv_sec * 1000 + end.tv_usec/1000; - diff -= start.tv_sec * 1000 + start.tv_usec/1000; + diff = end.tv_sec * 1000 + end.tv_usec / 1000; + diff -= start.tv_sec * 1000 + start.tv_usec / 1000; printf("Building tree took %ld.%03ld seconds\n", diff / 1000, diff % 1000); #endif } /* this is about 20% faster than build_subtree_diff, - entirely because e_tree_model_node_insert (xx, -1 xx) - is faster than inserting to the right row :( */ + * entirely because e_tree_model_node_insert (xx, -1 xx) + * is faster than inserting to the right row :( */ /* Otherwise, this code would probably go as it does the same thing essentially */ static void -build_subtree (MessageList *ml, ETreePath parent, CamelFolderThreadNode *c, gint *row) +build_subtree (MessageList *ml, + ETreePath parent, + CamelFolderThreadNode *c, + gint *row) { ETreePath node; @@ -3272,15 +3385,17 @@ build_subtree (MessageList *ml, ETreePath parent, CamelFolderThreadNode *c, gint } /* compares a thread tree node with the etable tree node to see if they point to - the same object */ + * the same object */ static gint -node_equal (ETreeModel *etm, ETreePath ap, CamelFolderThreadNode *bp) +node_equal (ETreeModel *etm, + ETreePath ap, + CamelFolderThreadNode *bp) { CamelMessageInfo *info; info = e_tree_memory_node_get_data (E_TREE_MEMORY (etm), ap); - if (bp->message && strcmp (camel_message_info_uid (info), camel_message_info_uid (bp->message))==0) + if (bp->message && strcmp (camel_message_info_uid (info), camel_message_info_uid (bp->message)) == 0) return 1; return 0; @@ -3289,7 +3404,9 @@ node_equal (ETreeModel *etm, ETreePath ap, CamelFolderThreadNode *bp) #ifndef BROKEN_ETREE /* debug function - compare the two trees to see if they are the same */ static gint -tree_equal (ETreeModel *etm, ETreePath ap, CamelFolderThreadNode *bp) +tree_equal (ETreeModel *etm, + ETreePath ap, + CamelFolderThreadNode *bp) { CamelMessageInfo *info; @@ -3329,7 +3446,12 @@ tree_equal (ETreeModel *etm, ETreePath ap, CamelFolderThreadNode *bp) /* adds a single node, retains save state, and handles adding children if required */ static void -add_node_diff (MessageList *ml, ETreePath parent, ETreePath path, CamelFolderThreadNode *c, gint *row, gint myrow) +add_node_diff (MessageList *ml, + ETreePath parent, + ETreePath path, + CamelFolderThreadNode *c, + gint *row, + gint myrow) { CamelMessageInfo *info; ETreePath node; @@ -3351,7 +3473,9 @@ add_node_diff (MessageList *ml, ETreePath parent, ETreePath path, CamelFolderThr /* removes node, children recursively and all associated data */ static void -remove_node_diff (MessageList *ml, ETreePath node, gint depth) +remove_node_diff (MessageList *ml, + ETreePath node, + gint depth) { ETreeModel *etm = ml->model; ETreePath cp, cn; @@ -3363,7 +3487,7 @@ remove_node_diff (MessageList *ml, ETreePath node, gint depth) cp = e_tree_model_node_get_first_child (etm, node); while (cp) { cn = e_tree_model_node_get_next (etm, cp); - remove_node_diff (ml, cp, depth+1); + remove_node_diff (ml, cp, depth + 1); cp = cn; } @@ -3379,9 +3503,13 @@ remove_node_diff (MessageList *ml, ETreePath node, gint depth) } /* applies a new tree structure to an existing tree, but only by changing things - that have changed */ + * that have changed */ static void -build_subtree_diff (MessageList *ml, ETreePath parent, ETreePath path, CamelFolderThreadNode *c, gint *row) +build_subtree_diff (MessageList *ml, + ETreePath parent, + ETreePath path, + CamelFolderThreadNode *c, + gint *row) { ETreeModel *etm = ml->model; ETreePath ap, *ai, *at, *tmp; @@ -3435,15 +3563,15 @@ build_subtree_diff (MessageList *ml, ETreePath parent, ETreePath path, CamelFold /* we have to scan each side for a match */ bi = bp->next; ai = e_tree_model_node_get_next (etm, ap); - for (i=1;bi!=NULL;i++,bi=bi->next) { + for (i = 1; bi != NULL; i++,bi = bi->next) { if (node_equal (etm, ap, bi)) break; } - for (j=1;ai!=NULL;j++,ai=e_tree_model_node_get_next (etm, ai)) { + for (j = 1; ai != NULL; j++,ai = e_tree_model_node_get_next (etm, ai)) { if (node_equal (etm, ai, bp)) break; } - if (i<j) { + if (i < j) { /* smaller run of new nodes - must be nodes to add */ if (bi) { bt = bp; @@ -3494,7 +3622,9 @@ static void build_flat_diff (MessageList *ml, CamelFolderChangeInfo *changes); #endif static void -build_flat (MessageList *ml, GPtrArray *summary, CamelFolderChangeInfo *changes) +build_flat (MessageList *ml, + GPtrArray *summary, + CamelFolderChangeInfo *changes) { ETreeModel *etm = ml->model; gchar *saveuid = NULL; @@ -3504,7 +3634,7 @@ build_flat (MessageList *ml, GPtrArray *summary, CamelFolderChangeInfo *changes) #endif #ifdef TIMEIT struct timeval start, end; - unsigned long diff; + gulong diff; printf("Building flat\n"); gettimeofday (&start, NULL); @@ -3549,15 +3679,16 @@ build_flat (MessageList *ml, GPtrArray *summary, CamelFolderChangeInfo *changes) #ifdef TIMEIT gettimeofday (&end, NULL); - diff = end.tv_sec * 1000 + end.tv_usec/1000; - diff -= start.tv_sec * 1000 + start.tv_usec/1000; + diff = end.tv_sec * 1000 + end.tv_usec / 1000; + diff -= start.tv_sec * 1000 + start.tv_usec / 1000; printf("Building flat took %ld.%03ld seconds\n", diff / 1000, diff % 1000); #endif } static void -message_list_change_first_visible_parent (MessageList *ml, ETreePath node) +message_list_change_first_visible_parent (MessageList *ml, + ETreePath node) { ETreePath first_visible = NULL; @@ -3575,7 +3706,8 @@ message_list_change_first_visible_parent (MessageList *ml, ETreePath node) #ifndef BROKEN_ETREE static void -build_flat_diff (MessageList *ml, CamelFolderChangeInfo *changes) +build_flat_diff (MessageList *ml, + CamelFolderChangeInfo *changes) { gint i; ETreePath node; @@ -3583,7 +3715,7 @@ build_flat_diff (MessageList *ml, CamelFolderChangeInfo *changes) #ifdef TIMEIT struct timeval start, end; - unsigned long diff; + gulong diff; gettimeofday (&start, NULL); #endif @@ -3592,7 +3724,7 @@ build_flat_diff (MessageList *ml, CamelFolderChangeInfo *changes) /* remove individual nodes? */ d(printf("Removing messages from view:\n")); - for (i=0;i<changes->uid_removed->len;i++) { + for (i = 0; i < changes->uid_removed->len; i++) { node = g_hash_table_lookup (ml->uid_nodemap, changes->uid_removed->pdata[i]); if (node) { info = e_tree_memory_node_get_data (E_TREE_MEMORY (ml->model), node); @@ -3603,7 +3735,7 @@ build_flat_diff (MessageList *ml, CamelFolderChangeInfo *changes) /* add new nodes? - just append to the end */ d(printf("Adding messages to view:\n")); - for (i=0;i<changes->uid_added->len;i++) { + for (i = 0; i < changes->uid_added->len; i++) { info = camel_folder_get_message_info (ml->folder, changes->uid_added->pdata[i]); if (info) { d(printf(" %s\n", (gchar *)changes->uid_added->pdata[i])); @@ -3625,8 +3757,8 @@ build_flat_diff (MessageList *ml, CamelFolderChangeInfo *changes) #ifdef TIMEIT gettimeofday (&end, NULL); - diff = end.tv_sec * 1000 + end.tv_usec/1000; - diff -= start.tv_sec * 1000 + start.tv_usec/1000; + diff = end.tv_sec * 1000 + end.tv_usec / 1000; + diff -= start.tv_sec * 1000 + start.tv_usec / 1000; printf("Inserting changes took %ld.%03ld seconds\n", diff / 1000, diff % 1000); #endif @@ -3898,7 +4030,10 @@ on_cursor_activated_idle (gpointer data) } static void -on_cursor_activated_cmd (ETree *tree, gint row, ETreePath path, gpointer user_data) +on_cursor_activated_cmd (ETree *tree, + gint row, + ETreePath path, + gpointer user_data) { MessageList *message_list = MESSAGE_LIST (user_data); const gchar *new_uid; @@ -3908,11 +4043,12 @@ on_cursor_activated_cmd (ETree *tree, gint row, ETreePath path, gpointer user_da else new_uid = get_message_uid (message_list, path); - /* Do not check the cursor_uid and the new_uid values, because the selected item - (set in on_selection_changed_cmd) can be different from the one with a cursor - (when selecting with Ctrl, for example). This has a little side-effect, when - keeping list it that state, then changing folders forth and back will select - and move cursor to that selected item. Does anybody consider it as a bug? */ + /* Do not check the cursor_uid and the new_uid values, because the + * selected item (set in on_selection_changed_cmd) can be different + * from the one with a cursor (when selecting with Ctrl, for example). + * This has a little side-effect, when keeping list it that state, + * then changing folders forth and back will select and move cursor + * to that selected item. Does anybody consider it as a bug? */ if ((message_list->cursor_uid == NULL && new_uid == NULL) || (message_list->last_sel_single && message_list->cursor_uid != NULL && new_uid != NULL)) return; @@ -3928,14 +4064,15 @@ on_cursor_activated_cmd (ETree *tree, gint row, ETreePath path, gpointer user_da } static void -on_selection_changed_cmd (ETree *tree, MessageList *ml) +on_selection_changed_cmd (ETree *tree, + MessageList *ml) { GPtrArray *uids; const gchar *newuid; ETreePath cursor; /* not sure if we could just ignore this for the cursor, i think sometimes you - only get a selection changed when you should also get a cursor activated? */ + * only get a selection changed when you should also get a cursor activated? */ uids = message_list_get_selected (ml); if (uids->len == 1) newuid = g_ptr_array_index (uids, 0); @@ -3945,8 +4082,8 @@ on_selection_changed_cmd (ETree *tree, MessageList *ml) newuid = NULL; /* If the selection isn't empty, then we ignore the no-uid check, since this event - is also used for other updating. If it is empty, it might just be a setup event - from etree which we do need to ignore */ + * is also used for other updating. If it is empty, it might just be a setup event + * from etree which we do need to ignore */ if ((newuid == NULL && ml->cursor_uid == NULL && uids->len == 0) || (ml->last_sel_single && uids->len == 1 && newuid != NULL && ml->cursor_uid != NULL && !strcmp (ml->cursor_uid, newuid))) { /* noop */ @@ -3963,7 +4100,12 @@ on_selection_changed_cmd (ETree *tree, MessageList *ml) } static gint -on_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, MessageList *list) +on_click (ETree *tree, + gint row, + ETreePath path, + gint col, + GdkEvent *event, + MessageList *list) { CamelMessageInfo *info; gboolean folder_is_trash; @@ -4053,7 +4195,8 @@ struct _ml_selected_data { }; static void -ml_getselected_cb (ETreePath path, gpointer user_data) +ml_getselected_cb (ETreePath path, + gpointer user_data) { struct _ml_selected_data *data = user_data; const gchar *uid; @@ -4099,7 +4242,8 @@ message_list_get_selected (MessageList *ml) } void -message_list_set_selected (MessageList *ml, GPtrArray *uids) +message_list_set_selected (MessageList *ml, + GPtrArray *uids) { gint i; ETreeSelectionModel *etsm; @@ -4107,7 +4251,7 @@ message_list_set_selected (MessageList *ml, GPtrArray *uids) GPtrArray *paths = g_ptr_array_new (); etsm = (ETreeSelectionModel *) e_tree_get_selection_model (E_TREE (ml)); - for (i=0; i<uids->len; i++) { + for (i = 0; i < uids->len; i++) { node = g_hash_table_lookup (ml->uid_nodemap, uids->pdata[i]); if (node) g_ptr_array_add (paths, node); @@ -4123,7 +4267,8 @@ struct ml_count_data { }; static void -ml_getcount_cb (ETreePath path, gpointer user_data) +ml_getcount_cb (ETreePath path, + gpointer user_data) { struct ml_count_data *data = user_data; @@ -4187,7 +4332,8 @@ message_list_set_threaded_collapse_all (MessageList *ml) } void -message_list_set_threaded (MessageList *ml, gboolean threaded) +message_list_set_threaded (MessageList *ml, + gboolean threaded) { if (ml->threaded != threaded) { ml->threaded = threaded; @@ -4198,7 +4344,8 @@ message_list_set_threaded (MessageList *ml, gboolean threaded) } void -message_list_set_hidedeleted (MessageList *ml, gboolean hidedeleted) +message_list_set_hidedeleted (MessageList *ml, + gboolean hidedeleted) { if (ml->hidedeleted != hidedeleted) { ml->hidedeleted = hidedeleted; @@ -4209,7 +4356,8 @@ message_list_set_hidedeleted (MessageList *ml, gboolean hidedeleted) } void -message_list_set_search (MessageList *ml, const gchar *search) +message_list_set_search (MessageList *ml, + const gchar *search) { #if HAVE_CLUTTER if (ml->priv->timeline == NULL) { @@ -4290,7 +4438,8 @@ message_list_set_search (MessageList *ml, const gchar *search) /* will ensure that the message with UID uid will be in the message list after the next rebuild */ void -message_list_ensure_message (MessageList *ml, const gchar *uid) +message_list_ensure_message (MessageList *ml, + const gchar *uid) { g_return_if_fail (ml != NULL); @@ -4317,7 +4466,9 @@ struct sort_array_data { }; static gint -cmp_array_uids (gconstpointer a, gconstpointer b, gpointer user_data) +cmp_array_uids (gconstpointer a, + gconstpointer b, + gpointer user_data) { const gchar *uid1 = *(const gchar **) a; const gchar *uid2 = *(const gchar **) b; @@ -4373,11 +4524,13 @@ cmp_array_uids (gconstpointer a, gconstpointer b, gpointer user_data) } static void -free_message_info_data (gpointer uid, struct sort_message_info_data *data, struct sort_array_data *sort_data) +free_message_info_data (gpointer uid, + struct sort_message_info_data *data, + struct sort_array_data *sort_data) { if (data->values) { /* values in this array are not newly allocated, even ml_tree_value_at_ex - returns gpointer, not a gconstpointer */ + * returns gpointer, not a gconstpointer */ g_ptr_array_free (data->values, TRUE); } @@ -4386,7 +4539,8 @@ free_message_info_data (gpointer uid, struct sort_message_info_data *data, struc } static void -ml_sort_uids_by_tree (MessageList *ml, GPtrArray *uids) +ml_sort_uids_by_tree (MessageList *ml, + GPtrArray *uids) { ETreeTableAdapter *adapter; ETableSortInfo *sort_info; @@ -4492,13 +4646,12 @@ struct _regen_list_msg { }; /* - maintain copy of summary - - any new messages added - any removed removed, etc. - - use vfolder to implement searches ??? - + * maintain copy of summary + * + * any new messages added + * any removed removed, etc. + * + * use vfolder to implement searches ??? */ static gchar * @@ -4566,8 +4719,8 @@ regen_list_exec (struct _regen_list_msg *m, searchuids = uids = camel_folder_search_by_expression ( m->folder, expr, &local_error); /* If m->changes is not NULL, then it means we are called from folder_changed event, - thus we will keep the selected message to be sure it doesn't disappear because - it no longer belong to our search filter. */ + * thus we will keep the selected message to be sure it doesn't disappear because + * it no longer belong to our search filter. */ if (uids && ((m->changes && m->ml->cursor_uid) || m->ml->ensure_uid)) { const gchar *looking_for = m->ml->cursor_uid; /* ensure_uid has precedence of cursor_uid */ @@ -4588,10 +4741,10 @@ regen_list_exec (struct _regen_list_msg *m, gboolean is_junk = store_has_vjunk && (camel_message_info_flags (looking_info) & CAMEL_MESSAGE_JUNK) != 0; /* I would really like to check for CAMEL_MESSAGE_FOLDER_FLAGGED on a message, - so I would know whether it was changed locally, and then just check the changes - struct whether change came from the server, but with periodical save it doesn't - matter. So here just check whether the file was deleted and we show it based - on the flag whether we can view deleted messages or not. */ + * so I would know whether it was changed locally, and then just check the changes + * struct whether change came from the server, but with periodical save it doesn't + * matter. So here just check whether the file was deleted and we show it based + * on the flag whether we can view deleted messages or not. */ if ((!is_deleted || (is_deleted && !m->hidedel)) && (!is_junk || (is_junk && !m->hidejunk))) g_ptr_array_add (uids, (gpointer) camel_pstring_strdup (looking_for)); @@ -4860,7 +5013,11 @@ mail_regen_cancel (MessageList *ml) } static void -mail_regen_list (MessageList *ml, const gchar *search, const gchar *hideexpr, CamelFolderChangeInfo *changes, gboolean scroll_to_cursor) +mail_regen_list (MessageList *ml, + const gchar *search, + const gchar *hideexpr, + CamelFolderChangeInfo *changes, + gboolean scroll_to_cursor) { struct _regen_list_msg *m; GConfClient *client; @@ -4931,7 +5088,7 @@ mail_regen_list (MessageList *ml, const gchar *search, const gchar *hideexpr, Ca } } else if (ml->priv->any_row_changed && m->dotree && !ml->just_set_folder && (!ml->search || g_str_equal (ml->search, " "))) { /* there has been some change on any row, if it was an expand state change, - then let it save; if not, then nothing happen. */ + * then let it save; if not, then nothing happen. */ message_list_save_state (ml); } else if (m->dotree && !ml->just_set_folder) { /* remember actual expand state and restore it after regen */ diff --git a/mail/message-list.h b/mail/message-list.h index f4a8150e1f..d0c8a55303 100644 --- a/mail/message-list.h +++ b/mail/message-list.h @@ -135,7 +135,7 @@ struct _MessageList { guint hidejunk : 1; /* frozen count */ - guint frozen:16; + guint frozen : 16; /* Where the ETree cursor is. */ gchar *cursor_uid; |