aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/widgets
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-07-01 12:07:26 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-08-13 23:27:51 +0800
commitf59681796df8fe0138a1754abbe8ec781bc1535e (patch)
tree0ced0c119ffed095713d7f64732686df9b2d9152 /addressbook/gui/widgets
parentbf4a1a13e3295deefc4031a446627ff9b1c95c7a (diff)
downloadgsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.tar
gsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.tar.gz
gsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.tar.bz2
gsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.tar.lz
gsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.tar.xz
gsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.tar.zst
gsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.zip
Coding style and whitespace cleanup.
Diffstat (limited to 'addressbook/gui/widgets')
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.c59
-rw-r--r--addressbook/gui/widgets/e-addressbook-selector.c31
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c50
-rw-r--r--addressbook/gui/widgets/eab-contact-display.c15
-rw-r--r--addressbook/gui/widgets/eab-contact-display.h8
-rw-r--r--addressbook/gui/widgets/eab-gui-util.c40
6 files changed, 136 insertions, 67 deletions
diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c
index 497b8fe353..2a34ccf3c0 100644
--- a/addressbook/gui/widgets/e-addressbook-model.c
+++ b/addressbook/gui/widgets/e-addressbook-model.c
@@ -130,8 +130,11 @@ remove_book_view (EAddressbookModel *model)
GError *error = NULL;
e_book_client_view_stop (model->priv->client_view, &error);
- if (error) {
- g_debug ("%s: Failed to stop client view: %s", G_STRFUNC, error->message);
+
+ if (error != NULL) {
+ g_warning (
+ "%s: Failed to stop client view: %s",
+ G_STRFUNC, error->message);
g_error_free (error);
}
@@ -166,7 +169,9 @@ update_folder_bar_message (EAddressbookModel *model)
}
static void
-view_create_contact_cb (EBookClientView *client_view, const GSList *contact_list, EAddressbookModel *model)
+view_create_contact_cb (EBookClientView *client_view,
+ const GSList *contact_list,
+ EAddressbookModel *model)
{
GPtrArray *array;
guint count;
@@ -198,7 +203,9 @@ sort_descending (gconstpointer ca,
}
static void
-view_remove_contact_cb (EBookClientView *client_view, const GSList *ids, EAddressbookModel *model)
+view_remove_contact_cb (EBookClientView *client_view,
+ const GSList *ids,
+ EAddressbookModel *model)
{
/* XXX we should keep a hash around instead of this O(n*m) loop */
const GSList *iter;
@@ -252,7 +259,9 @@ view_remove_contact_cb (EBookClientView *client_view, const GSList *ids, EAddres
}
static void
-view_modify_contact_cb (EBookClientView *client_view, const GSList *contact_list, EAddressbookModel *model)
+view_modify_contact_cb (EBookClientView *client_view,
+ const GSList *contact_list,
+ EAddressbookModel *model)
{
GPtrArray *array;
@@ -291,7 +300,10 @@ view_modify_contact_cb (EBookClientView *client_view, const GSList *contact_list
}
static void
-view_progress_cb (EBookClientView *client_view, guint percent, const gchar *message, EAddressbookModel *model)
+view_progress_cb (EBookClientView *client_view,
+ guint percent,
+ const gchar *message,
+ EAddressbookModel *model)
{
if (model->priv->remove_status_id)
g_source_remove (model->priv->remove_status_id);
@@ -301,7 +313,9 @@ view_progress_cb (EBookClientView *client_view, guint percent, const gchar *mess
}
static void
-view_complete_cb (EBookClientView *client_view, const GError *error, EAddressbookModel *model)
+view_complete_cb (EBookClientView *client_view,
+ const GError *error,
+ EAddressbookModel *model)
{
model->priv->search_in_progress = FALSE;
view_progress_cb (client_view, -1, NULL, model);
@@ -310,23 +324,30 @@ view_complete_cb (EBookClientView *client_view, const GError *error, EAddressboo
}
static void
-readonly_cb (EBookClient *book_client, EAddressbookModel *model)
+readonly_cb (EBookClient *book_client,
+ EAddressbookModel *model)
{
if (!model->priv->editable_set) {
- model->priv->editable = !e_client_is_readonly (E_CLIENT (book_client));
+ model->priv->editable =
+ !e_client_is_readonly (E_CLIENT (book_client));
- g_signal_emit (model, signals[WRITABLE_STATUS], 0, model->priv->editable);
+ g_signal_emit (
+ model, signals[WRITABLE_STATUS], 0,
+ model->priv->editable);
}
}
static void
-backend_died_cb (EBookClient *book_client, EAddressbookModel *model)
+backend_died_cb (EBookClient *book_client,
+ EAddressbookModel *model)
{
g_signal_emit (model, signals[BACKEND_DIED], 0);
}
static void
-client_view_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+client_view_ready_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
EBookClient *book_client = E_BOOK_CLIENT (source_object);
EBookClientView *client_view = NULL;
@@ -372,8 +393,11 @@ client_view_ready_cb (GObject *source_object, GAsyncResult *result, gpointer use
if (model->priv->client_view) {
e_book_client_view_start (model->priv->client_view, &error);
- if (error) {
- g_debug ("%s: Failed to start client view: %s", G_STRFUNC, error->message);
+
+ if (error != NULL) {
+ g_warning (
+ "%s: Failed to start client view: %s",
+ G_STRFUNC, error->message);
g_error_free (error);
}
}
@@ -383,7 +407,7 @@ static gboolean
addressbook_model_idle_cb (EAddressbookModel *model)
{
model->priv->client_view_idle_id = 0;
-
+
if (model->priv->book_client && model->priv->query_str) {
remove_book_view (model);
@@ -826,7 +850,7 @@ e_addressbook_model_get_client (EAddressbookModel *model)
void
e_addressbook_model_set_client (EAddressbookModel *model,
- EBookClient *book_client)
+ EBookClient *book_client)
{
g_return_if_fail (E_IS_ADDRESSBOOK_MODEL (model));
g_return_if_fail (E_IS_BOOK_CLIENT (book_client));
@@ -862,7 +886,8 @@ e_addressbook_model_set_client (EAddressbookModel *model,
G_CALLBACK (backend_died_cb), model);
if (!model->priv->editable_set) {
- model->priv->editable = !e_client_is_readonly (E_CLIENT (book_client));
+ model->priv->editable =
+ !e_client_is_readonly (E_CLIENT (book_client));
g_signal_emit (
model, signals[WRITABLE_STATUS], 0,
model->priv->editable);
diff --git a/addressbook/gui/widgets/e-addressbook-selector.c b/addressbook/gui/widgets/e-addressbook-selector.c
index 954b1e19b9..b6bfa01537 100644
--- a/addressbook/gui/widgets/e-addressbook-selector.c
+++ b/addressbook/gui/widgets/e-addressbook-selector.c
@@ -104,15 +104,20 @@ merge_context_free (MergeContext *merge_context)
}
static void
-addressbook_selector_removed_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+addressbook_selector_removed_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
EBookClient *book_client = E_BOOK_CLIENT (source_object);
MergeContext *merge_context = user_data;
GError *error = NULL;
e_book_client_remove_contact_finish (book_client, result, &error);
- if (error) {
- g_debug ("%s: Failed to remove contact: %s", G_STRFUNC, error->message);
+
+ if (error != NULL) {
+ g_warning (
+ "%s: Failed to remove contact: %s",
+ G_STRFUNC, error->message);
g_error_free (error);
}
@@ -252,7 +257,9 @@ addressbook_selector_constructed (GObject *object)
}
static void
-target_client_open_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+target_client_open_ready_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
ESource *source = E_SOURCE (source_object);
MergeContext *merge_context = user_data;
@@ -261,18 +268,24 @@ target_client_open_ready_cb (GObject *source_object, GAsyncResult *result, gpoin
g_return_if_fail (merge_context != NULL);
- if (!e_client_utils_open_new_finish (source, result, &client, &error))
- client = NULL;
+ e_client_utils_open_new_finish (source, result, &client, &error);
- if (error) {
- g_debug ("%s: Failed to open targer client: %s", G_STRFUNC, error->message);
+ if (error != NULL) {
+ g_warn_if_fail (client == NULL);
+ g_warning (
+ "%s: Failed to open targer client: %s",
+ G_STRFUNC, error->message);
g_error_free (error);
}
+ g_return_if_fail (E_IS_CLIENT (client));
+
merge_context->target_client = client ? E_BOOK_CLIENT (client) : NULL;
if (!merge_context->target_client) {
- g_slist_foreach (merge_context->remaining_contacts, (GFunc) g_object_unref, NULL);
+ g_slist_foreach (
+ merge_context->remaining_contacts,
+ (GFunc) g_object_unref, NULL);
g_slist_free (merge_context->remaining_contacts);
merge_context_free (merge_context);
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index 1de028c9fa..55310949b0 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -1266,9 +1266,9 @@ report_and_free_error_if_any (GError *error)
}
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_PERMISSION_DENIED)) {
- e_alert_run_dialog_for_args (e_shell_get_active_window (NULL),
- "addressbook:contact-delete-error-perm",
- NULL);
+ e_alert_run_dialog_for_args (
+ e_shell_get_active_window (NULL),
+ "addressbook:contact-delete-error-perm", NULL);
} else {
eab_error_dialog (NULL, _("Failed to delete contact"), error);
}
@@ -1280,7 +1280,9 @@ report_and_free_error_if_any (GError *error)
* which a user doesnt have write permission
*/
static void
-remove_contacts_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+remove_contacts_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
EBookClient *book_client = E_BOOK_CLIENT (source_object);
GError *error = NULL;
@@ -1291,7 +1293,9 @@ remove_contacts_cb (GObject *source_object, GAsyncResult *result, gpointer user_
}
static void
-remove_contact_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+remove_contact_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
EBookClient *book_client = E_BOOK_CLIENT (source_object);
GError *error = NULL;
@@ -1415,13 +1419,17 @@ e_addressbook_view_delete_selection (EAddressbookView *view, gboolean is_delete)
GSList *ids = NULL;
for (l = list; l; l = g_slist_next (l)) {
+ const gchar *uid;
+
contact = l->data;
- ids = g_slist_prepend (ids, (gpointer) e_contact_get_const (contact, E_CONTACT_UID));
+ uid = e_contact_get_const (contact, E_CONTACT_UID);
+ ids = g_slist_prepend (ids, (gpointer) uid);
}
/* Remove the cards all at once. */
- e_book_client_remove_contacts (book_client, ids, NULL, remove_contacts_cb, NULL);
+ e_book_client_remove_contacts (
+ book_client, ids, NULL, remove_contacts_cb, NULL);
g_slist_free (ids);
} else {
@@ -1429,7 +1437,9 @@ e_addressbook_view_delete_selection (EAddressbookView *view, gboolean is_delete)
contact = l->data;
/* Remove the card. */
- e_book_client_remove_contact (book_client, contact, NULL, remove_contact_cb, NULL);
+ e_book_client_remove_contact (
+ book_client, contact, NULL,
+ remove_contact_cb, NULL);
}
}
@@ -1531,11 +1541,14 @@ struct TransferContactsData
};
static void
-all_contacts_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+all_contacts_ready_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
EBookClient *book_client = E_BOOK_CLIENT (source_object);
struct TransferContactsData *tcd = user_data;
EShellView *shell_view;
+ EShellContent *shell_content;
EAlertSink *alert_sink;
GSList *contacts = NULL;
GError *error = NULL;
@@ -1547,7 +1560,8 @@ all_contacts_ready_cb (GObject *source_object, GAsyncResult *result, gpointer us
contacts = NULL;
shell_view = e_addressbook_view_get_shell_view (tcd->view);
- alert_sink = E_ALERT_SINK (e_shell_view_get_shell_content (shell_view));
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ alert_sink = E_ALERT_SINK (shell_content);
if (error) {
e_alert_submit (
@@ -1555,7 +1569,9 @@ all_contacts_ready_cb (GObject *source_object, GAsyncResult *result, gpointer us
error->message, NULL);
g_error_free (error);
} else if (contacts) {
- eab_transfer_contacts (book_client, contacts, tcd->delete_from_source, alert_sink);
+ eab_transfer_contacts (
+ book_client, contacts,
+ tcd->delete_from_source, alert_sink);
}
g_object_unref (tcd->view);
@@ -1584,17 +1600,23 @@ view_transfer_contacts (EAddressbookView *view,
tcd->delete_from_source = delete_from_source;
tcd->view = g_object_ref (view);
- e_book_client_get_contacts (book_client, query_str, NULL, all_contacts_ready_cb, tcd);
+ e_book_client_get_contacts (
+ book_client, query_str, NULL,
+ all_contacts_ready_cb, tcd);
} else {
GSList *contacts = NULL;
EShellView *shell_view;
+ EShellContent *shell_content;
EAlertSink *alert_sink;
shell_view = e_addressbook_view_get_shell_view (view);
- alert_sink = E_ALERT_SINK (e_shell_view_get_shell_content (shell_view));
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ alert_sink = E_ALERT_SINK (shell_content);
+
contacts = e_addressbook_view_get_selected (view);
- eab_transfer_contacts (book_client, contacts, delete_from_source, alert_sink);
+ eab_transfer_contacts (
+ book_client, contacts, delete_from_source, alert_sink);
}
}
diff --git a/addressbook/gui/widgets/eab-contact-display.c b/addressbook/gui/widgets/eab-contact-display.c
index ab66e8d554..76516fc119 100644
--- a/addressbook/gui/widgets/eab-contact-display.c
+++ b/addressbook/gui/widgets/eab-contact-display.c
@@ -505,8 +505,8 @@ render_contact_list_row (GString *buffer,
static void
render_contact_list_vertical (GString *buffer,
- EContact *contact,
- EABContactDisplay *display)
+ EContact *contact,
+ EABContactDisplay *display)
{
EDestination *destination;
const GList *dest, *dests;
@@ -523,7 +523,7 @@ render_contact_list_vertical (GString *buffer,
for (dest = dests; dest; dest = dest->next) {
render_contact_list_row (buffer, dest->data, display);
- }
+ }
g_string_append (buffer, "</table>");
g_string_append (buffer, "</td></tr></table>");
@@ -533,8 +533,8 @@ render_contact_list_vertical (GString *buffer,
static void
render_contact_list_horizontal (GString *buffer,
- EContact *contact,
- EABContactDisplay *display)
+ EContact *contact,
+ EABContactDisplay *display)
{
EDestination *destination;
const GList *dest, *dests;
@@ -549,9 +549,8 @@ render_contact_list_horizontal (GString *buffer,
"<tr><td with=" IMAGE_COL_WIDTH "></td><td>", _("List Members:"));
g_string_append (buffer, "<table border=\"0\" cellspacing=\"1\">");
- for (dest = dests; dest; dest = dest->next) {
+ for (dest = dests; dest; dest = dest->next)
render_contact_list_row (buffer, dest->data, display);
- }
g_string_append (buffer, "</table>");
g_string_append (buffer, "</td></tr></table>");
@@ -562,7 +561,7 @@ render_contact_list_horizontal (GString *buffer,
static void
render_contact_list (GString *buffer,
EContact *contact,
- EABContactDisplay *display)
+ EABContactDisplay *display)
{
if (display->priv->orientation == GTK_ORIENTATION_VERTICAL)
diff --git a/addressbook/gui/widgets/eab-contact-display.h b/addressbook/gui/widgets/eab-contact-display.h
index f7561f8779..610714800b 100644
--- a/addressbook/gui/widgets/eab-contact-display.h
+++ b/addressbook/gui/widgets/eab-contact-display.h
@@ -92,9 +92,11 @@ GtkOrientation eab_contact_display_get_orientation
void eab_contact_display_set_orientation
(EABContactDisplay *display,
GtkOrientation orientation);
-
-gboolean eab_contact_display_get_show_maps (EABContactDisplay *display);
-void eab_contact_display_set_show_maps (EABContactDisplay *display, gboolean display_maps);
+gboolean eab_contact_display_get_show_maps
+ (EABContactDisplay *display);
+void eab_contact_display_set_show_maps
+ (EABContactDisplay *display,
+ gboolean display_maps);
G_END_DECLS
diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c
index 7b94c85233..d910b339b4 100644
--- a/addressbook/gui/widgets/eab-gui-util.c
+++ b/addressbook/gui/widgets/eab-gui-util.c
@@ -374,7 +374,9 @@ struct ContactCopyProcess_ {
static void process_unref (ContactCopyProcess *process);
static void
-remove_contact_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+remove_contact_ready_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
EBookClient *book_client = E_BOOK_CLIENT (source_object);
ContactCopyProcess *process = user_data;
@@ -382,8 +384,10 @@ remove_contact_ready_cb (GObject *source_object, GAsyncResult *result, gpointer
e_book_client_remove_contact_by_uid_finish (book_client, result, &error);
- if (error) {
- g_debug ("%s: Remove contact by uid failed: %s", G_STRFUNC, error->message);
+ if (error != NULL) {
+ g_warning (
+ "%s: Remove contact by uid failed: %s",
+ G_STRFUNC, error->message);
g_error_free (error);
}
@@ -474,29 +478,33 @@ do_copy (gpointer data, gpointer user_data)
}
static void
-book_loaded_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+book_loaded_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
ESource *destination = E_SOURCE (source_object);
ContactCopyProcess *process = user_data;
EClient *client = NULL;
- EBookClient *book_client;
GError *error = NULL;
- if (!e_client_utils_open_new_finish (destination, result, &client, &error))
- client = NULL;
-
- book_client = client ? E_BOOK_CLIENT (client) : NULL;
+ e_client_utils_open_new_finish (destination, result, &client, &error);
- if (book_client != NULL) {
- g_warn_if_fail (error == NULL);
- process->destination = book_client;
- process->book_status = TRUE;
- g_slist_foreach (process->contacts, do_copy, process);
- } else if (error != NULL) {
- g_debug ("%s: Failed to open destination client: %s", G_STRFUNC, error->message);
+ if (error != NULL) {
+ g_warn_if_fail (client == NULL);
+ g_warning (
+ "%s: Failed to open destination client: %s",
+ G_STRFUNC, error->message);
g_error_free (error);
+ goto exit;
}
+ g_return_if_fail (E_IS_CLIENT (client));
+
+ process->destination = E_BOOK_CLIENT (client);
+ process->book_status = TRUE;
+ g_slist_foreach (process->contacts, do_copy, process);
+
+exit:
process_unref (process);
}