diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-05-20 10:01:49 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-05-20 10:01:49 +0800 |
commit | c8b4228f3d2db7f0bd866f16ed48b800256d3187 (patch) | |
tree | 4c8a71c50963bcd32627d46fe26f063108facc7f /widgets/misc/e-attachment-paned.c | |
parent | a53abe730b9e0d491ae92586862336b226d297bf (diff) | |
download | gsoc2013-evolution-c8b4228f3d2db7f0bd866f16ed48b800256d3187.tar.gz gsoc2013-evolution-c8b4228f3d2db7f0bd866f16ed48b800256d3187.tar.zst gsoc2013-evolution-c8b4228f3d2db7f0bd866f16ed48b800256d3187.zip |
Improve attachment bar selection behavior.
Some improvements made while investigating bug #608855. This does not
solve the bug however, and in fact I now believe the bug is actually a
GTK+ issue after reproducing the bug in gtk-demo.
These improvements restore multiple selections via Ctrl+Click and
Shift+Click, and also reduces the frequency that we synchronize the
selection between Icon View and Tree View.
Diffstat (limited to 'widgets/misc/e-attachment-paned.c')
-rw-r--r-- | widgets/misc/e-attachment-paned.c | 62 |
1 files changed, 20 insertions, 42 deletions
diff --git a/widgets/misc/e-attachment-paned.c b/widgets/misc/e-attachment-paned.c index 110e858e74..c9282c7718 100644 --- a/widgets/misc/e-attachment-paned.c +++ b/widgets/misc/e-attachment-paned.c @@ -92,36 +92,6 @@ attachment_paned_notify_cb (EAttachmentPaned *paned, } static void -attachment_paned_sync_icon_view (EAttachmentPaned *paned) -{ - EAttachmentView *source; - EAttachmentView *target; - - source = E_ATTACHMENT_VIEW (paned->priv->tree_view); - target = E_ATTACHMENT_VIEW (paned->priv->icon_view); - - /* Only sync if the tree view is active. This prevents the - * two views from endlessly trying to sync with each other. */ - if (e_attachment_paned_get_active_view (paned) == 1) - e_attachment_view_sync_selection (source, target); -} - -static void -attachment_paned_sync_tree_view (EAttachmentPaned *paned) -{ - EAttachmentView *source; - EAttachmentView *target; - - source = E_ATTACHMENT_VIEW (paned->priv->icon_view); - target = E_ATTACHMENT_VIEW (paned->priv->tree_view); - - /* Only sync if the icon view is active. This prevents the - * two views from endlessly trying to sync with each other. */ - if (e_attachment_paned_get_active_view (paned) == 0) - e_attachment_view_sync_selection (source, target); -} - -static void attachment_paned_update_status (EAttachmentPaned *paned) { EAttachmentView *view; @@ -509,7 +479,6 @@ static void attachment_paned_init (EAttachmentPaned *paned) { EAttachmentView *view; - GtkTreeSelection *selection; GtkSizeGroup *size_group; GtkWidget *container; GtkWidget *widget; @@ -662,17 +631,6 @@ attachment_paned_init (EAttachmentPaned *paned) paned->priv->status_label = g_object_ref (widget); gtk_widget_hide (widget); - selection = gtk_tree_view_get_selection ( - GTK_TREE_VIEW (paned->priv->tree_view)); - - g_signal_connect_swapped ( - selection, "changed", - G_CALLBACK (attachment_paned_sync_icon_view), paned); - - g_signal_connect_swapped ( - paned->priv->icon_view, "selection-changed", - G_CALLBACK (attachment_paned_sync_tree_view), paned); - g_signal_connect_swapped ( paned->priv->expander, "notify::expanded", G_CALLBACK (attachment_paned_notify_cb), paned); @@ -750,11 +708,31 @@ void e_attachment_paned_set_active_view (EAttachmentPaned *paned, gint active_view) { + EAttachmentView *source; + EAttachmentView *target; + g_return_if_fail (E_IS_ATTACHMENT_PANED (paned)); g_return_if_fail (active_view >= 0 && active_view < NUM_VIEWS); + if (active_view == paned->priv->active_view) + return; + paned->priv->active_view = active_view; + /* Synchronize the item selection of the view we're + * switching TO with the view we're switching FROM. */ + if (active_view == 0) { + /* from tree view to icon view */ + source = E_ATTACHMENT_VIEW (paned->priv->tree_view); + target = E_ATTACHMENT_VIEW (paned->priv->icon_view); + } else { + /* from icon view to tree view */ + source = E_ATTACHMENT_VIEW (paned->priv->icon_view); + target = E_ATTACHMENT_VIEW (paned->priv->tree_view); + } + + e_attachment_view_sync_selection (source, target); + g_object_notify (G_OBJECT (paned), "active-view"); } |