aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c12
-rw-r--r--addressbook/gui/contact-editor/e-contact-quick-add.c19
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-editor.c30
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c2
-rw-r--r--addressbook/gui/widgets/ea-minicard-view.c2
-rw-r--r--addressbook/gui/widgets/eab-gui-util.c27
6 files changed, 62 insertions, 30 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);