[evolution-data-server] Bug #584030 - New API function for ESourceSelectorDialog
- From: Milan Crha <mcrha src gnome org>
- To: svn-commits-list gnome org
- Subject: [evolution-data-server] Bug #584030 - New API function for ESourceSelectorDialog
- Date: Thu, 28 May 2009 10:45:46 -0400 (EDT)
commit ab2c4ce14ccb9f29361a8ee670834ee551023de6
Author: Milan Crha <mcrha redhat com>
Date: Thu May 28 16:44:20 2009 +0200
Bug #584030 - New API function for ESourceSelectorDialog
e_source_selector_dialog_select_default_source
---
libedataserverui/e-source-selector-dialog.c | 46 +++++++++++++++++++++++++++
libedataserverui/e-source-selector-dialog.h | 1 +
2 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/libedataserverui/e-source-selector-dialog.c b/libedataserverui/e-source-selector-dialog.c
index 6e66b56..8ff431e 100644
--- a/libedataserverui/e-source-selector-dialog.c
+++ b/libedataserverui/e-source-selector-dialog.c
@@ -213,6 +213,52 @@ e_source_selector_dialog_new (GtkWindow *parent, ESourceList *source_list)
}
/**
+ * e_source_selector_dialog_select_default_source:
+ * @dialog: An #ESourceSelectorDialog widget.
+ *
+ * Selects default source in the dialog.
+ *
+ * Return value: Whether found any default source.
+ **/
+gboolean
+e_source_selector_dialog_select_default_source (ESourceSelectorDialog *dialog)
+{
+ ESourceSelectorDialogPrivate *priv;
+
+ g_return_val_if_fail (E_IS_SOURCE_SELECTOR_DIALOG (dialog), FALSE);
+
+ priv = dialog->priv;
+
+ if (priv->source_list) {
+ ESource *default_source = NULL;
+ GSList *groups, *g;
+
+ groups = e_source_list_peek_groups (priv->source_list);
+ for (g = groups; g != NULL && !default_source; g = g->next) {
+ ESourceGroup *group = E_SOURCE_GROUP (g->data);
+ GSList *sources, *s;
+
+ sources = e_source_group_peek_sources (group);
+
+ for (s = sources; s != NULL && !default_source; s = s->next) {
+ ESource *source = E_SOURCE (s->data);
+
+ if (source && e_source_get_property (source, "default"))
+ default_source = source;
+ }
+
+ }
+
+ if (default_source)
+ e_source_selector_set_primary_selection (E_SOURCE_SELECTOR (priv->source_selector), default_source);
+
+ return default_source != NULL;
+ }
+
+ return FALSE;
+}
+
+/**
* e_source_selector_dialog_peek_primary_selection:
* @dialog: An #ESourceSelectorDialog widget.
*
diff --git a/libedataserverui/e-source-selector-dialog.h b/libedataserverui/e-source-selector-dialog.h
index 6acd982..624d6bf 100644
--- a/libedataserverui/e-source-selector-dialog.h
+++ b/libedataserverui/e-source-selector-dialog.h
@@ -52,6 +52,7 @@ struct _ESourceSelectorDialogClass {
GType e_source_selector_dialog_get_type (void);
GtkWidget *e_source_selector_dialog_new (GtkWindow *parent, ESourceList *source_list);
+gboolean e_source_selector_dialog_select_default_source (ESourceSelectorDialog *dialog);
ESource *e_source_selector_dialog_peek_primary_selection (ESourceSelectorDialog *dialog);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]