[gnome-utils] Fix GSEAL issues
- From: Javier Jardón <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-utils] Fix GSEAL issues
- Date: Sat, 3 Jul 2010 01:39:39 +0000 (UTC)
commit 2803defc99a265f994823f19ea9b2da48e0e5100
Author: Thomas Hindoe Paaboel Andersen <phomes gmail com>
Date: Wed Jun 23 01:10:44 2010 +0200
Fix GSEAL issues
GNOME bug #612485
Signed-off-by: Javier Jardón <jjardon gnome org>
baobab/src/baobab-cell-renderer-progress.c | 42 ++++++++++------
baobab/src/baobab-chart.c | 74 ++++++++++++++++------------
baobab/src/baobab-ringschart.c | 38 +++++++++------
baobab/src/baobab.c | 10 ++--
4 files changed, 98 insertions(+), 66 deletions(-)
---
diff --git a/baobab/src/baobab-cell-renderer-progress.c b/baobab/src/baobab-cell-renderer-progress.c
index 69c4cca..8e99a7b 100644
--- a/baobab/src/baobab-cell-renderer-progress.c
+++ b/baobab/src/baobab-cell-renderer-progress.c
@@ -46,9 +46,7 @@ baobab_cell_renderer_progress_init (BaobabCellRendererProgress *cellprogress)
cellprogress->priv = BAOBAB_CELL_RENDERER_PROGRESS_GET_PRIVATE (cellprogress);
cellprogress->priv->perc = 0;
- GTK_CELL_RENDERER(cellprogress)->mode = GTK_CELL_RENDERER_MODE_INERT;
- GTK_CELL_RENDERER(cellprogress)->xpad = 4;
- GTK_CELL_RENDERER(cellprogress)->ypad = 4;
+ gtk_cell_renderer_set_padding (GTK_CELL_RENDERER (cellprogress), 4, 4);
}
GtkCellRenderer*
@@ -109,9 +107,14 @@ baobab_cell_renderer_progress_get_size (GtkCellRenderer *cell,
{
gint calc_width;
gint calc_height;
+ gint xpad;
+ gint ypad;
+ gfloat xalign;
+ gfloat yalign;
- calc_width = (gint) cell->xpad * 2 + FIXED_WIDTH;
- calc_height = (gint) cell->ypad * 2 + FIXED_HEIGHT;
+ gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
+ calc_width = (gint) xpad * 2 + FIXED_WIDTH;
+ calc_height = (gint) ypad * 2 + FIXED_HEIGHT;
if (width)
*width = calc_width;
@@ -121,15 +124,16 @@ baobab_cell_renderer_progress_get_size (GtkCellRenderer *cell,
if (cell_area)
{
+ gtk_cell_renderer_get_alignment (cell, &xalign, &yalign);
if (x_offset)
{
- *x_offset = cell->xalign * (cell_area->width - calc_width);
+ *x_offset = xalign * (cell_area->width - calc_width);
*x_offset = MAX (*x_offset, 0);
}
if (y_offset)
{
- *y_offset = cell->yalign * (cell_area->height - calc_height);
+ *y_offset = yalign * (cell_area->height - calc_height);
*y_offset = MAX (*y_offset, 0);
}
}
@@ -190,16 +194,21 @@ baobab_cell_renderer_progress_render (GtkCellRenderer *cell,
gint x, y, w, h, perc_w, pos;
gboolean is_rtl;
cairo_t *cr;
+ gint xpad;
+ gint ypad;
+ GtkStyle *style;
is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
cr = gdk_cairo_create (window);
- x = cell_area->x + cell->xpad;
- y = cell_area->y + cell->ypad;
+ gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
+
+ x = cell_area->x + xpad;
+ y = cell_area->y + ypad;
- w = cell_area->width - cell->xpad * 2;
- h = cell_area->height - cell->ypad * 2;
+ w = cell_area->width - xpad * 2;
+ h = cell_area->height - ypad * 2;
/*
* we always use a white bar with black
@@ -211,11 +220,12 @@ baobab_cell_renderer_progress_render (GtkCellRenderer *cell,
cairo_rectangle (cr, x, y, w, h);
cairo_set_source_rgb (cr, 0, 0, 0);
cairo_fill (cr);
-
- x += widget->style->xthickness;
- y += widget->style->ythickness;
- w -= widget->style->xthickness * 2;
- h -= widget->style->ythickness * 2;
+
+ style = gtk_widget_get_style (widget);
+ x += style->xthickness;
+ y += style->ythickness;
+ w -= style->xthickness * 2;
+ h -= style->ythickness * 2;
cairo_rectangle (cr, x, y, w, h);
cairo_set_source_rgb (cr, 1, 1, 1);
diff --git a/baobab/src/baobab-chart.c b/baobab/src/baobab-chart.c
index 6ae8a27..b72c9d0 100644
--- a/baobab/src/baobab-chart.c
+++ b/baobab/src/baobab-chart.c
@@ -299,17 +299,22 @@ baobab_chart_realize (GtkWidget *widget)
BaobabChart *chart;
GdkWindowAttr attributes;
gint attributes_mask;
+ GtkAllocation allocation;
+ GdkWindow *window;
+ GtkStyle *style;
g_return_if_fail (BAOBAB_IS_CHART (widget));
chart = BAOBAB_CHART (widget);
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+ gtk_widget_set_realized (widget, TRUE);
+
+ gtk_widget_get_allocation (widget, &allocation);
attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
+ attributes.x = allocation.x;
+ attributes.y = allocation.y;
+ attributes.width = allocation.width;
+ attributes.height = allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
@@ -317,13 +322,16 @@ baobab_chart_realize (GtkWidget *widget)
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
- &attributes,
- attributes_mask);
- gdk_window_set_user_data (widget->window, chart);
+ window = gdk_window_new (gtk_widget_get_parent_window (widget),
+ &attributes,
+ attributes_mask);
+ gtk_widget_set_window (widget, window);
+ gdk_window_set_user_data (window, chart);
- widget->style = gtk_style_attach (widget->style, widget->window);
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
+ gtk_widget_style_attach (widget);
+ gtk_style_set_background (gtk_widget_get_style (widget),
+ window,
+ GTK_STATE_NORMAL);
gtk_widget_add_events (widget,
GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK |
@@ -346,11 +354,11 @@ baobab_chart_size_allocate (GtkWidget *widget,
priv = BAOBAB_CHART (widget)->priv;
class = BAOBAB_CHART_GET_CLASS (widget);
- widget->allocation = *allocation;
+ gtk_widget_set_allocation (widget, allocation);
- if (GTK_WIDGET_REALIZED (widget))
+ if (gtk_widget_get_realized (widget))
{
- gdk_window_move_resize (widget->window,
+ gdk_window_move_resize (gtk_widget_get_window (widget),
allocation->x, allocation->y,
allocation->width, allocation->height);
@@ -641,7 +649,7 @@ baobab_chart_update_draw (BaobabChart* chart,
GtkTreePath *root_path = NULL;
gint root_depth, node_depth;
- if (!GTK_WIDGET_REALIZED (chart))
+ if (!gtk_widget_get_realized ( GTK_WIDGET (chart)))
return;
priv = BAOBAB_CHART (chart)->priv;
@@ -755,6 +763,7 @@ baobab_chart_expose (GtkWidget *chart, GdkEventExpose *event)
gdouble p, sx, sy;
GtkTreePath *root_path = NULL;
GtkTreePath *current_path = NULL;
+ GtkAllocation allocation;
priv = BAOBAB_CHART (chart)->priv;
@@ -763,7 +772,7 @@ baobab_chart_expose (GtkWidget *chart, GdkEventExpose *event)
return FALSE;
/* get a cairo_t */
- cr = gdk_cairo_create (chart->window);
+ cr = gdk_cairo_create (gtk_widget_get_window (chart));
cairo_rectangle (cr,
event->area.x, event->area.y,
@@ -779,16 +788,16 @@ baobab_chart_expose (GtkWidget *chart, GdkEventExpose *event)
cairo_clip (cr);
+ gtk_widget_get_allocation (GTK_WIDGET (chart), &allocation);
if (w > 0 && h > 0 &&
- !(chart->allocation.width == w &&
- chart->allocation.height == h))
+ !(allocation.width == w && allocation.height == h))
{
/* minimal available proportion */
- p = MIN (chart->allocation.width / (1.0 * w),
- chart->allocation.height / (1.0 * h));
+ p = MIN (allocation.width / (1.0 * w),
+ allocation.height / (1.0 * h));
- sx = (gdouble) (chart->allocation.width - w * p) / 2.0;
- sy = (gdouble) (chart->allocation.height - h * p) / 2.0;
+ sx = (gdouble) (allocation.width - w * p) / 2.0;
+ sy = (gdouble) (allocation.height - h * p) / 2.0;
cairo_translate (cr, sx, sy);
cairo_scale (cr, p, p);
@@ -982,7 +991,8 @@ baobab_chart_set_item_highlight (GtkWidget *chart,
else
priv->highlighted_item = NULL;
- gdk_window_invalidate_rect (chart->window, &item->rect, TRUE);
+ gdk_window_invalidate_rect (gtk_widget_get_window ( GTK_WIDGET (chart)),
+ &item->rect, TRUE);
}
static gint
@@ -1163,9 +1173,9 @@ baobab_chart_get_pixbuf (GtkWidget *widget)
g_return_val_if_fail (BAOBAB_IS_CHART (widget), NULL);
- gdk_drawable_get_size (widget->window, &w, &h);
+ gdk_drawable_get_size (gtk_widget_get_window (widget), &w, &h);
pixbuf = gdk_pixbuf_get_from_drawable (NULL,
- widget->window,
+ gtk_widget_get_window (widget),
gdk_colormap_get_system (),
0, 0,
0, 0,
@@ -1464,6 +1474,7 @@ baobab_chart_freeze_updates (GtkWidget *chart)
cairo_surface_t *surface = NULL;
cairo_t *cr = NULL;
GdkRectangle area;
+ GtkAllocation allocation;
g_return_if_fail (BAOBAB_IS_CHART (chart));
@@ -1476,9 +1487,10 @@ baobab_chart_freeze_updates (GtkWidget *chart)
baobab_chart_disconnect_signals (chart,
priv->model);
+ gtk_widget_get_allocation (GTK_WIDGET (chart), &allocation);
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
- chart->allocation.width,
- chart->allocation.height);
+ allocation.width,
+ allocation.height);
if (cairo_surface_status (surface) == CAIRO_STATUS_SUCCESS)
{
@@ -1486,14 +1498,14 @@ baobab_chart_freeze_updates (GtkWidget *chart)
area.x = 0;
area.y = 0;
- area.width = chart->allocation.width;
- area.height = chart->allocation.height;
+ area.width = allocation.width;
+ area.height = allocation.height;
baobab_chart_draw (chart, cr, area);
cairo_rectangle (cr,
0, 0,
- chart->allocation.width,
- chart->allocation.height);
+ allocation.width,
+ allocation.height);
cairo_set_source_rgba (cr, 0.93, 0.93, 0.93, 0.5); /* tango: eeeeec */
cairo_fill_preserve (cr);
diff --git a/baobab/src/baobab-ringschart.c b/baobab/src/baobab-ringschart.c
index e9b4020..fda2567 100644
--- a/baobab/src/baobab-ringschart.c
+++ b/baobab/src/baobab-ringschart.c
@@ -44,9 +44,6 @@
BAOBAB_RINGSCHART_TYPE, \
BaobabRingschartPrivate))
-#define CENTER_X(widget) (widget->allocation.width / 2)
-#define CENTER_Y(widget) (widget->allocation.height / 2)
-
#define ITEM_BORDER_WIDTH 1
#define CHART_PADDING 13
#define ITEM_MIN_ANGLE 0.03
@@ -186,6 +183,7 @@ baobab_ringschart_draw_item (GtkWidget *chart,
BaobabRingschartPrivate *priv;
BaobabRingschartItem *data;
BaobabChartColor fill_color;
+ GtkAllocation allocation;
priv = BAOBAB_RINGSCHART_GET_PRIVATE (chart);
@@ -210,8 +208,10 @@ baobab_ringschart_draw_item (GtkWidget *chart,
item->depth,
highlighted);
+ gtk_widget_get_allocation (chart, &allocation);
baobab_ringschart_draw_sector (cr,
- CENTER_X (chart), CENTER_Y (chart),
+ allocation.width / 2,
+ allocation.height / 2,
data->min_radius,
data->max_radius - data->min_radius,
data->start_angle,
@@ -228,6 +228,7 @@ baobab_ringschart_calculate_item_geometry (GtkWidget *chart,
BaobabRingschartItem *data;
BaobabRingschartItem p_data;
BaobabChartItem *parent = NULL;
+ GtkAllocation allocation;
gdouble max_radius;
gdouble thickness;
@@ -243,7 +244,8 @@ baobab_ringschart_calculate_item_geometry (GtkWidget *chart,
data->continued = FALSE;
item->visible = FALSE;
- max_radius = MIN (CENTER_X (chart), CENTER_Y (chart)) - CHART_PADDING;
+ gtk_widget_get_allocation (chart, &allocation);
+ max_radius = MIN (allocation.width / 2, allocation.height / 2) - CHART_PADDING;
thickness = max_radius / (max_depth + 1);
if (item->parent == NULL)
@@ -288,10 +290,12 @@ baobab_ringschart_is_point_over_item (GtkWidget *chart,
{
BaobabRingschartItem *data;
gdouble radius, angle;
+ GtkAllocation allocation;
data = (BaobabRingschartItem *) item->data;
- x = x - CENTER_X (chart);
- y = y - CENTER_Y (chart);
+ gtk_widget_get_allocation (chart, &allocation);
+ x = x - allocation.width / 2;
+ y = y - allocation.height / 2;
radius = sqrt (x*x + y*y);
angle = atan2 (y, x);
@@ -328,18 +332,20 @@ baobab_ringschart_get_item_rectangle (GtkWidget *chart,
BaobabRingschartItem *data;
GdkRectangle rect;
gdouble cx, cy, r1, r2, a1, a2;
+ GtkAllocation allocation;
data = (BaobabRingschartItem *) item->data;
- cx = CENTER_X (chart);
- cy = CENTER_Y (chart);
+ gtk_widget_get_allocation (chart, &allocation);
+ cx = allocation.width / 2;
+ cy = allocation.height / 2;
r1 = data->min_radius;
r2 = data->max_radius;
a1 = data->start_angle;
a2 = data->start_angle + data->angle;
- rect.x = chart->allocation.width;
- rect.y = chart->allocation.height;
+ rect.x = allocation.width;
+ rect.y = allocation.height;
rect.width = 0;
rect.height = 0;
@@ -432,6 +438,7 @@ baobab_ringschart_draw_subfolder_tips (GtkWidget *chart, cairo_t *cr)
gdouble sector_center_x, sector_center_y;
gdouble a;
guint i;
+ GtkAllocation allocation;
PangoLayout *layout;
PangoRectangle layout_rect;
@@ -442,8 +449,9 @@ baobab_ringschart_draw_subfolder_tips (GtkWidget *chart, cairo_t *cr)
priv = BAOBAB_RINGSCHART_GET_PRIVATE (chart);
- q_width = chart->allocation.width / 2;
- q_height = chart->allocation.height / 2;
+ gtk_widget_get_allocation (chart, &allocation);
+ q_width = allocation.width / 2;
+ q_height = allocation.height / 2;
q_angle = atan2 (q_height, q_width);
memset (&last_rect, 0, sizeof (GdkRectangle));
@@ -506,10 +514,10 @@ baobab_ringschart_draw_subfolder_tips (GtkWidget *chart, cairo_t *cr)
while (a > M_PI/2)
{
if (i % 2 == 0)
- tooltip_rect.x = chart->allocation.width - tooltip_rect.x
+ tooltip_rect.x = allocation.width - tooltip_rect.x
- tooltip_rect.width;
else
- tooltip_rect.y = chart->allocation.height - tooltip_rect.y
+ tooltip_rect.y = allocation.height - tooltip_rect.y
- tooltip_rect.height;
i++;
diff --git a/baobab/src/baobab.c b/baobab/src/baobab.c
index a16bbd1..090dfff 100644
--- a/baobab/src/baobab.c
+++ b/baobab/src/baobab.c
@@ -84,6 +84,7 @@ baobab_set_busy (gboolean busy)
{
static GdkCursor *busy_cursor = NULL;
GdkCursor *cursor = NULL;
+ GdkWindow *window;
if (busy == TRUE) {
if (!busy_cursor) {
@@ -109,8 +110,9 @@ baobab_set_busy (gboolean busy)
}
/* change the cursor */
- if (baobab.window->window) {
- gdk_window_set_cursor (baobab.window->window, cursor);
+ window = gtk_widget_get_window (baobab.window);
+ if (window) {
+ gdk_window_set_cursor (window, cursor);
}
}
@@ -947,10 +949,10 @@ drag_data_received_handl (GtkWidget *widget,
/* set "gf" if we got some valid data */
if ((selection_data != NULL) &&
- (selection_data->length >= 0) &&
+ (gtk_selection_data_get_length (selection_data) >= 0) &&
(target_type == DND_TARGET_URI_LIST)) {
gchar **uri_list;
- uri_list = g_uri_list_extract_uris ((gchar*)selection_data->data);
+ uri_list = g_uri_list_extract_uris (gtk_selection_data_get_data (selection_data));
/* check list is 1 item long */
if (uri_list != NULL && uri_list[0] != NULL && uri_list[1] == NULL) {
gf = g_file_new_for_uri (uri_list[0]);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]