diff options
Diffstat (limited to 'e-util')
-rw-r--r-- | e-util/Makefile.am | 2 | ||||
-rw-r--r-- | e-util/e-util.c | 37 | ||||
-rw-r--r-- | e-util/e-util.h | 9 |
3 files changed, 31 insertions, 17 deletions
diff --git a/e-util/Makefile.am b/e-util/Makefile.am index be155b52bd..eb8c2e9bd8 100644 --- a/e-util/Makefile.am +++ b/e-util/Makefile.am @@ -34,7 +34,7 @@ INCLUDES = \ -DSEARCH_RULE_DIR=\"$(ruledir)\" \ -DG_LOG_DOMAIN=\"e-utils\" \ $(GNOME_PILOT_CFLAGS) \ - $(ICONV_CFLAGS) \ + $(ICONV_CFLAGS) \ $(E_UTIL_CFLAGS) privsolib_LTLIBRARIES = libeutil.la libeconduit.la diff --git a/e-util/e-util.c b/e-util/e-util.c index e4e9a3ac32..02c76c3d32 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -1529,23 +1529,32 @@ e_util_read_file (const char *filename, gboolean filename_is_uri, char **buffer, return res; } -GSList * -e_util_get_category_filter_options (void) +static gpointer +e_camel_object_copy (gpointer camel_object) { - GSList *res = NULL; - GList *clist, *l; + if (CAMEL_IS_OBJECT (camel_object)) + camel_object_ref (camel_object); - clist = e_categories_get_list (); - for (l = clist; l; l = l->next) { - const char *cname = l->data; - struct _filter_option *fo = g_new0 (struct _filter_option, 1); + return camel_object; +} - fo->title = g_strdup (cname); - fo->value = g_strdup (cname); - res = g_slist_prepend (res, fo); - } +static void +e_camel_object_free (gpointer camel_object) +{ + if (CAMEL_IS_OBJECT (camel_object)) + camel_object_unref (camel_object); +} + +GType +e_camel_object_get_type (void) +{ + static GType type = 0; - g_list_free (clist); + if (G_UNLIKELY (type == 0)) + type = g_boxed_type_register_static ( + "ECamelObject", + (GBoxedCopyFunc) e_camel_object_copy, + (GBoxedFreeFunc) e_camel_object_free); - return g_slist_reverse (res); + return type; } diff --git a/e-util/e-util.h b/e-util/e-util.h index 744b4a7a9d..168b497da7 100644 --- a/e-util/e-util.h +++ b/e-util/e-util.h @@ -27,6 +27,7 @@ #include <gtk/gtk.h> #include <limits.h> #include <gconf/gconf-client.h> +#include <camel/camel-object.h> #include <cairo.h> #include <e-util/e-marshal.h> @@ -131,7 +132,8 @@ gboolean e_file_lock_create (void); void e_file_lock_destroy (void); gboolean e_file_lock_exists (void); -gchar * e_util_guess_mime_type (const gchar *filename, gboolean localfile); +gchar * e_util_guess_mime_type (const gchar *filename, + gboolean localfile); gchar * e_util_filename_to_uri (const gchar *filename); gchar * e_util_uri_to_filename (const gchar *uri); @@ -141,7 +143,10 @@ gboolean e_util_read_file (const gchar *filename, gsize *read, GError **error); -GSList *e_util_get_category_filter_options (void); +/* Camel uses its own object system, so we have to box + * CamelObjects to safely use them as GObject properties. */ +#define E_TYPE_CAMEL_OBJECT (e_camel_object_get_type ()) +GType e_camel_object_get_type (void); G_END_DECLS |