[dia] general: use getters
- From: Zander <zbrown src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] general: use getters
- Date: Fri, 27 Sep 2019 11:14:53 +0000 (UTC)
commit a7bb78f68b7f1ce1c7c2293f4fd43fa2b5093364
Author: Zander Brown <zbrown gnome org>
Date: Fri Sep 27 12:14:16 2019 +0100
general: use getters
Generally neater and is required for gtk3
app/diapagelayout.c | 26 +++++---
app/display.c | 20 ++++---
app/gtkhwrapbox.c | 9 +--
app/gtkwrapbox.c | 28 +++++----
app/interface.c | 8 ++-
app/navigation.c | 52 +++++++++-------
app/ruler.c | 27 ++++-----
app/sheet-editor/sheets.c | 2 +-
lib/diaarrowchooser.c | 24 +++++---
lib/diacellrendererproperty.c | 43 ++++++++------
lib/dialinechooser.c | 23 ++++++--
meson.build | 1 +
objects/UML/class_attributes_dialog.c | 56 +++++++++---------
objects/UML/class_dialog.c | 28 ++++-----
objects/UML/class_operations_dialog.c | 108 +++++++++++++++++-----------------
objects/UML/class_templates_dialog.c | 38 ++++++------
16 files changed, 276 insertions(+), 217 deletions(-)
---
diff --git a/app/diapagelayout.c b/app/diapagelayout.c
index 9141acf4..23a295c5 100644
--- a/app/diapagelayout.c
+++ b/app/diapagelayout.c
@@ -604,6 +604,7 @@ darea_expose_event(DiaPageLayout *self, GdkEventExpose *event)
gfloat val;
gint num;
cairo_t *ctx;
+ GtkAllocation alloc;
if (!window)
return FALSE;
@@ -613,10 +614,12 @@ darea_expose_event(DiaPageLayout *self, GdkEventExpose *event)
cairo_set_line_width (ctx, 1);
cairo_set_antialias (ctx, CAIRO_ANTIALIAS_NONE);
+ gtk_widget_get_allocation (self->darea, &alloc);
+
cairo_set_source_rgba (ctx, 0, 0, 0, 0);
cairo_rectangle (ctx, 0, 0,
- self->darea->allocation.width,
- self->darea->allocation.height);
+ alloc.width,
+ alloc.height);
cairo_fill (ctx);
/* draw the page image */
@@ -711,13 +714,16 @@ max_margin (float size)
}
static void
-paper_size_change(GtkWidget *widget, DiaPageLayout *self)
+paper_size_change (GtkWidget *widget, DiaPageLayout *self)
{
gchar buf[512];
+ GtkAllocation alloc;
+
+ gtk_widget_get_allocation (self->darea, &alloc);
self->papernum = dia_option_menu_get_active (widget);
- size_page(self, &self->darea->allocation);
- gtk_widget_queue_draw(self->darea);
+ size_page (self, &alloc);
+ gtk_widget_queue_draw (self->darea);
self->block_changed = TRUE;
dia_unit_spinner_set_value(DIA_UNIT_SPINNER(self->tmargin),
@@ -759,10 +765,14 @@ paper_size_change(GtkWidget *widget, DiaPageLayout *self)
}
static void
-orient_changed(DiaPageLayout *self)
+orient_changed (DiaPageLayout *self)
{
- size_page(self, &self->darea->allocation);
- gtk_widget_queue_draw(self->darea);
+ GtkAllocation alloc;
+
+ gtk_widget_get_allocation (self->darea, &alloc);
+
+ size_page (self, &alloc);
+ gtk_widget_queue_draw (self->darea);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(self->orient_portrait))) {
dia_unit_spinner_set_upper (DIA_UNIT_SPINNER(self->tmargin),
diff --git a/app/display.c b/app/display.c
index cbed7681..940f4cbd 100644
--- a/app/display.c
+++ b/app/display.c
@@ -742,18 +742,21 @@ update_mainpoint_status(DDisplay *ddisp)
/** Scroll display to where point x,y (window coords) is visible */
gboolean
-ddisplay_autoscroll(DDisplay *ddisp, int x, int y)
+ddisplay_autoscroll (DDisplay *ddisp, int x, int y)
{
guint16 width, height;
Point scroll;
+ GtkAllocation alloc;
if (! ddisp->autoscroll)
return FALSE;
scroll.x = scroll.y = 0;
- width = GTK_WIDGET(ddisp->canvas)->allocation.width;
- height = GTK_WIDGET(ddisp->canvas)->allocation.height;
+ gtk_widget_get_allocation (ddisp->canvas, &alloc);
+
+ width = alloc.width;
+ height = alloc.height;
if (x < 0)
{
@@ -954,18 +957,21 @@ ddisplay_get_clicked_position(DDisplay *ddisp)
}
void
-ddisplay_set_renderer(DDisplay *ddisp, int aa_renderer)
+ddisplay_set_renderer (DDisplay *ddisp, int aa_renderer)
{
int width, height;
- GdkWindow *window = gtk_widget_get_window(ddisp->canvas);
+ GdkWindow *window = gtk_widget_get_window (ddisp->canvas);
+ GtkAllocation alloc;
if (ddisp->renderer)
g_object_unref (ddisp->renderer);
ddisp->aa_renderer = aa_renderer;
- width = ddisp->canvas->allocation.width;
- height = ddisp->canvas->allocation.height;
+ gtk_widget_get_allocation (ddisp->canvas, &alloc);
+
+ width = alloc.width;
+ height = alloc.height;
if (!ddisp->aa_renderer){
g_message ("Only antialias renderers supported");
diff --git a/app/gtkhwrapbox.c b/app/gtkhwrapbox.c
index 10f2d3d8..eccd8ee4 100644
--- a/app/gtkhwrapbox.c
+++ b/app/gtkhwrapbox.c
@@ -230,8 +230,8 @@ gtk_hwrap_box_size_request (GtkWidget *widget,
}
while (row_inc);
- requisition->width += GTK_CONTAINER (wbox)->border_width * 2; /*<h2v-skip>*/
- requisition->height += GTK_CONTAINER (wbox)->border_width * 2; /*<h2v-skip>*/
+ requisition->width += gtk_container_get_border_width (GTK_CONTAINER (wbox)) * 2; /*<h2v-skip>*/
+ requisition->height += gtk_container_get_border_width (GTK_CONTAINER (wbox)) * 2; /*<h2v-skip>*/
/* g_print ("chosen: width %d, height %d\n",
requisition->width,
requisition->height);
@@ -589,9 +589,8 @@ gtk_hwrap_box_size_allocate (GtkWidget *widget,
{
GtkWrapBox *wbox = GTK_WRAP_BOX (widget);
GtkAllocation area;
- gint border = GTK_CONTAINER (wbox)->border_width; /*<h2v-skip>*/
+ gint border = gtk_container_get_border_width (GTK_CONTAINER (wbox)); /*<h2v-skip>*/
- widget->allocation = *allocation;
area.x = allocation->x + border;
area.y = allocation->y + border;
area.width = MAX (1, (gint) allocation->width - border * 2);
@@ -605,4 +604,6 @@ gtk_hwrap_box_size_allocate (GtkWidget *widget,
/*<h2v-on>*/
layout_rows (wbox, &area);
+
+ GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
}
diff --git a/app/gtkwrapbox.c b/app/gtkwrapbox.c
index 01d6851d..53773db5 100644
--- a/app/gtkwrapbox.c
+++ b/app/gtkwrapbox.c
@@ -349,8 +349,14 @@ gtk_wrap_box_get_property (GObject *object,
g_value_set_float (value, wbox->aspect_ratio);
break;
case PROP_CURRENT_RATIO:
- g_value_set_float (value, (((gfloat) widget->allocation.width) /
- ((gfloat) widget->allocation.height)));
+ {
+ GtkAllocation alloc;
+
+ gtk_widget_get_allocation (widget, &alloc);
+
+ g_value_set_float (value, (((gfloat) alloc.width) /
+ ((gfloat) alloc.height)));
+ }
break;
case PROP_CHILD_LIMIT:
g_value_set_uint (value, wbox->child_limit);
@@ -572,7 +578,7 @@ gtk_wrap_box_pack (GtkWrapBox *wbox,
{
g_return_if_fail (GTK_IS_WRAP_BOX (wbox));
g_return_if_fail (GTK_IS_WIDGET (child));
- g_return_if_fail (child->parent == NULL);
+ g_return_if_fail (gtk_widget_get_parent (child) == NULL);
gtk_wrap_box_pack_wrapped (wbox, child, hexpand, hfill, vexpand, vfill, FALSE);
}
@@ -590,7 +596,7 @@ gtk_wrap_box_pack_wrapped (GtkWrapBox *wbox,
g_return_if_fail (GTK_IS_WRAP_BOX (wbox));
g_return_if_fail (GTK_IS_WIDGET (child));
- g_return_if_fail (child->parent == NULL);
+ g_return_if_fail (gtk_widget_get_parent (child) == NULL);
child_info = g_slice_new (GtkWrapBoxChild);
@@ -756,7 +762,7 @@ gtk_wrap_box_query_line_lengths (GtkWrapBox *wbox,
guint *_n_lines)
{
GtkWrapBoxChild *next_child = NULL;
- GtkAllocation area, *allocation;
+ GtkAllocation area, allocation;
gboolean expand_line;
GSList *slist;
guint max_child_size, border, n_lines = 0, *lines = NULL;
@@ -765,12 +771,12 @@ gtk_wrap_box_query_line_lengths (GtkWrapBox *wbox,
*_n_lines = 0;
g_return_val_if_fail (GTK_IS_WRAP_BOX (wbox), NULL);
- allocation = >K_WIDGET (wbox)->allocation;
- border = GTK_CONTAINER (wbox)->border_width;
- area.x = allocation->x + border;
- area.y = allocation->y + border;
- area.width = MAX (1, (gint) allocation->width - border * 2);
- area.height = MAX (1, (gint) allocation->height - border * 2);
+ gtk_widget_get_allocation (GTK_WIDGET (wbox), &allocation);
+ border = gtk_container_get_border_width (GTK_CONTAINER (wbox));
+ area.x = allocation.x + border;
+ area.y = allocation.y + border;
+ area.width = MAX (1, (gint) allocation.width - border * 2);
+ area.height = MAX (1, (gint) allocation.height - border * 2);
next_child = wbox->children;
slist = GTK_WRAP_BOX_GET_CLASS (wbox)->rlist_line_children (wbox,
diff --git a/app/interface.c b/app/interface.c
index aea97918..fbb6f0c9 100644
--- a/app/interface.c
+++ b/app/interface.c
@@ -703,6 +703,7 @@ create_display_shell(DDisplay *ddisp,
GtkWidget *root_vbox = NULL;
GtkWidget *zoom_hbox, *zoom_label;
int s_width, s_height;
+ GtkAllocation alloc;
if (app_is_interactive() && is_integrated_ui())
{
@@ -855,9 +856,10 @@ create_display_shell(DDisplay *ddisp,
}
gtk_widget_show (ddisp->shell);
+ gtk_widget_get_allocation (ddisp->hrule, &alloc);
+
/* before showing up, checking canvas's REAL size */
- if (use_mbar && ddisp->hrule->allocation.width > width)
- {
+ if (use_mbar && alloc.width > width) {
/* The menubar is not shrinkable, so the shell will have at least
* the menubar's width. If the diagram's requested width is smaller,
* the canvas will be enlarged to fit the place. In this case, we
@@ -865,7 +867,7 @@ create_display_shell(DDisplay *ddisp,
* that will be allocated, which the same as the hrule got.
*/
- width = ddisp->hrule->allocation.width;
+ width = alloc.width;
gtk_adjustment_set_upper (ddisp->hsbdata, width);
gtk_adjustment_set_page_increment (ddisp->hsbdata, (width - 1) / 4);
diff --git a/app/navigation.c b/app/navigation.c
index 51323bb7..baf1fc98 100644
--- a/app/navigation.c
+++ b/app/navigation.c
@@ -161,6 +161,7 @@ on_button_navigation_popup_pressed (GtkButton * button, gpointer _ddisp)
int canvas_width, canvas_height;/*pixels*/
int diagram_width, diagram_height;/*pixels*/
GtkAdjustment * adj;
+ GtkAllocation alloc;
nav->max_size = THUMBNAIL_MAX_SIZE;
@@ -182,8 +183,10 @@ on_button_navigation_popup_pressed (GtkButton * button, gpointer _ddisp)
if (diagram_width * diagram_height == 0)
return; /* don't crash with no size, i.e. empty diagram */
- canvas_width = nav->ddisp->canvas->allocation.width;
- canvas_height = nav->ddisp->canvas->allocation.height;
+ gtk_widget_get_allocation (nav->ddisp->canvas, &alloc);
+
+ canvas_width = alloc.width;
+ canvas_height = alloc.height;
nav->frame_w = nav->width * canvas_width / diagram_width;
nav->frame_h = nav->height * canvas_height / diagram_height;
@@ -193,11 +196,11 @@ on_button_navigation_popup_pressed (GtkButton * button, gpointer _ddisp)
/*and store the ratio thumbnail/adjustement(speedup on motion)*/
adj = nav->ddisp->hsbdata;
reset_sc_adj (adj, rect.left, rect.right, canvas_width / nav->ddisp->zoom_factor);
- nav->hadj_coef = (adj->upper - adj->page_size - adj->lower) / (nav->width - nav->frame_w);
+ nav->hadj_coef = (gtk_adjustment_get_upper (adj) - gtk_adjustment_get_page_size (adj) -
gtk_adjustment_get_lower (adj)) / (nav->width - nav->frame_w);
adj = nav->ddisp->vsbdata;
reset_sc_adj (adj, rect.top, rect.bottom, canvas_height / nav->ddisp->zoom_factor);
- nav->vadj_coef = (adj->upper - adj->page_size - adj->lower) / (nav->height - nav->frame_h);
+ nav->vadj_coef = (gtk_adjustment_get_upper (adj) - gtk_adjustment_get_page_size (adj) -
gtk_adjustment_get_lower (adj)) / (nav->height - nav->frame_h);
}
/*--GUI*/
@@ -275,15 +278,20 @@ on_button_navigation_popup_pressed (GtkButton * button, gpointer _ddisp)
static void
reset_sc_adj (GtkAdjustment * adj, gdouble lower, gdouble upper, gdouble page)
{
- adj->page_size = page;
+ gtk_adjustment_set_page_size (adj, page);
+
+ gtk_adjustment_set_lower (adj, lower);
+ gtk_adjustment_set_upper (adj, upper);
- adj->lower = lower;
- adj->upper = upper;
+ if (gtk_adjustment_get_value (adj) < lower) {
+ gtk_adjustment_set_value (adj, lower);
+ }
- if (adj->value < lower) adj->value = lower;
- if (adj->value > (upper - page)) adj->value = upper - page;
+ if (gtk_adjustment_get_value (adj) > (upper - page)) {
+ gtk_adjustment_set_value (adj, upper - page);
+ }
- gtk_adjustment_changed(adj);
+ gtk_adjustment_changed (adj);
}
@@ -307,10 +315,10 @@ on_da_expose_event (GtkWidget * widget, GdkEventExpose * event, gpointer unused)
cairo_fill (ctx);
adj = nav->ddisp->hsbdata;
- x = (adj->value - adj->lower) / (adj->upper - adj->lower) * (nav->width) +1;
+ x = (gtk_adjustment_get_value (adj) - gtk_adjustment_get_lower (adj)) / (gtk_adjustment_get_upper (adj) -
gtk_adjustment_get_lower (adj)) * (nav->width) +1;
adj = nav->ddisp->vsbdata;
- y = (adj->value - adj->lower) / (adj->upper - adj->lower) * (nav->height) +1;
+ y = (gtk_adjustment_get_value (adj) - gtk_adjustment_get_lower (adj)) / (gtk_adjustment_get_upper (adj) -
gtk_adjustment_get_lower (adj)) * (nav->height) +1;
/*draw directly on the window, do not buffer the miniframe*/
cairo_set_source_rgb (ctx, 0, 0, 0);
@@ -343,15 +351,15 @@ on_da_motion_notify_event (GtkWidget * drawing_area, GdkEventMotion * event, gpo
adj = nav->ddisp->hsbdata;
value_changed = FALSE;
if (w/2 <= event->x && event->x <= (nav->width - w/2)){
- adj->value = adj->lower + x * nav->hadj_coef;
+ gtk_adjustment_set_value (adj, gtk_adjustment_get_lower (adj) + x * nav->hadj_coef);
value_changed = TRUE;
}
- else if (x == 0 && adj->value != adj->lower){/*you've been too fast! :)*/
- adj->value = adj->lower;
+ else if (x == 0 && gtk_adjustment_get_value (adj) != gtk_adjustment_get_lower (adj)){/*you've been too
fast! :)*/
+ gtk_adjustment_set_value (adj, gtk_adjustment_get_lower (adj));
value_changed = TRUE;
}
- else if (x == (nav->width - w) && adj->value != (adj->upper - adj->page_size)){/*idem*/
- adj->value = adj->upper - adj->page_size;
+ else if (x == (nav->width - w) && gtk_adjustment_get_value (adj) != (gtk_adjustment_get_upper (adj) -
gtk_adjustment_get_page_size (adj))){/*idem*/
+ gtk_adjustment_set_value (adj, gtk_adjustment_get_upper (adj) - gtk_adjustment_get_page_size (adj));
value_changed = TRUE;
}
if (value_changed) gtk_adjustment_value_changed(adj);
@@ -359,15 +367,15 @@ on_da_motion_notify_event (GtkWidget * drawing_area, GdkEventMotion * event, gpo
adj = nav->ddisp->vsbdata;
value_changed = FALSE;
if (h/2 <= event->y && event->y <= (nav->height - h/2)){
- adj->value = adj->lower + y * nav->vadj_coef;
+ gtk_adjustment_set_value (adj, gtk_adjustment_get_lower (adj) + y * nav->vadj_coef);
value_changed = TRUE;
}
- else if (y == 0 && adj->value != adj->lower){/*you've been too fast! :)*/
- adj->value = adj->lower;
+ else if (y == 0 && gtk_adjustment_get_value (adj) != gtk_adjustment_get_lower (adj)){/*you've been too
fast! :)*/
+ gtk_adjustment_set_value (adj, gtk_adjustment_get_lower (adj));
value_changed = TRUE;
}
- else if (y == (nav->height - h) && adj->value != (adj->upper - adj->page_size)){/*idem*/
- adj->value = adj->upper - adj->page_size;
+ else if (y == (nav->height - h) && gtk_adjustment_get_value (adj) != (gtk_adjustment_get_upper (adj) -
gtk_adjustment_get_page_size (adj))){/*idem*/
+ gtk_adjustment_set_value (adj, gtk_adjustment_get_upper (adj) - gtk_adjustment_get_page_size (adj));
value_changed = TRUE;
}
if (value_changed) gtk_adjustment_value_changed(adj);
diff --git a/app/ruler.c b/app/ruler.c
index c03796fc..66aaf46c 100644
--- a/app/ruler.c
+++ b/app/ruler.c
@@ -68,15 +68,14 @@ dia_ruler_draw (GtkWidget *widget,
PangoLayout *layout;
int x, y, dx, dy, width, height;
real pos;
+ GtkAllocation alloc;
layout = gtk_widget_create_pango_layout (widget, "012456789");
-#if GTK_CHECK_VERSION(3,0,0)
- width = gtk_widget_get_allocated_width (widget);
- height = gtk_widget_get_allocated_height (widget);
-#else
- width = widget->allocation.width;
- height = widget->allocation.height;
-#endif
+
+ gtk_widget_get_allocation (widget, &alloc);
+ width = alloc.width;
+ height = alloc.height;
+
dx = (ruler->orientation == GTK_ORIENTATION_VERTICAL) ? width/3 : 0;
dy = (ruler->orientation == GTK_ORIENTATION_HORIZONTAL) ? height/3 : 0;
@@ -177,19 +176,17 @@ dia_ruler_motion_notify (GtkWidget *widget,
real tmp;
gint width, height;
gint x0, y0;
+ GtkAllocation alloc;
gdk_event_request_motions (event);
x = event->x;
y = event->y;
-#if GTK_CHECK_VERSION(3,0,0)
- width = gtk_widget_get_allocated_width (widget);
- height = gtk_widget_get_allocated_height (widget);
-#else
- width = widget->allocation.width;
- height = widget->allocation.height;
-#endif
- gdk_drawable_get_size (widget->window, &width, &height);
+ gtk_widget_get_allocation (widget, &alloc);
+ width = alloc.width;
+ height = alloc.height;
+
+ gdk_drawable_get_size (gtk_widget_get_window (widget), &width, &height);
if (ruler->orientation == GTK_ORIENTATION_HORIZONTAL)
{
diff --git a/app/sheet-editor/sheets.c b/app/sheet-editor/sheets.c
index f840bc83..8e2d5ff2 100644
--- a/app/sheet-editor/sheets.c
+++ b/app/sheet-editor/sheets.c
@@ -398,7 +398,7 @@ lookup_widget (GtkWidget *widget,
if (GTK_IS_MENU (widget)) {
parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
} else {
- parent = widget->parent;
+ parent = gtk_widget_get_parent (widget);
}
if (parent == NULL) {
diff --git a/lib/diaarrowchooser.c b/lib/diaarrowchooser.c
index 2e444ede..58246d4d 100644
--- a/lib/diaarrowchooser.c
+++ b/lib/diaarrowchooser.c
@@ -102,10 +102,15 @@ dia_arrow_preview_class_init(DiaArrowPreviewClass *class)
static void
dia_arrow_preview_init(DiaArrowPreview *arrow)
{
+ int xpad, ypad;
+
gtk_widget_set_has_window (GTK_WIDGET (arrow), FALSE);
- GTK_WIDGET (arrow)->requisition.width = 40 + GTK_MISC (arrow)->xpad * 2;
- GTK_WIDGET (arrow)->requisition.height = 20 + GTK_MISC (arrow)->ypad * 2;
+ gtk_misc_get_padding (GTK_MISC (arrow), &xpad, &ypad);
+
+ gtk_widget_set_size_request (GTK_WIDGET (arrow),
+ 40 + xpad * 2,
+ 20 + ypad * 2);
arrow->atype = ARROW_NONE;
arrow->left = TRUE;
@@ -157,18 +162,23 @@ dia_arrow_preview_expose(GtkWidget *widget, GdkEventExpose *event)
DiaCairoRenderer *renderer;
DiaArrowPreview *arrow = DIA_ARROW_PREVIEW(widget);
Arrow arrow_type;
- GtkMisc *misc = GTK_MISC(widget);
+ GtkMisc *misc = GTK_MISC (widget);
gint width, height;
gint x, y;
GdkWindow *win;
int linewidth = 2;
cairo_surface_t *surface;
cairo_t *ctx;
+ GtkAllocation alloc;
+ int xpad, ypad;
+
+ gtk_widget_get_allocation (widget, &alloc);
+ gtk_misc_get_padding (misc, &xpad, &ypad);
- width = widget->allocation.width - misc->xpad * 2;
- height = widget->allocation.height - misc->ypad * 2;
- x = (widget->allocation.x + misc->xpad);
- y = (widget->allocation.y + misc->ypad);
+ width = alloc.width - xpad * 2;
+ height = alloc.height - ypad * 2;
+ x = (alloc.x + xpad);
+ y = (alloc.y + ypad);
win = gtk_widget_get_window (widget);
diff --git a/lib/diacellrendererproperty.c b/lib/diacellrendererproperty.c
index 512cb55d..71c0a10e 100644
--- a/lib/diacellrendererproperty.c
+++ b/lib/diacellrendererproperty.c
@@ -127,7 +127,9 @@ dia_cell_renderer_property_class_init (DiaCellRendererPropertyClass *klass)
static void
dia_cell_renderer_property_init (DiaCellRendererProperty *cellproperty)
{
- GTK_CELL_RENDERER (cellproperty)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE;
+ g_object_set (cellproperty,
+ "mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE,
+ NULL);
}
static void
@@ -205,6 +207,13 @@ dia_cell_renderer_property_get_size (GtkCellRenderer *cell,
gint view_height = 0;
gint calc_width;
gint calc_height;
+ int xpad;
+ int ypad;
+ gfloat xalign;
+ gfloat yalign;
+
+ gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
+ gtk_cell_renderer_get_alignment (cell, &xalign, &yalign);
#if 0
cellproperty = DIA_CELL_RENDERER_PROPERTY (cell);
@@ -222,28 +231,26 @@ dia_cell_renderer_property_get_size (GtkCellRenderer *cell,
view_height = 30;
#endif
- calc_width = (gint) cell->xpad * 2 + view_width;
- calc_height = (gint) cell->ypad * 2 + view_height;
+ calc_width = (gint) xpad * 2 + view_width;
+ calc_height = (gint) ypad * 2 + view_height;
if (x_offset) *x_offset = 0;
if (y_offset) *y_offset = 0;
- if (cell_area && view_width > 0 && view_height > 0)
- {
- if (x_offset)
- {
- *x_offset = (((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?
- 1.0 - cell->xalign : cell->xalign) *
- (cell_area->width - calc_width - 2 * cell->xpad));
- *x_offset = (MAX (*x_offset, 0) + cell->xpad);
- }
- if (y_offset)
- {
- *y_offset = (cell->yalign *
- (cell_area->height - calc_height - 2 * cell->ypad));
- *y_offset = (MAX (*y_offset, 0) + cell->ypad);
- }
+ if (cell_area && view_width > 0 && view_height > 0) {
+ if (x_offset) {
+ *x_offset = (((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?
+ 1.0 - xalign : xalign) *
+ (cell_area->width - calc_width - 2 * xpad));
+ *x_offset = (MAX (*x_offset, 0) + xpad);
+ }
+
+ if (y_offset) {
+ *y_offset = (yalign *
+ (cell_area->height - calc_height - 2 * ypad));
+ *y_offset = (MAX (*y_offset, 0) + ypad);
}
+ }
if (width) *width = calc_width;
if (height) *height = calc_height;
diff --git a/lib/dialinechooser.c b/lib/dialinechooser.c
index 65c4012a..a9aeb40b 100644
--- a/lib/dialinechooser.c
+++ b/lib/dialinechooser.c
@@ -74,10 +74,15 @@ dia_line_preview_class_init (DiaLinePreviewClass *class)
static void
dia_line_preview_init (DiaLinePreview *line)
{
+ int xpad, ypad;
+
gtk_widget_set_has_window (GTK_WIDGET (line), FALSE);
- GTK_WIDGET (line)->requisition.width = 30 + GTK_MISC (line)->xpad * 2;
- GTK_WIDGET (line)->requisition.height = 15 + GTK_MISC (line)->ypad * 2;
+ gtk_misc_get_padding (GTK_MISC (line), &xpad, &ypad);
+
+ gtk_widget_set_size_request (GTK_WIDGET (line),
+ 30 + xpad * 2,
+ 15 + ypad * 2);
line->lstyle = LINESTYLE_SOLID;
}
@@ -115,10 +120,16 @@ dia_line_preview_expose(GtkWidget *widget, GdkEventExpose *event)
cairo_t *ctx;
if (gtk_widget_is_drawable(widget)) {
- width = widget->allocation.width - misc->xpad * 2;
- height = widget->allocation.height - misc->ypad * 2;
- x = (widget->allocation.x + misc->xpad);
- y = (widget->allocation.y + misc->ypad);
+ GtkAllocation alloc;
+ int xpad, ypad;
+
+ gtk_widget_get_allocation (widget, &alloc);
+ gtk_misc_get_padding (misc, &xpad, &ypad);
+
+ width = alloc.width - xpad * 2;
+ height = alloc.height - ypad * 2;
+ x = (alloc.x + xpad);
+ y = (alloc.y + ypad);
win = gtk_widget_get_window (widget);
style = gtk_widget_get_style (widget);
diff --git a/meson.build b/meson.build
index fa5507ec..b9dd8dc7 100644
--- a/meson.build
+++ b/meson.build
@@ -71,6 +71,7 @@ add_project_arguments([
'-DGDK_VERSION_MAX_ALLOWED=@0@'.format(gtk_ver),
'-DGLIB_VERSION_MIN_REQUIRED=@0@'.format(glib_ver),
'-DGLIB_VERSION_MAX_ALLOWED=@0@'.format(glib_ver),
+ '-DGSEAL_ENABLE',
], language: 'c')
subdir('po')
diff --git a/objects/UML/class_attributes_dialog.c b/objects/UML/class_attributes_dialog.c
index 39fd041d..49404719 100644
--- a/objects/UML/class_attributes_dialog.c
+++ b/objects/UML/class_attributes_dialog.c
@@ -82,13 +82,13 @@ attributes_get_values (UMLClassDialog *prop_dialog, UMLAttribute *attr)
attr->name = g_strdup (gtk_entry_get_text (prop_dialog->attr_name));
attr->type = g_strdup (gtk_entry_get_text (prop_dialog->attr_type));
-
+
attr->value = g_strdup (gtk_entry_get_text(prop_dialog->attr_value));
attr->comment = g_strdup (_class_get_comment(prop_dialog->attr_comment));
attr->visibility = (UMLVisibility)dia_option_menu_get_active (prop_dialog->attr_visible);
-
- attr->class_scope = prop_dialog->attr_class_scope->active;
+
+ attr->class_scope = gtk_toggle_button_get_active (prop_dialog->attr_class_scope);
}
void
@@ -148,7 +148,7 @@ attributes_list_selection_changed_callback(GtkWidget *gtklist,
return;
_attributes_get_current_values(prop_dialog);
-
+
list = GTK_LIST(gtklist)->selection;
if (!list && prop_dialog) { /* No selected */
attributes_set_sensitive(prop_dialog, FALSE);
@@ -156,7 +156,7 @@ attributes_list_selection_changed_callback(GtkWidget *gtklist,
prop_dialog->current_attr = NULL;
return;
}
-
+
list_item = G_OBJECT(list->data);
attr = (UMLAttribute *)g_object_get_data(G_OBJECT(list_item), "user_data");
attributes_set_values(prop_dialog, attr);
@@ -182,9 +182,9 @@ attributes_list_new_callback(GtkWidget *button,
attr = uml_attribute_new();
/* need to make the new ConnectionPoint valid and remember them */
uml_attribute_ensure_connection_points (attr, ¨class->element.object);
- prop_dialog->added_connections =
+ prop_dialog->added_connections =
g_list_prepend(prop_dialog->added_connections, attr->left_connection);
- prop_dialog->added_connections =
+ prop_dialog->added_connections =
g_list_prepend(prop_dialog->added_connections, attr->right_connection);
utfstr = uml_get_attribute_string (attr);
@@ -195,7 +195,7 @@ attributes_list_new_callback(GtkWidget *button,
g_object_set_data(G_OBJECT(list_item), "user_data", attr);
g_signal_connect (G_OBJECT (list_item), "destroy",
G_CALLBACK (attribute_list_item_destroy_callback), NULL);
-
+
list = g_list_append(NULL, list_item);
gtk_list_append_items(prop_dialog->attributes_list, list);
@@ -229,7 +229,7 @@ attributes_list_delete_callback(GtkWidget *button,
g_list_prepend(prop_dialog->deleted_connections,
attr->right_connection);
}
-
+
list = g_list_prepend(NULL, gtklist->selection->data);
gtk_list_remove_items(gtklist, list);
g_list_free(list);
@@ -247,13 +247,13 @@ attributes_list_move_up_callback(GtkWidget *button,
GtkList *gtklist;
GtkWidget *list_item;
int i;
-
+
prop_dialog = umlclass->properties_dialog;
gtklist = GTK_LIST(prop_dialog->attributes_list);
if (gtklist->selection != NULL) {
list_item = GTK_WIDGET(gtklist->selection->data);
-
+
i = gtk_list_child_position(gtklist, list_item);
if (i>0)
i--;
@@ -283,12 +283,12 @@ attributes_list_move_down_callback(GtkWidget *button,
if (gtklist->selection != NULL) {
list_item = GTK_WIDGET(gtklist->selection->data);
-
+
i = gtk_list_child_position(gtklist, list_item);
if (i<(g_list_length(gtklist->children)-1))
i++;
-
+
g_object_ref(list_item);
list = g_list_prepend(NULL, list_item);
gtk_list_remove_items(gtklist, list);
@@ -330,13 +330,13 @@ _attributes_read_from_dialog(UMLClass *umlclass,
clear_list = NULL;
while (list != NULL) {
list_item = GTK_WIDGET(list->data);
-
+
clear_list = g_list_prepend (clear_list, list_item);
attr = (UMLAttribute *)
g_object_get_data(G_OBJECT(list_item), "user_data");
g_object_set_data(G_OBJECT(list_item), "user_data", NULL);
umlclass->attributes = g_list_append(umlclass->attributes, attr);
-
+
if (attr->left_connection == NULL) {
uml_attribute_ensure_connection_points (attr, obj);
@@ -348,8 +348,8 @@ _attributes_read_from_dialog(UMLClass *umlclass,
attr->right_connection);
}
- if ( (prop_dialog->attr_vis->active) &&
- (!prop_dialog->attr_supp->active) ) {
+ if ( (gtk_toggle_button_get_active (prop_dialog->attr_vis)) &&
+ (!gtk_toggle_button_get_active (prop_dialog->attr_supp)) ) {
obj->connections[connection_index] = attr->left_connection;
connection_index++;
obj->connections[connection_index] = attr->right_connection;
@@ -382,7 +382,7 @@ _attributes_fill_in_dialog(UMLClass *umlclass)
int i;
#ifdef DEBUG
- umlclass_sanity_check(umlclass, "Filling in dialog");
+ umlclass_sanity_check(umlclass, "Filling in dialog");
#endif
prop_dialog = umlclass->properties_dialog;
@@ -405,7 +405,7 @@ _attributes_fill_in_dialog(UMLClass *umlclass)
G_CALLBACK (attribute_list_item_destroy_callback), NULL);
gtk_container_add (GTK_CONTAINER (prop_dialog->attributes_list), list_item);
gtk_widget_show (list_item);
-
+
list = g_list_next(list); i++;
g_free (attrstr);
}
@@ -429,7 +429,7 @@ attributes_update_event(GtkWidget *widget, GdkEventFocus *ev, UMLClass *umlclass
return 0;
}
-void
+void
_attributes_create_page(GtkNotebook *notebook, UMLClass *umlclass)
{
UMLClassDialog *prop_dialog;
@@ -453,15 +453,15 @@ _attributes_create_page(GtkNotebook *notebook, UMLClass *umlclass)
/* Attributes page: */
page_label = gtk_label_new_with_mnemonic (_("_Attributes"));
-
+
vbox = gtk_vbox_new(FALSE, 5);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
hbox = gtk_hbox_new(FALSE, 5);
-
+
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
- GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_box_pack_start (GTK_BOX (hbox), scrolled_win, TRUE, TRUE, 0);
gtk_widget_show (scrolled_win);
@@ -559,7 +559,7 @@ _attributes_create_page(GtkNotebook *notebook, UMLClass *umlclass)
g_signal_connect (G_OBJECT (entry), "focus_out_event",
G_CALLBACK (attributes_update_event), umlclass);
#if 0 /* while the GtkEntry has a "activate" signal, GtkTextView does not.
- * Maybe we should connect to "set-focus-child" instead?
+ * Maybe we should connect to "set-focus-child" instead?
*/
g_signal_connect (G_OBJECT (entry), "activate",
G_CALLBACK (attributes_update), umlclass);
@@ -579,7 +579,7 @@ _attributes_create_page(GtkNotebook *notebook, UMLClass *umlclass)
dia_option_menu_add_item(omenu, _("Protected"), UML_PROTECTED);
dia_option_menu_add_item(omenu, _("Implementation"), UML_IMPLEMENTATION);
- {
+ {
GtkWidget * align;
align = gtk_alignment_new(0.0, 0.5, 0.0, 0.0);
gtk_container_add(GTK_CONTAINER(align), omenu);
@@ -593,11 +593,11 @@ _attributes_create_page(GtkNotebook *notebook, UMLClass *umlclass)
prop_dialog->attr_class_scope = GTK_TOGGLE_BUTTON(checkbox);
gtk_box_pack_start (GTK_BOX (hbox2), checkbox, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, TRUE, 0);
-
+
gtk_widget_show(vbox2);
-
+
gtk_widget_show_all (vbox);
gtk_widget_show (page_label);
gtk_notebook_append_page(notebook, vbox, page_label);
-
+
}
diff --git a/objects/UML/class_dialog.c b/objects/UML/class_dialog.c
index 65eb3614..35b03dba 100644
--- a/objects/UML/class_dialog.c
+++ b/objects/UML/class_dialog.c
@@ -197,20 +197,20 @@ class_read_from_dialog(UMLClass *umlclass, UMLClassDialog *prop_dialog)
else
umlclass->comment = NULL;
- umlclass->abstract = prop_dialog->abstract_class->active;
- umlclass->visible_attributes = prop_dialog->attr_vis->active;
- umlclass->visible_operations = prop_dialog->op_vis->active;
- umlclass->wrap_operations = prop_dialog->op_wrap->active;
+ umlclass->abstract = gtk_toggle_button_get_active (prop_dialog->abstract_class);
+ umlclass->visible_attributes = gtk_toggle_button_get_active (prop_dialog->attr_vis);
+ umlclass->visible_operations = gtk_toggle_button_get_active (prop_dialog->op_vis);
+ umlclass->wrap_operations = gtk_toggle_button_get_active (prop_dialog->op_wrap);
umlclass->wrap_after_char = gtk_spin_button_get_value_as_int(prop_dialog->wrap_after_char);
umlclass->comment_line_length = gtk_spin_button_get_value_as_int(prop_dialog->comment_line_length);
- umlclass->comment_tagging = prop_dialog->comment_tagging->active;
- umlclass->visible_comments = prop_dialog->comments_vis->active;
- umlclass->suppress_attributes = prop_dialog->attr_supp->active;
- umlclass->suppress_operations = prop_dialog->op_supp->active;
- umlclass->line_width = gtk_spin_button_get_value(prop_dialog->line_width);
- dia_color_selector_get_color(GTK_WIDGET(prop_dialog->text_color), ¨class->text_color);
- dia_color_selector_get_color(GTK_WIDGET(prop_dialog->line_color), ¨class->line_color);
- dia_color_selector_get_color(GTK_WIDGET(prop_dialog->fill_color), ¨class->fill_color);
+ umlclass->comment_tagging = gtk_toggle_button_get_active (prop_dialog->comment_tagging);
+ umlclass->visible_comments = gtk_toggle_button_get_active (prop_dialog->comments_vis);
+ umlclass->suppress_attributes = gtk_toggle_button_get_active (prop_dialog->attr_supp);
+ umlclass->suppress_operations = gtk_toggle_button_get_active (prop_dialog->op_supp);
+ umlclass->line_width = gtk_spin_button_get_value (prop_dialog->line_width);
+ dia_color_selector_get_color (GTK_WIDGET (prop_dialog->text_color), ¨class->text_color);
+ dia_color_selector_get_color (GTK_WIDGET (prop_dialog->line_color), ¨class->line_color);
+ dia_color_selector_get_color (GTK_WIDGET (prop_dialog->fill_color), ¨class->fill_color);
umlclass->normal_font = dia_font_selector_get_font (prop_dialog->normal_font);
umlclass->polymorphic_font = dia_font_selector_get_font (prop_dialog->polymorphic_font);
@@ -602,11 +602,11 @@ umlclass_apply_props_from_dialog(UMLClass *umlclass, GtkWidget *widget)
/* Allocate enought connection points for attributes and operations. */
/* (two per op/attr) */
- if ( (prop_dialog->attr_vis->active) && (!prop_dialog->attr_supp->active))
+ if ( (gtk_toggle_button_get_active (prop_dialog->attr_vis)) && (!gtk_toggle_button_get_active
(prop_dialog->attr_supp)))
num_attrib = g_list_length(prop_dialog->attributes_list->children);
else
num_attrib = 0;
- if ( (prop_dialog->op_vis->active) && (!prop_dialog->op_supp->active))
+ if ( (gtk_toggle_button_get_active (prop_dialog->op_vis)) && (!gtk_toggle_button_get_active
(prop_dialog->op_supp)))
num_ops = g_list_length(prop_dialog->operations_list->children);
else
num_ops = 0;
diff --git a/objects/UML/class_operations_dialog.c b/objects/UML/class_operations_dialog.c
index ebce55a5..1cb12b40 100644
--- a/objects/UML/class_operations_dialog.c
+++ b/objects/UML/class_operations_dialog.c
@@ -77,10 +77,10 @@ parameters_get_values (UMLClassDialog *prop_dialog, UMLParameter *param)
g_free(param->comment);
if (param->value != NULL)
g_free(param->value);
-
+
param->name = g_strdup (gtk_entry_get_text (prop_dialog->param_name));
param->type = g_strdup (gtk_entry_get_text (prop_dialog->param_type));
-
+
param->value = g_strdup (gtk_entry_get_text(prop_dialog->param_value));
param->comment = g_strdup (_class_get_comment(prop_dialog->param_comment));
@@ -123,7 +123,7 @@ parameters_list_selection_changed_callback(GtkWidget *gtklist,
return; /* maybe hiding a bug elsewhere */
parameters_get_current_values(prop_dialog);
-
+
list = GTK_LIST(gtklist)->selection;
if (!list) { /* No selected */
parameters_set_sensitive(prop_dialog, FALSE);
@@ -131,7 +131,7 @@ parameters_list_selection_changed_callback(GtkWidget *gtklist,
prop_dialog->current_param = NULL;
return;
}
-
+
list_item = G_OBJECT(list->data);
param = (UMLParameter *)g_object_get_data(G_OBJECT(list_item), "user_data");
parameters_set_values(prop_dialog, param);
@@ -158,7 +158,7 @@ parameters_list_new_callback(GtkWidget *button,
current_op = (UMLOperation *)
g_object_get_data(G_OBJECT(prop_dialog->current_op), "user_data");
-
+
param = uml_parameter_new();
utf = uml_get_parameter_string (param);
@@ -170,7 +170,7 @@ parameters_list_new_callback(GtkWidget *button,
current_op->parameters = g_list_append(current_op->parameters,
(gpointer) param);
-
+
list = g_list_append(NULL, list_item);
gtk_list_append_items(prop_dialog->parameters_list, list);
@@ -191,7 +191,7 @@ parameters_list_delete_callback(GtkWidget *button,
GtkList *gtklist;
UMLOperation *current_op;
UMLParameter *param;
-
+
prop_dialog = umlclass->properties_dialog;
gtklist = GTK_LIST(prop_dialog->parameters_list);
@@ -202,11 +202,11 @@ parameters_list_delete_callback(GtkWidget *button,
g_object_get_data(G_OBJECT(prop_dialog->current_op), "user_data");
param = (UMLParameter *)
g_object_get_data(G_OBJECT(prop_dialog->current_param), "user_data");
-
+
current_op->parameters = g_list_remove(current_op->parameters,
(gpointer) param);
uml_parameter_destroy(param);
-
+
/* Remove from gtk list: */
list = g_list_prepend(NULL, prop_dialog->current_param);
@@ -228,13 +228,13 @@ parameters_list_move_up_callback(GtkWidget *button,
UMLOperation *current_op;
UMLParameter *param;
int i;
-
+
prop_dialog = umlclass->properties_dialog;
gtklist = GTK_LIST(prop_dialog->parameters_list);
if (gtklist->selection != NULL) {
list_item = GTK_WIDGET(gtklist->selection->data);
-
+
i = gtk_list_child_position(gtklist, list_item);
if (i>0)
i--;
@@ -244,7 +244,7 @@ parameters_list_move_up_callback(GtkWidget *button,
/* Move parameter in current operations list: */
current_op = (UMLOperation *)
g_object_get_data(G_OBJECT(prop_dialog->current_op), "user_data");
-
+
current_op->parameters = g_list_remove(current_op->parameters,
(gpointer) param);
current_op->parameters = g_list_insert(current_op->parameters,
@@ -275,13 +275,13 @@ parameters_list_move_down_callback(GtkWidget *button,
UMLOperation *current_op;
UMLParameter *param;
int i;
-
+
prop_dialog = umlclass->properties_dialog;
gtklist = GTK_LIST(prop_dialog->parameters_list);
if (gtklist->selection != NULL) {
list_item = GTK_WIDGET(gtklist->selection->data);
-
+
i = gtk_list_child_position(gtklist, list_item);
if (i<(g_list_length(gtklist->children)-1))
i++;
@@ -291,7 +291,7 @@ parameters_list_move_down_callback(GtkWidget *button,
/* Move parameter in current operations list: */
current_op = (UMLOperation *)
g_object_get_data(G_OBJECT(prop_dialog->current_op), "user_data");
-
+
current_op->parameters = g_list_remove(current_op->parameters,
(gpointer) param);
current_op->parameters = g_list_insert(current_op->parameters,
@@ -373,7 +373,7 @@ operations_set_values(UMLClassDialog *prop_dialog, UMLOperation *op)
g_object_set_data(G_OBJECT(list_item), "user_data", (gpointer) param);
gtk_container_add (GTK_CONTAINER (prop_dialog->parameters_list), list_item);
gtk_widget_show (list_item);
-
+
list = g_list_next(list);
}
}
@@ -414,11 +414,11 @@ operations_get_values(UMLClassDialog *prop_dialog, UMLOperation *op)
op->stereotype = NULL;
op->visibility = (UMLVisibility)dia_option_menu_get_active(prop_dialog->op_visible);
-
- op->class_scope = prop_dialog->op_class_scope->active;
+
+ op->class_scope = gtk_toggle_button_get_active (prop_dialog->op_class_scope);
op->inheritance_type = (UMLInheritanceType)dia_option_menu_get_active(prop_dialog->op_inheritance_type);
- op->query = prop_dialog->op_query->active;
+ op->query = gtk_toggle_button_get_active (prop_dialog->op_query);
}
@@ -473,7 +473,7 @@ operations_list_selection_changed_callback(GtkWidget *gtklist,
return; /* maybe hiding a bug elsewhere */
_operations_get_current_values(prop_dialog);
-
+
list = GTK_LIST(gtklist)->selection;
if (!list) { /* No selected */
operations_set_sensitive(prop_dialog, FALSE);
@@ -481,7 +481,7 @@ operations_list_selection_changed_callback(GtkWidget *gtklist,
prop_dialog->current_op = NULL;
return;
}
-
+
list_item = G_OBJECT(list->data);
op = (UMLOperation *)g_object_get_data(G_OBJECT(list_item), "user_data");
operations_set_values(prop_dialog, op);
@@ -508,9 +508,9 @@ operations_list_new_callback(GtkWidget *button,
op = uml_operation_new();
/* need to make new ConnectionPoints valid and remember them */
uml_operation_ensure_connection_points (op, ¨class->element.object);
- prop_dialog->added_connections =
+ prop_dialog->added_connections =
g_list_prepend(prop_dialog->added_connections, op->left_connection);
- prop_dialog->added_connections =
+ prop_dialog->added_connections =
g_list_prepend(prop_dialog->added_connections, op->right_connection);
@@ -522,7 +522,7 @@ operations_list_new_callback(GtkWidget *button,
g_object_set_data(G_OBJECT(list_item), "user_data", op);
g_signal_connect (G_OBJECT (list_item), "destroy",
G_CALLBACK (operations_list_item_destroy_callback), NULL);
-
+
list = g_list_append(NULL, list_item);
gtk_list_append_items(prop_dialog->operations_list, list);
@@ -540,7 +540,7 @@ operations_list_delete_callback(GtkWidget *button,
UMLClassDialog *prop_dialog;
GtkList *gtklist;
UMLOperation *op;
-
+
prop_dialog = umlclass->properties_dialog;
gtklist = GTK_LIST(prop_dialog->operations_list);
@@ -575,13 +575,13 @@ operations_list_move_up_callback(GtkWidget *button,
GtkList *gtklist;
GtkWidget *list_item;
int i;
-
+
prop_dialog = umlclass->properties_dialog;
gtklist = GTK_LIST(prop_dialog->operations_list);
if (gtklist->selection != NULL) {
list_item = GTK_WIDGET(gtklist->selection->data);
-
+
i = gtk_list_child_position(gtklist, list_item);
if (i>0)
i--;
@@ -606,13 +606,13 @@ operations_list_move_down_callback(GtkWidget *button,
GtkList *gtklist;
GtkWidget *list_item;
int i;
-
+
prop_dialog = umlclass->properties_dialog;
gtklist = GTK_LIST(prop_dialog->operations_list);
if (gtklist->selection != NULL) {
list_item = GTK_WIDGET(gtklist->selection->data);
-
+
i = gtk_list_child_position(gtklist, list_item);
if (i<(g_list_length(gtklist->children)-1))
i++;
@@ -658,16 +658,16 @@ _operations_read_from_dialog(UMLClass *umlclass,
clear_list = NULL;
while (list != NULL) {
list_item = GTK_WIDGET(list->data);
-
+
clear_list = g_list_prepend (clear_list, list_item);
op = (UMLOperation *)
g_object_get_data(G_OBJECT(list_item), "user_data");
g_object_set_data(G_OBJECT(list_item), "user_data", NULL);
umlclass->operations = g_list_append(umlclass->operations, op);
-
+
if (op->left_connection == NULL) {
uml_operation_ensure_connection_points (op, obj);
-
+
prop_dialog->added_connections =
g_list_prepend(prop_dialog->added_connections,
op->left_connection);
@@ -675,9 +675,9 @@ _operations_read_from_dialog(UMLClass *umlclass,
g_list_prepend(prop_dialog->added_connections,
op->right_connection);
}
-
- if ( (prop_dialog->op_vis->active) &&
- (!prop_dialog->op_supp->active) ) {
+
+ if ( (gtk_toggle_button_get_active (prop_dialog->op_vis)) &&
+ (!gtk_toggle_button_get_active (prop_dialog->op_supp)) ) {
obj->connections[connection_index] = op->left_connection;
connection_index++;
obj->connections[connection_index] = op->right_connection;
@@ -688,7 +688,7 @@ _operations_read_from_dialog(UMLClass *umlclass,
_umlclass_store_disconnects(prop_dialog, op->right_connection);
object_remove_connections_to(op->right_connection);
}
-
+
list = g_list_next(list);
}
clear_list = g_list_reverse (clear_list);
@@ -724,7 +724,7 @@ _operations_fill_in_dialog(UMLClass *umlclass)
G_CALLBACK (operations_list_item_destroy_callback), NULL);
gtk_container_add (GTK_CONTAINER (prop_dialog->operations_list), list_item);
gtk_widget_show (list_item);
-
+
list = g_list_next(list); i++;
g_free (opstr);
}
@@ -864,7 +864,7 @@ operations_data_create_hbox (UMLClass *umlclass)
gtk_table_attach (GTK_TABLE (table), scrolledwindow, 4,5,1,3, GTK_FILL | GTK_EXPAND,0, 0,0);
gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0);
- return hbox;
+ return hbox;
}
static GtkWidget*
@@ -887,15 +887,15 @@ operations_parameters_editor_create_vbox (UMLClass *umlclass)
label = gtk_label_new(_("Parameters:"));
gtk_box_pack_start( GTK_BOX(hbox2), label, FALSE, TRUE, 0);
-
+
gtk_box_pack_start (GTK_BOX (vbox2), hbox2, TRUE, TRUE, 0);
/* Parameters list editor - with of list at least width of buttons*/
hbox2 = gtk_hbox_new(TRUE, 5);
-
+
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
- GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_box_pack_start (GTK_BOX (hbox2), scrolled_win, TRUE, TRUE, 0);
gtk_widget_show (scrolled_win);
@@ -943,7 +943,7 @@ operations_parameters_editor_create_vbox (UMLClass *umlclass)
gtk_box_pack_start (GTK_BOX (vbox2), hbox2, TRUE, TRUE, 0);
/* end: Parameter list editor */
-
+
return vbox2;
}
@@ -959,7 +959,7 @@ operations_parameters_data_create_vbox (UMLClass *umlclass)
GtkWidget *entry;
GtkWidget *scrolledwindow;
GtkWidget *omenu;
-
+
prop_dialog = umlclass->properties_dialog;
vbox2 = gtk_vbox_new(FALSE, 5);
@@ -969,7 +969,7 @@ operations_parameters_data_create_vbox (UMLClass *umlclass)
gtk_container_add (GTK_CONTAINER (frame), vbox3);
gtk_widget_show(frame);
gtk_box_pack_start (GTK_BOX (vbox2), frame, FALSE, TRUE, 0);
-
+
table = gtk_table_new (3, 4, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 5);
gtk_box_pack_start (GTK_BOX (vbox3), table, FALSE, FALSE, 0);
@@ -1011,7 +1011,7 @@ operations_parameters_data_create_vbox (UMLClass *umlclass)
scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow),
GTK_SHADOW_IN);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
entry = gtk_text_view_new ();
@@ -1029,7 +1029,7 @@ operations_parameters_data_create_vbox (UMLClass *umlclass)
label = gtk_label_new(_("Direction:"));
- prop_dialog->param_kind = omenu = dia_option_menu_new ();
+ prop_dialog->param_kind = omenu = dia_option_menu_new ();
g_signal_connect (G_OBJECT (omenu), "changed",
G_CALLBACK (operations_update), umlclass);
dia_option_menu_add_item(omenu, _("Undefined"), UML_UNDEF_KIND);
@@ -1037,7 +1037,7 @@ operations_parameters_data_create_vbox (UMLClass *umlclass)
dia_option_menu_add_item(omenu, _("Out"), UML_OUT);
dia_option_menu_add_item(omenu, _("In & Out"), UML_INOUT);
- {
+ {
GtkWidget * align;
align = gtk_alignment_new(0.0, 0.5, 0.0, 0.0);
gtk_container_add(GTK_CONTAINER(align), omenu);
@@ -1049,7 +1049,7 @@ operations_parameters_data_create_vbox (UMLClass *umlclass)
return vbox2;
}
-void
+void
_operations_create_page(GtkNotebook *notebook, UMLClass *umlclass)
{
UMLClassDialog *prop_dialog;
@@ -1067,15 +1067,15 @@ _operations_create_page(GtkNotebook *notebook, UMLClass *umlclass)
/* Operations page: */
page_label = gtk_label_new_with_mnemonic (_("_Operations"));
-
+
vbox = gtk_vbox_new(FALSE, 5);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
hbox = gtk_hbox_new(FALSE, 5);
-
+
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
- GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_box_pack_start (GTK_BOX (hbox), scrolled_win, TRUE, TRUE, 0);
gtk_widget_show (scrolled_win);
@@ -1128,7 +1128,7 @@ _operations_create_page(GtkNotebook *notebook, UMLClass *umlclass)
gtk_container_add (GTK_CONTAINER (frame), vbox2);
gtk_widget_show(frame);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
-
+
/* parameter stuff below operation stuff */
hbox = gtk_hbox_new (FALSE, 5);
vbox3 = operations_parameters_editor_create_vbox (umlclass);
@@ -1136,9 +1136,9 @@ _operations_create_page(GtkNotebook *notebook, UMLClass *umlclass)
vbox3 = operations_parameters_data_create_vbox (umlclass);
gtk_box_pack_start (GTK_BOX (hbox), vbox3, TRUE, TRUE, 5);
-
+
gtk_box_pack_start (GTK_BOX (vbox2), hbox, TRUE, TRUE, 5);
-
+
gtk_widget_show_all (vbox);
gtk_widget_show (page_label);
gtk_notebook_append_page (notebook, vbox, page_label);
diff --git a/objects/UML/class_templates_dialog.c b/objects/UML/class_templates_dialog.c
index 285e5265..eba4d3c9 100644
--- a/objects/UML/class_templates_dialog.c
+++ b/objects/UML/class_templates_dialog.c
@@ -117,7 +117,7 @@ templates_list_selection_changed_callback(GtkWidget *gtklist,
return; /* maybe hiding a bug elsewhere */
_templates_get_current_values(prop_dialog);
-
+
list = GTK_LIST(gtklist)->selection;
if (!list) { /* No selected */
templates_set_sensitive(prop_dialog, FALSE);
@@ -125,7 +125,7 @@ templates_list_selection_changed_callback(GtkWidget *gtklist,
prop_dialog->current_templ = NULL;
return;
}
-
+
list_item = G_OBJECT(list->data);
param = (UMLFormalParameter *)g_object_get_data(G_OBJECT(list_item), "user_data");
templates_set_values(prop_dialog, param);
@@ -159,7 +159,7 @@ templates_list_new_callback(GtkWidget *button,
g_object_set_data(G_OBJECT(list_item), "user_data", param);
g_signal_connect (G_OBJECT (list_item), "destroy",
G_CALLBACK (templates_list_item_destroy_callback), NULL);
-
+
list = g_list_append(NULL, list_item);
gtk_list_append_items(prop_dialog->templates_list, list);
@@ -198,13 +198,13 @@ templates_list_move_up_callback(GtkWidget *button,
GtkList *gtklist;
GtkWidget *list_item;
int i;
-
+
prop_dialog = umlclass->properties_dialog;
gtklist = GTK_LIST(prop_dialog->templates_list);
if (gtklist->selection != NULL) {
list_item = GTK_WIDGET(gtklist->selection->data);
-
+
i = gtk_list_child_position(gtklist, list_item);
if (i>0)
i--;
@@ -234,7 +234,7 @@ templates_list_move_down_callback(GtkWidget *button,
if (gtklist->selection != NULL) {
list_item = GTK_WIDGET(gtklist->selection->data);
-
+
i = gtk_list_child_position(gtklist, list_item);
if (i<(g_list_length(gtklist->children)-1))
i++;
@@ -260,7 +260,7 @@ _templates_read_from_dialog(UMLClass *umlclass, UMLClassDialog *prop_dialog)
_templates_get_current_values(prop_dialog); /* if changed, update from widgets */
- umlclass->template = prop_dialog->templ_template->active;
+ umlclass->template = gtk_toggle_button_get_active (prop_dialog->templ_template);
/* Free current formal parameters: */
list = umlclass->formal_params;
@@ -311,14 +311,14 @@ _templates_fill_in_dialog(UMLClass *umlclass)
list_item = gtk_list_item_new_with_label (paramstr);
param_copy = uml_formalparameter_copy(param);
- g_object_set_data(G_OBJECT(list_item), "user_data",
+ g_object_set_data(G_OBJECT(list_item), "user_data",
(gpointer) param_copy);
g_signal_connect (G_OBJECT (list_item), "destroy",
G_CALLBACK (templates_list_item_destroy_callback), NULL);
gtk_container_add (GTK_CONTAINER (prop_dialog->templates_list),
list_item);
gtk_widget_show (list_item);
-
+
list = g_list_next(list); i++;
g_free (paramstr);
}
@@ -344,7 +344,7 @@ templates_update_event(GtkWidget *widget, GdkEventFocus *ev, UMLClass *umlclass)
return 0;
}
-void
+void
_templates_create_page(GtkNotebook *notebook, UMLClass *umlclass)
{
UMLClassDialog *prop_dialog;
@@ -361,12 +361,12 @@ _templates_create_page(GtkNotebook *notebook, UMLClass *umlclass)
GtkWidget *button;
GtkWidget *list;
GtkWidget *frame;
-
+
prop_dialog = umlclass->properties_dialog;
/* Templates page: */
page_label = gtk_label_new_with_mnemonic (_("_Templates"));
-
+
vbox = gtk_vbox_new(FALSE, 5);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
@@ -375,12 +375,12 @@ _templates_create_page(GtkNotebook *notebook, UMLClass *umlclass)
prop_dialog->templ_template = GTK_TOGGLE_BUTTON(checkbox);
gtk_box_pack_start (GTK_BOX (hbox2), checkbox, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, TRUE, 0);
-
+
hbox = gtk_hbox_new(FALSE, 5);
-
+
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
- GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_box_pack_start (GTK_BOX (hbox), scrolled_win, TRUE, TRUE, 0);
gtk_widget_show (scrolled_win);
@@ -437,9 +437,9 @@ _templates_create_page(GtkNotebook *notebook, UMLClass *umlclass)
entry = gtk_entry_new();
prop_dialog->templ_name = GTK_ENTRY(entry);
g_signal_connect (G_OBJECT (entry), "focus_out_event",
- G_CALLBACK (templates_update_event), umlclass);
+ G_CALLBACK (templates_update_event), umlclass);
g_signal_connect (G_OBJECT (entry), "activate",
- G_CALLBACK (templates_update), umlclass);
+ G_CALLBACK (templates_update), umlclass);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_table_attach (GTK_TABLE (table), label, 0,1,0,1, GTK_FILL,0, 0,0);
gtk_table_attach (GTK_TABLE (table), entry, 1,2,0,1, GTK_FILL | GTK_EXPAND,0, 0,2);
@@ -456,9 +456,9 @@ _templates_create_page(GtkNotebook *notebook, UMLClass *umlclass)
gtk_table_attach (GTK_TABLE (table), entry, 1,2,1,2, GTK_FILL | GTK_EXPAND,0, 0,2);
gtk_widget_show(vbox2);
-
+
/* TODO: Add stuff here! */
-
+
gtk_widget_show_all (vbox);
gtk_widget_show (page_label);
gtk_notebook_append_page (notebook, vbox, page_label);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]