aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-08-03 06:24:58 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-08-03 06:24:58 +0800
commit8b9b15e2add08a6c0e698e6d0e0e0fc072cf1fc0 (patch)
treef7f7fecf16bb927d40d1234e5619669a9e042d18
parent3c0bd9186ef18a5e080d4f346a308d49b003c743 (diff)
downloadgsoc2013-evolution-8b9b15e2add08a6c0e698e6d0e0e0fc072cf1fc0.tar.gz
gsoc2013-evolution-8b9b15e2add08a6c0e698e6d0e0e0fc072cf1fc0.tar.zst
gsoc2013-evolution-8b9b15e2add08a6c0e698e6d0e0e0fc072cf1fc0.zip
Wrap some debug printf's with d().
2001-08-02 Jeffrey Stedfast <fejj@ximian.com> * filter-rule.c: Wrap some debug printf's with d(). * rule-context.h: Removed prototype for rule_context_delete_rule() since the function doesn't exist. svn path=/trunk/; revision=11600
-rw-r--r--filter/ChangeLog7
-rw-r--r--filter/filter-editor.c81
-rw-r--r--filter/filter-rule.c101
-rw-r--r--filter/rule-context.h2
4 files changed, 98 insertions, 93 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog
index 57f97dfc0c..2182fbeebe 100644
--- a/filter/ChangeLog
+++ b/filter/ChangeLog
@@ -1,3 +1,10 @@
+2001-08-02 Jeffrey Stedfast <fejj@ximian.com>
+
+ * filter-rule.c: Wrap some debug printf's with d().
+
+ * rule-context.h: Removed prototype for rule_context_delete_rule()
+ since the function doesn't exist.
+
2001-07-23 Jon Trowbridge <trow@ximian.com>
* vfolder-rule.c (validate): Added a validate function
diff --git a/filter/filter-editor.c b/filter/filter-editor.c
index 51e0c6be30..b27270179d 100644
--- a/filter/filter-editor.c
+++ b/filter/filter-editor.c
@@ -82,14 +82,14 @@ filter_editor_class_init (FilterEditorClass *class)
{
GtkObjectClass *object_class = (GtkObjectClass *)class;
RuleEditorClass *re_class = (RuleEditorClass *)class;
-
- parent_class = gtk_type_class(gnome_dialog_get_type ());
+
+ parent_class = gtk_type_class (gnome_dialog_get_type ());
object_class->finalize = filter_editor_finalise;
-
+
/* override methods */
re_class->create_rule = create_rule;
-
+
/* signals */
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
@@ -105,10 +105,10 @@ static void
filter_editor_finalise (GtkObject *obj)
{
FilterEditor *o = (FilterEditor *)obj;
-
+
g_free(o->priv);
-
- ((GtkObjectClass *)(parent_class))->finalize(obj);
+
+ ((GtkObjectClass *)(parent_class))->finalize (obj);
}
/**
@@ -124,15 +124,15 @@ filter_editor_new(FilterContext *f, const char **source_names)
FilterEditor *o = (FilterEditor *)gtk_type_new (filter_editor_get_type ());
GladeXML *gui;
GtkWidget *w;
-
- gui = glade_xml_new(FILTER_GLADEDIR "/filter.glade", "rule_editor");
- filter_editor_construct(o, f, gui, source_names);
-
- w = glade_xml_get_widget(gui, "rule_frame");
- gtk_frame_set_label((GtkFrame *)w, _("Filter Rules"));
-
- gtk_object_unref((GtkObject *)gui);
-
+
+ gui = glade_xml_new (FILTER_GLADEDIR "/filter.glade", "rule_editor");
+ filter_editor_construct (o, f, gui, source_names);
+
+ w = glade_xml_get_widget (gui, "rule_frame");
+ gtk_frame_set_label (GTK_FRAME (w), _("Filter Rules"));
+
+ gtk_object_unref (GTK_OBJECT (gui));
+
return o;
}
@@ -141,48 +141,47 @@ select_source (GtkMenuItem *mi, FilterEditor *fe)
{
char *source;
- source = gtk_object_get_data(GTK_OBJECT(mi), "source");
- g_assert(source);
-
- rule_editor_set_source((RuleEditor *)fe, source);
+ source = gtk_object_get_data (GTK_OBJECT (mi), "source");
+ g_assert (source);
+
+ rule_editor_set_source ((RuleEditor *)fe, source);
}
void
-filter_editor_construct(FilterEditor *fe, FilterContext *fc, GladeXML *gui, const char **source_names)
+filter_editor_construct (FilterEditor *fe, FilterContext *fc, GladeXML *gui, const char **source_names)
{
GtkWidget *menu, *item, *omenu;
int i;
-
+
omenu = glade_xml_get_widget (gui, "filter_source");
gtk_option_menu_remove_menu (GTK_OPTION_MENU (omenu));
menu = gtk_menu_new ();
- for (i=0;source_names[i];i++) {
- item = gtk_menu_item_new_with_label(_(source_names[i]));
- gtk_object_set_data_full(GTK_OBJECT(item), "source", g_strdup(source_names[i]), g_free);
- gtk_menu_append(GTK_MENU(menu), item);
- gtk_widget_show((GtkWidget *)item);
- gtk_signal_connect(GTK_OBJECT(item), "activate", select_source, fe);
-
+ for (i = 0; source_names[i]; i++) {
+ item = gtk_menu_item_new_with_label (_(source_names[i]));
+ gtk_object_set_data_full (GTK_OBJECT (item), "source", g_strdup (source_names[i]), g_free);
+ gtk_menu_append (GTK_MENU (menu), item);
+ gtk_widget_show (item);
+ gtk_signal_connect (GTK_OBJECT (item), "activate", select_source, fe);
}
- gtk_option_menu_set_menu(GTK_OPTION_MENU(omenu), menu);
- gtk_widget_show((GtkWidget *)omenu);
-
- rule_editor_construct((RuleEditor *)fe, (RuleContext *)fc, gui, source_names[0]);
+ gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
+ gtk_widget_show (omenu);
+
+ rule_editor_construct ((RuleEditor *)fe, (RuleContext *)fc, gui, source_names[0]);
}
static FilterRule *
-create_rule(RuleEditor *re)
+create_rule (RuleEditor *re)
{
- FilterRule *rule = filter_rule_new();
+ FilterRule *rule = filter_rule_new ();
FilterPart *part;
-
+
/* create a rule with 1 part & 1 action in it */
- rule = (FilterRule *)filter_filter_new();
- part = rule_context_next_part(re->context, NULL);
- filter_rule_add_part(rule, filter_part_clone(part));
+ rule = (FilterRule *)filter_filter_new ();
+ part = rule_context_next_part (re->context, NULL);
+ filter_rule_add_part (rule, filter_part_clone (part));
part = filter_context_next_action ((FilterContext *)re->context, NULL);
- filter_filter_add_action((FilterFilter *)rule, filter_part_clone (part));
-
+ filter_filter_add_action ((FilterFilter *)rule, filter_part_clone (part));
+
return rule;
}
diff --git a/filter/filter-rule.c b/filter/filter-rule.c
index d63dd5df7e..cbab69ff16 100644
--- a/filter/filter-rule.c
+++ b/filter/filter-rule.c
@@ -153,24 +153,24 @@ filter_rule_clone(FilterRule *base, RuleContext *f)
{
xmlNodePtr xml;
FilterRule *rule;
-
- g_assert(IS_FILTER_RULE(base));
- g_assert(IS_RULE_CONTEXT(f));
-
+
+ g_assert (IS_FILTER_RULE (base));
+ g_assert (IS_RULE_CONTEXT (f));
+
/* TODO: do this more directly/efficiently */
- xml = filter_rule_xml_encode(base);
- rule = gtk_type_new(((GtkObject *)base)->klass->type);
- filter_rule_xml_decode(rule, xml, f);
- xmlFreeNodeList(xml);
-
+ xml = filter_rule_xml_encode (base);
+ rule = gtk_type_new (GTK_OBJECT (base)->klass->type);
+ filter_rule_xml_decode (rule, xml, f);
+ xmlFreeNodeList (xml);
+
return rule;
}
void
filter_rule_set_name (FilterRule *fr, const char *name)
{
- g_assert(IS_FILTER_RULE(fr));
-
+ g_assert (IS_FILTER_RULE (fr));
+
g_free (fr->name);
fr->name = g_strdup (name);
}
@@ -178,8 +178,8 @@ filter_rule_set_name (FilterRule *fr, const char *name)
void
filter_rule_set_source (FilterRule *fr, const char *source)
{
- g_assert(IS_FILTER_RULE(fr));
-
+ g_assert (IS_FILTER_RULE (fr));
+
g_free (fr->source);
fr->source = g_strdup (source);
}
@@ -187,9 +187,9 @@ filter_rule_set_source (FilterRule *fr, const char *source)
int
filter_rule_validate (FilterRule *fr)
{
- g_assert(IS_FILTER_RULE(fr));
-
- return ((FilterRuleClass *) ((GtkObject *) fr)->klass)->validate(fr);
+ g_assert (IS_FILTER_RULE (fr));
+
+ return ((FilterRuleClass *) ((GtkObject *) fr)->klass)->validate (fr);
}
static int
@@ -197,23 +197,23 @@ validate (FilterRule *fr)
{
int valid = TRUE;
GList *parts;
-
+
/* validate rule parts */
parts = fr->parts;
while (parts && valid) {
- valid = filter_part_validate((FilterPart *)parts->data);
+ valid = filter_part_validate ((FilterPart *)parts->data);
parts = parts->next;
}
-
+
return valid;
}
xmlNodePtr
filter_rule_xml_encode (FilterRule *fr)
{
- g_assert(IS_FILTER_RULE(fr));
-
- return ((FilterRuleClass *) ((GtkObject *) fr)->klass)->xml_encode(fr);
+ g_assert (IS_FILTER_RULE (fr));
+
+ return ((FilterRuleClass *) ((GtkObject *) fr)->klass)->xml_encode (fr);
}
static xmlNodePtr
@@ -231,7 +231,7 @@ xml_encode (FilterRule *fr)
xmlSetProp (node, "grouping", "any");
break;
}
-
+
if (fr->source) {
xmlSetProp (node, "source", fr->source);
} else {
@@ -241,12 +241,12 @@ xml_encode (FilterRule *fr)
if (fr->name) {
char *encstr;
-
+
work = xmlNewNode (NULL, "title");
- encstr = e_utf8_xml1_encode(fr->name);
- xmlNodeSetContent(work, encstr);
- g_free(encstr);
- xmlAddChild(node, work);
+ encstr = e_utf8_xml1_encode (fr->name);
+ xmlNodeSetContent (work, encstr);
+ g_free (encstr);
+ xmlAddChild (node, work);
}
set = xmlNewNode (NULL, "partset");
@@ -291,11 +291,11 @@ load_set (xmlNodePtr node, FilterRule *fr, RuleContext *f)
int
filter_rule_xml_decode (FilterRule *fr, xmlNodePtr node, RuleContext *f)
{
- g_assert(IS_FILTER_RULE(fr));
- g_assert(IS_RULE_CONTEXT(f));
- g_assert(node != NULL);
-
- return ((FilterRuleClass *) ((GtkObject *) fr)->klass)->xml_decode(fr, node, f);
+ g_assert (IS_FILTER_RULE (fr));
+ g_assert (IS_RULE_CONTEXT (f));
+ g_assert (node != NULL);
+
+ return ((FilterRuleClass *) ((GtkObject *) fr)->klass)->xml_decode (fr, node, f);
}
static int
@@ -336,7 +336,8 @@ xml_decode (FilterRule *fr, xmlNodePtr node, RuleContext *f)
gchar *str, *decstr;
str = xmlNodeGetContent (work);
decstr = e_utf8_xml1_decode (str);
- if (str) xmlFree (str);
+ if (str)
+ xmlFree (str);
fr->name = decstr;
}
}
@@ -349,18 +350,18 @@ xml_decode (FilterRule *fr, xmlNodePtr node, RuleContext *f)
void
filter_rule_add_part (FilterRule *fr, FilterPart *fp)
{
- g_assert(IS_FILTER_RULE(fr));
- g_assert(IS_FILTER_PART(fp));
-
+ g_assert (IS_FILTER_RULE (fr));
+ g_assert (IS_FILTER_PART (fp));
+
fr->parts = g_list_append (fr->parts, fp);
}
void
filter_rule_remove_part (FilterRule *fr, FilterPart *fp)
{
- g_assert(IS_FILTER_RULE(fr));
- g_assert(IS_FILTER_PART(fp));
-
+ g_assert (IS_FILTER_RULE (fr));
+ g_assert (IS_FILTER_PART (fp));
+
fr->parts = g_list_remove (fr->parts, fp);
}
@@ -368,10 +369,10 @@ void
filter_rule_replace_part (FilterRule *fr, FilterPart *fp, FilterPart *new)
{
GList *l;
-
- g_assert(IS_FILTER_RULE(fr));
- g_assert(IS_FILTER_PART(fp));
- g_assert(IS_FILTER_PART(new));
+
+ g_assert (IS_FILTER_RULE (fr));
+ g_assert (IS_FILTER_PART (fp));
+ g_assert (IS_FILTER_PART (new));
l = g_list_find (fr->parts, fp);
if (l) {
@@ -384,12 +385,12 @@ filter_rule_replace_part (FilterRule *fr, FilterPart *fp, FilterPart *new)
void
filter_rule_build_code (FilterRule *fr, GString *out)
{
- g_assert(IS_FILTER_RULE(fr));
- g_assert(out != NULL);
-
- ((FilterRuleClass *) ((GtkObject *) fr)->klass)->build_code(fr, out);
-
- g_message ("build_code: [%s](%d)", out->str, out->len);
+ g_assert (IS_FILTER_RULE (fr));
+ g_assert (out != NULL);
+
+ ((FilterRuleClass *) ((GtkObject *) fr)->klass)->build_code (fr, out);
+
+ d(printf ("build_code: [%s](%d)", out->str, out->len));
}
static void
diff --git a/filter/rule-context.h b/filter/rule-context.h
index 6c279edd80..a06bad9acd 100644
--- a/filter/rule-context.h
+++ b/filter/rule-context.h
@@ -105,8 +105,6 @@ void rule_context_remove_rule(RuleContext *f, FilterRule *rule);
void rule_context_rank_rule(RuleContext *f, FilterRule *rule, int rank);
int rule_context_get_rank_rule(RuleContext *f, FilterRule *rule, const char *source);
-void rule_context_delete_rule(RuleContext *f, FilterRule *rule);
-
/* setup type for set parts */
void rule_context_add_part_set(RuleContext *f, const char *setname, int part_type, RCPartFunc append, RCNextPartFunc next);
void rule_context_add_rule_set(RuleContext *f, const char *setname, int rule_type, RCRuleFunc append, RCNextRuleFunc next);