diff options
author | Peter Williams <peterw@ximian.com> | 2001-08-09 02:24:54 +0800 |
---|---|---|
committer | Peter Williams <peterw@src.gnome.org> | 2001-08-09 02:24:54 +0800 |
commit | 4bda0f453caf3779a6d8e6f3e1bd201b2549b494 (patch) | |
tree | 3a935e621f5255fb5edb4c227e02099888499e75 /mail/subscribe-dialog.c | |
parent | 62b28b0d5f05bcdff51bcf3bb2c71f06db583e1b (diff) | |
download | gsoc2013-evolution-4bda0f453caf3779a6d8e6f3e1bd201b2549b494.tar gsoc2013-evolution-4bda0f453caf3779a6d8e6f3e1bd201b2549b494.tar.gz gsoc2013-evolution-4bda0f453caf3779a6d8e6f3e1bd201b2549b494.tar.bz2 gsoc2013-evolution-4bda0f453caf3779a6d8e6f3e1bd201b2549b494.tar.lz gsoc2013-evolution-4bda0f453caf3779a6d8e6f3e1bd201b2549b494.tar.xz gsoc2013-evolution-4bda0f453caf3779a6d8e6f3e1bd201b2549b494.tar.zst gsoc2013-evolution-4bda0f453caf3779a6d8e6f3e1bd201b2549b494.zip |
New function. Set the sensitivity of the subscribe buttons based on
2001-08-08 Peter Williams <peterw@ximian.com>
* subscribe-dialog.c (sc_selection_changed): New function. Set the
sensitivity of the subscribe buttons based on whether any folders
are selected.
(menu_item_selected): If getting the widget for the first time,
hook up sc_selection_changed.
svn path=/trunk/; revision=11800
Diffstat (limited to 'mail/subscribe-dialog.c')
-rw-r--r-- | mail/subscribe-dialog.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/mail/subscribe-dialog.c b/mail/subscribe-dialog.c index c075bbfa00..7ab8ba38df 100644 --- a/mail/subscribe-dialog.c +++ b/mail/subscribe-dialog.c @@ -1314,6 +1314,21 @@ kill_default_view (SubscribeDialog *sc) } static void +sc_selection_changed (GtkObject *obj, gpointer user_data) +{ + SubscribeDialog *sc = SUBSCRIBE_DIALOG (user_data); + gboolean sensitive; + + if (e_selection_model_selected_count (E_SELECTION_MODEL (obj))) + sensitive = TRUE; + else + sensitive = FALSE; + + gtk_widget_set_sensitive (sc->priv->sub_button, sensitive); + gtk_widget_set_sensitive (sc->priv->unsub_button, sensitive); +} + +static void menu_item_selected (GtkMenuItem *item, gpointer user_data) { SubscribeDialog *sc = SUBSCRIBE_DIALOG (user_data); @@ -1323,9 +1338,16 @@ menu_item_selected (GtkMenuItem *item, gpointer user_data) if (sd->widget == NULL) { GtkWidget *widget; + ESelectionModel *esm; + ETree *tree; widget = store_data_get_widget (sd); gtk_box_pack_start (GTK_BOX (sc->priv->hbox), widget, TRUE, TRUE, 0); + + tree = e_tree_scrolled_get_tree (E_TREE_SCROLLED (widget)); + esm = e_tree_get_selection_model (tree); + gtk_signal_connect (GTK_OBJECT (esm), "selection_changed", sc_selection_changed, sc); + sc_selection_changed ((GtkObject *)esm, sc); } if (sc->priv->current_widget == sc->priv->default_widget) |