diff options
author | Kjartan Maraas <kmaraas@gnome.org> | 2006-02-08 19:44:27 +0800 |
---|---|---|
committer | Kjartan Maraas <kmaraas@src.gnome.org> | 2006-02-08 19:44:27 +0800 |
commit | ea9e711fe9b31a61fa9ace5dd5d84740d216f182 (patch) | |
tree | 35b22724298a3f8e82da15193119417a725c694c | |
parent | 99d9556902279ce55280febc1cbf39980efd11df (diff) | |
download | gsoc2013-evolution-ea9e711fe9b31a61fa9ace5dd5d84740d216f182.tar.gz gsoc2013-evolution-ea9e711fe9b31a61fa9ace5dd5d84740d216f182.tar.zst gsoc2013-evolution-ea9e711fe9b31a61fa9ace5dd5d84740d216f182.zip |
Remove unused code Move around some code to avoid unneccesary prototypes.
2006-01-27 Kjartan Maraas <kmaraas@gnome.org>
* filter-element.c: (filter_element_get_type): Remove unused code
* rule-editor.c: (rule_editor_add_undo), (rule_editor_play_undo),
(editor_response), (set_source): Move around some code to avoid
unneccesary prototypes.
svn path=/trunk/; revision=31447
-rw-r--r-- | filter/ChangeLog | 7 | ||||
-rw-r--r-- | filter/filter-element.c | 2 | ||||
-rw-r--r-- | filter/rule-editor.c | 181 |
3 files changed, 96 insertions, 94 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog index c54301a00d..f42493fb13 100644 --- a/filter/ChangeLog +++ b/filter/ChangeLog @@ -1,3 +1,10 @@ +2006-01-27 Kjartan Maraas <kmaraas@gnome.org> + + * filter-element.c: (filter_element_get_type): Remove unused code + * rule-editor.c: (rule_editor_add_undo), (rule_editor_play_undo), + (editor_response), (set_source): Move around some code to avoid + unneccesary prototypes. + 2006-01-25 Not Zed <NotZed@Ximian.com> * filter-rule.[ch]: Added new thread-matching mode 'single' for diff --git a/filter/filter-element.c b/filter/filter-element.c index 14aef0a015..11b848216f 100644 --- a/filter/filter-element.c +++ b/filter/filter-element.c @@ -48,7 +48,6 @@ static void filter_element_init (FilterElement *fe); static void filter_element_finalise (GObject *obj); static GObjectClass *parent_class = NULL; -static GHashTable *fe_table; GType filter_element_get_type (void) @@ -67,7 +66,6 @@ filter_element_get_type (void) 0, /* n_preallocs */ (GInstanceInitFunc) filter_element_init, }; - fe_table = g_hash_table_new(g_str_hash, g_str_equal); type = g_type_register_static (G_TYPE_OBJECT, "FilterElement", &info, 0); } diff --git a/filter/rule-editor.c b/filter/rule-editor.c index bc356b1024..b10b00f7d5 100644 --- a/filter/rule-editor.c +++ b/filter/rule-editor.c @@ -37,9 +37,6 @@ static int enable_undo = 0; -void rule_editor_add_undo (RuleEditor *re, int type, FilterRule *rule, int rank, int newrank); -void rule_editor_play_undo (RuleEditor *re); - #define d(x) static void set_source (RuleEditor *re, const char *source); @@ -230,6 +227,95 @@ editor_destroy (RuleEditor *re, GObject *deadbeef) } static void +rule_editor_add_undo (RuleEditor *re, int type, FilterRule *rule, int rank, int newrank) +{ + RuleEditorUndo *undo; + + if (!re->undo_active && enable_undo) { + undo = g_malloc0 (sizeof (*undo)); + undo->rule = rule; + undo->type = type; + undo->rank = rank; + undo->newrank = newrank; + + undo->next = re->undo_log; + re->undo_log = undo; + } else { + g_object_unref (rule); + } +} + +static void +rule_editor_play_undo (RuleEditor *re) +{ + RuleEditorUndo *undo, *next; + FilterRule *rule; + + re->undo_active = TRUE; + undo = re->undo_log; + re->undo_log = NULL; + while (undo) { + next = undo->next; + switch (undo->type) { + case RULE_EDITOR_LOG_EDIT: + d(printf ("Undoing edit on rule '%s'\n", undo->rule->name)); + rule = rule_context_find_rank_rule (re->context, undo->rank, undo->rule->source); + if (rule) { + d(printf (" name was '%s'\n", rule->name)); + filter_rule_copy (rule, undo->rule); + d(printf (" name is '%s'\n", rule->name)); + } else { + g_warning ("Could not find the right rule to undo against?"); + } + break; + case RULE_EDITOR_LOG_ADD: + d(printf ("Undoing add on rule '%s'\n", undo->rule->name)); + rule = rule_context_find_rank_rule (re->context, undo->rank, undo->rule->source); + if (rule) + rule_context_remove_rule (re->context, rule); + break; + case RULE_EDITOR_LOG_REMOVE: + d(printf ("Undoing remove on rule '%s'\n", undo->rule->name)); + g_object_ref (undo->rule); + rule_context_add_rule (re->context, undo->rule); + rule_context_rank_rule (re->context, undo->rule, re->source, undo->rank); + break; + case RULE_EDITOR_LOG_RANK: + rule = rule_context_find_rank_rule (re->context, undo->newrank, undo->rule->source); + if (rule) + rule_context_rank_rule (re->context, rule, re->source, undo->rank); + break; + } + + g_object_unref (undo->rule); + g_free (undo); + undo = next; + } + re->undo_active = FALSE; +} + +static void +editor_response (GtkWidget *dialog, int button, RuleEditor *re) +{ + if (button == GTK_RESPONSE_CANCEL) { + if (enable_undo) + rule_editor_play_undo (re); + else { + RuleEditorUndo *undo, *next; + + undo = re->undo_log; + re->undo_log = 0; + while (undo) { + next = undo->next; + g_object_unref (undo->rule); + g_free (undo); + undo = next; + } + } + } +} + +static void add_editor_response (GtkWidget *dialog, int button, RuleEditor *re) { GtkTreeSelection *selection; @@ -621,95 +707,6 @@ set_source (RuleEditor *re, const char *source) rule_editor_set_sensitive (re); } -void -rule_editor_add_undo (RuleEditor *re, int type, FilterRule *rule, int rank, int newrank) -{ - RuleEditorUndo *undo; - - if (!re->undo_active && enable_undo) { - undo = g_malloc0 (sizeof (*undo)); - undo->rule = rule; - undo->type = type; - undo->rank = rank; - undo->newrank = newrank; - - undo->next = re->undo_log; - re->undo_log = undo; - } else { - g_object_unref (rule); - } -} - -void -rule_editor_play_undo (RuleEditor *re) -{ - RuleEditorUndo *undo, *next; - FilterRule *rule; - - re->undo_active = TRUE; - undo = re->undo_log; - re->undo_log = NULL; - while (undo) { - next = undo->next; - switch (undo->type) { - case RULE_EDITOR_LOG_EDIT: - d(printf ("Undoing edit on rule '%s'\n", undo->rule->name)); - rule = rule_context_find_rank_rule (re->context, undo->rank, undo->rule->source); - if (rule) { - d(printf (" name was '%s'\n", rule->name)); - filter_rule_copy (rule, undo->rule); - d(printf (" name is '%s'\n", rule->name)); - } else { - g_warning ("Could not find the right rule to undo against?"); - } - break; - case RULE_EDITOR_LOG_ADD: - d(printf ("Undoing add on rule '%s'\n", undo->rule->name)); - rule = rule_context_find_rank_rule (re->context, undo->rank, undo->rule->source); - if (rule) - rule_context_remove_rule (re->context, rule); - break; - case RULE_EDITOR_LOG_REMOVE: - d(printf ("Undoing remove on rule '%s'\n", undo->rule->name)); - g_object_ref (undo->rule); - rule_context_add_rule (re->context, undo->rule); - rule_context_rank_rule (re->context, undo->rule, re->source, undo->rank); - break; - case RULE_EDITOR_LOG_RANK: - rule = rule_context_find_rank_rule (re->context, undo->newrank, undo->rule->source); - if (rule) - rule_context_rank_rule (re->context, rule, re->source, undo->rank); - break; - } - - g_object_unref (undo->rule); - g_free (undo); - undo = next; - } - re->undo_active = FALSE; -} - -static void -editor_response (GtkWidget *dialog, int button, RuleEditor *re) -{ - if (button == GTK_RESPONSE_CANCEL) { - if (enable_undo) - rule_editor_play_undo (re); - else { - RuleEditorUndo *undo, *next; - - undo = re->undo_log; - re->undo_log = 0; - while (undo) { - next = undo->next; - g_object_unref (undo->rule); - g_free (undo); - undo = next; - } - } - } -} - GtkWidget *rule_editor_treeview_new (char *widget_name, char *string1, char *string2, int int1, int int2); |