aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-06-20 07:05:26 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-06-20 07:05:26 +0800
commitc6aabcca4fa3e1af7cbb3b3295ef2c7d61b77d06 (patch)
tree0511fb4033ea74c0bc0c26aad4594868d78277a8 /widgets/misc
parentf4d748a85c534cb8a693b6a1f1b3353adfd73b5b (diff)
parented2d22755ff21516e3284f38eefd080102dd3715 (diff)
downloadgsoc2013-evolution-c6aabcca4fa3e1af7cbb3b3295ef2c7d61b77d06.tar.gz
gsoc2013-evolution-c6aabcca4fa3e1af7cbb3b3295ef2c7d61b77d06.tar.zst
gsoc2013-evolution-c6aabcca4fa3e1af7cbb3b3295ef2c7d61b77d06.zip
Merge commit 'EVOLUTION_2_27_3' into kill-bonobo
Conflicts: composer/e-composer-header-table.h composer/e-composer-header.c composer/e-composer-private.c configure.ac mail/em-account-editor.c po/POTFILES.in po/or.po widgets/misc/e-search-bar.c
Diffstat (limited to 'widgets/misc')
-rw-r--r--widgets/misc/e-account-combo-box.c47
-rw-r--r--widgets/misc/e-attachment-paned.c15
-rw-r--r--widgets/misc/e-attachment-paned.h4
3 files changed, 62 insertions, 4 deletions
diff --git a/widgets/misc/e-account-combo-box.c b/widgets/misc/e-account-combo-box.c
index 4286b0d26c..0ded393e72 100644
--- a/widgets/misc/e-account-combo-box.c
+++ b/widgets/misc/e-account-combo-box.c
@@ -65,6 +65,44 @@ account_combo_box_has_dupes (GList *list,
return (count > 1);
}
+static EAccount *
+account_combo_box_choose_account (EAccountComboBox *combo_box)
+{
+ EAccountList *account_list;
+ EAccount *account;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ account_list = e_account_combo_box_get_account_list (combo_box);
+ g_return_val_if_fail (account_list != NULL, NULL);
+
+ /* First try the default account. */
+
+ /* XXX EAccountList misuses const. */
+ account = (EAccount *)
+ e_account_list_get_default (account_list);
+
+ /* If there is no default account, give up. */
+ if (account == NULL)
+ return NULL;
+
+ /* Make sure the default account appears in the combo box. */
+ if (g_hash_table_lookup (combo_box->priv->index, account) != NULL)
+ return account;
+
+ /* Default account is disabled or otherwise unusable,
+ * so fall back to the first account in the combo box. */
+
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box));
+
+ if (!gtk_tree_model_get_iter_first (model, &iter))
+ return NULL;
+
+ gtk_tree_model_get (model, &iter, COLUMN_ACCOUNT, &account, -1);
+
+ return account;
+}
+
static gboolean
account_combo_box_test_account (EAccount *account)
{
@@ -417,11 +455,12 @@ e_account_combo_box_set_active (EAccountComboBox *combo_box,
account_list = combo_box->priv->account_list;
g_return_val_if_fail (account_list != NULL, FALSE);
- /* NULL means select the default account. */
- /* XXX EAccountList misuses const. */
+ /* NULL means choose an account ourselves. */
if (account == NULL)
- account = (EAccount *)
- e_account_list_get_default (account_list);
+ account = account_combo_box_choose_account (combo_box);
+
+ if (account == NULL)
+ return FALSE;
/* Lookup the tree row reference for the account. */
reference = g_hash_table_lookup (combo_box->priv->index, account);
diff --git a/widgets/misc/e-attachment-paned.c b/widgets/misc/e-attachment-paned.c
index a88f9fa8b2..a65d1c6ea4 100644
--- a/widgets/misc/e-attachment-paned.c
+++ b/widgets/misc/e-attachment-paned.c
@@ -45,6 +45,7 @@ struct _EAttachmentPanedPrivate {
GtkWidget *expander;
GtkWidget *notebook;
GtkWidget *combo_box;
+ GtkWidget *controls_container;
GtkWidget *icon_view;
GtkWidget *tree_view;
GtkWidget *show_hide_label;
@@ -574,6 +575,7 @@ attachment_paned_init (EAttachmentPaned *paned)
widget = gtk_hbox_new (FALSE, 6);
gtk_box_pack_end (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ paned->priv->controls_container = widget;
gtk_widget_show (widget);
container = widget;
@@ -775,3 +777,16 @@ e_attachment_paned_drag_data_received (EAttachmentPaned *paned,
paned->priv->icon_view, "drag-data-received",
context, x, y, selection, info, time);
}
+
+GtkWidget *
+e_attachment_paned_get_controls_container (EAttachmentPaned *paned)
+{
+ return paned->priv->controls_container;
+}
+
+GtkWidget *
+e_attachment_paned_get_view_combo (EAttachmentPaned *paned)
+{
+ return paned->priv->combo_box;
+}
+
diff --git a/widgets/misc/e-attachment-paned.h b/widgets/misc/e-attachment-paned.h
index 401ec581cb..825de3a16b 100644
--- a/widgets/misc/e-attachment-paned.h
+++ b/widgets/misc/e-attachment-paned.h
@@ -78,6 +78,10 @@ void e_attachment_paned_drag_data_received
GtkSelectionData *selection,
guint info,
guint time);
+GtkWidget * e_attachment_paned_get_controls_container
+ (EAttachmentPaned *paned);
+GtkWidget * e_attachment_paned_get_view_combo
+ (EAttachmentPaned *paned);
G_END_DECLS