]> err.no Git - mapper/commitdiff
Fixes to gps signal display widget:
authorKaj-Michael Lang <milang@tal.org>
Mon, 28 Apr 2008 13:42:41 +0000 (16:42 +0300)
committerKaj-Michael Lang <milang@tal.org>
Mon, 28 Apr 2008 13:42:41 +0000 (16:42 +0300)
- Don't use old functions
- Move some code around

src/gtkgps.c

index bb7ce0473bff3cc518e77316f509a61e6f412d0f..779f35482bb4c6d79fa3622e4a3ed017699ab10a 100644 (file)
@@ -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