aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-01-29 23:50:53 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-01-30 09:22:57 +0800
commit21ab8044dab93b6367463593628ec42befda4f67 (patch)
tree50948c4b0675041b615b5113d7b9176f2d71db99 /modules
parent8fade835168c511a89813019aef6d0ee02d63b5d (diff)
downloadgsoc2013-evolution-21ab8044dab93b6367463593628ec42befda4f67.tar
gsoc2013-evolution-21ab8044dab93b6367463593628ec42befda4f67.tar.gz
gsoc2013-evolution-21ab8044dab93b6367463593628ec42befda4f67.tar.bz2
gsoc2013-evolution-21ab8044dab93b6367463593628ec42befda4f67.tar.lz
gsoc2013-evolution-21ab8044dab93b6367463593628ec42befda4f67.tar.xz
gsoc2013-evolution-21ab8044dab93b6367463593628ec42befda4f67.tar.zst
gsoc2013-evolution-21ab8044dab93b6367463593628ec42befda4f67.zip
Coding style and whitespace cleanup.
Diffstat (limited to 'modules')
-rw-r--r--modules/calendar/e-cal-shell-migrate.c4
-rw-r--r--modules/calendar/e-cal-shell-sidebar.c27
-rw-r--r--modules/calendar/e-cal-shell-view-actions.c4
-rw-r--r--modules/calendar/e-memo-shell-sidebar.c40
-rw-r--r--modules/calendar/e-task-shell-migrate.c4
-rw-r--r--modules/calendar/e-task-shell-sidebar.c40
-rw-r--r--modules/mail/e-mail-shell-sidebar.c14
-rw-r--r--modules/mail/e-mail-shell-view-actions.c25
-rw-r--r--modules/mail/e-mail-shell-view-private.c251
9 files changed, 282 insertions, 127 deletions
diff --git a/modules/calendar/e-cal-shell-migrate.c b/modules/calendar/e-cal-shell-migrate.c
index 3ef6e554ad..710aa8f2a2 100644
--- a/modules/calendar/e-cal-shell-migrate.c
+++ b/modules/calendar/e-cal-shell-migrate.c
@@ -94,9 +94,11 @@ create_calendar_sources (EShellBackend *shell_backend,
if (groups) {
/* groups are already there, we need to search for things... */
GSList *g;
+ const gchar *data_dir;
gchar *base_dir, *base_uri;
- base_dir = g_build_filename (e_shell_backend_get_data_dir (shell_backend), "local", NULL);
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ base_dir = g_build_filename (data_dir, "local", NULL);
base_uri = g_filename_to_uri (base_dir, NULL, NULL);
for (g = groups; g; g = g->next) {
diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c
index 1af16b3b8e..f61e0a60a7 100644
--- a/modules/calendar/e-cal-shell-sidebar.c
+++ b/modules/calendar/e-cal-shell-sidebar.c
@@ -111,6 +111,7 @@ cal_shell_sidebar_backend_died_cb (ECalShellSidebar *cal_shell_sidebar,
ECal *client)
{
EShellView *shell_view;
+ EShellContent *shell_content;
EShellSidebar *shell_sidebar;
GHashTable *client_table;
ESource *source;
@@ -120,6 +121,7 @@ cal_shell_sidebar_backend_died_cb (ECalShellSidebar *cal_shell_sidebar,
shell_sidebar = E_SHELL_SIDEBAR (cal_shell_sidebar);
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_content = e_shell_view_get_shell_content (shell_view);
source = e_cal_get_source (client);
uid = e_source_peek_uid (source);
@@ -129,7 +131,8 @@ cal_shell_sidebar_backend_died_cb (ECalShellSidebar *cal_shell_sidebar,
g_hash_table_remove (client_table, uid);
cal_shell_sidebar_emit_status_message (cal_shell_sidebar, NULL);
- e_alert_submit (E_ALERT_SINK (e_shell_view_get_shell_content (shell_view)),
+ e_alert_submit (
+ E_ALERT_SINK (shell_content),
"calendar:calendar-crashed", NULL);
g_object_unref (source);
@@ -141,18 +144,23 @@ cal_shell_sidebar_backend_error_cb (ECalShellSidebar *cal_shell_sidebar,
ECal *client)
{
EShellView *shell_view;
+ EShellContent *shell_content;
EShellSidebar *shell_sidebar;
ESourceGroup *source_group;
ESource *source;
shell_sidebar = E_SHELL_SIDEBAR (cal_shell_sidebar);
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_content = e_shell_view_get_shell_content (shell_view);
source = e_cal_get_source (client);
source_group = e_source_peek_group (source);
- e_alert_submit (E_ALERT_SINK (e_shell_view_get_shell_content (shell_view)),
- "calendar:backend-error", e_source_group_peek_name (source_group), e_source_peek_name (source), message, NULL);
+ e_alert_submit (
+ E_ALERT_SINK (shell_content),
+ "calendar:backend-error",
+ e_source_group_peek_name (source_group),
+ e_source_peek_name (source), message, NULL);
}
static void
@@ -161,11 +169,13 @@ cal_shell_sidebar_client_opened_cb (ECalShellSidebar *cal_shell_sidebar,
ECal *client)
{
EShellView *shell_view;
+ EShellContent *shell_content;
EShellSidebar *shell_sidebar;
const gchar *message;
shell_sidebar = E_SHELL_SIDEBAR (cal_shell_sidebar);
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_content = e_shell_view_get_shell_content (shell_view);
if (g_error_matches (error, E_CALENDAR_ERROR,
E_CALENDAR_STATUS_AUTHENTICATION_FAILED) ||
@@ -186,14 +196,16 @@ cal_shell_sidebar_client_opened_cb (ECalShellSidebar *cal_shell_sidebar,
return;
case E_CALENDAR_STATUS_REPOSITORY_OFFLINE:
- e_alert_submit (E_ALERT_SINK (e_shell_view_get_shell_content (shell_view)),
+ e_alert_submit (
+ E_ALERT_SINK (shell_content),
"calendar:prompt-no-contents-offline-calendar",
NULL);
/* fall through */
default:
if (error->code != E_CALENDAR_STATUS_REPOSITORY_OFFLINE) {
- e_alert_submit (E_ALERT_SINK (e_shell_view_get_shell_content (shell_view)),
+ e_alert_submit (
+ E_ALERT_SINK (shell_content),
"calendar:failed-open-calendar",
error->message, NULL);
}
@@ -222,6 +234,7 @@ cal_shell_sidebar_default_loaded_cb (ESource *source,
EShellSidebar *shell_sidebar)
{
ECalShellSidebarPrivate *priv;
+ EShellContent *shell_content;
EShellView *shell_view;
ECal *client;
GError *error = NULL;
@@ -229,6 +242,7 @@ cal_shell_sidebar_default_loaded_cb (ESource *source,
priv = E_CAL_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar);
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_content = e_shell_view_get_shell_content (shell_view);
client = e_load_cal_source_finish (source, result, &error);
@@ -237,7 +251,8 @@ cal_shell_sidebar_default_loaded_cb (ESource *source,
goto exit;
} else if (error != NULL) {
- e_alert_submit (E_ALERT_SINK (e_shell_view_get_shell_content (shell_view)),
+ e_alert_submit (
+ E_ALERT_SINK (shell_content),
"calendar:failed-open-calendar",
error->message, NULL);
g_error_free (error);
diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c
index 3417875803..90abf79c3c 100644
--- a/modules/calendar/e-cal-shell-view-actions.c
+++ b/modules/calendar/e-cal-shell-view-actions.c
@@ -1216,7 +1216,9 @@ edit_event_as (ECalShellView *cal_shell_view, gboolean as_meeting)
}
}
- e_calendar_view_edit_appointment (calendar_view, client, icalcomp, as_meeting ? EDIT_EVENT_FORCE_MEETING : EDIT_EVENT_FORCE_APPOINTMENT);
+ e_calendar_view_edit_appointment (
+ calendar_view, client, icalcomp, as_meeting ?
+ EDIT_EVENT_FORCE_MEETING : EDIT_EVENT_FORCE_APPOINTMENT);
if (!as_meeting && icalcomp) {
icalcomponent_free (icalcomp);
diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c
index 31304948f9..b7e52a9095 100644
--- a/modules/calendar/e-memo-shell-sidebar.c
+++ b/modules/calendar/e-memo-shell-sidebar.c
@@ -101,24 +101,12 @@ memo_shell_sidebar_emit_status_message (EMemoShellSidebar *memo_shell_sidebar,
g_signal_emit (memo_shell_sidebar, signal_id, 0, status_message, -1.0);
}
-static EAlertSink *
-get_alert_sink (EShellView *shell_view)
-{
- EShellWindow *shell_window;
-
- shell_window = e_shell_view_get_shell_window (shell_view);
-
- if (g_strcmp0 (e_shell_window_get_active_view (shell_window), "calendar") == 0)
- shell_view = e_shell_window_peek_shell_view (shell_window, "calendar");
-
- return E_ALERT_SINK (e_shell_view_get_shell_content (shell_view));
-}
-
static void
memo_shell_sidebar_backend_died_cb (EMemoShellSidebar *memo_shell_sidebar,
ECal *client)
{
EShellView *shell_view;
+ EShellContent *shell_content;
EShellSidebar *shell_sidebar;
GHashTable *client_table;
ESource *source;
@@ -128,6 +116,7 @@ memo_shell_sidebar_backend_died_cb (EMemoShellSidebar *memo_shell_sidebar,
shell_sidebar = E_SHELL_SIDEBAR (memo_shell_sidebar);
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_content = e_shell_view_get_shell_content (shell_view);
source = e_cal_get_source (client);
uid = e_source_peek_uid (source);
@@ -137,7 +126,8 @@ memo_shell_sidebar_backend_died_cb (EMemoShellSidebar *memo_shell_sidebar,
g_hash_table_remove (client_table, uid);
memo_shell_sidebar_emit_status_message (memo_shell_sidebar, NULL);
- e_alert_submit (get_alert_sink (shell_view),
+ e_alert_submit (
+ E_ALERT_SINK (shell_content),
"calendar:memos-crashed", NULL);
g_object_unref (source);
@@ -149,18 +139,23 @@ memo_shell_sidebar_backend_error_cb (EMemoShellSidebar *memo_shell_sidebar,
ECal *client)
{
EShellView *shell_view;
+ EShellContent *shell_content;
EShellSidebar *shell_sidebar;
ESourceGroup *source_group;
ESource *source;
shell_sidebar = E_SHELL_SIDEBAR (memo_shell_sidebar);
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_content = e_shell_view_get_shell_content (shell_view);
source = e_cal_get_source (client);
source_group = e_source_peek_group (source);
- e_alert_submit (get_alert_sink (shell_view),
- "calendar:backend-error", e_source_group_peek_name (source_group), e_source_peek_name (source), message, NULL);
+ e_alert_submit (
+ E_ALERT_SINK (shell_content),
+ "calendar:backend-error",
+ e_source_group_peek_name (source_group),
+ e_source_peek_name (source), message, NULL);
}
static void
@@ -169,11 +164,13 @@ memo_shell_sidebar_client_opened_cb (EMemoShellSidebar *memo_shell_sidebar,
ECal *client)
{
EShellView *shell_view;
+ EShellContent *shell_content;
EShellSidebar *shell_sidebar;
const gchar *message;
shell_sidebar = E_SHELL_SIDEBAR (memo_shell_sidebar);
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_content = e_shell_view_get_shell_content (shell_view);
if (g_error_matches (error, E_CALENDAR_ERROR,
E_CALENDAR_STATUS_AUTHENTICATION_FAILED) ||
@@ -194,14 +191,16 @@ memo_shell_sidebar_client_opened_cb (EMemoShellSidebar *memo_shell_sidebar,
return;
case E_CALENDAR_STATUS_REPOSITORY_OFFLINE:
- e_alert_submit (get_alert_sink (shell_view),
+ e_alert_submit (
+ E_ALERT_SINK (shell_content),
"calendar:prompt-no-contents-offline-memos",
NULL);
/* fall through */
default:
if (error->code != E_CALENDAR_STATUS_REPOSITORY_OFFLINE) {
- e_alert_submit (get_alert_sink (shell_view),
+ e_alert_submit (
+ E_ALERT_SINK (shell_content),
"calendar:failed-open-memos",
error->message, NULL);
}
@@ -230,6 +229,7 @@ memo_shell_sidebar_default_loaded_cb (ESource *source,
EShellSidebar *shell_sidebar)
{
EMemoShellSidebarPrivate *priv;
+ EShellContent *shell_content;
EShellView *shell_view;
ECal *client;
GError *error = NULL;
@@ -237,6 +237,7 @@ memo_shell_sidebar_default_loaded_cb (ESource *source,
priv = E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar);
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_content = e_shell_view_get_shell_content (shell_view);
client = e_load_cal_source_finish (source, result, &error);
@@ -245,7 +246,8 @@ memo_shell_sidebar_default_loaded_cb (ESource *source,
goto exit;
} else if (error != NULL) {
- e_alert_submit (get_alert_sink (shell_view),
+ e_alert_submit (
+ E_ALERT_SINK (shell_content),
"calendar:failed-open-memos",
error->message, NULL);
g_error_free (error);
diff --git a/modules/calendar/e-task-shell-migrate.c b/modules/calendar/e-task-shell-migrate.c
index f57ac7e75a..d7daafc91d 100644
--- a/modules/calendar/e-task-shell-migrate.c
+++ b/modules/calendar/e-task-shell-migrate.c
@@ -70,9 +70,11 @@ create_task_sources (EShellBackend *shell_backend,
if (groups) {
/* groups are already there, we need to search for things... */
GSList *g;
+ const gchar *data_dir;
gchar *base_dir, *base_uri;
- base_dir = g_build_filename (e_shell_backend_get_data_dir (shell_backend), "local", NULL);
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ base_dir = g_build_filename (data_dir, "local", NULL);
base_uri = g_filename_to_uri (base_dir, NULL, NULL);
for (g = groups; g; g = g->next) {
diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c
index e00159026c..62973d2efc 100644
--- a/modules/calendar/e-task-shell-sidebar.c
+++ b/modules/calendar/e-task-shell-sidebar.c
@@ -101,24 +101,12 @@ task_shell_sidebar_emit_status_message (ETaskShellSidebar *task_shell_sidebar,
g_signal_emit (task_shell_sidebar, signal_id, 0, status_message, -1.0);
}
-static EAlertSink *
-get_alert_sink (EShellView *shell_view)
-{
- EShellWindow *shell_window;
-
- shell_window = e_shell_view_get_shell_window (shell_view);
-
- if (g_strcmp0 (e_shell_window_get_active_view (shell_window), "calendar") == 0)
- shell_view = e_shell_window_peek_shell_view (shell_window, "calendar");
-
- return E_ALERT_SINK (e_shell_view_get_shell_content (shell_view));
-}
-
static void
task_shell_sidebar_backend_died_cb (ETaskShellSidebar *task_shell_sidebar,
ECal *client)
{
EShellView *shell_view;
+ EShellContent *shell_content;
EShellSidebar *shell_sidebar;
GHashTable *client_table;
ESource *source;
@@ -128,6 +116,7 @@ task_shell_sidebar_backend_died_cb (ETaskShellSidebar *task_shell_sidebar,
shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar);
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_content = e_shell_view_get_shell_content (shell_view);
source = e_cal_get_source (client);
uid = e_source_peek_uid (source);
@@ -137,7 +126,8 @@ task_shell_sidebar_backend_died_cb (ETaskShellSidebar *task_shell_sidebar,
g_hash_table_remove (client_table, uid);
task_shell_sidebar_emit_status_message (task_shell_sidebar, NULL);
- e_alert_submit (get_alert_sink (shell_view),
+ e_alert_submit (
+ E_ALERT_SINK (shell_content),
"calendar:tasks-crashed", NULL);
g_object_unref (source);
@@ -149,18 +139,23 @@ task_shell_sidebar_backend_error_cb (ETaskShellSidebar *task_shell_sidebar,
ECal *client)
{
EShellView *shell_view;
+ EShellContent *shell_content;
EShellSidebar *shell_sidebar;
ESourceGroup *source_group;
ESource *source;
shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar);
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_content = e_shell_view_get_shell_content (shell_view);
source = e_cal_get_source (client);
source_group = e_source_peek_group (source);
- e_alert_submit (get_alert_sink (shell_view),
- "calendar:backend-error", e_source_group_peek_name (source_group), e_source_peek_name (source), message, NULL);
+ e_alert_submit (
+ E_ALERT_SINK (shell_content),
+ "calendar:backend-error",
+ e_source_group_peek_name (source_group),
+ e_source_peek_name (source), message, NULL);
}
static void
@@ -169,11 +164,13 @@ task_shell_sidebar_client_opened_cb (ETaskShellSidebar *task_shell_sidebar,
ECal *client)
{
EShellView *shell_view;
+ EShellContent *shell_content;
EShellSidebar *shell_sidebar;
const gchar *message;
shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar);
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_content = e_shell_view_get_shell_content (shell_view);
if (g_error_matches (error, E_CALENDAR_ERROR,
E_CALENDAR_STATUS_AUTHENTICATION_FAILED) ||
@@ -194,14 +191,16 @@ task_shell_sidebar_client_opened_cb (ETaskShellSidebar *task_shell_sidebar,
return;
case E_CALENDAR_STATUS_REPOSITORY_OFFLINE:
- e_alert_submit (get_alert_sink (shell_view),
+ e_alert_submit (
+ E_ALERT_SINK (shell_content),
"calendar:prompt-no-contents-offline-tasks",
NULL);
/* fall through */
default:
if (error->code != E_CALENDAR_STATUS_REPOSITORY_OFFLINE) {
- e_alert_submit (get_alert_sink (shell_view),
+ e_alert_submit (
+ E_ALERT_SINK (shell_content),
"calendar:failed-open-tasks",
error->message, NULL);
}
@@ -230,6 +229,7 @@ task_shell_sidebar_default_loaded_cb (ESource *source,
EShellSidebar *shell_sidebar)
{
ETaskShellSidebarPrivate *priv;
+ EShellContent *shell_content;
EShellView *shell_view;
ECal *client;
GError *error = NULL;
@@ -237,6 +237,7 @@ task_shell_sidebar_default_loaded_cb (ESource *source,
priv = E_TASK_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar);
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_content = e_shell_view_get_shell_content (shell_view);
client = e_load_cal_source_finish (source, result, &error);
@@ -245,7 +246,8 @@ task_shell_sidebar_default_loaded_cb (ESource *source,
goto exit;
} else if (error != NULL) {
- e_alert_submit (get_alert_sink (shell_view),
+ e_alert_submit (
+ E_ALERT_SINK (shell_content),
"calendar:failed-open-tasks",
error->message, NULL);
g_error_free (error);
diff --git a/modules/mail/e-mail-shell-sidebar.c b/modules/mail/e-mail-shell-sidebar.c
index 7c538de519..8a3587b1c8 100644
--- a/modules/mail/e-mail-shell-sidebar.c
+++ b/modules/mail/e-mail-shell-sidebar.c
@@ -232,16 +232,17 @@ guess_screen_width (EMailShellSidebar *sidebar)
static void
mail_shell_sidebar_get_preferred_height (GtkWidget *widget,
- gint *minimum_height,
- gint *natural_height)
+ gint *minimum_height,
+ gint *natural_height)
{
- GTK_WIDGET_CLASS (parent_class)->get_preferred_height (widget, minimum_height, natural_height);
+ GTK_WIDGET_CLASS (parent_class)->get_preferred_height (
+ widget, minimum_height, natural_height);
}
static void
mail_shell_sidebar_get_preferred_width (GtkWidget *widget,
- gint *minimum_width,
- gint *natural_width)
+ gint *minimum_width,
+ gint *natural_width)
{
/* We override the normal size-request handler so that we can
* spit out a treeview with a suitable width. We measure the
@@ -267,7 +268,8 @@ mail_shell_sidebar_get_preferred_width (GtkWidget *widget,
sidebar = E_MAIL_SHELL_SIDEBAR (widget);
- GTK_WIDGET_CLASS (parent_class)->get_preferred_width (widget, minimum_width, natural_width);
+ GTK_WIDGET_CLASS (parent_class)->get_preferred_width (
+ widget, minimum_width, natural_width);
/* This string is a mockup only; it doesn't need to be translated */
layout = gtk_widget_create_pango_layout (
diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c
index 1342e8aa11..1665b8e8ce 100644
--- a/modules/mail/e-mail-shell-view-actions.c
+++ b/modules/mail/e-mail-shell-view-actions.c
@@ -257,8 +257,10 @@ action_mail_folder_expunge_cb (GtkAction *action,
{
EMailShellSidebar *mail_shell_sidebar;
EMFolderTree *folder_tree;
+ EShellBackend *shell_backend;
EShellWindow *shell_window;
EShellView *shell_view;
+ EMailSession *session;
CamelFolder *folder;
/* This handles both the "folder-expunge" and "account-expunge"
@@ -278,7 +280,10 @@ action_mail_folder_expunge_cb (GtkAction *action,
folder = em_folder_tree_get_selected_folder (folder_tree);
g_return_if_fail (folder != NULL);
- em_utils_expunge_folder (GTK_WIDGET (shell_window), e_mail_backend_get_session (E_MAIL_BACKEND (e_shell_view_get_shell_backend (shell_view))), folder);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+ session = e_mail_backend_get_session (E_MAIL_BACKEND (shell_backend));
+
+ em_utils_expunge_folder (GTK_WIDGET (shell_window), session, folder);
}
static void
@@ -718,21 +723,27 @@ action_mail_label_none_cb (GtkAction *action,
}
static void
-action_mail_send_receive_cb (GtkAction *action, EMailShellView *mail_shell_view)
+action_mail_send_receive_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
{
- e_mail_shell_view_send_receive (mail_shell_view, E_MAIL_SEND_RECEIVE_BOTH, NULL);
+ e_mail_shell_view_send_receive (
+ mail_shell_view, E_MAIL_SEND_RECEIVE_BOTH, NULL);
}
static void
-action_mail_send_receive_receive_all_cb (GtkAction *action, EMailShellView *mail_shell_view)
+action_mail_send_receive_receive_all_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
{
- e_mail_shell_view_send_receive (mail_shell_view, E_MAIL_SEND_RECEIVE_RECEIVE, NULL);
+ e_mail_shell_view_send_receive (
+ mail_shell_view, E_MAIL_SEND_RECEIVE_RECEIVE, NULL);
}
static void
-action_mail_send_receive_send_all_cb (GtkAction *action, EMailShellView *mail_shell_view)
+action_mail_send_receive_send_all_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
{
- e_mail_shell_view_send_receive (mail_shell_view, E_MAIL_SEND_RECEIVE_SEND, NULL);
+ e_mail_shell_view_send_receive (
+ mail_shell_view, E_MAIL_SEND_RECEIVE_SEND, NULL);
}
static void
diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c
index 6a15f4ed07..d69ba8da3b 100644
--- a/modules/mail/e-mail-shell-view-private.c
+++ b/modules/mail/e-mail-shell-view-private.c
@@ -1137,17 +1137,22 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view)
}
void
-e_mail_shell_view_send_receive (EMailShellView *mail_shell_view, EMailSendReceiveMode mode, const gchar *account_uid)
+e_mail_shell_view_send_receive (EMailShellView *mail_shell_view,
+ EMailSendReceiveMode mode,
+ const gchar *account_uid)
{
- EMailBackend *backend;
EMailSession *session;
+ EShellView *shell_view;
EShellWindow *shell_window;
+ EShellBackend *shell_backend;
g_return_if_fail (mail_shell_view != NULL);
- shell_window = e_shell_view_get_shell_window (E_SHELL_VIEW (mail_shell_view));
- backend = E_MAIL_BACKEND (e_shell_view_get_shell_backend (E_SHELL_VIEW (mail_shell_view)));
- session = e_mail_backend_get_session (backend);
+ shell_view = E_SHELL_VIEW (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 ();
@@ -1166,17 +1171,24 @@ e_mail_shell_view_send_receive (EMailShellView *mail_shell_view, EMailSendReceiv
} else {
/* allow only receive on individual accounts */
EAccount *account;
+ const gchar *source_url = NULL;
account = e_get_account_by_uid (account_uid);
g_return_if_fail (account != NULL);
- if (account->enabled && account->source && account->source->url && *account->source->url)
- mail_receive_uri (session, account->source->url, account->source->keep_on_server);
+ if (account->enabled && account->source != NULL)
+ source_url = account->source->url;
+
+ if (source_url != NULL && *source_url != '\0')
+ mail_receive_uri (
+ session, source_url,
+ account->source->keep_on_server);
}
}
static GtkMenuItem *
-send_receive_find_account_menu_item (GtkMenuShell *menu, EAccount *account)
+send_receive_find_account_menu_item (GtkMenuShell *menu,
+ EAccount *account)
{
GList *children, *child;
@@ -1225,17 +1237,37 @@ send_receive_get_account_index (EAccount *account)
for (iterator = e_list_get_iterator (E_LIST (accounts));
e_iterator_is_valid (iterator);
e_iterator_next (iterator)) {
- EAccount *acc = (EAccount *) e_iterator_get (iterator);
+ EAccount *candidate;
const gchar *name;
- if (!acc || !acc->enabled || !acc->source || !acc->source->url || !*acc->source->url)
+ candidate = (EAccount *) e_iterator_get (iterator);
+
+ if (candidate == NULL)
continue;
- name = e_account_get_string (acc, E_ACCOUNT_NAME);
- if (!name || !*name || !acc->uid || !*acc->uid)
+ if (!candidate->enabled)
continue;
- if (g_strcmp0 (acc->uid, account->uid) == 0) {
+ if (candidate->source == NULL)
+ continue;
+
+ if (candidate->source->url == NULL)
+ continue;
+
+ if (*candidate->source->url == '\0')
+ continue;
+
+ name = e_account_get_string (candidate, E_ACCOUNT_NAME);
+ if (name == NULL || *name == '\0')
+ continue;
+
+ if (candidate->uid == NULL)
+ continue;
+
+ if (*candidate->uid == '\0')
+ continue;
+
+ if (g_strcmp0 (candidate->uid, account->uid) == 0) {
g_object_unref (iterator);
return res;
}
@@ -1249,7 +1281,8 @@ send_receive_get_account_index (EAccount *account)
}
static void
-send_receive_account_item_activate_cb (GtkMenuItem *item, GtkMenuShell *menu)
+send_receive_account_item_activate_cb (GtkMenuItem *item,
+ GtkMenuShell *menu)
{
EMailShellView *mail_shell_view;
const gchar *account_uid;
@@ -1263,11 +1296,14 @@ send_receive_account_item_activate_cb (GtkMenuItem *item, GtkMenuShell *menu)
account_uid = g_object_get_data (G_OBJECT (item), "e-account-uid");
g_return_if_fail (account_uid != NULL);
- e_mail_shell_view_send_receive (mail_shell_view, E_MAIL_SEND_RECEIVE_RECEIVE, account_uid);
+ e_mail_shell_view_send_receive (
+ mail_shell_view, E_MAIL_SEND_RECEIVE_RECEIVE, account_uid);
}
static void
-send_receive_add_to_menu (GtkMenuShell *menu, EAccount *account, gint insert_index)
+send_receive_add_to_menu (GtkMenuShell *menu,
+ EAccount *account,
+ gint insert_index)
{
const gchar *name;
GtkWidget *item;
@@ -1278,27 +1314,45 @@ send_receive_add_to_menu (GtkMenuShell *menu, EAccount *account, gint insert_ind
if (send_receive_find_account_menu_item (menu, account) != NULL)
return;
- if (!account->source || !account->source->url || !*account->source->url)
+ if (account->source == NULL)
+ return;
+
+ if (account->source->url == NULL)
+ return;
+
+ if (*account->source->url == '\0')
return;
name = e_account_get_string (account, E_ACCOUNT_NAME);
- if (!name || !*name || !account->uid || !*account->uid)
+ if (name == NULL || *name == '\0')
+ return;
+
+ if (account->uid == NULL)
+ return;
+
+ if (*account->uid == '\0')
return;
item = gtk_menu_item_new_with_label (name);
gtk_widget_show (item);
- g_object_set_data_full (G_OBJECT (item), "e-account-uid", g_strdup (account->uid), g_free);
- g_signal_connect (item, "activate", G_CALLBACK (send_receive_account_item_activate_cb), menu);
+ g_object_set_data_full (
+ G_OBJECT (item), "e-account-uid",
+ g_strdup (account->uid), g_free);
+ g_signal_connect (
+ item, "activate",
+ G_CALLBACK (send_receive_account_item_activate_cb), menu);
/* it's index between accounts, not in the menu */
if (insert_index < 0)
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
else
- gtk_menu_shell_insert (GTK_MENU_SHELL (menu), item, insert_index + 4);
+ gtk_menu_shell_insert (
+ GTK_MENU_SHELL (menu), item, insert_index + 4);
}
static void
-send_receive_remove_from_menu (GtkMenuShell *menu, EAccount *account)
+send_receive_remove_from_menu (GtkMenuShell *menu,
+ EAccount *account)
{
GtkMenuItem *item;
@@ -1306,41 +1360,56 @@ send_receive_remove_from_menu (GtkMenuShell *menu, EAccount *account)
g_return_if_fail (account != NULL);
item = send_receive_find_account_menu_item (menu, account);
- if (!item)
+ if (item == NULL)
return;
gtk_container_remove (GTK_CONTAINER (menu), GTK_WIDGET (item));
}
static void
-send_receive_menu_account_added_cb (EAccountList *list, EAccount *account, GtkMenuShell *menu)
+send_receive_menu_account_added_cb (EAccountList *list,
+ EAccount *account,
+ GtkMenuShell *menu)
{
g_return_if_fail (account != NULL);
g_return_if_fail (menu != NULL);
if (account->enabled)
- send_receive_add_to_menu (menu, account, send_receive_get_account_index (account));
+ send_receive_add_to_menu (
+ menu, account,
+ send_receive_get_account_index (account));
}
static void
-send_receive_menu_account_changed_cb (EAccountList *list, EAccount *account, GtkMenuShell *menu)
+send_receive_menu_account_changed_cb (EAccountList *list,
+ EAccount *account,
+ GtkMenuShell *menu)
{
g_return_if_fail (account != NULL);
g_return_if_fail (menu != NULL);
if (account->enabled) {
- GtkMenuItem *item = send_receive_find_account_menu_item (menu, account);
+ GtkMenuItem *item;
+
+ item = send_receive_find_account_menu_item (menu, account);
if (item) {
- if (!account->source || !account->source->url || !*account->source->url) {
+ if (account->source == NULL ||
+ account->source->url == NULL ||
+ *account->source->url == '\0') {
send_receive_remove_from_menu (menu, account);
} else {
- const gchar *name = e_account_get_string (account, E_ACCOUNT_NAME);
- if (name && *name)
+ const gchar *name;
+
+ name = e_account_get_string (
+ account, E_ACCOUNT_NAME);
+ if (name != NULL && *name != '\0')
gtk_menu_item_set_label (item, name);
}
} else {
- send_receive_add_to_menu (menu, account, send_receive_get_account_index (account));
+ send_receive_add_to_menu (
+ menu, account,
+ send_receive_get_account_index (account));
}
} else {
send_receive_remove_from_menu (menu, account);
@@ -1348,7 +1417,9 @@ send_receive_menu_account_changed_cb (EAccountList *list, EAccount *account, Gtk
}
static void
-send_receive_menu_account_removed_cb (EAccountList *list, EAccount *account, GtkMenuShell *menu)
+send_receive_menu_account_removed_cb (EAccountList *list,
+ EAccount *account,
+ GtkMenuShell *menu)
{
g_return_if_fail (account != NULL);
g_return_if_fail (menu != NULL);
@@ -1357,16 +1428,20 @@ send_receive_menu_account_removed_cb (EAccountList *list, EAccount *account, Gtk
}
static void
-menu_weak_ref_cb (gpointer accounts, GObject *freed_menu)
+menu_weak_ref_cb (gpointer accounts,
+ GObject *where_the_object_was)
{
g_return_if_fail (accounts != NULL);
- g_signal_handlers_disconnect_matched (accounts, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, freed_menu);
+ g_signal_handlers_disconnect_matched (
+ accounts, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, where_the_object_was);
}
static GtkWidget *
create_send_receive_submenu (EMailShellView *mail_shell_view)
{
+ EShellView *shell_view;
EShellWindow *shell_window;
EAccountList *accounts;
GtkWidget *menu;
@@ -1376,7 +1451,8 @@ create_send_receive_submenu (EMailShellView *mail_shell_view)
g_return_val_if_fail (mail_shell_view != NULL, NULL);
- shell_window = e_shell_view_get_shell_window (E_SHELL_VIEW (mail_shell_view));
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
accounts = e_get_account_list ();
menu = gtk_menu_new ();
@@ -1385,17 +1461,27 @@ create_send_receive_submenu (EMailShellView *mail_shell_view)
action = e_shell_window_get_action (shell_window, "mail-send-receive");
gtk_action_set_accel_group (action, accel_group);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), gtk_action_create_menu_item (action));
+ gtk_menu_shell_append (
+ GTK_MENU_SHELL (menu),
+ gtk_action_create_menu_item (action));
- action = e_shell_window_get_action (shell_window, "mail-send-receive-receive-all");
+ action = e_shell_window_get_action (
+ shell_window, "mail-send-receive-receive-all");
gtk_action_set_accel_group (action, accel_group);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), gtk_action_create_menu_item (action));
+ gtk_menu_shell_append (
+ GTK_MENU_SHELL (menu),
+ gtk_action_create_menu_item (action));
- action = e_shell_window_get_action (shell_window, "mail-send-receive-send-all");
+ action = e_shell_window_get_action (
+ shell_window, "mail-send-receive-send-all");
gtk_action_set_accel_group (action, accel_group);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), gtk_action_create_menu_item (action));
+ gtk_menu_shell_append (
+ GTK_MENU_SHELL (menu),
+ gtk_action_create_menu_item (action));
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), gtk_separator_menu_item_new ());
+ gtk_menu_shell_append (
+ GTK_MENU_SHELL (menu),
+ gtk_separator_menu_item_new ());
if (accounts) {
EIterator *iterator;
@@ -1403,21 +1489,34 @@ create_send_receive_submenu (EMailShellView *mail_shell_view)
for (iterator = e_list_get_iterator (E_LIST (accounts));
e_iterator_is_valid (iterator);
e_iterator_next (iterator)) {
- EAccount *account = (EAccount *) e_iterator_get (iterator);
+ EAccount *account;
+
+ account = (EAccount *) e_iterator_get (iterator);
- if (!account || !account->enabled)
+ if (account == NULL)
continue;
- send_receive_add_to_menu (GTK_MENU_SHELL (menu), account, -1);
+ if (!account->enabled)
+ continue;
+
+ send_receive_add_to_menu (
+ GTK_MENU_SHELL (menu), account, -1);
}
g_object_unref (iterator);
- g_signal_connect (accounts, "account-added", G_CALLBACK (send_receive_menu_account_added_cb), menu);
- g_signal_connect (accounts, "account-changed", G_CALLBACK (send_receive_menu_account_changed_cb), menu);
- g_signal_connect (accounts, "account-removed", G_CALLBACK (send_receive_menu_account_removed_cb), menu);
-
- g_object_weak_ref (G_OBJECT (menu), menu_weak_ref_cb, accounts);
+ g_signal_connect (
+ accounts, "account-added",
+ G_CALLBACK (send_receive_menu_account_added_cb), menu);
+ g_signal_connect (
+ accounts, "account-changed",
+ G_CALLBACK (send_receive_menu_account_changed_cb), menu);
+ g_signal_connect (
+ accounts, "account-removed",
+ G_CALLBACK (send_receive_menu_account_removed_cb), menu);
+
+ g_object_weak_ref (
+ G_OBJECT (menu), menu_weak_ref_cb, accounts);
}
gtk_widget_show_all (menu);
@@ -1432,24 +1531,31 @@ e_mail_shell_view_update_send_receive_menus (EMailShellView *mail_shell_view)
{
EMailShellViewPrivate *priv;
EShellWindow *shell_window;
+ EShellView *shell_view;
GtkWidget *widget;
+ const gchar *widget_path;
- g_return_if_fail (mail_shell_view != NULL);
+ g_return_if_fail (E_IS_MAIL_SHELL_VIEW (mail_shell_view));
priv = E_MAIL_SHELL_VIEW_GET_PRIVATE (mail_shell_view);
- g_return_if_fail (priv != NULL);
- if (!e_shell_view_is_active (E_SHELL_VIEW (mail_shell_view))) {
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ if (!e_shell_view_is_active (shell_view)) {
if (priv->send_receive_tool_item) {
GtkWidget *toolbar;
- shell_window = e_shell_view_get_shell_window (E_SHELL_VIEW (mail_shell_view));
-
- toolbar = e_shell_window_get_managed_widget (shell_window, "/main-toolbar");
+ toolbar = e_shell_window_get_managed_widget (
+ shell_window, "/main-toolbar");
g_return_if_fail (toolbar != NULL);
- gtk_container_remove (GTK_CONTAINER (toolbar), GTK_WIDGET (priv->send_receive_tool_item));
- gtk_container_remove (GTK_CONTAINER (toolbar), GTK_WIDGET (priv->send_receive_tool_separator));
+ gtk_container_remove (
+ GTK_CONTAINER (toolbar),
+ GTK_WIDGET (priv->send_receive_tool_item));
+ gtk_container_remove (
+ GTK_CONTAINER (toolbar),
+ GTK_WIDGET (priv->send_receive_tool_separator));
priv->send_receive_tool_item = NULL;
priv->send_receive_tool_separator = NULL;
@@ -1458,31 +1564,40 @@ e_mail_shell_view_update_send_receive_menus (EMailShellView *mail_shell_view)
return;
}
- shell_window = e_shell_view_get_shell_window (E_SHELL_VIEW (mail_shell_view));
-
- widget = e_shell_window_get_managed_widget (shell_window, "/main-menu/file-menu/mail-send-receiver/mail-send-receive-submenu");
- if (widget)
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (widget), create_send_receive_submenu (mail_shell_view));
+ widget_path =
+ "/main-menu/file-menu"
+ "/mail-send-receiver/mail-send-receive-submenu";
+ widget = e_shell_window_get_managed_widget (shell_window, widget_path);
+ if (widget != NULL)
+ gtk_menu_item_set_submenu (
+ GTK_MENU_ITEM (widget),
+ create_send_receive_submenu (mail_shell_view));
if (!priv->send_receive_tool_item) {
GtkWidget *toolbar;
GtkToolItem *tool_item;
gint index;
- toolbar = e_shell_window_get_managed_widget (shell_window, "/main-toolbar");
+ toolbar = e_shell_window_get_managed_widget (
+ shell_window, "/main-toolbar");
g_return_if_fail (toolbar != NULL);
- widget = e_shell_window_get_managed_widget (shell_window, "/main-toolbar/toolbar-actions/mail-send-receiver");
+ widget_path =
+ "/main-toolbar/toolbar-actions/mail-send-receiver";
+ widget = e_shell_window_get_managed_widget (
+ shell_window, widget_path);
g_return_if_fail (widget != NULL);
- index = gtk_toolbar_get_item_index (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (widget));
+ index = gtk_toolbar_get_item_index (
+ GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (widget));
tool_item = gtk_separator_tool_item_new ();
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), tool_item, index);
gtk_widget_show (GTK_WIDGET (tool_item));
priv->send_receive_tool_separator = tool_item;
- tool_item = GTK_TOOL_ITEM (e_menu_tool_button_new (_("Send / Receive")));
+ tool_item = GTK_TOOL_ITEM (
+ e_menu_tool_button_new (_("Send / Receive")));
gtk_tool_item_set_is_important (tool_item, TRUE);
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), tool_item, index);
gtk_widget_show (GTK_WIDGET (tool_item));
@@ -1495,5 +1610,7 @@ e_mail_shell_view_update_send_receive_menus (EMailShellView *mail_shell_view)
}
if (priv->send_receive_tool_item)
- gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (priv->send_receive_tool_item), create_send_receive_submenu (mail_shell_view));
+ gtk_menu_tool_button_set_menu (
+ GTK_MENU_TOOL_BUTTON (priv->send_receive_tool_item),
+ create_send_receive_submenu (mail_shell_view));
}