~foxtrotgps-team/foxtrotgps/trunk

« back to all changes in this revision

Viewing changes to src/callbacks.c

  • Committer: Joshua Judson Rosen
  • Date: 2010-08-08 21:26:27 UTC
  • Revision ID: rozzin@geekspace.com-20100808212627-33l17je2wcdeza2n
Install & distribute the foxtrotgps(1) man page.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#include "poi.h"
29
29
#include "wp.h"
30
30
#include "tracks.h"
31
 
#include "route.h"
32
 
#include "hrm_functions.h"
33
31
 
34
 
/* How many move events must come in for a drag to be recognized: */
35
32
#define WTFCOUNTER 5
36
33
 
37
34
 
38
 
static int wtfcounter=0;
 
35
static int wtfcounter=0; 
39
36
 
40
37
static int      friendfinder_timer = 0;
41
38
static gboolean distance_mode = FALSE;
53
50
static int local_y = 0;
54
51
 
55
52
 
 
53
static int drag_started = 0;
 
54
 
56
55
static  GdkPixmap *pixmap_photo = NULL;
57
56
static  GdkPixmap *pixmap_photo_big = NULL;
58
57
 
63
62
void
64
63
set_cursor(int type)
65
64
{
 
65
        printf("setting cursor to %d\n", type);
66
66
        static GdkCursor *cursor_cross = NULL;
67
67
        static GdkCursor *cursor_default = NULL;
68
 
 
 
68
        
69
69
        if(!cursor_cross)
70
70
        {
71
71
                cursor_cross = gdk_cursor_new(GDK_CROSSHAIR);
78
78
                gdk_window_set_cursor(window1->window, cursor_default);
79
79
}
80
80
 
81
 
waypoint_t *selected_wp;
82
81
 
83
82
gboolean
84
83
on_drawingarea1_button_press_event     (GtkWidget       *widget,
85
84
                                        GdkEventButton  *event,
86
85
                                        gpointer         user_data)
87
86
{
 
87
        
88
88
        wtfcounter = 0;
89
 
 
 
89
        if ( event->type==GDK_2BUTTON_PRESS) 
 
90
        {
 
91
                printf("double click\n");
 
92
                
 
93
                
 
94
        }
 
95
        
90
96
        mouse_x = (int) event->x;
91
97
        mouse_y = (int) event->y;
92
98
        local_x = global_x;
93
99
        local_y = global_y;
94
 
 
95
 
        selected_wp = find_routepoint (mouse_x, mouse_y);
96
 
 
 
100
                
97
101
        return FALSE;
98
102
}
99
103
 
103
107
                                        gpointer         user_data)
104
108
{
105
109
        if ((event->state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK) {
106
 
 
 
110
                
107
111
                GtkWidget *range;
108
112
                int zoom_old;
109
113
                double factor;
110
114
                int width_center, height_center;
111
 
 
112
 
 
113
 
 
 
115
                        
 
116
 
 
117
                        
114
118
                if(global_zoom<global_zoom_max)
115
 
                {
 
119
                {       
116
120
                        range = lookup_widget(window1, "vscale1");
117
 
 
 
121
                        
118
122
                        width_center  = map_drawable->allocation.width  / 2;
119
123
                        height_center = map_drawable->allocation.height / 2;
120
 
 
 
124
                                                
121
125
                        zoom_old = global_zoom;
122
 
 
 
126
                
123
127
                        global_zoom++;
124
128
                        gtk_range_set_value(GTK_RANGE(range), (double) global_zoom);
125
 
 
126
 
 
127
 
 
 
129
                        
 
130
                        
 
131
                        
128
132
                        factor = 2;
129
 
 
130
 
 
 
133
                        
 
134
                        
131
135
                        global_x = 2 * global_x + (int)event->x;
132
136
                        global_y = 2 * global_y + (int)event->y;
133
 
 
134
 
 
 
137
                        
 
138
                        
135
139
                        repaint_all();
136
140
                }
137
141
        }
138
142
        else {
 
143
                
 
144
                if ( event->type==GDK_2BUTTON_PRESS) 
 
145
                {       
 
146
                        printf("end double click\n");
 
147
                }
 
148
                
139
149
                if(wtfcounter >= WTFCOUNTER)
140
150
                {
141
 
                        /* This is the mouse release event
142
 
                           of a previous drag: */
143
 
 
144
 
                        if (!selected_wp) {
145
 
                                int mouse_dx, mouse_dy;
146
 
 
147
 
                                global_x = local_x;
148
 
                                global_y = local_y;
149
 
 
150
 
                                mouse_dx = mouse_x - (int) event->x;
151
 
                                mouse_dy = mouse_y - (int) event->y;
152
 
 
153
 
                                global_x += mouse_dx;
154
 
                                global_y += mouse_dy;
155
 
 
156
 
                                gdk_draw_rectangle (
157
 
                                        pixmap,
158
 
                                        widget->style->white_gc,
159
 
                                        TRUE,
160
 
                                        0, 0,
161
 
                                        widget->allocation.width+260,
162
 
                                        widget->allocation.height+260);
163
 
 
164
 
                                gtk_widget_queue_draw_area (
165
 
                                        widget,
166
 
                                        0,0,widget->allocation.width+260,widget->allocation.height+260);
167
 
 
168
 
 
169
 
                                repaint_all ();
170
 
                        } else {
171
 
                                selected_wp = NULL;
172
 
                        }
 
151
                        printf("* mouse drag +8events\n");
 
152
                        int mouse_dx, mouse_dy;
 
153
                        
 
154
                        global_x = local_x;
 
155
                        global_y = local_y;
 
156
                        
 
157
                        mouse_dx = mouse_x - (int) event->x;
 
158
                        mouse_dy = mouse_y - (int) event->y;
 
159
                        
 
160
                        global_x += mouse_dx;
 
161
                        global_y += mouse_dy;
 
162
                
 
163
                        gdk_draw_rectangle (
 
164
                                pixmap,
 
165
                                widget->style->white_gc,
 
166
                                TRUE,
 
167
                                0, 0,
 
168
                                widget->allocation.width+260,
 
169
                                widget->allocation.height+260);
 
170
                                                
 
171
                        gtk_widget_queue_draw_area (
 
172
                                widget, 
 
173
                                0,0,widget->allocation.width+260,widget->allocation.height+260);
 
174
                        
 
175
                
 
176
                        repaint_all();
173
177
                }
174
 
 
 
178
                
175
179
                if (abs(mouse_x - (int) event->x) < 10 && abs(mouse_y - (int) event->y) < 10)
176
180
                {
177
181
                        GSList *list;
178
182
                        gboolean friend_found = FALSE;
179
183
                        gboolean photo_found = FALSE;
180
184
                        gboolean poi_found = FALSE;
181
 
                        waypoint_t *routepoint;
182
 
 
183
 
 
 
185
                        
 
186
                        
184
187
                        if(global_show_friends)
185
188
                        {
186
189
                                for(list = friends_list; list != NULL && !friend_found; list = list->next)
190
193
                                        if(     abs(f->screen_x - mouse_x) < 15 &&
191
194
                                                abs(f->screen_y - mouse_y) < 15)
192
195
                                        {
193
 
 
 
196
                                                
194
197
                                                friend_found = TRUE;
195
198
                                        }
196
 
 
 
199
                                
197
200
                                }
198
201
                        }
199
 
 
 
202
                        
200
203
                        if(global_show_photos && !photo_found)
201
204
                        {
202
205
                                for(list = photo_list; list != NULL && !photo_found; list = list->next)
203
206
                                {
204
207
                                        photo_t *p = list->data;
205
 
 
 
208
                                        
206
209
                                        if(     abs(p->screen_x - mouse_x) < 15 &&
207
210
                                                abs(p->screen_y - mouse_y) < 15)
208
211
                                        {
209
 
 
 
212
                                                
210
213
                                                photo_found = TRUE;
211
214
                                        }
212
 
 
 
215
                                
213
216
                                }
214
217
                        }
215
 
 
 
218
                        
216
219
                        if (global_show_pois )
217
 
                        {
 
220
                        {       
218
221
                                for(list = poi_list; list != NULL && !poi_found; list = list->next)
219
222
                                {
220
223
                                        poi_t *p = list->data;
221
 
 
 
224
                                        
222
225
                                        if(     abs(p->screen_x - mouse_x) < 15 &&
223
226
                                                abs(p->screen_y - mouse_y) < 15)
224
227
                                        {
225
 
 
 
228
                                                
226
229
                                                poi_found = TRUE;
227
230
                                        }
228
 
 
 
231
                                
229
232
                                }
230
233
                        }
231
 
 
232
 
                        routepoint = find_routepoint (mouse_x, mouse_y);
233
 
 
234
 
                        if (!friend_found && !photo_found && !poi_found && !routepoint &&
 
234
                        
 
235
                        
 
236
                        if (!friend_found && !photo_found && !poi_found && 
235
237
                                !distance_mode && !pickpoint_mode)
236
 
                        {
237
 
 
 
238
                        {       
 
239
        
238
240
                                gtk_widget_show(menu1);
239
 
 
240
 
                                gtk_menu_popup (GTK_MENU(menu1), NULL, NULL, NULL, NULL,
241
 
                                          0, event->time);
242
 
 
 
241
                                
 
242
                                gtk_menu_popup (GTK_MENU(menu1), NULL, NULL, NULL, NULL, 
 
243
                                          event->button, event->time);
 
244
                                
243
245
                        }
244
 
 
 
246
                        
245
247
                        if(distance_mode)
246
248
                                do_distance();
247
249
                        else if (pickpoint_mode)
254
256
                                        on_item10_activate(NULL, NULL);
255
257
                                if (poi_found)
256
258
                                        on_item15_activate(NULL, NULL);
257
 
                                if (routepoint) {
258
 
                                        gtk_widget_show (route_menu);
259
 
                                        gtk_menu_popup (GTK_MENU (route_menu),
260
 
                                                        NULL, NULL, NULL, NULL,
261
 
                                                        event->button,
262
 
                                                        event->time);
263
 
                                }
264
259
                        }
265
260
                }
266
 
 
 
261
        
267
262
                wtfcounter = 0;
268
 
 
269
 
 
 
263
        
 
264
                        
270
265
                mouse_dx = mouse_dy = 0;
271
266
                drag_started = 0;
272
267
        }
282
277
        {
283
278
                int x, y, width, height;
284
279
                GdkModifierType state;
285
 
 
286
 
                width  = map_drawable->allocation.width;
287
 
                height = map_drawable->allocation.height;
288
 
 
 
280
                
 
281
                width  = map_drawable->allocation.width;  
 
282
                height = map_drawable->allocation.height; 
 
283
                
289
284
                if (event->is_hint)
290
285
                        gdk_window_get_pointer (event->window, &x, &y, &state);
291
286
                else
294
289
                        y = event->y;
295
290
                        state = event->state;
296
291
                }
297
 
 
298
 
                if (state & GDK_BUTTON1_MASK  && wtfcounter>=WTFCOUNTER)
 
292
         
 
293
                if (state & GDK_BUTTON1_MASK  && wtfcounter>=WTFCOUNTER) 
299
294
                {
300
 
 
301
 
                        if (selected_wp) {
302
 
                                double lat = pixel2lat (global_zoom, global_y+event->y);
303
 
                                double lon = pixel2lon (global_zoom, global_x+event->x);
304
 
                                change_waypoint_of_route (selected_wp, lat, lon);
305
 
                                repaint_all ();
306
 
                                return FALSE;
307
 
                        }
308
 
 
309
 
                        GtkToggleToolButton *autocenter_toggle;
310
 
 
311
295
                        if(!drag_started)
312
296
                        {
313
297
                                mouse_x = (int) event->x;
315
299
                                local_x = global_x;
316
300
                                local_y = global_y;
317
301
 
318
 
                                drag_started = 1;
 
302
                                drag_started = 1;                               
319
303
                        }
320
304
                        global_autocenter = FALSE;
321
 
 
322
 
                        mouse_dx = x - mouse_x;
 
305
                                
 
306
                        mouse_dx = x - mouse_x; 
323
307
                        mouse_dy = y - mouse_y;
324
 
 
 
308
                                
325
309
                        gdk_draw_drawable (
326
310
                                widget->window,
327
311
                                widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
329
313
                                0,0,
330
314
                                mouse_dx,mouse_dy,
331
315
                                -1,-1);
332
 
 
 
316
        
333
317
                        if(mouse_dx>0)
334
318
                                gdk_draw_rectangle (
335
319
                                        widget->window,
338
322
                                        0, 0,
339
323
                                        mouse_dx,
340
324
                                        widget->allocation.height);
341
 
 
 
325
                        
342
326
                        if (mouse_dy>0)
343
327
                                gdk_draw_rectangle (
344
328
                                        widget->window,
347
331
                                        0, 0,
348
332
                                        widget->allocation.width,
349
333
                                        mouse_dy);
350
 
 
351
 
                        autocenter_toggle =
352
 
                                GTK_TOGGLE_TOOL_BUTTON(lookup_widget(window1,
353
 
                                                                     "button3"));
354
 
                        gtk_toggle_tool_button_set_active(autocenter_toggle,
355
 
                                                          FALSE);
356
 
 
357
 
                        autocenter_toggle =
358
 
                                GTK_TOGGLE_TOOL_BUTTON(lookup_widget(window1,
359
 
                                                                     "button56"));
360
 
                        gtk_toggle_tool_button_set_active(autocenter_toggle,
361
 
                                                          FALSE);
362
 
 
363
 
                }
 
334
                                        
 
335
 
 
336
                }       
364
337
                else
365
338
                        wtfcounter++;
366
339
        }
367
 
 
368
 
        return FALSE;
 
340
        
 
341
  return FALSE;
369
342
}
370
343
 
371
344
 
374
347
                                        GdkEventConfigure *event,
375
348
                                        gpointer           user_data)
376
349
{
 
350
        printf("*** %s(): \n",__PRETTY_FUNCTION__);
 
351
        
377
352
        map_drawable = widget;
378
 
 
 
353
        
379
354
        global_drawingarea_width  = widget->allocation.width;
380
355
        global_drawingarea_height = widget->allocation.height;
381
 
 
382
 
 
 
356
        
 
357
        
383
358
        if (pixmap)
384
359
                g_object_unref (pixmap);
385
360
 
386
361
        pixmap = gdk_pixmap_new (
387
362
                        widget->window,
388
 
                        widget->allocation.width+260,
 
363
                        widget->allocation.width+260, 
389
364
                        widget->allocation.height+260,
390
365
                        -1);
391
 
 
392
 
        if (!pixmap)
393
 
        {
394
 
                printf("aieee: pixmap NULL\n");
395
 
        }
396
 
 
 
366
        
 
367
        if(pixmap) printf("pixmap created\n");
 
368
        else printf("aieee: pixmap NULL\n");
 
369
 
 
370
        
397
371
        gdk_draw_rectangle (
398
372
                pixmap,
399
373
                widget->style->white_gc,
401
375
                0, 0,
402
376
                widget->allocation.width+260,
403
377
                widget->allocation.height+260);
404
 
 
 
378
                                
405
379
        gtk_widget_queue_draw_area (
406
 
                widget,
 
380
                widget, 
407
381
                0,0,widget->allocation.width+260,widget->allocation.height+260);
408
382
 
409
 
        repaint_all();
410
 
 
 
383
        repaint_all();  
 
384
        
411
385
        return FALSE;
412
386
}
413
387
 
417
391
                                        GdkEventExpose  *event,
418
392
                                        gpointer         user_data)
419
393
{
420
 
 
421
 
 
422
 
 
 
394
        
 
395
        
 
396
        
423
397
        gdk_draw_drawable (
424
398
                widget->window,
425
399
                widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
427
401
                event->area.x, event->area.y,
428
402
                event->area.x, event->area.y,
429
403
                event->area.width, event->area.height);
430
 
 
 
404
        
431
405
        osd_speed(TRUE);
432
 
        osd_hrm(TRUE);
433
406
        map_scale_indicator();
434
 
 
 
407
        
435
408
        return FALSE;
436
409
}
437
410
 
438
411
void
439
 
on_button1_clicked                     (GtkToggleToolButton *button,
 
412
on_button1_clicked                     (GtkButton       *button,
440
413
                                        gpointer         user_data)
441
 
{
442
 
        maximized = gtk_toggle_tool_button_get_active (button);
443
 
 
444
 
        if(maximized)
445
 
        {
 
414
{       
 
415
        if(!maximized)
 
416
        {               
446
417
                gtk_window_fullscreen(GTK_WINDOW(window1));
447
418
                fill_tiles_pixel(global_x, global_y, global_zoom, FALSE);
 
419
 
 
420
                maximized = TRUE;
448
421
        }
449
422
        else
450
423
        {
451
424
                gtk_window_unfullscreen(GTK_WINDOW(window1));
 
425
 
 
426
                maximized = FALSE;
452
427
        }
453
428
}
454
429
 
467
442
                                        gpointer         user_data)
468
443
{
469
444
        GtkWidget *range;
470
 
 
471
 
 
 
445
        
 
446
        
472
447
        int zoom_old;
473
448
        double factor;
474
449
        int width_center, height_center;
475
450
 
476
451
        if(global_zoom<global_zoom_max)
477
 
        {
 
452
        {       
478
453
                range = lookup_widget(window1, "vscale1");
479
 
 
 
454
                
480
455
                width_center  = map_drawable->allocation.width  / 2;
481
456
                height_center = map_drawable->allocation.height / 2;
482
 
 
 
457
                                
483
458
                zoom_old = global_zoom;
484
 
 
 
459
        
485
460
                global_zoom++;
486
461
                gtk_range_set_value(GTK_RANGE(range), (double) global_zoom);
487
462
                factor = exp(global_zoom * M_LN2)/exp2(zoom_old);
488
 
 
 
463
                
489
464
                global_x = ((global_x + width_center) * factor) - width_center;
490
465
                global_y = ((global_y + height_center) * factor) - height_center;
491
 
 
492
 
 
 
466
                
 
467
                
493
468
                repaint_all();
494
469
        }
495
470
}
496
471
 
497
472
 
498
473
void
499
 
on_button3_clicked                     (GtkToggleToolButton *button,
 
474
on_button3_clicked                     (GtkButton       *button,
500
475
                                        gpointer         user_data)
501
476
{
502
 
        global_autocenter = gtk_toggle_tool_button_get_active(button);
503
 
 
504
 
        if (!global_autocenter)
505
 
                return;
506
 
 
 
477
        global_autocenter = TRUE;
 
478
        
507
479
        if(gpsdata) {
508
480
                if(isnan(gpsdata->fix.latitude) == 0    &&
509
481
                   isnan(gpsdata->fix.longitude)== 0    &&
512
484
                        set_mapcenter(gpsdata->fix.latitude, gpsdata->fix.longitude, global_zoom);
513
485
                }
514
486
        }
 
487
        else
 
488
                printf("Not autocentering map due to missing gps data\n");
515
489
}
516
490
 
517
491
gboolean
519
493
                                        GdkEvent        *event,
520
494
                                        gpointer         user_data)
521
495
{
522
 
        track_log_close ();
 
496
        printf("%s()\n",__PRETTY_FUNCTION__);
523
497
        gtk_main_quit();
524
 
 
525
 
        return FALSE;
 
498
        
 
499
        return FALSE; 
526
500
}
527
501
 
528
502
 
531
505
                                        GdkEvent        *event,
532
506
                                        gpointer         user_data)
533
507
{
534
 
        track_log_close ();
 
508
        printf("%s()\n",__PRETTY_FUNCTION__);
535
509
        gtk_main_quit();
536
 
 
537
510
        return FALSE;
538
511
}
539
512
 
549
522
        if(global_zoom>2)
550
523
        {
551
524
                range = lookup_widget(window1, "vscale1");
552
 
 
 
525
        
553
526
                width_center  = map_drawable->allocation.width  / 2;
554
527
                height_center = map_drawable->allocation.height / 2;
555
 
 
 
528
                                
556
529
                zoom_old = global_zoom;
557
 
 
 
530
        
558
531
                global_zoom--;
559
532
                gtk_range_set_value(GTK_RANGE(range), (double) global_zoom);
560
 
 
 
533
        
561
534
                factor = exp(global_zoom * M_LN2)/exp(zoom_old * M_LN2);
562
 
 
 
535
                
563
536
                global_x = ((global_x + width_center) * factor) - width_center;
564
537
                global_y = ((global_y + height_center) * factor) - height_center;
565
 
 
 
538
                
566
539
                repaint_all();
567
540
        }
568
541
}
574
547
                                        gpointer         user_data)
575
548
{
576
549
 
577
 
        return FALSE;
 
550
  return FALSE;
578
551
}
579
552
 
580
553
gboolean
583
556
                                        gpointer         user_data)
584
557
{
585
558
 
586
 
        return FALSE;
 
559
  return FALSE;
587
560
}
588
561
 
589
562
 
591
564
on_vscale1_button_release_event        (GtkWidget       *widget,
592
565
                                        GdkEventButton  *event,
593
566
                                        gpointer         user_data)
594
 
{
 
567
{       
595
568
        int zoom_old;
596
569
        float factor;
597
570
        int width_center, height_center;
598
 
 
 
571
        
599
572
        width_center  = map_drawable->allocation.width  / 2;
600
573
        height_center = map_drawable->allocation.height / 2;
601
 
 
 
574
                
602
575
        zoom_old = global_zoom;
603
576
 
604
577
        global_zoom = gtk_range_get_value(GTK_RANGE(widget));
605
578
        factor = exp(global_zoom * M_LN2)/exp(zoom_old * M_LN2);
606
 
 
 
579
        
607
580
        global_x = ((global_x + width_center) * factor) - width_center;
608
581
        global_y = ((global_y + height_center) * factor) - height_center;
609
 
 
 
582
        
610
583
        repaint_all();
611
 
 
 
584
        
612
585
        return FALSE;
613
586
}
614
587
 
619
592
{
620
593
        GSList  *list;
621
594
        gchar *reponame_combo;
 
595
        GError **error = NULL;
622
596
        gboolean success = FALSE;
623
597
        static gboolean first_run = TRUE;
624
598
 
625
 
 
 
599
        
626
600
        reponame_combo = gtk_combo_box_get_active_text(combobox);
627
601
 
628
602
        global_curr_reponame = g_strdup(reponame_combo);
629
 
 
630
 
 
 
603
        
 
604
        
631
605
        if(!global_curr_reponame)
632
606
        {
633
607
                global_curr_reponame = g_strdup("OSM");
634
608
                printf("YOUR DISTRIBUTION SUCKS BIGTIME\n");
635
609
        }
636
 
 
637
 
 
 
610
        
 
611
        
638
612
        for(list = global_repo_list; list != NULL; list = list->next)
639
613
        {
640
614
                repo_t  *repo;
642
616
 
643
617
                repo = list->data;
644
618
                reponame = g_strdup(repo->name);
645
 
 
 
619
                
646
620
                if(     g_strrstr(reponame,global_curr_reponame) != NULL &&
647
 
                        strlen(reponame) == strlen(global_curr_reponame)
648
 
                )
 
621
                        strlen(reponame) == strlen(global_curr_reponame)        
 
622
                ) 
649
623
                {
650
624
                        global_curr_repo = list;
651
625
                }
652
626
        }
653
 
 
654
 
 
655
 
        success = g_settings_set_string(
656
 
                                        global_settings,
657
 
                                        "repo-name",
658
 
                                        global_curr_reponame);
659
 
 
 
627
        
 
628
        
 
629
        success = gconf_client_set_string(
 
630
                                        global_gconfclient, 
 
631
                                        GCONF"/repo_name",
 
632
                                        global_curr_reponame,
 
633
                                        error);
 
634
        
660
635
        global_repo_nr = gtk_combo_box_get_active(combobox);
661
 
 
662
 
 
663
 
 
 
636
        
 
637
         
 
638
        
664
639
        if(first_run) {
665
640
                first_run = FALSE;
666
641
        }
672
647
on_dialog1_close                       (GtkDialog       *dialog,
673
648
                                        gpointer         user_data)
674
649
{
 
650
        printf("*** %s(): \n",__PRETTY_FUNCTION__);
 
651
 
675
652
}
676
653
 
677
654
 
680
657
                                        gint             response_id,
681
658
                                        gpointer         user_data)
682
659
{
 
660
        printf("*** %s(): \n",__PRETTY_FUNCTION__);
 
661
 
683
662
}
684
663
 
685
664
 
688
667
                                        gpointer         user_data)
689
668
{
690
669
        gtk_widget_hide(dialog1);
 
670
 
 
671
        printf("*** %s(): \n",__PRETTY_FUNCTION__);
691
672
}
692
673
 
693
674
 
703
684
        const gchar     *reponame, *uri, *dir;
704
685
        gboolean        reversed;
705
686
        repo_t *repo = g_new0(repo_t, 1);
706
 
 
707
 
 
 
687
        
 
688
        
708
689
        entry_repo = lookup_widget(dialog1, "entry5");
709
690
        entry_uri = lookup_widget(dialog1, "entry20");
710
691
        entry_dir = lookup_widget(dialog1, "entry21");
715
696
        uri = gtk_entry_get_text(GTK_ENTRY(entry_uri));
716
697
        dir = gtk_entry_get_text(GTK_ENTRY(entry_dir));
717
698
        reversed = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(togglebutton));
718
 
 
 
699
        
719
700
        gtk_combo_box_append_text (GTK_COMBO_BOX(combobox), g_strdup(reponame));
720
701
        gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), global_repo_cnt);
721
702
        global_repo_cnt++;
722
 
 
 
703
        
723
704
 
724
705
        repo->name = g_strdup(reponame);
725
706
        repo->dir = g_strdup(dir);
726
707
        repo->uri = g_strdup(uri);
727
708
        repo->inverted_zoom = reversed;
728
 
 
 
709
        
729
710
        global_repo_list = g_slist_prepend(global_repo_list, repo);
730
711
        global_curr_repo = global_repo_list;
731
 
 
732
 
        settings_set_repolist();
 
712
        
 
713
        gconf_set_repolist();
733
714
 
734
715
        gtk_widget_hide(dialog1);
 
716
 
 
717
        
 
718
        
 
719
        printf("*** %s(): new repo: %s\n",__PRETTY_FUNCTION__, reponame);
 
720
        
 
721
 
 
722
 
735
723
}
736
724
 
737
725
 
757
745
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(togglebutton), FALSE);
758
746
 
759
747
        gtk_widget_show(dialog1);
 
748
        printf("*** %s(): \n",__PRETTY_FUNCTION__);
760
749
}
761
750
 
762
751
void
775
764
{
776
765
        gboolean        toggled;
777
766
        gboolean success = FALSE;
778
 
 
 
767
        GError **error = NULL;  
 
768
        
779
769
        toggled = gtk_toggle_button_get_active(togglebutton);
780
770
        global_auto_download = toggled;
781
 
 
782
 
        success = g_settings_set_boolean(
783
 
                                global_settings,
784
 
                                "auto-download",
785
 
                                global_auto_download);
786
 
 
 
771
        
 
772
        success = gconf_client_set_bool(
 
773
                                global_gconfclient, 
 
774
                                GCONF"/auto_download",
 
775
                                global_auto_download,
 
776
                                error);
 
777
        
787
778
}
788
779
 
789
780
 
793
784
{
794
785
        GtkWidget       *entry_server, *entry_port;
795
786
        const gchar     *server, *port;
 
787
        
 
788
        printf("*** %s(): \n",__PRETTY_FUNCTION__);
796
789
 
797
790
        entry_server    = lookup_widget(window1, "entry3");
798
791
        entry_port      = lookup_widget(window1, "entry4");
800
793
        port    = gtk_entry_get_text(GTK_ENTRY(entry_port));
801
794
        global_server   = g_strdup(server);
802
795
        global_port     = g_strdup(port);
803
 
 
804
 
        reset_gpsd_io ();
 
796
        
 
797
        global_reconnect_gpsd = TRUE;
805
798
}
806
799
 
807
800
 
812
805
{
813
806
        GtkWidget *widget;
814
807
        gboolean success = FALSE;
815
 
 
816
 
 
 
808
        GError **error = NULL;
 
809
        
 
810
        
817
811
        if(!global_fftimer_running)
818
812
        {
819
813
                update_position();
823
817
 
824
818
                widget = lookup_widget(window1, "image24");
825
819
                gtk_widget_show(widget);
826
 
 
827
 
                gtk_button_set_label (button, _("Stop"));
828
 
 
 
820
                
 
821
                gtk_button_set_label(button, "Stop");
 
822
                
829
823
                widget = lookup_widget(menu1, "item19");
830
824
                gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), TRUE);
831
 
 
 
825
                
832
826
                global_fftimer_running = TRUE;
833
827
        }
834
 
 
835
 
 
836
 
 
 
828
        
 
829
        
 
830
        
837
831
        else
838
832
        {
839
833
                widget = lookup_widget(window1, "image24");
840
834
                gtk_widget_hide(widget);
841
 
 
 
835
                
842
836
                g_source_remove(friendfinder_timer);
843
837
                g_source_remove(msg_timer);
844
838
                friendfinder_timer = 0;
845
839
                msg_timer =0;
846
840
                global_fftimer_running = FALSE;
847
 
 
848
 
                gtk_button_set_label (button, _("Share!"));
 
841
                
 
842
                gtk_button_set_label(button, "Share!");
849
843
        }
850
844
 
851
 
 
852
 
        success = g_settings_set_boolean(
853
 
                global_settings,
854
 
                "fftimer-running",
855
 
                global_fftimer_running);
856
 
 
 
845
        
 
846
        success = gconf_client_set_bool(
 
847
                global_gconfclient, 
 
848
                GCONF"/fftimer_running",
 
849
                global_fftimer_running,
 
850
                error);
 
851
        
857
852
        global_show_friends = TRUE;
858
853
}
859
854
 
861
856
void
862
857
on_item3_activate                      (GtkMenuItem     *menuitem,
863
858
                                        gpointer         user_data)
864
 
{
 
859
{       
865
860
        GSList *list;
866
861
        GladeXML *gladexml;
867
862
        GtkWidget *label, *window, *friend_box, *widget, *hseparator;
879
874
        widget = lookup_widget(window, "vbox35");
880
875
        gtk_widget_show (window);
881
876
 
 
877
        
 
878
        printf("screen x,y: %d %d \n",mouse_x, mouse_y);
882
879
        lat = pixel2lat(global_zoom, global_y+mouse_y);
883
880
        lon = pixel2lon(global_zoom, global_x+mouse_x);
884
 
 
 
881
        
885
882
        lat_deg = rad2deg(lat);
886
883
        lon_deg = rad2deg(lon);
887
 
 
 
884
        printf ("##### Lonitude: %f %f - %f %f \n", lat, lon, lat_deg, lon_deg);
 
885
        
 
886
        
888
887
        if(gpsdata !=NULL && !global_myposition.lat && !global_myposition.lon)
889
888
        {
890
 
                distance =      6371.0 *
891
 
                                acos(sin(deg2rad(gpsdata->fix.latitude)) *
 
889
                distance =      6371.0 *  
 
890
                                acos(sin(deg2rad(gpsdata->fix.latitude)) * 
892
891
                                sin(lat) +
893
 
 
894
 
                                cos(deg2rad(gpsdata->fix.latitude)) *
895
 
                                cos(lat) *
 
892
                
 
893
                                cos(deg2rad(gpsdata->fix.latitude)) * 
 
894
                                cos(lat) * 
896
895
                                cos(lon - deg2rad(gpsdata->fix.longitude)) );
897
896
        }
898
897
        else if(global_myposition.lat && global_myposition.lon)
899
898
        {
900
 
                distance =      6371.0 *
901
 
                                acos(sin(deg2rad(global_myposition.lat)) *
 
899
                distance =      6371.0 *  
 
900
                                acos(sin(deg2rad(global_myposition.lat)) * 
902
901
                                sin(lat) +
903
 
 
904
 
                                cos(deg2rad(global_myposition.lat)) *
905
 
                                cos(lat) *
 
902
                
 
903
                                cos(deg2rad(global_myposition.lat)) * 
 
904
                                cos(lat) * 
906
905
                                cos(lon - deg2rad(global_myposition.lon)) );
907
 
 
 
906
                                
908
907
        }
909
 
 
910
 
        g_sprintf (buffer, _("<b><i>Distance:</i></b> %.3fkm\n"), distance);
911
 
 
 
908
        
 
909
        printf("*** %s(): \n",__PRETTY_FUNCTION__);
 
910
 
 
911
        g_sprintf(buffer, "<b><i>Distance:</i></b> %.3fkm\n",distance);
 
912
        
912
913
        for(list = friends_list; list != NULL; list = list->next)
913
914
        {
914
915
                friend_t *f = list->data;
916
917
                if(     abs(f->screen_x - mouse_x) < 15 &&
917
918
                        abs(f->screen_y - mouse_y) < 15)
918
919
                {
 
920
                        printf("FOUND FRIEND X: %d %d %s\n\n",f->screen_x, mouse_x,f->nick);
 
921
        
919
922
                        friend_box = create_friend_box(f);
920
 
 
 
923
                        
921
924
                        gtk_box_pack_start (GTK_BOX (widget), friend_box, FALSE, FALSE, 0);
922
 
 
 
925
                        
923
926
                        hseparator = gtk_hseparator_new ();
924
927
                        gtk_widget_show (hseparator);
925
928
                        gtk_box_pack_start (GTK_BOX (widget), hseparator, FALSE, FALSE, 0);
926
 
 
 
929
                        
927
930
                        friend_found = TRUE;
928
931
                }
929
 
 
 
932
        
930
933
        }
931
 
 
 
934
        
932
935
        if (!friend_found)
933
 
                g_sprintf (buffer, _("No friends at or near this position"));
 
936
                g_sprintf(buffer,"No friends at or near this position");
934
937
 
935
938
 
936
939
        label = lookup_widget(window,"label119");
942
945
                                        gpointer         user_data)
943
946
{
944
947
        GtkWidget *label;
945
 
        gchar buffer[512]; gchar *bufp;
 
948
        gchar buffer[512];
946
949
        gchar latlon[64];
947
950
        static float start_lat=0, start_lon=0;
948
951
        static float overall_distance = 0;
951
954
        float distance=0;
952
955
        double unit_conv = 1;
953
956
        static gchar distunit[3];
 
957
        
 
958
        printf("screen x,y, global x,y: %d %d %d %d\n",mouse_x, mouse_y, global_x, global_y);
954
959
 
955
960
        if(!distance_mode)
956
961
                overall_distance = 0.0;
957
962
 
958
963
        set_cursor(GDK_CROSSHAIR);
959
964
 
960
 
 
961
 
 
 
965
        
 
966
        
962
967
        lat = pixel2lat(global_zoom, global_y+mouse_y);
963
968
        lon = pixel2lon(global_zoom, global_x+mouse_x);
964
969
 
965
970
        lat_deg = rad2deg(lat);
966
971
        lon_deg = rad2deg(lon);
967
972
 
968
 
        switch (global_latlon_unit)
 
973
        printf ("##### Lonitude: %f %f - %f %f \n", lat, lon, lat_deg, lon_deg);
 
974
 
 
975
        
 
976
                
 
977
        switch (global_latlon_unit) 
969
978
        {
970
979
        case 0:
971
980
                g_sprintf(latlon, "%f - %f", lat_deg, lon_deg);
972
981
                break;
973
982
        case 1:
974
 
                g_sprintf(latlon, "%s   %s",
 
983
                g_sprintf(latlon, "%s   %s", 
975
984
                          latdeg2latmin(lat_deg),
976
985
                          londeg2lonmin(lon_deg));
977
986
                break;
978
987
        case 2:
979
 
                g_sprintf(latlon, "%s   %s",
 
988
                g_sprintf(latlon, "%s   %s", 
980
989
                          latdeg2latsec(lat_deg),
981
990
                          londeg2lonsec(lon_deg));
982
991
        }
983
992
 
984
 
 
 
993
        
985
994
        if(global_speed_unit==1)
986
995
        {
987
996
                unit_conv = 1.0/1.609344;
996
1005
        {
997
1006
                g_sprintf(distunit, "%s", "km");
998
1007
        }
999
 
 
1000
 
 
1001
 
 
 
1008
        
 
1009
        
 
1010
        
1002
1011
        if(distance_mode)
1003
1012
        {
1004
 
                distance =      6371.0 *
1005
 
                                acos(sin(deg2rad(start_lat)) *
 
1013
                distance =      6371.0 *  
 
1014
                                acos(sin(deg2rad(start_lat)) * 
1006
1015
                                sin(lat) +
1007
 
 
1008
 
                                cos(deg2rad(start_lat)) *
1009
 
                                cos(lat) *
 
1016
                
 
1017
                                cos(deg2rad(start_lat)) * 
 
1018
                                cos(lat) * 
1010
1019
                                cos(lon - deg2rad(start_lon)) );
1011
 
 
1012
 
                bearing = get_bearing(deg2rad(start_lat), deg2rad(start_lon), lat, lon);
 
1020
                
 
1021
                bearing = get_bearing(deg2rad(start_lat), deg2rad(start_lon), lat, lon);                
1013
1022
        }
1014
1023
        else if(gpsdata !=NULL && gpsdata->fix.latitude)
1015
1024
        {
1016
 
                distance =      6371.0 *
1017
 
                                acos(sin(deg2rad(gpsdata->fix.latitude)) *
 
1025
                distance =      6371.0 *  
 
1026
                                acos(sin(deg2rad(gpsdata->fix.latitude)) * 
1018
1027
                                sin(lat) +
1019
 
 
1020
 
                                cos(deg2rad(gpsdata->fix.latitude)) *
1021
 
                                cos(lat) *
 
1028
                
 
1029
                                cos(deg2rad(gpsdata->fix.latitude)) * 
 
1030
                                cos(lat) * 
1022
1031
                                cos(lon - deg2rad(gpsdata->fix.longitude)) );
1023
1032
        }
1024
1033
 
1025
1034
        if(distance_mode)
1026
1035
                overall_distance += distance;
1027
 
 
1028
 
 
 
1036
        
 
1037
        
1029
1038
        gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD), latlon, -1);
1030
 
 
1031
 
 
1032
 
 
 
1039
        
 
1040
        
 
1041
        
1033
1042
        label = lookup_widget(window2,"label64");
1034
 
 
1035
 
        bufp = buffer;
1036
 
        bufp += g_sprintf (bufp, _("<b>This point:</b>\n%s\n"
1037
 
                                   "<small><i>(coords auto-copied to clipboard)\n</i></small>\n"),
1038
 
                           latlon);
1039
 
 
1040
 
        if (gpsdata && gpsdata->fix.latitude)
 
1043
        
 
1044
        if(!distance_mode && gpsdata && gpsdata->fix.latitude)
1041
1045
        {
1042
 
                bufp += g_sprintf (bufp, _("<b>Bearing:</b>\n%.1f°\n"),
1043
 
                                   bearing/M_PI*180);
1044
 
 
1045
 
                if (!distance_mode)
1046
 
                {
1047
 
                        bufp += g_sprintf (bufp, _("<b>Distance from your location:</b>\n%.2f%s\n"),
1048
 
                                           distance*unit_conv,
1049
 
                                           distunit);
1050
 
                }
 
1046
                g_sprintf(buffer,"<b>This point:</b> \n%s \n"
 
1047
                                "<small><i>(coords auto-copied to clipboard)\n</i></small>\n"
 
1048
                                "<b>Bearing:</b>\n%.1f°\n"
 
1049
                                "<b>Distance from your location:</b>\n%.2f%s\n"
 
1050
                                "Click another point for distance",
 
1051
                                latlon, bearing/M_PI*180, 
 
1052
                                distance*unit_conv, distunit);
1051
1053
        }
1052
 
 
1053
 
        if (!distance_mode)
 
1054
        else if (!distance_mode && (!gpsdata || (gpsdata && !gpsdata->fix.latitude)))
1054
1055
        {
1055
 
                bufp += g_sprintf (bufp, _("Click another point for distance"));
 
1056
                g_sprintf(buffer,"<b>This point:</b> \n%s \n"
 
1057
                                "<small><i>(coords auto-copied to clipboard)\n</i></small>\n" 
 
1058
                                "Click another point for distance",
 
1059
                                latlon);                
1056
1060
        }
1057
1061
        else
1058
1062
        {
1059
 
                bufp += g_sprintf (bufp, _("<b>Distance from last point:</b>\n%.2f%s\n"),
1060
 
                                   distance*unit_conv, distunit);
1061
 
                bufp += g_sprintf (bufp, _("<b>Overall Distance:</b>\n%.2f%s"),
1062
 
                                   overall_distance*unit_conv, distunit);
 
1063
                g_sprintf(buffer,"<b>This point:</b> \n%s \n"
 
1064
                                "<small><i>(coords auto-copied to clipboard)\n</i></small>\n"
 
1065
                                "<b>Bearing:</b>\n%.1f°\n"
 
1066
                                "<b>Distance from last point:</b>\n%.2f%s\n"
 
1067
                                "<b>Overall Distance:</b>\n%.2f%s",
 
1068
                                latlon, bearing/M_PI*180, 
 
1069
                                distance*unit_conv, distunit, 
 
1070
                                overall_distance*unit_conv, distunit);
 
1071
                
1063
1072
        }
1064
 
 
 
1073
        
1065
1074
        gtk_label_set_label(GTK_LABEL(label),buffer);
1066
1075
        gtk_widget_show (window2);
1067
1076
 
1068
 
 
1069
 
 
 
1077
        
 
1078
        
1070
1079
        if(distance_mode)
1071
1080
        {
1072
 
 
 
1081
                
1073
1082
                int pixel_x, pixel_y, x, y;
1074
1083
                float lt, ln;
1075
 
 
1076
 
 
 
1084
                
 
1085
                
1077
1086
                GdkColor color;
1078
1087
                GdkGC *gc;
1079
 
 
 
1088
        
1080
1089
                gc = gdk_gc_new(pixmap);
1081
1090
                color.green = 0;
1082
1091
                color.blue = 50000;
1086
1095
                gc, 5, GDK_LINE_SOLID, GDK_CAP_ROUND, GDK_JOIN_ROUND);
1087
1096
 
1088
1097
 
1089
 
 
1090
 
 
 
1098
                
 
1099
                
1091
1100
                lt = deg2rad(start_lat);
1092
1101
                ln = deg2rad(start_lon);
1093
1102
                pixel_x = lon2pixel(global_zoom, ln);
1094
1103
                pixel_y = lat2pixel(global_zoom, lt);
1095
1104
                x = pixel_x - global_x;
1096
1105
                y = pixel_y - global_y;
1097
 
 
 
1106
                
1098
1107
 
1099
1108
 
1100
1109
                gdk_draw_line (pixmap, gc, x, y, mouse_x, mouse_y);
1101
1110
 
1102
1111
                gtk_widget_queue_draw_area (
1103
 
                        map_drawable,
1104
 
                        ((x > mouse_x) ? mouse_x : x) - 4,
 
1112
                        map_drawable, 
 
1113
                        ((x > mouse_x) ? mouse_x : x) - 4, 
1105
1114
                        ((y > mouse_y) ? mouse_y : y) - 4,
1106
1115
                        abs(mouse_x - x) + 8,
1107
1116
                        abs(mouse_y - y) + 8);
 
1117
                        
 
1118
 
 
1119
                printf("LINE x y lx ly: %d %d %d %d\n", start_x, start_y, mouse_x, mouse_y);
1108
1120
        }
1109
1121
        else
1110
1122
        {
1111
 
 
1112
 
 
 
1123
                
 
1124
                
1113
1125
                GdkColor color;
1114
1126
                GdkGC *gc;
1115
 
 
 
1127
        
1116
1128
                gc = gdk_gc_new(pixmap);
1117
1129
                color.green = 20000;
1118
1130
                color.blue = 20000;
1122
1134
                gc, 5, GDK_LINE_SOLID, GDK_CAP_ROUND, GDK_JOIN_ROUND);
1123
1135
 
1124
1136
 
1125
 
 
1126
 
 
 
1137
                
 
1138
                
1127
1139
                gdk_draw_arc (
1128
1140
                        pixmap,
1129
 
 
 
1141
                        
1130
1142
                        gc,
1131
 
                        TRUE,
1132
 
                        mouse_x-8, mouse_y-8,
1133
 
                        16,16,
1134
 
                        0,23040);
 
1143
                        TRUE,                   
 
1144
                        mouse_x-8, mouse_y-8,           
 
1145
                        16,16,                  
 
1146
                        0,23040);               
1135
1147
 
1136
1148
                gtk_widget_queue_draw_area (
1137
 
                        map_drawable,
1138
 
                        mouse_x - 8,
 
1149
                        map_drawable, 
 
1150
                        mouse_x - 8, 
1139
1151
                        mouse_y - 8,
1140
1152
                        mouse_x + 16,
1141
1153
                        mouse_y + 16);
1142
 
 
 
1154
                        
1143
1155
        }
1144
 
 
1145
 
 
 
1156
        
 
1157
        
1146
1158
        start_x = mouse_x;
1147
1159
        start_y = mouse_y;
1148
1160
        start_lat = lat_deg;
1149
1161
        start_lon = lon_deg;
1150
 
 
1151
 
 
 
1162
        
 
1163
        
1152
1164
        distance_mode = TRUE;
1153
1165
 
1154
1166
}
1162
1174
        GtkWidget *window;
1163
1175
        window = lookup_widget(GTK_WIDGET(button), "window2");
1164
1176
        gtk_widget_hide(window);
1165
 
 
 
1177
        
1166
1178
        distance_mode = FALSE;
1167
1179
        set_cursor(GDK_HAND2);
1168
1180
        repaint_all();
1173
1185
                                        GdkEventButton  *event,
1174
1186
                                        gpointer         user_data)
1175
1187
{
1176
 
 
 
1188
        
1177
1189
        GtkWidget *label;
1178
1190
        gchar buffer[512];
1179
1191
        float lat, lon,lat_deg,lon_deg;
1180
 
 
 
1192
        
 
1193
        
 
1194
        printf("screen x,y: %d %d \n",mouse_x, mouse_y);
1181
1195
        lat = pixel2lat(global_zoom, global_y+mouse_y);
1182
1196
        lon = pixel2lon(global_zoom, global_x+mouse_x);
1183
 
 
 
1197
        
1184
1198
        lat_deg = rad2deg(lat);
1185
1199
        lon_deg = rad2deg(lon);
1186
 
 
 
1200
        
1187
1201
        global_myposition.lat = lat_deg;
1188
1202
        global_myposition.lon = lon_deg;
1189
1203
 
1190
1204
        label = lookup_widget(window2,"label64");
1191
 
 
1192
 
        g_sprintf (buffer, _("<b>Manually set position</b>\n\n"
1193
 
                             "This point:\n\n  <i>%f %f</i>\n\n"
1194
 
                             "will now be used as your location\n"
1195
 
                             "for the friend finder service."),
1196
 
                   global_myposition.lat,
1197
 
                   global_myposition.lon);
1198
 
 
 
1205
        
 
1206
        g_sprintf(buffer,"<b>Manually set position</b>\n\nThis point: \n\n"
 
1207
                        "  <i>%f %f</i> \n\n"
 
1208
                        "will now be used as your location\n"
 
1209
                        "for the friend finder service.",
 
1210
                        global_myposition.lat,
 
1211
                        global_myposition.lon);
 
1212
                        
1199
1213
        gtk_label_set_label(GTK_LABEL(label),buffer);
1200
1214
        gtk_widget_show (window2);
1201
 
 
1202
 
        g_settings_set_double(
1203
 
                global_settings,
1204
 
                "myposition-lat",
1205
 
                global_myposition.lat);
1206
 
 
1207
 
        g_settings_set_double(
1208
 
                global_settings,
1209
 
                "myposition-lon",
1210
 
                global_myposition.lon);
1211
 
 
 
1215
        
 
1216
        gconf_client_set_float(
 
1217
                global_gconfclient, 
 
1218
                GCONF"/myposition_lat",
 
1219
                global_myposition.lat,
 
1220
                NULL);
 
1221
 
 
1222
        gconf_client_set_float(
 
1223
                global_gconfclient, 
 
1224
                GCONF"/myposition_lon",
 
1225
                global_myposition.lon,
 
1226
                NULL);
 
1227
                
1212
1228
        paint_myposition();
1213
 
 
 
1229
        
1214
1230
        return FALSE;
1215
1231
}
1216
1232
 
1220
1236
                                        gpointer         user_data)
1221
1237
{
1222
1238
        if ((event->state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK) {
 
1239
                if (event->direction == GDK_SCROLL_UP) {
 
1240
                        printf("SCROLL UP+Ctrl\n");
 
1241
                } else {
 
1242
                        printf("SCROLL DOWN+Ctrl\n");
 
1243
                }
1223
1244
                return TRUE;
1224
1245
        }
1225
1246
        else
1229
1250
                double factor;
1230
1251
                int width_center, height_center;
1231
1252
                static int slowpad = 0;
1232
 
 
 
1253
                
1233
1254
                if (event->direction == GDK_SCROLL_UP && slowpad % 2 ==0)
1234
1255
                {
1235
1256
                        slowpad++;
1236
 
 
 
1257
                                                
1237
1258
                        if(global_zoom<global_zoom_max)
1238
 
                        {
 
1259
                        {       
1239
1260
                                range = lookup_widget(window1, "vscale1");
1240
 
 
 
1261
                                
1241
1262
                                width_center  = map_drawable->allocation.width  / 2;
1242
1263
                                height_center = map_drawable->allocation.height / 2;
1243
 
 
 
1264
                                                                
1244
1265
                                zoom_old = global_zoom;
1245
 
 
 
1266
                        
1246
1267
                                global_zoom++;
1247
1268
                                gtk_range_set_value(GTK_RANGE(range), (double) global_zoom);
1248
 
 
1249
 
 
1250
 
 
 
1269
                                
 
1270
                                
 
1271
                                
1251
1272
                                factor = 2;
1252
 
 
1253
 
 
 
1273
                                
 
1274
                                
1254
1275
                                global_x = 2 * global_x + (int)event->x;
1255
1276
                                global_y = 2 * global_y + (int)event->y;
1256
 
 
1257
 
 
 
1277
                                
 
1278
                                
1258
1279
                                repaint_all();
1259
1280
                        }
1260
1281
                }
1265
1286
                        if(global_zoom>2)
1266
1287
                        {
1267
1288
                                range = lookup_widget(window1, "vscale1");
1268
 
 
 
1289
                        
1269
1290
                                width_center  = map_drawable->allocation.width  / 2;
1270
1291
                                height_center = map_drawable->allocation.height / 2;
1271
 
 
 
1292
                                                                
1272
1293
                                zoom_old = global_zoom;
1273
 
 
 
1294
                        
1274
1295
                                global_zoom--;
1275
1296
                                gtk_range_set_value(GTK_RANGE(range), (double) global_zoom);
1276
 
 
 
1297
                        
1277
1298
                                factor = exp(global_zoom * M_LN2)/exp(zoom_old * M_LN2);
1278
 
 
 
1299
                                
1279
1300
                                global_x = global_x/2 - (int)event->x/2;
1280
1301
                                global_y = global_y/2 - (int)event->y/2;
1281
 
 
 
1302
                                
1282
1303
                                repaint_all();
1283
1304
                        }
1284
1305
                }
1285
1306
                else slowpad++;
1286
 
 
 
1307
                        
1287
1308
                return TRUE;
1288
1309
        }
1289
1310
 
1295
1316
                                        gpointer         user_data)
1296
1317
{
1297
1318
        trip_counter_on = (trip_counter_on) ? FALSE : TRUE;
1298
 
 
 
1319
        
1299
1320
        if(trip_counter_on)
1300
 
                gtk_button_set_label (button, _("Stop"));
 
1321
                gtk_button_set_label(button, "Stop");
1301
1322
        else
1302
 
                gtk_button_set_label (button, _("Resume"));
 
1323
                gtk_button_set_label(button, "Resume");
1303
1324
}
1304
1325
 
1305
1326
void
1308
1329
{
1309
1330
        GtkWidget *nick;
1310
1331
        const gchar *n;
 
1332
        GError **error = NULL;
1311
1333
        gboolean success = FALSE;
1312
 
 
 
1334
        
1313
1335
        nick  = lookup_widget(window1, "entry7");
1314
 
 
 
1336
        
1315
1337
        n = gtk_entry_get_text(GTK_ENTRY(nick));
1316
 
 
1317
 
        success = g_settings_set_string(
1318
 
                                        global_settings,
1319
 
                                        "nick",
1320
 
                                        n);
 
1338
                
 
1339
        success = gconf_client_set_string(
 
1340
                                        global_gconfclient, 
 
1341
                                        GCONF"/nick",
 
1342
                                        n,
 
1343
                                        error);
1321
1344
}
1322
1345
 
1323
1346
 
1327
1350
{
1328
1351
        GtkWidget *pass;
1329
1352
        const gchar *p;
 
1353
        GError **error = NULL;
1330
1354
        gboolean success = FALSE;
1331
 
 
 
1355
        
1332
1356
        pass  = lookup_widget(window1, "entry8");
1333
 
 
 
1357
        
1334
1358
        p = gtk_entry_get_text(GTK_ENTRY(pass));
1335
 
 
1336
 
 
1337
 
        success = g_settings_set_string(
1338
 
                                        global_settings,
1339
 
                                        "pass",
1340
 
                                        p);
 
1359
        
 
1360
        
 
1361
        success = gconf_client_set_string(
 
1362
                                        global_gconfclient, 
 
1363
                                        GCONF"/pass",
 
1364
                                        p,
 
1365
                                        error);
1341
1366
 
1342
1367
}
1343
1368
 
1354
1379
on_button19_clicked                    (GtkButton       *button,
1355
1380
                                        gpointer         user_data)
1356
1381
{
1357
 
 
 
1382
        
1358
1383
        track_log_close();
1359
1384
        track_log_open();
1360
 
 
 
1385
        
1361
1386
}
1362
1387
 
1363
1388
 
1366
1391
                                        gpointer         user_data)
1367
1392
{
1368
1393
        GtkWidget *dialog3, *entry;
 
1394
        printf("*** %s(): \n",__PRETTY_FUNCTION__);
1369
1395
 
1370
1396
        dialog3 = glade_xml_get_widget (gladexml, "dialog3");
1371
1397
        entry = lookup_widget(dialog3, "entry12");
1372
1398
        gtk_entry_set_text(GTK_ENTRY(entry), global_track_dir);
1373
 
 
 
1399
        
1374
1400
        gtk_widget_show(dialog3);
1375
1401
}
1376
1402
 
1381
1407
        GtkWidget       *dialog3;
1382
1408
 
1383
1409
        dialog3 = lookup_widget(GTK_WIDGET(button), "dialog3");
1384
 
 
 
1410
        
1385
1411
        gtk_widget_hide(dialog3);
 
1412
 
 
1413
        printf("*** %s(): \n",__PRETTY_FUNCTION__);
1386
1414
}
1387
1415
 
1388
1416
 
1393
1421
        GtkWidget *dialog3;
1394
1422
        GtkEntry *entry;
1395
1423
        gint mkres;
 
1424
        GError **error = NULL;
1396
1425
        gboolean success = FALSE;
1397
1426
        int result;
1398
1427
 
1399
 
 
 
1428
        
1400
1429
        entry = (GtkEntry *)lookup_widget(GTK_WIDGET(button), "entry12");
1401
1430
        global_track_dir = g_strconcat(gtk_entry_get_text(entry),"/",NULL);
1402
1431
 
1403
 
        result = strncmp(global_track_dir, "~", 1);
1404
 
 
 
1432
        result = strncmp(global_track_dir, "~", 1); 
 
1433
        
1405
1434
        if(!result)
1406
1435
        {
1407
1436
                char *sub_home, *home_dir;
1408
 
 
 
1437
                
1409
1438
                strsep(&global_track_dir, "~");
1410
1439
                sub_home = g_strdup(strsep(&global_track_dir, "~"));
1411
1440
                home_dir = getenv("HOME");
1412
 
 
 
1441
                
1413
1442
                g_free(global_track_dir);
1414
1443
                global_track_dir = g_strconcat(home_dir, sub_home, NULL);
1415
 
 
 
1444
                
1416
1445
                g_free(sub_home);
1417
1446
        }
1418
 
 
 
1447
        
 
1448
        
 
1449
        printf("TRACKDIR: %s - ~ %d\n",global_track_dir, result);
 
1450
        
 
1451
        
1419
1452
        mkres = g_mkdir_with_parents(global_track_dir,0700);
1420
1453
        if(mkres==-1) {
 
1454
                printf("MKDIR ERROR\n\n");
1421
1455
                perror("mkdir........");
1422
1456
        }
1423
 
 
1424
 
        success = g_settings_set_string(
1425
 
                                global_settings,
1426
 
                                "track-dir",
1427
 
                                global_track_dir);
1428
 
 
 
1457
        
 
1458
        success = gconf_client_set_string(
 
1459
                                global_gconfclient, 
 
1460
                                GCONF"/track_dir",
 
1461
                                global_track_dir,
 
1462
                                error);
 
1463
        
1429
1464
        dialog3 = lookup_widget(GTK_WIDGET(button), "dialog3");
1430
 
 
 
1465
        
1431
1466
        gtk_widget_hide(dialog3);
1432
1467
}
1433
1468
 
1447
1482
                                        gpointer         user_data)
1448
1483
{
1449
1484
        global_myposition.lat = global_myposition.lon = 0;
1450
 
 
1451
 
        g_settings_set_double(
1452
 
                global_settings,
1453
 
                "myposition-lat",
1454
 
                0);
1455
 
 
1456
 
        g_settings_set_double(
1457
 
                global_settings,
1458
 
                "myposition-lon",
1459
 
                0);
1460
 
 
 
1485
        
 
1486
        gconf_client_set_float(
 
1487
                global_gconfclient, 
 
1488
                GCONF"/myposition_lat",
 
1489
                0,
 
1490
                NULL);
 
1491
 
 
1492
        gconf_client_set_float(
 
1493
                global_gconfclient, 
 
1494
                GCONF"/myposition_lon",
 
1495
                0,
 
1496
                NULL);
 
1497
        
1461
1498
        repaint_all();
1462
 
 
 
1499
        
1463
1500
        return FALSE;
1464
1501
}
1465
1502
 
1468
1505
                                        gpointer         user_data)
1469
1506
{
1470
1507
        GtkWidget *dialog4;
1471
 
 
 
1508
        
1472
1509
        dialog4 = glade_xml_get_widget (gladexml, "dialog4");
1473
1510
        gtk_widget_show(dialog4);
1474
1511
}
1500
1537
                                        GdkEventConfigure *event,
1501
1538
                                        gpointer         user_data)
1502
1539
{
 
1540
        printf("*** %s(): \n",__PRETTY_FUNCTION__);
 
1541
        
 
1542
 
 
1543
        
1503
1544
        if (!pixmap_photo)
1504
1545
        pixmap_photo = gdk_pixmap_new (
1505
1546
                        widget->window,
1507
1548
                        widget->allocation.height,
1508
1549
                        -1);
1509
1550
 
1510
 
        if (!pixmap_photo)
1511
 
        {
 
1551
        if(pixmap_photo)
 
1552
                printf("pixmap_photo NOT NULL");
 
1553
        else
1512
1554
                printf("aieee: pixmap_photo NULL\n");
1513
 
        }
1514
1555
 
 
1556
        
 
1557
        
 
1558
        
 
1559
        
 
1560
        
 
1561
        
1515
1562
        return FALSE;
1516
1563
}
1517
1564
 
1521
1568
                                        GdkEventExpose  *event,
1522
1569
                                        gpointer         user_data)
1523
1570
{
 
1571
        printf("** D2: expose event\n");
 
1572
 
1524
1573
        gdk_draw_drawable (
1525
1574
                widget->window,
1526
1575
                widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
1528
1577
                event->area.x, event->area.y,
1529
1578
                event->area.x, event->area.y,
1530
1579
                event->area.width, event->area.height);
1531
 
 
1532
 
 
 
1580
        
 
1581
        
1533
1582
        return FALSE;
1534
1583
}
1535
1584
 
1541
1590
{
1542
1591
        GtkWidget *label, *widget;
1543
1592
        GtkWidget *drawingarea2;
1544
 
 
 
1593
        
1545
1594
        static gulong hd1 = 0, hd2 = 0;
1546
1595
 
1547
1596
        GSList *list;
1552
1601
        GdkPixbuf *photo = NULL;
1553
1602
        GError  *error = NULL;
1554
1603
        GdkGC *gc;
1555
 
 
 
1604
        
1556
1605
        waypoint_t *wp = g_new0(waypoint_t,1);
1557
 
 
 
1606
        
1558
1607
        gtk_widget_show(window3);
1559
1608
 
1560
1609
        drawingarea2 = lookup_widget(window3,"drawingarea2");
1561
1610
 
1562
 
 
1563
 
 
1564
 
 
1565
 
 
1566
 
 
1567
 
 
 
1611
        
 
1612
        
 
1613
 
 
1614
 
 
1615
        
 
1616
        
1568
1617
        label = lookup_widget(window3,"label104");
1569
 
 
1570
 
 
1571
 
 
1572
 
 
1573
 
 
1574
 
 
 
1618
        
 
1619
        
 
1620
 
 
1621
        
 
1622
        
 
1623
        
1575
1624
        for(list = photo_list; list != NULL; list = list->next)
1576
1625
        {
1577
1626
                photo_t *p = list->data;
1578
 
 
 
1627
                printf("\n\nPIXEL PHOTOS: %d %d   \n\n",p->screen_x,p->screen_y);
 
1628
                
1579
1629
                if(abs(p->screen_x - mouse_x) < 15 &&
1580
1630
                   abs(p->screen_y - mouse_y) < 15 &&
1581
 
                   !photo_found && !photo)
 
1631
                   !photo_found && !photo) 
1582
1632
                {
1583
 
                        g_sprintf(buffer,
 
1633
                        
 
1634
                        printf("FOUND PHOTO X: %d %d %s\n",p->screen_x, mouse_x, p->name);
 
1635
        
 
1636
                        
 
1637
                        g_sprintf(buffer, 
1584
1638
                                "%s ",
1585
1639
                                p->name);
1586
1640
                        photo_found = TRUE;
1587
1641
                        wp->lat = deg2rad(p->lat);
1588
1642
                        wp->lon = deg2rad(p->lon);
1589
 
 
1590
 
 
 
1643
                        
 
1644
                        
1591
1645
                        photo = gdk_pixbuf_new_from_file_at_size (
1592
1646
                                                        p->filename, 240,-1,
1593
1647
                                                        &error);
1594
1648
                        if(!photo)
1595
1649
                        {
1596
 
                                printf ("+++++++++++++ PHOTO NOT FOUND +++++++++\n");
1597
 
                                g_sprintf (buffer, _("File not found"));
 
1650
                                printf ("+++++++++++++ FOTO NOT FOUND +++++++++\n");
 
1651
                                g_sprintf(buffer, "File not found");
1598
1652
                        }
1599
1653
                        else
1600
1654
                        {
1601
1655
                                photo_file = p->filename;
 
1656
                                
 
1657
                                printf ("+++++++++++++ F*CKING  DRAWINF +++++++++\n");
1602
1658
 
1603
1659
                                gc = gdk_gc_new(pixmap_photo);
1604
 
 
 
1660
                                
1605
1661
                                gdk_draw_rectangle (
1606
1662
                                        pixmap_photo,
1607
1663
                                        drawingarea2->style->white_gc,
1609
1665
                                        0, 0,
1610
1666
                                        drawingarea2->allocation.width,
1611
1667
                                        drawingarea2->allocation.height);
1612
 
 
 
1668
                                
1613
1669
                                gdk_draw_pixbuf (
1614
1670
                                        pixmap_photo,
1615
1671
                                        gc,
1618
1674
                                        0, 0,
1619
1675
                                        -1,-1,
1620
1676
                                        GDK_RGB_DITHER_NONE, 0, 0);
1621
 
 
 
1677
                                
1622
1678
                                gdk_draw_drawable (
1623
1679
                                        drawingarea2->window,
1624
1680
                                        drawingarea2->style->fg_gc[GTK_WIDGET_STATE (drawingarea2)],
1628
1684
                                        -1,-1);
1629
1685
 
1630
1686
                                gtk_widget_queue_draw_area (
1631
 
                                        drawingarea2,
 
1687
                                        drawingarea2, 
1632
1688
                                        0, 0,
1633
1689
                                        80,80);
1634
1690
 
1635
1691
                        }
1636
1692
 
1637
1693
 
1638
 
 
 
1694
        
1639
1695
                }
1640
 
 
 
1696
        
1641
1697
        }
1642
 
 
 
1698
        
1643
1699
        if(!photo_found)
1644
 
                g_sprintf (buffer, _("No Geo Photo found"));
1645
 
 
 
1700
                g_sprintf(buffer, "No Geo Photo found");
 
1701
        
1646
1702
        gtk_label_set_text(GTK_LABEL(label),buffer);
1647
1703
 
1648
1704
        widget = lookup_widget(window3, "button29");
1650
1706
        hd1 = g_signal_connect (        (gpointer) widget, "clicked",
1651
1707
                                G_CALLBACK (on_button29_clicked),
1652
1708
                                (gpointer) wp);
1653
 
 
 
1709
        
1654
1710
        widget = lookup_widget(window3, "button21");
1655
1711
        if(hd2) g_signal_handler_disconnect(G_OBJECT(widget), hd2);
1656
1712
        hd2 = g_signal_connect (        (gpointer) widget, "clicked",
1657
1713
                                G_CALLBACK (on_button21_clicked),
1658
1714
                                (gpointer) g_strdup(photo_file));
1659
 
 
 
1715
                
1660
1716
}
1661
1717
 
1662
1718
 
1681
1737
        GdkPixbuf *photo = NULL;
1682
1738
        GError  *error = NULL;
1683
1739
        GdkGC *gc;
 
1740
        
 
1741
printf("*** %s(): \n",__PRETTY_FUNCTION__);
1684
1742
 
 
1743
        
1685
1744
        gladexml = glade_xml_new (gladefile, "win13_biggeo", GETTEXT_PACKAGE);
1686
1745
        glade_xml_signal_autoconnect (gladexml);
1687
1746
        widget = glade_xml_get_widget (gladexml, "win13_biggeo");
1689
1748
                                  G_CALLBACK (g_object_unref), gladexml);
1690
1749
 
1691
1750
        gtk_widget_show(widget);
1692
 
 
 
1751
        
1693
1752
        drawingarea = lookup_widget(widget, "drawingarea3");
1694
 
 
 
1753
        
1695
1754
        photo = gdk_pixbuf_new_from_file_at_size (
1696
1755
                                                        photo_file, 640,-1,
1697
1756
                                                        &error);
1698
1757
        if(!photo)
1699
1758
        {
1700
 
                printf ("+++++++++++++ PHOTO NOT FOUND: %s +++++++++\n", photo_file);
1701
 
                g_sprintf (buffer, _("File not found"));
 
1759
                printf ("+++++++++++++ FOTO NOT FOUND: %s +++++++++\n", photo_file);
 
1760
                g_sprintf(buffer, "File not found");
1702
1761
        }
1703
1762
        else
1704
1763
        {
1705
1764
                gc = gdk_gc_new(pixmap_photo);
1706
 
 
 
1765
                
1707
1766
                gdk_draw_rectangle (
1708
1767
                        pixmap_photo,
1709
1768
                        drawingarea->style->white_gc,
1711
1770
                        0, 0,
1712
1771
                        drawingarea->allocation.width,
1713
1772
                        drawingarea->allocation.height);
1714
 
 
 
1773
                
1715
1774
                gdk_draw_pixbuf (
1716
1775
                        pixmap_photo,
1717
1776
                        gc,
1720
1779
                        0, 0,
1721
1780
                        -1,-1,
1722
1781
                        GDK_RGB_DITHER_NONE, 0, 0);
1723
 
 
 
1782
                
1724
1783
                gdk_draw_drawable (
1725
1784
                        drawingarea->window,
1726
1785
                        drawingarea->style->fg_gc[GTK_WIDGET_STATE (drawingarea)],
1730
1789
                        -1,-1);
1731
1790
 
1732
1791
                gtk_widget_queue_draw_area (
1733
 
                        drawingarea,
 
1792
                        drawingarea, 
1734
1793
                        0, 0,
1735
1794
                        80,80);
1736
1795
 
1737
1796
        }
1738
1797
 
1739
1798
 
1740
 
 
1741
 
 
 
1799
        
 
1800
        
1742
1801
        gtk_widget_hide(window3);printf("*** %s(): 44\n",__PRETTY_FUNCTION__);
1743
1802
 
1744
1803
}
1751
1810
                                        gpointer         user_data)
1752
1811
{
1753
1812
        show_window6();
1754
 
 
 
1813
        
1755
1814
        return FALSE;
1756
1815
}
1757
1816
 
1763
1822
{
1764
1823
        GtkWidget *dialog, *combobox;
1765
1824
 
 
1825
        printf("*** %s(): \n",__PRETTY_FUNCTION__);
1766
1826
        dialog = glade_xml_get_widget (gladexml, "dialog6");
1767
1827
        gtk_widget_show(dialog);
1768
 
 
 
1828
        
1769
1829
        combobox = lookup_widget(dialog, "combobox4");
1770
1830
        gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), 0);
1771
1831
 
1791
1851
        GtkWidget *dialog;
1792
1852
        dialog = lookup_widget(GTK_WIDGET(button), "window6");
1793
1853
        set_poi(dialog);
1794
 
 
1795
 
 
1796
 
        global_show_pois = TRUE;
 
1854
        
 
1855
 
 
1856
        global_show_pois = TRUE; 
1797
1857
        repaint_all();
1798
1858
}
1799
1859
 
1803
1863
                                        gpointer         user_data)
1804
1864
{
1805
1865
        GtkWidget *dialog;
1806
 
 
 
1866
        
 
1867
        printf("*** %s(): \n",__PRETTY_FUNCTION__);
 
1868
        
1807
1869
        dialog = lookup_widget(GTK_WIDGET(button), "dialog6");
1808
1870
        gtk_widget_hide(dialog);
1809
1871
 
1816
1878
{
1817
1879
        GtkWidget *dialog,*combobox,*widget;
1818
1880
        gboolean pois_shown;
1819
 
 
 
1881
        
 
1882
        printf("*** %s(): \n",__PRETTY_FUNCTION__);
 
1883
        
1820
1884
        dialog = lookup_widget(GTK_WIDGET(button), "dialog6");
1821
 
 
 
1885
        
1822
1886
        combobox = lookup_widget(GTK_WIDGET(button), "combobox4");
1823
1887
        global_poi_cat = gtk_combo_box_get_active(GTK_COMBO_BOX(combobox));
1824
1888
 
1825
1889
        gtk_widget_hide(dialog);
1826
 
 
 
1890
        
1827
1891
        widget = lookup_widget(menu1, "item20");
1828
1892
        pois_shown = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
1829
 
 
 
1893
        
1830
1894
        if(pois_shown)
1831
1895
                repaint_all();
1832
1896
        else
1833
1897
                gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), TRUE);
1834
 
 
 
1898
        
1835
1899
}
1836
1900
 
1837
1901
gboolean
1839
1903
                                        GdkEvent        *event,
1840
1904
                                        gpointer         user_data)
1841
1905
{
1842
 
        gtk_widget_hide (widget);
1843
 
        return TRUE;
 
1906
        printf("*** %s(): \n",__PRETTY_FUNCTION__);
 
1907
 
 
1908
  gtk_widget_hide (widget);
 
1909
  return TRUE;
1844
1910
}
1845
1911
 
1846
1912
 
1848
1914
on_combobox2_changed                   (GtkComboBox     *combobox,
1849
1915
                                        gpointer         user_data)
1850
1916
{
 
1917
        printf("*** %s(): \n",__PRETTY_FUNCTION__);
1851
1918
        on_combobox_cat_changed(combobox);
1852
1919
}
1853
1920
 
1874
1941
                                        gpointer         user_data)
1875
1942
{
1876
1943
        gboolean success = FALSE;
1877
 
 
1878
 
 
 
1944
        GError **error = NULL;          
 
1945
 
 
1946
        
1879
1947
        global_ffupdate_interval_minutes = atof(gtk_entry_get_text(GTK_ENTRY(editable)));
1880
1948
        global_ffupdate_interval = global_ffupdate_interval_minutes * 60000;
1881
 
 
 
1949
        
1882
1950
        if (global_ffupdate_interval < 30000)
1883
1951
                global_ffupdate_interval = 30000;
1884
1952
 
1888
1956
                        g_source_remove(friendfinder_timer);
1889
1957
                        friendfinder_timer = 0;
1890
1958
                }
1891
 
 
 
1959
                
1892
1960
                if(msg_timer) {
1893
1961
                        g_source_remove(msg_timer);
1894
1962
                        msg_timer = 0;
1895
1963
                }
1896
 
 
 
1964
                
1897
1965
                friendfinder_timer = g_timeout_add_seconds(global_ffupdate_interval/1000, update_position, NULL);
1898
1966
                msg_timer          = g_timeout_add_seconds(global_ffupdate_interval/1000, send_message, NULL);
1899
1967
        }
1900
 
 
1901
 
 
1902
 
        success = g_settings_set_double(
1903
 
                        global_settings,
1904
 
                        "ffupdate-interval-minutes",
1905
 
                        global_ffupdate_interval_minutes);
 
1968
        
 
1969
        
 
1970
        success = gconf_client_set_float(
 
1971
                        global_gconfclient, 
 
1972
                        GCONF"/ffupdate_interval_minutes",
 
1973
                        global_ffupdate_interval_minutes,
 
1974
                        error);
1906
1975
 
1907
1976
}
1908
1977
 
1912
1981
                                        gpointer         user_data)
1913
1982
{
1914
1983
        gboolean success = FALSE;
1915
 
 
 
1984
        GError **error = NULL;
 
1985
        
1916
1986
        global_speed_unit = (gtk_toggle_button_get_active(togglebutton)) ? 0 : global_speed_unit;
1917
1987
 
1918
 
        success = g_settings_set_int(
1919
 
                                global_settings,
1920
 
                                "speed-unit",
1921
 
                                global_speed_unit);
 
1988
        success = gconf_client_set_int(
 
1989
                                global_gconfclient, 
 
1990
                                GCONF"/speed_unit",
 
1991
                                global_speed_unit,
 
1992
                                error);
1922
1993
}
1923
1994
 
1924
1995
 
1927
1998
                                        gpointer         user_data)
1928
1999
{
1929
2000
        gboolean success = FALSE;
1930
 
 
 
2001
        GError **error = NULL;
 
2002
        
1931
2003
        global_speed_unit = (gtk_toggle_button_get_active(togglebutton)) ? 1 : global_speed_unit;
1932
 
 
1933
 
        success = g_settings_set_int(
1934
 
                                global_settings,
1935
 
                                "speed-unit",
1936
 
                                global_speed_unit);
 
2004
        
 
2005
        success = gconf_client_set_int(
 
2006
                                global_gconfclient, 
 
2007
                                GCONF"/speed_unit",
 
2008
                                global_speed_unit,
 
2009
                                error);
1937
2010
}
1938
2011
 
1939
2012
 
1942
2015
                                        gpointer         user_data)
1943
2016
{
1944
2017
        gboolean success = FALSE;
1945
 
 
 
2018
        GError **error = NULL;
 
2019
        
1946
2020
        global_speed_unit = (gtk_toggle_button_get_active(togglebutton)) ? 2 : global_speed_unit;
1947
 
 
1948
 
        success = g_settings_set_int(
1949
 
                                global_settings,
1950
 
                                "speed-unit",
1951
 
                                global_speed_unit);
 
2021
        
 
2022
        success = gconf_client_set_int(
 
2023
                                global_gconfclient, 
 
2024
                                GCONF"/speed_unit",
 
2025
                                global_speed_unit,
 
2026
                                error);
1952
2027
}
1953
2028
 
1954
2029
 
1957
2032
                                        gpointer         user_data)
1958
2033
{
1959
2034
        gboolean success = FALSE;
1960
 
 
 
2035
        GError **error = NULL;
 
2036
        
1961
2037
        global_alt_unit = (gtk_toggle_button_get_active(togglebutton)) ? 0 : global_alt_unit;
1962
 
 
1963
 
        success = g_settings_set_int(
1964
 
                                global_settings,
1965
 
                                "alt-unit",
1966
 
                                global_alt_unit);
 
2038
        
 
2039
        success = gconf_client_set_int(
 
2040
                                global_gconfclient, 
 
2041
                                GCONF"/alt_unit",
 
2042
                                global_alt_unit,
 
2043
                                error);
1967
2044
}
1968
2045
 
1969
2046
 
1972
2049
                                        gpointer         user_data)
1973
2050
{
1974
2051
        gboolean success = FALSE;
1975
 
 
 
2052
        GError **error = NULL;
 
2053
        
1976
2054
        global_alt_unit = (gtk_toggle_button_get_active(togglebutton)) ? 1 : global_alt_unit;
1977
2055
 
1978
 
        success = g_settings_set_int(
1979
 
                                global_settings,
1980
 
                                "alt-unit",
1981
 
                                global_alt_unit);
 
2056
        success = gconf_client_set_int(
 
2057
                                global_gconfclient, 
 
2058
                                GCONF"/alt_unit",
 
2059
                                global_alt_unit,
 
2060
                                error);
1982
2061
}
1983
2062
 
1984
2063
 
1987
2066
                                        gpointer         user_data)
1988
2067
{
1989
2068
        gboolean success = FALSE;
1990
 
 
 
2069
        GError **error = NULL;
 
2070
        
1991
2071
        global_latlon_unit = (gtk_toggle_button_get_active(togglebutton)) ? 0 : global_latlon_unit;
1992
 
 
1993
 
        success = g_settings_set_int(
1994
 
                                global_settings,
1995
 
                                "latlon-unit",
1996
 
                                global_latlon_unit);
 
2072
        
 
2073
        success = gconf_client_set_int(
 
2074
                                global_gconfclient, 
 
2075
                                GCONF"/latlon_unit",
 
2076
                                global_latlon_unit,
 
2077
                                error);
1997
2078
}
1998
2079
 
1999
2080
 
2002
2083
                                        gpointer         user_data)
2003
2084
{
2004
2085
        gboolean success = FALSE;
2005
 
 
 
2086
        GError **error = NULL;
 
2087
        
2006
2088
        global_latlon_unit = (gtk_toggle_button_get_active(togglebutton)) ? 1 : global_latlon_unit;
2007
2089
 
2008
 
        success = g_settings_set_int(
2009
 
                                global_settings,
2010
 
                                "latlon-unit",
2011
 
                                global_latlon_unit);
 
2090
        success = gconf_client_set_int(
 
2091
                                global_gconfclient, 
 
2092
                                GCONF"/latlon_unit",
 
2093
                                global_latlon_unit,
 
2094
                                error);
2012
2095
}
2013
2096
 
2014
2097
void
2016
2099
                                        gpointer         user_data)
2017
2100
{
2018
2101
        gboolean success = FALSE;
 
2102
        GError **error = NULL;
2019
2103
 
2020
2104
        global_latlon_unit = (gtk_toggle_button_get_active(togglebutton)) ? 2 : global_latlon_unit;
2021
 
 
2022
 
        success = g_settings_set_int(
2023
 
                                global_settings,
2024
 
                                "latlon-unit",
2025
 
                                global_latlon_unit);
 
2105
        
 
2106
        success = gconf_client_set_int(
 
2107
                                global_gconfclient, 
 
2108
                                GCONF"/latlon_unit",
 
2109
                                global_latlon_unit,
 
2110
                                error);
2026
2111
}
2027
2112
 
2028
2113
 
2050
2135
                                        GdkEvent        *event,
2051
2136
                                        gpointer         user_data)
2052
2137
{
2053
 
        gtk_widget_hide_on_delete       (widget);
 
2138
  gtk_widget_hide_on_delete       (widget);
2054
2139
        distance_mode = FALSE;
2055
2140
        set_cursor(GDK_HAND2);
2056
2141
        repaint_all();
2057
 
        return TRUE;
 
2142
  return TRUE;
2058
2143
}
2059
2144
 
2060
2145
void
2063
2148
{
2064
2149
        GtkWidget *window;
2065
2150
        waypoint_t *wp;
2066
 
 
 
2151
        
2067
2152
        wp = user_data;
2068
2153
        set_current_wp(wp->lat, wp->lon);
2069
 
 
 
2154
        
2070
2155
        window = lookup_widget(GTK_WIDGET(button), "window5");
2071
2156
        gtk_widget_destroy(window);
 
2157
        printf("hello, world, %f %f\n", wp->lat, wp->lon);
2072
2158
}
2073
2159
 
2074
2160
 
2078
2164
                                        GdkEvent        *event,
2079
2165
                                        gpointer         user_data)
2080
2166
{
2081
 
        gtk_widget_hide_on_delete       (widget);
2082
 
        return TRUE;
 
2167
  gtk_widget_hide_on_delete       (widget);
 
2168
  return TRUE;
2083
2169
}
2084
2170
 
2085
2171
void
2087
2173
                                        gpointer         user_data)
2088
2174
{
2089
2175
        gboolean active;
2090
 
 
 
2176
        
2091
2177
        active = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem));
2092
2178
        global_show_friends = (active) ? TRUE : FALSE;
2093
 
 
2094
 
 
 
2179
        
 
2180
        
2095
2181
        if(global_show_friends && !global_fftimer_running) {
2096
2182
                GtkWidget *widget = NULL;
2097
 
 
 
2183
                
2098
2184
                widget = lookup_widget(window1, "button11");
2099
2185
                gtk_button_clicked(GTK_BUTTON(widget));
2100
2186
        }
2107
2193
                                        gpointer         user_data)
2108
2194
{
2109
2195
        gboolean active;
2110
 
 
 
2196
        printf("*** %s(): \n",__PRETTY_FUNCTION__);
 
2197
        
2111
2198
        active = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem));
2112
2199
        global_show_pois = (active) ? TRUE : FALSE;
2113
2200
 
2114
2201
 
2115
 
 
 
2202
        
2116
2203
        repaint_all();
2117
2204
}
2118
2205
 
2123
2210
                                        gpointer         user_data)
2124
2211
{
2125
2212
        gboolean active;
2126
 
 
 
2213
        printf("*** %s(): \n",__PRETTY_FUNCTION__);
 
2214
        
2127
2215
        active = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem));
2128
2216
        global_show_photos = (active) ? TRUE : FALSE;
2129
2217
 
2130
2218
        if (active && photo_list == NULL)
2131
2219
                get_photos();
2132
 
 
 
2220
        
2133
2221
        repaint_all();
2134
2222
}
2135
2223
 
2137
2225
void
2138
2226
repaint_all()
2139
2227
{
2140
 
 
 
2228
        
2141
2229
 
2142
2230
 
2143
2231
        fill_tiles_pixel(global_x, global_y, global_zoom, FALSE);
2144
 
        paint_track();
 
2232
        print_track();
2145
2233
        paint_loaded_track();
2146
2234
        paint_friends();
2147
2235
        paint_photos();
2148
2236
        paint_pois();
2149
2237
        paint_wp();
2150
 
        paint_route();
2151
2238
        paint_myposition();
2152
 
 
 
2239
        
2153
2240
}
2154
2241
 
2155
2242
void
2158
2245
{
2159
2246
        GtkWidget *window;
2160
2247
        waypoint_t *wp;
2161
 
 
 
2248
        
2162
2249
        wp = user_data;
2163
2250
        set_current_wp(wp->lat, wp->lon);
2164
2251
 
2171
2258
                                        gpointer         user_data)
2172
2259
{
2173
2260
        GtkWidget *entry14, *entry15;
 
2261
 
2174
2262
        char buf[64];
2175
2263
 
 
2264
        printf("*** %s(): \n",__PRETTY_FUNCTION__);
 
2265
        
 
2266
        
2176
2267
        if(gpsdata && gpsdata->fix.latitude !=0)
2177
2268
        {
2178
2269
                entry14 = lookup_widget(GTK_WIDGET(button), "entry14");
2179
2270
                entry15 = lookup_widget(GTK_WIDGET(button), "entry15");
2180
 
 
 
2271
                
2181
2272
                g_sprintf(buf, "%f", gpsdata->fix.latitude);
2182
2273
                gtk_entry_set_text(GTK_ENTRY(entry14), buf);
2183
2274
                g_sprintf(buf, "%f", gpsdata->fix.longitude);
2184
2275
                gtk_entry_set_text(GTK_ENTRY(entry15), buf);
2185
2276
        }
2186
 
 
 
2277
        
2187
2278
}
2188
2279
 
2189
2280
void
2197
2288
        GtkWidget *window;
2198
2289
 
2199
2290
        poi_t *p;
2200
 
 
 
2291
        
2201
2292
        p = user_data;
2202
2293
        tbuffer = gtk_text_buffer_new(NULL);
2203
2294
        gtk_text_buffer_insert_at_cursor(tbuffer, "p->desc", -1);
2204
2295
        gtk_text_buffer_set_text(tbuffer, "p->desc", -1);
2205
 
 
2206
 
 
2207
 
 
2208
 
 
 
2296
        
 
2297
        
 
2298
        
 
2299
        
2209
2300
        gladexml = glade_xml_new (gladefile, "window10", GETTEXT_PACKAGE);
2210
2301
        glade_xml_signal_autoconnect (gladexml);
2211
2302
        window = glade_xml_get_widget (gladexml, "window10");
2212
2303
        g_signal_connect_swapped (window, "destroy",
2213
2304
                                  G_CALLBACK (g_object_unref), gladexml);
2214
2305
        gtk_widget_show(window);
2215
 
 
2216
 
 
2217
 
 
 
2306
        
 
2307
        
 
2308
        
2218
2309
        widget = lookup_widget(window, "entry17");
2219
2310
        gtk_entry_set_text(GTK_ENTRY(widget), g_strdup_printf("%f",p->lat_deg));
2220
 
 
 
2311
        
2221
2312
        widget = lookup_widget(window, "entry18");
2222
2313
        gtk_entry_set_text(GTK_ENTRY(widget), g_strdup_printf("%f",p->lon_deg));
2223
2314
 
2224
2315
        widget = lookup_widget(window, "entry19");
2225
2316
        gtk_entry_set_text(GTK_ENTRY(widget), p->keywords);
2226
 
 
 
2317
        
2227
2318
        widget = lookup_widget(window, "textview2");
2228
2319
        gtk_text_view_set_buffer(GTK_TEXT_VIEW(widget), tbuffer);
2229
2320
        gtk_text_buffer_set_text(tbuffer, p->desc, -1);
2230
2321
 
2231
2322
        widget = lookup_widget(window, "label126");
2232
 
 
 
2323
        
2233
2324
        if (p->idmd5==NULL)
2234
 
                gtk_label_set_label (GTK_LABEL(widget),
2235
 
                                     _("<span foreground='#ff0000'>"
2236
 
                                       "POI has no ID -> see website for help!"
2237
 
                                       "</span>"));
 
2325
                gtk_label_set_label(GTK_LABEL(widget), "<span foreground='#ff0000'>POI has no ID -> see website for help!</span>");
2238
2326
        else
2239
2327
                gtk_label_set_text(GTK_LABEL(widget), p->idmd5);
2240
2328
 
2241
 
 
 
2329
        
2242
2330
        widget = lookup_widget(GTK_WIDGET(button), "window5");
2243
2331
        gtk_widget_destroy(widget);
2244
2332
}
2262
2350
        GtkWidget *widget;
2263
2351
        widget = lookup_widget(GTK_WIDGET(button), "window10");
2264
2352
        update_poi(widget);
2265
 
 
2266
 
 
2267
 
 
2268
 
 
 
2353
        
 
2354
        
 
2355
 
 
2356
        
2269
2357
        repaint_all();
2270
2358
}
2271
2359
 
2274
2362
                                        gpointer         user_data)
2275
2363
{
2276
2364
        GtkWidget *entry17, *entry18;
 
2365
 
2277
2366
        char buf[64];
2278
2367
 
 
2368
        printf("*** %s(): \n",__PRETTY_FUNCTION__);
 
2369
        
 
2370
        
2279
2371
        if(gpsdata && gpsdata->fix.latitude !=0)
2280
2372
        {
2281
2373
                entry17 = lookup_widget(GTK_WIDGET(button), "entry17");
2282
2374
                entry18 = lookup_widget(GTK_WIDGET(button), "entry18");
2283
 
 
 
2375
                
2284
2376
                g_sprintf(buf, "%f", gpsdata->fix.latitude);
2285
2377
                gtk_entry_set_text(GTK_ENTRY(entry17), buf);
2286
2378
                g_sprintf(buf, "%f", gpsdata->fix.longitude);
2287
2379
                gtk_entry_set_text(GTK_ENTRY(entry18), buf);
2288
2380
        }
2289
 
 
 
2381
        
2290
2382
}
2291
2383
 
2292
2384
gboolean
2294
2386
                                        GdkEventKey     *event,
2295
2387
                                        gpointer         user_data)
2296
2388
{
2297
 
        if (event->keyval == GDK_Page_Up || event->keyval == GDK_KP_Up || event->keyval == GDK_i)
 
2389
        if (event->keyval == GDK_Page_Up || event->keyval == GDK_KP_Up || event->keyval == 'i')
2298
2390
                on_button4_clicked(NULL, NULL);
2299
 
        else if ((event->state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK && event->keyval == GDK_p)
 
2391
        else if ((event->state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK && event->keyval == 'p')
2300
2392
                geo_photos_open_dialog_photo_correlate();
2301
 
        else if ((event->state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK && event->keyval == GDK_t)
 
2393
        else if ((event->state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK && event->keyval == 't')
2302
2394
                tracks_open_tracks_dialog();
2303
 
        else if(event->keyval == GDK_Page_Down || event->keyval == GDK_o)
 
2395
        else if(event->keyval == GDK_Page_Down || event->keyval == 'o')
2304
2396
                on_button5_clicked(NULL, NULL);
2305
 
        else if(event->keyval == GDK_m)
 
2397
        else if(event->keyval == 'm')
2306
2398
                on_button76_clicked(NULL, NULL);
2307
2399
        else if(event->keyval == GDK_space || event->keyval == GDK_F11)
2308
 
        {
2309
 
                maximized = !maximized;
2310
 
                gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(lookup_widget(window1, "button1")), maximized);
2311
 
                gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(lookup_widget(window1, "button53")), maximized);
2312
 
        }
 
2400
                on_button1_clicked(GTK_BUTTON(lookup_widget(window1, "button1")), NULL);
2313
2401
        else if(event->keyval == GDK_Right)
2314
2402
                move_map(1);
2315
2403
        else if(event->keyval == GDK_Down)
2319
2407
        else if(event->keyval == GDK_Up)
2320
2408
                move_map(4);
2321
2409
        else if(event->keyval == GDK_a)
2322
 
        {
2323
 
                global_autocenter = !global_autocenter;
2324
 
                GtkToggleToolButton *autocenter_toggle;
2325
 
 
2326
 
                autocenter_toggle =
2327
 
                        GTK_TOGGLE_TOOL_BUTTON(lookup_widget(window1,
2328
 
                                                             "button3"));
2329
 
                gtk_toggle_tool_button_set_active(autocenter_toggle,
2330
 
                                                  global_autocenter);
2331
 
 
2332
 
                autocenter_toggle =
2333
 
                        GTK_TOGGLE_TOOL_BUTTON(lookup_widget(window1,
2334
 
                                                             "button56"));
2335
 
                gtk_toggle_tool_button_set_active(autocenter_toggle,
2336
 
                                                  global_autocenter);
2337
 
        }
 
2410
                on_button3_clicked(GTK_BUTTON(lookup_widget(window1,"button3")), NULL);
2338
2411
        else if(event->keyval == GDK_r)
2339
2412
                on_item23_button_release_event(NULL, NULL, NULL);
2340
2413
        else if(event->keyval == GDK_1)
2405
2478
        GtkWidget *widget, *widget2;
2406
2479
        poi_t *p;
2407
2480
 
 
2481
        printf("*** %s(): \n",__PRETTY_FUNCTION__);
 
2482
        
2408
2483
        p = user_data;
2409
2484
        gladexml = glade_xml_new (gladefile,
2410
2485
                                  "dialog7",
2414
2489
        g_signal_connect_swapped (widget, "destroy",
2415
2490
                                  G_CALLBACK (g_object_unref), gladexml);
2416
2491
        gtk_widget_show(widget);
2417
 
 
 
2492
        
2418
2493
        widget2 = lookup_widget(widget, "okbutton6");
2419
2494
        g_signal_connect (      (gpointer) widget2, "clicked",
2420
2495
                                G_CALLBACK (on_okbutton6_clicked),
2427
2502
                                        GdkEvent        *event,
2428
2503
                                        gpointer         user_data)
2429
2504
{
 
2505
        printf("*** %s(): \n",__PRETTY_FUNCTION__);
 
2506
 
2430
2507
        return FALSE;
2431
2508
}
2432
2509
 
2436
2513
                                        gpointer         user_data)
2437
2514
{
2438
2515
        GtkWidget *widget;
2439
 
 
 
2516
        
 
2517
        printf("*** %s(): \n",__PRETTY_FUNCTION__);
 
2518
        
2440
2519
        widget = lookup_widget(GTK_WIDGET(button), "dialog7");
2441
2520
        gtk_widget_destroy(widget);
2442
2521
}
2448
2527
{
2449
2528
        GtkWidget *widget;
2450
2529
        poi_t *p;
2451
 
 
 
2530
        
 
2531
        printf("*** %s(): \n",__PRETTY_FUNCTION__);
 
2532
        
2452
2533
        p = user_data;
2453
 
 
2454
 
        gtk_widget_destroy(p->widget);
 
2534
        
 
2535
        gtk_widget_destroy(p->widget); 
2455
2536
        delete_poi(p);
2456
 
 
 
2537
        
2457
2538
        widget = lookup_widget(GTK_WIDGET(button), "dialog7");
2458
2539
        gtk_widget_destroy(widget);
2459
2540
}
2464
2545
{
2465
2546
        GtkWidget *widget;
2466
2547
        widget = lookup_widget(window1, "vbox48");
2467
 
 
 
2548
        
2468
2549
        if(msg_pane_visible)
2469
 
        {
 
2550
        {       
2470
2551
                gtk_widget_hide(widget);
2471
2552
                msg_pane_visible = FALSE;
2472
 
                gtk_button_set_label (button, _("Show Messages"));
 
2553
                gtk_button_set_label(button, "Show Messages");
2473
2554
        }
2474
2555
        else
2475
2556
        {
2476
2557
                gtk_widget_show(widget);
2477
2558
                msg_pane_visible = TRUE;
2478
 
                gtk_button_set_label (button, _("Hide Messages"));
 
2559
                gtk_button_set_label(button, "Hide Messages");
2479
2560
        }
2480
2561
}
2481
2562
 
2485
2566
{
2486
2567
        GtkWidget *widget;
2487
2568
        const char *entry;
2488
 
 
 
2569
        
2489
2570
        widget = lookup_widget(window1, "entry3");
2490
2571
        entry = gtk_entry_get_text(GTK_ENTRY(widget));
2491
 
 
2492
 
        g_settings_set_string(  global_settings,
2493
 
                                        "gpsd-host",
2494
 
                                        entry);
 
2572
        
 
2573
        gconf_client_set_string(        global_gconfclient, 
 
2574
                                        GCONF"/gpsd_host",
 
2575
                                        entry,
 
2576
                                        NULL);
2495
2577
}
2496
2578
 
2497
2579
 
2501
2583
{
2502
2584
        GtkWidget *widget;
2503
2585
        const char *entry;
2504
 
 
 
2586
        
2505
2587
        widget = lookup_widget(window1, "entry4");
2506
2588
        entry = gtk_entry_get_text(GTK_ENTRY(widget));
2507
 
 
2508
 
        g_settings_set_string(  global_settings,
2509
 
                                        "gpsd-port",
2510
 
                                        entry);
 
2589
        
 
2590
        gconf_client_set_string(        global_gconfclient, 
 
2591
                                        GCONF"/gpsd_port",
 
2592
                                        entry,
 
2593
                                        NULL);
2511
2594
}
2512
2595
 
2513
2596
void
2523
2606
                                        gpointer         user_data)
2524
2607
{
2525
2608
        GtkWidget *window, *vbox;
 
2609
        printf("*** %s(): \n",__PRETTY_FUNCTION__);
2526
2610
 
2527
2611
        window = lookup_widget(widget, "window12");
2528
2612
        gtk_widget_hide(window);
2529
2613
 
2530
 
        vbox = lookup_widget(window, "vbox39");
 
2614
        vbox = lookup_widget(window, "vbox39");         
2531
2615
        gtk_container_foreach (GTK_CONTAINER (vbox),
2532
2616
                               (GtkCallback) gtk_widget_destroy,
2533
2617
                               NULL);
2540
2624
                                        gpointer         user_data)
2541
2625
{
2542
2626
        GtkWidget *widget, *vbox;
 
2627
        printf("*** %s(): \n",__PRETTY_FUNCTION__);
2543
2628
 
2544
2629
        widget = lookup_widget(GTK_WIDGET(button), "window12");
2545
2630
        gtk_widget_hide(widget);
2546
2631
 
2547
 
        vbox = lookup_widget(widget, "vbox39");
 
2632
        vbox = lookup_widget(widget, "vbox39");         
2548
2633
        gtk_container_foreach (GTK_CONTAINER (vbox),
2549
2634
                               (GtkCallback) gtk_widget_destroy,
2550
2635
                               NULL);
2559
2644
        GtkWidget       *entry_dir;
2560
2645
        GtkWidget       *togglebutton;
2561
2646
        repo_t          *repo;
2562
 
 
 
2647
                
2563
2648
        dialog8 = glade_xml_get_widget (gladexml, "dialog8");
2564
 
 
 
2649
                
2565
2650
        entry_repo = lookup_widget(dialog8, "entry24");
2566
2651
        entry_uri = lookup_widget(dialog8, "entry25");
2567
2652
        entry_dir = lookup_widget(dialog8, "entry26");
2574
2659
        gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(togglebutton), repo->inverted_zoom);
2575
2660
 
2576
2661
 
2577
 
 
 
2662
        
2578
2663
        gtk_widget_show(dialog8);
2579
2664
}
2580
2665
 
2586
2671
        GtkWidget       *widget;
2587
2672
 
2588
2673
        widget = lookup_widget(GTK_WIDGET(button), "dialog8");
2589
 
 
 
2674
        
2590
2675
        gtk_widget_hide(dialog8);
2591
2676
}
2592
2677
 
2603
2688
        const gchar     *reponame, *uri, *dir;
2604
2689
        gboolean        reversed;
2605
2690
        repo_t          *repo;
2606
 
 
 
2691
        
2607
2692
        repo = global_curr_repo->data;
2608
 
 
 
2693
        
2609
2694
        entry_repo = lookup_widget(dialog8, "entry24");
2610
2695
        entry_uri = lookup_widget(dialog8, "entry25");
2611
2696
        entry_dir = lookup_widget(dialog8, "entry26");
2616
2701
        uri = gtk_entry_get_text(GTK_ENTRY(entry_uri));
2617
2702
        dir = gtk_entry_get_text(GTK_ENTRY(entry_dir));
2618
2703
        reversed = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(togglebutton));
2619
 
 
 
2704
        
2620
2705
        repo->name = g_strdup(reponame);
2621
2706
        repo->dir = g_strdup(dir);
2622
2707
        repo->uri = g_strdup(uri);
2623
2708
        repo->inverted_zoom = reversed;
2624
 
 
 
2709
        
2625
2710
        global_curr_reponame = g_strdup(reponame);
2626
 
 
 
2711
        
2627
2712
        gtk_combo_box_remove_text(combobox, gtk_combo_box_get_active(combobox));
2628
2713
        gtk_combo_box_prepend_text (combobox, g_strdup(repo->name));
2629
2714
        gtk_combo_box_set_active(combobox, 0);
2630
2715
 
2631
 
        settings_set_repolist();
 
2716
        printf("*** %s(): new repo: %s %s\n",__PRETTY_FUNCTION__, repo->name, global_curr_reponame);
 
2717
        gconf_set_repolist();
2632
2718
 
2633
2719
        gtk_widget_hide(dialog8);
2634
2720
 
2641
2727
        GtkWidget       *widget;
2642
2728
        const char      *txt1, *txt2, *txt3;
2643
2729
 
2644
 
 
 
2730
        
2645
2731
        widget = lookup_widget(GTK_WIDGET(editable), "entry5");
2646
2732
        txt1 = gtk_entry_get_text(GTK_ENTRY(widget));
2647
2733
        widget = lookup_widget(GTK_WIDGET(editable), "entry20");
2649
2735
        widget = lookup_widget(GTK_WIDGET(editable), "entry21");
2650
2736
        txt3 = gtk_entry_get_text(GTK_ENTRY(widget));
2651
2737
 
2652
 
 
 
2738
        
2653
2739
        widget = lookup_widget(GTK_WIDGET(editable), "okbutton1");
2654
 
 
 
2740
        
2655
2741
        if(strlen(txt1) && strlen(txt2) && strlen(txt3))
2656
2742
                gtk_widget_set_sensitive (widget, TRUE);
2657
2743
        else
2658
2744
                gtk_widget_set_sensitive (widget, FALSE);
2659
 
 
 
2745
        
2660
2746
}
2661
2747
 
2662
2748
 
2667
2753
        GtkWidget       *widget;
2668
2754
        const char      *txt1, *txt2, *txt3;
2669
2755
 
2670
 
 
 
2756
        
2671
2757
        widget = lookup_widget(GTK_WIDGET(editable), "entry5");
2672
2758
        txt1 = gtk_entry_get_text(GTK_ENTRY(widget));
2673
2759
        widget = lookup_widget(GTK_WIDGET(editable), "entry20");
2675
2761
        widget = lookup_widget(GTK_WIDGET(editable), "entry21");
2676
2762
        txt3 = gtk_entry_get_text(GTK_ENTRY(widget));
2677
2763
 
2678
 
 
 
2764
        
2679
2765
        widget = lookup_widget(GTK_WIDGET(editable), "okbutton1");
2680
 
 
 
2766
        
2681
2767
        if(strlen(txt1) && strlen(txt2) && strlen(txt3))
2682
2768
                gtk_widget_set_sensitive (widget, TRUE);
2683
2769
        else
2684
2770
                gtk_widget_set_sensitive (widget, FALSE);
2685
 
 
 
2771
        
2686
2772
}
2687
2773
 
2688
2774
 
2694
2780
        const char      *txt1, *txt2, *txt3;
2695
2781
        const gchar     *dir;
2696
2782
        int result;
2697
 
 
 
2783
        
2698
2784
        dir = gtk_entry_get_text(GTK_ENTRY(editable));
2699
2785
 
2700
2786
        result = strncmp(dir, "~", 1);
2702
2788
                gtk_entry_set_text(GTK_ENTRY(editable), g_strdup(getenv("HOME")));
2703
2789
 
2704
2790
 
2705
 
 
 
2791
        
2706
2792
        widget = lookup_widget(GTK_WIDGET(editable), "entry5");
2707
2793
        txt1 = gtk_entry_get_text(GTK_ENTRY(widget));
2708
2794
        widget = lookup_widget(GTK_WIDGET(editable), "entry20");
2710
2796
        widget = lookup_widget(GTK_WIDGET(editable), "entry21");
2711
2797
        txt3 = gtk_entry_get_text(GTK_ENTRY(widget));
2712
2798
 
 
2799
        printf("strlen: %d \n", (int)strlen(txt1));
 
2800
        
2713
2801
        widget = lookup_widget(GTK_WIDGET(editable), "okbutton1");
2714
 
 
 
2802
        
2715
2803
        if(strlen(txt1) && strlen(txt2) && strlen(txt3))
2716
2804
                gtk_widget_set_sensitive (widget, TRUE);
2717
2805
        else
2718
2806
                gtk_widget_set_sensitive (widget, FALSE);
2719
 
 
 
2807
        
2720
2808
}
2721
2809
 
2722
2810
 
2735
2823
        GtkWidget       *widget;
2736
2824
        const char      *txt1, *txt2, *txt3;
2737
2825
 
2738
 
 
 
2826
        
2739
2827
        widget = lookup_widget(GTK_WIDGET(editable), "entry24");
2740
2828
        txt1 = gtk_entry_get_text(GTK_ENTRY(widget));
2741
2829
        widget = lookup_widget(GTK_WIDGET(editable), "entry25");
2743
2831
        widget = lookup_widget(GTK_WIDGET(editable), "entry26");
2744
2832
        txt3 = gtk_entry_get_text(GTK_ENTRY(widget));
2745
2833
 
2746
 
 
 
2834
        
2747
2835
        widget = lookup_widget(GTK_WIDGET(editable), "okbutton7");
2748
 
 
 
2836
        
2749
2837
        if(strlen(txt1) && strlen(txt2) && strlen(txt3))
2750
2838
                gtk_widget_set_sensitive (widget, TRUE);
2751
2839
        else
2752
2840
                gtk_widget_set_sensitive (widget, FALSE);
2753
 
 
 
2841
        
2754
2842
}
2755
2843
 
2756
2844
 
2761
2849
        GtkWidget       *widget;
2762
2850
        const char      *txt1, *txt2, *txt3;
2763
2851
 
2764
 
 
 
2852
        
2765
2853
        widget = lookup_widget(GTK_WIDGET(editable), "entry24");
2766
2854
        txt1 = gtk_entry_get_text(GTK_ENTRY(widget));
2767
2855
        widget = lookup_widget(GTK_WIDGET(editable), "entry25");
2769
2857
        widget = lookup_widget(GTK_WIDGET(editable), "entry26");
2770
2858
        txt3 = gtk_entry_get_text(GTK_ENTRY(widget));
2771
2859
 
2772
 
 
 
2860
        
2773
2861
        widget = lookup_widget(GTK_WIDGET(editable), "okbutton7");
2774
 
 
 
2862
        
2775
2863
        if(strlen(txt1) && strlen(txt2) && strlen(txt3))
2776
2864
                gtk_widget_set_sensitive (widget, TRUE);
2777
2865
        else
2778
2866
                gtk_widget_set_sensitive (widget, FALSE);
2779
 
 
 
2867
        
2780
2868
}
2781
2869
 
2782
2870
 
2788
2876
        const char      *txt1, *txt2, *txt3;
2789
2877
        const gchar     *dir;
2790
2878
        int result;
2791
 
 
 
2879
        
2792
2880
        dir = gtk_entry_get_text(GTK_ENTRY(editable));
2793
2881
 
2794
2882
        result = strncmp(dir, "~", 1);
2796
2884
                gtk_entry_set_text(GTK_ENTRY(editable), g_strdup(getenv("HOME")));
2797
2885
 
2798
2886
 
2799
 
 
 
2887
        
2800
2888
        widget = lookup_widget(GTK_WIDGET(editable), "entry24");
2801
2889
        txt1 = gtk_entry_get_text(GTK_ENTRY(widget));
2802
2890
        widget = lookup_widget(GTK_WIDGET(editable), "entry25");
2804
2892
        widget = lookup_widget(GTK_WIDGET(editable), "entry26");
2805
2893
        txt3 = gtk_entry_get_text(GTK_ENTRY(widget));
2806
2894
 
 
2895
        printf("strlen: %d \n", (int)strlen(txt1));
 
2896
        
2807
2897
        widget = lookup_widget(GTK_WIDGET(editable), "okbutton7");
2808
 
 
 
2898
        
2809
2899
        if(strlen(txt1) && strlen(txt2) && strlen(txt3))
2810
2900
                gtk_widget_set_sensitive (widget, TRUE);
2811
2901
        else
2812
2902
                gtk_widget_set_sensitive (widget, FALSE);
2813
 
 
 
2903
        
2814
2904
}
2815
2905
 
2816
2906
 
2825
2915
on_entry21_activate                    (GtkEntry        *entry,
2826
2916
                                        gpointer         user_data)
2827
2917
{
 
2918
        printf("%s(): \n",__PRETTY_FUNCTION__);
2828
2919
}
2829
2920
 
2830
2921
gboolean
2832
2923
                                        GdkEventButton  *event,
2833
2924
                                        gpointer         user_data)
2834
2925
{
 
2926
        printf("%s(): \n",__PRETTY_FUNCTION__);
 
2927
        
2835
2928
        GtkWidget       *window;
2836
 
 
 
2929
        
2837
2930
        window = lookup_widget(widget, "drawingarea2");
2838
2931
 
2839
 
 
2840
 
 
 
2932
        
 
2933
                
2841
2934
        gdk_draw_rectangle (
2842
2935
                pixmap_photo,
2843
2936
                widget->style->white_gc,
2845
2938
                0, 0,
2846
2939
                widget->allocation.width,
2847
2940
                widget->allocation.height);
2848
 
 
 
2941
                                        
2849
2942
        gtk_widget_queue_draw_area (
2850
 
                widget,
 
2943
                widget, 
2851
2944
                0,0,widget->allocation.width,widget->allocation.height);
2852
 
 
 
2945
        
2853
2946
        gtk_widget_hide(window3);
2854
 
 
 
2947
        
2855
2948
        return FALSE;
2856
2949
}
2857
2950
 
2861
2954
                                        gpointer         user_data)
2862
2955
{
2863
2956
        GtkWidget *window;
2864
 
 
 
2957
        
2865
2958
        window = lookup_widget(widget, "win13_biggeo");
2866
 
 
 
2959
        
2867
2960
        gtk_widget_destroy(window);
2868
 
 
2869
 
        return FALSE;
 
2961
        
 
2962
  return FALSE;
2870
2963
}
2871
2964
 
2872
2965
gboolean
2874
2967
                                        GdkEventConfigure *event,
2875
2968
                                        gpointer         user_data)
2876
2969
{
 
2970
        printf("*** %s(): \n",__PRETTY_FUNCTION__);
 
2971
        
 
2972
 
 
2973
        
2877
2974
        if (!pixmap_photo_big)
2878
2975
        pixmap_photo = gdk_pixmap_new (
2879
2976
                        widget->window,
2881
2978
                        widget->allocation.height,
2882
2979
                        -1);
2883
2980
 
2884
 
        if (!pixmap_photo_big)
2885
 
        {
 
2981
        if(pixmap_photo_big)
 
2982
                printf("pixmap_photo NOT NULL");
 
2983
        else
2886
2984
                printf("aieee: pixmap_photo NULL\n");
2887
 
        }
2888
2985
 
 
2986
        
 
2987
        
 
2988
        
 
2989
        
 
2990
        
 
2991
        
2889
2992
        return FALSE;
2890
2993
}
2891
2994
 
2895
2998
                                        GdkEventExpose  *event,
2896
2999
                                        gpointer         user_data)
2897
3000
{
 
3001
        printf("** D2: expose event\n");
 
3002
        
2898
3003
        gdk_draw_drawable (
2899
3004
                widget->window,
2900
3005
                widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
2902
3007
                event->area.x, event->area.y,
2903
3008
                event->area.x, event->area.y,
2904
3009
                event->area.width, event->area.height);
2905
 
 
2906
 
 
 
3010
        
 
3011
        
2907
3012
        return FALSE;
2908
3013
}
2909
3014
 
2916
3021
        return FALSE;
2917
3022
}
2918
3023
 
2919
 
gboolean
2920
 
on_itemgeocode1_expose_event (GtkWidget *widget, GdkEvent *event, gpointer user_data)
2921
 
{
2922
 
        if (system ("command -v gpscorrelate > /dev/null") != 0) {
2923
 
                gtk_widget_set_sensitive (widget, FALSE);
2924
 
                gtk_widget_set_tooltip_text
2925
 
                        (widget, _("gpscorrelate is necessary for this feature "
2926
 
                                   "but does not appear to be installed."));
2927
 
        } else {
2928
 
                gtk_widget_set_sensitive (widget, TRUE);
2929
 
                gtk_widget_set_tooltip_text (widget, NULL);
2930
 
        }
2931
 
 
2932
 
        return FALSE;
2933
 
}
2934
 
 
2935
 
 
2936
3024
 
2937
3025
void
2938
3026
on_button39_clicked                    (GtkButton       *button,
3011
3099
on_okbutton9_clicked                   (GtkButton       *button,
3012
3100
                                        gpointer         user_data)
3013
3101
{
 
3102
        printf("%s \n", __PRETTY_FUNCTION__);
3014
3103
        geo_photo_close_dialog_image_data();
3015
3104
}
3016
3105
 
3028
3117
                                        GdkEventButton  *event,
3029
3118
                                        gpointer         user_data)
3030
3119
{
3031
 
 
3032
 
 
3033
 
        return FALSE;
3034
 
}
3035
 
 
3036
 
int
3037
 
on_checkbutton14_expose_event (GtkWidget *togglebutton, gpointer user_data)
3038
 
{
3039
 
        if (system ("command -v jhead > /dev/null") != 0) {
3040
 
                gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (togglebutton), FALSE);
3041
 
                gtk_widget_set_sensitive (togglebutton, FALSE);
3042
 
                gtk_widget_set_tooltip_text
3043
 
                        (togglebutton, _("jhead is necessary for this feature "
3044
 
                                         "but does not appear to be installed."));
3045
 
        } else {
3046
 
                gtk_widget_set_sensitive (togglebutton, TRUE);
3047
 
                gtk_widget_set_tooltip_text (togglebutton, NULL);
3048
 
        }
3049
 
 
 
3120
        
 
3121
        
3050
3122
        return FALSE;
3051
3123
}
3052
3124
 
3081
3153
                                        GdkEvent        *event,
3082
3154
                                        gpointer         user_data)
3083
3155
{
 
3156
printf("I am deleted\n");
3084
3157
        geo_photo_close_dialog_image_data();
3085
3158
 
3086
 
        return TRUE;
 
3159
  return TRUE;
3087
3160
}
3088
3161
 
3089
3162
gboolean
3097
3170
        distance_mode = FALSE;
3098
3171
        set_cursor(GDK_HAND2);
3099
3172
        repaint_all();
3100
 
 
 
3173
        
3101
3174
        return FALSE;
3102
3175
}
3103
3176
 
3114
3187
                                        gpointer         user_data)
3115
3188
{
3116
3189
        GtkWidget *window = lookup_widget(GTK_WIDGET(button), "dialog_image_data");
3117
 
        geo_photo_dialog_image_data_next(window, user_data, GEOPHOTO_FULLSIZE);
 
3190
        geo_photo_dialog_image_data_next(window, user_data, GEOPHOTO_FULLSIZE); 
3118
3191
        gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE);
3119
3192
}
3120
3193
 
3122
3195
on_closebutton2_clicked                (GtkButton       *button,
3123
3196
                                        gpointer         user_data)
3124
3197
{
3125
 
        GtkWidget *widget = lookup_widget(GTK_WIDGET(button), "dialog_geocode_result");
 
3198
        GtkWidget *widget = lookup_widget(GTK_WIDGET(button), "dialog_geocode_result"); 
3126
3199
        gtk_widget_hide(widget);
3127
3200
}
3128
3201
 
3155
3228
                                        gpointer         user_data)
3156
3229
{
3157
3230
        set_cursor(GDK_CROSSHAIR);
3158
 
 
 
3231
        
3159
3232
        distance_mode = TRUE;
3160
3233
}
3161
3234
 
3170
3243
void
3171
3244
do_distance()
3172
3245
{
 
3246
        printf("distance_mode\n");
3173
3247
        on_item4_activate(NULL, NULL);
3174
3248
}
3175
3249
 
3179
3253
                                        gpointer         user_data)
3180
3254
{
3181
3255
        float lat, lon;
3182
 
 
 
3256
        
 
3257
        
 
3258
        printf("screen x,y: %d %d \n",mouse_x, mouse_y);
3183
3259
        lat = pixel2lat(global_zoom, global_y+mouse_y);
3184
3260
        lon = pixel2lon(global_zoom, global_x+mouse_x);
3185
 
 
 
3261
        
3186
3262
        set_current_wp(lat, lon);
3187
 
        return FALSE;
3188
 
}
3189
 
 
3190
 
gboolean
3191
 
on_add_wp_button_release_event (GtkWidget *widget,
3192
 
                                GdkEventButton *event,
3193
 
                                gpointer user_data)
3194
 
{
3195
 
        float lat, lon;
3196
 
 
3197
 
        lat = pixel2lat (global_zoom, global_y+mouse_y);
3198
 
        lon = pixel2lon (global_zoom, global_x+mouse_x);
3199
 
 
3200
 
        append_waypoint_to_route (lat, lon);
3201
 
        repaint_all ();
3202
 
 
3203
 
        return FALSE;
3204
 
}
3205
 
 
3206
 
gboolean
3207
 
on_clear_route_button_release_event (GtkWidget *widget,
3208
 
                                     GdkEventButton *event,
3209
 
                                     gpointer user_data)
3210
 
{
3211
 
        reset_route ();
3212
 
        repaint_all ();
3213
 
        return FALSE;
3214
 
}
3215
 
 
3216
 
gboolean
3217
 
on_save_route_gpx_button_release_event (GtkWidget *widget,
3218
 
                                        GdkEventButton *event,
3219
 
                                        gpointer user_data)
3220
 
{
3221
 
        char *filename;
3222
 
 
3223
 
        filename = choose_save_file ("Unnamed.gpx");
3224
 
        save_route_as_gpx (filename);
3225
 
        g_free (filename);
3226
 
        return FALSE;
3227
 
}
3228
 
 
3229
 
gboolean
3230
 
on_load_route_button_release_event (GtkWidget *widget,
3231
 
                                    GdkEventButton *event,
3232
 
                                    gpointer user_data)
3233
 
{
3234
 
        char *filename;
3235
 
 
3236
 
        filename = choose_load_file ();
3237
 
        load_route (filename);
3238
 
        repaint_all ();
3239
 
        g_free (filename);
3240
 
        return FALSE;
3241
 
}
3242
 
 
3243
 
gboolean
3244
 
on_save_route_tomtom_button_release_event (GtkWidget *widget,
3245
 
                                           GdkEventButton *event,
3246
 
                                           gpointer user_data)
3247
 
{
3248
 
        char *filename;
3249
 
 
3250
 
        filename = choose_save_file ("Unnamed.itn");
3251
 
        save_route_as_tomtom_itn (filename);
3252
 
        g_free (filename);
3253
 
        return FALSE;
 
3263
  return FALSE;
3254
3264
}
3255
3265
 
3256
3266
 
3259
3269
                                        GdkEventButton  *event,
3260
3270
                                        gpointer         user_data)
3261
3271
{
 
3272
        printf("*** %s(): \n",__PRETTY_FUNCTION__);
3262
3273
        global_wp_on = FALSE;
3263
3274
        repaint_all();
3264
 
        return FALSE;
 
3275
  return FALSE;
3265
3276
}
3266
3277
 
3267
3278
 
3272
3283
                                        gpointer         user_data)
3273
3284
{
3274
3285
        GtkWidget *combobox;
3275
 
 
 
3286
        
3276
3287
        combobox = lookup_widget(window1, "combobox1");
3277
3288
 
3278
3289
        if(global_repo_cnt-1 > global_repo_nr)
3279
3290
                gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), global_repo_nr+1);
3280
3291
        else
3281
3292
                gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), 0);
3282
 
 
 
3293
                
3283
3294
}
3284
3295
 
3285
3296
 
3288
3299
                                        gpointer         user_data)
3289
3300
{
3290
3301
        GtkWidget *combobox;
3291
 
 
 
3302
        
3292
3303
        combobox = lookup_widget(window1, "combobox1");
3293
3304
 
3294
3305
        if (global_repo_nr > 0)
3304
3315
                                        gpointer         user_data)
3305
3316
{
3306
3317
        GtkWidget *widget;
 
3318
        printf("* %s()\n",__PRETTY_FUNCTION__);
3307
3319
 
3308
3320
        widget = lookup_widget(GTK_WIDGET(entry), "okbutton10");
3309
3321
        gtk_button_clicked(GTK_BUTTON(widget));
3315
3327
                                        gpointer         user_data)
3316
3328
{
3317
3329
        GtkWidget *widget;
3318
 
 
 
3330
                        
3319
3331
        widget = lookup_widget(GTK_WIDGET(button), "dialog9");
3320
3332
        gtk_widget_destroy(widget);
3321
3333
}
3325
3337
                                        GdkEventButton  *event,
3326
3338
                                        gpointer         user_data)
3327
3339
{
3328
 
        if(global_new_msg)
 
3340
        printf("* %s()\n",__PRETTY_FUNCTION__);
 
3341
        if(global_new_msg) 
3329
3342
        {
3330
3343
                GtkWidget *widget;
3331
 
 
 
3344
                
3332
3345
                if(!global_infopane_visible)
3333
3346
                {
3334
3347
                        widget = lookup_widget(window1, "button76");
3335
 
                        g_signal_emit_by_name (widget, "clicked");
 
3348
                        gtk_button_clicked(GTK_BUTTON(widget));
3336
3349
                }
3337
 
 
 
3350
                
3338
3351
                gtk_widget_hide(global_infopane_current->data);
3339
 
 
 
3352
        
3340
3353
                gtk_widget_show(g_list_nth_data(global_infopane_widgets, FRIENDS_PAGE));
3341
3354
                global_infopane_current = g_list_nth(global_infopane_widgets, FRIENDS_PAGE);
3342
 
 
 
3355
                
3343
3356
                widget = lookup_widget(window1, "button35");
3344
 
 
 
3357
                
3345
3358
                if(!msg_pane_visible)
3346
3359
                        gtk_button_clicked(GTK_BUTTON(widget));
3347
 
 
 
3360
                
3348
3361
                global_new_msg = FALSE;
3349
3362
        }
3350
3363
        return FALSE;
3357
3370
                                        gpointer         user_data)
3358
3371
{
3359
3372
        GtkWidget *label, *button, *entry, *cbox;
3360
 
 
 
3373
        
3361
3374
        if (!dialog10)
3362
3375
                dialog10 = glade_xml_get_widget (gladexml, "dialog10");
3363
3376
 
3364
3377
        gtk_widget_show(dialog10);
3365
 
 
 
3378
        
3366
3379
        label = lookup_widget(dialog10, "label190");
3367
3380
        gtk_label_set_label(GTK_LABEL(label),"");
3368
3381
 
3369
3382
        entry = lookup_widget(dialog10, "entry31");
3370
3383
        gtk_entry_set_text(GTK_ENTRY(entry),"");
3371
3384
        entry = lookup_widget(dialog10, "entry32");
3372
 
        gtk_entry_set_text(GTK_ENTRY(entry),"");
3373
 
 
 
3385
        gtk_entry_set_text(GTK_ENTRY(entry),"");        
 
3386
        
3374
3387
        button = lookup_widget(dialog10, "okbutton11");
3375
3388
        gtk_widget_set_sensitive(button, TRUE);
3376
 
 
 
3389
        
3377
3390
        cbox = lookup_widget(GTK_WIDGET(button), "combobox8");
3378
 
        gtk_combo_box_set_active(GTK_COMBO_BOX(cbox), 0);
3379
 
 
 
3391
        gtk_combo_box_set_active(GTK_COMBO_BOX(cbox), 0);       
 
3392
        
3380
3393
        if (gpsdata && gpsdata->fix.latitude !=0)
3381
3394
        {
3382
3395
                button = lookup_widget(dialog10, "button61");
3392
3405
                                        gpointer         user_data)
3393
3406
{
3394
3407
        GtkWidget *widget;
3395
 
 
 
3408
        
3396
3409
        widget = lookup_widget(GTK_WIDGET(button), "dialog10");
3397
 
 
 
3410
        
3398
3411
        gtk_widget_hide(widget);
3399
 
 
 
3412
        
3400
3413
        pickpoint_mode = TRUE;
3401
3414
        pickpoint = 1;
3402
3415
}
3405
3418
void
3406
3419
on_button60_clicked                    (GtkButton       *button,
3407
3420
                                        gpointer         user_data)
3408
 
{
 
3421
{               
3409
3422
        gtk_widget_hide(dialog10);
3410
 
 
 
3423
        
3411
3424
        pickpoint_mode = TRUE;
3412
3425
        pickpoint = 2;
3413
3426
}
3418
3431
                                        gpointer         user_data)
3419
3432
{
3420
3433
        GtkWidget *widget = NULL;
3421
 
 
 
3434
        
3422
3435
        widget = lookup_widget(dialog10, "entry31");
3423
 
 
3424
 
        gtk_entry_set_text(GTK_ENTRY(widget),
 
3436
        
 
3437
        gtk_entry_set_text(GTK_ENTRY(widget), 
3425
3438
                g_strdup_printf("%f,%f",gpsdata->fix.latitude,gpsdata->fix.longitude));
3426
3439
}
3427
3440
 
3431
3444
                                        gpointer         user_data)
3432
3445
{
3433
3446
        GtkWidget *widget;
3434
 
 
 
3447
        
3435
3448
        widget = lookup_widget(GTK_WIDGET(button), "dialog10");
3436
3449
        gtk_widget_hide(widget);
3437
3450
}
3443
3456
{
3444
3457
        GtkWidget *widget;
3445
3458
        char *start=NULL, *end=NULL;
3446
 
        char *service=NULL;
3447
 
 
 
3459
        int service;
 
3460
        
3448
3461
        gtk_widget_set_sensitive(GTK_WIDGET(button),FALSE);
3449
 
 
 
3462
        
3450
3463
        widget = lookup_widget(GTK_WIDGET(button), "label190");
3451
 
 
3452
 
        gtk_label_set_label (GTK_LABEL(widget),
3453
 
                             _("<b><i>Connecting...</i></b>"));
3454
 
 
 
3464
        
 
3465
        gtk_label_set_label(GTK_LABEL(widget),"<b><i>Connecting...</i></b>");
 
3466
        
3455
3467
        widget = lookup_widget(GTK_WIDGET(button), "entry31");
3456
3468
        start = g_strdup( gtk_entry_get_text(GTK_ENTRY(widget)) );
3457
 
 
 
3469
        
3458
3470
        widget = lookup_widget(GTK_WIDGET(button), "entry32");
3459
3471
        end   = g_strdup( gtk_entry_get_text(GTK_ENTRY(widget)) );
3460
 
 
 
3472
        
3461
3473
        widget = lookup_widget(GTK_WIDGET(button), "combobox8");
3462
 
        service = g_strdup (gtk_combo_box_get_active_text(GTK_COMBO_BOX(widget)));
3463
 
 
3464
 
        fetch_track (dialog10, service, start, end);
 
3474
        service = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
 
3475
        
 
3476
        fetch_track(dialog10, service, start, end);
3465
3477
}
3466
3478
 
3467
3479
void
3469
3481
{
3470
3482
        GtkWidget *widget = NULL;
3471
3483
        float lat=0, lon=0;
3472
 
 
 
3484
        printf("%s():\n",__PRETTY_FUNCTION__);
 
3485
        
 
3486
        
 
3487
        
3473
3488
        lat = rad2deg( pixel2lat(global_zoom, global_y+mouse_y) );
3474
3489
        lon = rad2deg( pixel2lon(global_zoom, global_x+mouse_x) );
3475
 
 
 
3490
        
3476
3491
        if (pickpoint == 1)
3477
3492
                widget = lookup_widget(dialog10, "entry31");
3478
3493
        if (pickpoint == 2)
3479
3494
                widget = lookup_widget(dialog10, "entry32");
3480
 
 
 
3495
        
3481
3496
        gtk_entry_set_text(GTK_ENTRY(widget), g_strdup_printf("%f,%f",lat,lon));
3482
 
 
 
3497
        
3483
3498
        if (pickpoint == 2)
3484
3499
                gtk_widget_grab_focus(widget);
3485
 
 
 
3500
        
3486
3501
        gtk_widget_show(dialog10);
3487
3502
 
3488
3503
        pickpoint_mode = FALSE;
3493
3508
                                        GdkEvent        *event,
3494
3509
                                        gpointer         user_data)
3495
3510
{
3496
 
 
 
3511
        
3497
3512
        gtk_widget_hide_on_delete(widget);
3498
3513
        return TRUE;
3499
3514
}
3503
3518
                                        gpointer         user_data)
3504
3519
{
3505
3520
        GtkWidget *widget;
3506
 
 
 
3521
        
 
3522
        printf("ACTIVATED\n");
 
3523
        
3507
3524
        widget = lookup_widget(dialog10, "okbutton11");
3508
3525
        gtk_button_clicked(GTK_BUTTON(widget));
3509
3526
}
3512
3529
on_combobox8_changed                   (GtkComboBox     *combobox,
3513
3530
                                        gpointer         user_data)
3514
3531
{
3515
 
 
3516
 
 
3517
 
 
 
3532
        
 
3533
        
 
3534
        
3518
3535
}
3519
3536
 
3520
3537
 
3522
3539
on_button76_clicked                    (GtkButton       *button,
3523
3540
                                        gpointer         user_data)
3524
3541
{
3525
 
 
 
3542
        
3526
3543
 
3527
3544
        GtkWidget *widget, *widget1, *draw_widget, *toolbar;
3528
3545
 
3529
 
        widget  = lookup_widget(window1, "vbox53");
 
3546
        widget  = lookup_widget(window1, "vbox53");  
3530
3547
        widget1 = lookup_widget(window1, "hbox52");
3531
3548
 
3532
3549
        if(!global_infopane_visible)
3538
3555
                }
3539
3556
                else
3540
3557
                        gtk_widget_set_size_request(widget, 360, -1);
3541
 
 
 
3558
                
3542
3559
                gtk_widget_show(widget);
3543
 
 
 
3560
                
3544
3561
                if(!global_landscape) {
3545
3562
                        toolbar = lookup_widget(window1, "toolbar1");
3546
3563
                        gtk_widget_hide(toolbar);
3547
3564
                }
3548
 
 
 
3565
                
3549
3566
                if(!global_infopane_current) {
3550
3567
                        gtk_widget_show((GtkWidget *) global_infopane_widgets->data);
3551
3568
                        global_infopane_current = global_infopane_widgets;
3555
3572
        }
3556
3573
        else {
3557
3574
                draw_widget = lookup_widget(window1, "drawingarea1");
3558
 
 
 
3575
                
3559
3576
                gtk_widget_hide(widget);
3560
3577
                gtk_widget_show(widget1);
3561
3578
                gtk_widget_grab_focus(draw_widget);
3564
3581
                        toolbar = lookup_widget(window1, "toolbar1");
3565
3582
                        gtk_widget_show(toolbar);
3566
3583
                }
3567
 
 
3568
 
                global_infopane_visible = FALSE;
 
3584
                
 
3585
                global_infopane_visible = FALSE;                
3569
3586
        }
3570
3587
}
3571
3588
 
3575
3592
                                        gpointer         user_data)
3576
3593
{
3577
3594
        gtk_widget_hide(global_infopane_current->data);
3578
 
 
 
3595
        
3579
3596
        if(global_infopane_current->prev) {
3580
3597
                gtk_widget_show(global_infopane_current->prev->data);
3581
3598
                global_infopane_current = global_infopane_current->prev;
3596
3613
{
3597
3614
 
3598
3615
        gtk_widget_hide(global_infopane_current->data);
3599
 
 
 
3616
        
3600
3617
        if(global_infopane_current->next) {
3601
3618
                gtk_widget_show(global_infopane_current->next->data);
3602
3619
                global_infopane_current = global_infopane_current->next;
3605
3622
                gtk_widget_show(global_infopane_widgets->data);
3606
3623
                global_infopane_current = global_infopane_widgets;
3607
3624
        }
3608
 
 
 
3625
                
3609
3626
}
3610
3627
 
3611
3628
void
3614
3631
{
3615
3632
        GtkWidget *widget = NULL;
3616
3633
        gboolean active;
3617
 
 
 
3634
        
3618
3635
        active = gtk_toggle_button_get_active(togglebutton);
3619
3636
 
3620
3637
        widget = lookup_widget(window1, "entry8");
3626
3643
move_map(int i)
3627
3644
{
3628
3645
        GtkWidget *widget = NULL;
3629
 
        GtkToggleToolButton *autocenter_toggle;
3630
3646
 
3631
3647
        widget = lookup_widget(window1, "drawingarea1");
3632
 
 
 
3648
        
3633
3649
        if(i == 1)
3634
3650
                global_x += 80;
3635
3651
        else if(i == 3)
3639
3655
        else if(i == 4)
3640
3656
                global_y -= 80;
3641
3657
 
3642
 
 
 
3658
                
3643
3659
        gdk_draw_rectangle (
3644
3660
                pixmap,
3645
3661
                widget->style->white_gc,
3647
3663
                0, 0,
3648
3664
                widget->allocation.width+260,
3649
3665
                widget->allocation.height+260);
3650
 
 
 
3666
                                
3651
3667
        gtk_widget_queue_draw_area (
3652
 
                widget,
 
3668
                widget, 
3653
3669
                0,0,widget->allocation.width+260,widget->allocation.height+260);
3654
 
 
3655
 
        autocenter_toggle =
3656
 
                GTK_TOGGLE_TOOL_BUTTON(lookup_widget(window1, "button3"));
3657
 
        gtk_toggle_tool_button_set_active(autocenter_toggle, FALSE);
3658
 
 
3659
 
        autocenter_toggle =
3660
 
                GTK_TOGGLE_TOOL_BUTTON(lookup_widget(window1, "button56"));
3661
 
        gtk_toggle_tool_button_set_active(autocenter_toggle, FALSE);
3662
 
 
 
3670
        
 
3671
        global_autocenter = FALSE;
 
3672
        
3663
3673
        repaint_all();
3664
3674
}
3665
3675
 
3679
3689
}
3680
3690
 
3681
3691
void
3682
 
tracklog_toolbutton_toggled (GtkToggleToolButton *button, gpointer data)
3683
 
{
3684
 
        GtkToggleButton *main_toggle =
3685
 
                GTK_TOGGLE_BUTTON (lookup_widget (window1, "checkbutton17"));
3686
 
 
3687
 
        trip_logger_on = gtk_toggle_tool_button_get_active (button);
3688
 
 
3689
 
        gtk_toggle_button_set_active (main_toggle, trip_logger_on);
3690
 
}
3691
 
 
3692
 
void
3693
3692
on_checkbutton17_toggled               (GtkToggleButton *togglebutton,
3694
3693
                                        gpointer         user_data)
3695
3694
{
3696
 
        GtkToggleToolButton *toolbar_toggle =
3697
 
                GTK_TOGGLE_TOOL_BUTTON (lookup_widget (window1, "button62"));
3698
 
 
3699
3695
        trip_logger_on = gtk_toggle_button_get_active(togglebutton);
3700
3696
 
3701
 
        gtk_toggle_tool_button_set_active (toolbar_toggle, trip_logger_on);
3702
 
 
 
3697
        
3703
3698
        if(trip_logger_on)
3704
3699
        {
3705
3700
                track_log_open();
3706
 
                g_settings_set_boolean(
3707
 
                                global_settings,
3708
 
                                "tracklog-on",
3709
 
                                TRUE);
 
3701
                gconf_client_set_bool(
 
3702
                                global_gconfclient, 
 
3703
                                GCONF"/tracklog_on",
 
3704
                                TRUE, NULL);
3710
3705
        }
3711
3706
        else
3712
3707
        {
3713
3708
                track_log_close();
3714
 
                g_settings_set_boolean(
3715
 
                                global_settings,
3716
 
                                "tracklog-on",
3717
 
                                FALSE);
 
3709
                gconf_client_set_bool(
 
3710
                                global_gconfclient, 
 
3711
                                GCONF"/tracklog_on",
 
3712
                                FALSE, NULL);
3718
3713
        }
3719
3714
}
3720
3715
 
3723
3718
on_button79_clicked                    (GtkButton       *button,
3724
3719
                                        gpointer         user_data)
3725
3720
{
3726
 
        GtkWidget *widget;
3727
 
 
3728
 
        reset_loaded_track();
3729
 
        gtk_widget_hide(GTK_WIDGET(button));
3730
 
 
3731
 
        widget = lookup_widget(window1, "button78");
3732
 
        gtk_widget_hide(widget);
3733
 
 
3734
 
        widget = lookup_widget(window1, "label203");
3735
 
        gtk_label_set_label(GTK_LABEL(widget), "");
3736
 
 
3737
 
        repaint_all();
 
3721
 
3738
3722
}
3739
3723
 
3740
3724
void
3744
3728
        const char *me_msg;
3745
3729
 
3746
3730
        me_msg = gtk_entry_get_text(GTK_ENTRY(editable));
3747
 
        g_settings_set_string(global_settings, "me-msg", me_msg);
3748
 
}
3749
 
 
3750
 
void
3751
 
on_checkbutton18_toggled               (GtkToggleButton *togglebutton,
3752
 
                                        gpointer         user_data)
3753
 
{
3754
 
        GtkWidget *widget;
3755
 
 
3756
 
        hrm_on = gtk_toggle_button_get_active(togglebutton);
3757
 
 
3758
 
        g_settings_set_boolean( global_settings,
3759
 
                                "hrm-on",
3760
 
                                hrm_on);
3761
 
 
3762
 
        global_reconnect_hrm = TRUE;
3763
 
 
3764
 
        widget = lookup_widget(window1, "label205");
3765
 
        (hrm_on) ? gtk_widget_show(widget) : gtk_widget_hide(widget);
3766
 
 
3767
 
        widget = lookup_widget(window1, "label206");
3768
 
        (hrm_on) ? gtk_widget_show(widget) : gtk_widget_hide(widget);
3769
 
 
3770
 
        widget = lookup_widget(window1, "label207");
3771
 
        (hrm_on) ? gtk_widget_show(widget) : gtk_widget_hide(widget);
3772
 
}
3773
 
 
3774
 
 
3775
 
void
3776
 
on_entry33_changed                     (GtkEditable     *editable,
3777
 
                                        gpointer         user_data)
3778
 
{
3779
 
        const char *entry;
3780
 
 
3781
 
        entry = gtk_entry_get_text(GTK_ENTRY(editable));
3782
 
 
3783
 
        g_settings_set_string(global_settings,
3784
 
                                "hrm-bt-addr",
3785
 
                                entry);
3786
 
 
3787
 
        global_hrm_bt_addr = g_strdup(entry);
3788
 
        global_reconnect_hrm = TRUE;
 
3731
        gconf_client_set_string(global_gconfclient, GCONF"/me_msg", me_msg, NULL);
3789
3732
}
3790
3733
 
3791
3734
void
3798
3741
void
3799
3742
activate_more_map_details (GtkMenuItem *menu_item, gpointer user_data)
3800
3743
{
 
3744
        GError *error = NULL;
3801
3745
        gboolean success = FALSE;
3802
3746
 
 
3747
        printf ("shrink details\n");
 
3748
 
3803
3749
        if (global_detail_zoom > 0) {
3804
3750
                global_detail_zoom--;
3805
3751
 
3806
3752
        }
3807
3753
 
3808
 
        success = g_settings_set_int(
3809
 
                                global_settings,
3810
 
                                "global-detail-zoom",
3811
 
                                global_detail_zoom);
 
3754
        success = gconf_client_set_int(
 
3755
                                global_gconfclient, 
 
3756
                                GCONF"/global_detail_zoom",
 
3757
                                global_detail_zoom,
 
3758
                                &error);
3812
3759
 
3813
3760
        repaint_all ();
3814
3761
}
3816
3763
void
3817
3764
activate_larger_map_details (GtkMenuItem *larger_item, GtkMenuItem *more_item)
3818
3765
{
 
3766
        GError *error = NULL;
3819
3767
        gboolean success = FALSE;
3820
3768
 
 
3769
        printf ("enlarge details\n");
 
3770
 
3821
3771
        global_detail_zoom++;
3822
3772
 
3823
 
        success = g_settings_set_int(
3824
 
                                global_settings,
3825
 
                                "global-detail-zoom",
3826
 
                                global_detail_zoom);
3827
 
 
3828
 
        repaint_all ();
3829
 
}
3830
 
 
3831
 
 
3832
 
void
3833
 
toggle_tile_redownload (GtkToggleButton *togglebutton, gpointer data)
3834
 
{
3835
 
        global_no_redownload = !gtk_toggle_button_get_active (togglebutton);
3836
 
 
3837
 
        g_settings_set_boolean (global_settings,
3838
 
                               "no-redownload",
3839
 
                               global_no_redownload);
3840
 
}
3841
 
 
3842
 
gboolean
3843
 
on_delete_waypoint_button_release_event (GtkWidget *widget,
3844
 
                                         GdkEventButton *event,
3845
 
                                         gpointer user_data)
3846
 
{
3847
 
        delete_waypoint_of_route (selected_wp);
3848
 
        selected_wp = NULL;
3849
 
        repaint_all ();
3850
 
 
3851
 
        return FALSE;
3852
 
}
3853
 
 
3854
 
gboolean
3855
 
on_insert_waypoint_button_release_event (GtkWidget *widget,
3856
 
                                         GdkEventButton *event,
3857
 
                                         gpointer user_data)
3858
 
{
3859
 
        insert_waypoint_before_of_route (selected_wp);
3860
 
        selected_wp = NULL;
3861
 
        repaint_all ();
3862
 
 
3863
 
        return FALSE;
3864
 
}
3865
 
 
3866
 
void
3867
 
on_help_menuitem_activate (GtkMenuItem *help_menuitem, gpointer user_data)
3868
 
{
3869
 
        system ("xdg-open " PACKAGE_HTML_DIR "/" PACKAGE ".html");
 
3773
        success = gconf_client_set_int(
 
3774
                                global_gconfclient, 
 
3775
                                GCONF"/global_detail_zoom",
 
3776
                                global_detail_zoom,
 
3777
                                &error);
 
3778
 
 
3779
        repaint_all ();
3870
3780
}