aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/component
diff options
context:
space:
mode:
authorHans Petter Jansson <hpj@ximian.com>2004-01-17 08:52:06 +0800
committerHans Petter <hansp@src.gnome.org>2004-01-17 08:52:06 +0800
commitfa20d6a1f4c0c792ceefa031922da750eb60c32e (patch)
tree16859d85dc3efa973fc9f233dd65ef43e0dd798a /addressbook/gui/component
parent661c8fe4978af68a06b3c67076606edc8de7a068 (diff)
downloadgsoc2013-evolution-fa20d6a1f4c0c792ceefa031922da750eb60c32e.tar
gsoc2013-evolution-fa20d6a1f4c0c792ceefa031922da750eb60c32e.tar.gz
gsoc2013-evolution-fa20d6a1f4c0c792ceefa031922da750eb60c32e.tar.bz2
gsoc2013-evolution-fa20d6a1f4c0c792ceefa031922da750eb60c32e.tar.lz
gsoc2013-evolution-fa20d6a1f4c0c792ceefa031922da750eb60c32e.tar.xz
gsoc2013-evolution-fa20d6a1f4c0c792ceefa031922da750eb60c32e.tar.zst
gsoc2013-evolution-fa20d6a1f4c0c792ceefa031922da750eb60c32e.zip
Don't run callback if the action was cancelled. (load_source_cb): Ditto.
2004-01-16 Hans Petter Jansson <hpj@ximian.com> * gui/component/addressbook.c (load_source_auth_cb): Don't run callback if the action was cancelled. (load_source_cb): Ditto. (addressbook_load_source): Return an ID for the load attempt. (addressbook_load_source_cancel): Implement, allows cancelling a load attempt. * gui/contact-editor/e-contact-editor.c (new_target_cb): Clear the values for in-progress load operation. Only unref new_book if it's non-NULL. (cancel_load): Implement. Cancels the load operation if one is in progress. (source_selected): Cancel any running load operation before starting a new one. Set up in-progress values. (e_contact_editor_init): Clear the in-progress values. (e_contact_editor_dispose): Cancel load operation. (e_contact_editor_set_property): If a new target book is set, cancel any conflicting load operation in progress. * gui/widgets/e-addressbook-view.c (set_paned_position): Remove debug output. (get_paned_position): Ditto. svn path=/trunk/; revision=24287
Diffstat (limited to 'addressbook/gui/component')
-rw-r--r--addressbook/gui/component/addressbook.c24
-rw-r--r--addressbook/gui/component/addressbook.h3
2 files changed, 25 insertions, 2 deletions
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index b317e46c12..1062e2632d 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -682,6 +682,7 @@ typedef struct {
EBookCallback cb;
ESource *source;
gpointer closure;
+ guint cancelled : 1;
} LoadSourceData;
static void
@@ -689,6 +690,11 @@ load_source_auth_cb (EBook *book, EBookStatus status, gpointer closure)
{
LoadSourceData *data = closure;
+ if (data->cancelled) {
+ g_free (data);
+ return;
+ }
+
if (status != E_BOOK_ERROR_OK) {
if (status == E_BOOK_ERROR_CANCELLED) {
/* the user clicked cancel in the password dialog */
@@ -805,6 +811,11 @@ load_source_cb (EBook *book, EBookStatus status, gpointer closure)
{
LoadSourceData *load_source_data = closure;
+ if (load_source_data->cancelled) {
+ g_free (load_source_data);
+ return;
+ }
+
if (status == E_BOOK_ERROR_OK && book != NULL) {
const gchar *auth;
@@ -825,7 +836,7 @@ load_source_cb (EBook *book, EBookStatus status, gpointer closure)
g_free (load_source_data);
}
-void
+guint
addressbook_load_source (EBook *book, ESource *source,
EBookCallback cb, gpointer closure)
{
@@ -834,8 +845,19 @@ addressbook_load_source (EBook *book, ESource *source,
load_source_data->cb = cb;
load_source_data->closure = closure;
load_source_data->source = g_object_ref (source);
+ load_source_data->cancelled = FALSE;
e_book_async_load_source (book, source, load_source_cb, load_source_data);
+
+ return GPOINTER_TO_UINT (load_source_data);
+}
+
+void
+addressbook_load_source_cancel (guint id)
+{
+ LoadSourceData *load_source_data = GUINT_TO_POINTER (id);
+
+ load_source_data->cancelled = TRUE;
}
void
diff --git a/addressbook/gui/component/addressbook.h b/addressbook/gui/component/addressbook.h
index 16395789e2..875752e0c3 100644
--- a/addressbook/gui/component/addressbook.h
+++ b/addressbook/gui/component/addressbook.h
@@ -12,7 +12,8 @@
#if 0
void addressbook_load_uri (EBook *book, const char *uri, EBookCallback cb, gpointer closure);
#endif
-void addressbook_load_source (EBook *book, ESource *source, EBookCallback cb, gpointer closure);
+guint addressbook_load_source (EBook *book, ESource *source, EBookCallback cb, gpointer closure);
+void addressbook_load_source_cancel (guint id);
void addressbook_load_default_book (EBookCallback open_response, gpointer closure);
void addressbook_show_load_error_dialog (GtkWidget *parent, ESource *source, EBookStatus status);