aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend/ebook
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2001-03-18 06:30:06 +0800
committerChris Toshok <toshok@src.gnome.org>2001-03-18 06:30:06 +0800
commitb16a04e98d4d6afd4507fcd8e9bf31358f1b6344 (patch)
tree712f5da2d44ad0655e4356eda3d2e3eed0628265 /addressbook/backend/ebook
parentc768305c2f2203cf1fb9262a9f22b5a5f2dafebb (diff)
downloadgsoc2013-evolution-b16a04e98d4d6afd4507fcd8e9bf31358f1b6344.tar
gsoc2013-evolution-b16a04e98d4d6afd4507fcd8e9bf31358f1b6344.tar.gz
gsoc2013-evolution-b16a04e98d4d6afd4507fcd8e9bf31358f1b6344.tar.bz2
gsoc2013-evolution-b16a04e98d4d6afd4507fcd8e9bf31358f1b6344.tar.lz
gsoc2013-evolution-b16a04e98d4d6afd4507fcd8e9bf31358f1b6344.tar.xz
gsoc2013-evolution-b16a04e98d4d6afd4507fcd8e9bf31358f1b6344.tar.zst
gsoc2013-evolution-b16a04e98d4d6afd4507fcd8e9bf31358f1b6344.zip
new function. (impl_BookListener_report_writable): new function.
2001-03-17 Chris Toshok <toshok@ximian.com> * backend/ebook/e-book-listener.c (e_book_listener_queue_writable_status): new function. (impl_BookListener_report_writable): new function. (e_book_listener_get_epv): fill in epv->notifyWritable. * backend/ebook/e-book-listener.h: add writable status entries. * backend/ebook/e-book.c (e_book_do_writable_event): new function. (e_book_check_listener_queue): add WritableStatusEvent to the switch. (e_book_class_init): register writable_status signal. * backend/ebook/e-book.h: add writable_status signal. * backend/idl/addressbook.idl: add notifyWritable method to BookListener. * gui/widgets/e-minicard.c (e_minicard_class_init): add "editable" arg. (e_minicard_init): init editable. (e_minicard_set_arg): loop over the minicard fields setting their "editable". (e_minicard_get_arg): add editable. (supported_fields_cb): use editable when creating the contact_editor. (add_field): set "editable" when creatin the e_minicard. * gui/widgets/e-minicard.h (struct _EMinicard): add "editable". * gui/widgets/e-minicard-view.c (e_minicard_view_class_init): add editable arg. (e_minicard_view_init): init editable. (create_card): pass editable to e_minicard canvas item. (e_minicard_view_set_arg): bit of a hack - loop over all the canvas items setting their "editable." (e_minicard_view_get_arg): add editable. (supported_fields_cb): use editable when creating the contact editor. * gui/widgets/e-minicard-view.h (struct _EMinicardView): add "editable." * gui/widgets/e-minicard-view-widget.c (e_minicard_view_widget_class_init): add "editable" field. (e_minicard_view_widget_init): init editable to FALSE. (e_minicard_view_widget_set_arg): save editable, and pass it along the e-minicard-view. (e_minicard_view_widget_realize): same. (e_minicard_view_widget_get_arg): add editable. * gui/widgets/e-minicard-view-widget.h (struct _EMinicardViewWidget): add "editable" field. * gui/widgets/e-minicard-label.h (struct _EMinicardLabel): add "editable" field. * gui/widgets/e-minicard-label.c (e_minicard_label_class_init): add "editable" arg. (e_minicard_label_set_arg): editable, set it on the e_text too. (e_minicard_label_get_arg): editable. (e_minicard_label_construct): set the "editable" field when we create the e_text cavas item * gui/widgets/e-addressbook-view.c (e_addressbook_view_init): default editable to FALSE. (book_writable_cb): new function, set our editable field and gtk_object_set it on the active view. (e_addressbook_view_set_arg): set the active view's editable when we set the view's book, and connect the "writable_status" signal to book_writable_cb. (change_view_type): same. (supported_fields_cb): use our "editable" when creating the contact editor. * gui/widgets/e-addressbook-view.h (struct _EAddressbookView): add editable field. * gui/widgets/e-addressbook-model.c (e_addressbook_model_init): change the default of editable to FALSE. * backend/pas/pas-book.c (pas_book_report_writable): new function. * backend/pas/pas-book.h: prototype for pas_book_report_writable. * backend/pas/pas-backend-file.c (pas_backend_file_load_uri): if we open the file O_RDWR (or create it) report it as writable. if we can't open it as O_RDWR, try opening it read-only before we attempt to create it. * backend/pas/pas-backend-ldap.c (pas_backend_ldap_process_authenticate_user): if we authenticate successfully, grant write permissions (this is lacking but there's really nothing we can do to determine the extent of the access afforded a user.) svn path=/trunk/; revision=8787
Diffstat (limited to 'addressbook/backend/ebook')
-rw-r--r--addressbook/backend/ebook/e-book-listener.c25
-rw-r--r--addressbook/backend/ebook/e-book-listener.h4
-rw-r--r--addressbook/backend/ebook/e-book.c21
-rw-r--r--addressbook/backend/ebook/e-book.h5
4 files changed, 53 insertions, 2 deletions
diff --git a/addressbook/backend/ebook/e-book-listener.c b/addressbook/backend/ebook/e-book-listener.c
index 0aaf5483a5..e1d47d70d2 100644
--- a/addressbook/backend/ebook/e-book-listener.c
+++ b/addressbook/backend/ebook/e-book-listener.c
@@ -188,6 +188,20 @@ e_book_listener_queue_link_status (EBookListener *listener,
}
static void
+e_book_listener_queue_writable_status (EBookListener *listener,
+ gboolean writable)
+{
+ EBookListenerResponse *resp;
+
+ resp = g_new0 (EBookListenerResponse, 1);
+
+ resp->op = WritableStatusEvent;
+ resp->writable = writable;
+
+ e_book_listener_queue_response (listener, resp);
+}
+
+static void
e_book_listener_queue_authentication_response (EBookListener *listener,
EBookStatus status)
{
@@ -394,6 +408,16 @@ impl_BookListener_report_connection_status (PortableServer_Servant servant,
listener, connected);
}
+static void
+impl_BookListener_report_writable (PortableServer_Servant servant,
+ const CORBA_boolean writable,
+ CORBA_Environment *ev)
+{
+ EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant));
+
+ e_book_listener_queue_writable_status (listener, writable);
+}
+
/**
* e_book_listener_check_pending:
* @listener: the #EBookListener
@@ -627,6 +651,7 @@ e_book_listener_get_epv (void)
epv->notifyChangesRequested = impl_BookListener_respond_get_changes;
epv->notifyConnectionStatus = impl_BookListener_report_connection_status;
+ epv->notifyWritable = impl_BookListener_report_writable;
return epv;
}
diff --git a/addressbook/backend/ebook/e-book-listener.h b/addressbook/backend/ebook/e-book-listener.h
index 0390f7fcb2..84cdfecced 100644
--- a/addressbook/backend/ebook/e-book-listener.h
+++ b/addressbook/backend/ebook/e-book-listener.h
@@ -52,6 +52,7 @@ typedef enum {
/* Async events */
LinkStatusEvent,
+ WritableStatusEvent,
OpenProgressEvent,
} EBookListenerOperation;
@@ -80,6 +81,9 @@ typedef struct {
/* For LinkStatusEvent */
gboolean connected;
+ /* For WritableStatusEvent */
+ gboolean writable;
+
/* For Card[Added|Removed|Modified]Event */
char *id;
} EBookListenerResponse;
diff --git a/addressbook/backend/ebook/e-book.c b/addressbook/backend/ebook/e-book.c
index 2a02b78fbf..25fb42a37b 100644
--- a/addressbook/backend/ebook/e-book.c
+++ b/addressbook/backend/ebook/e-book.c
@@ -50,6 +50,7 @@ struct _EBookPrivate {
enum {
OPEN_PROGRESS,
+ WRITABLE_STATUS,
LINK_STATUS,
LAST_SIGNAL
};
@@ -336,6 +337,14 @@ e_book_do_link_event (EBook *book,
}
static void
+e_book_do_writable_event (EBook *book,
+ EBookListenerResponse *resp)
+{
+ gtk_signal_emit (GTK_OBJECT (book), e_book_signals [WRITABLE_STATUS],
+ resp->writable);
+}
+
+static void
e_book_do_response_get_supported_fields (EBook *book,
EBookListenerResponse *resp)
{
@@ -398,6 +407,9 @@ e_book_check_listener_queue (EBookListener *listener, EBook *book)
case LinkStatusEvent:
e_book_do_link_event (book, resp);
break;
+ case WritableStatusEvent:
+ e_book_do_writable_event (book, resp);
+ break;
default:
g_error ("EBook: Unknown operation %d in listener queue!\n",
resp->op);
@@ -1184,6 +1196,15 @@ e_book_class_init (EBookClass *klass)
GTK_TYPE_NONE, 1,
GTK_TYPE_BOOL);
+ e_book_signals [WRITABLE_STATUS] =
+ gtk_signal_new ("writable_status",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EBookClass, writable_status),
+ gtk_marshal_NONE__BOOL,
+ GTK_TYPE_NONE, 1,
+ GTK_TYPE_BOOL);
+
gtk_object_class_add_signals (object_class, e_book_signals,
LAST_SIGNAL);
diff --git a/addressbook/backend/ebook/e-book.h b/addressbook/backend/ebook/e-book.h
index 0713bc6bdb..9e25c9d9a5 100644
--- a/addressbook/backend/ebook/e-book.h
+++ b/addressbook/backend/ebook/e-book.h
@@ -35,8 +35,9 @@ struct _EBookClass {
/*
* Signals.
*/
- void (* open_progress) (EBook *book, const char *msg, short percent);
- void (* link_status) (EBook *book, gboolean connected);
+ void (* open_progress) (EBook *book, const char *msg, short percent);
+ void (* link_status) (EBook *book, gboolean connected);
+ void (* writable_status) (EBook *book, gboolean writable);
};
/* Callbacks for asynchronous functions. */