Diff of /trunk/src/main.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 6 by harbaum, Wed Jun 24 19:20:21 2009 UTC revision 123 by harbaum, Wed Sep 23 11:23:45 2009 UTC
# Line 95  void errorf(const char *fmt, ...) { Line 95  void errorf(const char *fmt, ...) {
95    GtkWidget *dialog = gtk_message_dialog_new(    GtkWidget *dialog = gtk_message_dialog_new(
96                             GTK_WINDOW(NULL),                             GTK_WINDOW(NULL),
97                             GTK_DIALOG_DESTROY_WITH_PARENT,                             GTK_DIALOG_DESTROY_WITH_PARENT,
98                             GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,  #if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5)
99                             buf);                             GTK_MESSAGE_ERROR,
100    #else
101                               GTK_MESSAGE_OTHER,
102    #endif
103                               GTK_BUTTONS_CLOSE, buf);
104    
105    gtk_window_set_title(GTK_WINDOW(dialog), _("ERROR"));    gtk_window_set_title(GTK_WINDOW(dialog), _("ERROR"));
106    
# Line 120  gpx_t *choose_file(appdata_t *appdata, g Line 124  gpx_t *choose_file(appdata_t *appdata, g
124                   HELP_ID_IMPORT, appdata->osso_context);                   HELP_ID_IMPORT, appdata->osso_context);
125  #endif  #endif
126  #else  #else
127    dialog = gtk_file_chooser_dialog_new (whole_dir?_("Open Directory"):    dialog = gtk_file_chooser_dialog_new (whole_dir?_("Import directory"):
128                                          _("Open File"),                                          _("Import file"),
129                          GTK_WINDOW(appdata->window),                          GTK_WINDOW(appdata->window),
130                          whole_dir?GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER :                          whole_dir?GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER :
131                                          GTK_FILE_CHOOSER_ACTION_OPEN,                                          GTK_FILE_CHOOSER_ACTION_OPEN,
# Line 138  gpx_t *choose_file(appdata_t *appdata, g Line 142  gpx_t *choose_file(appdata_t *appdata, g
142    gtk_widget_show_all (GTK_WIDGET(dialog));    gtk_widget_show_all (GTK_WIDGET(dialog));
143    if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_FM_OK) {    if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_FM_OK) {
144      char *filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));      char *filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
145    
146        if(filename) {
147          gpx_dialog_t *dialog = gpx_busy_dialog_new(GTK_WIDGET(appdata->window));
148    
149      gpx_dialog_t *dialog = gpx_busy_dialog_new(GTK_WIDGET(appdata->window));        if(!whole_dir)
150            gpx = gpx_parse(dialog, filename);
151      if(!whole_dir)        else {
152        gpx = gpx_parse(dialog, filename);          /* cur trailing '/' if present */
153      else {          if(strlastchr(filename) == '/')
154        /* cur trailing '/' if present */            filename[strlen(filename)] = 0;
155        if(strlastchr(filename) == '/')  
156          filename[strlen(filename)] = 0;          gpx = gpx_parse_dir(dialog, filename);
   
       gpx = gpx_parse_dir(dialog, filename);  
     }  
   
     gpx_busy_dialog_destroy(dialog);  
   
     /* save path if gpx was successfully loaded */  
     if(gpx) {  
       char *r = strrchr(filename, '/');  
   
       /* there is a delimiter, use everything left of it as path */  
       if(r && !whole_dir) {  
         *r = 0;  
         if(appdata->path) free(appdata->path);  
         appdata->path = strdup(filename);  
         /* restore path ... just in case ... */  
         *r = '/';  
157        }        }
158    
159          gpx_busy_dialog_destroy(dialog);
160    
161          /* save path if gpx was successfully loaded */
162          if(gpx) {
163            char *r = strrchr(filename, '/');
164    
165            /* there is a delimiter, use everything left of it as path */
166            if(r && !whole_dir) {
167              *r = 0;
168              if(appdata->path) free(appdata->path);
169              appdata->path = strdup(filename);
170              /* restore path ... just in case ... */
171              *r = '/';
172            }
173    
174            if(whole_dir)
175              appdata->path = strdup(filename);
176          } else
177            errorf(_("Load error"));
178    
179        if(whole_dir)        g_free (filename);
180          appdata->path = strdup(filename);      } else {
181    #ifndef USE_MAEMO
182          errorf(_("Error accessing the file."));
183    #else
184          errorf(_("Error accessing the file. This may happen if the file "
185                   "resides on a remote file system. Please copy the file onto "
186                   "the device (e.g. onto the memory card) and try again."));
187    #endif
188      }      }
   
     g_free (filename);  
189    }    }
190    
191    gtk_widget_destroy (dialog);    gtk_widget_destroy (dialog);
# Line 202  void cachelist_view_onRowActivated(GtkTr Line 217  void cachelist_view_onRowActivated(GtkTr
217    GtkTreeIter   iter;    GtkTreeIter   iter;
218    GtkTreeModel *model = gtk_tree_view_get_model(treeview);    GtkTreeModel *model = gtk_tree_view_get_model(treeview);
219    
220    #ifdef USE_MAEMO
221      /* check if a cache is already selected and ignore click if yes */
222      /* (was probably a double click) */
223      if(appdata->cur_cache) return;
224    #endif
225    
226    if(gtk_tree_model_get_iter(model, &iter, path)) {    if(gtk_tree_model_get_iter(model, &iter, path)) {
227      cache_t *cache;      cache_t *cache;
228      gtk_tree_model_get(model, &iter, CACHELIST_COL_DATA, &cache, -1);      gtk_tree_model_get(model, &iter, CACHELIST_COL_DATA, &cache, -1);
# Line 264  void cachelist_redraw(appdata_t *appdata Line 285  void cachelist_redraw(appdata_t *appdata
285    // gtk_widget_show_all(appdata->vbox);    // gtk_widget_show_all(appdata->vbox);
286  #else  #else
287    
288      if(!appdata->cur_view) {
289        printf("cachelist redraw: no active view\n");
290        return;
291      }
292    
293    g_assert(!appdata->cur_cache);    g_assert(!appdata->cur_cache);
294    int redraw = 0;    int redraw = 0;
295    if(appdata->search_results)    if(appdata->search_results)
# Line 274  void cachelist_redraw(appdata_t *appdata Line 300  void cachelist_redraw(appdata_t *appdata
300    }    }
301    
302    if(redraw) {    if(redraw) {
303      gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view);      GtkWidget *container = appdata->vbox;
304    
305        printf("redraw %d\n", redraw);
306    
307    #ifdef USE_STACKABLE_WINDOW
308        HildonWindowStack *stack = hildon_window_stack_get_default();
309        container = hildon_window_stack_peek(stack);
310    #endif
311    
312        gtk_container_remove(GTK_CONTAINER(container), appdata->cur_view);
313      switch(redraw) {      switch(redraw) {
314      case 1:      case 1:
315        appdata->cur_view = cachelist_create(appdata,        appdata->cur_view = cachelist_create(appdata,
# Line 286  void cachelist_redraw(appdata_t *appdata Line 321  void cachelist_redraw(appdata_t *appdata
321        break;        break;
322      }      }
323    
324      gtk_box_pack_start_defaults(GTK_BOX(appdata->vbox), appdata->cur_view);  #ifdef USE_STACKABLE_WINDOW
325      gtk_widget_show_all(appdata->vbox);      if(container != appdata->vbox)
326          gtk_container_add(GTK_CONTAINER(container), appdata->cur_view);
327        else
328    #endif
329          gtk_box_pack_start_defaults(GTK_BOX(container), appdata->cur_view);
330    
331        gtk_widget_show_all(container);
332    }    }
333  #endif  #endif
334  }  }
# Line 300  static gboolean cachelist_update(gpointe Line 341  static gboolean cachelist_update(gpointe
341  #ifdef USE_MAEMO  #ifdef USE_MAEMO
342    appdata_t *appdata = (appdata_t*)data;    appdata_t *appdata = (appdata_t*)data;
343    
344      if(appdata->cur_cache)
345        return TRUE;
346    
347    if(appdata->cachelist_disable_screensaver)    if(appdata->cachelist_disable_screensaver)
348      if (osso_display_blanking_pause(appdata->osso_context) != OSSO_OK)      if (osso_display_blanking_pause(appdata->osso_context) != OSSO_OK)
349        fprintf(stderr, "error with display blank\n");        fprintf(stderr, "error with display blank\n");
350    
351    if(appdata->cachelist_update)    if(appdata->cachelist_update)
352      cachelist_redraw(appdata);      cachelist_redraw(appdata);
353    
354  #endif  #endif
355    
356    return TRUE;    return TRUE;
357  }  }
358    
359  static void cachelist_timer_reset(appdata_t *appdata) {  static void cachelist_timer_reset(appdata_t *appdata) {
360      printf("cachelist timer reset\n");
361    g_assert(appdata->cachelist_handler_id);    g_assert(appdata->cachelist_handler_id);
362    gtk_timeout_remove(appdata->cachelist_handler_id);    gtk_timeout_remove(appdata->cachelist_handler_id);
363    appdata->cachelist_handler_id =    appdata->cachelist_handler_id =
# Line 543  void cachelist_dialog(appdata_t *appdata Line 589  void cachelist_dialog(appdata_t *appdata
589  }  }
590  #else  #else
591  #ifdef USE_STACKABLE_WINDOW  #ifdef USE_STACKABLE_WINDOW
592    static void search_result_free(gpx_t *result);
593    
594    void on_cachelist_destroy(GtkWidget *widget, appdata_t *appdata) {
595      if(appdata->search_results) {
596        search_result_free(appdata->search_results);
597        appdata->search_results = NULL;
598      }
599      appdata->cur_gpx = NULL;
600    
601      /* restore cur_view */
602      appdata->cur_view = g_object_get_data(G_OBJECT(widget), "cur_view");
603    }
604    
605  void cachelist_dialog(appdata_t *appdata, gpx_t *gpx) {  void cachelist_dialog(appdata_t *appdata, gpx_t *gpx) {
606    GtkWidget *window = hildon_stackable_window_new();    GtkWidget *window = hildon_stackable_window_new();
607    
608    gtk_window_set_title(GTK_WINDOW(window), gpx->name);    /* store last "cur_view" in window */
609      g_object_set_data(G_OBJECT(window), "cur_view", appdata->cur_view);
610    
611    gtk_container_add(GTK_CONTAINER(window),    appdata->cur_gpx = gpx;
612                      cachelist_create(appdata, gpx, NULL));    char *title = g_strdup_printf("%s - GPXView", gpx->name);
613      gtk_window_set_title(GTK_WINDOW(window), title);
614      g_free(title);
615    
616      appdata->cur_view = cachelist_create(appdata, gpx, NULL);
617      gtk_container_add(GTK_CONTAINER(window), appdata->cur_view);
618    
619    
620    hildon_window_set_app_menu(HILDON_WINDOW(window),    hildon_window_set_app_menu(HILDON_WINDOW(window),
621                               menu_create(appdata, MENU_CACHELIST));                               menu_create(appdata, MENU_CACHELIST));
622    
623      g_signal_connect(G_OBJECT(window), "destroy",
624                       G_CALLBACK(on_cachelist_destroy), appdata);
625    
626    gtk_widget_show_all(window);    gtk_widget_show_all(window);
627  }  }
628  #endif  #endif
# Line 666  static void gpxlist_view_onRowActivated( Line 735  static void gpxlist_view_onRowActivated(
735    GtkTreeIter   iter;    GtkTreeIter   iter;
736    GtkTreeModel *model = gtk_tree_view_get_model(treeview);    GtkTreeModel *model = gtk_tree_view_get_model(treeview);
737    
738    #ifdef USE_MAEMO
739      /* check if a cache is already selected and ignore click if yes */
740      /* (was probably a double click) */
741      if(appdata->cur_gpx) return;
742    #endif
743    
744    if (gtk_tree_model_get_iter(model, &iter, path)) {    if (gtk_tree_model_get_iter(model, &iter, path)) {
745      gpx_t *gpx;      gpx_t *gpx;
746      gtk_tree_model_get(model, &iter, GPXLIST_COL_DATA, &gpx, -1);      gtk_tree_model_get(model, &iter, GPXLIST_COL_DATA, &gpx, -1);
# Line 764  static void gpxlist_view_onRowActivated( Line 839  static void gpxlist_view_onRowActivated(
839          gpx_busy_dialog_destroy(dialog);          gpx_busy_dialog_destroy(dialog);
840        }        }
841  #ifndef USE_BREAD_CRUMB_TRAIL  #ifndef USE_BREAD_CRUMB_TRAIL
842        cachelist_dialog(appdata, gpx);  #ifdef USE_STACKABLE_WINDOW
843          if(!appdata->cur_gpx)
844    #endif
845            cachelist_dialog(appdata, gpx);
846    #ifdef USE_STACKABLE_WINDOW
847          else
848            printf("selected gpx, but cachelist window already present\n");
849    #endif
850  #else  #else
851        gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view);        gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view);
852        appdata->cur_view = cachelist_create(appdata, gpx, NULL);        appdata->cur_view = cachelist_create(appdata, gpx, NULL);
# Line 903  static GtkWidget *gpxlist_create_view_an Line 985  static GtkWidget *gpxlist_create_view_an
985      GtkTreeIter         iter;      GtkTreeIter         iter;
986      gtk_list_store_append(appdata->gpxstore, &iter);      gtk_list_store_append(appdata->gpxstore, &iter);
987      gpxlist_set(appdata->gpxstore, &iter, gpx);      gpxlist_set(appdata->gpxstore, &iter, gpx);
988    
989      if(gpx == sel_gpx) {      if(gpx == sel_gpx) {
990        sel_iter = iter;        sel_iter = iter;
991        sel_iter_valid = TRUE;        sel_iter_valid = TRUE;
# Line 963  static void gpxlist_add(appdata_t *appda Line 1045  static void gpxlist_add(appdata_t *appda
1045    
1046  /******************** begin of menu *********************/  /******************** begin of menu *********************/
1047    
1048    typedef struct {
1049      appdata_t *appdata;
1050      GtkWidget *dialog;
1051    } about_context_t;
1052    
1053    #ifdef ENABLE_BROWSER_INTERFACE
1054    void on_paypal_button_clicked(GtkButton *button, about_context_t *context) {
1055      gtk_dialog_response(GTK_DIALOG(context->dialog), GTK_RESPONSE_ACCEPT);
1056      browser_url(context->appdata,
1057                  "https://www.paypal.com/cgi-bin/webscr"
1058                  "?cmd=_s-xclick&hosted_button_id=7400558");
1059    }
1060    #endif
1061    
1062  static void  static void
1063  cb_menu_about(GtkWidget *window, gpointer data) {  cb_menu_about(GtkWidget *window, gpointer data) {
1064    GtkAboutDialog *about = GTK_ABOUT_DIALOG(gtk_about_dialog_new());    about_context_t context;
1065    
1066      context.appdata = (appdata_t *)data;
1067    
1068    gtk_about_dialog_set_name(about, "GPXView");  #ifdef ENABLE_LIBLOCATION
1069    gtk_about_dialog_set_version(about, VERSION);    char *uses = "uses liblocation";
1070    gtk_about_dialog_set_copyright(about,  #elif defined(ENABLE_GPSBT)
1071           _("GPXView (c) 2008 by\n"    char *uses = "uses gpsbt and gpsd";
1072           "Till Harbaum <till@harbaum.org>\n"  #else
1073           "Geocaching.com: Tantil"));    char *uses = "uses gpsd";
1074    #endif
1075    gtk_about_dialog_set_website(about,  
1076         _("http://www.harbaum.org/till/maemo"));    const gchar *authors[] = {
1077        "Till Harbaum <till@harbaum.org>",
1078    gtk_about_dialog_set_comments(about,      "John Stowers <john.stowers@gmail.com>",
1079         _("Geocaching.com GPX file viewer"));      NULL };
1080    
1081    gtk_widget_show_all(GTK_WIDGET(about));    context.dialog = g_object_new(GTK_TYPE_ABOUT_DIALOG,
1082    gtk_dialog_run(GTK_DIALOG(about));                          "name", "GPXView",
1083    gtk_widget_destroy(GTK_WIDGET(about));                          "version", VERSION,
1084                            "copyright", _("Copyright 2008-2009"),
1085                            "authors", authors,
1086                            "website", _("http://www.harbaum.org/till/maemo"),
1087                            "comments", _(uses),
1088                            NULL);
1089    
1090    #ifdef ENABLE_BROWSER_INTERFACE
1091      /* add a way to donate to the project */
1092      GtkWidget *alignment = gtk_alignment_new(0.5, 0, 0, 0);
1093    
1094      GtkWidget *hbox = gtk_hbox_new(FALSE, 8);
1095      gtk_box_pack_start(GTK_BOX(hbox),
1096                         gtk_label_new(_("Do you like GPXView?")),
1097                         FALSE, FALSE, 0);
1098    
1099      GtkWidget *button = gtk_button_new();
1100      gtk_button_set_image(GTK_BUTTON(button),
1101                           icon_get_widget(ICON_MISC, 8));
1102      gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
1103      g_signal_connect(button, "clicked",
1104                       G_CALLBACK(on_paypal_button_clicked), &context);
1105      gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
1106    
1107      gtk_container_add(GTK_CONTAINER(alignment), hbox);
1108      gtk_box_pack_start_defaults(GTK_BOX((GTK_DIALOG(context.dialog))->vbox),
1109                                  alignment);
1110    
1111      gtk_widget_show_all(alignment);
1112    #endif
1113    
1114      gtk_dialog_run(GTK_DIALOG(context.dialog));
1115      gtk_widget_destroy(context.dialog);
1116  }  }
1117    
1118  #if defined(USE_MAEMO) && defined(HILDON_HELP)  #if defined(USE_MAEMO) && defined(HILDON_HELP)
# Line 1328  cb_menu_search(GtkWidget *window, gpoint Line 1458  cb_menu_search(GtkWidget *window, gpoint
1458      /* don't search if we are asked to search for nothing */      /* don't search if we are asked to search for nothing */
1459      if(((appdata->search & (SEARCH_ID|SEARCH_NAME|SEARCH_DESC|SEARCH_OWNER)) &&      if(((appdata->search & (SEARCH_ID|SEARCH_NAME|SEARCH_DESC|SEARCH_OWNER)) &&
1460          strlen(p) > 0) || (appdata->search & SEARCH_FINDS)) {          strlen(p) > 0) || (appdata->search & SEARCH_FINDS)) {
       gpx_t *found = NULL;  
1461    
1462        printf("Search for %s (flags = %x)...\n", p, appdata->search);        printf("Search for %s (flags = %x)...\n", p, appdata->search);
1463    
1464  #ifndef USE_BREAD_CRUMB_TRAIL  #ifndef USE_BREAD_CRUMB_TRAIL
1465        found = search_do(appdata, appdata->gpx, p, appdata->search, FALSE);        gpx_t *found =
1466            search_do(appdata, appdata->gpx, p, appdata->search, FALSE);
1467    
1468        /* do search result dialog here ... */        /* do search result dialog here ... */
1469        cachelist_dialog(appdata, found);        cachelist_dialog(appdata, found);
1470    #ifndef USE_STACKABLE_WINDOW
1471        search_result_free(found);        search_result_free(found);
1472  #else  #else
1473          appdata->search_results = found;
1474    #endif
1475    #else
1476          gpx_t *found = NULL;
1477    
1478        if(appdata->cur_gpx)        if(appdata->cur_gpx)
1479          found = search_do(appdata, appdata->cur_gpx, p, appdata->search, TRUE);          found = search_do(appdata, appdata->cur_gpx, p, appdata->search, TRUE);
1480        else        else
# Line 1359  cb_menu_search(GtkWidget *window, gpoint Line 1495  cb_menu_search(GtkWidget *window, gpoint
1495      gtk_widget_destroy(dialog);      gtk_widget_destroy(dialog);
1496  }  }
1497    
1498  void on_window_destroy (GtkWidget *widget, gpointer data);  static void on_window_destroy (GtkWidget *widget, gpointer data);
1499    
1500  #ifndef USE_MAEMO  #ifndef USE_MAEMO
1501  static void  static void
# Line 1421  cb_menu_export_log(GtkWidget *widget, gp Line 1557  cb_menu_export_log(GtkWidget *widget, gp
1557    notes_log_export(appdata);    notes_log_export(appdata);
1558  }  }
1559    
1560  #ifdef USE_MAEMO  #ifdef ENABLE_MAEMO_MAPPER
1561  static void  static void
1562  cb_menu_export_mmpoi(GtkWidget *widget, gpointer data) {  cb_menu_export_mmpoi(GtkWidget *widget, gpointer data) {
1563    appdata_t *appdata = (appdata_t*)data;    appdata_t *appdata = (appdata_t*)data;
# Line 1435  cb_menu_export_garmin(GtkWidget *widget, Line 1571  cb_menu_export_garmin(GtkWidget *widget,
1571    garmin_export(appdata);    garmin_export(appdata);
1572  }  }
1573    
1574    #ifdef ENABLE_OSM_GPS_MAP
1575    static void
1576    cb_menu_map(GtkWidget *window, gpointer data) {
1577      map((appdata_t *)data);
1578    }
1579    #endif
1580    
1581  static void  static void
1582  cb_menu_geomath(GtkWidget *window, gpointer data) {  cb_menu_geomath(GtkWidget *window, gpointer data) {
1583    geomath_dialog((appdata_t *)data);    geomath_dialog((appdata_t *)data);
# Line 1451  cb_menu_precpos(GtkWidget *window, gpoin Line 1594  cb_menu_precpos(GtkWidget *window, gpoin
1594  }  }
1595    
1596  #ifdef USE_STACKABLE_WINDOW  #ifdef USE_STACKABLE_WINDOW
1597    typedef struct {
1598      char *label, *desc;
1599      GtkSignalFunc activate_cb;
1600    } menu_entry_t;
1601    
1602  void on_export_clicked(GtkButton *button, appdata_t *appdata) {  typedef struct {
1603    HildonStackableWindow *view_window;    const char *title;
1604    GtkWidget *but;    const menu_entry_t *menu;
1605      int len;
1606    } submenu_t;
1607    
1608    view_window = HILDON_STACKABLE_WINDOW (hildon_stackable_window_new ());  #define COLUMNS  1
   gtk_window_set_title (GTK_WINDOW (view_window), "Export");  
1609    
1610    GtkVBox *contents = GTK_VBOX(gtk_vbox_new (12, FALSE));  void on_submenu_entry_clicked(GtkButton *button, GtkWidget *menu) {
1611    
1612    but = hildon_button_new_with_text(    /* force closing of submenu dialog */
1613              HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH,    gtk_dialog_response(GTK_DIALOG(menu), GTK_RESPONSE_NONE);
1614              HILDON_BUTTON_ARRANGEMENT_VERTICAL,    gtk_widget_hide(menu);
1615              _("Export to Maemo Mapper"),  
1616              _("Save a Maemo Mapper POI file"));    /* let gtk clean up */
1617    g_signal_connect(but, "clicked",    while(gtk_events_pending())
1618                     G_CALLBACK(cb_menu_export_mmpoi), appdata);      gtk_main_iteration();
1619    gtk_box_pack_start(GTK_BOX(contents), but, FALSE, FALSE, 0);  }
1620    
1621    static GtkWidget *app_submenu_create(appdata_t *appdata,
1622                                         const submenu_t *submenu) {
1623    
1624    but = hildon_button_new_with_text(    /* create a oridinary dialog box */
1625              HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH,    GtkWidget *dialog = gtk_dialog_new();
1626              HILDON_BUTTON_ARRANGEMENT_VERTICAL,    gtk_window_set_title(GTK_WINDOW(dialog), _(submenu->title));
1627              _("Export Field Notes"),    gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
1628              _("Save a Garmin Field Notes file"));    gtk_window_set_transient_for(GTK_WINDOW(dialog),
1629    g_signal_connect(but, "clicked",                                 GTK_WINDOW(appdata->window));
1630                     G_CALLBACK(cb_menu_export_log), appdata);    gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
1631    gtk_box_pack_start(GTK_BOX(contents), but, FALSE, FALSE, 0);  
1632      GtkWidget *table = gtk_table_new(submenu->len/COLUMNS, COLUMNS, TRUE);
1633      int x = 0, y = 0;
1634    
1635    but = hildon_button_new_with_text(    const menu_entry_t *menu_entries = submenu->menu;
1636      while(menu_entries->label) {
1637        GtkWidget *button = NULL;
1638    
1639        button = hildon_button_new_with_text(
1640              HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH,              HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH,
1641              HILDON_BUTTON_ARRANGEMENT_VERTICAL,              HILDON_BUTTON_ARRANGEMENT_VERTICAL,
1642              _("Export Garmin GPX"),              _(menu_entries->label), _(menu_entries->desc));
1643              _("Save a GPX file containing modified waypoints"));  
1644    g_signal_connect(but, "clicked",      /* try to center both texts */
1645                     G_CALLBACK(cb_menu_export_garmin), appdata);      hildon_button_set_title_alignment(HILDON_BUTTON(button), 0.5, 0.5);
1646    gtk_box_pack_start(GTK_BOX(contents), but, FALSE, FALSE, 0);      hildon_button_set_value_alignment(HILDON_BUTTON(button), 0.5, 0.5);
1647    
1648        g_signal_connect(button, "clicked",
1649                         G_CALLBACK(on_submenu_entry_clicked), dialog);
1650    
1651        g_signal_connect(button, "clicked",
1652                         menu_entries->activate_cb, appdata);
1653    
1654        gtk_table_attach_defaults(GTK_TABLE(table),  button, x, x+1, y, y+1);
1655    
1656        x++;
1657        if(x == COLUMNS) { x = 0; y++; }
1658    
1659        menu_entries++;
1660      }
1661    
1662      gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox), table);
1663    
1664    gtk_container_add (GTK_CONTAINER (view_window), GTK_WIDGET (contents));    return dialog;
   gtk_widget_show_all (GTK_WIDGET (view_window));  
1665  }  }
1666    
1667  void on_tools_clicked(GtkButton *button, appdata_t *appdata) {  /* popup the dialog shaped submenu */
1668    HildonStackableWindow *view_window;  static void submenu_popup(GtkWidget *menu) {
1669    GtkWidget *but;    gtk_widget_show_all(menu);
1670      gtk_dialog_run(GTK_DIALOG(menu));
1671      gtk_widget_hide(menu);
1672    }
1673    
1674    view_window = HILDON_STACKABLE_WINDOW (hildon_stackable_window_new ());  static void submenu_cleanup(GtkWidget *menu) {
1675    gtk_window_set_title (GTK_WINDOW (view_window), "Export");    gtk_widget_destroy(menu);
1676    }
1677    
1678    GtkVBox *contents = GTK_VBOX(gtk_vbox_new (12, FALSE));  static const menu_entry_t submenu_export_entries[] = {
1679    #ifdef ENABLE_MAEMO_MAPPER
1680      { "Export to Maemo Mapper" , "Save a Maemo Mapper POI file",
1681        G_CALLBACK(cb_menu_export_mmpoi)  },
1682    #endif
1683      { "Export Field Notes",      "Save a Garmin Field Notes file",
1684        G_CALLBACK(cb_menu_export_log)    },
1685      { "Export Garmin GPX",       "Save modified waypoints in GPX file",
1686        G_CALLBACK(cb_menu_export_garmin) },
1687      { NULL, NULL, NULL }
1688    };
1689    
1690    but = hildon_button_new_with_text(  static const submenu_t submenu_export = {
1691              HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH,    "Export", submenu_export_entries,
1692              HILDON_BUTTON_ARRANGEMENT_VERTICAL,    sizeof(submenu_export_entries)/sizeof(menu_entry_t)-1
1693              _("Geomath"),  };
             _("Geocoordinate calculation"));  
   g_signal_connect(but, "clicked",  
                    G_CALLBACK(cb_menu_geomath), appdata);  
   gtk_box_pack_start(GTK_BOX(contents), but, FALSE, FALSE, 0);  
1694    
1695    /* the export submenu */
1696    void on_export_clicked(GtkButton *button, appdata_t *appdata) {
1697      if(!appdata->export_menu)
1698        appdata->export_menu = app_submenu_create(appdata, &submenu_export);
1699    
1700    but = hildon_button_new_with_text(    submenu_popup(appdata->export_menu);
1701              HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH,  }
             HILDON_BUTTON_ARRANGEMENT_VERTICAL,  
             _("Geotext"),  
             _("Text analysis, letter counting etc"));  
   g_signal_connect(but, "clicked",  
                    G_CALLBACK(cb_menu_geotext), appdata);  
   gtk_box_pack_start(GTK_BOX(contents), but, FALSE, FALSE, 0);  
   
1702    
1703    but = hildon_button_new_with_text(  static const menu_entry_t submenu_tools_entries[] = {
1704              HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH,    { "Geomath",          "Geocoordinate calculation",
1705              HILDON_BUTTON_ARRANGEMENT_VERTICAL,      G_CALLBACK(cb_menu_geomath) },
1706              _("Precise Position"),    { "Geotext",          "Text analysis",
1707              _("Calculate a very precise GPS posotions"));      G_CALLBACK(cb_menu_geotext) },
1708    g_signal_connect(but, "clicked",    { "Precise Position", "Calculate a precise GPS position",
1709                     G_CALLBACK(cb_menu_precpos), appdata);      G_CALLBACK(cb_menu_precpos) },
1710    gtk_box_pack_start(GTK_BOX(contents), but, FALSE, FALSE, 0);    { NULL, NULL, NULL }
1711    };
1712    
1713    static const submenu_t submenu_tools = {
1714      "Tools", submenu_tools_entries,
1715      sizeof(submenu_tools_entries)/sizeof(menu_entry_t)-1
1716    };
1717    
1718    gtk_container_add (GTK_CONTAINER (view_window), GTK_WIDGET (contents));  /* the tools submenu */
1719    gtk_widget_show_all (GTK_WIDGET (view_window));  void on_tools_clicked(GtkButton *button, appdata_t *appdata) {
1720      if(!appdata->tools_menu)
1721        appdata->tools_menu = app_submenu_create(appdata, &submenu_tools);
1722    
1723      submenu_popup(appdata->tools_menu);
1724  }  }
1725    
1726  HildonAppMenu *menu_create(appdata_t *appdata, int mode) {  HildonAppMenu *menu_create(appdata_t *appdata, int mode) {
# Line 1541  HildonAppMenu *menu_create(appdata_t *ap Line 1728  HildonAppMenu *menu_create(appdata_t *ap
1728    HildonAppMenu *menu = HILDON_APP_MENU(hildon_app_menu_new());    HildonAppMenu *menu = HILDON_APP_MENU(hildon_app_menu_new());
1729    
1730    /* ------- */    /* ------- */
1731      button = gtk_button_new_with_label(_("About"));
1732      g_signal_connect_after(button, "clicked",
1733                             G_CALLBACK(cb_menu_about), appdata);
1734      hildon_app_menu_append(menu, GTK_BUTTON(button));
1735    
1736    button = gtk_button_new_with_label(_("Settings"));    button = gtk_button_new_with_label(_("Settings"));
1737    g_signal_connect_after(button, "clicked", G_CALLBACK(cb_menu_settings),    g_signal_connect_after(button, "clicked", G_CALLBACK(cb_menu_settings),
1738                           appdata);                           appdata);
# Line 1552  HildonAppMenu *menu_create(appdata_t *ap Line 1744  HildonAppMenu *menu_create(appdata_t *ap
1744                             G_CALLBACK(cb_menu_add), appdata);                             G_CALLBACK(cb_menu_add), appdata);
1745      hildon_app_menu_append(menu, GTK_BUTTON(button));      hildon_app_menu_append(menu, GTK_BUTTON(button));
1746    
1747      button = gtk_button_new_with_label(_("Import dir"));      button = gtk_button_new_with_label(_("Import directory"));
1748      g_signal_connect_after(button, "clicked",      g_signal_connect_after(button, "clicked",
1749                             G_CALLBACK(cb_menu_adddir), appdata);                             G_CALLBACK(cb_menu_adddir), appdata);
1750      hildon_app_menu_append(menu, GTK_BUTTON(button));      hildon_app_menu_append(menu, GTK_BUTTON(button));
   }  
1751    
   if(mode == MENU_GPXLIST) {  
1752      button = gtk_button_new_with_label(_("Export"));      button = gtk_button_new_with_label(_("Export"));
1753      g_signal_connect_after(button, "clicked",      g_signal_connect_after(button, "clicked",
1754                             G_CALLBACK(on_export_clicked), appdata);                             G_CALLBACK(on_export_clicked), appdata);
# Line 1575  HildonAppMenu *menu_create(appdata_t *ap Line 1765  HildonAppMenu *menu_create(appdata_t *ap
1765                           G_CALLBACK(on_tools_clicked), appdata);                           G_CALLBACK(on_tools_clicked), appdata);
1766    hildon_app_menu_append(menu, GTK_BUTTON(button));    hildon_app_menu_append(menu, GTK_BUTTON(button));
1767    
1768    button = gtk_button_new_with_label(_("About"));  #ifdef ENABLE_OSM_GPS_MAP
1769        button = gtk_button_new_with_label(_("Map"));
1770        g_signal_connect_after(button, "clicked",
1771                               G_CALLBACK(cb_menu_map), appdata);
1772        hildon_app_menu_append(menu, GTK_BUTTON(button));
1773    #endif
1774    
1775    #ifdef HILDON_HELP
1776      button = gtk_button_new_with_label(_("Help"));
1777    g_signal_connect_after(button, "clicked",    g_signal_connect_after(button, "clicked",
1778                           G_CALLBACK(cb_menu_about), appdata);                           G_CALLBACK(cb_menu_help), appdata);
1779    hildon_app_menu_append(menu, GTK_BUTTON(button));    hildon_app_menu_append(menu, GTK_BUTTON(button));
1780    #endif
1781    
1782    gtk_widget_show(GTK_WIDGET(menu));    gtk_widget_show_all(GTK_WIDGET(menu));
1783    
1784    return menu;    return menu;
1785  }  }
# Line 1598  void menu_create(appdata_t *appdata) { Line 1797  void menu_create(appdata_t *appdata) {
1797    GtkWidget *submenu = gtk_menu_new();    GtkWidget *submenu = gtk_menu_new();
1798    gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);    gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
1799    
1800    item = gtk_menu_item_new_with_label( _("File...") );    item = gtk_menu_item_new_with_label( _("File") );
1801    gtk_menu_append(GTK_MENU_SHELL(submenu), item);    gtk_menu_append(GTK_MENU_SHELL(submenu), item);
1802    g_signal_connect(item, "activate", GTK_SIGNAL_FUNC(cb_menu_add), appdata);    g_signal_connect(item, "activate", GTK_SIGNAL_FUNC(cb_menu_add), appdata);
1803    
1804    item = gtk_menu_item_new_with_label( _("Directory...") );    item = gtk_menu_item_new_with_label( _("Directory") );
1805    gtk_menu_append(GTK_MENU_SHELL(submenu), item);    gtk_menu_append(GTK_MENU_SHELL(submenu), item);
1806    g_signal_connect(item, "activate", GTK_SIGNAL_FUNC(cb_menu_adddir), appdata);    g_signal_connect(item, "activate", GTK_SIGNAL_FUNC(cb_menu_adddir), appdata);
1807    
# Line 1628  void menu_create(appdata_t *appdata) { Line 1827  void menu_create(appdata_t *appdata) {
1827    submenu = gtk_menu_new();    submenu = gtk_menu_new();
1828    gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);    gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
1829    
1830  #ifdef USE_MAEMO  #ifdef ENABLE_MAEMO_MAPPER
1831    item = gtk_menu_item_new_with_label( _("Maemo Mapper POI...") );    item = gtk_menu_item_new_with_label( _("Maemo Mapper POI") );
1832    gtk_menu_append(GTK_MENU_SHELL(submenu), item);    gtk_menu_append(GTK_MENU_SHELL(submenu), item);
1833    g_signal_connect(item, "activate",    g_signal_connect(item, "activate",
1834                     GTK_SIGNAL_FUNC(cb_menu_export_mmpoi), appdata);                     GTK_SIGNAL_FUNC(cb_menu_export_mmpoi), appdata);
1835  #endif  #endif
1836    
1837    item = gtk_menu_item_new_with_label( _("Garmin Field Notes...") );    item = gtk_menu_item_new_with_label( _("Garmin Field Notes") );
1838    gtk_menu_append(GTK_MENU_SHELL(submenu), item);    gtk_menu_append(GTK_MENU_SHELL(submenu), item);
1839    g_signal_connect(item, "activate",    g_signal_connect(item, "activate",
1840                     GTK_SIGNAL_FUNC(cb_menu_export_log), appdata);                     GTK_SIGNAL_FUNC(cb_menu_export_log), appdata);
1841    
1842    item = gtk_menu_item_new_with_label( _("Garmin GPX...") );    item = gtk_menu_item_new_with_label( _("Garmin GPX") );
1843    gtk_menu_append(GTK_MENU_SHELL(submenu), item);    gtk_menu_append(GTK_MENU_SHELL(submenu), item);
1844    g_signal_connect(item, "activate",    g_signal_connect(item, "activate",
1845                     GTK_SIGNAL_FUNC(cb_menu_export_garmin), appdata);                     GTK_SIGNAL_FUNC(cb_menu_export_garmin), appdata);
# Line 1648  void menu_create(appdata_t *appdata) { Line 1847  void menu_create(appdata_t *appdata) {
1847  #ifdef USE_BREAD_CRUMB_TRAIL  #ifdef USE_BREAD_CRUMB_TRAIL
1848    appdata->menu_search =    appdata->menu_search =
1849  #endif  #endif
1850    item = gtk_menu_item_new_with_label( _("Search...") );    item = gtk_menu_item_new_with_label( _("Search") );
1851    gtk_menu_append(GTK_MENU_SHELL(menu), item);    gtk_menu_append(GTK_MENU_SHELL(menu), item);
1852    g_signal_connect(item, "activate", GTK_SIGNAL_FUNC(cb_menu_search), appdata);    g_signal_connect(item, "activate", GTK_SIGNAL_FUNC(cb_menu_search), appdata);
1853    
# Line 1685  void menu_create(appdata_t *appdata) { Line 1884  void menu_create(appdata_t *appdata) {
1884    
1885    gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new());    gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new());
1886    
1887    #ifdef ENABLE_OSM_GPS_MAP
1888      item = gtk_menu_item_new_with_label( _("Map") );
1889      gtk_menu_append(GTK_MENU_SHELL(menu), item);
1890      g_signal_connect(item, "activate",
1891                       GTK_SIGNAL_FUNC(cb_menu_map), appdata);
1892    #endif
1893    
1894    item = gtk_menu_item_new_with_label(_("Tools"));    item = gtk_menu_item_new_with_label(_("Tools"));
1895    gtk_menu_append(GTK_MENU_SHELL(menu), item);    gtk_menu_append(GTK_MENU_SHELL(menu), item);
1896    submenu = gtk_menu_new();    submenu = gtk_menu_new();
1897    gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);    gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
1898    
1899    item = gtk_menu_item_new_with_label( _("Geomath...") );    item = gtk_menu_item_new_with_label( _("Geomath") );
1900    gtk_menu_append(GTK_MENU_SHELL(submenu), item);    gtk_menu_append(GTK_MENU_SHELL(submenu), item);
1901    g_signal_connect(item, "activate",    g_signal_connect(item, "activate",
1902                     GTK_SIGNAL_FUNC(cb_menu_geomath), appdata);                     GTK_SIGNAL_FUNC(cb_menu_geomath), appdata);
1903    
1904    item = gtk_menu_item_new_with_label( _("Geotext...") );    item = gtk_menu_item_new_with_label( _("Geotext") );
1905    gtk_menu_append(GTK_MENU_SHELL(submenu), item);    gtk_menu_append(GTK_MENU_SHELL(submenu), item);
1906    g_signal_connect(item, "activate",    g_signal_connect(item, "activate",
1907                     GTK_SIGNAL_FUNC(cb_menu_geotext), appdata);                     GTK_SIGNAL_FUNC(cb_menu_geotext), appdata);
1908    
1909    item = gtk_menu_item_new_with_label( _("Precise Position...") );    item = gtk_menu_item_new_with_label( _("Precise Position") );
1910    gtk_menu_append(GTK_MENU_SHELL(submenu), item);    gtk_menu_append(GTK_MENU_SHELL(submenu), item);
1911    g_signal_connect(item, "activate",    g_signal_connect(item, "activate",
1912                     GTK_SIGNAL_FUNC(cb_menu_precpos), appdata);                     GTK_SIGNAL_FUNC(cb_menu_precpos), appdata);
# Line 1708  void menu_create(appdata_t *appdata) { Line 1914  void menu_create(appdata_t *appdata) {
1914    gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new());    gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new());
1915    
1916  #if defined(USE_MAEMO) && defined(HILDON_HELP)  #if defined(USE_MAEMO) && defined(HILDON_HELP)
1917    item = gtk_menu_item_new_with_label( _("Help...") );    item = gtk_menu_item_new_with_label( _("Help") );
1918    gtk_menu_append(GTK_MENU_SHELL(menu), item);    gtk_menu_append(GTK_MENU_SHELL(menu), item);
1919    g_signal_connect(item, "activate", GTK_SIGNAL_FUNC(cb_menu_help), appdata);    g_signal_connect(item, "activate", GTK_SIGNAL_FUNC(cb_menu_help), appdata);
1920  #endif  #endif
1921    
1922    item = gtk_menu_item_new_with_label( _("About...") );    item = gtk_menu_item_new_with_label( _("About") );
1923    gtk_menu_append(GTK_MENU_SHELL(menu), item);    gtk_menu_append(GTK_MENU_SHELL(menu), item);
1924    g_signal_connect(item, "activate", GTK_SIGNAL_FUNC(cb_menu_about), appdata);    g_signal_connect(item, "activate", GTK_SIGNAL_FUNC(cb_menu_about), appdata);
1925    
# Line 1749  void cleanup(appdata_t *appdata) { Line 1955  void cleanup(appdata_t *appdata) {
1955    if(appdata->image_path) free(appdata->image_path);    if(appdata->image_path) free(appdata->image_path);
1956    if(appdata->search_str) free(appdata->search_str);    if(appdata->search_str) free(appdata->search_str);
1957    
1958    #ifdef USE_STACKABLE_WINDOW
1959      if(appdata->export_menu) submenu_cleanup(appdata->export_menu);
1960      if(appdata->tools_menu)  submenu_cleanup(appdata->tools_menu);
1961    #endif
1962    
1963    gnome_vfs_shutdown();    gnome_vfs_shutdown();
1964    icons_free();    icons_free();
1965    gps_release(appdata);    gps_release(appdata);
# Line 1777  void cleanup(appdata_t *appdata) { Line 1988  void cleanup(appdata_t *appdata) {
1988    puts("everything is gone");    puts("everything is gone");
1989  }  }
1990    
1991  void on_window_destroy (GtkWidget *widget, gpointer data) {  static void on_window_destroy (GtkWidget *widget, gpointer data) {
1992    appdata_t *appdata = (appdata_t*)data;    appdata_t *appdata = (appdata_t*)data;
1993    
1994    gconf_save_state(appdata);    gconf_save_state(appdata);
# Line 1786  void on_window_destroy (GtkWidget *widge Line 1997  void on_window_destroy (GtkWidget *widge
1997  }  }
1998    
1999  gboolean on_window_key_press(GtkWidget *widget,  gboolean on_window_key_press(GtkWidget *widget,
2000                           GdkEventKey *event, gpointer data) {                           GdkEventKey *event, appdata_t *appdata) {
   appdata_t *appdata = (appdata_t*)data;  
2001    int handled = FALSE;    int handled = FALSE;
2002    
2003    //  printf("key event %d\n", event->keyval);    //  printf("key event %d\n", event->keyval);
# Line 1795  gboolean on_window_key_press(GtkWidget * Line 2005  gboolean on_window_key_press(GtkWidget *
2005    switch(event->keyval) {    switch(event->keyval) {
2006  #ifdef USE_MAEMO  #ifdef USE_MAEMO
2007    
 #if 0  /* don't do this as it interferes with gtkentry fields */  
   case HILDON_HARDKEY_SELECT:  
     /* remove as long as we haven't reached the main gpx list */  
     if(appdata->cur_gpx)  
       hildon_bread_crumb_trail_pop(HILDON_BREAD_CRUMB_TRAIL(appdata->bct));  
     handled = TRUE;  
     break;  
 #endif  
   
2008  #ifdef HILDON_HARDKEY_INCREASE  #ifdef HILDON_HARDKEY_INCREASE
2009    case HILDON_HARDKEY_INCREASE:    case HILDON_HARDKEY_INCREASE:
2010      html_zoom(appdata, TRUE);      html_zoom(appdata, TRUE);
# Line 1988  static void crumb_add(appdata_t *appdata Line 2189  static void crumb_add(appdata_t *appdata
2189  #endif // USE_BREAD_CRUMB_TRAIL  #endif // USE_BREAD_CRUMB_TRAIL
2190    
2191  void main_after_settings_redraw(appdata_t *appdata, int flags) {  void main_after_settings_redraw(appdata_t *appdata, int flags) {
2192      printf("main after settings redraw\n");
2193    
2194      if(!appdata->cur_view) {
2195        printf("no active view\n");
2196        return;
2197      }
2198    
2199  #ifndef USE_MAEMO  #ifndef USE_MAEMO
2200    // in non-maemo setup this can only affect the main screen as    // in non-maemo setup this can only affect the main screen as
2201    // the menu is blocked while a dialog is open. also the main    // the menu is blocked while a dialog is open. also the main
# Line 2023  void main_after_settings_redraw(appdata_ Line 2231  void main_after_settings_redraw(appdata_
2231    }    }
2232    
2233    if(redraw) {    if(redraw) {
2234      gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view);      GtkWidget *container = appdata->vbox;
2235    
2236    #ifdef USE_STACKABLE_WINDOW
2237        HildonWindowStack *stack = hildon_window_stack_get_default();
2238        container = hildon_window_stack_peek(stack);
2239    #endif
2240    
2241        gtk_container_remove(GTK_CONTAINER(container), appdata->cur_view);
2242      switch(redraw) {      switch(redraw) {
2243      case 1:      case 1:
2244        appdata->cur_view = cachelist_create(appdata,        appdata->cur_view = cachelist_create(appdata,
# Line 2038  void main_after_settings_redraw(appdata_ Line 2253  void main_after_settings_redraw(appdata_
2253        break;        break;
2254      }      }
2255    
2256      gtk_box_pack_start_defaults(GTK_BOX(appdata->vbox), appdata->cur_view);  #ifdef USE_STACKABLE_WINDOW
2257      gtk_widget_show_all(appdata->vbox);      if(container != appdata->vbox)
2258    }        gtk_container_add(GTK_CONTAINER(container), appdata->cur_view);
2259        else
2260  #endif  #endif
2261          gtk_box_pack_start_defaults(GTK_BOX(container), appdata->cur_view);
2262    
2263        gtk_widget_show_all(container);
2264      }
2265    #endif // USE_MAEMO
2266  }  }
2267    
2268  int main(int argc, char *argv[]) {  int main(int argc, char *argv[]) {
# Line 2070  int main(int argc, char *argv[]) { Line 2291  int main(int argc, char *argv[]) {
2291      fprintf(stderr, "error initiating osso context\n");      fprintf(stderr, "error initiating osso context\n");
2292    }    }
2293    
2294    #ifdef ENABLE_MAEMO_MAPPER
2295    dbus_register(&appdata);    dbus_register(&appdata);
2296  #endif  #endif
2297    #endif
2298    
2299    icons_init();    icons_init();
2300    
# Line 2098  int main(int argc, char *argv[]) { Line 2321  int main(int argc, char *argv[]) {
2321    gtk_window_set_default_size(GTK_WINDOW(appdata.window), 500, 300);    gtk_window_set_default_size(GTK_WINDOW(appdata.window), 500, 300);
2322  #endif  #endif
2323    
2324    #if MAEMO_VERSION_MAJOR == 5
2325    gtk_window_set_title(GTK_WINDOW(appdata.window), "GPXView");    gtk_window_set_title(GTK_WINDOW(appdata.window), "GPXView");
2326    #endif
2327    
2328    g_signal_connect(G_OBJECT(appdata.window), "destroy",    g_signal_connect(G_OBJECT(appdata.window), "destroy",
2329                     G_CALLBACK(on_window_destroy), &appdata);                     G_CALLBACK(on_window_destroy), &appdata);
2330    
# Line 2107  int main(int argc, char *argv[]) { Line 2333  int main(int argc, char *argv[]) {
2333    
2334    appdata.vbox = gtk_vbox_new(FALSE, 2);    appdata.vbox = gtk_vbox_new(FALSE, 2);
2335    gtk_container_add(GTK_CONTAINER(appdata.window), appdata.vbox);    gtk_container_add(GTK_CONTAINER(appdata.window), appdata.vbox);
   
2336  #ifndef USE_STACKABLE_WINDOW  #ifndef USE_STACKABLE_WINDOW
2337    menu_create(&appdata);    menu_create(&appdata);
2338  #else  #else

Legend:
Removed from v.6  
changed lines
  Added in v.123