From 23f5773903d64a554d977ae7d0ebbaca73528f1f Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 30 Nov 2011 20:53:20 -0600 Subject: Coding style and whitespace cleanup. --- filter/e-filter-datespec.c | 29 ++++++++++++++++++++--------- filter/e-filter-option.c | 12 +++++++++--- filter/e-filter-rule.c | 34 +++++++++++++++++++++++++--------- filter/e-rule-context.c | 11 ++++++++--- filter/e-rule-editor.c | 23 +++++++++++++++++------ 5 files changed, 79 insertions(+), 30 deletions(-) (limited to 'filter') diff --git a/filter/e-filter-datespec.c b/filter/e-filter-datespec.c index ef264d6205..4f7b659b52 100644 --- a/filter/e-filter-datespec.c +++ b/filter/e-filter-datespec.c @@ -47,6 +47,10 @@ #define localtime_r(tp,tmp) memcpy(tmp,localtime(tp),sizeof(struct tm)) #endif +#define E_FILTER_DATESPEC_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_FILTER_DATESPEC, EFilterDatespecPrivate)) + #define d(x) typedef struct { @@ -168,7 +172,7 @@ set_button (EFilterDatespec *fds) static void get_values (EFilterDatespec *fds) { - EFilterDatespecPrivate *p = fds->priv; + EFilterDatespecPrivate *p = E_FILTER_DATESPEC_GET_PRIVATE (fds); switch (fds->priv->type) { case FDST_SPECIFIED: { @@ -203,7 +207,7 @@ set_values (EFilterDatespec *fds) { gint note_type; - EFilterDatespecPrivate *p = fds->priv; + EFilterDatespecPrivate *p = E_FILTER_DATESPEC_GET_PRIVATE (fds); p->type = fds->type == FDST_UNKNOWN ? FDST_NOW : fds->type; @@ -270,7 +274,7 @@ static void button_clicked (GtkButton *button, EFilterDatespec *fds) { - EFilterDatespecPrivate *p = fds->priv; + EFilterDatespecPrivate *p = E_FILTER_DATESPEC_GET_PRIVATE (fds); GtkWidget *content_area; GtkWidget *toplevel; GtkDialog *dialog; @@ -298,9 +302,15 @@ button_clicked (GtkButton *button, set_values (fds); - g_signal_connect (p->combobox_type, "changed", G_CALLBACK (set_combobox_type), fds); - g_signal_connect (p->combobox_relative, "changed", G_CALLBACK (set_combobox_relative), fds); - g_signal_connect (p->combobox_past_future, "changed", G_CALLBACK (set_combobox_past_future), fds); + g_signal_connect ( + p->combobox_type, "changed", + G_CALLBACK (set_combobox_type), fds); + g_signal_connect ( + p->combobox_relative, "changed", + G_CALLBACK (set_combobox_relative), fds); + g_signal_connect ( + p->combobox_past_future, "changed", + G_CALLBACK (set_combobox_past_future), fds); content_area = gtk_dialog_get_content_area (dialog); gtk_box_pack_start (GTK_BOX (content_area), toplevel, TRUE, TRUE, 3); @@ -411,7 +421,9 @@ filter_datespec_get_widget (EFilterElement *element) button = gtk_button_new (); gtk_container_add (GTK_CONTAINER (button), fds->priv->label_button); - g_signal_connect (button, "clicked", G_CALLBACK (button_clicked), fds); + g_signal_connect ( + button, "clicked", + G_CALLBACK (button_clicked), fds); gtk_widget_show (button); gtk_widget_show (fds->priv->label_button); @@ -483,8 +495,7 @@ e_filter_datespec_class_init (EFilterDatespecClass *class) static void e_filter_datespec_init (EFilterDatespec *datespec) { - datespec->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - datespec, E_TYPE_FILTER_DATESPEC, EFilterDatespecPrivate); + datespec->priv = E_FILTER_DATESPEC_GET_PRIVATE (datespec); datespec->type = FDST_UNKNOWN; } diff --git a/filter/e-filter-option.c b/filter/e-filter-option.c index 2f5af12e3b..2f6c73454d 100644 --- a/filter/e-filter-option.c +++ b/filter/e-filter-option.c @@ -334,7 +334,9 @@ filter_option_get_widget (EFilterElement *element) if (op->is_dynamic) { break; } else { - e_filter_option_add (option, op->value, op->title, op->code, FALSE); + e_filter_option_add ( + option, op->value, + op->title, op->code, FALSE); } } @@ -343,7 +345,9 @@ filter_option_get_widget (EFilterElement *element) op = i->data; if (op) { - e_filter_option_add (option, op->value, op->title, op->code, TRUE); + e_filter_option_add ( + option, op->value, + op->title, op->code, TRUE); free_option (op); } } @@ -355,7 +359,9 @@ filter_option_get_widget (EFilterElement *element) op = l->data; if (!op->is_dynamic) - e_filter_option_add (option, op->value, op->title, op->code, FALSE); + e_filter_option_add ( + option, op->value, + op->title, op->code, FALSE); } if (old_cur) diff --git a/filter/e-filter-rule.c b/filter/e-filter-rule.c index 288e7a8be1..9ad66410d7 100644 --- a/filter/e-filter-rule.c +++ b/filter/e-filter-rule.c @@ -35,6 +35,10 @@ #include "e-filter-rule.h" #include "e-rule-context.h" +#define E_FILTER_RULE_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_FILTER_RULE, EFilterRulePrivate)) + typedef struct _FilterPartData FilterPartData; typedef struct _FilterRuleData FilterRuleData; @@ -161,7 +165,9 @@ get_rule_part_widget (ERuleContext *context, } gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), current); - g_signal_connect (combobox, "changed", G_CALLBACK (part_combobox_changed), data); + g_signal_connect ( + combobox, "changed", + G_CALLBACK (part_combobox_changed), data); gtk_widget_show (combobox); gtk_box_pack_start (GTK_BOX (hbox), combobox, FALSE, FALSE, 0); @@ -213,7 +219,9 @@ attach_rule (GtkWidget *rule, remove = gtk_button_new_from_stock (GTK_STOCK_REMOVE); g_object_set_data ((GObject *) remove, "rule", rule); - g_signal_connect (remove, "clicked", G_CALLBACK (less_parts), data); + g_signal_connect ( + remove, "clicked", + G_CALLBACK (less_parts), data); gtk_table_attach (GTK_TABLE (data->parts), remove, 1, 2, row, row + 1, 0, 0, 0, 0); @@ -252,7 +260,9 @@ more_parts (GtkWidget *button, l = g_list_last (data->rule->parts); part = l->data; if (!e_filter_part_validate (part, &alert)) { - e_alert_run_dialog (GTK_WINDOW (gtk_widget_get_toplevel (button)), alert); + GtkWidget *toplevel; + toplevel = gtk_widget_get_toplevel (button); + e_alert_run_dialog (GTK_WINDOW (toplevel), alert); return; } } @@ -283,7 +293,8 @@ more_parts (GtkWidget *button, if (w) { GtkAdjustment *adjustment; - adjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (w)); + adjustment = gtk_scrolled_window_get_vadjustment ( + GTK_SCROLLED_WINDOW (w)); if (adjustment) { gdouble upper; @@ -693,7 +704,9 @@ filter_rule_get_widget (EFilterRule *rule, gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), name, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); - g_signal_connect (name, "changed", G_CALLBACK (name_changed), rule); + g_signal_connect ( + name, "changed", + G_CALLBACK (name_changed), rule); gtk_widget_show (label); gtk_widget_show (hbox); @@ -796,7 +809,9 @@ filter_rule_get_widget (EFilterRule *rule, gtk_button_set_image ( GTK_BUTTON (add), gtk_image_new_from_stock ( GTK_STOCK_ADD, GTK_ICON_SIZE_BUTTON)); - g_signal_connect (add, "clicked", G_CALLBACK (more_parts), data); + g_signal_connect ( + add, "clicked", + G_CALLBACK (more_parts), data); gtk_box_pack_start (GTK_BOX (hbox), add, FALSE, FALSE, 12); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); @@ -825,7 +840,9 @@ filter_rule_get_widget (EFilterRule *rule, vadj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 1.0, 1.0, 1.0, 1.0)); scrolledwindow = gtk_scrolled_window_new (hadj, vadj); - g_signal_connect (hadj, "notify::upper", G_CALLBACK (ensure_scrolled_width_cb), scrolledwindow); + g_signal_connect ( + hadj, "notify::upper", + G_CALLBACK (ensure_scrolled_width_cb), scrolledwindow); gtk_scrolled_window_set_policy ( GTK_SCROLLED_WINDOW (scrolledwindow), @@ -875,8 +892,7 @@ e_filter_rule_class_init (EFilterRuleClass *class) static void e_filter_rule_init (EFilterRule *rule) { - rule->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - rule, E_TYPE_FILTER_RULE, EFilterRulePrivate); + rule->priv = E_FILTER_RULE_GET_PRIVATE (rule); rule->enabled = TRUE; } diff --git a/filter/e-rule-context.c b/filter/e-rule-context.c index 2f3daca6e7..9cedfa9a2f 100644 --- a/filter/e-rule-context.c +++ b/filter/e-rule-context.c @@ -54,6 +54,10 @@ #include "e-filter-rule.h" #include "e-rule-context.h" +#define E_RULE_CONTEXT_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_RULE_CONTEXT, ERuleContextPrivate)) + struct _ERuleContextPrivate { gint frozen; }; @@ -543,8 +547,7 @@ e_rule_context_class_init (ERuleContextClass *class) static void e_rule_context_init (ERuleContext *context) { - context->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - context, E_TYPE_RULE_CONTEXT, ERuleContextPrivate); + context->priv = E_RULE_CONTEXT_GET_PRIVATE (context); context->part_set_map = g_hash_table_new (g_str_hash, g_str_equal); context->rule_set_map = g_hash_table_new (g_str_hash, g_str_equal); @@ -813,7 +816,9 @@ e_rule_context_add_rule_gui (ERuleContext *context, if (path) g_object_set_data_full ((GObject *) dialog, "path", g_strdup (path), g_free); - g_signal_connect (dialog, "response", G_CALLBACK (new_rule_response), context); + g_signal_connect ( + dialog, "response", + G_CALLBACK (new_rule_response), context); g_object_ref (context); diff --git a/filter/e-rule-editor.c b/filter/e-rule-editor.c index eb52691c5b..280b6fdf48 100644 --- a/filter/e-rule-editor.c +++ b/filter/e-rule-editor.c @@ -37,6 +37,10 @@ #include "e-rule-editor.h" +#define E_RULE_EDITOR_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_RULE_EDITOR, ERuleEditorPrivate)) + static gint enable_undo = 0; enum { @@ -276,10 +280,14 @@ rule_add (GtkWidget *widget, content_area = gtk_dialog_get_content_area (GTK_DIALOG (editor->dialog)); gtk_box_pack_start (GTK_BOX (content_area), rules, TRUE, TRUE, 3); - g_signal_connect (editor->dialog, "response", G_CALLBACK (add_editor_response), editor); + g_signal_connect ( + editor->dialog, "response", + G_CALLBACK (add_editor_response), editor); g_object_weak_ref ((GObject *) editor->dialog, (GWeakNotify) editor_destroy, editor); - g_signal_connect (editor->edit, "changed", G_CALLBACK (dialog_rule_changed), editor->dialog); + g_signal_connect ( + editor->edit, "changed", + G_CALLBACK (dialog_rule_changed), editor->dialog); dialog_rule_changed (editor->edit, editor->dialog); gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE); @@ -365,10 +373,14 @@ rule_edit (GtkWidget *widget, content_area = gtk_dialog_get_content_area (GTK_DIALOG (editor->dialog)); gtk_box_pack_start (GTK_BOX (content_area), rules, TRUE, TRUE, 3); - g_signal_connect (editor->dialog, "response", G_CALLBACK (edit_editor_response), editor); + g_signal_connect ( + editor->dialog, "response", + G_CALLBACK (edit_editor_response), editor); g_object_weak_ref ((GObject *) editor->dialog, (GWeakNotify) editor_destroy, editor); - g_signal_connect (editor->edit, "changed", G_CALLBACK (dialog_rule_changed), editor->dialog); + g_signal_connect ( + editor->edit, "changed", + G_CALLBACK (dialog_rule_changed), editor->dialog); dialog_rule_changed (editor->edit, editor->dialog); gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE); @@ -667,8 +679,7 @@ e_rule_editor_class_init (ERuleEditorClass *class) static void e_rule_editor_init (ERuleEditor *editor) { - editor->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - editor, E_TYPE_RULE_EDITOR, ERuleEditorPrivate); + editor->priv = E_RULE_EDITOR_GET_PRIVATE (editor); } /** -- cgit