From e00f5133c1da7c59e0f26be575e34ba27c5b7e23 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Mon, 28 Apr 2008 16:42:41 +0300 Subject: [PATCH] Fixes to gps signal display widget: - Don't use old functions - Move some code around --- src/gtkgps.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/gtkgps.c b/src/gtkgps.c index bb7ce04..779f354 100644 --- a/src/gtkgps.c +++ b/src/gtkgps.c @@ -105,6 +105,13 @@ gps->width=300; gps->height=300; gps->size=300; gps->esid=0; +gps->context=gtk_widget_get_pango_context(GTK_WIDGET(gps)); +gps->layout=pango_layout_new(gps->context); +gps->fontdesc=pango_font_description_new(); +pango_font_description_set_family(gps->fontdesc, "Sans Serif"); +pango_font_description_set_size(gps->fontdesc, 10*PANGO_SCALE); +pango_layout_set_font_description(gps->layout, gps->fontdesc); +pango_layout_set_alignment(gps->layout, PANGO_ALIGN_CENTER); } static gboolean @@ -135,7 +142,7 @@ gtk_gps_new(GtkGpsMode display_mode, GpsData *data) GtkGps *gps; GtkWidget *widget; -gps=gtk_type_new(gtk_gps_get_type ()); +gps=g_object_new(GTK_GPS_TYPE, NULL); gps->display_mode=display_mode; gps->data=data; widget=GTK_WIDGET(gps); @@ -146,16 +153,6 @@ if (display_mode==GTK_GPS_MODE_COMBINED) { display_mode=GTK_GPS_MODE_SKY; } -gps->context=gtk_widget_get_pango_context(widget); -gps->layout=pango_layout_new(gps->context); -gps->fontdesc=pango_font_description_new(); -pango_font_description_set_family(gps->fontdesc, "Sans Serif"); -pango_font_description_set_size(gps->fontdesc, 10*PANGO_SCALE); -pango_layout_set_font_description(gps->layout, gps->fontdesc); -pango_layout_set_alignment(gps->layout, PANGO_ALIGN_CENTER); - -gps->esid=g_timeout_add(1000,(GSourceFunc)gtk_gps_refresh_cb, gps); - return GTK_WIDGET(gps); } @@ -282,6 +279,8 @@ if (!gps->gc_w) { gps->gc_w=gdk_gc_new(widget->window); gdk_gc_set_rgb_fg_color(gps->gc_w, &color); } + +gps->esid=g_timeout_add(1000,(GSourceFunc)gtk_gps_refresh_cb, gps); } static void -- 2.39.5