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/widgets/e-addressbook-model.c | |
parent | e435c042d08e5b3a46889bd7fafd1ef0f28bc734 (diff) | |
download | gsoc2013-evolution-bb0671f820227cd6759c5b77e678c87ff24af99a.tar gsoc2013-evolution-bb0671f820227cd6759c5b77e678c87ff24af99a.tar.gz gsoc2013-evolution-bb0671f820227cd6759c5b77e678c87ff24af99a.tar.bz2 gsoc2013-evolution-bb0671f820227cd6759c5b77e678c87ff24af99a.tar.lz gsoc2013-evolution-bb0671f820227cd6759c5b77e678c87ff24af99a.tar.xz 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/widgets/e-addressbook-model.c')
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-model.c | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c index 60da28f6be..fbc67d6ed6 100644 --- a/addressbook/gui/widgets/e-addressbook-model.c +++ b/addressbook/gui/widgets/e-addressbook-model.c @@ -33,6 +33,7 @@ enum { }; enum { + WRITABLE_STATUS, STATUS_MESSAGE, CARD_ADDED, CARD_REMOVED, @@ -83,8 +84,15 @@ addressbook_destroy(GtkObject *object) remove_book_view(model); - if (model->book) + if (model->book) { + if (model->writable_status_id) + gtk_signal_disconnect(GTK_OBJECT (model->book), + model->writable_status_id); + + model->writable_status_id = 0; + gtk_object_unref(GTK_OBJECT(model->book)); + } for ( i = 0; i < model->data_count; i++ ) { gtk_object_unref(GTK_OBJECT(model->data[i])); @@ -166,6 +174,18 @@ status_message (EBookView *book_view, } static void +writable_status (EBook *book, + gboolean writable, + EAddressbookModel *model) +{ + model->editable = writable; + + gtk_signal_emit (GTK_OBJECT (model), + e_addressbook_model_signals [WRITABLE_STATUS], + writable); +} + +static void e_addressbook_model_class_init (GtkObjectClass *object_class) { parent_class = gtk_type_class (PARENT_TYPE); @@ -181,6 +201,14 @@ e_addressbook_model_class_init (GtkObjectClass *object_class) gtk_object_add_arg_type ("EAddressbookModel::editable", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_EDITABLE); + e_addressbook_model_signals [WRITABLE_STATUS] = + gtk_signal_new ("writable_status", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (EAddressbookModelClass, writable_status), + gtk_marshal_NONE__BOOL, + GTK_TYPE_NONE, 1, GTK_TYPE_BOOL); + e_addressbook_model_signals [STATUS_MESSAGE] = gtk_signal_new ("status_message", GTK_RUN_LAST, @@ -236,6 +264,7 @@ e_addressbook_model_init (GtkObject *object) model->remove_card_id = 0; model->modify_card_id = 0; model->status_message_id = 0; + model->writable_status_id = 0; model->data = NULL; model->data_count = 0; model->allocated_count = 0; @@ -323,13 +352,23 @@ e_addressbook_model_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) switch (arg_id){ case ARG_BOOK: - if (model->book) + if (model->book) { + if (model->writable_status_id) + gtk_signal_disconnect(GTK_OBJECT (model->book), + model->writable_status_id); + + model->writable_status_id = 0; + gtk_object_unref(GTK_OBJECT(model->book)); + } model->book = E_BOOK(GTK_VALUE_OBJECT (*arg)); if (model->book) { gtk_object_ref(GTK_OBJECT(model->book)); if (model->get_view_idle == 0) model->get_view_idle = g_idle_add((GSourceFunc)get_view, model); + gtk_signal_connect (GTK_OBJECT(model->book), + "writable_status", + writable_status, model); } break; case ARG_QUERY: |