From: Rob Norris Date: Sun, 15 Sep 2013 20:58:11 +0000 (+0100) Subject: Update to at least Gtk2.16. X-Git-Url: https://git.street.me.uk/andy/viking.git/commitdiff_plain/90ba111cbdaf442cd8a4312585d4ea01058e7f7c Update to at least Gtk2.16. Use later method for getting allocated widget sizes. --- diff --git a/configure.ac b/configure.ac index 3a5cf3d3..73b57b92 100644 --- a/configure.ac +++ b/configure.ac @@ -67,7 +67,7 @@ dnl ------------------ PKG_CHECK_MODULES(PACKAGE, [ glib-2.0 >= 2.16 gthread-2.0 >= 2.2 - gtk+-2.0 >= 2.14 + gtk+-2.0 >= 2.16 gio-2.0 >= 2.12 ]) diff --git a/src/print-preview.c b/src/print-preview.c index 82096055..0ac7ab62 100644 --- a/src/print-preview.c +++ b/src/print-preview.c @@ -495,8 +495,10 @@ vik_print_preview_expose_event (GtkWidget *widget, if (preview->pixbuf == NULL) { - gint width = MIN (widget->allocation.width, 1024); - gint height = MIN (widget->allocation.height, 1024); + GtkAllocation allocation; + gtk_widget_get_allocation ( widget, &allocation ); + gint width = MIN (allocation.width, 1024); + gint height = MIN (allocation.height, 1024); preview->pixbuf = get_thumbnail(drawable, width, height); } diff --git a/src/viktrwlayer_propwin.c b/src/viktrwlayer_propwin.c index fcd3effb..dccaf7be 100644 --- a/src/viktrwlayer_propwin.c +++ b/src/viktrwlayer_propwin.c @@ -350,7 +350,9 @@ static void save_image_and_draw_graph_marks (GtkWidget *image, saved_img->saved = TRUE; if ((marker_x >= MARGIN) && (marker_x < (PROFILE_WIDTH + MARGIN))) { - gdk_draw_line (GDK_DRAWABLE(pix), gc, marker_x, 0, marker_x, image->allocation.height); + GtkAllocation allocation; + gtk_widget_get_allocation ( image, &allocation ); + gdk_draw_line (GDK_DRAWABLE(pix), gc, marker_x, 0, marker_x, allocation.height); *marker_drawn = TRUE; } else @@ -414,7 +416,10 @@ static void track_graph_click( GtkWidget *event_box, GdkEventButton *event, Prop graph_type == PROPWIN_GRAPH_TYPE_DISTANCE_TIME || graph_type == PROPWIN_GRAPH_TYPE_ELEVATION_TIME ); - VikTrackpoint *trackpoint = set_center_at_graph_position(event->x, event_box->allocation.width, widgets->vtl, widgets->vlp, widgets->vvp, widgets->tr, is_time_graph, widgets->profile_width); + GtkAllocation allocation; + gtk_widget_get_allocation ( event_box, &allocation ); + + VikTrackpoint *trackpoint = set_center_at_graph_position(event->x, allocation.width, widgets->vtl, widgets->vlp, widgets->vvp, widgets->tr, is_time_graph, widgets->profile_width); // Unable to get the point so give up if ( trackpoint == NULL ) { gtk_dialog_set_response_sensitive(GTK_DIALOG(widgets->dialog), VIK_TRW_LAYER_PROPWIN_SPLIT_MARKER, FALSE); @@ -639,7 +644,10 @@ void track_profile_move( GtkWidget *event_box, GdkEventMotion *event, PropWidget else mouse_x = event->x; - gdouble x = mouse_x - event_box->allocation.width / 2 + widgets->profile_width / 2 - MARGIN / 2; + GtkAllocation allocation; + gtk_widget_get_allocation ( event_box, &allocation ); + + gdouble x = mouse_x - allocation.width / 2 + widgets->profile_width / 2 - MARGIN / 2; if (x < 0) x = 0; if (x > widgets->profile_width) @@ -716,7 +724,10 @@ void track_gradient_move( GtkWidget *event_box, GdkEventMotion *event, PropWidge else mouse_x = event->x; - gdouble x = mouse_x - event_box->allocation.width / 2 + widgets->profile_width / 2 - MARGIN / 2; + GtkAllocation allocation; + gtk_widget_get_allocation ( event_box, &allocation ); + + gdouble x = mouse_x - allocation.width / 2 + widgets->profile_width / 2 - MARGIN / 2; if (x < 0) x = 0; if (x > widgets->profile_width) @@ -793,7 +804,9 @@ void track_vt_move( GtkWidget *event_box, GdkEventMotion *event, PropWidgets *wi else mouse_x = event->x; - gdouble x = mouse_x - event_box->allocation.width / 2 + widgets->profile_width / 2 - MARGIN / 2; + GtkAllocation allocation; + gtk_widget_get_allocation ( event_box, &allocation ); + gdouble x = mouse_x - allocation.width / 2 + widgets->profile_width / 2 - MARGIN / 2; if (x < 0) x = 0; if (x > widgets->profile_width) @@ -887,7 +900,10 @@ void track_dt_move( GtkWidget *event_box, GdkEventMotion *event, PropWidgets *wi else mouse_x = event->x; - gdouble x = mouse_x - event_box->allocation.width / 2 + widgets->profile_width / 2 - MARGIN / 2; + GtkAllocation allocation; + gtk_widget_get_allocation ( event_box, &allocation ); + + gdouble x = mouse_x - allocation.width / 2 + widgets->profile_width / 2 - MARGIN / 2; if (x < 0) x = 0; if (x > widgets->profile_width) @@ -966,7 +982,10 @@ void track_et_move( GtkWidget *event_box, GdkEventMotion *event, PropWidgets *wi else mouse_x = event->x; - gdouble x = mouse_x - event_box->allocation.width / 2 + widgets->profile_width / 2 - MARGIN / 2; + GtkAllocation allocation; + gtk_widget_get_allocation ( event_box, &allocation ); + + gdouble x = mouse_x - allocation.width / 2 + widgets->profile_width / 2 - MARGIN / 2; if (x < 0) x = 0; if (x > widgets->profile_width) @@ -1042,7 +1061,10 @@ void track_sd_move( GtkWidget *event_box, GdkEventMotion *event, PropWidgets *wi else mouse_x = event->x; - gdouble x = mouse_x - event_box->allocation.width / 2 + widgets->profile_width / 2 - MARGIN / 2; + GtkAllocation allocation; + gtk_widget_get_allocation ( event_box, &allocation ); + + gdouble x = mouse_x - allocation.width / 2 + widgets->profile_width / 2 - MARGIN / 2; if (x < 0) x = 0; if (x > widgets->profile_width) diff --git a/src/vikviewport.c b/src/vikviewport.c index 28216d9d..f7c98ffa 100644 --- a/src/vikviewport.c +++ b/src/vikviewport.c @@ -340,8 +340,10 @@ gboolean vik_viewport_configure ( VikViewport *vvp ) { g_return_val_if_fail ( vvp != NULL, TRUE ); - vvp->width = GTK_WIDGET(vvp)->allocation.width; - vvp->height = GTK_WIDGET(vvp)->allocation.height; + GtkAllocation allocation; + gtk_widget_get_allocation ( GTK_WIDGET(vvp), &allocation ); + vvp->width = allocation.width; + vvp->height = allocation.height; vvp->width_2 = vvp->width/2; vvp->height_2 = vvp->height/2;