Bug 679808 - e_source_selector_set_primary_selection() has side-effects
authorMatthew Barnes <mbarnes@redhat.com>
Sun, 5 Aug 2012 19:56:18 +0000 (15:56 -0400)
committerMatthew Barnes <mbarnes@redhat.com>
Sun, 5 Aug 2012 20:07:37 +0000 (16:07 -0400)
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.

libedataserverui/e-source-selector.c

index fd24086..cad97d8 100644 (file)
@@ -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);