diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-09-27 13:13:42 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2011-09-27 21:31:13 +0800 |
commit | e2b6ff7a6c1e1580c26ee0719b349151e8dad6fd (patch) | |
tree | d2d2ce8eb509717d412ad3171059e470ff0e7030 | |
parent | c520043a094d81d222aa0c3e23b0035ddb89d0bf (diff) | |
download | gsoc2013-evolution-e2b6ff7a6c1e1580c26ee0719b349151e8dad6fd.tar.gz gsoc2013-evolution-e2b6ff7a6c1e1580c26ee0719b349151e8dad6fd.tar.zst gsoc2013-evolution-e2b6ff7a6c1e1580c26ee0719b349151e8dad6fd.zip |
Miscellaneous cleanups from the account-mgmt branch.
Reducing diff noise so I can see important changes easier when comparing
branches. A few API changes, but nothing that affects functionality.
101 files changed, 1110 insertions, 847 deletions
diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c index 96af36fed2..3595437f28 100644 --- a/addressbook/gui/contact-editor/e-contact-quick-add.c +++ b/addressbook/gui/contact-editor/e-contact-quick-add.c @@ -411,6 +411,7 @@ source_changed (ESourceComboBox *source_combo_box, ESource *source; source = e_source_combo_box_get_active (source_combo_box); + if (source != NULL) { if (qa->source != NULL) g_object_unref (qa->source); @@ -472,6 +473,7 @@ build_quick_add_dialog (QuickAdd *qa) gconf_client, "/apps/evolution/addressbook/sources"); source = e_source_list_peek_default_source (qa->source_list); g_object_unref (gconf_client); + qa->combo_box = e_source_combo_box_new (qa->source_list); e_source_combo_box_set_active ( E_SOURCE_COMBO_BOX (qa->combo_box), source); diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.h b/addressbook/gui/contact-editor/e-contact-quick-add.h index a4d06ef12a..861ddba24d 100644 --- a/addressbook/gui/contact-editor/e-contact-quick-add.h +++ b/addressbook/gui/contact-editor/e-contact-quick-add.h @@ -25,16 +25,22 @@ #include <libebook/e-contact.h> -typedef void (*EContactQuickAddCallback) (EContact *new_contact, gpointer closure); - -void e_contact_quick_add (const gchar *name, const gchar *email, - EContactQuickAddCallback cb, gpointer closure); - -void e_contact_quick_add_free_form (const gchar *text, EContactQuickAddCallback cb, gpointer closure); - -void e_contact_quick_add_email (const gchar *email, EContactQuickAddCallback cb, gpointer closure); - -void e_contact_quick_add_vcard (const gchar *vcard, EContactQuickAddCallback cb, gpointer closure); +typedef void (*EContactQuickAddCallback) (EContact *new_contact, + gpointer closure); + +void e_contact_quick_add (const gchar *name, + const gchar *email, + EContactQuickAddCallback cb, + gpointer closure); +void e_contact_quick_add_free_form (const gchar *text, + EContactQuickAddCallback cb, + gpointer closure); +void e_contact_quick_add_email (const gchar *email, + EContactQuickAddCallback cb, + gpointer closure); +void e_contact_quick_add_vcard (const gchar *vcard, + EContactQuickAddCallback cb, + gpointer closure); #endif /* __E_CONTACT_QUICK_ADD_H__ */ diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c b/addressbook/gui/contact-list-editor/e-contact-list-editor.c index 1750f5a686..d6a373ad38 100644 --- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c +++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c @@ -49,6 +49,10 @@ #include "e-contact-list-model.h" #include "eab-contact-merging.h" +#define E_CONTACT_LIST_EDITOR_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_CONTACT_LIST_EDITOR, EContactListEditorPrivate)) + #define CONTACT_LIST_EDITOR_WIDGET(editor, name) \ (e_builder_get_widget \ (E_CONTACT_LIST_EDITOR (editor)->priv->builder, name)) @@ -1341,6 +1345,76 @@ contact_list_editor_dispose (GObject *object) G_OBJECT_CLASS (parent_class)->dispose (object); } +static void +contact_list_editor_constructed (GObject *object) +{ + EContactListEditor *editor; + GtkTreeViewColumn *column; + GtkCellRenderer *renderer; + GtkTreeView *view; + GtkTreeSelection *selection; + + editor = E_CONTACT_LIST_EDITOR (object); + + /* Chain up to parent's constructed() method. */ + G_OBJECT_CLASS (parent_class)->constructed (object); + + editor->priv->editable = TRUE; + editor->priv->allows_contact_lists = TRUE; + + editor->priv->builder = gtk_builder_new (); + e_load_ui_builder_definition ( + editor->priv->builder, "contact-list-editor.ui"); + gtk_builder_connect_signals (editor->priv->builder, NULL); + + /* Embed a pointer to the EContactListEditor in the top-level + * widget. Signal handlers can then access the pointer from any + * child widget by calling contact_list_editor_extract(widget). */ + g_object_set_data (G_OBJECT (WIDGET (DIALOG)), TOPLEVEL_KEY, editor); + + view = GTK_TREE_VIEW (WIDGET (TREE_VIEW)); + editor->priv->model = e_contact_list_model_new (); + gtk_tree_view_set_model (view, editor->priv->model); + + selection = gtk_tree_view_get_selection (view); + gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE); + g_signal_connect (selection, "changed", + G_CALLBACK (contact_list_editor_selection_changed_cb), editor); + + gtk_tree_view_enable_model_drag_dest (view, NULL, 0, GDK_ACTION_LINK); + e_drag_dest_add_directory_targets (WIDGET (TREE_VIEW)); + gtk_drag_dest_add_text_targets (WIDGET (TREE_VIEW)); + + column = gtk_tree_view_column_new (); + renderer = gtk_cell_renderer_text_new (); + g_object_set (renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL); + gtk_tree_view_column_pack_start (column, renderer, TRUE); + gtk_tree_view_append_column (view, column); + + gtk_tree_view_column_set_cell_data_func ( + column, renderer, (GtkTreeCellDataFunc) + contact_list_editor_render_destination, NULL, NULL); + + editor->priv->name_selector = e_name_selector_new (); + + e_name_selector_model_add_section ( + e_name_selector_peek_model (editor->priv->name_selector), + "Members", _("_Members"), NULL); + + g_signal_connect ( + editor, "notify::book", + G_CALLBACK (contact_list_editor_notify_cb), NULL); + g_signal_connect ( + editor, "notify::editable", + G_CALLBACK (contact_list_editor_notify_cb), NULL); + + gtk_widget_show_all (WIDGET (DIALOG)); + + setup_custom_widgets (editor); + + e_name_selector_load_books (editor->priv->name_selector); +} + /**************************** EABEditor Callbacks ****************************/ static void @@ -1492,6 +1566,7 @@ contact_list_editor_class_init (EContactListEditorClass *class) object_class->set_property = contact_list_editor_set_property; object_class->get_property = contact_list_editor_get_property; object_class->dispose = contact_list_editor_dispose; + object_class->constructed = contact_list_editor_constructed; editor_class = EAB_EDITOR_CLASS (class); editor_class->show = contact_list_editor_show; @@ -1550,68 +1625,7 @@ contact_list_editor_class_init (EContactListEditorClass *class) static void contact_list_editor_init (EContactListEditor *editor) { - EContactListEditorPrivate *priv; - GtkTreeViewColumn *column; - GtkCellRenderer *renderer; - GtkTreeView *view; - GtkTreeSelection *selection; - - editor->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE ( - editor, E_TYPE_CONTACT_LIST_EDITOR, EContactListEditorPrivate); - - priv->editable = TRUE; - priv->allows_contact_lists = TRUE; - - priv->builder = gtk_builder_new (); - e_load_ui_builder_definition (priv->builder, "contact-list-editor.ui"); - gtk_builder_connect_signals (priv->builder, NULL); - - /* Embed a pointer to the EContactListEditor in the top-level - * widget. Signal handlers can then access the pointer from any - * child widget by calling contact_list_editor_extract(widget). */ - g_object_set_data (G_OBJECT (WIDGET (DIALOG)), TOPLEVEL_KEY, editor); - - view = GTK_TREE_VIEW (WIDGET (TREE_VIEW)); - priv->model = e_contact_list_model_new (); - gtk_tree_view_set_model (view, priv->model); - - selection = gtk_tree_view_get_selection (view); - gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE); - g_signal_connect (selection, "changed", - G_CALLBACK (contact_list_editor_selection_changed_cb), editor); - - gtk_tree_view_enable_model_drag_dest (view, NULL, 0, GDK_ACTION_LINK); - e_drag_dest_add_directory_targets (WIDGET (TREE_VIEW)); - gtk_drag_dest_add_text_targets (WIDGET (TREE_VIEW)); - - column = gtk_tree_view_column_new (); - renderer = gtk_cell_renderer_text_new (); - g_object_set (renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL); - gtk_tree_view_column_pack_start (column, renderer, TRUE); - gtk_tree_view_append_column (view, column); - - gtk_tree_view_column_set_cell_data_func ( - column, renderer, (GtkTreeCellDataFunc) - contact_list_editor_render_destination, NULL, NULL); - - priv->name_selector = e_name_selector_new (); - - e_name_selector_model_add_section ( - e_name_selector_peek_model (priv->name_selector), - "Members", _("_Members"), NULL); - - g_signal_connect ( - editor, "notify::book", - G_CALLBACK (contact_list_editor_notify_cb), NULL); - g_signal_connect ( - editor, "notify::editable", - G_CALLBACK (contact_list_editor_notify_cb), NULL); - - gtk_widget_show_all (WIDGET (DIALOG)); - - setup_custom_widgets (editor); - - e_name_selector_load_books (priv->name_selector); + editor->priv = E_CONTACT_LIST_EDITOR_GET_PRIVATE (editor); } /***************************** Public Interface ******************************/ diff --git a/addressbook/gui/merging/eab-contact-compare.c b/addressbook/gui/merging/eab-contact-compare.c index a25ad4e403..231a14281c 100644 --- a/addressbook/gui/merging/eab-contact-compare.c +++ b/addressbook/gui/merging/eab-contact-compare.c @@ -834,7 +834,8 @@ eab_contact_locate_match_full (EBookClient *book_client, source = e_source_list_peek_default_source (info->source_list); - e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL, + e_client_utils_open_new ( + source, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL, e_client_utils_authenticate_handler, NULL, book_loaded_cb, info); } diff --git a/addressbook/gui/merging/eab-contact-compare.h b/addressbook/gui/merging/eab-contact-compare.h index 7ce31eddb9..8c07a56f08 100644 --- a/addressbook/gui/merging/eab-contact-compare.h +++ b/addressbook/gui/merging/eab-contact-compare.h @@ -26,8 +26,8 @@ #ifndef __EAB_CONTACT_COMPARE_H__ #define __EAB_CONTACT_COMPARE_H__ -#include <libebook/e-book-client.h> #include <libebook/e-contact.h> +#include <libebook/e-book-client.h> typedef enum { EAB_CONTACT_MATCH_NOT_APPLICABLE = 0, @@ -45,26 +45,56 @@ typedef enum { EAB_CONTACT_MATCH_PART_FAMILY_NAME = 1 << 3 } EABContactMatchPart; -typedef void (*EABContactMatchQueryCallback) (EContact *contact, EContact *match, EABContactMatchType type, gpointer closure); +typedef void (*EABContactMatchQueryCallback) (EContact *contact, + EContact *match, + EABContactMatchType type, + gpointer closure); -EABContactMatchType eab_contact_compare_name_to_string (EContact *contact, const gchar *str); +EABContactMatchType + eab_contact_compare_name_to_string + (EContact *contact, + const gchar *str); -EABContactMatchType eab_contact_compare_name_to_string_full (EContact *contact, const gchar *str, - gboolean allow_partial_matches, - gint *matched_parts, EABContactMatchPart *first_matched_part, - gint *matched_character_count); +EABContactMatchType + eab_contact_compare_name_to_string_full + (EContact *contact, + const gchar *str, + gboolean allow_partial_matches, + gint *matched_parts, + EABContactMatchPart *first_matched_part, + gint *matched_character_count); -EABContactMatchType eab_contact_compare_file_as (EContact *contact1, EContact *contact2); -EABContactMatchType eab_contact_compare_name (EContact *contact1, EContact *contact2); -EABContactMatchType eab_contact_compare_nickname (EContact *contact1, EContact *contact2); -EABContactMatchType eab_contact_compare_email (EContact *contact1, EContact *contact2); -EABContactMatchType eab_contact_compare_address (EContact *contact1, EContact *contact2); -EABContactMatchType eab_contact_compare_telephone (EContact *contact1, EContact *contact2); +EABContactMatchType + eab_contact_compare_file_as (EContact *contact1, + EContact *contact2); +EABContactMatchType + eab_contact_compare_name (EContact *contact1, + EContact *contact2); +EABContactMatchType + eab_contact_compare_nickname (EContact *contact1, + EContact *contact2); +EABContactMatchType + eab_contact_compare_email (EContact *contact1, + EContact *contact2); +EABContactMatchType + eab_contact_compare_address (EContact *contact1, + EContact *contact2); +EABContactMatchType + eab_contact_compare_telephone (EContact *contact1, + EContact *contact2); -EABContactMatchType eab_contact_compare (EContact *contact1, EContact *contact2); +EABContactMatchType + eab_contact_compare (EContact *contact1, + EContact *contact2); -void eab_contact_locate_match (EContact *contact, EABContactMatchQueryCallback cb, gpointer closure); -void eab_contact_locate_match_full (EBookClient *book_client, EContact *contact, GList *avoid, EABContactMatchQueryCallback cb, gpointer closure); +void eab_contact_locate_match (EContact *contact, + EABContactMatchQueryCallback cb, + gpointer closure); +void eab_contact_locate_match_full (EBookClient *book_client, + EContact *contact, + GList *avoid, + EABContactMatchQueryCallback cb, + gpointer closure); #endif /* __E_CONTACT_COMPARE_H__ */ diff --git a/addressbook/gui/merging/eab-contact-merging.c b/addressbook/gui/merging/eab-contact-merging.c index f791eab114..1e70b97d77 100644 --- a/addressbook/gui/merging/eab-contact-merging.c +++ b/addressbook/gui/merging/eab-contact-merging.c @@ -73,7 +73,10 @@ add_lookup (EContactMergingLookup *lookup) { if (running_merge_requests < SIMULTANEOUS_MERGING_REQUESTS) { running_merge_requests++; - eab_contact_locate_match_full (lookup->book_client, lookup->contact, lookup->avoid, match_query_callback, lookup); + eab_contact_locate_match_full ( + lookup->book_client, + lookup->contact, lookup->avoid, + match_query_callback, lookup); } else { merging_queue = g_list_append (merging_queue, lookup); @@ -97,8 +100,9 @@ finished_lookup (void) running_merge_requests++; eab_contact_locate_match_full ( - lookup->book_client, lookup->contact, - lookup->avoid, match_query_callback, lookup); + lookup->book_client, + lookup->contact, lookup->avoid, + match_query_callback, lookup); } } @@ -138,8 +142,8 @@ final_cb_as_id (EBookClient *book_client, if (lookup->id_cb) lookup->id_cb ( - lookup->book_client, error, - lookup->contact ? + lookup->book_client, + error, lookup->contact ? e_contact_get_const ( lookup->contact, E_CONTACT_UID) : NULL, lookup->closure); @@ -566,7 +570,11 @@ match_query_callback (EContact *contact, if (lookup->op == E_CONTACT_MERGING_FIND) { if (lookup->c_cb) - lookup->c_cb (lookup->book_client, NULL, (gint) type <= (gint) EAB_CONTACT_MATCH_VAGUE ? NULL : match, lookup->closure); + lookup->c_cb ( + lookup->book_client, NULL, + (gint) type <= (gint) + EAB_CONTACT_MATCH_VAGUE ? NULL : match, + lookup->closure); free_lookup (lookup); finished_lookup (); diff --git a/addressbook/gui/merging/eab-contact-merging.h b/addressbook/gui/merging/eab-contact-merging.h index c8e2ddb3ef..a922d6b9fb 100644 --- a/addressbook/gui/merging/eab-contact-merging.h +++ b/addressbook/gui/merging/eab-contact-merging.h @@ -30,9 +30,18 @@ G_BEGIN_DECLS -typedef void (*EABMergingAsyncCallback) (EBookClient *book_client, const GError *error, gpointer closure); -typedef void (*EABMergingIdAsyncCallback) (EBookClient *book_client, const GError *error, const gchar *id, gpointer closure); -typedef void (*EABMergingContactAsyncCallback) (EBookClient *book_client, const GError *error, EContact *contact, gpointer closure); +typedef void (*EABMergingAsyncCallback) (EBookClient *book_client, + const GError *error, + gpointer closure); +typedef void (*EABMergingIdAsyncCallback) (EBookClient *book_client, + const GError *error, + const gchar *id, + gpointer closure); +typedef void (*EABMergingContactAsyncCallback) + (EBookClient *book_client, + const GError *error, + EContact *contact, + gpointer closure); gboolean eab_merging_book_add_contact (EBookClient *book_client, EContact *contact, diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c index 74e794bd6e..fa61c4e5e2 100644 --- a/addressbook/gui/widgets/e-addressbook-model.c +++ b/addressbook/gui/widgets/e-addressbook-model.c @@ -576,7 +576,8 @@ addressbook_model_class_init (EAddressbookModelClass *class) "EBookClient", NULL, E_TYPE_BOOK_CLIENT, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); g_object_class_install_property ( object_class, @@ -586,7 +587,8 @@ addressbook_model_class_init (EAddressbookModelClass *class) "Editable", NULL, FALSE, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); g_object_class_install_property ( object_class, @@ -597,7 +599,8 @@ addressbook_model_class_init (EAddressbookModelClass *class) NULL, NULL, G_PARAM_READWRITE | - G_PARAM_CONSTRUCT)); + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); signals[WRITABLE_STATUS] = g_signal_new ("writable_status", diff --git a/addressbook/gui/widgets/e-addressbook-model.h b/addressbook/gui/widgets/e-addressbook-model.h index 13d23e92b0..680352c717 100644 --- a/addressbook/gui/widgets/e-addressbook-model.h +++ b/addressbook/gui/widgets/e-addressbook-model.h @@ -104,8 +104,10 @@ gint e_addressbook_model_find (EAddressbookModel *model, EBookClient * e_addressbook_model_get_client (EAddressbookModel *model); void e_addressbook_model_set_client (EAddressbookModel *model, EBookClient *book_client); -gboolean e_addressbook_model_get_editable (EAddressbookModel *model); -void e_addressbook_model_set_editable (EAddressbookModel *model, +gboolean e_addressbook_model_get_editable + (EAddressbookModel *model); +void e_addressbook_model_set_editable + (EAddressbookModel *model, gboolean editable); gchar * e_addressbook_model_get_query (EAddressbookModel *model); void e_addressbook_model_set_query (EAddressbookModel *model, diff --git a/addressbook/gui/widgets/e-addressbook-selector.c b/addressbook/gui/widgets/e-addressbook-selector.c index b6bfa01537..30bb8899f5 100644 --- a/addressbook/gui/widgets/e-addressbook-selector.c +++ b/addressbook/gui/widgets/e-addressbook-selector.c @@ -293,7 +293,8 @@ target_client_open_ready_cb (GObject *source_object, } eab_merging_book_add_contact ( - merge_context->target_client, merge_context->current_contact, + merge_context->target_client, + merge_context->current_contact, addressbook_selector_merge_next_cb, merge_context); } @@ -335,7 +336,8 @@ addressbook_selector_data_dropped (ESourceSelector *selector, merge_context->remove_from_source = remove_from_source; merge_context->pending_adds = TRUE; - e_client_utils_open_new (destination, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL, + e_client_utils_open_new ( + destination, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL, e_client_utils_authenticate_handler, NULL, target_client_open_ready_cb, merge_context); diff --git a/addressbook/gui/widgets/e-addressbook-table-adapter.c b/addressbook/gui/widgets/e-addressbook-table-adapter.c index f102b684d7..463bdc7a3d 100644 --- a/addressbook/gui/widgets/e-addressbook-table-adapter.c +++ b/addressbook/gui/widgets/e-addressbook-table-adapter.c @@ -168,8 +168,11 @@ addressbook_set_value_at (ETableModel *etc, EAddressbookTableAdapterPrivate *priv = adapter->priv; if (e_addressbook_model_get_editable (priv->model)) { + EBookClient *book_client; EContact *contact; + book_client = e_addressbook_model_get_client (priv->model); + if (col >= COLS || row >= e_addressbook_model_contact_count (priv->model)) return; @@ -191,7 +194,7 @@ addressbook_set_value_at (ETableModel *etc, e_contact_set (contact, col, (gpointer) val); eab_merging_book_modify_contact ( - e_addressbook_model_get_client (priv->model), + book_client, contact, contact_modified_cb, etc); g_object_unref (contact); @@ -218,8 +221,8 @@ addressbook_append_row (ETableModel *etm, { EAddressbookTableAdapter *adapter = EAB_TABLE_ADAPTER (etm); EAddressbookTableAdapterPrivate *priv = adapter->priv; - EContact *contact; EBookClient *book_client; + EContact *contact; gint col; contact = e_contact_new (); diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c index 7f3a7a85b8..9bda90a280 100644 --- a/addressbook/gui/widgets/e-addressbook-view.c +++ b/addressbook/gui/widgets/e-addressbook-view.c @@ -1111,7 +1111,7 @@ folder_bar_message (EAddressbookView *view, { EShellView *shell_view; EShellSidebar *shell_sidebar; - const gchar *name; + const gchar *display_name; shell_view = e_addressbook_view_get_shell_view (view); shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); @@ -1119,8 +1119,8 @@ folder_bar_message (EAddressbookView *view, if (view->priv->source == NULL) return; - name = e_source_peek_name (view->priv->source); - e_shell_sidebar_set_primary_text (shell_sidebar, name); + display_name = e_source_peek_name (view->priv->source); + e_shell_sidebar_set_primary_text (shell_sidebar, display_name); e_shell_sidebar_set_secondary_text (shell_sidebar, message); } @@ -1622,7 +1622,8 @@ view_transfer_contacts (EAddressbookView *view, contacts = e_addressbook_view_get_selected (view); eab_transfer_contacts ( - book_client, contacts, delete_from_source, alert_sink); + book_client, contacts, + delete_from_source, alert_sink); } } diff --git a/addressbook/gui/widgets/ea-minicard-view.c b/addressbook/gui/widgets/ea-minicard-view.c index 58d3a5fd2b..6772a0bf80 100644 --- a/addressbook/gui/widgets/ea-minicard-view.c +++ b/addressbook/gui/widgets/ea-minicard-view.c @@ -149,7 +149,8 @@ ea_minicard_view_get_name (AtkObject *accessible) gchar *string; EMinicardView *card_view; EBookClient *book_client = NULL; - const gchar *source_name; + ESource *source; + const gchar *display_name; g_return_val_if_fail (EA_IS_MINICARD_VIEW (accessible), NULL); @@ -163,13 +164,14 @@ ea_minicard_view_get_name (AtkObject *accessible) card_view = E_MINICARD_VIEW (reflow); g_object_get (card_view->adapter, "client", &book_client, NULL); g_return_val_if_fail (E_IS_BOOK_CLIENT (book_client), NULL); - source_name = e_source_peek_name (e_client_get_source (E_CLIENT (book_client))); - if (!source_name) - source_name=""; + source = e_client_get_source (E_CLIENT (book_client)); + display_name = e_source_peek_name (source); + if (display_name == NULL) + display_name = ""; string = g_strdup_printf (ngettext ("current address book folder %s has %d card", "current address book folder %s has %d cards", - reflow->count), source_name, reflow->count); + reflow->count), display_name, reflow->count); ATK_OBJECT_CLASS (parent_class)->set_name (accessible, string); g_free (string); @@ -372,7 +374,9 @@ static void atk_action_interface_init (AtkActionIface *iface) iface->get_name = atk_action_interface_get_name; } -static gboolean atk_action_interface_do_action (AtkAction *action, gint i) +static gboolean +atk_action_interface_do_action (AtkAction *action, + gint i) { gboolean return_value = TRUE; EMinicardView *card_view; @@ -405,7 +409,8 @@ static gboolean atk_action_interface_do_action (AtkAction *action, gint i) return return_value; } -static gint atk_action_interface_get_n_action (AtkAction *iface) +static gint +atk_action_interface_get_n_action (AtkAction *iface) { return G_N_ELEMENTS (action_name); } diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c index c951b290c7..00f4e884c7 100644 --- a/addressbook/gui/widgets/eab-gui-util.c +++ b/addressbook/gui/widgets/eab-gui-util.c @@ -34,13 +34,13 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> +#include <libebook/e-destination.h> #include <libedataserver/e-data-server-util.h> #include <libedataserverui/e-client-utils.h> #include <libedataserverui/e-source-selector.h> #include <e-util/e-util.h> #include "eab-gui-util.h" #include "util/eab-book-util.h" -#include <libebook/e-destination.h> #include "e-util/e-alert-dialog.h" #include "e-util/e-html-utils.h" #include "shell/e-shell.h" @@ -319,14 +319,18 @@ eab_select_source (ESource *except_source, selector = e_source_selector_new (source_list); e_source_selector_show_selection (E_SOURCE_SELECTOR (selector), FALSE); if (except_source) - g_object_set_data (G_OBJECT (ok_button), "except-source", e_source_list_peek_source_by_uid (source_list, e_source_peek_uid (except_source))); - g_signal_connect (selector, "primary_selection_changed", - G_CALLBACK (source_selection_changed_cb), ok_button); + g_object_set_data ( + G_OBJECT (ok_button), "except-source", + e_source_list_peek_source_by_uid (source_list, e_source_peek_uid (except_source))); + g_signal_connect ( + selector, "primary_selection_changed", + G_CALLBACK (source_selection_changed_cb), ok_button); if (select_uid) { source = e_source_list_peek_source_by_uid (source_list, select_uid); if (source) - e_source_selector_set_primary_selection (E_SOURCE_SELECTOR (selector), source); + e_source_selector_set_primary_selection ( + E_SOURCE_SELECTOR (selector), source); } scrolled_window = gtk_scrolled_window_new (NULL, NULL); @@ -493,7 +497,9 @@ do_copy (gpointer data, book_client = process->destination; process->count++; - eab_merging_book_add_contact (book_client, contact, contact_added_cb, process); + eab_merging_book_add_contact ( + book_client, + contact, contact_added_cb, process); } static void @@ -533,6 +539,7 @@ eab_transfer_contacts (EBookClient *source_client, gboolean delete_from_source, EAlertSink *alert_sink) { + ESource *source; ESource *destination; static gchar *last_uid = NULL; ContactCopyProcess *process; @@ -559,9 +566,10 @@ eab_transfer_contacts (EBookClient *source_client, desc = _("Copy contacts to"); } + source = e_client_get_source (E_CLIENT (source_client)); + destination = eab_select_source ( - e_client_get_source (E_CLIENT (source_client)), - desc, NULL, last_uid, window); + source, desc, NULL, last_uid, window); if (!destination) return; diff --git a/addressbook/importers/evolution-csv-importer.c b/addressbook/importers/evolution-csv-importer.c index f41a806940..20d0209f4b 100644 --- a/addressbook/importers/evolution-csv-importer.c +++ b/addressbook/importers/evolution-csv-importer.c @@ -40,7 +40,7 @@ #include <libebook/e-destination.h> -#include "e-util/e-import.h" +#include <e-util/e-import.h> #include "evolution-addressbook-importers.h" @@ -784,9 +784,12 @@ csv_getwidget (EImport *ei, if (primary == NULL) { primary = e_source_list_peek_source_any (source_list); g_object_ref (primary); - g_datalist_set_data_full(&target->data, "csv-source", primary, g_object_unref); + g_datalist_set_data_full ( + &target->data, "csv-source", primary, + (GDestroyNotify) g_object_unref); } - e_source_selector_set_primary_selection (E_SOURCE_SELECTOR (selector), primary); + e_source_selector_set_primary_selection ( + E_SOURCE_SELECTOR (selector), primary); g_object_unref (source_list); g_signal_connect ( diff --git a/addressbook/importers/evolution-ldif-importer.c b/addressbook/importers/evolution-ldif-importer.c index 8eb0c57192..989bb805f4 100644 --- a/addressbook/importers/evolution-ldif-importer.c +++ b/addressbook/importers/evolution-ldif-importer.c @@ -47,7 +47,7 @@ #include <libebook/e-destination.h> -#include "e-util/e-import.h" +#include <e-util/e-import.h> #include "evolution-addressbook-importers.h" diff --git a/addressbook/importers/evolution-vcard-importer.c b/addressbook/importers/evolution-vcard-importer.c index cf3a429337..be97f25c98 100644 --- a/addressbook/importers/evolution-vcard-importer.c +++ b/addressbook/importers/evolution-vcard-importer.c @@ -42,9 +42,9 @@ #include <util/eab-book-util.h> #include <libebook/e-destination.h> -#include "e-util/e-import.h" -#include "e-util/e-datetime-format.h" -#include "misc/e-web-view-preview.h" +#include <e-util/e-import.h> +#include <e-util/e-datetime-format.h> +#include <misc/e-web-view-preview.h> #include "evolution-addressbook-importers.h" diff --git a/addressbook/util/eab-book-util.c b/addressbook/util/eab-book-util.c index 5c8d3350fd..9839e5174f 100644 --- a/addressbook/util/eab-book-util.c +++ b/addressbook/util/eab-book-util.c @@ -180,7 +180,7 @@ eab_book_and_contact_list_from_string (const gchar *str, *book_client = e_book_client_new_from_uri (uri, NULL); g_free (uri); - return *book_client ? TRUE : FALSE; + return (*book_client != NULL); } gchar * @@ -193,11 +193,11 @@ eab_book_and_contact_list_to_string (EBookClient *book_client, if (!s0) s0 = g_strdup (""); - if (book_client) + if (book_client != NULL) { s1 = g_strconcat ( "Book: ", e_client_get_uri ( E_CLIENT (book_client)), "\r\n", s0, NULL); - else + } else s1 = g_strdup (s0); g_free (s0); diff --git a/addressbook/util/eab-book-util.h b/addressbook/util/eab-book-util.h index 602e7bd44b..4376863973 100644 --- a/addressbook/util/eab-book-util.h +++ b/addressbook/util/eab-book-util.h @@ -28,14 +28,21 @@ G_BEGIN_DECLS -GSList * eab_contact_list_from_string (const gchar *str); -gchar * eab_contact_list_to_string (const GSList *contacts); - -gboolean eab_book_and_contact_list_from_string (const gchar *str, EBookClient **book_client, GSList **contacts); -gchar * eab_book_and_contact_list_to_string (EBookClient *book_client, const GSList *contacts); - -gint e_utf8_casefold_collate_len (const gchar *str1, const gchar *str2, gint len); -gint e_utf8_casefold_collate (const gchar *str1, const gchar *str2); +GSList * eab_contact_list_from_string (const gchar *str); +gchar * eab_contact_list_to_string (const GSList *contacts); + +gboolean eab_book_and_contact_list_from_string + (const gchar *str, + EBookClient **book_client, + GSList **contacts); +gchar * eab_book_and_contact_list_to_string + (EBookClient *book_client, + const GSList *contacts); +gint e_utf8_casefold_collate_len (const gchar *str1, + const gchar *str2, + gint len); +gint e_utf8_casefold_collate (const gchar *str1, + const gchar *str2); G_END_DECLS diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c index 3256e39780..e612b0c56c 100644 --- a/calendar/gui/alarm-notify/alarm-notify.c +++ b/calendar/gui/alarm-notify/alarm-notify.c @@ -37,6 +37,10 @@ #include "alarm-queue.h" #include "config-data.h" +#define ALARM_NOTIFY_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), TYPE_ALARM_NOTIFY, AlarmNotifyPrivate)) + #define APPLICATION_ID "org.gnome.EvolutionAlarmNotify" struct _AlarmNotifyPrivate { @@ -55,7 +59,13 @@ typedef struct { GList *removals; } ProcessRemovalsData; -G_DEFINE_TYPE (AlarmNotify, alarm_notify, GTK_TYPE_APPLICATION) +/* Forward Declarations */ +static void alarm_notify_initable_init (GInitableIface *interface); + +G_DEFINE_TYPE_WITH_CODE ( + AlarmNotify, alarm_notify, GTK_TYPE_APPLICATION, + G_IMPLEMENT_INTERFACE ( + G_TYPE_INITABLE, alarm_notify_initable_init)) static void process_removal_in_hash (const gchar *uri, @@ -212,7 +222,7 @@ alarm_notify_finalize (GObject *object) AlarmNotifyPrivate *priv; gint ii; - priv = ALARM_NOTIFY (object)->priv; + priv = ALARM_NOTIFY_GET_PRIVATE (object); for (ii = 0; ii < E_CAL_CLIENT_SOURCE_TYPE_LAST; ii++) { g_hash_table_foreach ( @@ -264,6 +274,15 @@ alarm_notify_activate (GApplication *application) * if there are no handlers connected to this signal. */ } +static gboolean +alarm_notify_initable (GInitable *initable, + GCancellable *cancellable, + GError **error) +{ + /* XXX Just return TRUE for now. We'll have use for this soon. */ + return TRUE; +} + static void alarm_notify_class_init (AlarmNotifyClass *class) { @@ -281,12 +300,18 @@ alarm_notify_class_init (AlarmNotifyClass *class) } static void +alarm_notify_initable_init (GInitableIface *interface) +{ + /* XXX Awkward name since we're missing an 'E' prefix. */ + interface->init = alarm_notify_initable; +} + +static void alarm_notify_init (AlarmNotify *an) { gint ii; - an->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - an, TYPE_ALARM_NOTIFY, AlarmNotifyPrivate); + an->priv = ALARM_NOTIFY_GET_PRIVATE (an); an->priv->mutex = g_mutex_new (); an->priv->selected_calendars = config_data_get_calendars ( "/apps/evolution/calendar/sources"); @@ -317,10 +342,11 @@ alarm_notify_get_selected_calendars (AlarmNotify *an) * Returns: a newly-created #AlarmNotify **/ AlarmNotify * -alarm_notify_new (void) +alarm_notify_new (GCancellable *cancellable, + GError **error) { - return g_object_new ( - TYPE_ALARM_NOTIFY, + return g_initable_new ( + TYPE_ALARM_NOTIFY, cancellable, error, "application-id", APPLICATION_ID, NULL); } diff --git a/calendar/gui/alarm-notify/alarm-notify.h b/calendar/gui/alarm-notify/alarm-notify.h index 51837d21d5..f95a4d6b33 100644 --- a/calendar/gui/alarm-notify/alarm-notify.h +++ b/calendar/gui/alarm-notify/alarm-notify.h @@ -65,7 +65,8 @@ struct _AlarmNotifyClass { }; GType alarm_notify_get_type (void); -AlarmNotify * alarm_notify_new (void); +AlarmNotify * alarm_notify_new (GCancellable *cancellable, + GError **error); void alarm_notify_add_calendar (AlarmNotify *an, ECalClientSourceType source_type, ESource *source, diff --git a/calendar/gui/alarm-notify/notify-main.c b/calendar/gui/alarm-notify/notify-main.c index 225dde4c26..b1775d8d23 100644 --- a/calendar/gui/alarm-notify/notify-main.c +++ b/calendar/gui/alarm-notify/notify-main.c @@ -27,6 +27,7 @@ #include <config.h> #endif +#include <stdlib.h> #include <glib/gi18n.h> #include "alarm-notify.h" @@ -50,6 +51,7 @@ main (gint argc, { AlarmNotify *alarm_notify_service; gint exit_status; + GError *error = NULL; #ifdef G_OS_WIN32 gchar *path; @@ -87,7 +89,13 @@ main (gint argc, g_warning ("Could not set PATH for Evolution Alarm Notifier"); #endif - alarm_notify_service = alarm_notify_new (); + alarm_notify_service = alarm_notify_new (NULL, &error); + + if (error != NULL) { + g_printerr ("%s\n", error->message); + g_error_free (error); + exit (EXIT_FAILURE); + } exit_status = g_application_run ( G_APPLICATION (alarm_notify_service), argc, argv); diff --git a/calendar/gui/dialogs/alarm-dialog.h b/calendar/gui/dialogs/alarm-dialog.h index d99d47f15f..42c72d685a 100644 --- a/calendar/gui/dialogs/alarm-dialog.h +++ b/calendar/gui/dialogs/alarm-dialog.h @@ -35,7 +35,9 @@ G_BEGIN_DECLS -gboolean alarm_dialog_run (GtkWidget *parent, ECalClient *cal_client, ECalComponentAlarm *alarm); +gboolean alarm_dialog_run (GtkWidget *parent, + ECalClient *cal_client, + ECalComponentAlarm *alarm); G_END_DECLS diff --git a/calendar/gui/dialogs/alarm-list-dialog.h b/calendar/gui/dialogs/alarm-list-dialog.h index 163582c556..5746664c1f 100644 --- a/calendar/gui/dialogs/alarm-list-dialog.h +++ b/calendar/gui/dialogs/alarm-list-dialog.h @@ -36,9 +36,13 @@ G_BEGIN_DECLS -gboolean alarm_list_dialog_run (GtkWidget *parent, ECalClient *cal_client, EAlarmList *list_store); -GtkWidget *alarm_list_dialog_peek (ECalClient *cal_client, EAlarmList *list_store); -void alarm_list_dialog_set_client (GtkWidget *dlg_box, ECalClient *cal_client); +gboolean alarm_list_dialog_run (GtkWidget *parent, + ECalClient *cal_client, + EAlarmList *list_store); +GtkWidget * alarm_list_dialog_peek (ECalClient *cal_client, + EAlarmList *list_store); +void alarm_list_dialog_set_client (GtkWidget *dlg_box, + ECalClient *cal_client); G_END_DECLS diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 42b8acef63..27427540b6 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -3243,6 +3243,7 @@ real_send_comp (CompEditor *editor, g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE); priv = editor->priv; + flags = comp_editor_get_flags (editor); if (priv->mod == CALOBJ_MOD_ALL && e_cal_component_is_instance (priv->comp)) { diff --git a/calendar/gui/dialogs/copy-source-dialog.h b/calendar/gui/dialogs/copy-source-dialog.h index d9475f742c..5ac51406de 100644 --- a/calendar/gui/dialogs/copy-source-dialog.h +++ b/calendar/gui/dialogs/copy-source-dialog.h @@ -27,10 +27,12 @@ #define COPY_SOURCE_DIALOG_H #include <gtk/gtk.h> -#include <libedataserver/e-source.h> -#include <libecal/e-cal-client.h> #include <libecal/e-cal-util.h> +#include <libecal/e-cal-client.h> +#include <libedataserver/e-source.h> -void copy_source_dialog (GtkWindow *parent, ESource *source, ECalClientSourceType type); +void copy_source_dialog (GtkWindow *parent, + ESource *source, + ECalClientSourceType type); -#endif +#endif /* COPY_SOURCE_DIALOG_H */ diff --git a/calendar/gui/dialogs/e-delegate-dialog.c b/calendar/gui/dialogs/e-delegate-dialog.c index af61f807a8..fc7ae7d121 100644 --- a/calendar/gui/dialogs/e-delegate-dialog.c +++ b/calendar/gui/dialogs/e-delegate-dialog.c @@ -124,7 +124,6 @@ e_delegate_dialog_construct (EDelegateDialog *edd, ENameSelectorModel *name_selector_model; ENameSelectorDialog *name_selector_dialog; - g_return_val_if_fail (edd != NULL, NULL); g_return_val_if_fail (E_IS_DELEGATE_DIALOG (edd), NULL); priv = edd->priv; @@ -228,8 +227,10 @@ e_delegate_dialog_new (const gchar *name, { EDelegateDialog *edd; - edd = E_DELEGATE_DIALOG (g_object_new (E_TYPE_DELEGATE_DIALOG, NULL)); - return e_delegate_dialog_construct (E_DELEGATE_DIALOG (edd), name, address); + edd = g_object_new (E_TYPE_DELEGATE_DIALOG, NULL); + + return e_delegate_dialog_construct ( + E_DELEGATE_DIALOG (edd), name, address); } gchar * diff --git a/calendar/gui/dialogs/e-delegate-dialog.h b/calendar/gui/dialogs/e-delegate-dialog.h index 032901c8bc..5fb672bd5e 100644 --- a/calendar/gui/dialogs/e-delegate-dialog.h +++ b/calendar/gui/dialogs/e-delegate-dialog.h @@ -21,28 +21,38 @@ * */ -#ifndef __E_DELEGATE_DIALOG_H__ -#define __E_DELEGATE_DIALOG_H__ +#ifndef E_DELEGATE_DIALOG_H +#define E_DELEGATE_DIALOG_H #include <gtk/gtk.h> - - -#define E_TYPE_DELEGATE_DIALOG (e_delegate_dialog_get_type ()) -#define E_DELEGATE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_DELEGATE_DIALOG, EDelegateDialog)) -#define E_DELEGATE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_DELEGATE_DIALOG, \ - EDelegateDialogClass)) -#define E_IS_DELEGATE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_DELEGATE_DIALOG)) -#define E_IS_DELEGATE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_DELEGATE_DIALOG)) - -typedef struct _EDelegateDialog EDelegateDialog; -typedef struct _EDelegateDialogClass EDelegateDialogClass; -typedef struct _EDelegateDialogPrivate EDelegateDialogPrivate; +/* Standard GObject macros */ +#define E_TYPE_DELEGATE_DIALOG \ + (e_delegate_dialog_get_type ()) +#define E_DELEGATE_DIALOG(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_DELEGATE_DIALOG, EDelegateDialog)) +#define E_DELEGATE_DIALOG_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_DELEGATE_DIALOG, EDelegateDialogClass)) +#define E_IS_DELEGATE_DIALOG(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_DELEGATE_DIALOG)) +#define E_IS_DELEGATE_DIALOG_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_DELEGATE_DIALOG)) +#define E_DELEGATE_DIALOG_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_DELEGATE_DIALOG, EDelegateDialogClass)) + +G_BEGIN_DECLS + +typedef struct _EDelegateDialog EDelegateDialog; +typedef struct _EDelegateDialogClass EDelegateDialogClass; +typedef struct _EDelegateDialogPrivate EDelegateDialogPrivate; struct _EDelegateDialog { GObject object; - - /* Private data */ EDelegateDialogPrivate *priv; }; @@ -50,24 +60,21 @@ struct _EDelegateDialogClass { GObjectClass parent_class; }; -GType e_delegate_dialog_get_type (void); - -EDelegateDialog * e_delegate_dialog_construct (EDelegateDialog *etd, - const gchar *name, - const gchar *address); - -EDelegateDialog * e_delegate_dialog_new (const gchar *name, - const gchar *address); - -gchar * e_delegate_dialog_get_delegate (EDelegateDialog *etd); - -gchar * e_delegate_dialog_get_delegate_name (EDelegateDialog *etd); - -void e_delegate_dialog_set_delegate (EDelegateDialog *etd, - const gchar *address); - -GtkWidget * e_delegate_dialog_get_toplevel (EDelegateDialog *etd); - - - -#endif /* __E_DELEGATE_DIALOG_H__ */ +GType e_delegate_dialog_get_type (void); +EDelegateDialog * + e_delegate_dialog_construct (EDelegateDialog *etd, + const gchar *name, + const gchar *address); +EDelegateDialog * + e_delegate_dialog_new (const gchar *name, + const gchar *address); +gchar * e_delegate_dialog_get_delegate (EDelegateDialog *etd); +gchar * e_delegate_dialog_get_delegate_name + (EDelegateDialog *etd); +void e_delegate_dialog_set_delegate (EDelegateDialog *etd, + const gchar *address); +GtkWidget * e_delegate_dialog_get_toplevel (EDelegateDialog *etd); + +G_END_DECLS + +#endif /* E_DELEGATE_DIALOG_H */ diff --git a/calendar/gui/dialogs/e-send-options-utils.c b/calendar/gui/dialogs/e-send-options-utils.c index f8e933574c..780554812d 100644 --- a/calendar/gui/dialogs/e-send-options-utils.c +++ b/calendar/gui/dialogs/e-send-options-utils.c @@ -28,6 +28,7 @@ #include "e-send-options-utils.h" +#include <stdlib.h> #include <string.h> void diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index f89b67056d..29352642e7 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -730,8 +730,9 @@ event_editor_send_comp (CompEditor *editor, gboolean result; client = e_meeting_store_get_client (priv->model); - result = itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, - client, NULL, NULL, NULL, strip_alarms, FALSE); + result = itip_send_comp ( + E_CAL_COMPONENT_METHOD_CANCEL, comp, + client, NULL, NULL, NULL, strip_alarms, FALSE); g_object_unref (comp); if (!result) diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index 653f0215ac..e92c9872d0 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -2916,11 +2916,12 @@ epage_client_opened_cb (GObject *source_object, E_SOURCE_COMBO_BOX (priv->source_selector), e_client_get_source (E_CLIENT (old_client))); - dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, - GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - _("Unable to open the calendar '%s': %s"), - e_source_peek_name (source), - error ? error->message : _("Unknown error")); + dialog = gtk_message_dialog_new ( + NULL, GTK_DIALOG_MODAL, + GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, + _("Unable to open the calendar '%s': %s"), + e_source_peek_name (source), + error->message); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); @@ -2952,7 +2953,8 @@ epage_client_opened_cb (GObject *source_object, sensitize_widgets (epage); - alarm_list_dialog_set_client (priv->alarm_list_dlg_widget, cal_client); + alarm_list_dialog_set_client ( + priv->alarm_list_dlg_widget, cal_client); } } diff --git a/calendar/gui/dialogs/select-source-dialog.h b/calendar/gui/dialogs/select-source-dialog.h index 6d64fb825a..2ef8e0e625 100644 --- a/calendar/gui/dialogs/select-source-dialog.h +++ b/calendar/gui/dialogs/select-source-dialog.h @@ -30,6 +30,8 @@ #include <libedataserver/e-source.h> #include <libecal/e-cal-client.h> -ESource *select_source_dialog (GtkWindow *parent, ECalClientSourceType type, ESource *except_source); +ESource * select_source_dialog (GtkWindow *parent, + ECalClientSourceType type, + ESource *except_source); #endif diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 31593e0a04..1942224f7f 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -472,8 +472,9 @@ task_editor_send_comp (CompEditor *editor, gboolean result; client = e_meeting_store_get_client (priv->model); - result = itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, - client, NULL, NULL, NULL, strip_alarms, FALSE); + result = itip_send_comp ( + E_CAL_COMPONENT_METHOD_CANCEL, comp, + client, NULL, NULL, NULL, strip_alarms, FALSE); g_object_unref (comp); if (!result) diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index e0aa030358..05f1f87c05 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -1758,11 +1758,12 @@ tpage_client_opened_cb (GObject *source_object, E_SOURCE_COMBO_BOX (priv->source_selector), e_client_get_source (E_CLIENT (old_client))); - dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, - GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - _("Unable to open tasks in '%s': %s"), - e_source_peek_name (source), - error ? error->message : _("Unknown error")); + dialog = gtk_message_dialog_new ( + NULL, GTK_DIALOG_MODAL, + GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, + _("Unable to open tasks in '%s': %s"), + e_source_peek_name (source), + error->message); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); diff --git a/calendar/gui/e-cal-model-calendar.c b/calendar/gui/e-cal-model-calendar.c index 1254a8711b..6a1493f01a 100644 --- a/calendar/gui/e-cal-model-calendar.c +++ b/calendar/gui/e-cal-model-calendar.c @@ -369,8 +369,10 @@ ecmc_set_value_at (ETableModel *etm, } } - itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, send_comp ? send_comp : comp, - comp_data->client, NULL, NULL, NULL, strip_alarms, FALSE); + itip_send_comp ( + E_CAL_COMPONENT_METHOD_REQUEST, + send_comp ? send_comp : comp, comp_data->client, + NULL, NULL, NULL, strip_alarms, FALSE); if (send_comp) g_object_unref (send_comp); diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index 637d0f504e..4428d31cbd 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -1609,6 +1609,7 @@ ecm_get_color_for_component (ECalModel *model, ESource *source; const gchar *color_spec; gint i, first_empty = 0; + static AssignedColorData assigned_colors[] = { { "#BECEDD", NULL }, /* 190 206 221 Blue */ { "#E2F0EF", NULL }, /* 226 240 239 Light Blue */ @@ -1650,8 +1651,9 @@ ecm_get_color_for_component (ECalModel *model, } /* return the first unused color */ - assigned_colors[first_empty].uris = g_list_append (assigned_colors[first_empty].uris, - g_strdup (e_client_get_uri (E_CLIENT (comp_data->client)))); + assigned_colors[first_empty].uris = g_list_append ( + assigned_colors[first_empty].uris, + g_strdup (e_client_get_uri (E_CLIENT (comp_data->client)))); return assigned_colors[first_empty].color; } @@ -2039,7 +2041,7 @@ e_cal_model_get_client_list (ECalModel *model) /** * e_cal_model_get_client_for_uri: - * @model: A calendar model. + * @model: an #ECalModel * @uri: Uri for the client to get. */ ECalClient * @@ -2123,8 +2125,8 @@ search_by_id_and_client (ECalModelPrivate *priv, static void remove_all_for_id_and_client (ECalModel *model, - ECalClient *client, - const ECalComponentId *id) + ECalClient *client, + const ECalComponentId *id) { ECalModelComponent *comp_data; @@ -2883,13 +2885,15 @@ client_opened_cb (GObject *source_object, } if (error != NULL) { - const gchar *uri; + ESource *source; - uri = e_client_get_uri (E_CLIENT (client)); + source = e_client_get_source (E_CLIENT (client)); e_cal_model_remove_client (model, client); g_warning ( "%s: Failed to open '%s': %s", - G_STRFUNC, uri, error->message); + G_STRFUNC, + e_source_peek_name (source), + error->message); g_error_free (error); e_cal_model_update_status_message (model, NULL, -1.0); return; @@ -2958,9 +2962,13 @@ add_new_client (ECalModel *model, if (e_client_is_opened (E_CLIENT (client))) { update_e_cal_view_for_client (model, client_data); } else { + ESource *source; + const gchar *display_name; gchar *msg; - msg = g_strdup_printf (_("Opening %s"), e_client_get_uri (E_CLIENT (client))); + source = e_client_get_source (E_CLIENT (client)); + display_name = e_source_peek_name (source); + msg = g_strdup_printf (_("Opening %s"), display_name); e_cal_model_update_status_message (model, msg, -1.0); g_free (msg); @@ -3388,6 +3396,91 @@ e_cal_model_create_component_with_defaults (ECalModel *model, } /** + * Returns information about attendees in the component. + * If there are no attendees, the function returns NULL. + * + * The information is like "Status: Accepted: X Declined: Y ...". + * + * Free returned pointer with g_free. + **/ +gchar * +e_cal_model_get_attendees_status_info (ECalModel *model, + ECalComponent *comp, + ECalClient *cal_client) +{ + struct _values { + icalparameter_partstat status; + const gchar *caption; + gint count; + } values[] = { + { ICAL_PARTSTAT_ACCEPTED, N_("Accepted"), 0 }, + { ICAL_PARTSTAT_DECLINED, N_("Declined"), 0 }, + { ICAL_PARTSTAT_TENTATIVE, N_("Tentative"), 0 }, + { ICAL_PARTSTAT_DELEGATED, N_("Delegated"), 0 }, + { ICAL_PARTSTAT_NEEDSACTION, N_("Needs action"), 0 }, + { ICAL_PARTSTAT_NONE, N_("Other"), 0 }, + { ICAL_PARTSTAT_X, NULL, -1 } + }; + + GSList *attendees = NULL, *a; + gboolean have = FALSE; + gchar *res = NULL; + gint i; + + g_return_val_if_fail (E_IS_CAL_MODEL (model), NULL); + + if (!comp || !e_cal_component_has_attendees (comp) || + !itip_organizer_is_user_ex (comp, cal_client, TRUE)) + return NULL; + + e_cal_component_get_attendee_list (comp, &attendees); + + for (a = attendees; a; a = a->next) { + ECalComponentAttendee *att = a->data; + + if (att && att->cutype == ICAL_CUTYPE_INDIVIDUAL && + (att->role == ICAL_ROLE_CHAIR || + att->role == ICAL_ROLE_REQPARTICIPANT || + att->role == ICAL_ROLE_OPTPARTICIPANT)) { + have = TRUE; + + for (i = 0; values[i].count != -1; i++) { + if (att->status == values[i].status || values[i].status == ICAL_PARTSTAT_NONE) { + values[i].count++; + break; + } + } + } + } + + if (have) { + GString *str = g_string_new (""); + + for (i = 0; values[i].count != -1; i++) { + if (values[i].count > 0) { + if (str->str && *str->str) + g_string_append (str, " "); + + g_string_append_printf (str, "%s: %d", _(values[i].caption), values[i].count); + } + } + + g_string_prepend (str, ": "); + + /* To Translators: 'Status' here means the state of the attendees, the resulting string will be in a form: + * Status: Accepted: X Declined: Y ... */ + g_string_prepend (str, _("Status")); + + res = g_string_free (str, FALSE); + } + + if (attendees) + e_cal_component_free_attendee_list (attendees); + + return res; +} + +/** * e_cal_model_get_color_for_component */ const gchar * diff --git a/calendar/gui/e-cal-model.h b/calendar/gui/e-cal-model.h index a514c95ab2..6dd04675ed 100644 --- a/calendar/gui/e-cal-model.h +++ b/calendar/gui/e-cal-model.h @@ -263,6 +263,10 @@ void e_cal_model_set_search_query (ECalModel *model, icalcomponent * e_cal_model_create_component_with_defaults (ECalModel *model, gboolean all_day); +gchar * e_cal_model_get_attendees_status_info + (ECalModel *model, + ECalComponent *comp, + ECalClient *cal_client); const gchar * e_cal_model_get_color_for_component (ECalModel *model, ECalModelComponent *comp_data); diff --git a/calendar/gui/e-calendar-selector.c b/calendar/gui/e-calendar-selector.c index c71e3b99aa..989391625b 100644 --- a/calendar/gui/e-calendar-selector.c +++ b/calendar/gui/e-calendar-selector.c @@ -26,13 +26,17 @@ #include <libecal/e-cal-client.h> #include <libedataserverui/e-client-utils.h> + #include "e-util/e-selection.h" struct _ECalendarSelectorPrivate { gint dummy_value; }; -static gpointer parent_class; +G_DEFINE_TYPE ( + ECalendarSelector, + e_calendar_selector, + E_TYPE_SOURCE_SELECTOR) static gboolean calendar_selector_update_single_object (ECalClient *client, @@ -170,7 +174,8 @@ calendar_selector_data_dropped (ESourceSelector *selector, icalcomponent_set_uid (icalcomp, uid); } - e_client_utils_open_new (destination, E_CLIENT_SOURCE_TYPE_EVENTS, FALSE, NULL, + e_client_utils_open_new ( + destination, E_CLIENT_SOURCE_TYPE_EVENTS, FALSE, NULL, e_client_utils_authenticate_handler, NULL, client_opened_cb, icalcomp); @@ -187,11 +192,10 @@ exit: } static void -calendar_selector_class_init (ECalendarSelectorClass *class) +e_calendar_selector_class_init (ECalendarSelectorClass *class) { ESourceSelectorClass *source_selector_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ECalendarSelectorPrivate)); source_selector_class = E_SOURCE_SELECTOR_CLASS (class); @@ -199,7 +203,7 @@ calendar_selector_class_init (ECalendarSelectorClass *class) } static void -calendar_selector_init (ECalendarSelector *selector) +e_calendar_selector_init (ECalendarSelector *selector) { selector->priv = G_TYPE_INSTANCE_GET_PRIVATE ( selector, E_TYPE_CALENDAR_SELECTOR, ECalendarSelectorPrivate); @@ -211,33 +215,6 @@ calendar_selector_init (ECalendarSelector *selector) e_drag_dest_add_calendar_targets (GTK_WIDGET (selector)); } -GType -e_calendar_selector_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - const GTypeInfo type_info = { - sizeof (ECalendarSelectorClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) calendar_selector_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ECalendarSelector), - 0, /* n_preallocs */ - (GInstanceInitFunc) calendar_selector_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_SOURCE_SELECTOR, "ECalendarSelector", - &type_info, 0); - } - - return type; -} - GtkWidget * e_calendar_selector_new (ESourceList *source_list) { diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c index b70df8b019..84046e7aac 100644 --- a/calendar/gui/e-calendar-view.c +++ b/calendar/gui/e-calendar-view.c @@ -218,12 +218,15 @@ calendar_view_delete_event (ECalendarView *cal_view, const gchar *uid; gchar *rid = NULL; - if ((itip_organizer_is_user (comp, event->comp_data->client) || itip_sentby_is_user (comp, event->comp_data->client)) + if ((itip_organizer_is_user (comp, event->comp_data->client) || + itip_sentby_is_user (comp, event->comp_data->client)) && cancel_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)), event->comp_data->client, comp, TRUE)) - itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, - event->comp_data->client, NULL, NULL, NULL, TRUE, FALSE); + itip_send_comp ( + E_CAL_COMPONENT_METHOD_CANCEL, + comp, event->comp_data->client, NULL, NULL, + NULL, TRUE, FALSE); e_cal_component_get_uid (comp, &uid); if (!uid || !*uid) { @@ -473,11 +476,14 @@ calendar_view_cut_clipboard (ESelectable *selectable) comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); - if ((itip_organizer_is_user (comp, event->comp_data->client) || itip_sentby_is_user (comp, event->comp_data->client)) + if ((itip_organizer_is_user (comp, event->comp_data->client) || + itip_sentby_is_user (comp, event->comp_data->client)) && cancel_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)), event->comp_data->client, comp, TRUE)) - itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, - event->comp_data->client, NULL, NULL, NULL, TRUE, FALSE); + itip_send_comp ( + E_CAL_COMPONENT_METHOD_CANCEL, + comp, event->comp_data->client, NULL, NULL, + NULL, TRUE, FALSE); e_cal_component_get_uid (comp, &uid); if (e_cal_component_is_instance (comp)) { @@ -1058,11 +1064,16 @@ e_calendar_view_add_event (ECalendarView *cal_view, g_free (uid); } - if ((itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp, client)) && - send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)), - client, comp, TRUE, &strip_alarms, NULL)) { - itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp, - client, NULL, NULL, NULL, strip_alarms, FALSE); + if ((itip_organizer_is_user (comp, client) || + itip_sentby_is_user (comp, client)) && + send_component_dialog ( + (GtkWindow *) gtk_widget_get_toplevel ( + GTK_WIDGET (cal_view)), + client, comp, TRUE, &strip_alarms, NULL)) { + itip_send_comp ( + E_CAL_COMPONENT_METHOD_REQUEST, + comp, client, NULL, NULL, NULL, strip_alarms, + FALSE); } } else { g_message (G_STRLOC ": Could not create the object! %s", error ? error->message : ""); @@ -1339,7 +1350,8 @@ e_calendar_view_delete_selected_occurrence (ECalendarView *cal_view) e_cal_component_free_datetime (&dt); - if ((itip_organizer_is_user (comp, event->comp_data->client) || itip_sentby_is_user (comp, event->comp_data->client)) + if ((itip_organizer_is_user (comp, event->comp_data->client) || + itip_sentby_is_user (comp, event->comp_data->client)) && cancel_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)), event->comp_data->client, comp, TRUE) && !e_cal_client_check_save_schedules (event->comp_data->client)) { @@ -1354,7 +1366,11 @@ e_calendar_view_delete_selected_occurrence (ECalendarView *cal_view) e_cal_component_free_datetime (&range.datetime); } - itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, event->comp_data->client, NULL, NULL, NULL, TRUE, FALSE); + + itip_send_comp ( + E_CAL_COMPONENT_METHOD_CANCEL, + comp, event->comp_data->client, NULL, NULL, + NULL, TRUE, FALSE); } if (is_instance) @@ -1437,8 +1453,14 @@ e_calendar_view_new_appointment_for (ECalendarView *cal_view, if (e_client_is_readonly (E_CLIENT (default_client))) { GtkWidget *widget; + ESource *source; + + source = e_client_get_source (E_CLIENT (default_client)); - widget = e_alert_dialog_new_for_args (parent, "calendar:prompt-read-only-cal", e_source_peek_name (e_client_get_source (E_CLIENT (default_client))), NULL); + widget = e_alert_dialog_new_for_args ( + parent, "calendar:prompt-read-only-cal", + e_source_peek_name (source), + NULL); g_signal_connect ((GtkDialog *)widget, "response", G_CALLBACK (gtk_widget_destroy), widget); @@ -1653,7 +1675,9 @@ e_calendar_view_edit_appointment (ECalendarView *cal_view, ECalComponent *comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp)); flags |= COMP_EDITOR_MEETING; - if (itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp, client) || !e_cal_component_has_attendees (comp)) + if (itip_organizer_is_user (comp, client) || + itip_sentby_is_user (comp, client) || + !e_cal_component_has_attendees (comp)) flags |= COMP_EDITOR_USER_ORG; g_object_unref (comp); } @@ -1662,7 +1686,8 @@ e_calendar_view_edit_appointment (ECalendarView *cal_view, } void -e_calendar_view_modify_and_send (ECalComponent *comp, +e_calendar_view_modify_and_send (ECalendarView *cal_view, + ECalComponent *comp, ECalClient *client, CalObjModType mod, GtkWindow *toplevel, @@ -1671,12 +1696,15 @@ e_calendar_view_modify_and_send (ECalComponent *comp, gboolean only_new_attendees = FALSE; GError *error = NULL; + g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view)); + e_cal_component_commit_sequence (comp); if (e_cal_client_modify_object_sync (client, e_cal_component_get_icalcomponent (comp), mod, NULL, &error)) { gboolean strip_alarms = TRUE; - if ((itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp, client)) && + if ((itip_organizer_is_user (comp, client) || + itip_sentby_is_user (comp, client)) && send_component_dialog (toplevel, client, comp, new, &strip_alarms, &only_new_attendees)) { ECalComponent *send_comp = NULL; @@ -1699,7 +1727,10 @@ e_calendar_view_modify_and_send (ECalComponent *comp, } } - itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, send_comp ? send_comp : comp, client, NULL, NULL, NULL, strip_alarms, only_new_attendees); + itip_send_comp ( + E_CAL_COMPONENT_METHOD_REQUEST, + send_comp ? send_comp : comp, client, NULL, + NULL, NULL, strip_alarms, only_new_attendees); if (send_comp) g_object_unref (send_comp); @@ -1784,84 +1815,6 @@ e_calendar_view_move_tip (GtkWidget *widget, gtk_widget_show (widget); } -/** - * Returns information about attendees in the component. If no attendees, then returns NULL. - * The information is like "Status: Accepted: X Declined: Y ...". - * Free returned pointer with g_free. - **/ -gchar * -e_calendar_view_get_attendees_status_info (ECalComponent *comp, - ECalClient *client) -{ - struct _values { - icalparameter_partstat status; - const gchar *caption; - gint count; - } values[] = { - { ICAL_PARTSTAT_ACCEPTED, N_("Accepted"), 0 }, - { ICAL_PARTSTAT_DECLINED, N_("Declined"), 0 }, - { ICAL_PARTSTAT_TENTATIVE, N_("Tentative"), 0 }, - { ICAL_PARTSTAT_DELEGATED, N_("Delegated"), 0 }, - { ICAL_PARTSTAT_NEEDSACTION, N_("Needs action"), 0 }, - { ICAL_PARTSTAT_NONE, N_("Other"), 0 }, - { ICAL_PARTSTAT_X, NULL, -1 } - }; - - GSList *attendees = NULL, *a; - gboolean have = FALSE; - gchar *res = NULL; - gint i; - - if (!comp || !e_cal_component_has_attendees (comp) || !itip_organizer_is_user_ex (comp, client, TRUE)) - return NULL; - - e_cal_component_get_attendee_list (comp, &attendees); - - for (a = attendees; a; a = a->next) { - ECalComponentAttendee *att = a->data; - - if (att && att->cutype == ICAL_CUTYPE_INDIVIDUAL && - (att->role == ICAL_ROLE_CHAIR || - att->role == ICAL_ROLE_REQPARTICIPANT || - att->role == ICAL_ROLE_OPTPARTICIPANT)) { - have = TRUE; - - for (i = 0; values[i].count != -1; i++) { - if (att->status == values[i].status || values[i].status == ICAL_PARTSTAT_NONE) { - values[i].count++; - break; - } - } - } - } - - if (have) { - GString *str = g_string_new (""); - - for (i = 0; values[i].count != -1; i++) { - if (values[i].count > 0) { - if (str->str && *str->str) - g_string_append (str, " "); - - g_string_append_printf (str, "%s: %d", _(values[i].caption), values[i].count); - } - } - - g_string_prepend (str, ": "); - - /* To Translators: 'Status' here means the state of the attendees, the resulting string will be in a form: - * Status: Accepted: X Declined: Y ... */ - g_string_prepend (str, _("Status")); - - res = g_string_free (str, FALSE); - } - - if (attendees) - e_cal_component_free_attendee_list (attendees); - - return res; -} - /* * It is expected to show the tooltips in this below format * @@ -1873,7 +1826,8 @@ e_calendar_view_get_attendees_status_info (ECalComponent *comp, */ gboolean -e_calendar_view_get_tooltips (const ECalendarViewEventData *data) +e_calendar_view_get_tooltips (ECalendarView *cal_view, + const ECalendarViewEventData *data) { GtkWidget *label, *box, *hbox, *ebox, *frame; const gchar *str; @@ -1888,9 +1842,14 @@ e_calendar_view_get_tooltips (const ECalendarViewEventData *data) GdkWindow *window; ECalComponent *newcomp = e_cal_component_new (); icaltimezone *zone, *default_zone; + ECalModel *model; ECalClient *client = NULL; gboolean free_text = FALSE; + g_return_val_if_fail (E_IS_CALENDAR_VIEW (cal_view), FALSE); + + model = e_calendar_view_get_model (cal_view); + /* Delete any stray tooltip if left */ if (widget) gtk_widget_destroy (widget); @@ -2023,7 +1982,8 @@ e_calendar_view_get_tooltips (const ECalendarViewEventData *data) g_free (tmp2); g_free (tmp1); - tmp = e_calendar_view_get_attendees_status_info (newcomp, pevent->comp_data->client); + tmp = e_cal_model_get_attendees_status_info ( + model, newcomp, pevent->comp_data->client); if (tmp) { hbox = gtk_hbox_new (FALSE, 0); gtk_box_pack_start ((GtkBox *) hbox, gtk_label_new (tmp), FALSE, FALSE, 0); diff --git a/calendar/gui/e-calendar-view.h b/calendar/gui/e-calendar-view.h index decfdfffbf..7ebcef7d1c 100644 --- a/calendar/gui/e-calendar-view.h +++ b/calendar/gui/e-calendar-view.h @@ -235,18 +235,21 @@ void e_calendar_view_new_appointment_full gboolean meeting, gboolean no_past_date); void e_calendar_view_new_appointment (ECalendarView *cal_view); -void e_calendar_view_edit_appointment (ECalendarView *cal_view, +void e_calendar_view_edit_appointment + (ECalendarView *cal_view, ECalClient *client, icalcomponent *icalcomp, EEditEventMode mode); void e_calendar_view_open_event (ECalendarView *cal_view); -void e_calendar_view_modify_and_send (ECalComponent *comp, +void e_calendar_view_modify_and_send (ECalendarView *cal_view, + ECalComponent *comp, ECalClient *client, CalObjModType mod, GtkWindow *toplevel, gboolean new); -gboolean e_calendar_view_get_tooltips (const ECalendarViewEventData *data); +gboolean e_calendar_view_get_tooltips (ECalendarView *cal_view, + const ECalendarViewEventData *data); void e_calendar_view_move_tip (GtkWidget *widget, gint x, @@ -256,9 +259,6 @@ const gchar * e_calendar_view_get_icalcomponent_summary (ECalClient *ecal, icalcomponent *icalcomp, gboolean *free_text); -gchar * e_calendar_view_get_attendees_status_info - (ECalComponent *comp, - ECalClient *client); void e_calendar_view_emit_user_created (ECalendarView *cal_view); diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index efad7dbc6f..8af5ffb3fa 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -739,7 +739,9 @@ process_component (EDayView *day_view, /* Add the object */ add_event_data.day_view = day_view; add_event_data.comp_data = comp_data; - e_day_view_add_event (comp, comp_data->instance_start, comp_data->instance_end, &add_event_data); + e_day_view_add_event ( + comp, comp_data->instance_start, + comp_data->instance_end, &add_event_data); g_object_unref (comp); g_free (rid); @@ -4225,7 +4227,8 @@ e_day_view_finish_long_event_resize (EDayView *day_view) comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); - if (e_cal_component_has_attendees (comp) && !itip_organizer_is_user (comp, client)) { + if (e_cal_component_has_attendees (comp) && + !itip_organizer_is_user (comp, client)) { g_object_unref (comp); e_day_view_abort_resize (day_view); return; @@ -4297,7 +4300,10 @@ e_day_view_finish_long_event_resize (EDayView *day_view) mod = CALOBJ_MOD_THIS; toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (day_view))); - e_calendar_view_modify_and_send (comp, client, mod, toplevel, TRUE); + + e_calendar_view_modify_and_send ( + E_CALENDAR_VIEW (day_view), + comp, client, mod, toplevel, TRUE); out: day_view->resize_drag_pos = E_CALENDAR_VIEW_POS_NONE; @@ -4343,7 +4349,8 @@ e_day_view_finish_resize (EDayView *day_view) comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); - if (e_cal_component_has_attendees (comp) && !itip_organizer_is_user (comp, client)) { + if (e_cal_component_has_attendees (comp) && + !itip_organizer_is_user (comp, client)) { g_object_unref (comp); e_day_view_abort_resize (day_view); return; @@ -4413,7 +4420,11 @@ e_day_view_finish_resize (EDayView *day_view) toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (day_view))); e_cal_component_commit_sequence (comp); - e_calendar_view_modify_and_send (comp, client, mod, toplevel, TRUE); + + e_calendar_view_modify_and_send ( + E_CALENDAR_VIEW (day_view), + comp, client, mod, toplevel, TRUE); + out: g_object_unref (comp); } @@ -4558,7 +4569,9 @@ e_day_view_add_event (ECalComponent *comp, e_calendar_view_get_timezone (E_CALENDAR_VIEW (add_event_data->day_view)))) event.different_timezone = TRUE; - if (!e_cal_component_has_attendees (comp) || itip_organizer_is_user (comp, event.comp_data->client) || itip_sentby_is_user (comp, event.comp_data->client)) + if (!e_cal_component_has_attendees (comp) || + itip_organizer_is_user (comp, event.comp_data->client) || + itip_sentby_is_user (comp, event.comp_data->client)) event.is_editable = TRUE; else event.is_editable = FALSE; @@ -5099,9 +5112,11 @@ e_day_view_add_new_event_in_selected_range (EDayView *day_view, const gchar *uid; AddEventData add_event_data; - /* Check if the client is read only */ model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)); + client = e_cal_model_get_default_client (model); + + /* Check if the client is read only */ if (e_client_is_readonly (E_CLIENT (client))) return FALSE; @@ -6488,7 +6503,8 @@ e_day_view_change_event_time (EDayView *day_view, comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); - if (e_cal_component_has_attendees (comp) && !itip_organizer_is_user (comp, client)) { + if (e_cal_component_has_attendees (comp) && + !itip_organizer_is_user (comp, client)) { g_object_unref (comp); return; } @@ -6537,7 +6553,10 @@ e_day_view_change_event_time (EDayView *day_view, toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (day_view))); e_cal_component_commit_sequence (comp); - e_calendar_view_modify_and_send (comp, client, mod, toplevel, TRUE); + + e_calendar_view_modify_and_send ( + E_CALENDAR_VIEW (day_view), + comp, client, mod, toplevel, TRUE); out: g_object_unref (comp); @@ -6861,7 +6880,10 @@ e_day_view_on_editing_stopped (EDayView *day_view, /* FIXME When sending here, what exactly should we send? */ toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (day_view))); - e_calendar_view_modify_and_send (comp, client, mod, toplevel, FALSE); + + e_calendar_view_modify_and_send ( + E_CALENDAR_VIEW (day_view), + comp, client, mod, toplevel, FALSE); } } @@ -7863,13 +7885,13 @@ e_day_view_on_drag_data_get (GtkWidget *widget, comp_str = icalcomponent_as_ical_string_r (vcal); if (comp_str) { - ESource *source = e_client_get_source (E_CLIENT (event->comp_data->client)); - const gchar *source_uid = e_source_peek_uid (source); + ESource *source; + const gchar *source_uid; GdkAtom target; gchar *tmp; - if (!source_uid) - source_uid = ""; + source = e_client_get_source (E_CLIENT (event->comp_data->client)); + source_uid = e_source_peek_uid (source); tmp = g_strconcat (source_uid, "\n", comp_str, NULL); target = gtk_selection_data_get_target (selection_data); @@ -7984,7 +8006,8 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget, comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); - if (e_cal_component_has_attendees (comp) && !itip_organizer_is_user (comp, client)) { + if (e_cal_component_has_attendees (comp) && + !itip_organizer_is_user (comp, client)) { g_object_unref (comp); return; } @@ -8055,7 +8078,10 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget, mod = CALOBJ_MOD_THIS; toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (day_view))); - e_calendar_view_modify_and_send (comp, client, mod, toplevel, FALSE); + + e_calendar_view_modify_and_send ( + E_CALENDAR_VIEW (day_view), + comp, client, mod, toplevel, FALSE); g_object_unref (comp); @@ -8234,7 +8260,8 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget, comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); - if (e_cal_component_has_attendees (comp) && !itip_organizer_is_user (comp, client)) { + if (e_cal_component_has_attendees (comp) && + !itip_organizer_is_user (comp, client)) { g_object_unref (comp); return; } @@ -8282,7 +8309,10 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget, mod = CALOBJ_MOD_THIS; toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (day_view))); - e_calendar_view_modify_and_send (comp, client, mod, toplevel, FALSE); + + e_calendar_view_modify_and_send ( + E_CALENDAR_VIEW (day_view), + comp, client, mod, toplevel, FALSE); g_object_unref (comp); diff --git a/calendar/gui/e-meeting-store.c b/calendar/gui/e-meeting-store.c index 7e5fbf215e..833c6a821e 100644 --- a/calendar/gui/e-meeting-store.c +++ b/calendar/gui/e-meeting-store.c @@ -1984,7 +1984,9 @@ download_with_libsoup (const gchar *uri, g_object_set_data_full (G_OBJECT (msg), "orig-uri", g_strdup (uri), g_free); session = soup_session_async_new (); - g_signal_connect (session, "authenticate", G_CALLBACK (soup_authenticate), NULL); + g_signal_connect ( + session, "authenticate", + G_CALLBACK (soup_authenticate), NULL); proxy = e_proxy_new (); e_proxy_setup_proxy (proxy); diff --git a/calendar/gui/e-memo-list-selector.c b/calendar/gui/e-memo-list-selector.c index 5fff33d188..4484f94298 100644 --- a/calendar/gui/e-memo-list-selector.c +++ b/calendar/gui/e-memo-list-selector.c @@ -34,7 +34,10 @@ struct _EMemoListSelectorPrivate { gint dummy_value; }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EMemoListSelector, + e_memo_list_selector, + E_TYPE_SOURCE_SELECTOR) static gboolean memo_list_selector_update_single_object (ECalClient *client, @@ -302,11 +305,10 @@ memo_list_selector_data_dropped (ESourceSelector *selector, } static void -memo_list_selector_class_init (EMemoListSelectorClass *class) +e_memo_list_selector_class_init (EMemoListSelectorClass *class) { ESourceSelectorClass *source_selector_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EMemoListSelectorPrivate)); source_selector_class = E_SOURCE_SELECTOR_CLASS (class); @@ -314,7 +316,7 @@ memo_list_selector_class_init (EMemoListSelectorClass *class) } static void -memo_list_selector_init (EMemoListSelector *selector) +e_memo_list_selector_init (EMemoListSelector *selector) { selector->priv = G_TYPE_INSTANCE_GET_PRIVATE ( selector, E_TYPE_MEMO_LIST_SELECTOR, EMemoListSelectorPrivate); @@ -326,33 +328,6 @@ memo_list_selector_init (EMemoListSelector *selector) e_drag_dest_add_calendar_targets (GTK_WIDGET (selector)); } -GType -e_memo_list_selector_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - const GTypeInfo type_info = { - sizeof (EMemoListSelectorClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) memo_list_selector_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EMemoListSelector), - 0, /* n_preallocs */ - (GInstanceInitFunc) memo_list_selector_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_SOURCE_SELECTOR, "EMemoListSelector", - &type_info, 0); - } - - return type; -} - GtkWidget * e_memo_list_selector_new (ESourceList *source_list) { diff --git a/calendar/gui/e-task-list-selector.c b/calendar/gui/e-task-list-selector.c index 7e091599cf..ba210e8c05 100644 --- a/calendar/gui/e-task-list-selector.c +++ b/calendar/gui/e-task-list-selector.c @@ -34,7 +34,10 @@ struct _ETaskListSelectorPrivate { gint dummy_value; }; -static gpointer parent_class; +G_DEFINE_TYPE ( + ETaskListSelector, + e_task_list_selector, + E_TYPE_SOURCE_SELECTOR) static gboolean task_list_selector_update_single_object (ECalClient *client, @@ -304,11 +307,10 @@ task_list_selector_data_dropped (ESourceSelector *selector, } static void -task_list_selector_class_init (ETaskListSelectorClass *class) +e_task_list_selector_class_init (ETaskListSelectorClass *class) { ESourceSelectorClass *source_selector_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ETaskListSelectorPrivate)); source_selector_class = E_SOURCE_SELECTOR_CLASS (class); @@ -316,7 +318,7 @@ task_list_selector_class_init (ETaskListSelectorClass *class) } static void -task_list_selector_init (ETaskListSelector *selector) +e_task_list_selector_init (ETaskListSelector *selector) { selector->priv = G_TYPE_INSTANCE_GET_PRIVATE ( selector, E_TYPE_TASK_LIST_SELECTOR, ETaskListSelectorPrivate); @@ -328,33 +330,6 @@ task_list_selector_init (ETaskListSelector *selector) e_drag_dest_add_calendar_targets (GTK_WIDGET (selector)); } -GType -e_task_list_selector_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - const GTypeInfo type_info = { - sizeof (ETaskListSelectorClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) task_list_selector_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ETaskListSelector), - 0, /* n_preallocs */ - (GInstanceInitFunc) task_list_selector_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_SOURCE_SELECTOR, "ETaskListSelector", - &type_info, 0); - } - - return type; -} - GtkWidget * e_task_list_selector_new (ESourceList *source_list) { diff --git a/calendar/gui/e-task-table.c b/calendar/gui/e-task-table.c index ec49cd1478..0a38889e2d 100644 --- a/calendar/gui/e-task-table.c +++ b/calendar/gui/e-task-table.c @@ -712,6 +712,7 @@ task_table_query_tooltip (GtkWidget *widget, model = e_task_table_get_model (task_table); comp_data = e_cal_model_get_component_at (model, row); + if (!comp_data || !comp_data->icalcomp) return FALSE; @@ -850,8 +851,8 @@ task_table_query_tooltip (GtkWidget *widget, e_cal_component_free_datetime (&dtstart); e_cal_component_free_datetime (&dtdue); - tmp = e_calendar_view_get_attendees_status_info ( - new_comp, comp_data->client); + tmp = e_cal_model_get_attendees_status_info ( + model, new_comp, comp_data->client); if (tmp) { l = gtk_label_new (tmp); gtk_misc_set_alignment (GTK_MISC (l), 0.0, 0.5); diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index a98ff42776..036b6192f5 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -3901,7 +3901,10 @@ e_week_view_change_event_time (EWeekView *week_view, toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (week_view))); e_cal_component_commit_sequence (comp); - e_calendar_view_modify_and_send (comp, client, mod, toplevel, TRUE); + + e_calendar_view_modify_and_send ( + E_CALENDAR_VIEW (week_view), + comp, client, mod, toplevel, TRUE); out: g_object_unref (comp); @@ -4112,7 +4115,10 @@ e_week_view_on_editing_stopped (EWeekView *week_view, /* FIXME When sending here, what exactly should we send? */ toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (week_view))); - e_calendar_view_modify_and_send (comp, client, mod, toplevel, FALSE); + + e_calendar_view_modify_and_send ( + E_CALENDAR_VIEW (week_view), + comp, client, mod, toplevel, FALSE); } } diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 654eb1898a..66c90fb1c2 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -138,9 +138,9 @@ struct _GnomeCalendarPrivate { enum { PROP_0, PROP_DATE_NAVIGATOR, - PROP_VIEW, PROP_MEMO_TABLE, - PROP_TASK_TABLE + PROP_TASK_TABLE, + PROP_VIEW }; enum { @@ -341,12 +341,6 @@ gnome_calendar_set_property (GObject *object, g_value_get_object (value)); return; - case PROP_VIEW: - gnome_calendar_set_view ( - GNOME_CALENDAR (object), - g_value_get_int (value)); - return; - case PROP_MEMO_TABLE: gnome_calendar_set_memo_table ( GNOME_CALENDAR (object), @@ -358,6 +352,12 @@ gnome_calendar_set_property (GObject *object, GNOME_CALENDAR (object), g_value_get_object (value)); return; + + case PROP_VIEW: + gnome_calendar_set_view ( + GNOME_CALENDAR (object), + g_value_get_int (value)); + return; } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -376,12 +376,6 @@ gnome_calendar_get_property (GObject *object, GNOME_CALENDAR (object))); return; - case PROP_VIEW: - g_value_set_int ( - value, gnome_calendar_get_view ( - GNOME_CALENDAR (object))); - return; - case PROP_MEMO_TABLE: g_value_set_object ( value, gnome_calendar_get_memo_table ( @@ -393,6 +387,12 @@ gnome_calendar_get_property (GObject *object, value, gnome_calendar_get_task_table ( GNOME_CALENDAR (object))); return; + + case PROP_VIEW: + g_value_set_int ( + value, gnome_calendar_get_view ( + GNOME_CALENDAR (object))); + return; } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -528,18 +528,6 @@ gnome_calendar_class_init (GnomeCalendarClass *class) g_object_class_install_property ( object_class, - PROP_VIEW, - g_param_spec_int ( - "view", - "View", - NULL, - GNOME_CAL_DAY_VIEW, - GNOME_CAL_LIST_VIEW, - GNOME_CAL_DAY_VIEW, - G_PARAM_READWRITE)); - - g_object_class_install_property ( - object_class, PROP_MEMO_TABLE, g_param_spec_object ( "memo-table", @@ -558,6 +546,18 @@ gnome_calendar_class_init (GnomeCalendarClass *class) E_TYPE_TASK_TABLE, G_PARAM_READWRITE)); + g_object_class_install_property ( + object_class, + PROP_VIEW, + g_param_spec_int ( + "view", + "View", + NULL, + GNOME_CAL_DAY_VIEW, + GNOME_CAL_LIST_VIEW, + GNOME_CAL_DAY_VIEW, + G_PARAM_READWRITE)); + signals[DATES_SHOWN_CHANGED] = g_signal_new ("dates_shown_changed", G_TYPE_FROM_CLASS (object_class), diff --git a/calendar/importers/icalendar-importer.c b/calendar/importers/icalendar-importer.c index 739a23cf1d..449cab0d24 100644 --- a/calendar/importers/icalendar-importer.c +++ b/calendar/importers/icalendar-importer.c @@ -335,7 +335,7 @@ ivcal_getwidget (EImport *ei, if (!group) group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (rb)); if (first == NULL) { - g_datalist_set_data_full(&target->data, "primary-source", g_object_ref(primary), g_object_unref); + g_datalist_set_data_full(&target->data, "primary-source", g_object_ref (primary), g_object_unref); g_datalist_set_data(&target->data, "primary-type", GINT_TO_POINTER(import_type_map[i])); first = rb; } @@ -867,7 +867,8 @@ open_default_source (ICalIntelligentImporter *ici, e_import_status (ici->ei, ici->target, _("Opening calendar"), 0); - e_client_utils_open_new (source, source_type == E_CAL_CLIENT_SOURCE_TYPE_EVENTS ? E_CLIENT_SOURCE_TYPE_EVENTS : E_CLIENT_SOURCE_TYPE_TASKS, FALSE, ici->cancellable, + e_client_utils_open_new ( + source, source_type == E_CAL_CLIENT_SOURCE_TYPE_EVENTS ? E_CLIENT_SOURCE_TYPE_EVENTS : E_CLIENT_SOURCE_TYPE_TASKS, FALSE, ici->cancellable, e_client_utils_authenticate_handler, NULL, default_source_opened_cb, odsd); diff --git a/capplet/settings/mail-capplet-shell.c b/capplet/settings/mail-capplet-shell.c index dba46a804f..91a82b6757 100644 --- a/capplet/settings/mail-capplet-shell.c +++ b/capplet/settings/mail-capplet-shell.c @@ -279,7 +279,7 @@ mail_capplet_shell_construct (MailCappletShell *shell, mail_config_init (session); mail_msg_init (); custom_dir = g_build_filename (e_get_user_data_dir (), "mail", NULL); - e_mail_store_init (session, custom_dir); + e_mail_store_init (shell->priv->backend, custom_dir); g_free (custom_dir); if (just_druid) { diff --git a/composer/e-composer-from-header.h b/composer/e-composer-from-header.h index d2603bd664..182a75134b 100644 --- a/composer/e-composer-from-header.h +++ b/composer/e-composer-from-header.h @@ -21,13 +21,11 @@ #ifndef E_COMPOSER_FROM_HEADER_H #define E_COMPOSER_FROM_HEADER_H -#include "e-composer-common.h" - #include <libedataserver/e-account.h> #include <libedataserver/e-account-list.h> #include <misc/e-account-combo-box.h> -#include "e-composer-header.h" +#include <composer/e-composer-header.h> /* Standard GObject macros */ #define E_TYPE_COMPOSER_FROM_HEADER \ diff --git a/composer/e-composer-header-table.h b/composer/e-composer-header-table.h index 856a8e2158..f7edec0b14 100644 --- a/composer/e-composer-header-table.h +++ b/composer/e-composer-header-table.h @@ -18,8 +18,6 @@ #ifndef E_COMPOSER_HEADER_TABLE_H #define E_COMPOSER_HEADER_TABLE_H -#include "e-composer-common.h" - #include <libedataserver/e-account.h> #include <libedataserver/e-account-list.h> #include <libebook/e-destination.h> @@ -27,8 +25,7 @@ #include <shell/e-shell.h> #include <e-util/e-signature.h> #include <e-util/e-signature-list.h> - -#include "e-composer-header.h" +#include <composer/e-composer-header.h> /* Standard GObject macros */ #define E_TYPE_COMPOSER_HEADER_TABLE \ diff --git a/composer/e-composer-header.c b/composer/e-composer-header.c index d6a270a73b..29a9a5c790 100644 --- a/composer/e-composer-header.c +++ b/composer/e-composer-header.c @@ -26,21 +26,12 @@ #include "e-composer-header.h" -#include <glib/gi18n.h> - -enum { - PROP_0, - PROP_BUTTON, - PROP_LABEL, - PROP_SENSITIVE, - PROP_VISIBLE -}; +#include <config.h> +#include <glib/gi18n-lib.h> -enum { - CHANGED, - CLICKED, - LAST_SIGNAL -}; +#define E_COMPOSER_HEADER_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_COMPOSER_HEADER, EComposerHeaderPrivate)) struct _EComposerHeaderPrivate { gchar *label; @@ -56,6 +47,20 @@ struct _EComposerHeaderPrivate { guint visible : 1; }; +enum { + PROP_0, + PROP_BUTTON, + PROP_LABEL, + PROP_SENSITIVE, + PROP_VISIBLE +}; + +enum { + CHANGED, + CLICKED, + LAST_SIGNAL +}; + static guint signal_ids[LAST_SIGNAL]; G_DEFINE_ABSTRACT_TYPE ( @@ -98,7 +103,8 @@ composer_header_constructor (GType type, label = gtk_bin_get_child (GTK_BIN (widget)); } else { widget = gtk_label_new_with_mnemonic (header->priv->label); - gtk_label_set_mnemonic_widget (GTK_LABEL (widget), header->input_widget); + gtk_label_set_mnemonic_widget ( + GTK_LABEL (widget), header->input_widget); label = widget; } @@ -227,7 +233,8 @@ e_composer_header_class_init (EComposerHeaderClass *class) NULL, FALSE, G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS)); g_object_class_install_property ( object_class, @@ -238,7 +245,8 @@ e_composer_header_class_init (EComposerHeaderClass *class) NULL, NULL, G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS)); g_object_class_install_property ( object_class, @@ -248,7 +256,8 @@ e_composer_header_class_init (EComposerHeaderClass *class) NULL, NULL, FALSE, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); g_object_class_install_property ( object_class, @@ -258,7 +267,8 @@ e_composer_header_class_init (EComposerHeaderClass *class) NULL, NULL, FALSE, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); signal_ids[CHANGED] = g_signal_new ( "changed", diff --git a/composer/e-composer-header.h b/composer/e-composer-header.h index 971b55968c..08db97a2d4 100644 --- a/composer/e-composer-header.h +++ b/composer/e-composer-header.h @@ -18,7 +18,7 @@ #ifndef E_COMPOSER_HEADER_H #define E_COMPOSER_HEADER_H -#include "e-composer-common.h" +#include <composer/e-composer-common.h> /* Standard GObject macros */ #define E_TYPE_COMPOSER_HEADER \ diff --git a/composer/e-composer-name-header.c b/composer/e-composer-name-header.c index a99f1cd949..b17cb4a75a 100644 --- a/composer/e-composer-name-header.c +++ b/composer/e-composer-name-header.c @@ -276,11 +276,11 @@ e_composer_name_header_new (const gchar *label, { g_return_val_if_fail (E_IS_NAME_SELECTOR (name_selector), NULL); - return g_object_new (E_TYPE_COMPOSER_NAME_HEADER, - "label", label, - "button", TRUE, - "name-selector", name_selector, - NULL); + return g_object_new ( + E_TYPE_COMPOSER_NAME_HEADER, + "label", label, "button", TRUE, + "name-selector", name_selector, + NULL); } ENameSelector * diff --git a/composer/e-composer-name-header.h b/composer/e-composer-name-header.h index 785f7d11e8..e2f5e0044c 100644 --- a/composer/e-composer-name-header.h +++ b/composer/e-composer-name-header.h @@ -18,12 +18,10 @@ #ifndef E_COMPOSER_NAME_HEADER_H #define E_COMPOSER_NAME_HEADER_H -#include "e-composer-common.h" - #include <libebook/e-destination.h> #include <libedataserverui/e-name-selector.h> -#include "e-composer-header.h" +#include <composer/e-composer-header.h> /* Standard GObject macros */ #define E_TYPE_COMPOSER_NAME_HEADER \ @@ -62,7 +60,6 @@ struct _EComposerNameHeaderClass { GType e_composer_name_header_get_type (void); EComposerHeader * e_composer_name_header_new (const gchar *label, ENameSelector *name_selector); - ENameSelector * e_composer_name_header_get_name_selector (EComposerNameHeader *header); EDestination ** e_composer_name_header_get_destinations diff --git a/composer/e-composer-post-header.h b/composer/e-composer-post-header.h index c38bfe2d17..c6fff3e751 100644 --- a/composer/e-composer-post-header.h +++ b/composer/e-composer-post-header.h @@ -23,7 +23,7 @@ #include <libedataserver/e-account.h> -#include "e-composer-text-header.h" +#include <composer/e-composer-text-header.h> /* Standard GObject macros */ #define E_TYPE_COMPOSER_POST_HEADER \ diff --git a/composer/e-composer-private.c b/composer/e-composer-private.c index 693fd959f5..bd7b46a4ee 100644 --- a/composer/e-composer-private.c +++ b/composer/e-composer-private.c @@ -198,7 +198,8 @@ e_composer_private_constructed (EMsgComposer *composer) gtk_widget_hide (widget); #endif widget = gtkhtml_editor_get_managed_widget (editor, "/main-toolbar"); - gtk_toolbar_set_style (GTK_TOOLBAR (widget), GTK_TOOLBAR_BOTH_HORIZ); + gtk_toolbar_set_style ( + GTK_TOOLBAR (widget), GTK_TOOLBAR_BOTH_HORIZ); gtk_widget_hide (widget); } @@ -318,7 +319,7 @@ e_composer_private_constructed (EMsgComposer *composer) /* Construct the attachment paned. */ if (small_screen_mode) { - /* short attachment bar for Anjal */ + /* Short attachment bar for Anjal. */ e_attachment_paned_set_default_height (75); e_attachment_icon_view_set_default_icon_size (GTK_ICON_SIZE_BUTTON); } diff --git a/composer/e-composer-text-header.c b/composer/e-composer-text-header.c index 28df51ec87..39279237ab 100644 --- a/composer/e-composer-text-header.c +++ b/composer/e-composer-text-header.c @@ -89,19 +89,19 @@ e_composer_text_header_init (EComposerTextHeader *header) EComposerHeader * e_composer_text_header_new_label (const gchar *label) { - return g_object_new (E_TYPE_COMPOSER_TEXT_HEADER, - "label", label, - "button", FALSE, - NULL); + return g_object_new ( + E_TYPE_COMPOSER_TEXT_HEADER, + "label", label, "button", FALSE, + NULL); } EComposerHeader * e_composer_text_header_new_button (const gchar *label) { - return g_object_new (E_TYPE_COMPOSER_TEXT_HEADER, - "label", label, - "button", TRUE, - NULL); + return g_object_new ( + E_TYPE_COMPOSER_TEXT_HEADER, + "label", label, "button", TRUE, + NULL); } const gchar * @@ -112,6 +112,7 @@ e_composer_text_header_get_text (EComposerTextHeader *header) g_return_val_if_fail (E_IS_COMPOSER_TEXT_HEADER (header), NULL); entry = E_COMPOSER_TEXT_HEADER_GET_ENTRY (header); + return gtk_entry_get_text (entry); } @@ -124,5 +125,6 @@ e_composer_text_header_set_text (EComposerTextHeader *header, g_return_if_fail (E_IS_COMPOSER_TEXT_HEADER (header)); entry = E_COMPOSER_TEXT_HEADER_GET_ENTRY (header); + gtk_entry_set_text (entry, (text != NULL) ? text : ""); } diff --git a/composer/e-composer-text-header.h b/composer/e-composer-text-header.h index 278b2b1116..860fcc3c61 100644 --- a/composer/e-composer-text-header.h +++ b/composer/e-composer-text-header.h @@ -21,8 +21,7 @@ #ifndef E_COMPOSER_TEXT_HEADER_H #define E_COMPOSER_TEXT_HEADER_H -#include "e-composer-common.h" -#include "e-composer-header.h" +#include <composer/e-composer-header.h> /* Standard GObject macros */ #define E_TYPE_COMPOSER_TEXT_HEADER \ @@ -57,13 +56,12 @@ struct _EComposerTextHeaderClass { }; GType e_composer_text_header_get_type (void); - EComposerHeader * -e_composer_text_header_new_label (const gchar *label); - + e_composer_text_header_new_label + (const gchar *label); EComposerHeader * -e_composer_text_header_new_button (const gchar *label); - + e_composer_text_header_new_button + (const gchar *label); const gchar * e_composer_text_header_get_text (EComposerTextHeader *header); void e_composer_text_header_set_text (EComposerTextHeader *header, const gchar *text); diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index c41c4019b3..ba7a7a4641 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -522,6 +522,7 @@ build_message_headers (EMsgComposer *composer, if (account != NULL) { CamelMedium *medium; CamelInternetAddress *addr; + const gchar *header_name; const gchar *name = account->id->name; const gchar *address = account->id->address; gchar *transport_uid; @@ -542,18 +543,18 @@ build_message_headers (EMsgComposer *composer, g_object_unref (addr); /* X-Evolution-Account */ - camel_medium_set_header ( - medium, "X-Evolution-Account", account->uid); + header_name = "X-Evolution-Account"; + camel_medium_set_header (medium, header_name, account->uid); /* X-Evolution-Fcc */ - camel_medium_set_header ( - medium, "X-Evolution-Fcc", account->sent_folder_uri); + header_name = "X-Evolution-Fcc"; + camel_medium_set_header (medium, header_name, account->sent_folder_uri); /* X-Evolution-Transport */ + header_name = "X-Evolution-Transport"; transport_uid = g_strconcat ( account->uid, "-transport", NULL); - camel_medium_set_header ( - medium, "X-Evolution-Transport", transport_uid); + camel_medium_set_header (medium, header_name, transport_uid); g_free (transport_uid); } @@ -1102,7 +1103,8 @@ composer_build_message (EMsgComposer *composer, /* Disposition-Notification-To */ if (flags & COMPOSER_FLAG_REQUEST_READ_RECEIPT) { gchar *mdn_address = account->id->reply_to; - if (!mdn_address || !*mdn_address) + + if (mdn_address == NULL || *mdn_address == '\0') mdn_address = account->id->address; camel_medium_add_header ( @@ -1501,7 +1503,8 @@ is_top_signature (EMsgComposer *composer) shell = e_msg_composer_get_shell (composer); shell_settings = e_shell_get_shell_settings (shell); - return e_shell_settings_get_boolean (shell_settings, "composer-top-signature"); + return e_shell_settings_get_boolean ( + shell_settings, "composer-top-signature"); } static gboolean diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h index 296bb35a2f..258d260e3f 100644 --- a/composer/e-msg-composer.h +++ b/composer/e-msg-composer.h @@ -33,7 +33,7 @@ #include <misc/e-web-view.h> #include <shell/e-shell.h> -#include "e-composer-header-table.h" +#include <composer/e-composer-header-table.h> /* Standard GObject macros */ #define E_TYPE_MSG_COMPOSER \ diff --git a/doc/reference/shell/tmpl/e-attachment-store.sgml b/doc/reference/shell/tmpl/e-attachment-store.sgml index f0a8b68944..34884eacc5 100644 --- a/doc/reference/shell/tmpl/e-attachment-store.sgml +++ b/doc/reference/shell/tmpl/e-attachment-store.sgml @@ -201,6 +201,7 @@ e-attachment-store @store: @destination: +@filename_prefix: @callback: @user_data: diff --git a/e-util/e-marshal.list b/e-util/e-marshal.list index ce8e393fce..c42078b2df 100644 --- a/e-util/e-marshal.list +++ b/e-util/e-marshal.list @@ -6,6 +6,7 @@ BOOLEAN:INT,INT,OBJECT,INT,INT,UINT BOOLEAN:INT,POINTER,INT,BOXED BOOLEAN:INT,POINTER,INT,OBJECT,INT,INT,UINT BOOLEAN:NONE +BOOLEAN:OBJECT BOOLEAN:OBJECT,DOUBLE,DOUBLE,BOOLEAN BOOLEAN:POINTER BOOLEAN:POINTER,BOOLEAN,POINTER diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c index 0c6590805f..5768934b1a 100644 --- a/mail/e-mail-backend.c +++ b/mail/e-mail-backend.c @@ -171,7 +171,7 @@ mail_backend_prepare_for_offline_cb (EShell *shell, } e_mail_store_foreach ( - session, (GFunc) mail_store_prepare_for_offline_cb, activity); + backend, (GFunc) mail_store_prepare_for_offline_cb, activity); } /* Helper for mail_backend_prepare_for_online_cb() */ @@ -197,7 +197,7 @@ mail_backend_prepare_for_online_cb (EShell *shell, camel_session_set_online (CAMEL_SESSION (session), TRUE); e_mail_store_foreach ( - session, (GFunc) mail_store_prepare_for_online_cb, activity); + backend, (GFunc) mail_store_prepare_for_online_cb, activity); } /* Helper for mail_backend_prepare_for_quit_cb() */ @@ -272,7 +272,6 @@ mail_backend_prepare_for_quit_cb (EShell *shell, EMailBackend *backend) { EAccountList *account_list; - EMailSession *session; gboolean delete_junk; gboolean empty_trash; @@ -281,8 +280,6 @@ mail_backend_prepare_for_quit_cb (EShell *shell, gboolean empty_trash; } sync_data; - session = e_mail_backend_get_session (backend); - delete_junk = e_mail_backend_delete_junk_policy_decision (backend); empty_trash = e_mail_backend_empty_trash_policy_decision (backend); @@ -298,13 +295,13 @@ mail_backend_prepare_for_quit_cb (EShell *shell, if (delete_junk) e_mail_store_foreach ( - session, (GFunc) mail_backend_delete_junk, backend); + backend, (GFunc) mail_backend_delete_junk, backend); sync_data.activity = activity; sync_data.empty_trash = empty_trash; e_mail_store_foreach ( - session, (GFunc) mail_backend_final_sync, &sync_data); + backend, (GFunc) mail_backend_final_sync, &sync_data); /* Now we poll until all activities are actually cancelled or finished. * Reffing the activity delays quitting; the reference count @@ -579,7 +576,8 @@ mail_backend_folder_changed_cb (MailFolderCache *folder_cache, if (target->new > 0) e_shell_event (e_shell_backend_get_shell (E_SHELL_BACKEND (mail_backend)), "mail-icon", (gpointer) "mail-unread"); - /** @Event: folder.changed + /** + * @Event: folder.changed * @Title: Folder changed * @Target: EMEventTargetFolder * diff --git a/mail/e-mail-migrate.c b/mail/e-mail-migrate.c index 07b2a8bb2c..10afa58e04 100644 --- a/mail/e-mail-migrate.c +++ b/mail/e-mail-migrate.c @@ -701,7 +701,6 @@ migrate_to_db (EShellBackend *shell_backend) EMMigrateSession *session; EAccountList *accounts; EMailBackend *mail_backend; - EMailSession *mail_session; EIterator *iter; gint i = 0, len; CamelStore *store = NULL; @@ -713,11 +712,10 @@ migrate_to_db (EShellBackend *shell_backend) return; mail_backend = E_MAIL_BACKEND (shell_backend); - mail_session = e_mail_backend_get_session (mail_backend); data_dir = e_shell_backend_get_data_dir (shell_backend); /* Initialize the mail stores early so we can add a new one. */ - e_mail_store_init (mail_session, data_dir); + e_mail_store_init (mail_backend, data_dir); iter = e_list_get_iterator ((EList *) accounts); len = e_list_length ((EList *) accounts); @@ -772,7 +770,7 @@ migrate_to_db (EShellBackend *shell_backend) && strncmp (service->url, "mbox:", 5) != 0) { store = e_mail_store_add_by_account ( - mail_session, account); + mail_backend, account); info = camel_store_get_folder_info_sync ( store, NULL, @@ -1020,7 +1018,6 @@ create_mbox_account (EShellBackend *shell_backend, EMMigrateSession *session) { EMailBackend *mail_backend; - EMailSession *mail_session; CamelStore *store; CamelURL *url; EAccountList *accounts; @@ -1029,11 +1026,10 @@ create_mbox_account (EShellBackend *shell_backend, gchar *name, *id, *temp, *uri, *folder_uri; mail_backend = E_MAIL_BACKEND (shell_backend); - mail_session = e_mail_backend_get_session (mail_backend); data_dir = e_shell_backend_get_data_dir (shell_backend); /* Initialize the mail stores early so we can add a new one. */ - e_mail_store_init (mail_session, data_dir); + e_mail_store_init (mail_backend, data_dir); account = e_account_new (); account->enabled = TRUE; @@ -1067,7 +1063,7 @@ create_mbox_account (EShellBackend *shell_backend, } e_account_list_add (accounts, account); - store = e_mail_store_add_by_account (mail_session, account); + store = e_mail_store_add_by_account (mail_backend, account); folder_uri = e_mail_folder_uri_build (store, "Sent"); e_account_set_string ( diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c index 4cc9465c7d..725a0c6d7c 100644 --- a/mail/e-mail-reader-utils.c +++ b/mail/e-mail-reader-utils.c @@ -287,7 +287,6 @@ e_mail_reader_mark_as_read (EMailReader *reader, const gchar *uid) { EMailBackend *backend; - EMailSession *session; EMFormatHTML *formatter; CamelFolder *folder; guint32 mask, set; @@ -300,15 +299,13 @@ e_mail_reader_mark_as_read (EMailReader *reader, backend = e_mail_reader_get_backend (reader); formatter = e_mail_reader_get_formatter (reader); - session = e_mail_backend_get_session (backend); - flags = camel_folder_get_message_flags (folder, uid); if (!(flags & CAMEL_MESSAGE_SEEN)) { CamelMimeMessage *message; message = EM_FORMAT (formatter)->message; - em_utils_handle_receipt (session, folder, uid, message); + em_utils_handle_receipt (backend, folder, uid, message); } mask = CAMEL_MESSAGE_SEEN; diff --git a/mail/e-mail-session-utils.c b/mail/e-mail-session-utils.c index 55221249c4..217e7e2e8e 100644 --- a/mail/e-mail-session-utils.c +++ b/mail/e-mail-session-utils.c @@ -695,14 +695,14 @@ e_mail_session_send_to (EMailSession *session, sent_folder_uri = g_strdup (account->sent_folder_uri); } - string = camel_header_raw_find (&xev, "X-Evolution-Transport", NULL); - if (transport_uid == NULL && string != NULL) - transport_uid = g_strstrip (g_strdup (string)); - string = camel_header_raw_find (&xev, "X-Evolution-Fcc", NULL); if (sent_folder_uri == NULL && string != NULL) sent_folder_uri = g_strstrip (g_strdup (string)); + string = camel_header_raw_find (&xev, "X-Evolution-Transport", NULL); + if (transport_uid == NULL && string != NULL) + transport_uid = g_strstrip (g_strdup (string)); + post_to_uris = g_ptr_array_new (); for (header = xev; header != NULL; header = header->next) { gchar *folder_uri; diff --git a/mail/e-mail-session.c b/mail/e-mail-session.c index 333ee74477..d716357288 100644 --- a/mail/e-mail-session.c +++ b/mail/e-mail-session.c @@ -398,10 +398,17 @@ static guint preparing_flush = 0; static gboolean forward_to_flush_outbox_cb (EMailSession *session) { + EShell *shell; + EShellBackend *shell_backend; + g_return_val_if_fail (preparing_flush != 0, FALSE); + shell = e_shell_get_default (); + shell_backend = e_shell_get_backend_by_name (shell, "mail"); + g_return_val_if_fail (E_IS_MAIL_BACKEND (shell_backend), FALSE); + preparing_flush = 0; - mail_send (session); + mail_send (E_MAIL_BACKEND (shell_backend)); return FALSE; } @@ -458,8 +465,8 @@ set_socks_proxy_from_gsettings (CamelSession *session) static void proxy_gsettings_changed_cb (GSettings *settings, - const gchar *key, - CamelSession *session) + const gchar *key, + CamelSession *session) { set_socks_proxy_from_gsettings (session); } diff --git a/mail/e-mail-store.c b/mail/e-mail-store.c index fe54dd057c..885e34bc6b 100644 --- a/mail/e-mail-store.c +++ b/mail/e-mail-store.c @@ -182,10 +182,11 @@ special_mail_store_is_enabled (CamelStore *store) } static void -mail_store_add (EMailSession *session, +mail_store_add (EMailBackend *backend, CamelStore *store, AddStoreCallback callback) { + EMailSession *session; EMFolderTreeModel *default_model; MailFolderCache *folder_cache; StoreInfo *store_info; @@ -194,6 +195,7 @@ mail_store_add (EMailSession *session, g_return_if_fail (store != NULL); g_return_if_fail (CAMEL_IS_STORE (store)); + session = e_mail_backend_get_session (backend); default_model = em_folder_tree_model_get_default (); folder_cache = e_mail_session_get_folder_cache (session); @@ -228,23 +230,26 @@ mail_store_add_local_done_cb (MailFolderCache *folder_cache, } static void -mail_store_load_accounts (EMailSession *session, +mail_store_load_accounts (EMailBackend *backend, const gchar *data_dir) { CamelStore *local_store; + EMailSession *session; EAccountList *account_list; EIterator *iter; - /* Set up the local store. */ + session = e_mail_backend_get_session (backend); + + /* Add the local store. */ e_mail_local_init (session, data_dir); local_store = e_mail_local_get_store (); mail_store_add ( - session, local_store, (AddStoreCallback) + backend, local_store, (AddStoreCallback) mail_store_add_local_done_cb); - /* Set up remote stores. */ + /* Add mail accounts.. */ account_list = e_get_account_list (); @@ -257,19 +262,19 @@ mail_store_load_accounts (EMailSession *session, if (!account->enabled) continue; - e_mail_store_add_by_account (session, account); + e_mail_store_add_by_account (backend, account); } g_object_unref (iter); } void -e_mail_store_init (EMailSession *session, +e_mail_store_init (EMailBackend *backend, const gchar *data_dir) { static gboolean initialized = FALSE; - g_return_if_fail (E_IS_MAIL_SESSION (session)); + g_return_if_fail (E_IS_MAIL_BACKEND (backend)); /* This function is idempotent because mail * migration code may need to call it early. */ @@ -283,34 +288,37 @@ e_mail_store_init (EMailSession *session, (GDestroyNotify) NULL, (GDestroyNotify) store_table_free); - mail_store_load_accounts (session, data_dir); + mail_store_load_accounts (backend, data_dir); initialized = TRUE; } void -e_mail_store_add (EMailSession *session, +e_mail_store_add (EMailBackend *backend, CamelStore *store) { - g_return_if_fail (E_IS_MAIL_SESSION (session)); + g_return_if_fail (E_IS_MAIL_BACKEND (backend)); g_return_if_fail (CAMEL_IS_STORE (store)); - mail_store_add (session, store, NULL); + mail_store_add (backend, store, NULL); } CamelStore * -e_mail_store_add_by_account (EMailSession *session, +e_mail_store_add_by_account (EMailBackend *backend, EAccount *account) { + EMailSession *session; CamelService *service = NULL; CamelProvider *provider; CamelURL *url; gboolean skip, transport_only; GError *error = NULL; - g_return_val_if_fail (E_IS_MAIL_SESSION (session), NULL); + g_return_val_if_fail (E_IS_MAIL_BACKEND (backend), NULL); g_return_val_if_fail (E_IS_ACCOUNT (account), NULL); + session = e_mail_backend_get_session (backend); + /* check whether it's transport-only accounts */ transport_only = !account->source || !account->source->url || !*account->source->url; if (transport_only) @@ -376,7 +384,7 @@ handle_transport: } if (!skip && (provider->flags & CAMEL_PROVIDER_IS_STORAGE)) - e_mail_store_add (session, CAMEL_STORE (service)); + e_mail_store_add (backend, CAMEL_STORE (service)); return CAMEL_STORE (service); @@ -392,16 +400,19 @@ fail: } void -e_mail_store_remove (EMailSession *session, +e_mail_store_remove (EMailBackend *backend, CamelStore *store) { + EMailSession *session; MailFolderCache *folder_cache; EMFolderTreeModel *default_model; - g_return_if_fail (E_IS_MAIL_SESSION (session)); + g_return_if_fail (E_IS_MAIL_BACKEND (backend)); g_return_if_fail (CAMEL_IS_STORE (store)); g_return_if_fail (store_table != NULL); + session = e_mail_backend_get_session (backend); + /* Because the store table holds a reference to each store used * as a key in it, none of them will ever be gc'ed, meaning any * call to camel_session_get_{service,store} with the same URL @@ -426,43 +437,48 @@ e_mail_store_remove (EMailSession *session, } void -e_mail_store_remove_by_account (EMailSession *session, +e_mail_store_remove_by_account (EMailBackend *backend, EAccount *account) { + EMailSession *session; CamelService *service; CamelProvider *provider; + const gchar *uid; - g_return_if_fail (E_IS_MAIL_SESSION (session)); + g_return_if_fail (E_IS_MAIL_BACKEND (backend)); g_return_if_fail (E_IS_ACCOUNT (account)); - provider = camel_provider_get (account->source->url, NULL); - if (provider == NULL) - return; + uid = account->uid; + session = e_mail_backend_get_session (backend); - if (!(provider->flags & CAMEL_PROVIDER_IS_STORAGE)) - return; + service = camel_session_get_service (CAMEL_SESSION (session), uid); + g_return_if_fail (CAMEL_IS_STORE (service)); - service = camel_session_get_service ( - CAMEL_SESSION (session), account->uid); + provider = camel_service_get_provider (service); + g_return_if_fail (provider != NULL); - g_return_if_fail (CAMEL_IS_STORE (service)); + if (!(provider->flags & CAMEL_PROVIDER_IS_STORAGE)) + return; - e_mail_store_remove (session, CAMEL_STORE (service)); + e_mail_store_remove (backend, CAMEL_STORE (service)); } void -e_mail_store_foreach (EMailSession *session, +e_mail_store_foreach (EMailBackend *backend, GFunc func, gpointer user_data) { + EMailSession *session; GList *list, *link; /* XXX This is a silly convenience function. * Could probably just get rid of it. */ - g_return_if_fail (E_IS_MAIL_SESSION (session)); + g_return_if_fail (E_IS_MAIL_BACKEND (backend)); g_return_if_fail (func != NULL); + session = e_mail_backend_get_session (backend); + list = camel_session_list_services (CAMEL_SESSION (session)); for (link = list; link != NULL; link = g_list_next (link)) { diff --git a/mail/e-mail-store.h b/mail/e-mail-store.h index 5dca416e09..2c676d4fc4 100644 --- a/mail/e-mail-store.h +++ b/mail/e-mail-store.h @@ -23,22 +23,22 @@ #define E_MAIL_STORE_H #include <camel/camel.h> -#include <mail/e-mail-session.h> +#include <mail/e-mail-backend.h> #include <libedataserver/e-account.h> G_BEGIN_DECLS -void e_mail_store_init (EMailSession *session, +void e_mail_store_init (EMailBackend *backend, const gchar *data_dir); -void e_mail_store_add (EMailSession *session, +void e_mail_store_add (EMailBackend *backend, CamelStore *store); -CamelStore * e_mail_store_add_by_account (EMailSession *session, +CamelStore * e_mail_store_add_by_account (EMailBackend *backend, EAccount *account); -void e_mail_store_remove (EMailSession *session, +void e_mail_store_remove (EMailBackend *backend, CamelStore *store); -void e_mail_store_remove_by_account (EMailSession *session, +void e_mail_store_remove_by_account (EMailBackend *backend, EAccount *account); -void e_mail_store_foreach (EMailSession *session, +void e_mail_store_foreach (EMailBackend *backend, GFunc func, gpointer user_data); diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c index 5f2289ab58..8ec881b1f0 100644 --- a/mail/em-account-editor.c +++ b/mail/em-account-editor.c @@ -4108,11 +4108,9 @@ emae_commit (EConfig *ec, && emae->priv->source.provider && (emae->priv->source.provider->flags & CAMEL_PROVIDER_IS_STORAGE)) { EMailBackend *backend; - EMailSession *session; backend = em_account_editor_get_backend (emae); - session = e_mail_backend_get_session (backend); - e_mail_store_add_by_account (session, account); + e_mail_store_add_by_account (backend, account); } } diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index 1dfa3c4a58..837cc31f62 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -1750,7 +1750,7 @@ em_utils_forward_messages (EMailReader *reader, CamelFolder *folder, GPtrArray *uids, EMailForwardStyle style, - GtkWidget *destroy_when_done) + GtkWidget *destroy_when_done) { EActivity *activity; AsyncContext *context; @@ -1846,7 +1846,7 @@ em_utils_redirect_message (EShell *shell, /* Message disposition notifications, rfc 2298 */ void -em_utils_handle_receipt (EMailSession *session, +em_utils_handle_receipt (EMailBackend *backend, CamelFolder *folder, const gchar *message_uid, CamelMimeMessage *message) @@ -1855,7 +1855,7 @@ em_utils_handle_receipt (EMailSession *session, const gchar *addr; CamelMessageInfo *info; - g_return_if_fail (E_IS_MAIL_SESSION (session)); + g_return_if_fail (E_IS_MAIL_BACKEND (backend)); g_return_if_fail (CAMEL_IS_FOLDER (folder)); g_return_if_fail (CAMEL_IS_MIME_MESSAGE (message)); @@ -1911,23 +1911,23 @@ em_utils_handle_receipt (EMailSession *session, return; } - em_utils_send_receipt (session, folder, message); + em_utils_send_receipt (backend, folder, message); } static void em_utils_receipt_done (CamelFolder *folder, GAsyncResult *result, - EMailSession *session) + EMailBackend *backend) { /* FIXME Poor error handling. */ if (!e_mail_folder_append_message_finish (folder, result, NULL, NULL)) return; - mail_send (session); + mail_send (backend); } void -em_utils_send_receipt (EMailSession *session, +em_utils_send_receipt (EMailBackend *backend, CamelFolder *folder, CamelMimeMessage *message) { @@ -2102,7 +2102,7 @@ em_utils_send_receipt (EMailSession *session, /* FIXME Pass a GCancellable. */ e_mail_folder_append_message ( out_folder, receipt, info, G_PRIORITY_DEFAULT, NULL, - (GAsyncReadyCallback) em_utils_receipt_done, session); + (GAsyncReadyCallback) em_utils_receipt_done, backend); camel_message_info_free (info); } @@ -2485,18 +2485,24 @@ concat_unique_addrs (CamelInternetAddress *dest, } } -static void -get_reply_all (CamelMimeMessage *message, - CamelInternetAddress *to, - CamelInternetAddress *cc, - CamelNNTPAddress *postto) +void +em_utils_get_reply_all (CamelMimeMessage *message, + CamelInternetAddress *to, + CamelInternetAddress *cc, + CamelNNTPAddress *postto) { - CamelInternetAddress *reply_to, *to_addrs, *cc_addrs; + CamelInternetAddress *reply_to; + CamelInternetAddress *to_addrs; + CamelInternetAddress *cc_addrs; CamelMedium *medium; const gchar *name, *addr; const gchar *posthdr = NULL; GHashTable *rcpt_hash; + g_return_if_fail (CAMEL_IS_MIME_MESSAGE (message)); + g_return_if_fail (CAMEL_IS_INTERNET_ADDRESS (to)); + g_return_if_fail (CAMEL_IS_INTERNET_ADDRESS (cc)); + medium = CAMEL_MEDIUM (message); /* check whether there is a 'Newsgroups: ' header in there */ @@ -2512,8 +2518,10 @@ get_reply_all (CamelMimeMessage *message, rcpt_hash = em_utils_generate_account_hash (); reply_to = get_reply_to (message); - to_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO); - cc_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC); + to_addrs = camel_mime_message_get_recipients ( + message, CAMEL_RECIPIENT_TYPE_TO); + cc_addrs = camel_mime_message_get_recipients ( + message, CAMEL_RECIPIENT_TYPE_CC); if (reply_to != NULL) { gint ii = 0; @@ -2556,15 +2564,6 @@ get_reply_all (CamelMimeMessage *message, g_hash_table_destroy (rcpt_hash); } -void -em_utils_get_reply_all (CamelMimeMessage *message, - CamelInternetAddress *to, - CamelInternetAddress *cc, - CamelNNTPAddress *postto) -{ - get_reply_all (message, to, cc, postto); -} - enum { ATTRIB_UNKNOWN, ATTRIB_CUSTOM, @@ -2947,7 +2946,7 @@ em_utils_reply_to_message (EShell *shell, if (folder) postto = camel_nntp_address_new (); - get_reply_all (message, to, cc, postto); + em_utils_get_reply_all (message, to, cc, postto); break; } diff --git a/mail/em-composer-utils.h b/mail/em-composer-utils.h index 3dba3e9216..bd6eb7cffd 100644 --- a/mail/em-composer-utils.h +++ b/mail/em-composer-utils.h @@ -25,9 +25,9 @@ #define EM_COMPOSER_UTILS_H #include <em-format/em-format.h> +#include <mail/e-mail-backend.h> #include <mail/e-mail-enums.h> #include <mail/e-mail-reader.h> -#include <mail/e-mail-session.h> #include <composer/e-msg-composer.h> G_BEGIN_DECLS @@ -58,11 +58,11 @@ void em_utils_forward_messages (EMailReader *reader, GtkWidget *destroy_when_done); void em_utils_redirect_message (EShell *shell, CamelMimeMessage *message); -void em_utils_handle_receipt (EMailSession *session, +void em_utils_handle_receipt (EMailBackend *backend, CamelFolder *folder, const gchar *message_uid, CamelMimeMessage *message); -void em_utils_send_receipt (EMailSession *session, +void em_utils_send_receipt (EMailBackend *backend, CamelFolder *folder, CamelMimeMessage *message); gchar * em_utils_construct_composer_text diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c index 5f8e9dd41d..1e7840710f 100644 --- a/mail/em-folder-tree-model.c +++ b/mail/em-folder-tree-model.c @@ -34,11 +34,11 @@ #include <errno.h> #include <sys/stat.h> +#include <glib/gi18n.h> + #include "e-util/e-util.h" #include "e-util/e-account-utils.h" -#include <glib/gi18n.h> - #include "mail-tools.h" #include "mail-mt.h" #include "mail-ops.h" @@ -288,12 +288,10 @@ account_added_cb (EAccountList *accounts, EMFolderTreeModel *model) { EMailBackend *backend; - EMailSession *session; backend = em_folder_tree_model_get_backend (model); - session = e_mail_backend_get_session (backend); - e_mail_store_add_by_account (session, account); + e_mail_store_add_by_account (backend, account); } static void @@ -458,7 +456,6 @@ folder_tree_model_get_property (GObject *object, G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } - static void folder_tree_model_dispose (GObject *object) { diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 061c3540f7..1d831cc4e4 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -1780,17 +1780,15 @@ em_folder_tree_new_with_model (EMailBackend *backend, EAlertSink *alert_sink, EMFolderTreeModel *model) { - EMailSession *session; const gchar *data_dir; g_return_val_if_fail (E_IS_MAIL_BACKEND (backend), NULL); g_return_val_if_fail (E_IS_ALERT_SINK (alert_sink), NULL); g_return_val_if_fail (EM_IS_FOLDER_TREE_MODEL (model), NULL); - session = e_mail_backend_get_session (backend); data_dir = e_shell_backend_get_data_dir (E_SHELL_BACKEND (backend)); - e_mail_store_init (session, data_dir); + e_mail_store_init (backend, data_dir); return g_object_new ( EM_TYPE_FOLDER_TREE, diff --git a/mail/em-subscription-editor.c b/mail/em-subscription-editor.c index e2452d70bf..09b74bcb3c 100644 --- a/mail/em-subscription-editor.c +++ b/mail/em-subscription-editor.c @@ -51,7 +51,7 @@ typedef struct _AsyncContext AsyncContext; typedef struct _StoreData StoreData; struct _EMSubscriptionEditorPrivate { - CamelSession *session; + EMailBackend *backend; CamelStore *initial_store; GtkWidget *combo_box; /* not referenced */ @@ -95,7 +95,7 @@ struct _StoreData { enum { PROP_0, - PROP_SESSION, + PROP_BACKEND, PROP_STORE }; @@ -932,13 +932,13 @@ subscription_editor_set_store (EMSubscriptionEditor *editor, } static void -subscription_editor_set_session (EMSubscriptionEditor *editor, - CamelSession *session) +subscription_editor_set_backend (EMSubscriptionEditor *editor, + EMailBackend *backend) { - g_return_if_fail (CAMEL_IS_SESSION (session)); - g_return_if_fail (editor->priv->session == NULL); + g_return_if_fail (E_IS_MAIL_BACKEND (backend)); + g_return_if_fail (editor->priv->backend == NULL); - editor->priv->session = g_object_ref (session); + editor->priv->backend = g_object_ref (backend); } static void @@ -948,8 +948,8 @@ subscription_editor_set_property (GObject *object, GParamSpec *pspec) { switch (property_id) { - case PROP_SESSION: - subscription_editor_set_session ( + case PROP_BACKEND: + subscription_editor_set_backend ( EM_SUBSCRIPTION_EDITOR (object), g_value_get_object (value)); return; @@ -971,10 +971,10 @@ subscription_editor_get_property (GObject *object, GParamSpec *pspec) { switch (property_id) { - case PROP_SESSION: + case PROP_BACKEND: g_value_set_object ( value, - em_subscription_editor_get_session ( + em_subscription_editor_get_backend ( EM_SUBSCRIPTION_EDITOR (object))); return; @@ -996,9 +996,9 @@ subscription_editor_dispose (GObject *object) priv = EM_SUBSCRIPTION_EDITOR_GET_PRIVATE (object); - if (priv->session != NULL) { - g_object_unref (priv->session); - priv->session = NULL; + if (priv->backend != NULL) { + g_object_unref (priv->backend); + priv->backend = NULL; } if (priv->initial_store != NULL) { @@ -1044,14 +1044,17 @@ subscription_editor_constructed (GObject *object) if (editor->priv->initial_store == NULL) { EAccount *account; CamelService *service; - CamelSession *session; - const gchar *uid; + EMailBackend *backend; + EMailSession *session; account = e_get_default_account (); - uid = account->uid; - session = em_subscription_editor_get_session (editor); - service = camel_session_get_service (session, uid); + backend = em_subscription_editor_get_backend (editor); + session = e_mail_backend_get_session (backend); + + service = camel_session_get_service ( + CAMEL_SESSION (session), + account->uid); if (CAMEL_IS_SUBSCRIBABLE (service)) editor->priv->initial_store = g_object_ref (service); @@ -1122,12 +1125,12 @@ em_subscription_editor_class_init (EMSubscriptionEditorClass *class) g_object_class_install_property ( object_class, - PROP_SESSION, + PROP_BACKEND, g_param_spec_object ( - "session", + "backend", NULL, NULL, - CAMEL_TYPE_SESSION, + E_TYPE_MAIL_BACKEND, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); @@ -1343,26 +1346,26 @@ em_subscription_editor_init (EMSubscriptionEditor *editor) GtkWidget * em_subscription_editor_new (GtkWindow *parent, - CamelSession *session, + EMailBackend *backend, CamelStore *initial_store) { g_return_val_if_fail (GTK_IS_WINDOW (parent), NULL); - g_return_val_if_fail (CAMEL_IS_SESSION (session), NULL); + g_return_val_if_fail (E_IS_MAIL_BACKEND (backend), NULL); return g_object_new ( EM_TYPE_SUBSCRIPTION_EDITOR, - "session", session, + "backend", backend, "store", initial_store, "transient-for", parent, NULL); } -CamelSession * -em_subscription_editor_get_session (EMSubscriptionEditor *editor) +EMailBackend * +em_subscription_editor_get_backend (EMSubscriptionEditor *editor) { g_return_val_if_fail (EM_IS_SUBSCRIPTION_EDITOR (editor), NULL); - return editor->priv->session; + return editor->priv->backend; } CamelStore * diff --git a/mail/em-subscription-editor.h b/mail/em-subscription-editor.h index d75347760b..80b371f744 100644 --- a/mail/em-subscription-editor.h +++ b/mail/em-subscription-editor.h @@ -21,6 +21,7 @@ #include <gtk/gtk.h> #include <camel/camel.h> +#include <mail/e-mail-backend.h> /* Standard GObject macros */ #define EM_TYPE_SUBSCRIPTION_EDITOR \ @@ -58,9 +59,9 @@ struct _EMSubscriptionEditorClass { GType em_subscription_editor_get_type (void); GtkWidget * em_subscription_editor_new (GtkWindow *parent, - CamelSession *session, + EMailBackend *backend, CamelStore *initial_store); -CamelSession * em_subscription_editor_get_session +EMailBackend * em_subscription_editor_get_backend (EMSubscriptionEditor *editor); CamelStore * em_subscription_editor_get_store (EMSubscriptionEditor *editor); diff --git a/mail/em-utils.c b/mail/em-utils.c index 4a74a80fc2..67978884d0 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -2316,7 +2316,8 @@ free_account_sort_order_cache (void) } static void -fill_accounts_sort_order_cache (EMailBackend *backend, gboolean force_reload) +fill_accounts_sort_order_cache (EMailBackend *backend, + gboolean force_reload) { GSList *account_uids; @@ -2380,7 +2381,8 @@ emu_get_sort_order_key_file (EMailBackend *backend) } void -em_utils_save_accounts_sort_order (EMailBackend *backend, const GSList *account_uids) +em_utils_save_accounts_sort_order (EMailBackend *backend, + const GSList *account_uids) { gchar *filename; GKeyFile *key_file; @@ -2445,7 +2447,8 @@ em_utils_load_accounts_sort_order (EMailBackend *backend) } guint -em_utils_get_account_sort_order (EMailBackend *backend, const gchar *account_uid) +em_utils_get_account_sort_order (EMailBackend *backend, + const gchar *account_uid) { guint res; diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index 0e1ac98413..30bbce6579 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -39,8 +39,8 @@ #include <glib/gstdio.h> #include <libedataserver/e-data-server-util.h> -#include "e-util/e-marshal.h" -#include "e-util/e-util.h" +#include <e-util/e-marshal.h> +#include <e-util/e-util.h> #include "mail-mt.h" #include "mail-folder-cache.h" diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 2c4b3067df..0ff745e413 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -452,7 +452,7 @@ static const gchar *resent_recipients[] = { struct _send_queue_msg { MailMsg base; - EMailSession *session; + EMailBackend *backend; CamelFolder *queue; CamelTransport *transport; @@ -483,6 +483,7 @@ mail_send_message (struct _send_queue_msg *m, GError **error) { EAccount *account = NULL; + EMailSession *session; const CamelInternetAddress *iaddr; CamelAddress *from, *recipients; CamelMessageInfo *info = NULL; @@ -504,11 +505,13 @@ mail_send_message (struct _send_queue_msg *m, camel_medium_set_header (CAMEL_MEDIUM (message), "X-Mailer", x_mailer); - err = g_string_new(""); + err = g_string_new (""); xev = mail_tool_remove_xevolution_headers (message); - tmp = camel_header_raw_find(&xev, "X-Evolution-Account", NULL); - if (tmp) { + session = e_mail_backend_get_session (m->backend); + + tmp = camel_header_raw_find (&xev, "X-Evolution-Account", NULL); + if (tmp != NULL) { gchar *name; name = g_strstrip (g_strdup (tmp)); @@ -522,7 +525,7 @@ mail_send_message (struct _send_queue_msg *m, transport_uid = g_strconcat ( account->uid, "-transport", NULL); service = camel_session_get_service ( - CAMEL_SESSION (m->session), + CAMEL_SESSION (session), transport_uid); g_free (transport_uid); @@ -607,7 +610,7 @@ mail_send_message (struct _send_queue_msg *m, uri = g_strstrip (g_strdup (header->value)); /* FIXME Not passing a GCancellable or GError here. */ folder = e_mail_session_uri_to_folder_sync ( - m->session, uri, 0, NULL, NULL); + session, uri, 0, NULL, NULL); if (folder) { /* FIXME Not passing a GCancellable or GError here. */ camel_folder_append_message_sync ( @@ -647,7 +650,7 @@ mail_send_message (struct _send_queue_msg *m, if (sent_folder_uri) { folder = e_mail_session_uri_to_folder_sync ( - m->session, sent_folder_uri, 0, + session, sent_folder_uri, 0, cancellable, &local_error); if (folder == NULL) { g_string_append_printf ( @@ -714,7 +717,7 @@ mail_send_message (struct _send_queue_msg *m, if (local_error == NULL) { /* Mark the draft message for deletion, if present. */ e_mail_session_handle_draft_headers_sync ( - m->session, message, cancellable, &local_error); + session, message, cancellable, &local_error); if (local_error != NULL) { g_warning ("%s: Failed to handle draft headers: %s", G_STRFUNC, local_error->message); g_clear_error (&local_error); @@ -724,7 +727,7 @@ mail_send_message (struct _send_queue_msg *m, * Source message refers to the message being forwarded * or replied to. */ e_mail_session_handle_source_headers_sync ( - m->session, message, cancellable, &local_error); + session, message, cancellable, &local_error); if (local_error != NULL) { g_warning ("%s: Failed to handle source headers: %s", G_STRFUNC, local_error->message); g_clear_error (&local_error); @@ -766,8 +769,6 @@ exit: camel_header_raw_clear (&xev); g_string_free (err, TRUE); g_object_unref (message); - - return; } /* ** SEND MAIL QUEUE ***************************************************** */ @@ -930,8 +931,8 @@ send_queue_desc (struct _send_queue_msg *m) static void send_queue_free (struct _send_queue_msg *m) { - if (m->session != NULL) - g_object_unref (m->session); + if (m->backend != NULL) + g_object_unref (m->backend); if (m->driver != NULL) g_object_unref (m->driver); if (m->transport != NULL) @@ -950,7 +951,7 @@ static MailMsgInfo send_queue_info = { /* same interface as fetch_mail, just 'cause i'm lazy today * (and we need to run it from the same spot?) */ void -mail_send_queue (EMailSession *session, +mail_send_queue (EMailBackend *backend, CamelFolder *queue, CamelTransport *transport, const gchar *type, @@ -962,10 +963,15 @@ mail_send_queue (EMailSession *session, void (*done)(gpointer data), gpointer data) { + EMailSession *session; struct _send_queue_msg *m; + g_return_if_fail (E_IS_MAIL_BACKEND (backend)); + + session = e_mail_backend_get_session (backend); + m = mail_msg_new (&send_queue_info); - m->session = g_object_ref (session); + m->backend = g_object_ref (backend); m->queue = g_object_ref (queue); m->transport = g_object_ref (transport); if (G_IS_CANCELLABLE (cancellable)) diff --git a/mail/mail-ops.h b/mail/mail-ops.h index 32784be245..4ec64ccf22 100644 --- a/mail/mail-ops.h +++ b/mail/mail-ops.h @@ -63,7 +63,7 @@ void mail_xfer_folder (const gchar *src_uri, const gchar *dest_uri, gboolean rem gpointer data); /* yeah so this is messy, but it does a lot, maybe i can consolidate all user_data's to be the one */ -void mail_send_queue (EMailSession *session, +void mail_send_queue (EMailBackend *backend, CamelFolder *queue, CamelTransport *transport, const gchar *type, diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c index 5fda76d103..33ac977e35 100644 --- a/mail/mail-send-recv.c +++ b/mail/mail-send-recv.c @@ -107,7 +107,7 @@ typedef enum { struct _send_info { send_info_t type; /* 0 = fetch, 1 = send */ - EMailSession *session; + EMailBackend *backend; GCancellable *cancellable; gchar *service_uid; gboolean keep_on_server; @@ -151,8 +151,8 @@ free_folder_info (struct _folder_info *info) static void free_send_info (struct _send_info *info) { - if (info->session) - g_object_unref (info->session); + if (info->backend) + g_object_unref (info->backend); if (info->cancellable) g_object_unref (info->cancellable); g_free (info->service_uid); @@ -425,7 +425,7 @@ get_receive_type (CamelURL *url) static struct _send_data * build_dialog (GtkWindow *parent, - EMailSession *session, + EMailBackend *backend, EAccountList *accounts, CamelFolder *outbox, EAccount *outgoing_account, @@ -552,7 +552,7 @@ build_dialog (GtkWindow *parent, info = g_malloc0 (sizeof (*info)); info->type = type; - info->session = g_object_ref (session); + info->backend = g_object_ref (backend); d(printf("adding source %s\n", source->url)); @@ -802,21 +802,24 @@ receive_done (gpointer data) /* if we've been called to run again - run again */ if (info->type == SEND_SEND && info->state == SEND_ACTIVE && info->again) { + EMailSession *session; CamelFolder *local_outbox; CamelService *service; + session = e_mail_backend_get_session (info->backend); + local_outbox = e_mail_local_get_folder ( E_MAIL_LOCAL_FOLDER_OUTBOX); service = camel_session_get_service ( - CAMEL_SESSION (info->session), + CAMEL_SESSION (session), info->service_uid); g_return_if_fail (CAMEL_IS_TRANSPORT (service)); info->again = 0; mail_send_queue ( - info->session, + info->backend, local_outbox, CAMEL_TRANSPORT (service), E_FILTER_SOURCE_OUTGOING, @@ -875,19 +878,24 @@ receive_get_folder (CamelFilterDriver *d, { struct _send_info *info = data; CamelFolder *folder; + EMailSession *session; struct _folder_info *oldinfo; gpointer oldkey, oldinfoptr; g_mutex_lock (info->data->lock); oldinfo = g_hash_table_lookup (info->data->folders, uri); g_mutex_unlock (info->data->lock); + if (oldinfo) { g_object_ref (oldinfo->folder); return oldinfo->folder; } + + session = e_mail_backend_get_session (info->backend); + /* FIXME Not passing a GCancellable here. */ folder = e_mail_session_uri_to_folder_sync ( - info->session, uri, 0, NULL, error); + session, uri, 0, NULL, error); if (!folder) return NULL; @@ -965,6 +973,7 @@ refresh_folders_exec (struct _refresh_folders_msg *m, GError **error) { CamelFolder *folder; + EMailSession *session; gint i; GError *local_error = NULL; gulong handler_id = 0; @@ -978,9 +987,11 @@ refresh_folders_exec (struct _refresh_folders_msg *m, camel_operation_push_message (m->info->cancellable, _("Updating...")); + session = e_mail_backend_get_session (m->info->backend); + for (i = 0; i < m->folders->len; i++) { folder = e_mail_session_uri_to_folder_sync ( - m->info->session, + session, m->folders->pdata[i], 0, cancellable, &local_error); if (folder) { @@ -1068,14 +1079,16 @@ static void receive_update_got_store (CamelStore *store, struct _send_info *info) { + EMailSession *session; MailFolderCache *folder_cache; - folder_cache = e_mail_session_get_folder_cache (info->session); + session = e_mail_backend_get_session (info->backend); + folder_cache = e_mail_session_get_folder_cache (session); if (store) { mail_folder_cache_note_store ( folder_cache, - CAMEL_SESSION (info->session), + CAMEL_SESSION (session), store, info->cancellable, receive_update_got_folderinfo, info); } else { @@ -1085,11 +1098,12 @@ receive_update_got_store (CamelStore *store, static GtkWidget * send_receive (GtkWindow *parent, - EMailSession *session, + EMailBackend *backend, gboolean allow_send) { CamelFolder *local_outbox; struct _send_data *data; + EMailSession *session; EAccountList *accounts; EAccount *account; GList *scan; @@ -1101,6 +1115,8 @@ send_receive (GtkWindow *parent, return send_recv_dialog; } + session = e_mail_backend_get_session (backend); + if (!camel_session_get_online (CAMEL_SESSION (session))) return send_recv_dialog; @@ -1112,7 +1128,7 @@ send_receive (GtkWindow *parent, local_outbox = e_mail_local_get_folder (E_MAIL_LOCAL_FOLDER_OUTBOX); data = build_dialog ( - parent, session, accounts, + parent, backend, accounts, local_outbox, account, allow_send); for (scan = data->infos; scan != NULL; scan = scan->next) { @@ -1139,7 +1155,7 @@ send_receive (GtkWindow *parent, case SEND_SEND: /* todo, store the folder in info? */ mail_send_queue ( - session, local_outbox, + backend, local_outbox, CAMEL_TRANSPORT (service), E_FILTER_SOURCE_OUTGOING, info->cancellable, @@ -1161,21 +1177,21 @@ send_receive (GtkWindow *parent, GtkWidget * mail_send_receive (GtkWindow *parent, - EMailSession *session) + EMailBackend *backend) { - return send_receive (parent, session, TRUE); + return send_receive (parent, backend, TRUE); } GtkWidget * mail_receive (GtkWindow *parent, - EMailSession *session) + EMailBackend *backend) { - return send_receive (parent, session, FALSE); + return send_receive (parent, backend, FALSE); } struct _auto_data { EAccount *account; - EMailSession *session; + EMailBackend *backend; gint period; /* in seconds */ gint timeout_id; }; @@ -1185,10 +1201,13 @@ static GHashTable *auto_active; static gboolean auto_timeout (gpointer data) { + EMailSession *session; struct _auto_data *info = data; - if (camel_session_get_online (CAMEL_SESSION (info->session))) - mail_receive_account (info->session, info->account); + session = e_mail_backend_get_session (info->backend); + + if (camel_session_get_online (CAMEL_SESSION (session))) + mail_receive_account (info->backend, info->account); return TRUE; } @@ -1211,8 +1230,8 @@ auto_account_removed (EAccountList *eal, static void auto_account_finalized (struct _auto_data *info) { - if (info->session != NULL) - g_object_unref (info->session); + if (info->backend != NULL) + g_object_unref (info->backend); if (info->timeout_id) g_source_remove (info->timeout_id); g_free (info); @@ -1243,13 +1262,13 @@ auto_account_commit (struct _auto_data *info) static void auto_account_added (EAccountList *eal, EAccount *ea, - EMailSession *session) + EMailBackend *backend) { struct _auto_data *info; info = g_malloc0 (sizeof (*info)); info->account = ea; - info->session = g_object_ref (session); + info->backend = g_object_ref (backend); g_object_set_data_full ( G_OBJECT (ea), "mail-autoreceive", info, (GDestroyNotify) auto_account_finalized); @@ -1314,7 +1333,6 @@ mail_autoreceive_init (EMailBackend *backend) { EShellBackend *shell_backend; EShellSettings *shell_settings; - EMailSession *session; EAccountList *accounts; EIterator *iter; EShell *shell; @@ -1327,11 +1345,9 @@ mail_autoreceive_init (EMailBackend *backend) accounts = e_get_account_list (); auto_active = g_hash_table_new (g_str_hash, g_str_equal); - session = e_mail_backend_get_session (backend); - g_signal_connect ( accounts, "account-added", - G_CALLBACK (auto_account_added), session); + G_CALLBACK (auto_account_added), backend); g_signal_connect ( accounts, "account-removed", G_CALLBACK (auto_account_removed), NULL); @@ -1344,7 +1360,7 @@ mail_autoreceive_init (EMailBackend *backend) e_iterator_next (iter)) auto_account_added ( accounts, (EAccount *) - e_iterator_get (iter), session); + e_iterator_get (iter), backend); shell_backend = E_SHELL_BACKEND (backend); shell = e_shell_backend_get_shell (shell_backend); @@ -1356,7 +1372,7 @@ mail_autoreceive_init (EMailBackend *backend) /* also flush outbox on start */ if (e_shell_get_online (shell)) - mail_send (session); + mail_send (backend); } g_signal_connect ( @@ -1367,11 +1383,12 @@ mail_autoreceive_init (EMailBackend *backend) /* We setup the download info's in a hashtable, if we later * need to build the gui, we insert them in to add them. */ void -mail_receive_account (EMailSession *session, +mail_receive_account (EMailBackend *backend, EAccount *account) { struct _send_info *info; struct _send_data *data; + EMailSession *session; CamelFolder *local_outbox; CamelService *service; CamelURL *url; @@ -1394,7 +1411,7 @@ mail_receive_account (EMailSession *session, info = g_malloc0 (sizeof (*info)); info->type = type; - info->session = g_object_ref (session); + info->backend = g_object_ref (backend); info->progress_bar = NULL; info->status_label = NULL; info->service_uid = g_strdup (account->uid); @@ -1413,6 +1430,8 @@ mail_receive_account (EMailSession *session, g_hash_table_insert (data->active, account->uid, info); + session = e_mail_backend_get_session (backend); + service = camel_session_get_service ( CAMEL_SESSION (session), account->uid); @@ -1434,7 +1453,7 @@ mail_receive_account (EMailSession *session, local_outbox = e_mail_local_get_folder ( E_MAIL_LOCAL_FOLDER_OUTBOX); mail_send_queue ( - info->session, + info->backend, local_outbox, CAMEL_TRANSPORT (service), E_FILTER_SOURCE_OUTGOING, @@ -1452,10 +1471,11 @@ mail_receive_account (EMailSession *session, } void -mail_send (EMailSession *session) +mail_send (EMailBackend *backend) { CamelFolder *local_outbox; CamelService *service; + EMailSession *session; EAccount *account; CamelURL *url; struct _send_info *info; @@ -1490,7 +1510,7 @@ mail_send (EMailSession *session) info = g_malloc0 (sizeof (*info)); info->type = SEND_SEND; - info->session = g_object_ref (session); + info->backend = g_object_ref (backend); info->progress_bar = NULL; info->status_label = NULL; info->service_uid = g_strdup (transport_uid); @@ -1508,6 +1528,8 @@ mail_send (EMailSession *session) /* todo, store the folder in info? */ local_outbox = e_mail_local_get_folder (E_MAIL_LOCAL_FOLDER_OUTBOX); + session = e_mail_backend_get_session (backend); + service = camel_session_get_service ( CAMEL_SESSION (session), transport_uid); @@ -1516,7 +1538,7 @@ mail_send (EMailSession *session) g_return_if_fail (CAMEL_IS_TRANSPORT (service)); mail_send_queue ( - session, local_outbox, + backend, local_outbox, CAMEL_TRANSPORT (service), E_FILTER_SOURCE_OUTGOING, info->cancellable, diff --git a/mail/mail-send-recv.h b/mail/mail-send-recv.h index 5da6599712..f702b74d7a 100644 --- a/mail/mail-send-recv.h +++ b/mail/mail-send-recv.h @@ -32,16 +32,16 @@ G_BEGIN_DECLS /* send/receive all uri's */ GtkWidget * mail_send_receive (GtkWindow *parent, - EMailSession *session); + EMailBackend *backend); GtkWidget * mail_receive (GtkWindow *parent, - EMailSession *session); + EMailBackend *backend); /* receive a single account */ -void mail_receive_account (EMailSession *session, +void mail_receive_account (EMailBackend *backend, EAccount *account); -void mail_send (EMailSession *session); +void mail_send (EMailBackend *backend); /* setup auto receive stuff */ void mail_autoreceive_init (EMailBackend *backend); diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index 78d0863e0c..c1e451d04c 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -1161,7 +1161,7 @@ vfolder_load_storage (EMailBackend *backend) G_CALLBACK (context_rule_removed), context); /* load store to mail component */ - e_mail_store_add (session, vfolder_store); + e_mail_store_add (backend, vfolder_store); /* and setup the rules we have */ rule = NULL; diff --git a/mail/message-list.c b/mail/message-list.c index d98f860f8c..602bdfa4dd 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -3332,7 +3332,7 @@ build_tree (MessageList *ml, #endif if (!saveuid && ml->cursor_uid && g_hash_table_lookup (ml->uid_nodemap, ml->cursor_uid)) { /* this makes sure a visible node is selected, like when - collapsing all nodes and a children had been selected + * collapsing all nodes and a children had been selected */ saveuid = g_strdup (ml->cursor_uid); } diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c index 5eb5ce9f53..4cf3cb78a5 100644 --- a/modules/mail/e-mail-shell-backend.c +++ b/modules/mail/e-mail-shell-backend.c @@ -234,8 +234,6 @@ mail_shell_backend_mail_sync (EMailShellBackend *mail_shell_backend) { EShell *shell; EShellBackend *shell_backend; - EMailBackend *backend; - EMailSession *session; shell_backend = E_SHELL_BACKEND (mail_shell_backend); shell = e_shell_backend_get_shell (shell_backend); @@ -248,11 +246,9 @@ mail_shell_backend_mail_sync (EMailShellBackend *mail_shell_backend) if (mail_shell_backend->priv->mail_sync_in_progress) goto exit; - backend = E_MAIL_BACKEND (mail_shell_backend); - session = e_mail_backend_get_session (backend); - e_mail_store_foreach ( - session, (GFunc) mail_shell_backend_sync_store_cb, + E_MAIL_BACKEND (mail_shell_backend), + (GFunc) mail_shell_backend_sync_store_cb, mail_shell_backend); exit: @@ -445,7 +441,6 @@ mail_shell_backend_start (EShellBackend *shell_backend) EShell *shell; EShellSettings *shell_settings; EMailBackend *backend; - EMailSession *session; gboolean enable_search_folders; const gchar *data_dir; @@ -455,10 +450,9 @@ mail_shell_backend_start (EShellBackend *shell_backend) shell_settings = e_shell_get_shell_settings (shell); backend = E_MAIL_BACKEND (shell_backend); - session = e_mail_backend_get_session (backend); data_dir = e_shell_backend_get_data_dir (shell_backend); - e_mail_store_init (session, data_dir); + e_mail_store_init (backend, data_dir); enable_search_folders = e_shell_settings_get_boolean ( shell_settings, "mail-enable-search-folders"); diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c index f4f5ea26f6..6d9b3a4252 100644 --- a/modules/mail/e-mail-shell-view-actions.c +++ b/modules/mail/e-mail-shell-view-actions.c @@ -85,7 +85,6 @@ action_mail_account_disable_cb (GtkAction *action, EShellBackend *shell_backend; EShellView *shell_view; EMailBackend *backend; - EMailSession *session; EMFolderTree *folder_tree; CamelService *service; CamelStore *store; @@ -99,7 +98,6 @@ action_mail_account_disable_cb (GtkAction *action, shell_backend = e_shell_view_get_shell_backend (shell_view); backend = E_MAIL_BACKEND (shell_backend); - session = e_mail_backend_get_session (backend); folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar); store = em_folder_tree_get_selected_store (folder_tree); @@ -117,7 +115,7 @@ action_mail_account_disable_cb (GtkAction *action, account->enabled = !account->enabled; e_account_list_change (account_list, account); - e_mail_store_remove_by_account (session, account); + e_mail_store_remove_by_account (backend, account); if (account->parent_uid != NULL) e_account_list_remove (account_list, account); @@ -227,17 +225,15 @@ action_mail_download_cb (GtkAction *action, EMailView *mail_view; EMailReader *reader; EMailBackend *backend; - EMailSession *session; mail_shell_content = mail_shell_view->priv->mail_shell_content; mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); reader = E_MAIL_READER (mail_view); backend = e_mail_reader_get_backend (reader); - session = e_mail_backend_get_session (backend); e_mail_store_foreach ( - session, (GFunc) action_mail_download_foreach_cb, reader); + backend, (GFunc) action_mail_download_foreach_cb, reader); } static void @@ -247,15 +243,12 @@ action_mail_flush_outbox_cb (GtkAction *action, EShellBackend *shell_backend; EShellView *shell_view; EMailBackend *backend; - EMailSession *session; shell_view = E_SHELL_VIEW (mail_shell_view); shell_backend = e_shell_view_get_shell_backend (shell_view); - backend = E_MAIL_BACKEND (shell_backend); - session = e_mail_backend_get_session (backend); - mail_send (session); + mail_send (backend); } static void @@ -1059,7 +1052,6 @@ action_mail_tools_subscriptions_cb (GtkAction *action, EShellWindow *shell_window; EShellView *shell_view; EMailBackend *backend; - EMailSession *session; EMFolderTree *folder_tree; GtkWidget *dialog; CamelStore *store; @@ -1073,11 +1065,9 @@ action_mail_tools_subscriptions_cb (GtkAction *action, store = em_folder_tree_get_selected_store (folder_tree); backend = E_MAIL_BACKEND (shell_backend); - session = e_mail_backend_get_session (backend); dialog = em_subscription_editor_new ( - GTK_WINDOW (shell_window), - CAMEL_SESSION (session), store); + GTK_WINDOW (shell_window), backend, store); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c index a7309904bd..30a6756ddf 100644 --- a/modules/mail/e-mail-shell-view-private.c +++ b/modules/mail/e-mail-shell-view-private.c @@ -1089,7 +1089,6 @@ e_mail_shell_view_send_receive (EMailShellView *mail_shell_view, EMailSendReceiveMode mode, const gchar *account_uid) { - EMailSession *session; EShellView *shell_view; EShellWindow *shell_window; EShellBackend *shell_backend; @@ -1100,20 +1099,22 @@ e_mail_shell_view_send_receive (EMailShellView *mail_shell_view, shell_window = e_shell_view_get_shell_window (shell_view); shell_backend = e_shell_view_get_shell_backend (shell_view); - session = e_mail_backend_get_session (E_MAIL_BACKEND (shell_backend)); - em_utils_clear_get_password_canceled_accounts_flag (); if (!account_uid) { switch (mode) { case E_MAIL_SEND_RECEIVE_BOTH: - mail_send_receive (GTK_WINDOW (shell_window), session); + mail_send_receive ( + GTK_WINDOW (shell_window), + E_MAIL_BACKEND (shell_backend)); break; case E_MAIL_SEND_RECEIVE_RECEIVE: - mail_receive (GTK_WINDOW (shell_window), session); + mail_receive ( + GTK_WINDOW (shell_window), + E_MAIL_BACKEND (shell_backend)); break; case E_MAIL_SEND_RECEIVE_SEND: - mail_send (session); + mail_send (E_MAIL_BACKEND (shell_backend)); break; } } else { @@ -1124,7 +1125,8 @@ e_mail_shell_view_send_receive (EMailShellView *mail_shell_view, g_return_if_fail (account != NULL); if (account->enabled && account->source != NULL) - mail_receive_account (session, account); + mail_receive_account ( + E_MAIL_BACKEND (shell_backend), account); } } diff --git a/modules/mail/em-account-prefs.c b/modules/mail/em-account-prefs.c index 1b11b41b68..0dc93bea1f 100644 --- a/modules/mail/em-account-prefs.c +++ b/modules/mail/em-account-prefs.c @@ -62,7 +62,9 @@ G_DEFINE_TYPE ( E_TYPE_ACCOUNT_MANAGER) static gboolean -account_prefs_toggle_enable_special (EMAccountPrefs *prefs, EAccountTreeViewSelectedType type, gboolean enabled) +account_prefs_toggle_enable_special (EMAccountPrefs *prefs, + EAccountTreeViewSelectedType type, + gboolean enabled) { const gchar *prop = NULL; EShell *shell; @@ -96,7 +98,6 @@ account_prefs_enable_account_cb (EAccountTreeView *tree_view, EMAccountPrefs *prefs) { EAccount *account; - EMailSession *session; account = e_account_tree_view_get_selected (tree_view); if (!account) { @@ -106,8 +107,7 @@ account_prefs_enable_account_cb (EAccountTreeView *tree_view, g_return_if_fail (account != NULL); - session = e_mail_backend_get_session (prefs->priv->backend); - e_mail_store_add_by_account (session, account); + e_mail_store_add_by_account (prefs->priv->backend, account); } static void @@ -115,7 +115,6 @@ account_prefs_disable_account_cb (EAccountTreeView *tree_view, EMAccountPrefs *prefs) { EAccountList *account_list; - EMailSession *session; EAccount *account; gpointer parent; gint response; @@ -131,10 +130,8 @@ account_prefs_disable_account_cb (EAccountTreeView *tree_view, account_list = e_account_tree_view_get_account_list (tree_view); g_return_if_fail (account_list != NULL); - session = e_mail_backend_get_session (prefs->priv->backend); - if (!e_account_list_account_has_proxies (account_list, account)) { - e_mail_store_remove_by_account (session, account); + e_mail_store_remove_by_account (prefs->priv->backend, account); return; } @@ -151,7 +148,7 @@ account_prefs_disable_account_cb (EAccountTreeView *tree_view, e_account_list_remove_account_proxies (account_list, account); - e_mail_store_remove_by_account (session, account); + e_mail_store_remove_by_account (prefs->priv->backend, account); } static void @@ -323,14 +320,12 @@ account_prefs_delete_account (EAccountManager *manager) EMAccountPrefsPrivate *priv; EAccountTreeView *tree_view; EAccountList *account_list; - EMailSession *session; EAccount *account; gboolean has_proxies; gpointer parent; gint response; priv = EM_ACCOUNT_PREFS (manager)->priv; - session = e_mail_backend_get_session (priv->backend); account_list = e_account_manager_get_account_list (manager); tree_view = e_account_manager_get_tree_view (manager); @@ -359,7 +354,7 @@ account_prefs_delete_account (EAccountManager *manager) /* Remove the account from the folder tree. */ if (account->enabled) - e_mail_store_remove_by_account (session, account); + e_mail_store_remove_by_account (priv->backend, account); /* Remove all the proxies the account has created. */ if (has_proxies) @@ -423,7 +418,8 @@ em_account_prefs_init (EMAccountPrefs *prefs) } static void -account_tree_view_sort_order_changed_cb (EAccountTreeView *tree_view, EMailBackend *backend) +account_tree_view_sort_order_changed_cb (EAccountTreeView *tree_view, + EMailBackend *backend) { GSList *account_uids; diff --git a/modules/mail/em-composer-prefs.c b/modules/mail/em-composer-prefs.c index fb49352357..12a521b454 100644 --- a/modules/mail/em-composer-prefs.c +++ b/modules/mail/em-composer-prefs.c @@ -43,16 +43,16 @@ #include <gtkhtml/gtkhtml.h> #include <editor/gtkhtml-spell-language.h> -#include "e-util/e-util.h" -#include "e-util/e-util-private.h" -#include "mail/e-mail-junk-options.h" -#include "widgets/misc/e-charset-combo-box.h" -#include "widgets/misc/e-signature-editor.h" -#include "widgets/misc/e-signature-manager.h" -#include "widgets/misc/e-signature-preview.h" +#include <e-util/e-util.h> +#include <e-util/e-util-private.h> +#include <misc/e-charset-combo-box.h> +#include <misc/e-signature-editor.h> +#include <misc/e-signature-manager.h> +#include <misc/e-signature-preview.h> #include "em-config.h" #include "em-folder-selection-button.h" +#include "e-mail-junk-options.h" G_DEFINE_TYPE ( EMComposerPrefs, @@ -132,14 +132,17 @@ transform_new_to_old_reply_style (GBinding *binding, } static void -composer_prefs_finalize (GObject *object) +composer_prefs_dispose (GObject *object) { EMComposerPrefs *prefs = (EMComposerPrefs *) object; - g_object_unref (prefs->builder); + if (prefs->builder != NULL) { + g_object_unref (prefs->builder); + prefs->builder = NULL; + } - /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (em_composer_prefs_parent_class)->finalize (object); + /* Chain up to parent's dispose() method. */ + G_OBJECT_CLASS (em_composer_prefs_parent_class)->dispose (object); } static void @@ -148,7 +151,7 @@ em_composer_prefs_class_init (EMComposerPrefsClass *class) GObjectClass *object_class; object_class = G_OBJECT_CLASS (class); - object_class->finalize = composer_prefs_finalize; + object_class->dispose = composer_prefs_dispose; } static void @@ -538,7 +541,8 @@ em_composer_prefs_construct (EMComposerPrefs *prefs, /* Signatures */ signature_list = e_get_signature_list (); - container = e_builder_get_widget (prefs->builder, "signature-alignment"); + container = e_builder_get_widget ( + prefs->builder, "signature-alignment"); widget = e_signature_manager_new (signature_list); gtk_container_add (GTK_CONTAINER (container), widget); gtk_widget_show (widget); @@ -589,9 +593,10 @@ em_composer_prefs_construct (EMComposerPrefs *prefs, GtkWidget * em_composer_prefs_new (EPreferencesWindow *window) { + EShell *shell; EMComposerPrefs *prefs; - EShell *shell = e_preferences_window_get_shell (window); + shell = e_preferences_window_get_shell (window); g_return_val_if_fail (E_IS_SHELL (shell), NULL); prefs = g_object_new (EM_TYPE_COMPOSER_PREFS, NULL); diff --git a/modules/mail/em-composer-prefs.h b/modules/mail/em-composer-prefs.h index f39af57c4e..79a53bb775 100644 --- a/modules/mail/em-composer-prefs.h +++ b/modules/mail/em-composer-prefs.h @@ -76,8 +76,8 @@ struct _EMComposerPrefsClass { GtkVBoxClass parent_class; }; -GType em_composer_prefs_get_type (void); -GtkWidget *em_composer_prefs_new (EPreferencesWindow *window); +GType em_composer_prefs_get_type (void); +GtkWidget * em_composer_prefs_new (EPreferencesWindow *window); G_END_DECLS diff --git a/plugins/default-source/default-source.c b/plugins/default-source/default-source.c index 62ebd4b2a5..c80aba39cd 100644 --- a/plugins/default-source/default-source.c +++ b/plugins/default-source/default-source.c @@ -55,7 +55,8 @@ e_plugin_lib_enable (EPlugin *ep, } static void -mark_default_source_in_list (ESourceList *source_list, ESource *source) +mark_default_source_in_list (ESourceList *source_list, + ESource *source) { GSList *g, *s; g_return_if_fail (source_list != NULL); @@ -106,7 +107,7 @@ commit_default_calendar (EPlugin *epl, if (source_list) { /* mark in the backend's source_list, to avoid race - with saving of two different source lists + * with saving of two different source lists */ mark_default_source_in_list (source_list, source); } else { @@ -139,7 +140,7 @@ commit_default_book (EPlugin *epl, if (source_list) { /* mark in the backend's source_list, to avoid race - with saving of two different source lists + * with saving of two different source lists */ mark_default_source_in_list (source_list, source); } else { diff --git a/plugins/mail-notification/mail-notification.c b/plugins/mail-notification/mail-notification.c index 9639bc6908..d85987df55 100644 --- a/plugins/mail-notification/mail-notification.c +++ b/plugins/mail-notification/mail-notification.c @@ -37,7 +37,6 @@ #include <time.h> #include <e-util/e-config.h> -#include <e-util/e-account-utils.h> #include <e-util/gconf-bridge.h> #include <mail/e-mail-folder-utils.h> #include <mail/em-utils.h> diff --git a/plugins/mail-to-task/mail-to-task.c b/plugins/mail-to-task/mail-to-task.c index 1d9f1fa0d0..810a2b593c 100644 --- a/plugins/mail-to-task/mail-to-task.c +++ b/plugins/mail-to-task/mail-to-task.c @@ -1131,10 +1131,12 @@ mail_to_event (ECalClientSourceType source_type, /* ask the user which tasks list to save to */ dialog = e_source_selector_dialog_new (NULL, source_list); - e_source_selector_dialog_select_default_source (E_SOURCE_SELECTOR_DIALOG (dialog)); + e_source_selector_dialog_select_default_source ( + E_SOURCE_SELECTOR_DIALOG (dialog)); if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) - source = e_source_selector_dialog_peek_primary_selection (E_SOURCE_SELECTOR_DIALOG (dialog)); + source = e_source_selector_dialog_peek_primary_selection ( + E_SOURCE_SELECTOR_DIALOG (dialog)); else source = NULL; diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c index b330a371ba..fc19d7a4fd 100644 --- a/plugins/pst-import/pst-importer.c +++ b/plugins/pst-import/pst-importer.c @@ -412,7 +412,9 @@ add_source_list_with_check (GtkWidget *frame, gtk_box_pack_end ((GtkBox *) hbox, combo, FALSE, FALSE, 0); - g_signal_connect (check, "toggled", G_CALLBACK (widget_sanitizer_cb), combo); + g_signal_connect ( + check, "toggled", + G_CALLBACK (widget_sanitizer_cb), combo); widget_sanitizer_cb (GTK_TOGGLE_BUTTON (check), combo); } @@ -472,10 +474,22 @@ org_credativ_evolution_readpst_getwidget (EImport *ei, gtk_box_pack_start ((GtkBox *) framebox, hbox, FALSE, FALSE, 0); - add_source_list_with_check (framebox, _("_Address Book"), E_CLIENT_SOURCE_TYPE_CONTACTS, G_CALLBACK (checkbox_addr_toggle_cb), target); - add_source_list_with_check (framebox, _("A_ppointments"), E_CLIENT_SOURCE_TYPE_EVENTS, G_CALLBACK (checkbox_appt_toggle_cb), target); - add_source_list_with_check (framebox, _("_Tasks"), E_CLIENT_SOURCE_TYPE_TASKS, G_CALLBACK (checkbox_task_toggle_cb), target); - add_source_list_with_check (framebox, _("_Journal entries"), E_CLIENT_SOURCE_TYPE_MEMOS, G_CALLBACK (checkbox_journal_toggle_cb), target); + add_source_list_with_check ( + framebox, _("_Address Book"), + E_CLIENT_SOURCE_TYPE_CONTACTS, + G_CALLBACK (checkbox_addr_toggle_cb), target); + add_source_list_with_check ( + framebox, _("A_ppointments"), + E_CLIENT_SOURCE_TYPE_EVENTS, + G_CALLBACK (checkbox_appt_toggle_cb), target); + add_source_list_with_check ( + framebox, _("_Tasks"), + E_CLIENT_SOURCE_TYPE_TASKS, + G_CALLBACK (checkbox_task_toggle_cb), target); + add_source_list_with_check ( + framebox, _("_Journal entries"), + E_CLIENT_SOURCE_TYPE_MEMOS, + G_CALLBACK (checkbox_journal_toggle_cb), target); gtk_widget_show_all (framebox); @@ -550,7 +564,8 @@ open_client (PstImporter *m, m->waiting_open++; - e_client_utils_open_new (source, source_type, FALSE, m->cancellable, + e_client_utils_open_new ( + source, source_type, FALSE, m->cancellable, e_client_utils_authenticate_handler, NULL, client_opened_cb, m); } diff --git a/plugins/vcard-inline/vcard-inline.c b/plugins/vcard-inline/vcard-inline.c index 1b72958712..cfe461b163 100644 --- a/plugins/vcard-inline/vcard-inline.c +++ b/plugins/vcard-inline/vcard-inline.c @@ -119,14 +119,13 @@ org_gnome_vcard_inline_decode (VCardInlinePObject *vcard_object, } static void -org_gnome_vcard_inline_client_loaded_cb (GObject *source_object, +org_gnome_vcard_inline_client_loaded_cb (ESource *source, GAsyncResult *result, - gpointer user_data) + GSList *contact_list) { - ESource *source = E_SOURCE (source_object); EClient *client = NULL; EBookClient *book_client; - GSList *contact_list = user_data, *iter; + GSList *iter; GError *error = NULL; e_client_utils_open_new_finish (source, result, &client, &error); @@ -185,9 +184,11 @@ org_gnome_vcard_inline_save_cb (VCardInlinePObject *vcard_object) contact_list = e_client_util_copy_object_slist (NULL, vcard_object->contact_list); - e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL, - e_client_utils_authenticate_handler, NULL, - org_gnome_vcard_inline_client_loaded_cb, contact_list); + e_client_utils_open_new ( + source, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, + NULL, e_client_utils_authenticate_handler, NULL, + (GAsyncReadyCallback) org_gnome_vcard_inline_client_loaded_cb, + contact_list); } static void diff --git a/shell/e-shell.c b/shell/e-shell.c index 2954765d15..dce7b21070 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -46,6 +46,10 @@ #include "e-shell-window.h" #include "e-shell-utils.h" +#define E_SHELL_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_SHELL, EShellPrivate)) + struct _EShellPrivate { GQueue alerts; GList *watched_windows; @@ -739,7 +743,7 @@ shell_dispose (GObject *object) EShellPrivate *priv; EAlert *alert; - priv = E_SHELL (object)->priv; + priv = E_SHELL_GET_PRIVATE (object); while ((alert = g_queue_pop_head (&priv->alerts)) != NULL) { g_signal_handlers_disconnect_by_func ( @@ -787,7 +791,7 @@ shell_finalize (GObject *object) { EShellPrivate *priv; - priv = E_SHELL (object)->priv; + priv = E_SHELL_GET_PRIVATE (object); g_hash_table_destroy (priv->backends_by_name); g_hash_table_destroy (priv->backends_by_scheme); @@ -1226,8 +1230,7 @@ e_shell_init (EShell *shell) GtkIconTheme *icon_theme; EggSMClient *sm_client; - shell->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - shell, E_TYPE_SHELL, EShellPrivate); + shell->priv = E_SHELL_GET_PRIVATE (shell); backends_by_name = g_hash_table_new (g_str_hash, g_str_equal); backends_by_scheme = g_hash_table_new (g_str_hash, g_str_equal); diff --git a/smime/gui/component.c b/smime/gui/component.c index 091ebeefe8..fcbb9faf9f 100644 --- a/smime/gui/component.c +++ b/smime/gui/component.c @@ -50,10 +50,10 @@ smime_pk11_passwd (ECertDB *db, prompt = g_strdup_printf (_("Enter the password for '%s'"), slot_name); g_free (slot_name); - *passwd = e_passwords_ask_password (_("Enter password"), NULL, "", - prompt, - E_PASSWORDS_REMEMBER_NEVER | E_PASSWORDS_SECRET, NULL, - NULL); + *passwd = e_passwords_ask_password ( + _("Enter password"), NULL, "", prompt, + E_PASSWORDS_REMEMBER_NEVER | E_PASSWORDS_SECRET, + NULL, NULL); g_free (prompt); @@ -75,10 +75,10 @@ smime_pk11_change_passwd (ECertDB *db, /* we're setting the password initially */ prompt = _("Enter new password for certificate database"); - *passwd = e_passwords_ask_password (_("Enter new password"), NULL, "", - prompt, - E_PASSWORDS_REMEMBER_NEVER | E_PASSWORDS_SECRET, NULL, - NULL); + *passwd = e_passwords_ask_password ( + _("Enter new password"), NULL, "", prompt, + E_PASSWORDS_REMEMBER_NEVER | E_PASSWORDS_SECRET, + NULL, NULL); } else { /* we're changing the password */ diff --git a/smime/lib/e-pkcs12.c b/smime/lib/e-pkcs12.c index 959924e69d..9b95668135 100644 --- a/smime/lib/e-pkcs12.c +++ b/smime/lib/e-pkcs12.c @@ -205,9 +205,10 @@ prompt_for_password (gchar *title, { gchar *passwd; - passwd = e_passwords_ask_password (title, NULL, "", prompt, - E_PASSWORDS_REMEMBER_NEVER | E_PASSWORDS_SECRET, NULL, - NULL); + passwd = e_passwords_ask_password ( + title, NULL, "", prompt, + E_PASSWORDS_REMEMBER_NEVER | E_PASSWORDS_SECRET, + NULL, NULL); if (passwd) { gsize len = strlen (passwd); diff --git a/widgets/misc/e-account-tree-view.c b/widgets/misc/e-account-tree-view.c index a2136433d4..7eae4e14aa 100644 --- a/widgets/misc/e-account-tree-view.c +++ b/widgets/misc/e-account-tree-view.c @@ -941,7 +941,8 @@ e_account_tree_view_get_selected_type (EAccountTreeView *tree_view) * Since: 3.4 **/ void -e_account_tree_view_set_selected_type (EAccountTreeView *tree_view, EAccountTreeViewSelectedType select) +e_account_tree_view_set_selected_type (EAccountTreeView *tree_view, + EAccountTreeViewSelectedType select) { GtkTreeSelection *selection; GtkTreeModel *model; @@ -994,7 +995,8 @@ e_account_tree_view_set_selected_type (EAccountTreeView *tree_view, EAccountTree } static guint -account_tree_view_get_slist_index (const GSList *account_uids, const gchar *uid) +account_tree_view_get_slist_index (const GSList *account_uids, + const gchar *uid) { guint res = 0; @@ -1021,7 +1023,8 @@ account_tree_view_get_slist_index (const GSList *account_uids, const gchar *uid) * Since: 3.4 **/ void -e_account_tree_view_set_sort_order (EAccountTreeView *tree_view, const GSList *account_uids) +e_account_tree_view_set_sort_order (EAccountTreeView *tree_view, + const GSList *account_uids) { GtkTreeModel *model; GtkTreeIter iter; @@ -1064,7 +1067,9 @@ e_account_tree_view_set_sort_order (EAccountTreeView *tree_view, const GSList *a } static gint -eval_order_by_sort_hash_cb (gconstpointer a, gconstpointer b, gpointer user_data) +eval_order_by_sort_hash_cb (gconstpointer a, + gconstpointer b, + gpointer user_data) { guint asortorder = GPOINTER_TO_UINT (g_hash_table_lookup (user_data, a)); guint bsortorder = GPOINTER_TO_UINT (g_hash_table_lookup (user_data, b)); @@ -1173,7 +1178,8 @@ e_account_tree_view_sort_changed (EAccountTreeView *tree_view) } static void -account_tree_view_swap_sort_order (EAccountTreeView *tree_view, gint direction) +account_tree_view_swap_sort_order (EAccountTreeView *tree_view, + gint direction) { GtkTreeSelection *selection; GtkTreeModel *model; @@ -1239,7 +1245,8 @@ e_account_tree_view_move_down (EAccountTreeView *tree_view) } void -e_account_tree_view_set_sort_alpha (EAccountTreeView *tree_view, gboolean sort_alpha) +e_account_tree_view_set_sort_alpha (EAccountTreeView *tree_view, + gboolean sort_alpha) { g_return_if_fail (tree_view != NULL); g_return_if_fail (E_IS_ACCOUNT_TREE_VIEW (tree_view)); @@ -1265,7 +1272,8 @@ e_account_tree_view_get_sort_alpha (EAccountTreeView *tree_view) } void -e_account_tree_view_set_express_mode (EAccountTreeView *tree_view, gboolean express_mode) +e_account_tree_view_set_express_mode (EAccountTreeView *tree_view, + gboolean express_mode) { g_return_if_fail (tree_view != NULL); g_return_if_fail (E_IS_ACCOUNT_TREE_VIEW (tree_view)); @@ -1291,7 +1299,9 @@ e_account_tree_view_get_express_mode (EAccountTreeView *tree_view) } static void -update_special_enable_state (EAccountTreeView *tree_view, const gchar *display_name, gboolean enabled) +update_special_enable_state (EAccountTreeView *tree_view, + const gchar *display_name, + gboolean enabled) { GtkTreeModel *model; GtkTreeIter iter; @@ -1332,7 +1342,8 @@ update_special_enable_state (EAccountTreeView *tree_view, const gchar *display_n } void -e_account_tree_view_set_enable_local_folders (EAccountTreeView *tree_view, gboolean enabled) +e_account_tree_view_set_enable_local_folders (EAccountTreeView *tree_view, + gboolean enabled) { g_return_if_fail (tree_view != NULL); g_return_if_fail (E_IS_ACCOUNT_TREE_VIEW (tree_view)); @@ -1359,7 +1370,8 @@ e_account_tree_view_get_enable_local_folders (EAccountTreeView *tree_view) } void -e_account_tree_view_set_enable_search_folders (EAccountTreeView *tree_view, gboolean enabled) +e_account_tree_view_set_enable_search_folders (EAccountTreeView *tree_view, + gboolean enabled) { g_return_if_fail (tree_view != NULL); g_return_if_fail (E_IS_ACCOUNT_TREE_VIEW (tree_view)); diff --git a/widgets/misc/e-attachment-store.c b/widgets/misc/e-attachment-store.c index 8db9f2af80..691fd518b8 100644 --- a/widgets/misc/e-attachment-store.c +++ b/widgets/misc/e-attachment-store.c @@ -1080,7 +1080,7 @@ struct _SaveContext { static SaveContext * attachment_store_save_context_new (EAttachmentStore *store, GFile *destination, - const gchar *filename_prefix, + const gchar *filename_prefix, GAsyncReadyCallback callback, gpointer user_data) { @@ -1128,7 +1128,7 @@ attachment_store_save_context_free (SaveContext *save_context) g_free (save_context->filename_prefix); save_context->filename_prefix = NULL; - + if (save_context->fresh_directory) { g_object_unref (save_context->fresh_directory); save_context->fresh_directory = NULL; @@ -1145,7 +1145,10 @@ attachment_store_save_context_free (SaveContext *save_context) } static void -attachment_store_move_file (SaveContext *save_context, GFile *source, GFile *destination, GError **error) +attachment_store_move_file (SaveContext *save_context, + GFile *source, + GFile *destination, + GError **error) { gchar *tmpl; gchar *path; @@ -1311,7 +1314,7 @@ attachment_store_save_cb (EAttachment *attachment, void e_attachment_store_save_async (EAttachmentStore *store, GFile *destination, - const gchar *filename_prefix, + const gchar *filename_prefix, GAsyncReadyCallback callback, gpointer user_data) { |