Contents of /trunk/src/map-tool.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 60 - (hide annotations)
Mon Aug 17 19:44:00 2009 UTC (14 years, 9 months ago) by harbaum
File MIME type: text/plain
File size: 16840 byte(s)
Released 0.6.4
1 harbaum 33 /*
2 harbaum 55 * Copyright (C) 2008-2009 Till Harbaum <till@harbaum.org>.
3 harbaum 33 *
4     * This file is part of GPXView.
5     *
6     * GPXView is free software: you can redistribute it and/or modify
7     * it under the terms of the GNU General Public License as published by
8     * the Free Software Foundation, either version 3 of the License, or
9     * (at your option) any later version.
10     *
11     * GPXView is distributed in the hope that it will be useful,
12     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     * GNU General Public License for more details.
15     *
16     * You should have received a copy of the GNU General Public License
17     * along with GPXView. If not, see <http://www.gnu.org/licenses/>.
18     */
19    
20     #include "gpxview.h"
21 harbaum 34 #include <math.h> // for isnan
22 harbaum 33
23     #ifdef ENABLE_OSM_GPS_MAP
24     #include "osm-gps-map.h"
25     #endif
26    
27 harbaum 55 #define MAP_SOURCE OSM_GPS_MAP_SOURCE_OPENSTREETMAP
28 harbaum 48 #define GPS_DEFAULT_ZOOM 13
29    
30 harbaum 42 /* equatorial radius in meters */
31     #define EQ_RADIUS (6378137.0)
32    
33     #define RAD2DEG(a) (((a)*180.0)/M_PI)
34     #define DEG2RAD(a) (((a)*M_PI)/180.0)
35    
36 harbaum 34 #define PROXY_KEY "/system/http_proxy/"
37    
38     static const char *get_proxy_uri(appdata_t *appdata) {
39     static char proxy_buffer[64] = "";
40 harbaum 33
41     /* use environment settings if preset */
42     const char *proxy = g_getenv("http_proxy");
43     if(proxy) {
44     printf("http_proxy: %s\n", proxy);
45     return proxy;
46     }
47    
48 harbaum 34 /* ------------- get proxy settings -------------------- */
49     if(gconf_client_get_bool(appdata->gconf_client,
50     PROXY_KEY "use_http_proxy", NULL)) {
51 harbaum 33
52 harbaum 34 /* we can savely ignore things like "ignore_hosts" since we */
53     /* are pretty sure not inside the net of one of our map renderers */
54     /* (unless the user works at google :-) */
55    
56     /* get basic settings */
57     char *host =
58     gconf_client_get_string(appdata->gconf_client, PROXY_KEY "host", NULL);
59     if(host) {
60     int port =
61     gconf_client_get_int(appdata->gconf_client, PROXY_KEY "port", NULL);
62 harbaum 33
63 harbaum 34 snprintf(proxy_buffer, sizeof(proxy_buffer),
64     "http://%s:%u", host, port);
65 harbaum 33
66 harbaum 34 g_free(host);
67     }
68 harbaum 35 return proxy_buffer;
69 harbaum 34 }
70    
71 harbaum 35 return NULL;
72 harbaum 33 }
73    
74     static void map_zoom(map_context_t *context, int step) {
75 harbaum 48 gint zoom;
76 harbaum 33 OsmGpsMap *map = OSM_GPS_MAP(context->widget);
77     g_object_get(map, "zoom", &zoom, NULL);
78     zoom = osm_gps_map_set_zoom(map, zoom+step);
79    
80     /* enable/disable zoom buttons as required */
81 harbaum 55 gtk_widget_set_sensitive(context->zoomin,
82     zoom < osm_gps_map_source_get_max_zoom(MAP_SOURCE));
83     gtk_widget_set_sensitive(context->zoomout,
84     zoom > osm_gps_map_source_get_min_zoom(MAP_SOURCE));
85 harbaum 48
86 harbaum 56 /* hmm ... this doesn't really work */
87     osm_gps_map_osd_speed(map, zoom);
88    
89 harbaum 48 /* save new zoom */
90     context->appdata->map.zoom = zoom;
91 harbaum 33 }
92    
93     static gboolean
94     cb_map_zoomin(GtkButton *button, map_context_t *context) {
95     map_zoom(context, +1);
96     return FALSE;
97     }
98    
99     static gboolean
100     cb_map_zoomout(GtkButton *button, map_context_t *context) {
101     map_zoom(context, -1);
102     return FALSE;
103     }
104    
105     static gboolean
106     cb_map_gps(GtkButton *button, map_context_t *context) {
107 harbaum 34 pos_t *refpos = get_pos(context->appdata);
108     if(refpos && !isnan(refpos->lat) && !isnan(refpos->lon)) {
109 harbaum 35 osm_gps_map_set_mapcenter(OSM_GPS_MAP(context->widget),
110 harbaum 48 refpos->lat, refpos->lon, GPS_DEFAULT_ZOOM);
111 harbaum 35 } else {
112     /* no coordinates given: display the entire world */
113     osm_gps_map_set_mapcenter(OSM_GPS_MAP(context->widget),
114     0.0, 0.0, 1);
115 harbaum 34 }
116 harbaum 33
117     return FALSE;
118     }
119    
120     static GtkWidget
121 harbaum 51 *map_add_button(int icon, GCallback cb, gpointer data,
122 harbaum 33 char *tooltip) {
123     GtkWidget *button = gtk_button_new();
124 harbaum 51 gtk_button_set_image(GTK_BUTTON(button), icon_get_widget(ICON_MISC, icon));
125 harbaum 33 g_signal_connect(button, "clicked", cb, data);
126     #ifndef USE_MAEMO
127     gtk_widget_set_tooltip_text(button, tooltip);
128     #endif
129     return button;
130     }
131    
132 harbaum 55 static int dist2pixel(map_context_t *context, float km, float lat) {
133     return 1000.0*km/osm_gps_map_get_scale(OSM_GPS_MAP(context->widget));
134     }
135    
136 harbaum 33 static gboolean map_gps_update(gpointer data) {
137     map_context_t *context = (map_context_t*)data;
138    
139 harbaum 51 /* get reference position ... */
140 harbaum 34 pos_t *refpos = get_pos(context->appdata);
141     gboolean ok = (refpos!= NULL) && !isnan(refpos->lat) && !isnan(refpos->lon);
142 harbaum 33
143 harbaum 51 /* ... and enable "goto" button if it's valid */
144 harbaum 34 gtk_widget_set_sensitive(context->gps, ok);
145    
146 harbaum 51 if(ok) {
147 harbaum 53 float heading = NAN;
148 harbaum 54 int radius = 0;
149 harbaum 51
150 harbaum 53 if(context->appdata->use_gps) {
151     heading = gps_get_heading(context->appdata);
152    
153     /* get error */
154     float eph = gps_get_eph(context->appdata);
155 harbaum 55 if(!isnan(eph))
156     radius = dist2pixel(context, eph/1000, refpos->lat);
157 harbaum 53 }
158    
159     g_object_set(context->widget, "gps-track-highlight-radius", radius, NULL);
160     osm_gps_map_draw_gps(OSM_GPS_MAP(context->widget),
161 harbaum 51 refpos->lat, refpos->lon, heading);
162     } else
163     osm_gps_map_clear_gps(OSM_GPS_MAP(context->widget));
164    
165 harbaum 33 return TRUE;
166     }
167    
168 harbaum 35 static gboolean on_map_configure(GtkWidget *widget,
169     GdkEventConfigure *event,
170     map_context_t *context) {
171 harbaum 33
172 harbaum 48 /* set default values if they are invalid */
173     if(!context->appdata->map.zoom ||
174     isnan(context->appdata->map.pos.lat) ||
175     isnan(context->appdata->map.pos.lon)) {
176     printf("no valid map position found\n");
177    
178     pos_t *refpos = get_pos(context->appdata);
179     if(refpos && !isnan(refpos->lat) && !isnan(refpos->lon)) {
180     /* use gps position if present */
181     context->appdata->map.pos = *refpos;
182     context->appdata->map.zoom = GPS_DEFAULT_ZOOM;
183     } else {
184     /* use world map otherwise */
185     context->appdata->map.pos.lat = 0.0;
186     context->appdata->map.pos.lon = 0.0;
187     context->appdata->map.zoom = 1;
188     }
189     }
190 harbaum 35
191 harbaum 48 /* jump to initial position */
192     osm_gps_map_set_mapcenter(OSM_GPS_MAP(context->widget),
193     context->appdata->map.pos.lat,
194     context->appdata->map.pos.lon,
195     context->appdata->map.zoom);
196    
197 harbaum 35 return FALSE;
198     }
199    
200 harbaum 38 static void map_draw_cachelist(GtkWidget *map, cache_t *cache) {
201     while(cache) {
202     GdkPixbuf *icon = icon_get(ICON_CACHE_TYPE, cache->type);
203    
204     osm_gps_map_add_image(OSM_GPS_MAP(map),
205     cache->pos.lat, cache->pos.lon, icon);
206    
207     cache = cache->next;
208     }
209     }
210    
211 harbaum 41 static void
212     map_cachelist_nearest(cache_t *cache, pos_t *pos,
213     cache_t **result, float *distance) {
214     while(cache) {
215     float dist =
216     pow(cache->pos.lat - pos->lat, 2) +
217     pow(cache->pos.lon - pos->lon, 2);
218    
219     if(!(dist > *distance)) {
220     *result = cache;
221     *distance = dist;
222     }
223    
224     cache = cache->next;
225     }
226     }
227    
228     static cache_t *map_closest(map_context_t *context, pos_t *pos) {
229     cache_t *result = NULL;
230     float distance = NAN;
231    
232     #ifdef USE_MAEMO
233     if(!context->appdata->cur_gpx) {
234     #endif
235     /* search all geocaches */
236     gpx_t *gpx = context->appdata->gpx;
237     while(gpx) {
238     map_cachelist_nearest(gpx->cache, pos, &result, &distance);
239     gpx = gpx->next;
240     }
241     #ifdef USE_MAEMO
242     } else {
243     map_cachelist_nearest(context->appdata->cur_gpx->cache,
244     pos, &result, &distance);
245     }
246     #endif
247    
248     return result;
249     }
250    
251     /* translate between osm-gps-map positions and gpxview ones */
252     pos_t coord2pos(coord_t coo) {
253     pos_t pos;
254     pos.lat = RAD2DEG(coo.rlat);
255     pos.lon = RAD2DEG(coo.rlon);
256     return pos;
257     }
258    
259 harbaum 47 #define CLICK_FUZZ (24)
260 harbaum 42
261 harbaum 41 static gboolean
262     on_map_button_press_event(GtkWidget *widget,
263     GdkEventButton *event, map_context_t *context) {
264     OsmGpsMap *map = OSM_GPS_MAP(context->widget);
265    
266 harbaum 44 /* got a press event without release event? eat it! */
267     if(context->press_on != NULL) {
268     printf("PRESS: already\n");
269     return TRUE;
270     }
271    
272 harbaum 41 pos_t pos =
273 harbaum 42 coord2pos(osm_gps_map_get_co_ordinates(map, event->x, event->y));
274 harbaum 41
275 harbaum 42 cache_t *nearest = map_closest(context, &pos);
276     if(nearest) {
277     float dist = gpx_pos_get_distance(pos, nearest->pos, FALSE);
278 harbaum 44 if(dist2pixel(context, dist, nearest->pos.lat) < CLICK_FUZZ)
279 harbaum 42 context->press_on = nearest;
280     }
281 harbaum 44
282 harbaum 41 return FALSE;
283     }
284    
285 harbaum 58 static void
286     cairo_draw_pixbuf(cairo_t *cr, GdkPixbuf *buf, gint x, gint y) {
287     /* convert the pixbuf into something cairo can handle */
288    
289     // Create a new ImageSurface
290     cairo_surface_t *image_surface =
291     cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
292     gdk_pixbuf_get_width(buf),
293     gdk_pixbuf_get_height(buf));
294    
295     // Create the new Context for the ImageSurface
296     cairo_t *context = cairo_create(image_surface);
297    
298     // Draw the image on the new Context
299     gdk_cairo_set_source_pixbuf(context, buf, 0.0, 0.0);
300     cairo_paint(context);
301    
302     // now draw this onto the original context
303     cairo_set_source_surface(cr, image_surface, x, y);
304 harbaum 60
305 harbaum 58 cairo_paint(cr);
306     }
307    
308 harbaum 60 #define LINE_SKIP 7
309 harbaum 59
310 harbaum 58 static void
311     balloon_draw_cb(cairo_t *cr, OsmGpsMapRect_t *rect, gpointer data) {
312     cache_t *cache = (cache_t*)data;
313    
314     // printf("draw cb for \"%s\"\n", cache->name);
315    
316     #if 0
317     /* draw pink background to check clipping */
318     cairo_rectangle (cr, rect->x-20, rect->y-20, rect->w+40, rect->h+40);
319     cairo_set_source_rgba (cr, 1, 0, 0, 0.3);
320     cairo_fill_preserve (cr);
321     cairo_set_line_width (cr, 0);
322     cairo_stroke (cr);
323     #endif
324    
325     /* leave a little border top and left */
326     gint x = rect->x, y = rect->y;
327    
328     /* draw the cache type icon ... */
329     GdkPixbuf *icon = icon_get(ICON_CACHE_TYPE, cache->type);
330     cairo_draw_pixbuf(cr, icon, x, y);
331    
332     /* ... and right of it the waypoint id */
333     cairo_text_extents_t extents;
334    
335 harbaum 60 if(cache->id) {
336     cairo_select_font_face (cr, "Sans",
337     CAIRO_FONT_SLANT_NORMAL,
338     CAIRO_FONT_WEIGHT_BOLD);
339 harbaum 58
340 harbaum 60 cairo_set_font_size (cr, 20.0);
341     cairo_text_extents (cr, cache->id, &extents);
342 harbaum 58
343 harbaum 60 /* display id right of icon vertically centered */
344     x += gdk_pixbuf_get_width(icon) + 5;
345     y += (gdk_pixbuf_get_height(icon) + extents.height)/2;
346     cairo_move_to (cr, x, y);
347     cairo_set_source_rgba (cr, 0, 0, 0, 1);
348     cairo_show_text (cr, cache->id);
349     cairo_stroke (cr);
350 harbaum 59
351 harbaum 60 y += (gdk_pixbuf_get_height(icon) - extents.height)/2 + LINE_SKIP;
352     } else
353     y += gdk_pixbuf_get_height(icon);
354    
355 harbaum 59 /* return to the left border and below icon/text */
356     x = rect->x;
357    
358 harbaum 60 /* everything from here uses the same font */
359     cairo_select_font_face (cr, "Sans", CAIRO_FONT_SLANT_NORMAL,
360 harbaum 59 CAIRO_FONT_WEIGHT_NORMAL);
361     cairo_set_font_size (cr, 14.0);
362    
363 harbaum 60 if(cache->name) {
364     /* draw cache name */
365     cairo_text_extents (cr, cache->name, &extents);
366     y += extents.height;
367     cairo_move_to (cr, x, y);
368     cairo_set_source_rgba (cr, 0, 0, 0, 1);
369     cairo_show_text (cr, cache->name);
370     cairo_stroke (cr);
371 harbaum 58
372 harbaum 60 /* return to the left border and below text */
373     y += LINE_SKIP;
374     x = rect->x;
375     }
376    
377     if(cache->terrain) {
378     /* draw cache rating */
379     const char *terrain = "Terrain:";
380     icon = icon_get(ICON_STARS, (int)(cache->terrain*2-2));
381     cairo_text_extents (cr, _(terrain), &extents);
382     y += (gdk_pixbuf_get_height(icon) + extents.height)/2;
383    
384     /* draw "Terrain:" string */
385     cairo_move_to (cr, x, y);
386     cairo_set_source_rgba (cr, 0, 0, 0, 1);
387     cairo_show_text (cr, _(terrain));
388     cairo_stroke (cr);
389     x += extents.width + 2;
390    
391     /* draw terrain stars */
392     cairo_draw_pixbuf(cr, icon, x, y -
393     (gdk_pixbuf_get_height(icon) + extents.height)/2);
394    
395     x += gdk_pixbuf_get_width(icon) + LINE_SKIP;
396     y -= (gdk_pixbuf_get_height(icon) + extents.height)/2;
397     }
398    
399     if(cache->difficulty) {
400     const char *difficulty = "Difficulty:";
401     cairo_text_extents (cr, _(difficulty), &extents);
402     y += (gdk_pixbuf_get_height(icon) + extents.height)/2;
403    
404     /* draw "Difficulty:" string */
405     cairo_move_to (cr, x, y);
406     cairo_set_source_rgba (cr, 0, 0, 0, 1);
407     cairo_show_text (cr, _(difficulty));
408     cairo_stroke (cr);
409     x += extents.width + 2;
410    
411     icon = icon_get(ICON_STARS, (int)(cache->difficulty*2-2));
412     cairo_draw_pixbuf(cr, icon, x, y -
413     (gdk_pixbuf_get_height(icon) + extents.height)/2);
414     }
415 harbaum 58 }
416    
417 harbaum 41 static gboolean
418     on_map_button_release_event(GtkWidget *widget,
419     GdkEventButton *event, map_context_t *context) {
420 harbaum 48 OsmGpsMap *map = OSM_GPS_MAP(context->widget);
421    
422 harbaum 42 if(context->press_on) {
423 harbaum 57 coord_t coo;
424     coo = osm_gps_map_get_co_ordinates(map, event->x, event->y);
425    
426 harbaum 42 pos_t pos =
427     coord2pos(osm_gps_map_get_co_ordinates(map, event->x, event->y));
428 harbaum 41
429 harbaum 42 cache_t *nearest = map_closest(context, &pos);
430     if(nearest && nearest == context->press_on) {
431     float dist = gpx_pos_get_distance(pos, nearest->pos, FALSE);
432 harbaum 57 if(dist2pixel(context, dist, nearest->pos.lat) < CLICK_FUZZ) {
433    
434 harbaum 58 osm_gps_map_draw_balloon(map, nearest->pos.lat, nearest->pos.lon,
435     balloon_draw_cb, nearest);
436 harbaum 57 }
437 harbaum 42 }
438 harbaum 44 context->press_on = NULL;
439 harbaum 48 } else {
440     /* save new map position */
441     gfloat lat, lon;
442     g_object_get(map, "latitude", &lat, "longitude", &lon, NULL);
443     context->appdata->map.pos.lat = lat;
444     context->appdata->map.pos.lon = lon;
445 harbaum 41 }
446    
447     return FALSE;
448     }
449    
450 harbaum 56 static void on_window_destroy(GtkWidget *widget, map_context_t *context) {
451     appdata_t *appdata = context->appdata;
452    
453     printf("destroy map window\n");
454    
455 harbaum 48 /* save map parameters */
456     OsmGpsMap *map = OSM_GPS_MAP(context->widget);
457     gint zoom;
458     g_object_get(map, "zoom", &zoom, NULL);
459     context->appdata->map.zoom = zoom;
460 harbaum 44
461 harbaum 48 gfloat lat, lon;
462     g_object_get(map, "latitude", &lat, "longitude", &lon, NULL);
463     context->appdata->map.pos.lat = lat;
464     context->appdata->map.pos.lon = lon;
465    
466 harbaum 40 #if MAEMO_VERSION_MAJOR == 5
467     /* restore cur_view */
468     context->appdata->cur_view = context->old_view;
469 harbaum 56 #endif
470 harbaum 40
471     gtk_timeout_remove(context->handler_id);
472 harbaum 56
473 harbaum 40 g_free(context);
474 harbaum 56 appdata->map.context = NULL;
475 harbaum 40 }
476    
477 harbaum 33 void map(appdata_t *appdata) {
478 harbaum 56 map_context_t *context = NULL;
479    
480     /* if the map window already exists, just raise it */
481     if(appdata->map.context) {
482     gtk_window_present(GTK_WINDOW(appdata->map.context->window));
483     return;
484     }
485    
486     context = appdata->map.context = g_new0(map_context_t, 1);
487 harbaum 40 context->appdata = appdata;
488 harbaum 33
489 harbaum 41 GtkWidget *hbox = gtk_hbox_new(FALSE, 0);
490    
491     char *path = g_strdup_printf("%s/map/", appdata->image_path);
492     const char *proxy = get_proxy_uri(appdata);
493    
494     context->widget = g_object_new(OSM_TYPE_GPS_MAP,
495 harbaum 55 "map-source", MAP_SOURCE,
496     "tile-cache", path,
497     "auto-center", FALSE,
498     "record-trip-history", FALSE,
499     "show-trip-history", FALSE,
500     proxy?"proxy-uri":NULL, proxy,
501 harbaum 41 NULL);
502    
503     g_free(path);
504    
505     char *name = NULL;
506     #ifdef USE_MAEMO
507     if(!appdata->cur_gpx) {
508     #endif
509     /* draw all geocaches */
510     gpx_t *gpx = appdata->gpx;
511     while(gpx) {
512     map_draw_cachelist(context->widget, gpx->cache);
513     gpx = gpx->next;
514     }
515     name = g_strdup(_("all geocaches"));
516     #ifdef USE_MAEMO
517     } else {
518     map_draw_cachelist(context->widget, appdata->cur_gpx->cache);
519 harbaum 44 name = g_strdup(appdata->cur_gpx->name);
520 harbaum 41 }
521     #endif
522    
523     char *title = g_strdup_printf(_("Map - %s"), name);
524     g_free(name);
525    
526 harbaum 56 #ifdef USE_MAEMO
527     #ifdef USE_STACKABLE_WINDOW
528     context->window = hildon_stackable_window_new();
529 harbaum 40 #else
530 harbaum 56 context->window = hildon_window_new();
531     #endif
532     #else
533     context->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
534     #endif
535 harbaum 33
536 harbaum 56 gtk_window_set_title(GTK_WINDOW(context->window), title);
537    
538 harbaum 33 #ifndef USE_MAEMO
539 harbaum 56 gtk_window_set_default_size(GTK_WINDOW(context->window), 640, 480);
540 harbaum 33 #endif
541    
542 harbaum 41 g_free(title);
543 harbaum 33
544 harbaum 41 g_signal_connect(G_OBJECT(context->widget), "configure-event",
545     G_CALLBACK(on_map_configure), context);
546 harbaum 33
547 harbaum 41 g_signal_connect(G_OBJECT(context->widget), "button-press-event",
548     G_CALLBACK(on_map_button_press_event), context);
549 harbaum 33
550 harbaum 40 g_signal_connect(G_OBJECT(context->widget), "button-release-event",
551     G_CALLBACK(on_map_button_release_event), context);
552 harbaum 33
553 harbaum 40 gtk_box_pack_start_defaults(GTK_BOX(hbox), context->widget);
554 harbaum 33 /* zoom button box */
555     GtkWidget *vbox = gtk_vbox_new(FALSE,0);
556    
557 harbaum 40 context->zoomin =
558 harbaum 51 map_add_button(10, G_CALLBACK(cb_map_zoomin),
559 harbaum 40 context, _("Zoom in"));
560     gtk_box_pack_start(GTK_BOX(vbox), context->zoomin, FALSE, FALSE, 0);
561 harbaum 33
562 harbaum 40 context->zoomout =
563 harbaum 51 map_add_button(11, G_CALLBACK(cb_map_zoomout),
564 harbaum 40 context, _("Zoom out"));
565     gtk_box_pack_start(GTK_BOX(vbox), context->zoomout, FALSE, FALSE, 0);
566 harbaum 33
567 harbaum 40 context->gps =
568 harbaum 51 map_add_button(9, G_CALLBACK(cb_map_gps),
569 harbaum 40 context, _("Jump to GPS position"));
570     gtk_widget_set_sensitive(context->gps, FALSE);
571 harbaum 56
572 harbaum 33 /* install handler for timed updates of the gps button */
573 harbaum 40 context->handler_id = gtk_timeout_add(1000, map_gps_update, context);
574     gtk_box_pack_start(GTK_BOX(vbox), context->gps, FALSE, FALSE, 0);
575 harbaum 33
576     gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
577    
578 harbaum 40 #if MAEMO_VERSION_MAJOR == 5
579     /* prevent some of the main screen things */
580     context->old_view = appdata->cur_view;
581     appdata->cur_view = NULL;
582 harbaum 56 #endif
583 harbaum 40
584 harbaum 56 g_signal_connect(G_OBJECT(context->window), "destroy",
585 harbaum 40 G_CALLBACK(on_window_destroy), context);
586    
587 harbaum 56 gtk_container_add(GTK_CONTAINER(context->window), hbox);
588     gtk_widget_show_all(GTK_WIDGET(context->window));
589 harbaum 33 }