diff options
author | Chris Toshok <toshok@ximian.com> | 2001-03-18 06:30:06 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2001-03-18 06:30:06 +0800 |
commit | b16a04e98d4d6afd4507fcd8e9bf31358f1b6344 (patch) | |
tree | 712f5da2d44ad0655e4356eda3d2e3eed0628265 /addressbook/gui/widgets/e-addressbook-view.c | |
parent | c768305c2f2203cf1fb9262a9f22b5a5f2dafebb (diff) | |
download | gsoc2013-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/gui/widgets/e-addressbook-view.c')
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-view.c | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c index 1ecdec06f3..e22228023f 100644 --- a/addressbook/gui/widgets/e-addressbook-view.c +++ b/addressbook/gui/widgets/e-addressbook-view.c @@ -140,6 +140,7 @@ e_addressbook_view_init (EAddressbookView *eav) { eav->view_type = E_ADDRESSBOOK_VIEW_NONE; + eav->editable = FALSE; eav->book = NULL; eav->query = g_strdup("(contains \"x-evolution-any-field\" \"\")"); @@ -168,6 +169,16 @@ e_addressbook_view_new (void) } static void +book_writable_cb (EBook *book, gboolean writable, EAddressbookView *eav) +{ + eav->editable = writable; + if (eav->object) + gtk_object_set (GTK_OBJECT (eav->object), + "editable", eav->editable, + NULL); +} + +static void e_addressbook_view_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) { EAddressbookView *eav = E_ADDRESSBOOK_VIEW(object); @@ -180,13 +191,18 @@ e_addressbook_view_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) if (GTK_VALUE_OBJECT(*arg)) { eav->book = E_BOOK(GTK_VALUE_OBJECT(*arg)); gtk_object_ref(GTK_OBJECT(eav->book)); + gtk_signal_connect (GTK_OBJECT (eav->book), + "writable_status", + book_writable_cb, eav); } else eav->book = NULL; if (eav->object) gtk_object_set(GTK_OBJECT(eav->object), "book", eav->book, + "editable", eav->editable, NULL); + break; case ARG_QUERY: g_free(eav->query); @@ -391,12 +407,17 @@ editor_closed_cb (EContactEditor *ce, gpointer data) gtk_object_unref (GTK_OBJECT (ce)); } +typedef struct { + EAddressbookView *view; + ECard *card; +} CardAndView; + static void -supported_fields_cb (EBook *book, EBookStatus status, EList *fields, ECard *card) +supported_fields_cb (EBook *book, EBookStatus status, EList *fields, CardAndView *card_and_view) { EContactEditor *ce; - ce = e_contact_editor_new (card, FALSE, fields, FALSE); + ce = e_contact_editor_new (card_and_view->card, FALSE, fields, !card_and_view->view->editable); gtk_signal_connect (GTK_OBJECT (ce), "add_card", GTK_SIGNAL_FUNC (add_card_cb), book); @@ -407,7 +428,9 @@ supported_fields_cb (EBook *book, EBookStatus status, EList *fields, ECard *card gtk_signal_connect (GTK_OBJECT (ce), "editor_closed", GTK_SIGNAL_FUNC (editor_closed_cb), NULL); - gtk_object_unref(GTK_OBJECT(card)); + gtk_object_unref(GTK_OBJECT(card_and_view->card)); + + g_free (card_and_view); } static void @@ -417,14 +440,18 @@ table_double_click(ETableScrolled *table, gint row, EAddressbookView *view) EAddressbookModel *model = E_ADDRESSBOOK_MODEL(view->object); ECard *card = e_addressbook_model_get_card(model, row); EBook *book; - + CardAndView *card_and_view; + gtk_object_get(GTK_OBJECT(model), "book", &book, NULL); g_assert (E_IS_BOOK (book)); - e_book_get_supported_fields (book, (EBookFieldsCallback)supported_fields_cb, card); + card_and_view = g_new (CardAndView, 1); + card_and_view->card = card; + card_and_view->view = view; + e_book_get_supported_fields (book, (EBookFieldsCallback)supported_fields_cb, card_and_view); } } @@ -730,6 +757,7 @@ change_view_type (EAddressbookView *view, EAddressbookViewType view_type) gtk_object_set(view->object, "query", view->query, "book", view->book, + "editable", view->editable, NULL); } |