From 38f4f2cd20d68010f15e5ace7a895903211a10f2 Mon Sep 17 00:00:00 2001 From: Rodney Dawes Date: Thu, 24 Jun 2004 17:22:40 +0000 Subject: Add a call to e_source_selector_set_select_new here so that we can select 2004-06-24 Rodney Dawes * gui/calendar-component.c (create_component_view): * gui/tasks-component.c (create_component_view): Add a call to e_source_selector_set_select_new here so that we can select new sources when we create them 2004-06-24 Rodney Dawes * e-source-selector.[ch]: Add new "select_new" property to private structure of the ESourceSelector (rebuild_cb): Add code to select the new source, and cause the selection_changed signal to get emitted, if we select new sources (init): Don't select new sources by default (e_source_selector_set_select_new): Add function to set whether or not we want to select new sources when we add them svn path=/trunk/; revision=26498 --- widgets/misc/e-source-selector.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'widgets/misc/e-source-selector.c') diff --git a/widgets/misc/e-source-selector.c b/widgets/misc/e-source-selector.c index 1a0e0d1fbd..466930ed4f 100644 --- a/widgets/misc/e-source-selector.c +++ b/widgets/misc/e-source-selector.c @@ -53,6 +53,7 @@ struct _ESourceSelectorPrivate { gboolean toggled_last; gboolean checkboxes_shown; gboolean toggle_selection; + gboolean select_new; }; typedef struct { @@ -276,6 +277,10 @@ rebuild_model (ESourceSelector *selector) row_ref = g_hash_table_lookup (rebuild_data->remaining_uids, e_source_peek_uid (source)); if (!row_ref) { + if (selector->priv->select_new) { + select_source (selector, source); + rebuild_data->selection_changed = TRUE; + } gtk_tree_store_append (GTK_TREE_STORE (tree_store), &child_iter, &iter); gtk_tree_store_set (GTK_TREE_STORE (tree_store), &child_iter, 0, source, -1); @@ -726,6 +731,7 @@ init (ESourceSelector *selector) priv->toggled_last = FALSE; priv->checkboxes_shown = TRUE; + priv->select_new = FALSE; priv->selected_sources = create_selected_sources_hash (); @@ -891,7 +897,7 @@ e_source_selector_selection_shown (ESourceSelector *selector) * @selector: * @state: * - * Set the source selectr behaviour, whether you can toggle the + * Set the source selector behaviour, whether you can toggle the * current selection or not. **/ void @@ -902,6 +908,21 @@ e_source_selector_set_toggle_selection(ESourceSelector *selector, gboolean state selector->priv->toggle_selection = state; } +/** + * e_source_selector_set_select_new: + * @selector: An ESourceSelector widget + * @state: A gboolean + * + * Set whether or not to select new sources added to @selector. + **/ +void +e_source_selector_set_select_new (ESourceSelector *selector, gboolean state) +{ + g_return_if_fail (E_IS_SOURCE_SELECTOR (selector)); + + selector->priv->select_new = state; +} + /** * e_source_selector_select_source: * @selector: An ESourceSelector widget -- cgit v1.2.3