From 6af0c53b697c6981c1470c177b2c37e081635258 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 29 Jan 2011 10:50:53 -0500 Subject: Coding style and whitespace cleanup. --- widgets/misc/e-alert-bar.c | 30 +++--- widgets/misc/e-canvas.c | 4 +- widgets/misc/e-dateedit.c | 4 +- widgets/misc/e-map.c | 153 +++++++++++++++++++---------- widgets/table/e-table-click-to-add.h | 3 +- widgets/table/e-table-field-chooser-item.c | 3 +- widgets/table/e-table-header-item.c | 5 +- widgets/table/e-table-header-item.h | 51 +++++----- widgets/table/e-table-header-utils.c | 23 +++-- widgets/table/e-table-item.c | 2 +- widgets/table/e-table.c | 26 +++-- widgets/table/e-tree-model.h | 10 +- widgets/table/e-tree.c | 44 ++++++--- widgets/text/e-text.c | 87 +++++++++------- 14 files changed, 273 insertions(+), 172 deletions(-) (limited to 'widgets') diff --git a/widgets/misc/e-alert-bar.c b/widgets/misc/e-alert-bar.c index c20a74e4d0..d5c1f953d4 100644 --- a/widgets/misc/e-alert-bar.c +++ b/widgets/misc/e-alert-bar.c @@ -243,33 +243,31 @@ e_alert_bar_new (void) return g_object_new (E_TYPE_ALERT_BAR, NULL); } -struct DuplicateData -{ +typedef struct { gboolean found; EAlert *looking_for; -}; +} DuplicateData; static void -find_duplicate_cb (gpointer data, gpointer user_data) +alert_bar_find_duplicate_cb (EAlert *alert, + DuplicateData *dd) { - EAlert *alert = data; - struct DuplicateData *dd = user_data; - - g_return_if_fail (alert != NULL); - g_return_if_fail (dd != NULL); g_return_if_fail (dd->looking_for != NULL); - dd->found = dd->found || ( - e_alert_get_message_type (alert) == e_alert_get_message_type (dd->looking_for) && - g_strcmp0 (e_alert_get_primary_text (alert), e_alert_get_primary_text (dd->looking_for)) == 0 && - g_strcmp0 (e_alert_get_secondary_text (alert), e_alert_get_secondary_text (dd->looking_for)) == 0); + dd->found |= ( + e_alert_get_message_type (alert) == + e_alert_get_message_type (dd->looking_for) && + g_strcmp0 (e_alert_get_primary_text (alert), + e_alert_get_primary_text (dd->looking_for)) == 0 && + g_strcmp0 (e_alert_get_secondary_text (alert), + e_alert_get_secondary_text (dd->looking_for)) == 0); } void e_alert_bar_add_alert (EAlertBar *alert_bar, EAlert *alert) { - struct DuplicateData dd; + DuplicateData dd; g_return_if_fail (E_IS_ALERT_BAR (alert_bar)); g_return_if_fail (E_IS_ALERT (alert)); @@ -277,7 +275,9 @@ e_alert_bar_add_alert (EAlertBar *alert_bar, dd.found = FALSE; dd.looking_for = alert; - g_queue_foreach (&alert_bar->priv->alerts, find_duplicate_cb, &dd); + g_queue_foreach ( + &alert_bar->priv->alerts, + (GFunc) alert_bar_find_duplicate_cb, &dd); if (dd.found) return; diff --git a/widgets/misc/e-canvas.c b/widgets/misc/e-canvas.c index 70785773a0..cca6d92670 100644 --- a/widgets/misc/e-canvas.c +++ b/widgets/misc/e-canvas.c @@ -278,7 +278,9 @@ pick_current_item (GnomeCanvas *canvas, GdkEvent *event) /* find the closest item */ if (canvas->root->flags & GNOME_CANVAS_ITEM_VISIBLE) - canvas->new_current_item = gnome_canvas_item_invoke_point (canvas->root, x, y, cx, cy); + canvas->new_current_item = + gnome_canvas_item_invoke_point ( + canvas->root, x, y, cx, cy); else canvas->new_current_item = NULL; } else diff --git a/widgets/misc/e-dateedit.c b/widgets/misc/e-dateedit.c index 0a2b744372..d2c7dc200a 100644 --- a/widgets/misc/e-dateedit.c +++ b/widgets/misc/e-dateedit.c @@ -1570,6 +1570,7 @@ static void rebuild_time_popup (EDateEdit *dedit) { EDateEditPrivate *priv; + GtkTreeModel *model; GtkListStore *list_store; GtkTreeIter iter; gchar buffer[40]; @@ -1578,7 +1579,8 @@ rebuild_time_popup (EDateEdit *dedit) priv = dedit->priv; - list_store = GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (priv->time_combo))); + model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->time_combo)); + list_store = GTK_LIST_STORE (model); gtk_list_store_clear (list_store); /* Fill the struct tm with some sane values. */ diff --git a/widgets/misc/e-map.c b/widgets/misc/e-map.c index f4c981b601..405a55d686 100644 --- a/widgets/misc/e-map.c +++ b/widgets/misc/e-map.c @@ -118,9 +118,6 @@ enum { /* Internal prototypes */ -static void e_map_get_current_location (EMap *map, gdouble *longitude, gdouble *latitude); -static void e_map_world_to_render_surface (EMap *map, gdouble world_longitude, gdouble world_latitude, - gdouble *win_x, gdouble *win_y); static void update_render_surface (EMap *map, gboolean render_overlays); static void set_scroll_area (EMap *map, gint width, gint height); static void center_at (EMap *map, gdouble longitude, gdouble latitude); @@ -205,7 +202,11 @@ e_map_start_tweening (EMap *map) } static void -e_map_tween_new (EMap *map, guint msecs, gdouble longitude_offset, gdouble latitude_offset, gdouble zoom_factor) +e_map_tween_new (EMap *map, + guint msecs, + gdouble longitude_offset, + gdouble latitude_offset, + gdouble zoom_factor) { EMapTween *tween; @@ -233,6 +234,37 @@ G_DEFINE_TYPE_WITH_CODE ( GTK_TYPE_WIDGET, G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, NULL)) +static void +e_map_get_current_location (EMap *map, + gdouble *longitude, + gdouble *latitude) +{ + GtkAllocation allocation; + + gtk_widget_get_allocation (GTK_WIDGET (map), &allocation); + + e_map_window_to_world ( + map, allocation.width / 2.0, + allocation.height / 2.0, + longitude, latitude); +} + +static void +e_map_world_to_render_surface (EMap *map, + gdouble world_longitude, + gdouble world_latitude, + gdouble *win_x, + gdouble *win_y) +{ + gint width, height; + + width = E_MAP_GET_WIDTH (map); + height = E_MAP_GET_HEIGHT (map); + + *win_x = (width / 2.0 + (width / 2.0) * world_longitude / 180.0); + *win_y = (height / 2.0 - (height / 2.0) * world_latitude / 90.0); +} + static void e_map_tween_new_from (EMap *map, guint msecs, @@ -393,14 +425,18 @@ e_map_set_hadjustment (EMap *map, GtkAdjustment *adjustment) return; if (priv->hadjustment != NULL) { - g_signal_handlers_disconnect_matched (priv->hadjustment, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, map); + g_signal_handlers_disconnect_matched ( + priv->hadjustment, G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, map); g_object_unref (priv->hadjustment); } if (!adjustment) adjustment = gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0); - g_signal_connect (adjustment, "value-changed", G_CALLBACK (e_map_adjustment_changed), map); + g_signal_connect ( + adjustment, "value-changed", + G_CALLBACK (e_map_adjustment_changed), map); priv->hadjustment = g_object_ref_sink (adjustment); e_map_set_hadjustment_values (map); @@ -416,14 +452,18 @@ e_map_set_vadjustment (EMap *map, GtkAdjustment *adjustment) return; if (priv->vadjustment != NULL) { - g_signal_handlers_disconnect_matched (priv->vadjustment, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, map); + g_signal_handlers_disconnect_matched ( + priv->vadjustment, G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, map); g_object_unref (priv->vadjustment); } if (!adjustment) adjustment = gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0); - g_signal_connect (adjustment, "value-changed", G_CALLBACK (e_map_adjustment_changed), map); + g_signal_connect ( + adjustment, "value-changed", + G_CALLBACK (e_map_adjustment_changed), map); priv->vadjustment = g_object_ref_sink (adjustment); e_map_set_vadjustment_values (map); @@ -435,7 +475,10 @@ e_map_set_vadjustment (EMap *map, GtkAdjustment *adjustment) * ----------------- */ static void -e_map_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) +e_map_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) { EMap *map; @@ -464,7 +507,10 @@ e_map_set_property (GObject *object, guint prop_id, const GValue *value, GParamS } static void -e_map_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) +e_map_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) { EMap *map; @@ -750,10 +796,14 @@ e_map_class_init (EMapClass *class) object_class->get_property = e_map_get_property; /* Scrollable interface properties */ - g_object_class_override_property (object_class, PROP_HADJUSTMENT, "hadjustment"); - g_object_class_override_property (object_class, PROP_VADJUSTMENT, "vadjustment"); - g_object_class_override_property (object_class, PROP_HSCROLL_POLICY, "hscroll-policy"); - g_object_class_override_property (object_class, PROP_VSCROLL_POLICY, "vscroll-policy"); + g_object_class_override_property ( + object_class, PROP_HADJUSTMENT, "hadjustment"); + g_object_class_override_property ( + object_class, PROP_VADJUSTMENT, "vadjustment"); + g_object_class_override_property ( + object_class, PROP_HSCROLL_POLICY, "hscroll-policy"); + g_object_class_override_property ( + object_class, PROP_VSCROLL_POLICY, "vscroll-policy"); widget_class = GTK_WIDGET_CLASS (class); widget_class->realize = e_map_realize; @@ -772,7 +822,10 @@ static void e_map_init (EMap *map) { GtkWidget *widget; - gchar *map_file_name = g_build_filename (EVOLUTION_IMAGESDIR, "world_map-960.png", NULL); + gchar *map_file_name; + + map_file_name = g_build_filename ( + EVOLUTION_IMAGESDIR, "world_map-960.png", NULL); widget = GTK_WIDGET (map); @@ -812,7 +865,10 @@ e_map_new (void) a11y = gtk_widget_get_accessible (widget); atk_object_set_name (a11y, _("World Map")); atk_object_set_role (a11y, ATK_ROLE_IMAGE); - atk_object_set_description (a11y, _("Mouse-based interactive map widget for selecting timezone. Keyboard users should instead select the timezone from the drop-down combination box below.")); + atk_object_set_description ( + a11y, _("Mouse-based interactive map widget for selecting " + "timezone. Keyboard users should instead select the timezone " + "from the drop-down combination box below.")); return (E_MAP (widget)); } @@ -825,7 +881,11 @@ e_map_new (void) * Latitude E <-90, 90] */ void -e_map_window_to_world (EMap *map, gdouble win_x, gdouble win_y, gdouble *world_longitude, gdouble *world_latitude) +e_map_window_to_world (EMap *map, + gdouble win_x, + gdouble win_y, + gdouble *world_longitude, + gdouble *world_latitude) { gint width, height; @@ -842,33 +902,23 @@ e_map_window_to_world (EMap *map, gdouble win_x, gdouble win_y, gdouble *world_l ((gdouble) height / 2.0) * 90.0; } -static void -e_map_world_to_render_surface (EMap *map, gdouble world_longitude, gdouble world_latitude, gdouble *win_x, gdouble *win_y) -{ - gint width, height; - - width = E_MAP_GET_WIDTH (map); - height = E_MAP_GET_HEIGHT (map); - - *win_x = (width / 2.0 + (width / 2.0) * world_longitude / 180.0); - *win_y = (height / 2.0 - (height / 2.0) * world_latitude / 90.0); -} - void -e_map_world_to_window (EMap *map, gdouble world_longitude, gdouble world_latitude, gdouble *win_x, gdouble *win_y) +e_map_world_to_window (EMap *map, + gdouble world_longitude, + gdouble world_latitude, + gdouble *win_x, + gdouble *win_y) { g_return_if_fail (E_IS_MAP (map)); g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (map))); g_return_if_fail (world_longitude >= -180.0 && world_longitude <= 180.0); g_return_if_fail (world_latitude >= -90.0 && world_latitude <= 90.0); - e_map_world_to_render_surface (map, world_longitude, world_latitude, win_x, win_y); + e_map_world_to_render_surface ( + map, world_longitude, world_latitude, win_x, win_y); + *win_x -= map->priv->xofs; *win_y -= map->priv->yofs; - -#ifdef DEBUG - printf ("Map size: (%d, %d)\nCoords: (%.1f, %.1f) -> (%.1f, %.1f)\n---\n", width, height, world_longitude, world_latitude, *win_x, *win_y); -#endif } /* --- Zoom --- */ @@ -954,7 +1004,11 @@ e_map_thaw (EMap *map) /* --- Point manipulation --- */ EMapPoint * -e_map_add_point (EMap *map, gchar *name, gdouble longitude, gdouble latitude, guint32 color_rgba) +e_map_add_point (EMap *map, + gchar *name, + gdouble longitude, + gdouble latitude, + guint32 color_rgba) { EMapPoint *point; @@ -994,7 +1048,9 @@ e_map_remove_point (EMap *map, EMapPoint *point) } void -e_map_point_get_location (EMapPoint *point, gdouble *longitude, gdouble *latitude) +e_map_point_get_location (EMapPoint *point, + gdouble *longitude, + gdouble *latitude) { *longitude = point->longitude; *latitude = point->latitude; @@ -1013,7 +1069,9 @@ e_map_point_get_color_rgba (EMapPoint *point) } void -e_map_point_set_color_rgba (EMap *map, EMapPoint *point, guint32 color_rgba) +e_map_point_set_color_rgba (EMap *map, + EMapPoint *point, + guint32 color_rgba) { point->rgba = color_rgba; @@ -1057,7 +1115,10 @@ e_map_point_is_in_view (EMap *map, EMapPoint *point) } EMapPoint * -e_map_get_closest_point (EMap *map, gdouble longitude, gdouble latitude, gboolean in_view) +e_map_get_closest_point (EMap *map, + gdouble longitude, + gdouble latitude, + gboolean in_view) { EMapPoint *point_chosen = NULL, *point; gdouble min_dist = 0.0, dist; @@ -1284,19 +1345,7 @@ scroll_to (EMap *map, gint x, gint y) } static void -e_map_get_current_location (EMap *map, gdouble *longitude, gdouble *latitude) -{ - GtkAllocation allocation; - - gtk_widget_get_allocation (GTK_WIDGET (map), &allocation); - - e_map_window_to_world (map, - allocation.width / 2.0, allocation.height / 2.0, - longitude, latitude); -} - -static void -set_scroll_area (EMap *view, int width, int height) +set_scroll_area (EMap *view, gint width, gint height) { EMapPrivate *priv; GtkAllocation allocation; diff --git a/widgets/table/e-table-click-to-add.h b/widgets/table/e-table-click-to-add.h index 49f8df334c..b92672d387 100644 --- a/widgets/table/e-table-click-to-add.h +++ b/widgets/table/e-table-click-to-add.h @@ -64,7 +64,8 @@ struct _ETableClickToAdd { gchar *message; - GnomeCanvasItem *row; /* If row is NULL, we're sitting with no data and a "Click here" message. */ + GnomeCanvasItem *row; /* If row is NULL, we're sitting with + * no data and a "Click here" message. */ GnomeCanvasItem *text; /* If text is NULL, row shouldn't be. */ GnomeCanvasItem *rect; /* What the heck. Why not. */ diff --git a/widgets/table/e-table-field-chooser-item.c b/widgets/table/e-table-field-chooser-item.c index 411c1b58f4..91a77c83c5 100644 --- a/widgets/table/e-table-field-chooser-item.c +++ b/widgets/table/e-table-field-chooser-item.c @@ -582,7 +582,8 @@ etfci_start_drag (ETableFieldChooserItem *etfci, GdkEvent *event, gdouble x, gdo button_height = e_table_header_compute_height (ecol, widget); window = gtk_widget_get_window (widget); - cs = gdk_window_create_similar_surface (window, CAIRO_CONTENT_COLOR, etfci->width, button_height); + cs = gdk_window_create_similar_surface ( + window, CAIRO_CONTENT_COLOR, etfci->width, button_height); style = gtk_widget_get_style (widget); state = gtk_widget_get_state (widget); diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c index b7388fdfaa..0c56b59ea2 100644 --- a/widgets/table/e-table-header-item.c +++ b/widgets/table/e-table-header-item.c @@ -1235,9 +1235,8 @@ ethi_start_drag (ETableHeaderItem *ethi, GdkEvent *event) col_width = ecol->width; s = cairo_image_surface_create (CAIRO_FORMAT_A1, col_width, ethi->height); cr = cairo_create (s); - pixbuf = gdk_pixbuf_get_from_surface(s, - 0, 0, - col_width, ethi->height); + pixbuf = gdk_pixbuf_get_from_surface ( + s, 0, 0, col_width, ethi->height); state = gtk_widget_get_state (widget); diff --git a/widgets/table/e-table-header-item.h b/widgets/table/e-table-header-item.h index 4ab483a4ce..96f167b4e8 100644 --- a/widgets/table/e-table-header-item.h +++ b/widgets/table/e-table-header-item.h @@ -56,25 +56,25 @@ typedef struct _ETableHeaderItem ETableHeaderItem; typedef struct _ETableHeaderItemClass ETableHeaderItemClass; struct _ETableHeaderItem { - GnomeCanvasItem parent; - ETableHeader *eth; + GnomeCanvasItem parent; + ETableHeader *eth; - GdkCursor *change_cursor; - GdkCursor *resize_cursor; + GdkCursor *change_cursor; + GdkCursor *resize_cursor; - gshort height, width; + gshort height, width; PangoFontDescription *font_desc; /* - * Used during resizing; Could be shorts + * Used during resizing; Could be shorts */ - gint resize_col; - gint resize_start_pos; - gint resize_min_width; + gint resize_col; + gint resize_start_pos; + gint resize_min_width; - gpointer resize_guide; + gpointer resize_guide; - gint group_indent_width; + gint group_indent_width; /* * Ids @@ -84,20 +84,25 @@ struct _ETableHeaderItem { /* * For dragging columns */ - guint maybe_drag:1; - guint dnd_ready:1; - gint click_x, click_y; - gint drag_col, drop_col, drag_mark; - guint drag_motion_id, drag_end_id, drag_leave_id, drag_drop_id, drag_data_received_id, drag_data_get_id; - guint sort_info_changed_id, group_info_changed_id; + guint maybe_drag:1; + guint dnd_ready:1; + gint click_x, click_y; + gint drag_col, drop_col, drag_mark; + guint drag_motion_id; + guint drag_end_id; + guint drag_leave_id; + guint drag_drop_id; + guint drag_data_received_id; + guint drag_data_get_id; + guint sort_info_changed_id, group_info_changed_id; GnomeCanvasItem *remove_item; - gchar *dnd_code; + gchar *dnd_code; /* * For column sorting info */ - ETableSortInfo *sort_info; + ETableSortInfo *sort_info; guint scroll_direction : 4; gint last_drop_x; @@ -107,10 +112,10 @@ struct _ETableHeaderItem { gint scroll_idle_id; /* For adding fields. */ - ETableHeader *full_header; - ETable *table; - ETree *tree; - void *config; + ETableHeader *full_header; + ETable *table; + ETree *tree; + gpointer config; union { GtkWidget *widget; diff --git a/widgets/table/e-table-header-utils.c b/widgets/table/e-table-header-utils.c index da60ce03d9..55e90159c6 100644 --- a/widgets/table/e-table-header-utils.c +++ b/widgets/table/e-table-header-utils.c @@ -272,7 +272,8 @@ e_table_header_draw_button (cairo_t *cr, ETableCol *ecol, } cairo_save (cr); - gdk_cairo_set_source_color (cr, >k_widget_get_style (GTK_WIDGET (g_label))->fg[state]); + gdk_cairo_set_source_color ( + cr, >k_widget_get_style (GTK_WIDGET (g_label))->fg[state]); xthick = style->xthickness; ythick = style->ythickness; @@ -321,7 +322,7 @@ e_table_header_draw_button (cairo_t *cr, ETableCol *ecol, } layout = build_header_layout (widget, ecol->text); - pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END); + pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END); /* Pixbuf or label */ if (ecol->icon_name != NULL) { @@ -351,10 +352,12 @@ e_table_header_draw_button (cairo_t *cr, ETableCol *ecol, ypos = inner_y; - pango_layout_set_width (layout, (inner_width - (xpos - inner_x)) * PANGO_SCALE); + pango_layout_set_width ( + layout, (inner_width - (xpos - inner_x)) * + PANGO_SCALE); - cairo_move_to (cr, xpos + pwidth + 1, ypos); - pango_cairo_show_layout (cr, layout); + cairo_move_to (cr, xpos + pwidth + 1, ypos); + pango_cairo_show_layout (cr, layout); } /* FIXME: For some reason, under clutter gdk_draw_rgb_image_dithalign crashes @@ -377,14 +380,14 @@ e_table_header_draw_button (cairo_t *cr, ETableCol *ecol, g_object_unref (pixmap); } #endif - gdk_cairo_set_source_pixbuf (cr, ecol->pixbuf, + gdk_cairo_set_source_pixbuf (cr, ecol->pixbuf, xpos, inner_y + (inner_height - clip_height) / 2); - cairo_paint (cr); + cairo_paint (cr); } else { - pango_layout_set_width (layout, inner_width * PANGO_SCALE); + pango_layout_set_width (layout, inner_width * PANGO_SCALE); - cairo_move_to (cr, inner_x, inner_y); - pango_cairo_show_layout (cr, layout); + cairo_move_to (cr, inner_x, inner_y); + pango_cairo_show_layout (cr, layout); } switch (arrow) { diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index d5c9c2da14..75a8f44d5d 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -1743,7 +1743,7 @@ eti_draw (GnomeCanvasItem *item, cairo_t *cr, gint x, gint y, gint width, gint h GtkWidget *canvas = GTK_WIDGET (item->canvas); GtkStyle *style = gtk_widget_get_style (canvas); gint height_extra = eti->horizontal_draw_grid ? 1 : 0; - + /* * Find out our real position after grouping */ diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index 69e4241a7a..5028a48a6b 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -234,17 +234,21 @@ static void et_get_preferred_width (GtkWidget *widget, gint *minimum, gint *natural) { ETable *et = E_TABLE (widget); - GTK_WIDGET_CLASS (e_table_parent_class)->get_preferred_width (widget, minimum, natural); + + GTK_WIDGET_CLASS (e_table_parent_class)-> + get_preferred_width (widget, minimum, natural); + if (et->horizontal_resize) { - *minimum = MAX (*minimum, et->header_width); - *natural = MAX (*natural, et->header_width); - } + *minimum = MAX (*minimum, et->header_width); + *natural = MAX (*natural, et->header_width); + } } static void et_get_preferred_height (GtkWidget *widget, gint *minimum, gint *natural) { - GTK_WIDGET_CLASS (e_table_parent_class)->get_preferred_height (widget, minimum, natural); + GTK_WIDGET_CLASS (e_table_parent_class)-> + get_preferred_height (widget, minimum, natural); } static void @@ -3538,10 +3542,14 @@ e_table_class_init (ETableClass *class) G_PARAM_STATIC_STRINGS)); /* Scrollable interface */ - g_object_class_override_property (object_class, PROP_HADJUSTMENT, "hadjustment"); - g_object_class_override_property (object_class, PROP_VADJUSTMENT, "vadjustment"); - g_object_class_override_property (object_class, PROP_HSCROLL_POLICY, "hscroll-policy"); - g_object_class_override_property (object_class, PROP_VSCROLL_POLICY, "vscroll-policy"); + g_object_class_override_property ( + object_class, PROP_HADJUSTMENT, "hadjustment"); + g_object_class_override_property ( + object_class, PROP_VADJUSTMENT, "vadjustment"); + g_object_class_override_property ( + object_class, PROP_HSCROLL_POLICY, "hscroll-policy"); + g_object_class_override_property ( + object_class, PROP_VSCROLL_POLICY, "vscroll-policy"); gal_a11y_e_table_init (); } diff --git a/widgets/table/e-tree-model.h b/widgets/table/e-tree-model.h index 01c4bf4180..f857e52a49 100644 --- a/widgets/table/e-tree-model.h +++ b/widgets/table/e-tree-model.h @@ -227,24 +227,24 @@ void *e_tree_model_value_at (ETreeModel *etree, void e_tree_model_set_value_at (ETreeModel *etree, ETreePath node, gint col, - const void *val); + gconstpointer val); gboolean e_tree_model_node_is_editable (ETreeModel *etree, ETreePath node, gint col); void *e_tree_model_duplicate_value (ETreeModel *etree, gint col, - const void *value); + gconstpointer value); void e_tree_model_free_value (ETreeModel *etree, gint col, - void *value); + gpointer value); void *e_tree_model_initialize_value (ETreeModel *etree, gint col); gboolean e_tree_model_value_is_empty (ETreeModel *etree, gint col, - const void *value); + gconstpointer value); gchar * e_tree_model_value_to_string (ETreeModel *etree, gint col, - const void *value); + gconstpointer value); /* depth first traversal of path's descendents, calling func on each one */ void e_tree_model_node_traverse (ETreeModel *model, diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c index 4471514d68..b77bda8ef7 100644 --- a/widgets/table/e-tree.c +++ b/widgets/table/e-tree.c @@ -1922,25 +1922,33 @@ et_get_property (GObject *object, break; case PROP_HADJUSTMENT: if (etree->priv->table_canvas) - g_object_get_property (G_OBJECT (etree->priv->table_canvas), "hadjustment", value); + g_object_get_property ( + G_OBJECT (etree->priv->table_canvas), + "hadjustment", value); else g_value_set_object (value, NULL); break; case PROP_VADJUSTMENT: if (etree->priv->table_canvas) - g_object_get_property (G_OBJECT (etree->priv->table_canvas), "vadjustment", value); + g_object_get_property ( + G_OBJECT (etree->priv->table_canvas), + "vadjustment", value); else g_value_set_object (value, NULL); break; case PROP_HSCROLL_POLICY: if (etree->priv->table_canvas) - g_object_get_property (G_OBJECT (etree->priv->table_canvas), "hscroll-policy", value); + g_object_get_property ( + G_OBJECT (etree->priv->table_canvas), + "hscroll-policy", value); else g_value_set_enum (value, 0); break; case PROP_VSCROLL_POLICY: if (etree->priv->table_canvas) - g_object_get_property (G_OBJECT (etree->priv->table_canvas), "vscroll-policy", value); + g_object_get_property ( + G_OBJECT (etree->priv->table_canvas), + "vscroll-policy", value); else g_value_set_enum (value, 0); break; @@ -2018,19 +2026,27 @@ et_set_property (GObject *object, case PROP_HADJUSTMENT: if (etree->priv->table_canvas) - g_object_set_property (G_OBJECT (etree->priv->table_canvas), "hadjustment", value); + g_object_set_property ( + G_OBJECT (etree->priv->table_canvas), + "hadjustment", value); break; case PROP_VADJUSTMENT: if (etree->priv->table_canvas) - g_object_set_property (G_OBJECT (etree->priv->table_canvas), "vadjustment", value); + g_object_set_property ( + G_OBJECT (etree->priv->table_canvas), + "vadjustment", value); break; case PROP_HSCROLL_POLICY: if (etree->priv->table_canvas) - g_object_set_property (G_OBJECT (etree->priv->table_canvas), "hscroll-policy", value); + g_object_set_property ( + G_OBJECT (etree->priv->table_canvas), + "hscroll-policy", value); break; case PROP_VSCROLL_POLICY: if (etree->priv->table_canvas) - g_object_set_property (G_OBJECT (etree->priv->table_canvas), "vscroll-policy", value); + g_object_set_property ( + G_OBJECT (etree->priv->table_canvas), + "vscroll-policy", value); break; } } @@ -3548,10 +3564,14 @@ e_tree_class_init (ETreeClass *class) G_PARAM_STATIC_STRINGS)); /* Scrollable interface */ - g_object_class_override_property (object_class, PROP_HADJUSTMENT, "hadjustment"); - g_object_class_override_property (object_class, PROP_VADJUSTMENT, "vadjustment"); - g_object_class_override_property (object_class, PROP_HSCROLL_POLICY, "hscroll-policy"); - g_object_class_override_property (object_class, PROP_VSCROLL_POLICY, "vscroll-policy"); + g_object_class_override_property ( + object_class, PROP_HADJUSTMENT, "hadjustment"); + g_object_class_override_property ( + object_class, PROP_VADJUSTMENT, "vadjustment"); + g_object_class_override_property ( + object_class, PROP_HSCROLL_POLICY, "hscroll-policy"); + g_object_class_override_property ( + object_class, PROP_VSCROLL_POLICY, "vscroll-policy"); gal_a11y_e_tree_init (); } diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c index 8070416b9a..edd0a74fcc 100644 --- a/widgets/text/e-text.c +++ b/widgets/text/e-text.c @@ -181,7 +181,8 @@ disconnect_im_context (EText *text) if (!text || !text->im_context) return; - g_signal_handlers_disconnect_matched (text->im_context, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, text); + g_signal_handlers_disconnect_matched ( + text->im_context, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, text); text->im_context_signals_registered = FALSE; } @@ -1123,25 +1124,28 @@ e_text_update (GnomeCanvasItem *item, const cairo_matrix_t *i2c, gint flags) if ( text->needs_recalc_bounds || (flags & GNOME_CANVAS_UPDATE_AFFINE)) { - get_bounds (text, &x1, &y1, &x2, &y2); - if ( item->x1 != x1 || - item->x2 != x2 || - item->y1 != y1 || - item->y2 != y2 ) { - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2); - item->x1 = x1; - item->y1 = y1; - item->x2 = x2; - item->y2 = y2; - text->needs_redraw = 1; - item->canvas->need_repick = TRUE; - } - if (!text->fill_clip_rectangle) - item->canvas->need_repick = TRUE; + get_bounds (text, &x1, &y1, &x2, &y2); + if ( item->x1 != x1 || + item->x2 != x2 || + item->y1 != y1 || + item->y2 != y2 ) { + gnome_canvas_request_redraw ( + item->canvas, item->x1, item->y1, + item->x2, item->y2); + item->x1 = x1; + item->y1 = y1; + item->x2 = x2; + item->y2 = y2; + text->needs_redraw = 1; + item->canvas->need_repick = TRUE; + } + if (!text->fill_clip_rectangle) + item->canvas->need_repick = TRUE; text->needs_recalc_bounds = 0; } if (text->needs_redraw) { - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2); + gnome_canvas_request_redraw ( + item->canvas, item->x1, item->y1, item->x2, item->y2); text->needs_redraw = 0; } } @@ -1201,12 +1205,16 @@ draw_pango_rectangle (cairo_t *cr, { gint width = rect.width / PANGO_SCALE; gint height = rect.height / PANGO_SCALE; + if (width <= 0) width = 1; if (height <= 0) height = 1; - cairo_rectangle (cr, x1 + rect.x / PANGO_SCALE, y1 + rect.y / PANGO_SCALE, width, height); - cairo_fill (cr); + + cairo_rectangle ( + cr, x1 + rect.x / PANGO_SCALE, + y1 + rect.y / PANGO_SCALE, width, height); + cairo_fill (cr); } static gboolean @@ -1456,11 +1464,11 @@ e_text_draw (GnomeCanvasItem *item, cairo_t *cr, cairo_save (cr); if (text->clip) { - cairo_rectangle (cr, - xpos, ypos, - text->clip_cwidth - text->xofs, - text->clip_cheight - text->yofs); - cairo_clip (cr); + cairo_rectangle (cr, + xpos, ypos, + text->clip_cwidth - text->xofs, + text->clip_cheight - text->yofs); + cairo_clip (cr); } if (text->editing) { @@ -1468,16 +1476,19 @@ e_text_draw (GnomeCanvasItem *item, cairo_t *cr, ypos -= text->yofs_edit; } - cairo_move_to (cr, xpos, ypos); - pango_cairo_show_layout (cr, text->layout); + cairo_move_to (cr, xpos, ypos); + pango_cairo_show_layout (cr, text->layout); if (text->editing) { if (text->selection_start != text->selection_end) { cairo_region_t *clip_region = cairo_region_create (); gint indices[2]; - GtkStateType state; + GtkStateType state; - state = text->has_selection ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE; + if (text->has_selection) + state = GTK_STATE_SELECTED; + else + state = GTK_STATE_ACTIVE; indices[0] = MIN (text->selection_start, text->selection_end); indices[1] = MAX (text->selection_start, text->selection_end); @@ -1486,19 +1497,19 @@ e_text_draw (GnomeCanvasItem *item, cairo_t *cr, indices[0] = g_utf8_offset_to_pointer (text->text, indices[0]) - text->text; indices[1] = g_utf8_offset_to_pointer (text->text, indices[1]) - text->text; - clip_region = gdk_pango_layout_get_clip_region (text->layout, - xpos, ypos, - indices, 1); - gdk_cairo_region (cr, clip_region); - cairo_clip (cr); + clip_region = gdk_pango_layout_get_clip_region (text->layout, + xpos, ypos, + indices, 1); + gdk_cairo_region (cr, clip_region); + cairo_clip (cr); cairo_region_destroy (clip_region); - gdk_cairo_set_source_color (cr, &style->base[state]); - cairo_paint (cr); + gdk_cairo_set_source_color (cr, &style->base[state]); + cairo_paint (cr); - gdk_cairo_set_source_color (cr, &style->text[state]); - cairo_move_to (cr, xpos, ypos); - pango_cairo_show_layout (cr, text->layout); + gdk_cairo_set_source_color (cr, &style->text[state]); + cairo_move_to (cr, xpos, ypos); + pango_cairo_show_layout (cr, text->layout); } else { if (text->show_cursor) { PangoRectangle strong_pos, weak_pos; -- cgit v1.2.3