aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-08-02 14:25:50 +0800
committerChris Lahey <clahey@src.gnome.org>2001-08-02 14:25:50 +0800
commit18b20048a2813ef487b3dbb08343d1b84991a30e (patch)
tree0cdbb80085d6940d4859350bb7575e8e97470929
parent77316d782f31a8c321dbe8ccb9220c0a85f7fc47 (diff)
downloadgsoc2013-evolution-18b20048a2813ef487b3dbb08343d1b84991a30e.tar
gsoc2013-evolution-18b20048a2813ef487b3dbb08343d1b84991a30e.tar.gz
gsoc2013-evolution-18b20048a2813ef487b3dbb08343d1b84991a30e.tar.bz2
gsoc2013-evolution-18b20048a2813ef487b3dbb08343d1b84991a30e.tar.lz
gsoc2013-evolution-18b20048a2813ef487b3dbb08343d1b84991a30e.tar.xz
gsoc2013-evolution-18b20048a2813ef487b3dbb08343d1b84991a30e.tar.zst
gsoc2013-evolution-18b20048a2813ef487b3dbb08343d1b84991a30e.zip
Added ContactsSaveAsVCard, ContactsSendContactToOther, and
2001-08-02 Christopher James Lahey <clahey@ximian.com> * gui/component/addressbook.c: Added ContactsSaveAsVCard, ContactsSendContactToOther, and ContactsSendMessageToContact verbs here. * gui/widgets/e-addressbook-view.c (e_addressbook_view_save_as, e_addressbook_view_send, e_addressbook_view_send_to): New functions to allow outside users to cause the addressbook to save, send, or send a message to its selection. svn path=/trunk/; revision=11567
-rw-r--r--addressbook/ChangeLog11
-rw-r--r--addressbook/gui/component/addressbook.c40
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c86
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.h6
4 files changed, 114 insertions, 29 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 97f6ad92b3..2f59d74ee1 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,14 @@
+2001-08-02 Christopher James Lahey <clahey@ximian.com>
+
+ * gui/component/addressbook.c: Added ContactsSaveAsVCard,
+ ContactsSendContactToOther, and ContactsSendMessageToContact verbs
+ here.
+
+ * gui/widgets/e-addressbook-view.c (e_addressbook_view_save_as,
+ e_addressbook_view_send, e_addressbook_view_send_to): New
+ functions to allow outside users to cause the addressbook to save,
+ send, or send a message to its selection.
+
2001-08-01 Christopher James Lahey <clahey@ximian.com>
* contact-editor/.cvsignore: Removed this file from this unused
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index cb52b6fd5d..9337bfd601 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -83,6 +83,13 @@ new_contact_list_cb (BonoboUIComponent *uih, void *user_data, const char *path)
}
static void
+save_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path)
+{
+ AddressbookView *view = (AddressbookView *) user_data;
+ e_addressbook_view_save_as(view->view);
+}
+
+static void
config_cb (BonoboUIComponent *uih, void *user_data, const char *path)
{
addressbook_config (NULL /* XXX */);
@@ -152,6 +159,20 @@ select_all_contacts_cb (BonoboUIComponent *uih, void *user_data, const char *pat
}
static void
+send_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path)
+{
+ AddressbookView *view = (AddressbookView *) user_data;
+ e_addressbook_view_send(view->view);
+}
+
+static void
+send_contact_to_cb (BonoboUIComponent *uih, void *user_data, const char *path)
+{
+ AddressbookView *view = (AddressbookView *) user_data;
+ e_addressbook_view_send_to(view->view);
+}
+
+static void
update_command_state (EAddressbookView *eav, AddressbookView *view)
{
BonoboUIComponent *uic = bonobo_control_get_ui_component (view->control);
@@ -166,6 +187,11 @@ update_command_state (EAddressbookView *eav, AddressbookView *view)
"sensitive",
e_addressbook_view_can_create (view->view) ? "1" : "0", NULL);
+ bonobo_ui_component_set_prop (uic,
+ "/commands/ContactsSaveAsVCard",
+ "sensitive",
+ e_addressbook_view_can_save_as (view->view) ? "1" : "0", NULL);
+
/* Print Contact */
bonobo_ui_component_set_prop (uic,
"/commands/ContactsPrint",
@@ -195,6 +221,16 @@ update_command_state (EAddressbookView *eav, AddressbookView *view)
"sensitive",
e_addressbook_view_can_select_all (view->view) ? "1" : "0", NULL);
+ bonobo_ui_component_set_prop (uic,
+ "/commands/ContactsSendContactToOther",
+ "sensitive",
+ e_addressbook_view_can_send (view->view) ? "1" : "0", NULL);
+
+ bonobo_ui_component_set_prop (uic,
+ "/commands/ContactsSendMessageToContact",
+ "sensitive",
+ e_addressbook_view_can_send_to (view->view) ? "1" : "0", NULL);
+
/* Stop */
bonobo_ui_component_set_prop (uic,
@@ -211,6 +247,7 @@ change_view_type (AddressbookView *view, EAddressbookViewType view_type)
BonoboUIVerb verbs [] = {
BONOBO_UI_UNSAFE_VERB ("ContactsPrint", print_cb),
+ BONOBO_UI_UNSAFE_VERB ("ContactsSaveAsVCard", save_contact_cb),
BONOBO_UI_UNSAFE_VERB ("ToolSearch", search_cb),
BONOBO_UI_UNSAFE_VERB ("AddressbookConfig", config_cb),
@@ -224,6 +261,9 @@ BonoboUIVerb verbs [] = {
BONOBO_UI_UNSAFE_VERB ("ContactsCopy", copy_contacts_cb),
BONOBO_UI_UNSAFE_VERB ("ContactsPaste", paste_contacts_cb),
BONOBO_UI_UNSAFE_VERB ("ContactsSelectAll", select_all_contacts_cb),
+
+ BONOBO_UI_UNSAFE_VERB ("ContactsSendContactToOther", send_contact_cb),
+ BONOBO_UI_UNSAFE_VERB ("ContactsSendMessageToContact", send_contact_to_cb),
BONOBO_UI_VERB_END
};
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index 4f39360045..05374e26fa 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -1206,6 +1206,33 @@ get_selected_cards (EAddressbookView *view)
}
void
+e_addressbook_view_save_as (EAddressbookView *view)
+{
+ GList *list = get_selected_cards (view);
+ if (list)
+ e_contact_list_save_as (_("Save as VCard"), list);
+ g_list_free (list);
+}
+
+void
+e_addressbook_view_send (EAddressbookView *view)
+{
+ GList *list = get_selected_cards (view);
+ if (list)
+ e_card_list_send (list, E_CARD_DISPOSITION_AS_ATTACHMENT);
+ g_list_free (list);
+}
+
+void
+e_addressbook_view_send_to (EAddressbookView *view)
+{
+ GList *list = get_selected_cards (view);
+ if (list)
+ e_card_list_send (list, E_CARD_DISPOSITION_AS_TO);
+ g_list_free (list);
+}
+
+void
e_addressbook_view_cut (EAddressbookView *view)
{
e_addressbook_view_copy (view);
@@ -1252,6 +1279,18 @@ e_addressbook_view_stop(EAddressbookView *view)
e_addressbook_model_stop (view->model);
}
+static gboolean
+e_addressbook_view_selection_nonempty (EAddressbookView *view)
+{
+ ESelectionModel *selection_model;
+
+ selection_model = get_selection_model (view);
+ if (selection_model == NULL)
+ return FALSE;
+
+ return e_selection_model_selected_count (selection_model) != 0;
+}
+
gboolean
e_addressbook_view_can_create (EAddressbookView *view)
{
@@ -1261,58 +1300,47 @@ e_addressbook_view_can_create (EAddressbookView *view)
gboolean
e_addressbook_view_can_print (EAddressbookView *view)
{
- ESelectionModel *selection_model;
+ return e_addressbook_view_selection_nonempty (view);
+}
- if (!e_addressbook_model_editable (view->model))
- return FALSE;
+gboolean
+e_addressbook_view_can_save_as (EAddressbookView *view)
+{
+ return e_addressbook_view_selection_nonempty (view);
+}
- selection_model = get_selection_model (view);
- if (selection_model == NULL)
- return FALSE;
+gboolean e_addressbook_view_can_send (EAddressbookView *view)
+{
+ return e_addressbook_view_selection_nonempty (view);
+}
- return e_selection_model_selected_count (selection_model) != 0;
+gboolean e_addressbook_view_can_send_to (EAddressbookView *view)
+{
+ return e_addressbook_view_selection_nonempty (view);
}
gboolean
e_addressbook_view_can_delete (EAddressbookView *view)
{
- ESelectionModel *selection_model;
-
- if (!e_addressbook_model_editable (view->model))
- return FALSE;
-
- selection_model = get_selection_model (view);
- if (selection_model == NULL)
- return FALSE;
-
- return e_selection_model_selected_count (selection_model) != 0;
+ return e_addressbook_view_selection_nonempty (view) && e_addressbook_model_editable (view->model);
}
gboolean
e_addressbook_view_can_cut (EAddressbookView *view)
{
- return (e_addressbook_view_can_copy (view) && e_addressbook_model_editable (view->model));
+ return e_addressbook_view_selection_nonempty (view) && e_addressbook_model_editable (view->model);
}
gboolean
e_addressbook_view_can_copy (EAddressbookView *view)
{
- ESelectionModel *selection_model;
-
- if (!e_addressbook_model_editable (view->model))
- return FALSE;
-
- selection_model = get_selection_model (view);
- if (selection_model == NULL)
- return FALSE;
-
- return e_selection_model_selected_count (selection_model) != 0;
+ return e_addressbook_view_selection_nonempty (view);
}
gboolean
e_addressbook_view_can_paste (EAddressbookView *view)
{
- return TRUE;
+ return e_addressbook_model_editable (view->model);
}
gboolean
diff --git a/addressbook/gui/widgets/e-addressbook-view.h b/addressbook/gui/widgets/e-addressbook-view.h
index 0a594842d8..8fc807572a 100644
--- a/addressbook/gui/widgets/e-addressbook-view.h
+++ b/addressbook/gui/widgets/e-addressbook-view.h
@@ -101,6 +101,9 @@ void e_addressbook_view_setup_menus (EAddressbookView *view,
BonoboUIComponent *uic);
void e_addressbook_view_discard_menus (EAddressbookView *view);
+void e_addressbook_view_save_as (EAddressbookView *view);
+void e_addressbook_view_send (EAddressbookView *view);
+void e_addressbook_view_send_to (EAddressbookView *view);
void e_addressbook_view_print (EAddressbookView *view);
void e_addressbook_view_delete_selection (EAddressbookView *view);
void e_addressbook_view_cut (EAddressbookView *view);
@@ -112,6 +115,9 @@ void e_addressbook_view_stop (EAddressbookView *view);
gboolean e_addressbook_view_can_create (EAddressbookView *view);
gboolean e_addressbook_view_can_print (EAddressbookView *view);
+gboolean e_addressbook_view_can_save_as (EAddressbookView *view);
+gboolean e_addressbook_view_can_send (EAddressbookView *view);
+gboolean e_addressbook_view_can_send_to (EAddressbookView *view);
gboolean e_addressbook_view_can_delete (EAddressbookView *view);
gboolean e_addressbook_view_can_cut (EAddressbookView *view);
gboolean e_addressbook_view_can_copy (EAddressbookView *view);