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-minicard-view-widget.c | |
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/widgets/e-minicard-view-widget.c')
-rw-r--r-- | addressbook/gui/widgets/e-minicard-view-widget.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/addressbook/gui/widgets/e-minicard-view-widget.c b/addressbook/gui/widgets/e-minicard-view-widget.c index 8944f2118c..576f8b3aab 100644 --- a/addressbook/gui/widgets/e-minicard-view-widget.c +++ b/addressbook/gui/widgets/e-minicard-view-widget.c @@ -37,6 +37,8 @@ static void e_minicard_view_widget_reflow (ECanvas *canvas); static void e_minicard_view_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static void e_minicard_view_widget_realize (GtkWidget *widget); +static void selection_change (ESelectionModel *esm, EMinicardViewWidget *widget); + static ECanvasClass *parent_class = NULL; /* The arguments we take */ @@ -47,6 +49,13 @@ enum { ARG_EDITABLE }; +enum { + SELECTION_CHANGE, + LAST_SIGNAL +}; + +static guint e_minicard_view_widget_signals [LAST_SIGNAL] = {0, }; + GtkType e_minicard_view_widget_get_type (void) { @@ -92,6 +101,16 @@ e_minicard_view_widget_class_init (EMinicardViewWidgetClass *klass) gtk_object_add_arg_type ("EMinicardViewWidget::editable", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_EDITABLE); + e_minicard_view_widget_signals [SELECTION_CHANGE] = + gtk_signal_new ("selection_change", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (EMinicardViewWidgetClass, selection_change), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, 0); + + gtk_object_class_add_signals (object_class, e_minicard_view_widget_signals, LAST_SIGNAL); + object_class->set_arg = e_minicard_view_widget_set_arg; object_class->get_arg = e_minicard_view_widget_get_arg; object_class->destroy = e_minicard_view_widget_destroy; @@ -223,6 +242,10 @@ e_minicard_view_widget_realize (GtkWidget *widget) "adapter", view->adapter, NULL); + gtk_signal_connect (GTK_OBJECT (E_REFLOW(view->emv)->selection), + "selection_changed", + selection_change, view); + if (GTK_WIDGET_CLASS(parent_class)->realize) GTK_WIDGET_CLASS(parent_class)->realize (widget); } @@ -275,6 +298,22 @@ e_minicard_view_widget_reflow(ECanvas *canvas) NULL ); } +static void +selection_change (ESelectionModel *esm, EMinicardViewWidget *widget) +{ + gtk_signal_emit (GTK_OBJECT(widget), + e_minicard_view_widget_signals [SELECTION_CHANGE], widget); +} + +gint +e_minicard_view_widget_selected_count (EMinicardViewWidget *view) +{ + if (!view->emv) + return 0; + else + return e_selection_model_selected_count (E_REFLOW (view->emv)->selection); +} + void e_minicard_view_widget_remove_selection(EMinicardViewWidget *view, EBookCallback cb, |