[evolution/account-mgmt: 4/25] Adapt libeutil to the new ESource API.



commit 782b7f138de2126741e36e59806150225bb5f78e
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue Dec 7 15:30:15 2010 -0600

    Adapt libeutil to the new ESource API.

 doc/reference/shell/tmpl/e-util.sgml |    4 +-
 e-util/e-marshal.list                |    1 +
 e-util/e-plugin-util.c               |    4 +++
 e-util/e-plugin-util.h               |    5 +++-
 e-util/e-util.c                      |   46 +++++++--------------------------
 e-util/e-util.h                      |   10 ++-----
 e-util/gtk-compat.h                  |    9 ++++--
 7 files changed, 30 insertions(+), 49 deletions(-)
---
diff --git a/doc/reference/shell/tmpl/e-util.sgml b/doc/reference/shell/tmpl/e-util.sgml
index 060ec3f..0001f4e 100644
--- a/doc/reference/shell/tmpl/e-util.sgml
+++ b/doc/reference/shell/tmpl/e-util.sgml
@@ -391,7 +391,7 @@ Miscellaneous Utilities
 @binding: 
 @source_value: 
 @target_value: 
- source_list: 
+ registry: 
 @Returns: 
 
 
@@ -403,7 +403,7 @@ Miscellaneous Utilities
 @binding: 
 @source_value: 
 @target_value: 
- source_list: 
+ registry: 
 @Returns: 
 
 
diff --git a/e-util/e-marshal.list b/e-util/e-marshal.list
index d4e6f43..d9c708c 100644
--- a/e-util/e-marshal.list
+++ b/e-util/e-marshal.list
@@ -6,6 +6,7 @@ BOOLEAN:INT,INT,OBJECT,INT,INT,UINT
 BOOLEAN:INT,POINTER,INT,BOXED
 BOOLEAN:INT,POINTER,INT,OBJECT,INT,INT,UINT
 BOOLEAN:NONE
+BOOLEAN:OBJECT
 BOOLEAN:OBJECT,DOUBLE,DOUBLE,BOOLEAN
 BOOLEAN:POINTER
 BOOLEAN:POINTER,BOOLEAN,POINTER
diff --git a/e-util/e-plugin-util.c b/e-util/e-plugin-util.c
index 8ff3b28..fef0a5c 100644
--- a/e-util/e-plugin-util.c
+++ b/e-util/e-plugin-util.c
@@ -34,6 +34,7 @@
 #define EPU_CHECK_TRUE "epu-check-true-value"
 #define EPU_CHECK_FALSE "epu-check-false-value"
 
+#if 0  /* ACCOUNT_MGMT */
 static gboolean
 epu_is_uri_proto (const gchar *uri, const gchar *protocol)
 {
@@ -92,6 +93,7 @@ e_plugin_util_is_group_proto (ESourceGroup *group, const gchar *protocol)
 
 	return epu_is_uri_proto (e_source_group_peek_base_uri (group), protocol);
 }
+#endif /* ACCOUNT_MGMT */
 
 /**
  * e_plugin_util_replace_at_sign:
@@ -157,6 +159,7 @@ e_plugin_util_uri_no_proto (SoupURI *uri)
 	return uri_noproto;
 }
 
+#if 0  /* ACCOUNT_MGMT */
 static void
 epu_update_source_property (ESource *source, GObject *object, const gchar *value)
 {
@@ -465,3 +468,4 @@ e_plugin_util_add_refresh (GtkWidget *parent, const gchar *label, ESource *sourc
 
 	return hbox;
 }
+#endif /* ACCOUNT_MGMT */
diff --git a/e-util/e-plugin-util.h b/e-util/e-plugin-util.h
index 6bee4d0..5ee9b90 100644
--- a/e-util/e-plugin-util.h
+++ b/e-util/e-plugin-util.h
@@ -28,16 +28,19 @@
 #include <libsoup/soup.h>
 
 #include <libedataserver/e-source.h>
-#include <libedataserver/e-source.h>
 
+#if 0  /* ACCOUNT_MGMT */
 gboolean e_plugin_util_is_source_proto (ESource *source, const gchar *protocol);
 gboolean e_plugin_util_is_group_proto (ESourceGroup *group, const gchar *protocol);
+#endif /* ACCOUNT_MGMT */
 
 gchar *e_plugin_util_replace_at_sign (const gchar *str);
 gchar *e_plugin_util_uri_no_proto (SoupURI *uri);
 
 /* common widgets used in plugin setup */
+#if 0  /* ACCOUNT_MGMT */
 GtkWidget *e_plugin_util_add_entry (GtkWidget *parent, const gchar *label, ESource *source, const gchar *source_property);
+#endif /* ACCOUNT_MGMT */
 GtkWidget *e_plugin_util_add_check (GtkWidget *parent, const gchar *label, ESource *source, const gchar *source_property, const gchar *true_value, const gchar *false_value);
 
 /* multipack widgets */
diff --git a/e-util/e-util.c b/e-util/e-util.c
index 4c2764d..d3030c6 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -51,7 +51,6 @@
 #include <camel/camel.h>
 #include <libedataserver/e-data-server-util.h>
 #include <libedataserver/e-categories.h>
-#include <libedataserver/e-source-list.h>
 
 #include "filter/e-filter-option.h"
 
@@ -1478,31 +1477,6 @@ e_util_get_category_filter_options (void)
 }
 
 /**
- * e_util_set_source_combo_box_list:
- * @source_combo_box: an #ESourceComboBox
- * @source_gconf_path: GConf path with sources to use in an #ESourceList
- *
- * Sets an #ESourceList of a given GConf path to an #ESourceComboBox.
- **/
-void
-e_util_set_source_combo_box_list (GtkWidget *source_combo_box,
-                                  const gchar *source_gconf_path)
-{
-	ESourceList *source_list;
-	GConfClient *gconf_client;
-
-	g_return_if_fail (source_combo_box != NULL);
-	g_return_if_fail (source_gconf_path != NULL);
-
-	gconf_client = gconf_client_get_default ();
-	source_list = e_source_list_new_for_gconf (
-		gconf_client, source_gconf_path);
-	g_object_set (source_combo_box, "source-list", source_list, NULL);
-	g_object_unref (source_list);
-	g_object_unref (gconf_client);
-}
-
-/**
  * e_binding_transform_color_to_string:
  * @binding: a #GBinding
  * @source_value: a #GValue of type #GDK_TYPE_COLOR
@@ -1643,7 +1617,7 @@ e_binding_transform_enum_nick_to_value (GBinding *binding,
  * @binding: a #GBinding
  * @source_value: a #GValue of type #E_TYPE_SOURCE
  * @target_value: a #GValue of type #G_TYPE_STRING
- * @source_list: an #ESourceList
+ * @registry: an #ESourceRegistry
  *
  * Transforms an #ESource object to its UID string.
  *
@@ -1653,18 +1627,18 @@ gboolean
 e_binding_transform_source_to_uid (GBinding *binding,
                                    const GValue *source_value,
                                    GValue *target_value,
-                                   ESourceList *source_list)
+                                   ESourceRegistry *registry)
 {
 	ESource *source;
 	const gchar *string;
 	gboolean success = FALSE;
 
 	g_return_val_if_fail (G_IS_BINDING (binding), FALSE);
-	g_return_val_if_fail (E_IS_SOURCE_LIST (source_list), FALSE);
+	g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FALSE);
 
 	source = g_value_get_object (source_value);
 	if (E_IS_SOURCE (source)) {
-		string = e_source_peek_uid (source);
+		string = e_source_get_uid (source);
 		g_value_set_string (target_value, string);
 		success = TRUE;
 	}
@@ -1677,32 +1651,32 @@ e_binding_transform_source_to_uid (GBinding *binding,
  * @binding: a #GBinding
  * @source_value: a #GValue of type #G_TYPE_STRING
  * @target_value: a #GValue of type #E_TYPE_SOURCe
- * @source_list: an #ESourceList
+ * @registry: an #ESourceRegistry
  *
  * Transforms an #ESource UID string to the corresponding #ESource object
- * in @source_list.
+ * in @registry.
  *
- * Returns: %TRUE if @source_list had an #ESource object with a matching
+ * Returns: %TRUE if @registry had an #ESource object with a matching
  *          UID string
  **/
 gboolean
 e_binding_transform_uid_to_source (GBinding *binding,
                                    const GValue *source_value,
                                    GValue *target_value,
-                                   ESourceList *source_list)
+                                   ESourceRegistry *registry)
 {
 	ESource *source;
 	const gchar *string;
 	gboolean success = FALSE;
 
 	g_return_val_if_fail (G_IS_BINDING (binding), FALSE);
-	g_return_val_if_fail (E_IS_SOURCE_LIST (source_list), FALSE);
+	g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FALSE);
 
 	string = g_value_get_string (source_value);
 	if (string == NULL || *string == '\0')
 		return FALSE;
 
-	source = e_source_list_peek_source_by_uid (source_list, string);
+	source = e_source_registry_lookup_by_uid (registry, string);
 	if (source != NULL) {
 		g_value_set_object (target_value, source);
 		success = TRUE;
diff --git a/e-util/e-util.h b/e-util/e-util.h
index 6560481..63057c1 100644
--- a/e-util/e-util.h
+++ b/e-util/e-util.h
@@ -31,7 +31,7 @@
 #include <e-util/e-marshal.h>
 #include <e-util/e-util-enums.h>
 
-#include <libedataserver/e-source-list.h>
+#include <libedataserver/e-source-registry.h>
 
 /* e_get_user_data_dir() used to live here, so #include its new home
  * for backward-compatibility (not that we really care about that). */
@@ -141,10 +141,6 @@ gchar *		e_util_guess_mime_type		(const gchar *filename,
 GSList *	e_util_get_category_filter_options
 						(void);
 
-void		e_util_set_source_combo_box_list
-						(GtkWidget *source_combo_box,
-						 const gchar *source_gconf_path);
-
 /* Useful GBinding transformation functions */
 gboolean	e_binding_transform_color_to_string
 						(GBinding *binding,
@@ -170,12 +166,12 @@ gboolean	e_binding_transform_source_to_uid
 						(GBinding *binding,
 						 const GValue *source_value,
 						 GValue *target_value,
-						 ESourceList *source_list);
+						 ESourceRegistry *registry);
 gboolean	e_binding_transform_uid_to_source
 						(GBinding *binding,
 						 const GValue *source_value,
 						 GValue *target_value,
-						 ESourceList *source_list);
+						 ESourceRegistry *registry);
 
 G_END_DECLS
 
diff --git a/e-util/gtk-compat.h b/e-util/gtk-compat.h
index 7e4ab69..4a0e750 100644
--- a/e-util/gtk-compat.h
+++ b/e-util/gtk-compat.h
@@ -73,7 +73,7 @@ gdk_window_get_height (GdkWindow *window)
 #endif
 
 #if GTK_CHECK_VERSION (2,23,0)
-#define GTK_COMBO_BOX_ENTRY			GTK_COMBO_BOX
+#define GTK_COMBO_BOX_ENTRY		GTK_COMBO_BOX
 
 #define ENSURE_GTK_COMBO_BOX_ENTRY_TYPE						\
 	GType gtk_combo_box_entry_get_type (void);				\
@@ -120,8 +120,11 @@ gdk_window_get_height (GdkWindow *window)
 		object_class->constructor = gtk_combo_box_entry_constructor;	\
 	}
 #else
-#define gtk_combo_box_set_entry_text_column \
-	gtk_combo_box_entry_set_text_column
+#define gtk_combo_box_new_with_entry \
+	gtk_combo_box_entry_new
+#define gtk_combo_box_set_entry_text_column(combo_box, column) \
+	(gtk_combo_box_entry_set_text_column \
+	(GTK_COMBO_BOX_ENTRY (combo_box), column))
 #endif
 
 #if GTK_CHECK_VERSION (2,90,5)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]