From cb97c2dc8fd97b381af048f206333d5e557892ae Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 21 May 2011 10:02:58 -0400 Subject: Coding style and whitespace cleanup. --- widgets/misc/e-calendar-item.c | 16 ++++++--- widgets/misc/e-calendar.c | 3 +- widgets/misc/e-canvas.c | 3 +- widgets/misc/e-canvas.h | 6 ---- widgets/misc/e-dateedit.c | 64 +++++++++++++++++++++--------------- widgets/misc/e-import-assistant.c | 33 ++++++++++++------- widgets/misc/e-popup-menu.h | 22 +++++++------ widgets/misc/e-searching-tokenizer.c | 60 +++++++++++++++++++-------------- widgets/misc/e-selection-model.c | 6 ++-- widgets/misc/e-web-view.c | 13 +++++--- widgets/misc/e-web-view.h | 3 +- 11 files changed, 136 insertions(+), 93 deletions(-) (limited to 'widgets/misc') diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c index f58259bdd8..ad7b95bfd4 100644 --- a/widgets/misc/e-calendar-item.c +++ b/widgets/misc/e-calendar-item.c @@ -2124,7 +2124,12 @@ e_calendar_item_button_press (ECalendarItem *calitem, day += calitem->selection_start_day - tmp_start_day; /* keep same count of days selected */ - add_days = e_calendar_item_get_inclusive_days (calitem, calitem->selection_start_month_offset, calitem->selection_start_day, calitem->selection_end_month_offset, calitem->selection_end_day) - 1; + add_days = e_calendar_item_get_inclusive_days ( + calitem, + calitem->selection_start_month_offset, + calitem->selection_start_day, + calitem->selection_end_month_offset, + calitem->selection_end_day) - 1; } calitem->selection_set = TRUE; @@ -2153,8 +2158,10 @@ e_calendar_item_button_press (ECalendarItem *calitem, round_up_end = TRUE; } - /* Don't round up or down if we can't select a week or more. Or when keeping week days */ - if (calitem->max_days_selected < 7 || (all_week && calitem->keep_wdays_on_weeknum_click)) { + /* Don't round up or down if we can't select a week or more, + * or when keeping week days. */ + if (calitem->max_days_selected < 7 || + (all_week && calitem->keep_wdays_on_weeknum_click)) { round_down_start = FALSE; round_up_end = FALSE; } @@ -2655,7 +2662,8 @@ e_calendar_item_set_first_month (ECalendarItem *calitem, /* Make sure the selection will be displayed. */ if (calitem->selection_start_month_offset < 0 || calitem->selection_start_month_offset >= num_months) { - calitem->selection_end_month_offset -= calitem->selection_start_month_offset; + calitem->selection_end_month_offset -= + calitem->selection_start_month_offset; calitem->selection_start_month_offset = 0; } diff --git a/widgets/misc/e-calendar.c b/widgets/misc/e-calendar.c index 9332345875..b0e8cbe12f 100644 --- a/widgets/misc/e-calendar.c +++ b/widgets/misc/e-calendar.c @@ -658,7 +658,8 @@ e_calendar_set_focusable (ECalendar *cal, gboolean focusable) gtk_widget_set_can_focus (next_widget, TRUE); } else { - if (gtk_widget_has_focus (GTK_WIDGET (cal)) || e_calendar_button_has_focus (cal)) { + if (gtk_widget_has_focus (GTK_WIDGET (cal)) || + e_calendar_button_has_focus (cal)) { toplevel = gtk_widget_get_toplevel (widget); if (toplevel) gtk_widget_grab_focus (toplevel); diff --git a/widgets/misc/e-canvas.c b/widgets/misc/e-canvas.c index 05832f74af..e2d0fe7bbf 100644 --- a/widgets/misc/e-canvas.c +++ b/widgets/misc/e-canvas.c @@ -286,7 +286,8 @@ pick_current_item (GnomeCanvas *canvas, GdkEvent *event) } else canvas->new_current_item = NULL; - if ((canvas->new_current_item == canvas->current_item) && !canvas->left_grabbed_item) + if ((canvas->new_current_item == canvas->current_item) && + !canvas->left_grabbed_item) return retval; /* current item did not change */ /* Synthesize events for old and new current items */ diff --git a/widgets/misc/e-canvas.h b/widgets/misc/e-canvas.h index 97055ab5ff..72a2e47f54 100644 --- a/widgets/misc/e-canvas.h +++ b/widgets/misc/e-canvas.h @@ -72,12 +72,6 @@ enum { E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW = 1 << 14 }; -enum { - E_CANVAS_ITEM_SELECTION_SELECT = 1 << 0, /* TRUE = select. FALSE = unselect. */ - E_CANVAS_ITEM_SELECTION_CURSOR = 1 << 1, /* TRUE = has become cursor. FALSE = not cursor. */ - E_CANVAS_ITEM_SELECTION_DELETE_DATA = 1 << 2 -}; - typedef struct { GnomeCanvasItem *item; gpointer id; diff --git a/widgets/misc/e-dateedit.c b/widgets/misc/e-dateedit.c index 881f1f332c..7fb0f8cd79 100644 --- a/widgets/misc/e-dateedit.c +++ b/widgets/misc/e-dateedit.c @@ -1944,23 +1944,26 @@ e_date_edit_update_date_entry (EDateEdit *dedit) /* This sets the text in the time entry according to the current settings. */ static void -e_date_edit_update_time_entry (EDateEdit *dedit) +e_date_edit_update_time_entry (EDateEdit *dedit) { EDateEditPrivate *priv; + GtkComboBox *combo_box; GtkWidget *child; gchar buffer[40]; struct tm tmp_tm = { 0 }; priv = dedit->priv; + combo_box = GTK_COMBO_BOX (priv->time_combo); child = gtk_bin_get_child (GTK_BIN (priv->time_combo)); if (priv->time_set_to_none || !priv->time_is_valid) { - gtk_combo_box_set_active (GTK_COMBO_BOX (priv->time_combo), -1); + gtk_combo_box_set_active (combo_box, -1); gtk_entry_set_text (GTK_ENTRY (child), ""); } else { GtkTreeModel *model; GtkTreeIter iter; + gboolean valid; gchar *b; /* Set these to reasonable values just in case. */ @@ -1975,15 +1978,19 @@ e_date_edit_update_time_entry (EDateEdit *dedit) tmp_tm.tm_isdst = -1; if (priv->use_24_hour_format) - /* This is a strftime() format. %H = hour (0-23), %M = minute. */ - e_time_format_time (&tmp_tm, 1, 0, buffer, sizeof (buffer)); + /* This is a strftime() format. + * %H = hour (0-23), %M = minute. */ + e_time_format_time ( + &tmp_tm, 1, 0, buffer, sizeof (buffer)); else - /* This is a strftime() format. %I = hour (1-12), - * %M = minute, %p = am/pm string. */ - e_time_format_time (&tmp_tm, 0, 0, buffer, sizeof (buffer)); - - /* For 12-hour am/pm format, we want space padding, not zero padding. This - * can be done with strftime's %l, but it's a potentially unportable extension. */ + /* This is a strftime() format. + * %I = hour (1-12), %M = minute, %p = am/pm. */ + e_time_format_time ( + &tmp_tm, 0, 0, buffer, sizeof (buffer)); + + /* For 12-hour am/pm format, we want space padding, not + * zero padding. This can be done with strftime's %l, + * but it's a potentially unportable extension. */ if (!priv->use_24_hour_format && buffer[0] == '0') buffer[0] = ' '; @@ -1994,28 +2001,31 @@ e_date_edit_update_time_entry (EDateEdit *dedit) while (*b == ' ') b++; - model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->time_combo)); - if (gtk_tree_model_get_iter_first (model, &iter)) { - do { - gchar *text = NULL; + model = gtk_combo_box_get_model (combo_box); + valid = gtk_tree_model_get_iter_first (model, &iter); + + while (valid) { + gchar *text = NULL; - gtk_tree_model_get (model, &iter, 0, &text, -1); - if (text) { - gchar *t = text; + gtk_tree_model_get (model, &iter, 0, &text, -1); + if (text) { + gchar *t = text; - /* truncate left spaces */ - while (*t == ' ') - t++; + /* truncate left spaces */ + while (*t == ' ') + t++; - if (strcmp (b, t) == 0) { - gtk_combo_box_set_active_iter (GTK_COMBO_BOX (priv->time_combo), &iter); - g_free (text); - break; - } + if (strcmp (b, t) == 0) { + gtk_combo_box_set_active_iter ( + combo_box, &iter); + g_free (text); + break; } + } + + g_free (text); - g_free (text); - } while (gtk_tree_model_iter_next (model, &iter)); + valid = gtk_tree_model_iter_next (model, &iter); } } diff --git a/widgets/misc/e-import-assistant.c b/widgets/misc/e-import-assistant.c index a87f7ce040..521e8fb76b 100644 --- a/widgets/misc/e-import-assistant.c +++ b/widgets/misc/e-import-assistant.c @@ -1027,7 +1027,8 @@ set_import_uris (EImportAssistant *assistant, gchar **uris) furi = g_filename_to_uri (filename, NULL, NULL); target = e_import_target_new_uri (priv->import, furi, NULL); - importers = e_import_get_importers (priv->import, (EImportTarget *) target); + importers = e_import_get_importers ( + priv->import, (EImportTarget *) target); if (importers != NULL) { /* there is at least one importer which can be used, @@ -1291,38 +1292,48 @@ import_assistant_construct (EImportAssistant *import_assistant) gtk_widget_show (page); gtk_assistant_append_page (assistant, page); - gtk_assistant_set_page_title (assistant, page, _("Evolution Import Assistant")); - gtk_assistant_set_page_type (assistant, page, GTK_ASSISTANT_PAGE_INTRO); + gtk_assistant_set_page_title ( + assistant, page, _("Evolution Import Assistant")); + gtk_assistant_set_page_type ( + assistant, page, GTK_ASSISTANT_PAGE_INTRO); gtk_assistant_set_page_complete (assistant, page, TRUE); /* Intelligent or direct import page */ page = import_assistant_type_page_init (import_assistant); gtk_assistant_append_page (assistant, page); - gtk_assistant_set_page_title (assistant, page, _("Importer Type")); - gtk_assistant_set_page_type (assistant, page, GTK_ASSISTANT_PAGE_CONTENT); + gtk_assistant_set_page_title ( + assistant, page, _("Importer Type")); + gtk_assistant_set_page_type ( + assistant, page, GTK_ASSISTANT_PAGE_CONTENT); gtk_assistant_set_page_complete (assistant, page, TRUE); /* Intelligent importer source page */ page = import_assistant_selection_page_init (import_assistant); gtk_assistant_append_page (assistant, page); - gtk_assistant_set_page_title (assistant, page, _("Select Information to Import")); - gtk_assistant_set_page_type (assistant, page, GTK_ASSISTANT_PAGE_CONTENT); + gtk_assistant_set_page_title ( + assistant, page, _("Select Information to Import")); + gtk_assistant_set_page_type ( + assistant, page, GTK_ASSISTANT_PAGE_CONTENT); /* File selection and file type page */ page = import_assistant_file_page_init (import_assistant); gtk_assistant_append_page (assistant, page); - gtk_assistant_set_page_title (assistant, page, _("Select a File")); - gtk_assistant_set_page_type (assistant, page, GTK_ASSISTANT_PAGE_CONTENT); + gtk_assistant_set_page_title ( + assistant, page, _("Select a File")); + gtk_assistant_set_page_type ( + assistant, page, GTK_ASSISTANT_PAGE_CONTENT); /* File destination page */ page = import_assistant_destination_page_init (import_assistant); gtk_assistant_append_page (assistant, page); - gtk_assistant_set_page_title (assistant, page, _("Import Location")); - gtk_assistant_set_page_type (assistant, page, GTK_ASSISTANT_PAGE_CONTENT); + gtk_assistant_set_page_title ( + assistant, page, _("Import Location")); + gtk_assistant_set_page_type ( + assistant, page, GTK_ASSISTANT_PAGE_CONTENT); /* Finish page */ page = gtk_label_new (""); diff --git a/widgets/misc/e-popup-menu.h b/widgets/misc/e-popup-menu.h index 2af3183933..24a8fa6022 100644 --- a/widgets/misc/e-popup-menu.h +++ b/widgets/misc/e-popup-menu.h @@ -32,7 +32,9 @@ G_BEGIN_DECLS #define E_POPUP_SEPARATOR { (gchar *) "", NULL, (NULL), NULL, 0 } #define E_POPUP_TERMINATOR { NULL, NULL, (NULL), NULL, 0 } -#define E_POPUP_ITEM(name,fn,disable_mask) { (gchar *) (name), NULL, (fn), NULL, (disable_mask), NULL, NULL, 0, 0, 0, 0 } +#define E_POPUP_ITEM(name,fn,disable_mask) \ + { (gchar *) (name), NULL, (fn), NULL, \ + (disable_mask), NULL, NULL, 0, 0, 0, 0 } typedef struct _EPopupMenu EPopupMenu; @@ -55,15 +57,15 @@ struct _EPopupMenu { guint use_custom_closure : 1; }; -GtkMenu *e_popup_menu_create (EPopupMenu *menu_list, - guint32 disable_mask, - guint32 hide_mask, - void *default_closure); -GtkMenu *e_popup_menu_create_with_domain (EPopupMenu *menu_list, - guint32 disable_mask, - guint32 hide_mask, - void *default_closure, - const gchar *domain); +GtkMenu * e_popup_menu_create (EPopupMenu *menu_list, + guint32 disable_mask, + guint32 hide_mask, + gpointer default_closure); +GtkMenu * e_popup_menu_create_with_domain (EPopupMenu *menu_list, + guint32 disable_mask, + guint32 hide_mask, + gpointer default_closure, + const gchar *domain); G_END_DECLS diff --git a/widgets/misc/e-searching-tokenizer.c b/widgets/misc/e-searching-tokenizer.c index 0955779534..6d34b6d8f0 100644 --- a/widgets/misc/e-searching-tokenizer.c +++ b/widgets/misc/e-searching-tokenizer.c @@ -51,7 +51,8 @@ G_DEFINE_TYPE ( /* Utility functions */ -/* This is faster and safer than glib2's utf8 abomination, but isn't exported from camel as yet */ +/* This is faster and safer than glib2's utf8 abomination, + * but isn't exported from camel as yet */ static inline guint32 camel_utf8_getc (const guchar **ptr) { @@ -89,7 +90,8 @@ loop: return v; } -/* note: our tags of interest are 7 bit ascii, only, no need to do any fancy utf8 stuff */ +/* note: our tags of interest are 7 bit ascii + * only no need to do any fancy utf8 stuff */ /* tags should be upper case if this list gets longer than 10 entries, consider binary search */ static const gchar *ignored_tags[] = { @@ -246,7 +248,10 @@ build_trie (gint nocase, gint len, guchar **words) q->final = 0; if (state_depth_max < depth) { state_depth_max += 64; - state_depth = g_realloc (state_depth, sizeof (*state_depth[0])*state_depth_max); + state_depth = g_realloc ( + state_depth, + sizeof (*state_depth[0]) * + state_depth_max); } if (state_depth_size < depth) { state_depth[depth] = NULL; @@ -369,14 +374,20 @@ struct _searcher { }; static void -searcher_set_tokenfunc (struct _searcher *s, gchar *(*next)(), gpointer data) +searcher_set_tokenfunc (struct _searcher *s, + gchar *(*next)(), + gpointer data) { s->next_token = next; s->next_data = data; } static struct _searcher * -searcher_new (gint flags, gint argc, guchar **argv, const gchar *tags, const gchar *tage) +searcher_new (gint flags, + gint argc, + guchar **argv, + const gchar *tags, + const gchar *tage) { gint i, m; struct _searcher *s; @@ -457,10 +468,8 @@ output_token (struct _searcher *s, struct _token *token) if (token->tok[0] == TAG_ESCAPE) { if (token->offset >= s->offout) { - d (printf("moving tag token '%s' from input to output\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok)); g_queue_push_tail (&s->output, token); } else { - d (printf("discarding tag token '%s' from input\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok)); free_token (token); } } else { @@ -470,11 +479,9 @@ output_token (struct _searcher *s, struct _token *token) pre = s->offout - token->offset; if (pre>0) memmove (token->tok, token->tok+pre, left+1); - d (printf("adding partial remaining/failed '%s'\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok)); s->offout = offend; g_queue_push_tail (&s->output, token); } else { - d (printf("discarding whole token '%s'\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok)); free_token (token); } } @@ -516,20 +523,18 @@ output_match (struct _searcher *s, guint start, guint end) return; } - d (printf("start in token '%s'\n", starttoken->tok[0]==TAG_ESCAPE?starttoken->tok+1:starttoken->tok)); - d (printf("end in token '%s'\n", endtoken->tok[0]==TAG_ESCAPE?endtoken->tok+1:endtoken->tok)); - /* output pending stuff that didn't match afterall */ while ((struct _token *) g_queue_peek_head (&s->input) != starttoken) { token = g_queue_pop_head (&s->input); - d (printf("appending failed match '%s'\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok)); output_token (s, token); } /* output any pre-match text */ if (s->offout < start) { - token = append_token (&s->output, starttoken->tok + (s->offout-starttoken->offset), start-s->offout); - d (printf("adding pre-match text '%s'\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok)); + token = append_token ( + &s->output, starttoken->tok + + (s->offout-starttoken->offset), + start-s->offout); s->offout = start; } @@ -545,15 +550,16 @@ output_match (struct _searcher *s, guint start, guint end) if (starttoken != endtoken) { while ((struct _token *) g_queue_peek_head (&s->input) != endtoken) { token = g_queue_pop_head (&s->input); - d (printf("appending (partial) match node (head) '%s'\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok)); output_token (s, token); } } /* any remaining partial content */ if (s->offout < end) { - token = append_token (&s->output, endtoken->tok+(s->offout-endtoken->offset), end-s->offout); - d (printf("appending (partial) match node (tail) '%s'\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok)); + token = append_token ( + &s->output, endtoken->tok + + (s->offout-endtoken->offset), + end-s->offout); s->offout = end; } @@ -608,7 +614,8 @@ merge_subpending (struct _searcher *s, gint offstart, gint offend) static void push_subpending (struct _searcher *s, gint offstart, gint offend) { - /* This is really an assertion, we just ignore the last pending match instead of crashing though */ + /* This is really an assertion, we just ignore the + * last pending match instead of crashing though. */ if (s->submatchp >= s->words) { d (printf("ERROR: submatch pending stack overflow\n")); s->submatchp = s->words-1; @@ -619,7 +626,8 @@ push_subpending (struct _searcher *s, gint offstart, gint offend) s->submatchp++; } -/* move any (partial) tokens from input to output if they are beyond the current output position */ +/* move any (partial) tokens from input to output + * if they are beyond the current output position */ static void output_pending (struct _searcher *s) { @@ -679,8 +687,6 @@ searcher_next_token (struct _searcher *s) token->offset = s->offset; tok = (guchar *) token->tok; - d (printf("new token %d '%s'\n", token->offset, token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok)); - /* tag test, reset state on unknown tags */ if (tok[0] == TAG_ESCAPE) { if (!ignore_tag ((gchar *) tok)) { @@ -728,8 +734,10 @@ searcher_next_token (struct _searcher *s) push_subpending (s, offstart, offend); /*output_match(s, offstart, offend);*/ } else if (g_queue_get_length (&s->input) > 8) { - /* we're continuing to match and merge, but we have a lot of stuff - waiting, so flush it out now since this is a safe point to do it */ + /* we're continuing to match and merge, + * but we have a lot of stuff waiting, + * so flush it out now since this is a + * safe point to do it */ output_subpending (s); } } else { @@ -895,7 +903,9 @@ search_info_to_searcher (struct _search_info *si) tage = g_alloca (20); sprintf(tage, "%c", TAG_ESCAPE); - return searcher_new (si->flags, si->strv->len, (guchar **) si->strv->pdata, tags, tage); + return searcher_new ( + si->flags, si->strv->len, + (guchar **) si->strv->pdata, tags, tage); } /* ********************************************************************** */ diff --git a/widgets/misc/e-selection-model.c b/widgets/misc/e-selection-model.c index d5ce69a1a6..e41d44e808 100644 --- a/widgets/misc/e-selection-model.c +++ b/widgets/misc/e-selection-model.c @@ -744,7 +744,8 @@ e_selection_model_key_press (ESelectionModel *selection, gint cursor_col = e_selection_model_cursor_col (selection); row = e_sorter_sorted_to_model (selection->sorter, row); - e_selection_model_select_as_key_press (selection, row, cursor_col, key->state); + e_selection_model_select_as_key_press ( + selection, row, cursor_col, key->state); return TRUE; } break; @@ -755,7 +756,8 @@ e_selection_model_key_press (ESelectionModel *selection, gint cursor_col = e_selection_model_cursor_col (selection); row = e_sorter_sorted_to_model (selection->sorter, row); - e_selection_model_select_as_key_press (selection, row, cursor_col, key->state); + e_selection_model_select_as_key_press ( + selection, row, cursor_col, key->state); return TRUE; } break; diff --git a/widgets/misc/e-web-view.c b/widgets/misc/e-web-view.c index e7153761ac..54bd251a53 100644 --- a/widgets/misc/e-web-view.c +++ b/widgets/misc/e-web-view.c @@ -476,9 +476,12 @@ web_view_button_press_event_cb (EWebView *web_view, if (event) { GdkPixbufAnimation *anim; - anim = gtk_html_get_image_at (frame ? frame : GTK_HTML (web_view), event->x, event->y); + if (frame == NULL) + frame = GTK_HTML (web_view); + + anim = gtk_html_get_image_at (frame, event->x, event->y); e_web_view_set_cursor_image (web_view, anim); - if (anim) + if (anim != NULL) g_object_unref (anim); } @@ -772,7 +775,7 @@ web_view_dispose (GObject *object) priv->paste_target_list = NULL; } - if (priv->cursor_image) { + if (priv->cursor_image != NULL) { g_object_unref (priv->cursor_image); priv->cursor_image = NULL; } @@ -1987,10 +1990,10 @@ e_web_view_set_cursor_image (EWebView *web_view, { g_return_if_fail (E_IS_WEB_VIEW (web_view)); - if (image) + if (image != NULL) g_object_ref (image); - if (web_view->priv->cursor_image) + if (web_view->priv->cursor_image != NULL) g_object_unref (web_view->priv->cursor_image); web_view->priv->cursor_image = image; diff --git a/widgets/misc/e-web-view.h b/widgets/misc/e-web-view.h index ed9017e3bd..b5f368f622 100644 --- a/widgets/misc/e-web-view.h +++ b/widgets/misc/e-web-view.h @@ -124,7 +124,8 @@ void e_web_view_set_magic_smileys (EWebView *web_view, const gchar * e_web_view_get_selected_uri (EWebView *web_view); void e_web_view_set_selected_uri (EWebView *web_view, const gchar *selected_uri); -GdkPixbufAnimation * e_web_view_get_cursor_image(EWebView *web_view); +GdkPixbufAnimation * + e_web_view_get_cursor_image (EWebView *web_view); void e_web_view_set_cursor_image (EWebView *web_view, GdkPixbufAnimation *animation); GtkAction * e_web_view_get_open_proxy (EWebView *web_view); -- cgit v1.2.3