aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/component/addressbook.c
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2001-05-30 16:47:00 +0800
committerChris Toshok <toshok@src.gnome.org>2001-05-30 16:47:00 +0800
commit0660722baaa21b9513d1f5eef1ce76722431a823 (patch)
treef81d901c009cf3531bda25ac348cedcbd70ebaab /addressbook/gui/component/addressbook.c
parentcc5c75e9f1153fa90e6d4cf566dd80bb26af9ee9 (diff)
downloadgsoc2013-evolution-0660722baaa21b9513d1f5eef1ce76722431a823.tar.gz
gsoc2013-evolution-0660722baaa21b9513d1f5eef1ce76722431a823.tar.zst
gsoc2013-evolution-0660722baaa21b9513d1f5eef1ce76722431a823.zip
new function, for the Cut verb. (copy_contacts_cb): new function, for the
2001-05-30 Chris Toshok <toshok@ximian.com> * gui/component/addressbook.c (cut_contacts_cb): new function, for the Cut verb. (copy_contacts_cb): new function, for the Copy verb. (paste_contacts_cb): new function, for the Paste verb. (select_all_contacts_cb): new function, for the Select All verb. (update_command_state): add handling for sensitivity of Cut/Copy/Paste/Select All. * gui/widgets/e-addressbook-view.c (e_addressbook_view_init): init the invisible and set up selection/destroy signals. (get_selection_model): new function, so we can get the ETableSelectionModel from either view type. makes lots of the other functions easier, since we can get the list of selected cards using the same code regardless of view type. (invisible_destroyed): new function. (selection_get): new function. convert the clipboard list to string. (selection_clear_event): new function - free up the list of ECards. (selection_received): if the selection data is valid and well-formed, add the corresponding cards to the ebook. (add_to_list): new function. (get_selected_cards): new function. (e_addressbook_view_cut): new function, implement in terms of _copy and _delete_selection. (e_addressbook_view_copy): claim ownership of the CLIPBOARD selection after saving the list of selected ECards. (e_addressbook_view_paste): call gtk_selection_convert. (e_addressbook_view_select_all): new function, using e_selection_model_select_all. (e_addressbook_view_can_print): re-implement in terms of get_selection_model. (e_addressbook_view_can_delete): same. (e_addressbook_view_can_cut): new function. (e_addressbook_view_can_copy): new function. (e_addressbook_view_can_paste): new function. hmm, always return TRUE here. (e_addressbook_view_can_select_all): new function. * gui/widgets/e-addressbook-view.h (struct _EAddressbookView): add selection stuff - the list of selected cards, and the GtkInvisible selection owner, and add prototypes for e_addressbook_view_[can]_{cut,copy,paste,select_all}. * gui/widgets/e-minicard-view-widget.h: add a prototype for e_minicard_view_widget_get_selection_model. * gui/widgets/e-minicard-view-widget.c (e_minicard_view_widget_get_selection_model): new function. svn path=/trunk/; revision=10050
Diffstat (limited to 'addressbook/gui/component/addressbook.c')
-rw-r--r--addressbook/gui/component/addressbook.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index 5db16cf42b..d489b89f60 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -188,6 +188,34 @@ stop_loading_cb (BonoboUIComponent *uih, void *user_data, const char *path)
}
static void
+cut_contacts_cb (BonoboUIComponent *uih, void *user_data, const char *path)
+{
+ AddressbookView *view = (AddressbookView *) user_data;
+ e_addressbook_view_cut(view->view);
+}
+
+static void
+copy_contacts_cb (BonoboUIComponent *uih, void *user_data, const char *path)
+{
+ AddressbookView *view = (AddressbookView *) user_data;
+ e_addressbook_view_copy(view->view);
+}
+
+static void
+paste_contacts_cb (BonoboUIComponent *uih, void *user_data, const char *path)
+{
+ AddressbookView *view = (AddressbookView *) user_data;
+ e_addressbook_view_paste(view->view);
+}
+
+static void
+select_all_contacts_cb (BonoboUIComponent *uih, void *user_data, const char *path)
+{
+ AddressbookView *view = (AddressbookView *) user_data;
+ e_addressbook_view_select_all (view->view);
+}
+
+static void
update_command_state (EAddressbookView *eav, AddressbookView *view)
{
BonoboUIComponent *uic = bonobo_control_get_ui_component (view->control);
@@ -210,7 +238,24 @@ update_command_state (EAddressbookView *eav, AddressbookView *view)
"sensitive",
e_addressbook_view_can_delete (view->view) ? "1" : "0", NULL);
+ bonobo_ui_component_set_prop (uic,
+ "/commands/ContactsCut",
+ "sensitive",
+ e_addressbook_view_can_cut (view->view) ? "1" : "0", NULL);
+ bonobo_ui_component_set_prop (uic,
+ "/commands/ContactsCopy",
+ "sensitive",
+ e_addressbook_view_can_copy (view->view) ? "1" : "0", NULL);
+ bonobo_ui_component_set_prop (uic,
+ "/commands/ContactsPaste",
+ "sensitive",
+ e_addressbook_view_can_paste (view->view) ? "1" : "0", NULL);
+ bonobo_ui_component_set_prop (uic,
+ "/commands/ContactsSelectAll",
+ "sensitive",
+ e_addressbook_view_can_select_all (view->view) ? "1" : "0", NULL);
+
/* View All Contacts */
#if 0
/* this is always enabled */
@@ -242,6 +287,11 @@ BonoboUIVerb verbs [] = {
BONOBO_UI_UNSAFE_VERB ("ContactDelete", delete_contact_cb),
BONOBO_UI_UNSAFE_VERB ("ContactViewAll", show_all_contacts_cb),
BONOBO_UI_UNSAFE_VERB ("ContactStop", stop_loading_cb),
+
+ BONOBO_UI_UNSAFE_VERB ("ContactsCut", cut_contacts_cb),
+ 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_VERB_END
};