From 0660722baaa21b9513d1f5eef1ce76722431a823 Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Wed, 30 May 2001 08:47:00 +0000 Subject: new function, for the Cut verb. (copy_contacts_cb): new function, for the 2001-05-30 Chris Toshok * 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 --- addressbook/gui/component/addressbook.c | 50 +++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'addressbook/gui/component/addressbook.c') 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 @@ -187,6 +187,34 @@ stop_loading_cb (BonoboUIComponent *uih, void *user_data, const char *path) e_addressbook_view_stop(view->view); } +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) { @@ -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 }; -- cgit v1.2.3