aboutsummaryrefslogtreecommitdiffstats
path: root/filter/filter-element.c
diff options
context:
space:
mode:
Diffstat (limited to 'filter/filter-element.c')
-rw-r--r--filter/filter-element.c80
1 files changed, 47 insertions, 33 deletions
diff --git a/filter/filter-element.c b/filter/filter-element.c
index 58e68350a4..40a9357598 100644
--- a/filter/filter-element.c
+++ b/filter/filter-element.c
@@ -28,6 +28,7 @@
#include "filter-colour.h"
#include "filter-datespec.h"
#include "filter-score.h"
+#include "filter-url.h"
#include "filter-folder.h"
static void xml_create(FilterElement *fe, xmlNodePtr node);
@@ -77,7 +78,7 @@ filter_element_class_init (FilterElementClass *class)
GtkObjectClass *object_class;
object_class = (GtkObjectClass *)class;
- parent_class = gtk_type_class(gtk_object_get_type ());
+ parent_class = gtk_type_class (gtk_object_get_type ());
object_class->finalize = filter_element_finalise;
@@ -87,17 +88,17 @@ filter_element_class_init (FilterElementClass *class)
/* signals */
- gtk_object_class_add_signals(object_class, signals, LAST_SIGNAL);
+ gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
}
static void
filter_element_init (FilterElement *o)
{
- o->priv = g_malloc0(sizeof(*o->priv));
+ o->priv = g_malloc0 (sizeof (*o->priv));
}
static void
-filter_element_finalise(GtkObject *obj)
+filter_element_finalise (GtkObject *obj)
{
FilterElement *o = (FilterElement *)obj;
@@ -114,7 +115,7 @@ filter_element_finalise(GtkObject *obj)
* Return value: A new #FilterElement object.
**/
FilterElement *
-filter_element_new(void)
+filter_element_new (void)
{
FilterElement *o = (FilterElement *)gtk_type_new(filter_element_get_type ());
return o;
@@ -122,106 +123,114 @@ filter_element_new(void)
/**
* filter_element_xml_create:
- * @fe:
- * @node:
+ * @fe: filter element
+ * @node: xml node
*
* Create a new filter element based on an xml definition of
* that element.
**/
-void filter_element_xml_create (FilterElement *fe, xmlNodePtr node)
+void
+filter_element_xml_create (FilterElement *fe, xmlNodePtr node)
{
return ((FilterElementClass *)((GtkObject *)fe)->klass)->xml_create(fe, node);
}
/**
* filter_element_xml_encode:
- * @fe:
+ * @fe: filter element
*
* Encode the values of a filter element into xml format.
*
* Return value:
**/
-xmlNodePtr filter_element_xml_encode (FilterElement *fe)
+xmlNodePtr
+filter_element_xml_encode (FilterElement *fe)
{
return ((FilterElementClass *)((GtkObject *)fe)->klass)->xml_encode(fe);
}
/**
* filter_element_xml_decode:
- * @fe:
- * @node:
+ * @fe: filter element
+ * @node: xml node
*
* Decode the values of a fitler element from xml format.
*
* Return value:
**/
-int filter_element_xml_decode (FilterElement *fe, xmlNodePtr node)
+int
+filter_element_xml_decode (FilterElement *fe, xmlNodePtr node)
{
return ((FilterElementClass *)((GtkObject *)fe)->klass)->xml_decode(fe, node);
}
/**
* filter_element_clone:
- * @fe:
+ * @fe: filter element
*
* Clones the FilterElement @fe.
*
* Return value:
**/
-FilterElement *filter_element_clone (FilterElement *fe)
+FilterElement *
+filter_element_clone (FilterElement *fe)
{
return ((FilterElementClass *)((GtkObject *)fe)->klass)->clone(fe);
}
/**
* filter_element_get_widget:
- * @fe:
- * @node:
+ * @fe: filter element
+ * @node: xml node
*
* Create a widget to represent this element.
*
* Return value:
**/
-GtkWidget *filter_element_get_widget (FilterElement *fe)
+GtkWidget *
+filter_element_get_widget (FilterElement *fe)
{
return ((FilterElementClass *)((GtkObject *)fe)->klass)->get_widget(fe);
}
/**
* filter_element_build_code:
- * @fe:
- * @out:
+ * @fe: filter element
+ * @out: output buffer
* @ff:
*
* Add the code representing this element to the output string @out.
**/
-void filter_element_build_code (FilterElement *fe, GString *out, struct _FilterPart *ff)
+void
+filter_element_build_code (FilterElement *fe, GString *out, struct _FilterPart *ff)
{
return ((FilterElementClass *)((GtkObject *)fe)->klass)->build_code(fe, out, ff);
}
/**
* filter_element_format_sexp:
- * @fe:
- * @out:
+ * @fe: filter element
+ * @out: output buffer
*
* Format the value(s) of this element in a method suitable for the context of
* sexp where it is used. Usually as space separated, double-quoted strings.
**/
-void filter_element_format_sexp (FilterElement *fe, GString *out)
+void
+filter_element_format_sexp (FilterElement *fe, GString *out)
{
return ((FilterElementClass *)((GtkObject *)fe)->klass)->format_sexp(fe, out);
}
/**
* filter_element_new_type_name:
- * @type:
+ * @type: filter element type
*
* Create a new filter element based on its type name.
*
* Return value:
**/
-FilterElement *filter_element_new_type_name (const char *type)
+FilterElement *
+filter_element_new_type_name (const char *type)
{
if (type == NULL)
return NULL;
@@ -243,6 +252,8 @@ FilterElement *filter_element_new_type_name (const char *type)
return (FilterElement *)filter_datespec_new ();
} else if (!strcmp (type, "score")) {
return (FilterElement *)filter_score_new ();
+ } else if (!strcmp (type, "url")) {
+ return (FilterElement *)filter_url_new ();
} else {
g_warning("Unknown filter type '%s'", type);
return 0;
@@ -250,20 +261,23 @@ FilterElement *filter_element_new_type_name (const char *type)
}
/* default implementations */
-static void xml_create(FilterElement *fe, xmlNodePtr node)
+static void
+xml_create (FilterElement *fe, xmlNodePtr node)
{
- fe->name = xmlGetProp(node, "name");
+ fe->name = xmlGetProp (node, "name");
}
-static FilterElement *clone(FilterElement *fe)
+static FilterElement *
+clone (FilterElement *fe)
{
xmlNodePtr node;
FilterElement *new;
- new = (FilterElement *)gtk_type_new( ((GtkObject *)fe)->klass->type );
- node = filter_element_xml_encode(fe);
- filter_element_xml_decode(new, node);
- xmlFreeNodeList(node);
+ new = (FilterElement *)gtk_type_new (GTK_OBJECT (fe)->klass->type);
+ node = filter_element_xml_encode (fe);
+ filter_element_xml_decode (new, node);
+ xmlFreeNodeList (node);
+
return new;
}