aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2014-01-27 21:51:26 +0800
committerMilan Crha <mcrha@redhat.com>2014-01-27 21:52:25 +0800
commit3066ddf0c4e747a48a825b70c7f250faa4e6d276 (patch)
tree3284172993008926161d8e46080df5cadbe66cdb
parent8b8bf669658c436f0955d9a075ed40d8c2c216d1 (diff)
downloadgsoc2013-evolution-3066ddf0c4e747a48a825b70c7f250faa4e6d276.tar
gsoc2013-evolution-3066ddf0c4e747a48a825b70c7f250faa4e6d276.tar.gz
gsoc2013-evolution-3066ddf0c4e747a48a825b70c7f250faa4e6d276.tar.bz2
gsoc2013-evolution-3066ddf0c4e747a48a825b70c7f250faa4e6d276.tar.lz
gsoc2013-evolution-3066ddf0c4e747a48a825b70c7f250faa4e6d276.tar.xz
gsoc2013-evolution-3066ddf0c4e747a48a825b70c7f250faa4e6d276.tar.zst
gsoc2013-evolution-3066ddf0c4e747a48a825b70c7f250faa4e6d276.zip
Bug #707518 - Deleting a local address book triggers error "Unable to open address book"
-rw-r--r--e-util/e-source-selector.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/e-util/e-source-selector.c b/e-util/e-source-selector.c
index 1b4fd3897f..5d180acb75 100644
--- a/e-util/e-source-selector.c
+++ b/e-util/e-source-selector.c
@@ -110,6 +110,9 @@ G_DEFINE_TYPE (
e_cell_renderer_safe_toggle,
GTK_TYPE_CELL_RENDERER_TOGGLE)
+static void selection_changed_callback (GtkTreeSelection *selection,
+ ESourceSelector *selector);
+
static gboolean
safe_toggle_activate (GtkCellRenderer *cell,
GdkEvent *event,
@@ -342,6 +345,7 @@ source_selector_build_model (ESourceSelector *selector)
GQueue queue = G_QUEUE_INIT;
GHashTable *source_index;
GtkTreeView *tree_view;
+ GtkTreeSelection *selection;
GtkTreeModel *model;
ESource *selected;
const gchar *extension_name;
@@ -359,6 +363,12 @@ source_selector_build_model (ESourceSelector *selector)
source_index = selector->priv->source_index;
selected = e_source_selector_ref_primary_selection (selector);
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (selector));
+
+ /* Signal is blocked to avoid "primary-selection-changed" signal on model clear */
+ g_signal_handlers_block_matched (
+ selection, G_SIGNAL_MATCH_FUNC,
+ 0, 0, NULL, selection_changed_callback, NULL);
/* Save expanded sources to restore later. */
gtk_tree_view_map_expanded_rows (
@@ -404,6 +414,12 @@ source_selector_build_model (ESourceSelector *selector)
g_object_unref (selected);
}
+ /* If the first succeeded, then there is no selection change, thus no need
+ for notification; notify about the change in ay other cases */
+ g_signal_handlers_unblock_matched (
+ selection, G_SIGNAL_MATCH_FUNC,
+ 0, 0, NULL, selection_changed_callback, NULL);
+
/* Make sure we have a primary selection. If not, pick one. */
selected = e_source_selector_ref_primary_selection (selector);
if (selected == NULL) {