diff options
Diffstat (limited to 'addressbook/backend')
-rw-r--r-- | addressbook/backend/ebook/e-book-view-listener.c | 46 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-book-view-listener.h | 4 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-book-view.c | 28 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-book-view.h | 1 | ||||
-rw-r--r-- | addressbook/backend/idl/addressbook.idl | 1 | ||||
-rw-r--r-- | addressbook/backend/pas/pas-book-view.c | 18 | ||||
-rw-r--r-- | addressbook/backend/pas/pas-book-view.h | 33 |
7 files changed, 109 insertions, 22 deletions
diff --git a/addressbook/backend/ebook/e-book-view-listener.c b/addressbook/backend/ebook/e-book-view-listener.c index be871d65d7..cd1bdc6000 100644 --- a/addressbook/backend/ebook/e-book-view-listener.c +++ b/addressbook/backend/ebook/e-book-view-listener.c @@ -72,6 +72,7 @@ e_book_view_listener_queue_empty_event (EBookViewListener *listener, resp->op = op; resp->id = NULL; resp->cards = NULL; + resp->message = NULL; e_book_view_listener_queue_response (listener, resp); } @@ -89,6 +90,7 @@ e_book_view_listener_queue_id_event (EBookViewListener *listener, resp->op = op; resp->id = g_strdup (id); resp->cards = NULL; + resp->message = NULL; e_book_view_listener_queue_response (listener, resp); } @@ -107,6 +109,7 @@ e_book_view_listener_queue_sequence_event (EBookViewListener *listener, resp->op = op; resp->id = NULL; resp->cards = NULL; + resp->message = NULL; for ( i = 0; i < cards->_length; i++ ) { resp->cards = g_list_append(resp->cards, e_card_new(cards->_buffer[i])); @@ -115,6 +118,24 @@ e_book_view_listener_queue_sequence_event (EBookViewListener *listener, e_book_view_listener_queue_response (listener, resp); } +/* Status Message */ +static void +e_book_view_listener_queue_message_event (EBookViewListener *listener, + EBookViewListenerOperation op, + const char *message) +{ + EBookViewListenerResponse *resp; + + resp = g_new0 (EBookViewListenerResponse, 1); + + resp->op = op; + resp->id = NULL; + resp->cards = NULL; + resp->message = g_strdup(message); + + e_book_view_listener_queue_response (listener, resp); +} + static void impl_BookViewListener_signal_card_added (PortableServer_Servant servant, const Evolution_VCardList *cards, @@ -157,6 +178,16 @@ impl_BookViewListener_signal_sequence_complete (PortableServer_Servant servant, e_book_view_listener_queue_empty_event (listener, SequenceCompleteEvent); } +static void +impl_BookViewListener_signal_status_message (PortableServer_Servant servant, + const char *message, + CORBA_Environment *ev) +{ + EBookViewListener *listener = E_BOOK_VIEW_LISTENER (bonobo_object_from_servant (servant)); + + e_book_view_listener_queue_message_event (listener, StatusMessageEvent, message); +} + /** * e_book_view_listener_check_pending: * @listener: the #EBookViewListener @@ -288,12 +319,14 @@ e_book_view_listener_destroy (GtkObject *object) for (l = listener->priv->response_queue; l != NULL; l = l->next) { EBookViewListenerResponse *resp = l->data; - if (resp->id) - g_free(resp->id); - if (resp->cards) { - g_list_foreach(resp->cards, (GFunc) gtk_object_unref, NULL); - g_list_free(resp->cards); - } + + g_free(resp->id); + + g_list_foreach(resp->cards, (GFunc) gtk_object_unref, NULL); + g_list_free(resp->cards); + + g_free (resp->message); + g_free (resp); } g_list_free (listener->priv->response_queue); @@ -314,6 +347,7 @@ e_book_view_listener_get_epv (void) epv->signal_card_removed = impl_BookViewListener_signal_card_removed; epv->signal_card_added = impl_BookViewListener_signal_card_added; epv->signal_sequence_complete = impl_BookViewListener_signal_sequence_complete; + epv->signal_status_message = impl_BookViewListener_signal_status_message; return epv; } diff --git a/addressbook/backend/ebook/e-book-view-listener.h b/addressbook/backend/ebook/e-book-view-listener.h index 65e5f8eb5b..5a535a209a 100644 --- a/addressbook/backend/ebook/e-book-view-listener.h +++ b/addressbook/backend/ebook/e-book-view-listener.h @@ -42,6 +42,7 @@ typedef enum { CardRemovedEvent, CardModifiedEvent, SequenceCompleteEvent, + StatusMessageEvent, } EBookViewListenerOperation; typedef struct { @@ -52,6 +53,9 @@ typedef struct { /* For Card[Added|Modified]Event */ GList *cards; /* Of type ECard. */ + + /* For StatusMessageEvent */ + char *message; } EBookViewListenerResponse; diff --git a/addressbook/backend/ebook/e-book-view.c b/addressbook/backend/ebook/e-book-view.c index f00a2efb08..6e0379f2cc 100644 --- a/addressbook/backend/ebook/e-book-view.c +++ b/addressbook/backend/ebook/e-book-view.c @@ -32,6 +32,7 @@ enum { CARD_REMOVED, CARD_ADDED, SEQUENCE_COMPLETE, + STATUS_MESSAGE, LAST_SIGNAL }; @@ -76,6 +77,15 @@ e_book_view_do_complete_event (EBookView *book_view, gtk_signal_emit (GTK_OBJECT (book_view), e_book_view_signals [SEQUENCE_COMPLETE]); } +static void +e_book_view_do_status_message_event (EBookView *book_view, + EBookViewListenerResponse *resp) +{ + gtk_signal_emit (GTK_OBJECT (book_view), e_book_view_signals [STATUS_MESSAGE], + resp->message); + g_free(resp->message); +} + /* * Reading notices out of the EBookViewListener's queue. @@ -103,6 +113,9 @@ e_book_view_check_listener_queue (EBookViewListener *listener, EBookView *book_v case SequenceCompleteEvent: e_book_view_do_complete_event (book_view, resp); break; + case StatusMessageEvent: + e_book_view_do_status_message_event (book_view, resp); + break; default: g_error ("EBookView: Unknown operation %d in listener queue!\n", resp->op); @@ -267,9 +280,24 @@ e_book_view_class_init (EBookViewClass *klass) gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0); + e_book_view_signals [STATUS_MESSAGE] = + gtk_signal_new ("status_message", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (EBookViewClass, status_message), + gtk_marshal_NONE__STRING, + GTK_TYPE_NONE, 1, + GTK_TYPE_STRING); + gtk_object_class_add_signals (object_class, e_book_view_signals, LAST_SIGNAL); + klass->card_changed = NULL; + klass->card_added = NULL; + klass->card_removed = NULL; + klass->sequence_complete = NULL; + klass->status_message = NULL; + object_class->destroy = e_book_view_destroy; } diff --git a/addressbook/backend/ebook/e-book-view.h b/addressbook/backend/ebook/e-book-view.h index b8edc68018..bd64c9dbc7 100644 --- a/addressbook/backend/ebook/e-book-view.h +++ b/addressbook/backend/ebook/e-book-view.h @@ -37,6 +37,7 @@ struct _EBookViewClass { void (* card_removed) (EBookView *book_view, const char *id); void (* card_added) (EBookView *book_view, const GList *cards); void (* sequence_complete) (EBookView *book_view); + void (* status_message) (EBookView *book_view, const char *message); }; /* Creating a new addressbook. */ diff --git a/addressbook/backend/idl/addressbook.idl b/addressbook/backend/idl/addressbook.idl index bbdabd713d..e520621858 100644 --- a/addressbook/backend/idl/addressbook.idl +++ b/addressbook/backend/idl/addressbook.idl @@ -33,6 +33,7 @@ module Evolution { void signal_card_removed (in CardId id); void signal_card_changed (in VCardList cards); void signal_sequence_complete (); + void signal_status_message (in string message); }; interface BookView : Bonobo::Unknown { diff --git a/addressbook/backend/pas/pas-book-view.c b/addressbook/backend/pas/pas-book-view.c index 3bf35f439f..94babf6280 100644 --- a/addressbook/backend/pas/pas-book-view.c +++ b/addressbook/backend/pas/pas-book-view.c @@ -142,6 +142,24 @@ pas_book_view_notify_complete (PASBookView *book_view) CORBA_exception_free (&ev); } +void +pas_book_view_notify_status_message (PASBookView *book_view, + const char *message) +{ + CORBA_Environment ev; + + CORBA_exception_init (&ev); + + Evolution_BookViewListener_signal_status_message ( + book_view->priv->listener, message, &ev); + + if (ev._major != CORBA_NO_EXCEPTION) { + g_warning ("pas_book_view_notify_complete: Exception signaling BookViewListener!\n"); + } + + CORBA_exception_free (&ev); +} + static gboolean pas_book_view_construct (PASBookView *book_view, Evolution_BookViewListener listener) diff --git a/addressbook/backend/pas/pas-book-view.h b/addressbook/backend/pas/pas-book-view.h index b9cdbee876..df6aed5bbb 100644 --- a/addressbook/backend/pas/pas-book-view.h +++ b/addressbook/backend/pas/pas-book-view.h @@ -28,22 +28,23 @@ struct _PASBookView { struct _PASBookViewClass { BonoboObjectClass parent_class; }; - -PASBookView *pas_book_view_new (Evolution_BookViewListener listener); - -void pas_book_view_notify_change (PASBookView *book_view, - const GList *cards); -void pas_book_view_notify_change_1 (PASBookView *book_view, - const char *card); -void pas_book_view_notify_remove (PASBookView *book_view, - const char *id); -void pas_book_view_notify_add (PASBookView *book_view, - const GList *cards); -void pas_book_view_notify_add_1 (PASBookView *book_view, - const char *card); -void pas_book_view_notify_complete (PASBookView *book_view); - -GtkType pas_book_view_get_type (void); +PASBookView *pas_book_view_new (Evolution_BookViewListener listener); + +void pas_book_view_notify_change (PASBookView *book_view, + const GList *cards); +void pas_book_view_notify_change_1 (PASBookView *book_view, + const char *card); +void pas_book_view_notify_remove (PASBookView *book_view, + const char *id); +void pas_book_view_notify_add (PASBookView *book_view, + const GList *cards); +void pas_book_view_notify_add_1 (PASBookView *book_view, + const char *card); +void pas_book_view_notify_complete (PASBookView *book_view); +void pas_book_view_notify_status_message (PASBookView *book_view, + const char *message); + +GtkType pas_book_view_get_type (void); #define PAS_BOOK_VIEW_TYPE (pas_book_view_get_type ()) #define PAS_BOOK_VIEW(o) (GTK_CHECK_CAST ((o), PAS_BOOK_VIEW_TYPE, PASBookView)) |