diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-04-22 02:52:23 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-04-22 05:07:15 +0800 |
commit | 7950d6a0c6efd6c4d48afd99c138f38952bdd1bb (patch) | |
tree | 3a8fd7957dd29441120d2db18ccb1cc23f5935f2 /addressbook | |
parent | 397b15ff4aa5afd1d5c7e0a093a33616624401cf (diff) | |
download | gsoc2013-evolution-7950d6a0c6efd6c4d48afd99c138f38952bdd1bb.tar gsoc2013-evolution-7950d6a0c6efd6c4d48afd99c138f38952bdd1bb.tar.gz gsoc2013-evolution-7950d6a0c6efd6c4d48afd99c138f38952bdd1bb.tar.bz2 gsoc2013-evolution-7950d6a0c6efd6c4d48afd99c138f38952bdd1bb.tar.lz gsoc2013-evolution-7950d6a0c6efd6c4d48afd99c138f38952bdd1bb.tar.xz gsoc2013-evolution-7950d6a0c6efd6c4d48afd99c138f38952bdd1bb.tar.zst gsoc2013-evolution-7950d6a0c6efd6c4d48afd99c138f38952bdd1bb.zip |
Adapt to libedataserver[ui] changes.
Diffstat (limited to 'addressbook')
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor.c | 12 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-quick-add.c | 19 | ||||
-rw-r--r-- | addressbook/gui/contact-list-editor/e-contact-list-editor.c | 30 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-view.c | 2 | ||||
-rw-r--r-- | addressbook/gui/widgets/ea-minicard-view.c | 2 | ||||
-rw-r--r-- | addressbook/gui/widgets/eab-gui-util.c | 27 | ||||
-rw-r--r-- | addressbook/importers/evolution-csv-importer.c | 11 | ||||
-rw-r--r-- | addressbook/importers/evolution-ldif-importer.c | 11 | ||||
-rw-r--r-- | addressbook/importers/evolution-vcard-importer.c | 11 | ||||
-rw-r--r-- | addressbook/tools/evolution-addressbook-export-list-folders.c | 4 |
10 files changed, 88 insertions, 41 deletions
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index 7676d62f5e..7ad3bcdb3e 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -27,6 +27,7 @@ #include "eab-editor.h" #include "e-contact-editor.h" +#include <stdlib.h> #include <string.h> #include <time.h> #include <gtk/gtk.h> @@ -3094,7 +3095,9 @@ source_changed (ESourceComboBox *source_combo_box, ESource *source; GtkWindow *parent; - source = e_source_combo_box_get_active (source_combo_box); + source = e_source_combo_box_ref_active (source_combo_box); + g_return_if_fail (source != NULL); + parent = eab_editor_get_window (EAB_EDITOR (editor)); if (editor->cancellable != NULL) { @@ -3107,13 +3110,13 @@ source_changed (ESourceComboBox *source_combo_box, source_source = e_client_get_source (E_CLIENT (editor->source_client)); if (e_source_equal (target_source, source)) - return; + goto exit; if (e_source_equal (source_source, source)) { g_object_set ( editor, "target_client", editor->source_client, NULL); - return; + goto exit; } editor->cancellable = g_cancellable_new (); @@ -3123,6 +3126,9 @@ source_changed (ESourceComboBox *source_combo_box, FALSE, editor->cancellable, e_client_utils_authenticate_handler, parent, contact_editor_book_loaded_cb, g_object_ref (editor)); + +exit: + g_object_unref (source); } static void diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c index 7c303e7725..69b35b6cdb 100644 --- a/addressbook/gui/contact-editor/e-contact-quick-add.c +++ b/addressbook/gui/contact-editor/e-contact-quick-add.c @@ -156,12 +156,13 @@ merge_cb (GObject *source_object, if (!e_client_is_readonly (client)) eab_merging_book_add_contact ( - E_BOOK_CLIENT (client), qa->contact, NULL, NULL); + E_BOOK_CLIENT (client), + qa->contact, NULL, NULL); else e_alert_run_dialog_for_args ( e_shell_get_active_window (NULL), "addressbook:error-read-only", - e_source_peek_name (source), + e_source_get_display_name (source), NULL); if (qa->cb) @@ -312,7 +313,8 @@ ce_have_book (GObject *source_object, g_return_if_fail (E_IS_CLIENT (client)); eab_merging_book_find_contact ( - E_BOOK_CLIENT (client), qa->contact, ce_have_contact, qa); + E_BOOK_CLIENT (client), + qa->contact, ce_have_contact, qa); } static void @@ -389,13 +391,16 @@ clicked_cb (GtkWidget *w, static void sanitize_widgets (QuickAdd *qa) { + GtkComboBox *combo_box; + const gchar *active_id; gboolean enabled = TRUE; g_return_if_fail (qa != NULL); g_return_if_fail (qa->dialog != NULL); - enabled = (e_source_combo_box_get_active_uid ( - E_SOURCE_COMBO_BOX (qa->combo_box)) != NULL); + combo_box = GTK_COMBO_BOX (qa->combo_box); + active_id = gtk_combo_box_get_active_id (combo_box); + enabled = (active_id != NULL); gtk_dialog_set_response_sensitive ( GTK_DIALOG (qa->dialog), @@ -410,12 +415,12 @@ source_changed (ESourceComboBox *source_combo_box, { ESource *source; - source = e_source_combo_box_get_active (source_combo_box); + source = e_source_combo_box_ref_active (source_combo_box); if (source != NULL) { if (qa->source != NULL) g_object_unref (qa->source); - qa->source = g_object_ref (source); + qa->source = source; /* takes reference */ } sanitize_widgets (qa); 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 3db6c4cca7..385ce096eb 100644 --- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c +++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c @@ -935,21 +935,31 @@ contact_list_editor_source_menu_changed_cb (GtkWidget *widget); void contact_list_editor_source_menu_changed_cb (GtkWidget *widget) { + ESourceComboBox *combo_box; EContactListEditor *editor; - ESource *source; + ESource *active_source; + ESource *client_source; + EClient *client; editor = contact_list_editor_extract (widget); - source = e_source_combo_box_get_active (E_SOURCE_COMBO_BOX (widget)); - if (e_source_equal (e_client_get_source (E_CLIENT (editor->priv->book_client)), source)) - return; + combo_box = E_SOURCE_COMBO_BOX (widget); + active_source = e_source_combo_box_ref_active (combo_box); + g_return_if_fail (active_source != NULL); + + client = E_CLIENT (editor->priv->book_client); + client_source = e_client_get_source (client); + + if (!e_source_equal (client_source, active_source)) + e_client_utils_open_new ( + client_source, E_CLIENT_SOURCE_TYPE_CONTACTS, + FALSE, NULL, + e_client_utils_authenticate_handler, + eab_editor_get_window (EAB_EDITOR (editor)), + contact_list_editor_book_loaded_cb, + g_object_ref (editor)); - e_client_utils_open_new ( - source, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL, - e_client_utils_authenticate_handler, - eab_editor_get_window (EAB_EDITOR (editor)), - contact_list_editor_book_loaded_cb, - g_object_ref (editor)); + g_object_unref (active_source); } gboolean diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c index 50f50c9203..5dce1e2a74 100644 --- a/addressbook/gui/widgets/e-addressbook-view.c +++ b/addressbook/gui/widgets/e-addressbook-view.c @@ -1099,7 +1099,7 @@ folder_bar_message (EAddressbookView *view, if (view->priv->source == NULL) return; - display_name = e_source_peek_name (view->priv->source); + display_name = e_source_get_display_name (view->priv->source); e_shell_sidebar_set_primary_text (shell_sidebar, display_name); e_shell_sidebar_set_secondary_text (shell_sidebar, message); } diff --git a/addressbook/gui/widgets/ea-minicard-view.c b/addressbook/gui/widgets/ea-minicard-view.c index 6772a0bf80..65b20feb1a 100644 --- a/addressbook/gui/widgets/ea-minicard-view.c +++ b/addressbook/gui/widgets/ea-minicard-view.c @@ -165,7 +165,7 @@ ea_minicard_view_get_name (AtkObject *accessible) g_object_get (card_view->adapter, "client", &book_client, NULL); g_return_val_if_fail (E_IS_BOOK_CLIENT (book_client), NULL); source = e_client_get_source (E_CLIENT (book_client)); - display_name = e_source_peek_name (source); + display_name = e_source_get_display_name (source); if (display_name == NULL) display_name = ""; diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c index 535e1bd3f0..3d9d819d06 100644 --- a/addressbook/gui/widgets/eab-gui-util.c +++ b/addressbook/gui/widgets/eab-gui-util.c @@ -134,7 +134,7 @@ eab_load_error_dialog (GtkWidget *parent, source_dir = e_source_peek_relative_uri (source); if (!source_dir || !g_str_equal (source_dir, "system")) - source_dir = e_source_peek_uid (source); + source_dir = e_source_get_uid (source); /* Mangle the URI to not contain invalid characters. */ mangled_source_dir = g_strdelimit (g_strdup (source_dir), ":/", '_'); @@ -285,11 +285,16 @@ source_selection_changed_cb (ESourceSelector *selector, GtkWidget *ok_button) { ESource *except_source = NULL, *selected; + gboolean sensitive; except_source = g_object_get_data (G_OBJECT (ok_button), "except-source"); - selected = e_source_selector_get_primary_selection (selector); + selected = e_source_selector_ref_primary_selection (selector); - gtk_widget_set_sensitive (ok_button, selected && selected != except_source); + sensitive = (selected != NULL && selected != except_source); + gtk_widget_set_sensitive (ok_button, sensitive); + + if (selected != NULL) + g_object_unref (selected); } ESource * @@ -335,7 +340,7 @@ eab_select_source (ESource *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))); + source_list, e_source_get_uid (except_source))); g_signal_connect ( selector, "primary_selection_changed", @@ -343,7 +348,7 @@ eab_select_source (ESource *except_source, if (select_uid) { source = e_source_list_peek_source_by_uid (source_list, select_uid); - if (source) + if (source != NULL) e_source_selector_set_primary_selection ( E_SOURCE_SELECTOR (selector), source); } @@ -359,11 +364,17 @@ eab_select_source (ESource *except_source, response = gtk_dialog_run (GTK_DIALOG (dialog)); if (response == GTK_RESPONSE_ACCEPT) - source = e_source_selector_get_primary_selection (E_SOURCE_SELECTOR (selector)); + source = e_source_selector_ref_primary_selection ( + E_SOURCE_SELECTOR (selector)); else source = NULL; gtk_widget_destroy (dialog); + + /* XXX Return a borrowed reference for backward-compatibility. */ + if (source != NULL) + g_object_unref (source); + return source; } @@ -590,9 +601,9 @@ eab_transfer_contacts (EBookClient *source_client, if (!destination) return; - if (strcmp (last_uid, e_source_peek_uid (destination)) != 0) { + if (strcmp (last_uid, e_source_get_uid (destination)) != 0) { g_free (last_uid); - last_uid = g_strdup (e_source_peek_uid (destination)); + last_uid = g_strdup (e_source_get_uid (destination)); } process = g_new (ContactCopyProcess, 1); diff --git a/addressbook/importers/evolution-csv-importer.c b/addressbook/importers/evolution-csv-importer.c index 66cc0a7051..92290e8d1c 100644 --- a/addressbook/importers/evolution-csv-importer.c +++ b/addressbook/importers/evolution-csv-importer.c @@ -755,10 +755,14 @@ static void primary_selection_changed_cb (ESourceSelector *selector, EImportTarget *target) { + ESource *source; + + source = e_source_selector_ref_primary_selection (selector); + g_return_if_fail (source != NULL); + g_datalist_set_data_full ( &target->data, "csv-source", - g_object_ref (e_source_selector_get_primary_selection (selector)), - g_object_unref); + source, (GDestroyNotify) g_object_unref); } static GtkWidget * @@ -921,7 +925,8 @@ csv_import (EImport *ei, source = g_datalist_get_data (&target->data, "csv-source"); - 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, gci); } diff --git a/addressbook/importers/evolution-ldif-importer.c b/addressbook/importers/evolution-ldif-importer.c index 989bb805f4..1ba350a70f 100644 --- a/addressbook/importers/evolution-ldif-importer.c +++ b/addressbook/importers/evolution-ldif-importer.c @@ -553,10 +553,14 @@ static void primary_selection_changed_cb (ESourceSelector *selector, EImportTarget *target) { + ESource *source; + + source = e_source_selector_ref_primary_selection (selector); + g_return_if_fail (source != NULL); + g_datalist_set_data_full ( &target->data, "ldif-source", - g_object_ref (e_source_selector_get_primary_selection (selector)), - g_object_unref); + source, (GDestroyNotify) g_object_unref); } static GtkWidget * @@ -711,7 +715,8 @@ ldif_import (EImport *ei, source = g_datalist_get_data (&target->data, "ldif-source"); - 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, gci); } diff --git a/addressbook/importers/evolution-vcard-importer.c b/addressbook/importers/evolution-vcard-importer.c index b35553943e..1dbbed0a39 100644 --- a/addressbook/importers/evolution-vcard-importer.c +++ b/addressbook/importers/evolution-vcard-importer.c @@ -391,10 +391,14 @@ static void primary_selection_changed_cb (ESourceSelector *selector, EImportTarget *target) { + ESource *source; + + source = e_source_selector_ref_primary_selection (selector); + g_return_if_fail (source != NULL); + g_datalist_set_data_full ( &target->data, "vcard-source", - g_object_ref (e_source_selector_get_primary_selection (selector)), - g_object_unref); + source, (GDestroyNotify) g_object_unref); } static GtkWidget * @@ -569,7 +573,8 @@ vcard_import (EImport *ei, source = g_datalist_get_data (&target->data, "vcard-source"); - 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, gci); } diff --git a/addressbook/tools/evolution-addressbook-export-list-folders.c b/addressbook/tools/evolution-addressbook-export-list-folders.c index 2628c9c499..14e7e201ba 100644 --- a/addressbook/tools/evolution-addressbook-export-list-folders.c +++ b/addressbook/tools/evolution-addressbook-export-list-folders.c @@ -76,7 +76,7 @@ action_list_folders_init (ActionContext *p_actctx) book_client = e_book_client_new (s, &error); if (!book_client || !e_client_open_sync (E_CLIENT (book_client), TRUE, NULL, &error)) { - g_warning (_("Failed to open client '%s': %s"), e_source_peek_name (s), error ? error->message : _("Unknown error")); + g_warning (_("Failed to open client '%s': %s"), e_source_get_display_name (s), error ? error->message : _("Unknown error")); if (error) g_error_free (error); continue; @@ -86,7 +86,7 @@ action_list_folders_init (ActionContext *p_actctx) contacts = NULL; uri = e_source_get_uri (s); - name = e_source_peek_name (s); + name = e_source_get_display_name (s); if (outputfile) fprintf ( |