aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-09-22 19:13:53 +0800
committerChris Lahey <clahey@src.gnome.org>2000-09-22 19:13:53 +0800
commitb2019f34096c075bedcc2f9db7ee94d493225768 (patch)
tree60117e19ac3be2357786d4fd6dec1b6454de9daa /addressbook/gui
parent0d39d588a7da56bca9c195615d765edd572b3a41 (diff)
downloadgsoc2013-evolution-b2019f34096c075bedcc2f9db7ee94d493225768.tar
gsoc2013-evolution-b2019f34096c075bedcc2f9db7ee94d493225768.tar.gz
gsoc2013-evolution-b2019f34096c075bedcc2f9db7ee94d493225768.tar.bz2
gsoc2013-evolution-b2019f34096c075bedcc2f9db7ee94d493225768.tar.lz
gsoc2013-evolution-b2019f34096c075bedcc2f9db7ee94d493225768.tar.xz
gsoc2013-evolution-b2019f34096c075bedcc2f9db7ee94d493225768.tar.zst
gsoc2013-evolution-b2019f34096c075bedcc2f9db7ee94d493225768.zip
Added evolution-addressbook-ldap.xml.
2000-09-22 Christopher James Lahey <clahey@helixcode.com> * ui/Makefile.am: Added evolution-addressbook-ldap.xml. * ui/evolution-addressbook-ldap.xml: New file. (A Variation on evolution-addressbook.xml) * ui/evolution-addressbook.xml: Added View All and Stop buttons. From addressbook/ChangeLog: 2000-09-22 Christopher James Lahey <clahey@helixcode.com> * backend/ebook/e-book.c, backend/ebook/e-book.h, backend/idl/addressbook.idl, backend/pas/pas-backend-file.c, backend/pas/pas-backend-ldap.c, backend/pas-backend.c, backend/pas/pas-backend.h, backend/pas/pas-book.c, backend/pas/pas-book.h: Added a function to query static capabilities (capabilities that can be reported immediately) and implemented them in the 2 servers. * gui/component/addressbook.c: Added a View All button and a Stop button. Sorted out the new directory server stuff a bit. * gui/widgets/e-addressbook-model.c, gui/widgets/e-addressbook-model.h: Cleaned up a bit. Added a stop function. Check for capabilities before deciding whether to load all cards when initially viewed. * gui/widgets/e-addressbook-view.c, gui/widgets/e-addressbook-view.h: Added stop and view all functions. * gui/widgets/e-minicard-view-widget.c, gui/widgets/e-minicard-view-widget.h, gui/widgets/e-minicard-view.c, gui/widgets/e-minicard-view.h: Added a stop function. Check for capabilities before deciding whether to load all cards when initially viewed. svn path=/trunk/; revision=5547
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/component/addressbook.c39
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.c63
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.h2
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c23
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.h2
-rw-r--r--addressbook/gui/widgets/e-minicard-view-widget.c6
-rw-r--r--addressbook/gui/widgets/e-minicard-view-widget.h1
-rw-r--r--addressbook/gui/widgets/e-minicard-view.c27
-rw-r--r--addressbook/gui/widgets/e-minicard-view.h3
9 files changed, 128 insertions, 38 deletions
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index 10a092cea1..a632c61ead 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -308,6 +308,20 @@ make_quick_search_widget (GtkSignalFunc start_search_func,
return search_vbox;
}
+static void
+show_all_contacts_cb (BonoboUIHandler *uih, void *user_data, const char *path)
+{
+ AddressbookView *view = (AddressbookView *) user_data;
+ e_addressbook_view_show_all(view->view);
+}
+
+static void
+stop_loading_cb (BonoboUIHandler *uih, void *user_data, const char *path)
+{
+ AddressbookView *view = (AddressbookView *) user_data;
+ e_addressbook_view_stop(view->view);
+}
+
BonoboUIVerb verbs [] = {
BONOBO_UI_VERB ("ContactsPrint", print_cb),
BONOBO_UI_VERB ("ViewAsTable", toggle_view_as_cb),
@@ -317,6 +331,11 @@ BonoboUIVerb verbs [] = {
BONOBO_UI_VERB ("ContactNew", new_contact_cb),
/* BONOBO_UI_VERB ("ContactFind", find_contact_cb),*/
BONOBO_UI_VERB ("ContactDelete", delete_contact_cb),
+ BONOBO_UI_VERB ("ContactViewAll", show_all_contacts_cb),
+ BONOBO_UI_VERB ("ContactStop", stop_loading_cb),
+#ifdef HAVE_LDAP
+ BONOBO_UI_VERB ("ContactNewServer", new_server_cb),
+#endif
BONOBO_UI_VERB_END
};
@@ -337,19 +356,6 @@ control_activate (BonoboControl *control, BonoboUIHandler *uih,
bonobo_ui_handler_set_container (uih, remote_uih);
bonobo_object_release_unref (remote_uih, NULL);
-
-#warning FIXME; this needs to be sorted.
-#if 0
-#ifdef HAVE_LDAP
- bonobo_ui_handler_menu_new_item (uih, "/Actions/New Directory Server",
- N_("N_ew Directory Server"),
- NULL, -1,
- BONOBO_UI_HANDLER_PIXMAP_NONE, NULL,
- 0, 0, new_server_cb,
- (gpointer)view);
-#endif
-#endif
-
component = bonobo_ui_compat_get_component (uih);
bonobo_ui_component_add_verb_list_with_data (
@@ -360,12 +366,17 @@ control_activate (BonoboControl *control, BonoboUIHandler *uih,
bonobo_ui_container_freeze (container, NULL);
+#ifdef HAVE_LDAP
+ fname = bonobo_ui_util_get_ui_fname (
+ EVOLUTION_DATADIR, "evolution-addressbook-ldap.xml");
+#else
fname = bonobo_ui_util_get_ui_fname (
EVOLUTION_DATADIR, "evolution-addressbook.xml");
+#endif
g_warning ("Attempting ui load from '%s'", fname);
ui = bonobo_ui_util_new_ui (component, fname, "evolution-addressbook");
-
+
bonobo_ui_component_set_tree (component, container, "/", ui, NULL);
g_free (fname);
diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c
index 9df7ab7225..830b70879c 100644
--- a/addressbook/gui/widgets/e-addressbook-model.c
+++ b/addressbook/gui/widgets/e-addressbook-model.c
@@ -33,13 +33,8 @@ enum {
};
static void
-addressbook_destroy(GtkObject *object)
+remove_book_view(EAddressbookModel *model)
{
- EAddressbookModel *model = E_ADDRESSBOOK_MODEL(object);
- int i;
-
- if (model->get_view_idle)
- g_source_remove(model->get_view_idle);
if (model->book_view && model->create_card_id)
gtk_signal_disconnect(GTK_OBJECT (model->book_view),
model->create_card_id);
@@ -49,11 +44,31 @@ addressbook_destroy(GtkObject *object)
if (model->book_view && model->modify_card_id)
gtk_signal_disconnect(GTK_OBJECT (model->book_view),
model->modify_card_id);
- if (model->book)
- gtk_object_unref(GTK_OBJECT(model->book));
+
+ model->create_card_id = 0;
+ model->remove_card_id = 0;
+ model->modify_card_id = 0;
+
if (model->book_view)
gtk_object_unref(GTK_OBJECT(model->book_view));
+ model->book_view = NULL;
+}
+
+static void
+addressbook_destroy(GtkObject *object)
+{
+ EAddressbookModel *model = E_ADDRESSBOOK_MODEL(object);
+ int i;
+
+ if (model->get_view_idle)
+ g_source_remove(model->get_view_idle);
+
+ remove_book_view(model);
+
+ if (model->book)
+ gtk_object_unref(GTK_OBJECT(model->book));
+
for ( i = 0; i < model->data_count; i++ ) {
gtk_object_unref(GTK_OBJECT(model->data[i]));
}
@@ -265,6 +280,7 @@ e_addressbook_model_init (GtkObject *object)
model->data = NULL;
model->data_count = 0;
model->editable = TRUE;
+ model->first_get_view = TRUE;
}
static void
@@ -272,17 +288,7 @@ book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, gpointe
{
EAddressbookModel *model = closure;
int i;
- if (model->book_view && model->create_card_id)
- gtk_signal_disconnect(GTK_OBJECT (model->book_view),
- model->create_card_id);
- if (model->book_view && model->remove_card_id)
- gtk_signal_disconnect(GTK_OBJECT (model->book_view),
- model->remove_card_id);
- if (model->book_view && model->modify_card_id)
- gtk_signal_disconnect(GTK_OBJECT (model->book_view),
- model->modify_card_id);
- if (model->book_view)
- gtk_object_unref(GTK_OBJECT(model->book_view));
+ remove_book_view(model);
model->book_view = book_view;
if (model->book_view)
gtk_object_ref(GTK_OBJECT(model->book_view));
@@ -313,8 +319,18 @@ book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, gpointe
static gboolean
get_view(EAddressbookModel *model)
{
- if (model->book && model->query)
- e_book_get_book_view(model->book, model->query, book_view_loaded, model);
+ if (model->book && model->query) {
+ if (model->first_get_view) {
+ char *capabilities;
+ capabilities = e_book_get_static_capabilities(model->book);
+ if (strstr(capabilities, "local")) {
+ e_book_get_book_view(model->book, model->query, book_view_loaded, model);
+ }
+ model->first_get_view = FALSE;
+ }
+ else
+ e_book_get_book_view(model->book, model->query, book_view_loaded, model);
+ }
model->get_view_idle = 0;
return FALSE;
@@ -421,3 +437,8 @@ e_addressbook_model_new (void)
return E_TABLE_MODEL(et);
}
+
+void e_addressbook_model_stop (EAddressbookModel *model)
+{
+ remove_book_view(model);
+}
diff --git a/addressbook/gui/widgets/e-addressbook-model.h b/addressbook/gui/widgets/e-addressbook-model.h
index 0bde425a25..860fb641ac 100644
--- a/addressbook/gui/widgets/e-addressbook-model.h
+++ b/addressbook/gui/widgets/e-addressbook-model.h
@@ -36,6 +36,7 @@ typedef struct {
int create_card_id, remove_card_id, modify_card_id;
guint editable : 1;
+ guint first_get_view : 1;
} EAddressbookModel;
@@ -50,5 +51,6 @@ ETableModel *e_addressbook_model_new (void);
/* Returns object with ref count of 1. */
ECard *e_addressbook_model_get_card(EAddressbookModel *model,
int row);
+void e_addressbook_model_stop (EAddressbookModel *model);
#endif /* _E_ADDRESSBOOK_MODEL_H_ */
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index 1700cfdc89..bd229fad25 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -709,3 +709,26 @@ e_addressbook_view_delete_selection(EAddressbookView *view)
if (view->view_type == E_ADDRESSBOOK_VIEW_MINICARD)
e_minicard_view_widget_remove_selection (E_MINICARD_VIEW_WIDGET(view->object), card_deleted_cb, NULL);
}
+
+void
+e_addressbook_view_show_all(EAddressbookView *view)
+{
+ gtk_object_set(GTK_OBJECT(view),
+ "query", NULL,
+ NULL);
+}
+
+void
+e_addressbook_view_stop(EAddressbookView *view)
+{
+ switch(view->view_type) {
+ case E_ADDRESSBOOK_VIEW_MINICARD:
+ e_minicard_view_widget_stop(E_MINICARD_VIEW_WIDGET (view->object));
+ break;
+ case E_ADDRESSBOOK_VIEW_TABLE:
+ e_addressbook_model_stop(E_ADDRESSBOOK_MODEL (view->object));
+ break;
+ case E_ADDRESSBOOK_VIEW_NONE:
+ break;
+ }
+}
diff --git a/addressbook/gui/widgets/e-addressbook-view.h b/addressbook/gui/widgets/e-addressbook-view.h
index 0509e897e6..60da283a75 100644
--- a/addressbook/gui/widgets/e-addressbook-view.h
+++ b/addressbook/gui/widgets/e-addressbook-view.h
@@ -79,6 +79,8 @@ GtkType e_addressbook_view_get_type (void);
void e_addressbook_view_print (EAddressbookView *view);
void e_addressbook_view_delete_selection (EAddressbookView *view);
+void e_addressbook_view_show_all (EAddressbookView *view);
+void e_addressbook_view_stop (EAddressbookView *view);
#ifdef __cplusplus
}
diff --git a/addressbook/gui/widgets/e-minicard-view-widget.c b/addressbook/gui/widgets/e-minicard-view-widget.c
index f23d3e4476..c6809bf1d0 100644
--- a/addressbook/gui/widgets/e-minicard-view-widget.c
+++ b/addressbook/gui/widgets/e-minicard-view-widget.c
@@ -268,3 +268,9 @@ void e_minicard_view_widget_jump_to_letter (EMinicardViewWidget *view,
if (view->emv)
e_minicard_view_jump_to_letter(E_MINICARD_VIEW(view->emv), letter);
}
+
+void
+e_minicard_view_widget_stop(EMinicardViewWidget *view)
+{
+ e_minicard_view_stop(E_MINICARD_VIEW(view->emv));
+}
diff --git a/addressbook/gui/widgets/e-minicard-view-widget.h b/addressbook/gui/widgets/e-minicard-view-widget.h
index 952e60ee65..cf20c9a4df 100644
--- a/addressbook/gui/widgets/e-minicard-view-widget.h
+++ b/addressbook/gui/widgets/e-minicard-view-widget.h
@@ -63,6 +63,7 @@ void e_minicard_view_widget_remove_selection (EMinicardViewWidget *view,
gpointer closure);
void e_minicard_view_widget_jump_to_letter (EMinicardViewWidget *view,
char letter);
+void e_minicard_view_widget_stop (EMinicardViewWidget *view);
GtkWidget *e_minicard_view_widget_new (void);
diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c
index 249c987802..7169e41542 100644
--- a/addressbook/gui/widgets/e-minicard-view.c
+++ b/addressbook/gui/widgets/e-minicard-view.c
@@ -105,6 +105,7 @@ e_minicard_view_init (EMinicardView *view)
view->remove_card_id = 0;
view->modify_card_id = 0;
view->canvas_destroy_id = 0;
+ view->first_get_view = TRUE;
gtk_object_set(GTK_OBJECT(view),
"empty_message", _("\n\nThere are no items to show in this view\n\n"
@@ -191,8 +192,18 @@ book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, gpointe
static gboolean
get_view(EMinicardView *view)
{
- if (view->book && view->query)
- e_book_get_book_view(view->book, view->query, book_view_loaded, view);
+ if (view->book && view->query) {
+ if (view->first_get_view) {
+ char *capabilities;
+ capabilities = e_book_get_static_capabilities(view->book);
+ if (strstr(capabilities, "local")) {
+ e_book_get_book_view(view->book, view->query, book_view_loaded, view);
+ }
+ view->first_get_view = FALSE;
+ }
+ else
+ e_book_get_book_view(view->book, view->query, book_view_loaded, view);
+ }
view->get_view_idle = 0;
return FALSE;
@@ -423,10 +434,20 @@ compare_to_letter(EMinicard *card, char *letter)
}
}
-void e_minicard_view_jump_to_letter (EMinicardView *view,
+void
+e_minicard_view_jump_to_letter (EMinicardView *view,
char letter)
{
e_reflow_sorted_jump(E_REFLOW_SORTED(view),
(GCompareFunc) compare_to_letter,
&letter);
}
+
+void
+e_minicard_view_stop (EMinicardView *view)
+{
+ disconnect_signals(view);
+ if (view->book_view)
+ gtk_object_unref(GTK_OBJECT(view->book_view));
+ view->book_view = NULL;
+}
diff --git a/addressbook/gui/widgets/e-minicard-view.h b/addressbook/gui/widgets/e-minicard-view.h
index f12f0d43cf..e4c1be870a 100644
--- a/addressbook/gui/widgets/e-minicard-view.h
+++ b/addressbook/gui/widgets/e-minicard-view.h
@@ -73,6 +73,8 @@ struct _EMinicardView
int canvas_destroy_id;
int create_card_id, remove_card_id, modify_card_id;
+
+ guint first_get_view : 1;
};
struct _EMinicardViewClass
@@ -86,6 +88,7 @@ void e_minicard_view_remove_selection (EMinicardView *view,
gpointer closure);
void e_minicard_view_jump_to_letter (EMinicardView *view,
char letter);
+void e_minicard_view_stop (EMinicardView *view);
#ifdef __cplusplus
}