[evolution] Use libevolution-utils all over evolution.



commit 147687c60f59d6b8a9d484750119102329b6be04
Author: Srinivasa Ragavan <sragavan gnome org>
Date:   Wed Feb 29 18:37:54 2012 +0530

    Use libevolution-utils all over evolution.

 e-util/Makefile.am                  |    1 +
 e-util/e-util.c                     |   67 -----------------------------------
 e-util/e-util.h                     |    4 --
 filter/Makefile.am                  |    2 +-
 libevolution-utils/Makefile.am      |    1 +
 libevolution-utils/evolution-util.c |   66 ++++++++++++++++++++++++++++++++++
 libevolution-utils/evolution-util.h |    8 ++++-
 7 files changed, 76 insertions(+), 73 deletions(-)
---
diff --git a/e-util/Makefile.am b/e-util/Makefile.am
index 4480387..0087a21 100644
--- a/e-util/Makefile.am
+++ b/e-util/Makefile.am
@@ -116,6 +116,7 @@ libeutil_la_SOURCES =				\
 libeutil_la_LDFLAGS = -avoid-version $(NO_UNDEFINED)
 
 libeutil_la_LIBADD = 			\
+	$(top_builddir)/libevolution-utils/libevolution-utils.la	\
 	$(ICONV_LIBS)			\
 	$(EVOLUTION_DATA_SERVER_LIBS)	\
 	$(GNOME_PLATFORM_LIBS)		\
diff --git a/e-util/e-util.c b/e-util/e-util.c
index 717f99b..109ee1b 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -478,73 +478,6 @@ e_lookup_action_group (GtkUIManager *ui_manager,
 }
 
 /**
- * e_builder_get_widget:
- * @builder: a #GtkBuilder
- * @widget_name: name of a widget in @builder
- *
- * Gets the widget named @widget_name.  Note that this function does not
- * increment the reference count of the returned widget.  If @widget_name
- * could not be found in the @builder<!-- -->'s object tree, a run-time
- * warning is emitted since this usually indicates a programming error.
- *
- * This is a convenience function to work around the awkwardness of
- * #GtkBuilder returning #GObject pointers, when the vast majority of
- * the time you want a #GtkWidget pointer.
- *
- * If you need something from @builder other than a #GtkWidget, or you
- * want to test for the existence of some widget name without incurring
- * a run-time warning, use gtk_builder_get_object().
- *
- * Returns: the widget named @widget_name, or %NULL
- **/
-GtkWidget *
-e_builder_get_widget (GtkBuilder *builder,
-                      const gchar *widget_name)
-{
-	GObject *object;
-
-	g_return_val_if_fail (GTK_IS_BUILDER (builder), NULL);
-	g_return_val_if_fail (widget_name != NULL, NULL);
-
-	object = gtk_builder_get_object (builder, widget_name);
-	if (object == NULL) {
-		g_warning ("Could not find widget '%s'", widget_name);
-		return NULL;
-	}
-
-	return GTK_WIDGET (object);
-}
-
-/**
- * e_load_ui_builder_definition:
- * @builder: a #GtkBuilder
- * @basename: basename of the UI definition file
- *
- * Loads a UI definition into @builder from Evolution's UI directory.
- * Failure here is fatal, since the application can't function without
- * its UI definitions.
- **/
-void
-e_load_ui_builder_definition (GtkBuilder *builder,
-                              const gchar *basename)
-{
-	gchar *filename;
-	GError *error = NULL;
-
-	g_return_if_fail (GTK_IS_BUILDER (builder));
-	g_return_if_fail (basename != NULL);
-
-	filename = g_build_filename (EVOLUTION_UIDIR, basename, NULL);
-	gtk_builder_add_from_file (builder, filename, &error);
-	g_free (filename);
-
-	if (error != NULL) {
-		g_error ("%s: %s", basename, error->message);
-		g_assert_not_reached ();
-	}
-}
-
-/**
  * e_action_compare_by_label:
  * @action1: a #GtkAction
  * @action2: a #GtkAction
diff --git a/e-util/e-util.h b/e-util/e-util.h
index 1bca2ea..bd9ad2d 100644
--- a/e-util/e-util.h
+++ b/e-util/e-util.h
@@ -64,10 +64,6 @@ GtkAction *	e_lookup_action			(GtkUIManager *ui_manager,
 						 const gchar *action_name);
 GtkActionGroup *e_lookup_action_group		(GtkUIManager *ui_manager,
 						 const gchar *group_name);
-GtkWidget *	e_builder_get_widget		(GtkBuilder *builder,
-						 const gchar *widget_name);
-void		e_load_ui_builder_definition	(GtkBuilder *builder,
-						 const gchar *basename);
 gint		e_action_compare_by_label	(GtkAction *action1,
 						 GtkAction *action2);
 void		e_action_group_remove_all_actions
diff --git a/filter/Makefile.am b/filter/Makefile.am
index ad8c9b3..0c2db0a 100644
--- a/filter/Makefile.am
+++ b/filter/Makefile.am
@@ -56,7 +56,7 @@ libfilter_la_SOURCES =				\
 libfilter_la_LDFLAGS = -avoid-version $(NO_UNDEFINED)
 
 libfilter_la_LIBADD = 				\
-	$(top_builddir)/e-util/libeutil.la	\
+	$(top_builddir)/libevolution-utils/libevolution-utils.la	\
 	$(EVOLUTION_DATA_SERVER_LIBS)		\
 	$(GNOME_PLATFORM_LIBS)			\
 	$(REGEX_LIBS)
diff --git a/libevolution-utils/Makefile.am b/libevolution-utils/Makefile.am
index 82798ad..617e9e3 100644
--- a/libevolution-utils/Makefile.am
+++ b/libevolution-utils/Makefile.am
@@ -7,6 +7,7 @@ libevolution_utils_la_CPPFLAGS = \
 	-I$(top_srcdir) \
 	-I$(top_builddir) \
 	-DEVOLUTION_PRIVDATADIR=\""$(privdatadir)"\" \
+	-DEVOLUTION_UIDIR=\""$(uidir)"\"	\
 	$(EVOLUTION_DATA_SERVER_CFLAGS) \
 	$(GNOME_PLATFORM_CFLAGS) \
 	$(NULL)
diff --git a/libevolution-utils/evolution-util.c b/libevolution-utils/evolution-util.c
index 23d3b51..e6c6e84 100644
--- a/libevolution-utils/evolution-util.c
+++ b/libevolution-utils/evolution-util.c
@@ -258,3 +258,69 @@ e_ascii_dtostr (gchar *buffer,
 	return buffer;
 }
 
+/**
+ * e_builder_get_widget:
+ * @builder: a #GtkBuilder
+ * @widget_name: name of a widget in @builder
+ *
+ * Gets the widget named @widget_name.  Note that this function does not
+ * increment the reference count of the returned widget.  If @widget_name
+ * could not be found in the @builder<!-- -->'s object tree, a run-time
+ * warning is emitted since this usually indicates a programming error.
+ *
+ * This is a convenience function to work around the awkwardness of
+ * #GtkBuilder returning #GObject pointers, when the vast majority of
+ * the time you want a #GtkWidget pointer.
+ *
+ * If you need something from @builder other than a #GtkWidget, or you
+ * want to test for the existence of some widget name without incurring
+ * a run-time warning, use gtk_builder_get_object().
+ *
+ * Returns: the widget named @widget_name, or %NULL
+ **/
+GtkWidget *
+e_builder_get_widget (GtkBuilder *builder,
+                      const gchar *widget_name)
+{
+	GObject *object;
+
+	g_return_val_if_fail (GTK_IS_BUILDER (builder), NULL);
+	g_return_val_if_fail (widget_name != NULL, NULL);
+
+	object = gtk_builder_get_object (builder, widget_name);
+	if (object == NULL) {
+		g_warning ("Could not find widget '%s'", widget_name);
+		return NULL;
+	}
+
+	return GTK_WIDGET (object);
+}
+
+/**
+ * e_load_ui_builder_definition:
+ * @builder: a #GtkBuilder
+ * @basename: basename of the UI definition file
+ *
+ * Loads a UI definition into @builder from Evolution's UI directory.
+ * Failure here is fatal, since the application can't function without
+ * its UI definitions.
+ **/
+void
+e_load_ui_builder_definition (GtkBuilder *builder,
+                              const gchar *basename)
+{
+	gchar *filename;
+	GError *error = NULL;
+
+	g_return_if_fail (GTK_IS_BUILDER (builder));
+	g_return_if_fail (basename != NULL);
+
+	filename = g_build_filename (EVOLUTION_UIDIR, basename, NULL);
+	gtk_builder_add_from_file (builder, filename, &error);
+	g_free (filename);
+
+	if (error != NULL) {
+		g_error ("%s: %s", basename, error->message);
+		g_assert_not_reached ();
+	}
+}
diff --git a/libevolution-utils/evolution-util.h b/libevolution-utils/evolution-util.h
index 5d1830b..9493453 100644
--- a/libevolution-utils/evolution-util.h
+++ b/libevolution-utils/evolution-util.h
@@ -25,7 +25,7 @@
 
 #include <sys/types.h>
 #include <glib.h>
-
+#include <gtk/gtk.h>
 /* String to/from double conversion functions */
 gdouble		e_flexible_strtod		(const gchar *nptr,
 						 gchar **endptr);
@@ -39,4 +39,10 @@ gchar *		e_ascii_dtostr			(gchar *buffer,
 						 const gchar *format,
 						 gdouble d);
 
+GtkWidget *	e_builder_get_widget		(GtkBuilder *builder,
+						 const gchar *widget_name);
+void		e_load_ui_builder_definition	(GtkBuilder *builder,
+						 const gchar *basename);
+
+
 #endif /* EVOLUTION_UTIL_H */



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