From 89eb58a623adb77fe98ca2dbedecc8d2c5d7b40d Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Wed, 3 Oct 2007 01:24:01 +0300 Subject: [PATCH] Cleanups --- src/gtkcompass.c | 22 ++++++---------------- src/gtkgps.c | 6 +++--- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/src/gtkcompass.c b/src/gtkcompass.c index 62bf9ee..e570140 100644 --- a/src/gtkcompass.c +++ b/src/gtkcompass.c @@ -94,8 +94,6 @@ switch (prop_id) { static void gtk_compass_init (GtkCompass *compass) { -g_printf("%s()\n", __PRETTY_FUNCTION__); - compass->gc_h=NULL; compass->gc_d=NULL; compass->gc_w=NULL; @@ -132,8 +130,6 @@ static void gtk_compass_finalize(GObject *object) { GtkCompass *compass; - -g_printf("%s()\n", __PRETTY_FUNCTION__); g_return_if_fail(GTK_IS_COMPASS(object)); compass=GTK_COMPASS(object); @@ -149,8 +145,6 @@ static void gtk_compass_size_request(GtkWidget *widget, GtkRequisition *requisition) { GtkCompass *compass; - -g_printf("%s()\n", __PRETTY_FUNCTION__); g_return_if_fail(GTK_IS_COMPASS(widget)); g_return_if_fail(requisition != NULL); @@ -168,8 +162,6 @@ gtk_compass_size_allocate(GtkWidget *widget, GtkAllocation *allocation) { GtkCompass *compass; -g_printf("%s()\n", __PRETTY_FUNCTION__); - g_return_if_fail(GTK_IS_COMPASS(widget)); g_return_if_fail(allocation!=NULL); @@ -205,8 +197,6 @@ GdkColor color; GdkWindowAttr attributes; gint attributes_mask; -g_printf("%s()\n", __PRETTY_FUNCTION__); - g_return_if_fail (GTK_IS_COMPASS(widget)); GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); compass=GTK_COMPASS(widget); @@ -287,7 +277,7 @@ static void gtk_compass_paint(GtkCompass *compass) { GtkWidget *widget; -guint i, x, y, size, hsize; +guint i, x, y, size, hsize, fs; gint dir; gfloat tmp; gchar *text; @@ -299,6 +289,9 @@ widget=GTK_WIDGET(compass); size=compass->size; hsize=size/2; +fs=size/42; +BOUND(fs, 1, 16); + pango_context_set_matrix (compass->context, NULL); g_snprintf(htext, 8, "%3.0f°", compass->data->heading); @@ -400,7 +393,7 @@ for (i = 0; i < 5; i++) { pango_matrix_rotate (&matrix, dir); pango_context_set_matrix (compass->context, &matrix); - pango_font_description_set_size(compass->fontdesc, (10 + x) * PANGO_SCALE); + pango_font_description_set_size(compass->fontdesc, (10 + x + fs) * PANGO_SCALE); pango_layout_set_font_description(compass->layout, compass->fontdesc); pango_layout_set_text(compass->layout, text, -1); pango_layout_get_pixel_size(compass->layout, &x, &y); @@ -419,7 +412,7 @@ for (i = 0; i < 5; i++) { } } -return TRUE; +return; } @@ -440,11 +433,8 @@ gtk_compass_refresh(GtkWidget *widget) { GtkCompass *compass; -g_printf("%s()\n", __PRETTY_FUNCTION__); g_return_if_fail(GTK_IS_COMPASS(widget)); compass=GTK_COMPASS(widget); gtk_compass_paint(compass); - -g_printf("%s(): return\n", __PRETTY_FUNCTION__); } diff --git a/src/gtkgps.c b/src/gtkgps.c index 9923b22..bd0a0e5 100644 --- a/src/gtkgps.c +++ b/src/gtkgps.c @@ -293,14 +293,14 @@ if (!GTK_WIDGET_MAPPED(widget)) x0=0; y0=0; -size=gps->size; +size=gps->size-PADDING; halfsize=size/2; if (gps->width>gps->height) { - xoffset=x0+(gps->width-gps->height-PADDING)/2; + xoffset=x0+(gps->width-gps->height)/2; yoffset=y0+5; } else { xoffset=x0+5; - yoffset=y0+(gps->height-gps->width-PADDING)/2; + yoffset=y0+(gps->height-gps->width)/2; } gtk_paint_flat_box (widget->style, -- 2.39.5