aboutsummaryrefslogtreecommitdiffstats
path: root/modules/calendar
diff options
context:
space:
mode:
Diffstat (limited to 'modules/calendar')
-rw-r--r--modules/calendar/e-cal-attachment-handler.c14
-rw-r--r--modules/calendar/e-cal-shell-backend.c6
-rw-r--r--modules/calendar/e-cal-shell-migrate.c4
-rw-r--r--modules/calendar/e-cal-shell-sidebar.c40
-rw-r--r--modules/calendar/e-cal-shell-view-actions.c41
-rw-r--r--modules/calendar/e-memo-shell-backend.c4
-rw-r--r--modules/calendar/e-memo-shell-content.c2
-rw-r--r--modules/calendar/e-memo-shell-migrate.c4
-rw-r--r--modules/calendar/e-memo-shell-sidebar.c40
-rw-r--r--modules/calendar/e-memo-shell-view-actions.c41
-rw-r--r--modules/calendar/e-task-shell-backend.c4
-rw-r--r--modules/calendar/e-task-shell-content.c2
-rw-r--r--modules/calendar/e-task-shell-migrate.c4
-rw-r--r--modules/calendar/e-task-shell-sidebar.c40
-rw-r--r--modules/calendar/e-task-shell-view-actions.c41
15 files changed, 180 insertions, 107 deletions
diff --git a/modules/calendar/e-cal-attachment-handler.c b/modules/calendar/e-cal-attachment-handler.c
index 3b18f426aa..403345d8ec 100644
--- a/modules/calendar/e-cal-attachment-handler.c
+++ b/modules/calendar/e-cal-attachment-handler.c
@@ -183,7 +183,7 @@ attachment_handler_import_event (GObject *source_object,
g_warn_if_fail (client == NULL);
g_warning (
"%s: Failed to open '%s': %s",
- G_STRFUNC, e_source_peek_name (source),
+ G_STRFUNC, e_source_get_display_name (source),
error->message);
g_object_unref (attachment);
g_error_free (error);
@@ -239,7 +239,7 @@ attachment_handler_import_todo (GObject *source_object,
g_warn_if_fail (client == NULL);
g_warning (
"%s: Failed to open '%s': %s",
- G_STRFUNC, e_source_peek_name (source),
+ G_STRFUNC, e_source_get_display_name (source),
error->message);
g_object_unref (attachment);
g_error_free (error);
@@ -354,18 +354,20 @@ attachment_handler_run_dialog (GtkWindow *parent,
if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK)
goto exit;
- source = e_source_selector_get_primary_selection (selector);
+ source = e_source_selector_ref_primary_selection (selector);
if (source == NULL)
goto exit;
switch (source_type) {
case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
- e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_EVENTS, FALSE, NULL,
+ e_client_utils_open_new (
+ source, E_CLIENT_SOURCE_TYPE_EVENTS, FALSE, NULL,
e_client_utils_authenticate_handler, NULL,
attachment_handler_import_event, g_object_ref (attachment));
break;
case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
- e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_TASKS, FALSE, NULL,
+ e_client_utils_open_new (
+ source, E_CLIENT_SOURCE_TYPE_TASKS, FALSE, NULL,
e_client_utils_authenticate_handler, NULL,
attachment_handler_import_todo, g_object_ref (attachment));
break;
@@ -373,6 +375,8 @@ attachment_handler_run_dialog (GtkWindow *parent,
break;
}
+ g_object_unref (source);
+
exit:
gtk_widget_destroy (dialog);
}
diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c
index d538e9bd74..e73eca5d42 100644
--- a/modules/calendar/e-cal-shell-backend.c
+++ b/modules/calendar/e-cal-shell-backend.c
@@ -163,7 +163,7 @@ cal_shell_backend_ensure_sources (EShellBackend *shell_backend)
if (primary == NULL && selected == NULL) {
const gchar *uid;
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
selected = g_slist_prepend (NULL, g_strdup (uid));
e_shell_settings_set_string (
@@ -260,7 +260,7 @@ cal_shell_backend_new_event (ESource *source,
g_warn_if_fail (client == NULL);
g_warning (
"%s: Failed to open '%s': %s",
- G_STRFUNC, e_source_peek_name (source),
+ G_STRFUNC, e_source_get_display_name (source),
error->message);
g_error_free (error);
return;
@@ -641,7 +641,7 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
if (error != NULL) {
g_warning (
"%s: Failed to create/open client '%s': %s",
- G_STRFUNC, e_source_peek_name (source),
+ G_STRFUNC, e_source_get_display_name (source),
error->message);
g_object_unref (source_list);
g_error_free (error);
diff --git a/modules/calendar/e-cal-shell-migrate.c b/modules/calendar/e-cal-shell-migrate.c
index dd76049171..7eb69edb85 100644
--- a/modules/calendar/e-cal-shell-migrate.c
+++ b/modules/calendar/e-cal-shell-migrate.c
@@ -176,9 +176,9 @@ create_calendar_sources (EShellBackend *shell_backend,
e_shell_settings_set_string (
shell_settings, "cal-primary-calendar",
- e_source_peek_uid (source));
+ e_source_get_uid (source));
- link.data = (gpointer) e_source_peek_uid (source);
+ link.data = (gpointer) e_source_get_uid (source);
link.next = NULL;
e_cal_shell_backend_set_selected_calendars (
diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c
index 633942df98..468db23c40 100644
--- a/modules/calendar/e-cal-shell-sidebar.c
+++ b/modules/calendar/e-cal-shell-sidebar.c
@@ -131,7 +131,7 @@ cal_shell_sidebar_backend_died_cb (ECalShellSidebar *cal_shell_sidebar,
shell_content = e_shell_view_get_shell_content (shell_view);
source = e_client_get_source (E_CLIENT (client));
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
g_object_ref (source);
@@ -167,7 +167,7 @@ cal_shell_sidebar_backend_error_cb (ECalShellSidebar *cal_shell_sidebar,
E_ALERT_SINK (shell_content),
"calendar:backend-error",
e_source_group_peek_name (source_group),
- e_source_peek_name (source), message, NULL);
+ e_source_get_display_name (source), message, NULL);
}
static void
@@ -281,7 +281,7 @@ cal_shell_sidebar_client_opened_cb (GObject *source_object,
case E_CLIENT_ERROR_BUSY:
g_warning (
"%s: Cannot open '%s', it's busy (%s)",
- G_STRFUNC, e_source_peek_name (source),
+ G_STRFUNC, e_source_get_display_name (source),
error->message);
g_clear_error (&error);
return;
@@ -422,7 +422,7 @@ cal_shell_sidebar_set_default (ECalShellSidebar *cal_shell_sidebar,
priv->loading_default_client = NULL;
}
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
client = g_hash_table_lookup (priv->client_table, uid);
/* If we already have an open connection for
@@ -456,20 +456,22 @@ cal_shell_sidebar_row_changed_cb (ECalShellSidebar *cal_shell_sidebar,
ESource *source;
selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
- source = e_source_selector_get_source_by_path (selector, tree_path);
+ source = e_source_selector_ref_source_by_path (selector, tree_path);
/* XXX This signal gets emitted a lot while the model is being
* rebuilt, during which time we won't get a valid ESource.
* ESourceSelector should probably block this signal while
* rebuilding the model, but we'll be forgiving and not
* emit a warning. */
- if (!E_IS_SOURCE (source))
+ if (source == NULL)
return;
if (e_source_selector_source_is_selected (selector, source))
e_cal_shell_sidebar_add_source (cal_shell_sidebar, source);
else
e_cal_shell_sidebar_remove_source (cal_shell_sidebar, source);
+
+ g_object_unref (source);
}
static void
@@ -494,7 +496,7 @@ cal_shell_sidebar_selection_changed_cb (ECalShellSidebar *cal_shell_sidebar,
for (iter = list; iter != NULL; iter = iter->next) {
ESource *source = iter->data;
- iter->data = (gpointer) e_source_peek_uid (source);
+ iter->data = (gpointer) e_source_get_uid (source);
g_object_unref (source);
}
@@ -510,11 +512,13 @@ cal_shell_sidebar_primary_selection_changed_cb (ECalShellSidebar *cal_shell_side
{
ESource *source;
- source = e_source_selector_get_primary_selection (selector);
+ source = e_source_selector_ref_primary_selection (selector);
if (source == NULL)
return;
cal_shell_sidebar_set_default (cal_shell_sidebar, source);
+
+ g_object_unref (source);
}
static void
@@ -816,17 +820,20 @@ cal_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
gboolean can_delete = FALSE;
gboolean is_system = FALSE;
gboolean refresh_supported = FALSE;
+ gboolean has_primary_source = FALSE;
guint32 state = 0;
cal_shell_sidebar = E_CAL_SHELL_SIDEBAR (shell_sidebar);
selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
- source = e_source_selector_get_primary_selection (selector);
+ source = e_source_selector_ref_primary_selection (selector);
if (source != NULL) {
ECalClient *client;
const gchar *uri;
const gchar *delete;
+ has_primary_source = TRUE;
+
uri = e_source_peek_relative_uri (source);
is_system = (uri == NULL || strcmp (uri, "system") == 0);
@@ -836,12 +843,14 @@ cal_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
client = g_hash_table_lookup (
cal_shell_sidebar->priv->client_table,
- e_source_peek_uid (source));
+ e_source_get_uid (source));
refresh_supported =
client && e_client_check_refresh_supported (E_CLIENT (client));
+
+ g_object_unref (source);
}
- if (source != NULL)
+ if (has_primary_source)
state |= E_CAL_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE;
if (can_delete)
state |= E_CAL_SHELL_SIDEBAR_CAN_DELETE_PRIMARY_SOURCE;
@@ -870,8 +879,7 @@ cal_shell_sidebar_client_removed (ECalShellSidebar *cal_shell_sidebar,
NULL, NULL, cal_shell_sidebar);
source = e_client_get_source (E_CLIENT (client));
- uid = e_source_peek_uid (source);
- g_return_if_fail (uid != NULL);
+ uid = e_source_get_uid (source);
g_hash_table_remove (client_table, uid);
e_source_selector_unselect_source (selector, source);
@@ -1069,7 +1077,7 @@ e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar,
default_client = cal_shell_sidebar->priv->default_client;
selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
client = g_hash_table_lookup (client_table, uid);
if (client != NULL)
@@ -1080,7 +1088,7 @@ e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar,
const gchar *default_uid;
default_source = e_client_get_source (E_CLIENT (default_client));
- default_uid = e_source_peek_uid (default_source);
+ default_uid = e_source_get_uid (default_source);
if (g_strcmp0 (uid, default_uid) == 0)
client = g_object_ref (default_client);
@@ -1146,7 +1154,7 @@ e_cal_shell_sidebar_remove_source (ECalShellSidebar *cal_shell_sidebar,
client_table = cal_shell_sidebar->priv->client_table;
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
client = g_hash_table_lookup (client_table, uid);
if (client == NULL)
diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c
index d73feef25e..e5db33837c 100644
--- a/modules/calendar/e-cal-shell-view-actions.c
+++ b/modules/calendar/e-cal-shell-view-actions.c
@@ -46,12 +46,14 @@ action_calendar_copy_cb (GtkAction *action,
cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar;
selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
- source = e_source_selector_get_primary_selection (selector);
- g_return_if_fail (E_IS_SOURCE (source));
+ source = e_source_selector_ref_primary_selection (selector);
+ g_return_if_fail (source != NULL);
copy_source_dialog (
GTK_WINDOW (shell_window),
source, E_CAL_CLIENT_SOURCE_TYPE_EVENTS);
+
+ g_object_unref (source);
}
static void
@@ -88,16 +90,18 @@ action_calendar_delete_cb (GtkAction *action,
cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar;
selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
- source = e_source_selector_get_primary_selection (selector);
- g_return_if_fail (E_IS_SOURCE (source));
+ source = e_source_selector_ref_primary_selection (selector);
+ g_return_if_fail (source != NULL);
/* Ask for confirmation. */
response = e_alert_run_dialog_for_args (
GTK_WINDOW (shell_window),
"calendar:prompt-delete-calendar",
- e_source_peek_name (source), NULL);
- if (response != GTK_RESPONSE_YES)
+ e_source_get_display_name (source), NULL);
+ if (response != GTK_RESPONSE_YES) {
+ g_object_unref (source);
return;
+ }
uri = e_source_get_uri (source);
client = e_cal_model_get_client_for_uri (model, uri);
@@ -114,6 +118,7 @@ action_calendar_delete_cb (GtkAction *action,
g_warning (
"%s: Failed to remove client: %s",
G_STRFUNC, error->message);
+ g_object_unref (source);
g_error_free (error);
return;
}
@@ -138,6 +143,8 @@ action_calendar_delete_cb (GtkAction *action,
G_STRFUNC, error->message);
g_error_free (error);
}
+
+ g_object_unref (source);
}
static void
@@ -282,13 +289,15 @@ action_calendar_properties_cb (GtkAction *action,
cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar;
selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
- source = e_source_selector_get_primary_selection (selector);
- g_return_if_fail (E_IS_SOURCE (source));
+ source = e_source_selector_ref_primary_selection (selector);
+ g_return_if_fail (source != NULL);
/* XXX Does this -really- need a source group parameter? */
calendar_setup_edit_calendar (
GTK_WINDOW (shell_window), source,
e_source_peek_group (source));
+
+ g_object_unref (source);
}
static void
@@ -384,15 +393,17 @@ action_calendar_refresh_cb (GtkAction *action,
model = e_cal_shell_content_get_model (cal_shell_content);
selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
- source = e_source_selector_get_primary_selection (selector);
- g_return_if_fail (E_IS_SOURCE (source));
+ source = e_source_selector_ref_primary_selection (selector);
+ g_return_if_fail (source != NULL);
uri = e_source_get_uri (source);
client = e_cal_model_get_client_for_uri (model, uri);
g_free (uri);
- if (client == NULL)
+ if (client == NULL) {
+ g_object_unref (source);
return;
+ }
g_return_if_fail (e_client_check_refresh_supported (E_CLIENT (client)));
@@ -401,10 +412,12 @@ action_calendar_refresh_cb (GtkAction *action,
if (error != NULL) {
g_warning (
"%s: Failed to refresh '%s', %s",
- G_STRFUNC, e_source_peek_name (source),
+ G_STRFUNC, e_source_get_display_name (source),
error->message);
g_error_free (error);
}
+
+ g_object_unref (source);
}
static void
@@ -452,10 +465,12 @@ action_calendar_select_one_cb (GtkAction *action,
cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar;
selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
- primary = e_source_selector_get_primary_selection (selector);
+ primary = e_source_selector_ref_primary_selection (selector);
g_return_if_fail (primary != NULL);
e_source_selector_select_exclusive (selector, primary);
+
+ g_object_unref (primary);
}
static void
diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c
index 2bdd3ef8ed..127473d582 100644
--- a/modules/calendar/e-memo-shell-backend.c
+++ b/modules/calendar/e-memo-shell-backend.c
@@ -151,7 +151,7 @@ memo_shell_backend_ensure_sources (EShellBackend *shell_backend)
if (primary == NULL && selected == NULL) {
const gchar *uid;
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
selected = g_slist_prepend (NULL, g_strdup (uid));
e_shell_settings_set_string (
@@ -193,7 +193,7 @@ memo_shell_backend_new_memo (ESource *source,
g_warn_if_fail (client == NULL);
g_warning (
"%s: Failed to open '%s': %s",
- G_STRFUNC, e_source_peek_name (source),
+ G_STRFUNC, e_source_get_display_name (source),
error->message);
g_error_free (error);
return;
diff --git a/modules/calendar/e-memo-shell-content.c b/modules/calendar/e-memo-shell-content.c
index 528db0911b..24f7a68d73 100644
--- a/modules/calendar/e-memo-shell-content.c
+++ b/modules/calendar/e-memo-shell-content.c
@@ -124,7 +124,7 @@ memo_shell_content_table_foreach_cb (gint model_row,
const gchar *source_uid;
source = e_client_get_source (E_CLIENT (comp_data->client));
- source_uid = e_source_peek_uid (source);
+ source_uid = e_source_get_uid (source);
foreach_data->list = g_slist_prepend (
foreach_data->list,
diff --git a/modules/calendar/e-memo-shell-migrate.c b/modules/calendar/e-memo-shell-migrate.c
index 64b5263008..efa0716b81 100644
--- a/modules/calendar/e-memo-shell-migrate.c
+++ b/modules/calendar/e-memo-shell-migrate.c
@@ -134,9 +134,9 @@ create_memo_sources (EShellBackend *shell_backend,
e_shell_settings_set_string (
shell_settings, "cal-primary-memo-list",
- e_source_peek_uid (source));
+ e_source_get_uid (source));
- link.data = (gpointer) e_source_peek_uid (source);
+ link.data = (gpointer) e_source_get_uid (source);
link.next = NULL;
e_memo_shell_backend_set_selected_memo_lists (
diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c
index 4a012c7d6d..7e209c5d24 100644
--- a/modules/calendar/e-memo-shell-sidebar.c
+++ b/modules/calendar/e-memo-shell-sidebar.c
@@ -127,7 +127,7 @@ memo_shell_sidebar_backend_died_cb (EMemoShellSidebar *memo_shell_sidebar,
shell_content = e_shell_view_get_shell_content (shell_view);
source = e_client_get_source (E_CLIENT (client));
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
g_object_ref (source);
@@ -163,7 +163,7 @@ memo_shell_sidebar_backend_error_cb (EMemoShellSidebar *memo_shell_sidebar,
E_ALERT_SINK (shell_content),
"calendar:backend-error",
e_source_group_peek_name (source_group),
- e_source_peek_name (source), message, NULL);
+ e_source_get_display_name (source), message, NULL);
}
static void
@@ -276,7 +276,7 @@ memo_shell_sidebar_client_opened_cb (GObject *source_object,
case E_CLIENT_ERROR_BUSY:
g_warning (
"%s: Cannot open '%s', it's busy (%s)",
- G_STRFUNC, e_source_peek_name (source),
+ G_STRFUNC, e_source_get_display_name (source),
error->message);
g_clear_error (&error);
return;
@@ -417,7 +417,7 @@ memo_shell_sidebar_set_default (EMemoShellSidebar *memo_shell_sidebar,
priv->loading_default_client = NULL;
}
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
client = g_hash_table_lookup (priv->client_table, uid);
/* If we already have an open connection for
@@ -451,20 +451,22 @@ memo_shell_sidebar_row_changed_cb (EMemoShellSidebar *memo_shell_sidebar,
ESource *source;
selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
- source = e_source_selector_get_source_by_path (selector, tree_path);
+ source = e_source_selector_ref_source_by_path (selector, tree_path);
/* XXX This signal gets emitted a lot while the model is being
* rebuilt, during which time we won't get a valid ESource.
* ESourceSelector should probably block this signal while
* rebuilding the model, but we'll be forgiving and not
* emit a warning. */
- if (!E_IS_SOURCE (source))
+ if (source == NULL)
return;
if (e_source_selector_source_is_selected (selector, source))
e_memo_shell_sidebar_add_source (memo_shell_sidebar, source);
else
e_memo_shell_sidebar_remove_source (memo_shell_sidebar, source);
+
+ g_object_unref (source);
}
static void
@@ -489,7 +491,7 @@ memo_shell_sidebar_selection_changed_cb (EMemoShellSidebar *memo_shell_sidebar,
for (iter = list; iter != NULL; iter = iter->next) {
ESource *source = iter->data;
- iter->data = (gpointer) e_source_peek_uid (source);
+ iter->data = (gpointer) e_source_get_uid (source);
g_object_unref (source);
}
@@ -505,11 +507,13 @@ memo_shell_sidebar_primary_selection_changed_cb (EMemoShellSidebar *memo_shell_s
{
ESource *source;
- source = e_source_selector_get_primary_selection (selector);
+ source = e_source_selector_ref_primary_selection (selector);
if (source == NULL)
return;
memo_shell_sidebar_set_default (memo_shell_sidebar, source);
+
+ g_object_unref (source);
}
static void
@@ -721,17 +725,20 @@ memo_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
gboolean can_delete = FALSE;
gboolean is_system = FALSE;
gboolean refresh_supported = FALSE;
+ gboolean has_primary_source = FALSE;
guint32 state = 0;
memo_shell_sidebar = E_MEMO_SHELL_SIDEBAR (shell_sidebar);
selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
- source = e_source_selector_get_primary_selection (selector);
+ source = e_source_selector_ref_primary_selection (selector);
if (source != NULL) {
ECalClient *client;
const gchar *uri;
const gchar *delete;
+ has_primary_source = TRUE;
+
uri = e_source_peek_relative_uri (source);
is_system = (uri == NULL || strcmp (uri, "system") == 0);
@@ -741,12 +748,14 @@ memo_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
client = g_hash_table_lookup (
memo_shell_sidebar->priv->client_table,
- e_source_peek_uid (source));
+ e_source_get_uid (source));
refresh_supported =
client && e_client_check_refresh_supported (E_CLIENT (client));
+
+ g_object_unref (source);
}
- if (source != NULL)
+ if (has_primary_source)
state |= E_MEMO_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE;
if (can_delete)
state |= E_MEMO_SHELL_SIDEBAR_CAN_DELETE_PRIMARY_SOURCE;
@@ -775,8 +784,7 @@ memo_shell_sidebar_client_removed (EMemoShellSidebar *memo_shell_sidebar,
NULL, NULL, memo_shell_sidebar);
source = e_client_get_source (E_CLIENT (client));
- uid = e_source_peek_uid (source);
- g_return_if_fail (uid != NULL);
+ uid = e_source_get_uid (source);
g_hash_table_remove (client_table, uid);
e_source_selector_unselect_source (selector, source);
@@ -956,7 +964,7 @@ e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar,
default_client = memo_shell_sidebar->priv->default_client;
selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
client = g_hash_table_lookup (client_table, uid);
if (client != NULL)
@@ -967,7 +975,7 @@ e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar,
const gchar *default_uid;
default_source = e_client_get_source (E_CLIENT (default_client));
- default_uid = e_source_peek_uid (default_source);
+ default_uid = e_source_get_uid (default_source);
if (g_strcmp0 (uid, default_uid) == 0)
client = g_object_ref (default_client);
@@ -1033,7 +1041,7 @@ e_memo_shell_sidebar_remove_source (EMemoShellSidebar *memo_shell_sidebar,
client_table = memo_shell_sidebar->priv->client_table;
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
client = g_hash_table_lookup (client_table, uid);
if (client == NULL)
diff --git a/modules/calendar/e-memo-shell-view-actions.c b/modules/calendar/e-memo-shell-view-actions.c
index 5a99624a95..4c2025910a 100644
--- a/modules/calendar/e-memo-shell-view-actions.c
+++ b/modules/calendar/e-memo-shell-view-actions.c
@@ -116,12 +116,14 @@ action_memo_list_copy_cb (GtkAction *action,
memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar;
selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
- source = e_source_selector_get_primary_selection (selector);
- g_return_if_fail (E_IS_SOURCE (source));
+ source = e_source_selector_ref_primary_selection (selector);
+ g_return_if_fail (source != NULL);
copy_source_dialog (
GTK_WINDOW (shell_window),
source, E_CAL_CLIENT_SOURCE_TYPE_MEMOS);
+
+ g_object_unref (source);
}
static void
@@ -156,16 +158,18 @@ action_memo_list_delete_cb (GtkAction *action,
memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar;
selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
- source = e_source_selector_get_primary_selection (selector);
- g_return_if_fail (E_IS_SOURCE (source));
+ source = e_source_selector_ref_primary_selection (selector);
+ g_return_if_fail (source != NULL);
/* Ask for confirmation. */
response = e_alert_run_dialog_for_args (
GTK_WINDOW (shell_window),
"calendar:prompt-delete-memo-list",
- e_source_peek_name (source), NULL);
- if (response != GTK_RESPONSE_YES)
+ e_source_get_display_name (source), NULL);
+ if (response != GTK_RESPONSE_YES) {
+ g_object_unref (source);
return;
+ }
uri = e_source_get_uri (source);
client = e_cal_model_get_client_for_uri (model, uri);
@@ -182,6 +186,7 @@ action_memo_list_delete_cb (GtkAction *action,
g_warning (
"%s: Failed to remove client: %s",
G_STRFUNC, error->message);
+ g_object_unref (source);
g_error_free (error);
return;
}
@@ -203,6 +208,8 @@ action_memo_list_delete_cb (GtkAction *action,
G_STRFUNC, error->message);
g_error_free (error);
}
+
+ g_object_unref (source);
}
static void
@@ -262,10 +269,12 @@ action_memo_list_properties_cb (GtkAction *action,
memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar;
selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
- source = e_source_selector_get_primary_selection (selector);
- g_return_if_fail (E_IS_SOURCE (source));
+ source = e_source_selector_ref_primary_selection (selector);
+ g_return_if_fail (source != NULL);
calendar_setup_edit_memo_list (GTK_WINDOW (shell_window), source);
+
+ g_object_unref (source);
}
static void
@@ -287,15 +296,17 @@ action_memo_list_refresh_cb (GtkAction *action,
model = e_memo_shell_content_get_memo_model (memo_shell_content);
selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
- source = e_source_selector_get_primary_selection (selector);
- g_return_if_fail (E_IS_SOURCE (source));
+ source = e_source_selector_ref_primary_selection (selector);
+ g_return_if_fail (source != NULL);
uri = e_source_get_uri (source);
client = e_cal_model_get_client_for_uri (model, uri);
g_free (uri);
- if (client == NULL)
+ if (client == NULL) {
+ g_object_unref (source);
return;
+ }
g_return_if_fail (e_client_check_refresh_supported (E_CLIENT (client)));
@@ -304,10 +315,12 @@ action_memo_list_refresh_cb (GtkAction *action,
if (error != NULL) {
g_warning (
"%s: Failed to refresh '%s', %s",
- G_STRFUNC, e_source_peek_name (source),
+ G_STRFUNC, e_source_get_display_name (source),
error->message);
g_error_free (error);
}
+
+ g_object_unref (source);
}
static void
@@ -334,10 +347,12 @@ action_memo_list_select_one_cb (GtkAction *action,
memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar;
selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
- primary = e_source_selector_get_primary_selection (selector);
+ primary = e_source_selector_ref_primary_selection (selector);
g_return_if_fail (primary != NULL);
e_source_selector_select_exclusive (selector, primary);
+
+ g_object_unref (primary);
}
static void
diff --git a/modules/calendar/e-task-shell-backend.c b/modules/calendar/e-task-shell-backend.c
index 1bb7ca338f..786e9c6910 100644
--- a/modules/calendar/e-task-shell-backend.c
+++ b/modules/calendar/e-task-shell-backend.c
@@ -147,7 +147,7 @@ task_shell_backend_ensure_sources (EShellBackend *shell_backend)
if (primary == NULL && selected == NULL) {
const gchar *uid;
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
selected = g_slist_prepend (NULL, g_strdup (uid));
e_shell_settings_set_string (
@@ -189,7 +189,7 @@ task_shell_backend_new_task (ESource *source,
g_warn_if_fail (client == NULL);
g_warning (
"%s: Failed to open '%s': %s",
- G_STRFUNC, e_source_peek_name (source),
+ G_STRFUNC, e_source_get_display_name (source),
error->message);
g_error_free (error);
return;
diff --git a/modules/calendar/e-task-shell-content.c b/modules/calendar/e-task-shell-content.c
index 67b1e368b3..0ebff795bf 100644
--- a/modules/calendar/e-task-shell-content.c
+++ b/modules/calendar/e-task-shell-content.c
@@ -124,7 +124,7 @@ task_shell_content_table_foreach_cb (gint model_row,
const gchar *source_uid;
source = e_client_get_source (E_CLIENT (comp_data->client));
- source_uid = e_source_peek_uid (source);
+ source_uid = e_source_get_uid (source);
foreach_data->list = g_slist_prepend (
foreach_data->list,
diff --git a/modules/calendar/e-task-shell-migrate.c b/modules/calendar/e-task-shell-migrate.c
index 60499d673f..c24f52d97c 100644
--- a/modules/calendar/e-task-shell-migrate.c
+++ b/modules/calendar/e-task-shell-migrate.c
@@ -143,9 +143,9 @@ create_task_sources (EShellBackend *shell_backend,
e_shell_settings_set_string (
shell_settings, "cal-primary-task-list",
- e_source_peek_uid (source));
+ e_source_get_uid (source));
- link.data = (gpointer) e_source_peek_uid (source);
+ link.data = (gpointer) e_source_get_uid (source);
link.next = NULL;
e_task_shell_backend_set_selected_task_lists (
diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c
index a2ceb77bbf..4667ae4ed6 100644
--- a/modules/calendar/e-task-shell-sidebar.c
+++ b/modules/calendar/e-task-shell-sidebar.c
@@ -127,7 +127,7 @@ task_shell_sidebar_backend_died_cb (ETaskShellSidebar *task_shell_sidebar,
shell_content = e_shell_view_get_shell_content (shell_view);
source = e_client_get_source (E_CLIENT (client));
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
g_object_ref (source);
@@ -163,7 +163,7 @@ task_shell_sidebar_backend_error_cb (ETaskShellSidebar *task_shell_sidebar,
E_ALERT_SINK (shell_content),
"calendar:backend-error",
e_source_group_peek_name (source_group),
- e_source_peek_name (source), message, NULL);
+ e_source_get_display_name (source), message, NULL);
}
static void
@@ -276,7 +276,7 @@ task_shell_sidebar_client_opened_cb (GObject *source_object,
case E_CLIENT_ERROR_BUSY:
g_warning (
"%s: Cannot open '%s', it's busy (%s)",
- G_STRFUNC, e_source_peek_name (source),
+ G_STRFUNC, e_source_get_display_name (source),
error->message);
g_clear_error (&error);
return;
@@ -417,7 +417,7 @@ task_shell_sidebar_set_default (ETaskShellSidebar *task_shell_sidebar,
priv->loading_default_client = NULL;
}
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
client = g_hash_table_lookup (priv->client_table, uid);
/* If we already have an open connection for
@@ -451,20 +451,22 @@ task_shell_sidebar_row_changed_cb (ETaskShellSidebar *task_shell_sidebar,
ESource *source;
selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
- source = e_source_selector_get_source_by_path (selector, tree_path);
+ source = e_source_selector_ref_source_by_path (selector, tree_path);
/* XXX This signal gets emitted a lot while the model is being
* rebuilt, during which time we won't get a valid ESource.
* ESourceSelector should probably block this signal while
* rebuilding the model, but we'll be forgiving and not
* emit a warning. */
- if (!E_IS_SOURCE (source))
+ if (source == NULL)
return;
if (e_source_selector_source_is_selected (selector, source))
e_task_shell_sidebar_add_source (task_shell_sidebar, source);
else
e_task_shell_sidebar_remove_source (task_shell_sidebar, source);
+
+ g_object_unref (source);
}
static void
@@ -489,7 +491,7 @@ task_shell_sidebar_selection_changed_cb (ETaskShellSidebar *task_shell_sidebar,
for (iter = list; iter != NULL; iter = iter->next) {
ESource *source = iter->data;
- iter->data = (gpointer) e_source_peek_uid (source);
+ iter->data = (gpointer) e_source_get_uid (source);
g_object_unref (source);
}
@@ -505,11 +507,13 @@ task_shell_sidebar_primary_selection_changed_cb (ETaskShellSidebar *task_shell_s
{
ESource *source;
- source = e_source_selector_get_primary_selection (selector);
+ source = e_source_selector_ref_primary_selection (selector);
if (source == NULL)
return;
task_shell_sidebar_set_default (task_shell_sidebar, source);
+
+ g_object_unref (source);
}
static void
@@ -721,17 +725,20 @@ task_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
gboolean can_delete = FALSE;
gboolean is_system = FALSE;
gboolean refresh_supported = FALSE;
+ gboolean has_primary_source = FALSE;
guint32 state = 0;
task_shell_sidebar = E_TASK_SHELL_SIDEBAR (shell_sidebar);
selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
- source = e_source_selector_get_primary_selection (selector);
+ source = e_source_selector_ref_primary_selection (selector);
if (source != NULL) {
ECalClient *client;
const gchar *uri;
const gchar *delete_prop;
+ has_primary_source = TRUE;
+
uri = e_source_peek_relative_uri (source);
is_system = (uri == NULL || strcmp (uri, "system") == 0);
@@ -742,12 +749,14 @@ task_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
client = g_hash_table_lookup (
task_shell_sidebar->priv->client_table,
- e_source_peek_uid (source));
+ e_source_get_uid (source));
refresh_supported = client &&
e_client_check_refresh_supported (E_CLIENT (client));
+
+ g_object_unref (source);
}
- if (source != NULL)
+ if (has_primary_source)
state |= E_TASK_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE;
if (can_delete)
state |= E_TASK_SHELL_SIDEBAR_CAN_DELETE_PRIMARY_SOURCE;
@@ -776,8 +785,7 @@ task_shell_sidebar_client_removed (ETaskShellSidebar *task_shell_sidebar,
NULL, NULL, task_shell_sidebar);
source = e_client_get_source (E_CLIENT (client));
- uid = e_source_peek_uid (source);
- g_return_if_fail (uid != NULL);
+ uid = e_source_get_uid (source);
g_hash_table_remove (client_table, uid);
e_source_selector_unselect_source (selector, source);
@@ -957,7 +965,7 @@ e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar,
default_client = task_shell_sidebar->priv->default_client;
selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
client = g_hash_table_lookup (client_table, uid);
if (client != NULL)
@@ -968,7 +976,7 @@ e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar,
const gchar *default_uid;
default_source = e_client_get_source (E_CLIENT (default_client));
- default_uid = e_source_peek_uid (default_source);
+ default_uid = e_source_get_uid (default_source);
if (g_strcmp0 (uid, default_uid) == 0)
client = g_object_ref (default_client);
@@ -1034,7 +1042,7 @@ e_task_shell_sidebar_remove_source (ETaskShellSidebar *task_shell_sidebar,
client_table = task_shell_sidebar->priv->client_table;
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
client = g_hash_table_lookup (client_table, uid);
if (client == NULL)
diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c
index 7f4fd08600..badfbf031d 100644
--- a/modules/calendar/e-task-shell-view-actions.c
+++ b/modules/calendar/e-task-shell-view-actions.c
@@ -139,12 +139,14 @@ action_task_list_copy_cb (GtkAction *action,
task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
- source = e_source_selector_get_primary_selection (selector);
- g_return_if_fail (E_IS_SOURCE (source));
+ source = e_source_selector_ref_primary_selection (selector);
+ g_return_if_fail (source != NULL);
copy_source_dialog (
GTK_WINDOW (shell_window),
source, E_CAL_CLIENT_SOURCE_TYPE_TASKS);
+
+ g_object_unref (source);
}
static void
@@ -179,16 +181,18 @@ action_task_list_delete_cb (GtkAction *action,
task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
- source = e_source_selector_get_primary_selection (selector);
- g_return_if_fail (E_IS_SOURCE (source));
+ source = e_source_selector_ref_primary_selection (selector);
+ g_return_if_fail (source != NULL);
/* Ask for confirmation. */
response = e_alert_run_dialog_for_args (
GTK_WINDOW (shell_window),
"calendar:prompt-delete-task-list",
- e_source_peek_name (source), NULL);
- if (response != GTK_RESPONSE_YES)
+ e_source_get_display_name (source), NULL);
+ if (response != GTK_RESPONSE_YES) {
+ g_object_unref (source);
return;
+ }
uri = e_source_get_uri (source);
client = e_cal_model_get_client_for_uri (model, uri);
@@ -205,6 +209,7 @@ action_task_list_delete_cb (GtkAction *action,
g_warning (
"%s: Failed to remove client: %s",
G_STRFUNC, error->message);
+ g_object_unref (source);
g_error_free (error);
return;
}
@@ -226,6 +231,8 @@ action_task_list_delete_cb (GtkAction *action,
G_STRFUNC, error->message);
g_error_free (error);
}
+
+ g_object_unref (source);
}
static void
@@ -285,10 +292,12 @@ action_task_list_properties_cb (GtkAction *action,
task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
- source = e_source_selector_get_primary_selection (selector);
- g_return_if_fail (E_IS_SOURCE (source));
+ source = e_source_selector_ref_primary_selection (selector);
+ g_return_if_fail (source != NULL);
calendar_setup_edit_task_list (GTK_WINDOW (shell_window), source);
+
+ g_object_unref (source);
}
static void
@@ -310,15 +319,17 @@ action_task_list_refresh_cb (GtkAction *action,
model = e_task_shell_content_get_task_model (task_shell_content);
selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
- source = e_source_selector_get_primary_selection (selector);
- g_return_if_fail (E_IS_SOURCE (source));
+ source = e_source_selector_ref_primary_selection (selector);
+ g_return_if_fail (source != NULL);
uri = e_source_get_uri (source);
client = e_cal_model_get_client_for_uri (model, uri);
g_free (uri);
- if (client == NULL)
+ if (client == NULL) {
+ g_object_unref (source);
return;
+ }
g_return_if_fail (e_client_check_refresh_supported (E_CLIENT (client)));
@@ -327,10 +338,12 @@ action_task_list_refresh_cb (GtkAction *action,
if (error != NULL) {
g_warning (
"%s: Failed to refresh '%s', %s",
- G_STRFUNC, e_source_peek_name (source),
+ G_STRFUNC, e_source_get_display_name (source),
error->message);
g_error_free (error);
}
+
+ g_object_unref (source);
}
static void
@@ -357,10 +370,12 @@ action_task_list_select_one_cb (GtkAction *action,
task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
- primary = e_source_selector_get_primary_selection (selector);
+ primary = e_source_selector_ref_primary_selection (selector);
g_return_if_fail (primary != NULL);
e_source_selector_select_exclusive (selector, primary);
+
+ g_object_unref (primary);
}
static void