From: Matthew Barnes Date: Sun, 5 Aug 2012 19:56:18 +0000 (-0400) Subject: Bug 679808 - e_source_selector_set_primary_selection() has side-effects X-Git-Tag: upstream/3.7.4~596 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6143c9a743be36f304e0f3503ae2de96be77065b;p=platform%2Fupstream%2Fevolution-data-server.git Bug 679808 - e_source_selector_set_primary_selection() has side-effects In ESourceSelector parlance, the "primary selection" is the highlighted tree view item. A tree view item is "selected" if the check box cell is ticked. The two selection states are supposed to be orthogonal. e_source_selector_set_primary_selection() has apparently for some time been highlighting the requested item and also activating its check box. That last part is an unwanted and undocumented side-effect. This commit removes the side-effect and explicitly states in the API documentation that the function does NOT alter the item's check box. --- diff --git a/libedataserverui/e-source-selector.c b/libedataserverui/e-source-selector.c index fd24086..cad97d8 100644 --- a/libedataserverui/e-source-selector.c +++ b/libedataserverui/e-source-selector.c @@ -1926,7 +1926,12 @@ e_source_selector_ref_primary_selection (ESourceSelector *selector) * @selector: an #ESourceSelector widget * @source: an #ESource to select * - * Set the primary selected source. + * Highlights @source in @selector. The highlighted #ESource is called + * the primary selection. + * + * Do not confuse this function with e_source_selector_select_source(), + * which activates the check box next to an #ESource's display name in + * @selector. This funtion does not alter the check box. **/ void e_source_selector_set_primary_selection (ESourceSelector *selector, @@ -1979,19 +1984,9 @@ e_source_selector_set_primary_selection (ESourceSelector *selector, if (gtk_tree_view_row_expanded (tree_view, parent_path)) { gtk_tree_selection_select_path (selection, child_path); } else { - ESourceSelectorClass *class; - - class = E_SOURCE_SELECTOR_GET_CLASS (selector); - g_return_if_fail (class->set_source_selected != NULL); - selector->priv->saved_primary_selection = gtk_tree_row_reference_copy (reference); - - class->set_source_selected (selector, source, TRUE); - g_signal_emit (selector, signals[SELECTION_CHANGED], 0); - g_signal_emit (selector, signals[PRIMARY_SELECTION_CHANGED], 0); - g_object_notify (G_OBJECT (selector), "primary-selection"); } gtk_tree_path_free (child_path);