diff options
author | Chris Toshok <toshok@ximian.com> | 2001-05-18 07:30:57 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2001-05-18 07:30:57 +0800 |
commit | bb0671f820227cd6759c5b77e678c87ff24af99a (patch) | |
tree | 3a00d31e02aaf352a35807d19f4276959bbe4111 /addressbook/gui/component | |
parent | e435c042d08e5b3a46889bd7fafd1ef0f28bc734 (diff) | |
download | gsoc2013-evolution-bb0671f820227cd6759c5b77e678c87ff24af99a.tar.gz gsoc2013-evolution-bb0671f820227cd6759c5b77e678c87ff24af99a.tar.zst gsoc2013-evolution-bb0671f820227cd6759c5b77e678c87ff24af99a.zip |
add our selection_change signal. (e_minicard_view_widget_realize): connect
2001-05-17 Chris Toshok <toshok@ximian.com>
* gui/widgets/e-minicard-view-widget.c
(e_minicard_view_widget_class_init): add our selection_change
signal.
(e_minicard_view_widget_realize): connect to the ESelectionModel's
selection_changed signal.
(e_minicard_view_widget_selected_count): new function.
(selection_change): new function - emit our "selection_change"
signal.
* gui/widgets/e-minicard-view-widget.h (struct
_EMinicardViewWidgetClass): add selection_change signal. also,
add prototype for e_minicard_view_widget_selected_count. *
gui/widgets/e-addressbook-view.c
(e_addressbook_view_class_init): add our command_state_change
signal.
(e_addressbook_view_init): connect to the writable_status signal
on the EAddressbookModel.
(minicard_selection_change): new function - calls
command_state_change.
(create_minicard_view): connect to selection_change on the
minicard_view so we know when to update command state.
(table_selection_change): new function - calls
command_state_change.
(writable_status): new function - calls command_state_change.
(command_state_change): new function - emits our
"command_state_change" signal.
(create_table_view): connect to the selection_change signal so we
know to update the command state.
(change_view_type): update the command state every time we change
view types.
(e_addressbook_view_can_create): new function.
(e_addressbook_view_can_print): new function.
(e_addressbook_view_can_delete): new function.
(e_addressbook_view_can_stop): new function.
* gui/widgets/e-addressbook-view.h (struct
_EAddressbookViewClass): add command_state_change signal, and
prototypes of functions the component can use to test the state of
commands.
* gui/widgets/e-addressbook-model.c (addressbook_destroy): unlink
the writable_status signal on the EBook.
(writable_status): new function.
(e_addressbook_model_class_init): add our writable_status signal.
(e_addressbook_model_init): init writable_status_id.
(e_addressbook_model_set_arg): unlink the writable_status signal
on the old EBook, and connect it on the new one.
* gui/widgets/e-addressbook-model.h: add writable_status signal.
* gui/component/addressbook.c (update_command_state): new
function, set the sensitivity of the bonobo commands.
(control_activate): update our command state immediately upon
activating the control.
(addressbook_factory_new_control): register command_state_change
to update the commands.
svn path=/trunk/; revision=9874
Diffstat (limited to 'addressbook/gui/component')
-rw-r--r-- | addressbook/gui/component/addressbook.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c index 3e3cf862da..c0aafaa1b6 100644 --- a/addressbook/gui/component/addressbook.c +++ b/addressbook/gui/component/addressbook.c @@ -225,6 +225,53 @@ stop_loading_cb (BonoboUIComponent *uih, void *user_data, const char *path) } static void +update_command_state (EAddressbookView *eav, AddressbookView *view) +{ + BonoboUIComponent *uic = bonobo_control_get_ui_component (view->control); + + /* New Contact */ + bonobo_ui_component_set_prop (uic, + "/commands/ContactNew", + "sensitive", + e_addressbook_view_can_create (view->view) ? "1" : "0", NULL); + + /* Find Contact */ +#if 0 + /* this is always enabled */ + bonobo_ui_component_set_prop (uic, + "/commands/ContactFind", + "sensitive", "0", NULL); +#endif + + /* Print Contact */ + bonobo_ui_component_set_prop (uic, + "/commands/ContactsPrint", + "sensitive", + e_addressbook_view_can_print (view->view) ? "1" : "0", NULL); + + /* Delete Contact */ + bonobo_ui_component_set_prop (uic, + "/commands/ContactDelete", + "sensitive", + e_addressbook_view_can_delete (view->view) ? "1" : "0", NULL); + + + /* View All Contacts */ +#if 0 + /* this is always enabled */ + bonobo_ui_component_set_prop (uic, + "/Toolbar/View All", + "sensitive", "1", NULL); +#endif + + /* Stop */ + bonobo_ui_component_set_prop (uic, + "/commands/ContactStop", + "sensitive", + e_addressbook_view_can_stop (view->view) ? "1" : "0", NULL); +} + +static void update_view_type (AddressbookView *view) { BonoboUIComponent *uic = bonobo_control_get_ui_component (view->control); @@ -332,6 +379,8 @@ control_activate (BonoboControl *control, e_pixmaps_update (uic, pixmaps); bonobo_ui_component_thaw (uic, NULL); + + update_command_state (view->view, view); } static void @@ -767,6 +816,11 @@ addressbook_factory_new_control (void) "status_message", GTK_SIGNAL_FUNC(set_status_message), view); + + gtk_signal_connect (GTK_OBJECT (view->view), + "command_state_change", + GTK_SIGNAL_FUNC(update_command_state), + view); view->uri = NULL; |