Diff of /trunk/src/main.c

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

revision 15 by harbaum, Sun Jun 28 18:58:40 2009 UTC revision 107 by harbaum, Fri Sep 11 12:16:50 2009 UTC
# Line 138  gpx_t *choose_file(appdata_t *appdata, g Line 138  gpx_t *choose_file(appdata_t *appdata, g
138    gtk_widget_show_all (GTK_WIDGET(dialog));    gtk_widget_show_all (GTK_WIDGET(dialog));
139    if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_FM_OK) {    if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_FM_OK) {
140      char *filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));      char *filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
141    
142        if(filename) {
143          gpx_dialog_t *dialog = gpx_busy_dialog_new(GTK_WIDGET(appdata->window));
144    
145      gpx_dialog_t *dialog = gpx_busy_dialog_new(GTK_WIDGET(appdata->window));        if(!whole_dir)
146            gpx = gpx_parse(dialog, filename);
147      if(!whole_dir)        else {
148        gpx = gpx_parse(dialog, filename);          /* cur trailing '/' if present */
149      else {          if(strlastchr(filename) == '/')
150        /* cur trailing '/' if present */            filename[strlen(filename)] = 0;
151        if(strlastchr(filename) == '/')  
152          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 = '/';  
153        }        }
154    
155          gpx_busy_dialog_destroy(dialog);
156    
157          /* save path if gpx was successfully loaded */
158          if(gpx) {
159            char *r = strrchr(filename, '/');
160    
161            /* there is a delimiter, use everything left of it as path */
162            if(r && !whole_dir) {
163              *r = 0;
164              if(appdata->path) free(appdata->path);
165              appdata->path = strdup(filename);
166              /* restore path ... just in case ... */
167              *r = '/';
168            }
169    
170            if(whole_dir)
171              appdata->path = strdup(filename);
172          } else
173            errorf(_("Load error"));
174    
175        if(whole_dir)        g_free (filename);
176          appdata->path = strdup(filename);      } else {
177    #ifndef USE_MAEMO
178          errorf(_("Error accessing the file."));
179    #else
180          errorf(_("Error accessing the file. This may happen if the file "
181                   "resides on a remote file system. Please copy the file onto "
182                   "the device (e.g. onto the memory card) and try again."));
183    #endif
184      }      }
   
     g_free (filename);  
185    }    }
186    
187    gtk_widget_destroy (dialog);    gtk_widget_destroy (dialog);
# Line 202  void cachelist_view_onRowActivated(GtkTr Line 213  void cachelist_view_onRowActivated(GtkTr
213    GtkTreeIter   iter;    GtkTreeIter   iter;
214    GtkTreeModel *model = gtk_tree_view_get_model(treeview);    GtkTreeModel *model = gtk_tree_view_get_model(treeview);
215    
216    #ifdef USE_MAEMO
217      /* check if a cache is already selected and ignore click if yes */
218      /* (was probably a double click) */
219      if(appdata->cur_cache) return;
220    #endif
221    
222    if(gtk_tree_model_get_iter(model, &iter, path)) {    if(gtk_tree_model_get_iter(model, &iter, path)) {
223      cache_t *cache;      cache_t *cache;
224      gtk_tree_model_get(model, &iter, CACHELIST_COL_DATA, &cache, -1);      gtk_tree_model_get(model, &iter, CACHELIST_COL_DATA, &cache, -1);
# Line 587  void cachelist_dialog(appdata_t *appdata Line 604  void cachelist_dialog(appdata_t *appdata
604    g_object_set_data(G_OBJECT(window), "cur_view", appdata->cur_view);    g_object_set_data(G_OBJECT(window), "cur_view", appdata->cur_view);
605    
606    appdata->cur_gpx = gpx;    appdata->cur_gpx = gpx;
607    char *title = g_strdup_printf("GPXView - %s", gpx->name);    char *title = g_strdup_printf("%s - GPXView", gpx->name);
608    gtk_window_set_title(GTK_WINDOW(window), title);    gtk_window_set_title(GTK_WINDOW(window), title);
609    g_free(title);    g_free(title);
610    
# Line 713  static void gpxlist_view_onRowActivated( Line 730  static void gpxlist_view_onRowActivated(
730    GtkTreeIter   iter;    GtkTreeIter   iter;
731    GtkTreeModel *model = gtk_tree_view_get_model(treeview);    GtkTreeModel *model = gtk_tree_view_get_model(treeview);
732    
733    #ifdef USE_MAEMO
734      /* check if a cache is already selected and ignore click if yes */
735      /* (was probably a double click) */
736      if(appdata->cur_gpx) return;
737    #endif
738    
739    if (gtk_tree_model_get_iter(model, &iter, path)) {    if (gtk_tree_model_get_iter(model, &iter, path)) {
740      gpx_t *gpx;      gpx_t *gpx;
741      gtk_tree_model_get(model, &iter, GPXLIST_COL_DATA, &gpx, -1);      gtk_tree_model_get(model, &iter, GPXLIST_COL_DATA, &gpx, -1);
# Line 954  static GtkWidget *gpxlist_create_view_an Line 977  static GtkWidget *gpxlist_create_view_an
977    GtkTreeIter sel_iter;    GtkTreeIter sel_iter;
978    gboolean sel_iter_valid = FALSE;    gboolean sel_iter_valid = FALSE;
979    while(gpx) {    while(gpx) {
980      GtkTreeIter         iter;      /* don't display entries that failed at load */
981      gtk_list_store_append(appdata->gpxstore, &iter);      if(!gpx->failed) {
982      gpxlist_set(appdata->gpxstore, &iter, gpx);        GtkTreeIter         iter;
983          gtk_list_store_append(appdata->gpxstore, &iter);
984      if(gpx == sel_gpx) {        gpxlist_set(appdata->gpxstore, &iter, gpx);
985        sel_iter = iter;  
986        sel_iter_valid = TRUE;        if(gpx == sel_gpx) {
987            sel_iter = iter;
988            sel_iter_valid = TRUE;
989          }
990      }      }
991    
992      gpx = gpx->next;      gpx = gpx->next;
# Line 1017  static void gpxlist_add(appdata_t *appda Line 1043  static void gpxlist_add(appdata_t *appda
1043    
1044  /******************** begin of menu *********************/  /******************** begin of menu *********************/
1045    
1046    typedef struct {
1047      appdata_t *appdata;
1048      GtkWidget *dialog;
1049    } about_context_t;
1050    
1051    #ifdef ENABLE_BROWSER_INTERFACE
1052    void on_paypal_button_clicked(GtkButton *button, about_context_t *context) {
1053      gtk_dialog_response(GTK_DIALOG(context->dialog), GTK_RESPONSE_ACCEPT);
1054      browser_url(context->appdata,
1055                  "https://www.paypal.com/cgi-bin/webscr"
1056                  "?cmd=_s-xclick&hosted_button_id=7400558");
1057    }
1058    #endif
1059    
1060  static void  static void
1061  cb_menu_about(GtkWidget *window, gpointer data) {  cb_menu_about(GtkWidget *window, gpointer data) {
1062    GtkAboutDialog *about = GTK_ABOUT_DIALOG(gtk_about_dialog_new());    about_context_t context;
1063    
1064    gtk_about_dialog_set_name(about, "GPXView");    context.appdata = (appdata_t *)data;
   gtk_about_dialog_set_version(about, VERSION);  
1065    
1066  #ifdef ENABLE_LIBLOCATION  #ifdef ENABLE_LIBLOCATION
1067    char *uses = "uses liblocation";    char *uses = "uses liblocation";
# Line 1032  cb_menu_about(GtkWidget *window, gpointe Line 1071  cb_menu_about(GtkWidget *window, gpointe
1071    char *uses = "uses gpsd";    char *uses = "uses gpsd";
1072  #endif  #endif
1073    
1074    char *str = g_strdup_printf("%s\n\n(%s)",    const gchar *authors[] = {
1075                                _("GPXView (c) 2008 by\n"      "Till Harbaum <till@harbaum.org>",
1076                                  "Till Harbaum <till@harbaum.org>\n"      "John Stowers <john.stowers@gmail.com>",
1077                                  "Geocaching.com: Tantil"),      NULL };
1078                                _(uses)  
1079                                );    context.dialog = g_object_new(GTK_TYPE_ABOUT_DIALOG,
1080                            "name", "GPXView",
1081    gtk_about_dialog_set_copyright(about, str);                          "version", VERSION,
1082    g_free(str);                          "copyright", _("Copyright 2008-2009"),
1083                            "authors", authors,
1084    gtk_about_dialog_set_website(about,                          "website", _("http://www.harbaum.org/till/maemo"),
1085         _("http://www.harbaum.org/till/maemo"));                          "comments", _(uses),
1086                            NULL);
1087    gtk_about_dialog_set_comments(about,  
1088         _("Geocaching.com GPX file viewer"));  #ifdef ENABLE_BROWSER_INTERFACE
1089      /* add a way to donate to the project */
1090    gtk_widget_show_all(GTK_WIDGET(about));    GtkWidget *alignment = gtk_alignment_new(0.5, 0, 0, 0);
1091    gtk_dialog_run(GTK_DIALOG(about));  
1092    gtk_widget_destroy(GTK_WIDGET(about));    GtkWidget *hbox = gtk_hbox_new(FALSE, 8);
1093      gtk_box_pack_start(GTK_BOX(hbox),
1094                         gtk_label_new(_("Do you like GPXView?")),
1095                         FALSE, FALSE, 0);
1096    
1097      GtkWidget *button = gtk_button_new();
1098      gtk_button_set_image(GTK_BUTTON(button),
1099                           icon_get_widget(ICON_MISC, 8));
1100      gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
1101      g_signal_connect(button, "clicked",
1102                       G_CALLBACK(on_paypal_button_clicked), &context);
1103      gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
1104    
1105      gtk_container_add(GTK_CONTAINER(alignment), hbox);
1106      gtk_box_pack_start_defaults(GTK_BOX((GTK_DIALOG(context.dialog))->vbox),
1107                                  alignment);
1108    
1109      gtk_widget_show_all(alignment);
1110    #endif
1111    
1112      gtk_dialog_run(GTK_DIALOG(context.dialog));
1113      gtk_widget_destroy(context.dialog);
1114  }  }
1115    
1116  #if defined(USE_MAEMO) && defined(HILDON_HELP)  #if defined(USE_MAEMO) && defined(HILDON_HELP)
# Line 1433  cb_menu_search(GtkWidget *window, gpoint Line 1493  cb_menu_search(GtkWidget *window, gpoint
1493      gtk_widget_destroy(dialog);      gtk_widget_destroy(dialog);
1494  }  }
1495    
1496  void on_window_destroy (GtkWidget *widget, gpointer data);  static void on_window_destroy (GtkWidget *widget, gpointer data);
1497    
1498  #ifndef USE_MAEMO  #ifndef USE_MAEMO
1499  static void  static void
# Line 1509  cb_menu_export_garmin(GtkWidget *widget, Line 1569  cb_menu_export_garmin(GtkWidget *widget,
1569    garmin_export(appdata);    garmin_export(appdata);
1570  }  }
1571    
1572    #ifdef ENABLE_OSM_GPS_MAP
1573    static void
1574    cb_menu_map(GtkWidget *window, gpointer data) {
1575      map((appdata_t *)data);
1576    }
1577    #endif
1578    
1579  static void  static void
1580  cb_menu_geomath(GtkWidget *window, gpointer data) {  cb_menu_geomath(GtkWidget *window, gpointer data) {
1581    geomath_dialog((appdata_t *)data);    geomath_dialog((appdata_t *)data);
# Line 1525  cb_menu_precpos(GtkWidget *window, gpoin Line 1592  cb_menu_precpos(GtkWidget *window, gpoin
1592  }  }
1593    
1594  #ifdef USE_STACKABLE_WINDOW  #ifdef USE_STACKABLE_WINDOW
1595  static void on_export_destroy(GtkWidget *widget, appdata_t *appdata) {  typedef struct {
1596    appdata->cur_view = g_object_get_data(G_OBJECT(widget), "cur_view");    char *label, *desc;
1597  }    GtkSignalFunc activate_cb;
1598    } menu_entry_t;
1599    
1600  void on_export_clicked(GtkButton *button, appdata_t *appdata) {  typedef struct {
1601    HildonStackableWindow *view_window;    const char *title;
1602    GtkWidget *but;    const menu_entry_t *menu;
1603      int len;
1604    } submenu_t;
1605    
1606    view_window = HILDON_STACKABLE_WINDOW (hildon_stackable_window_new ());  #define COLUMNS  1
   gtk_window_set_title (GTK_WINDOW (view_window), "GPXView - Export");  
1607    
1608     /* store last "cur_view" in window */  void on_submenu_entry_clicked(GtkButton *button, GtkWidget *menu) {
   g_object_set_data(G_OBJECT(view_window), "cur_view", appdata->cur_view);  
   appdata->cur_view = NULL;  
1609    
1610    g_signal_connect(G_OBJECT(view_window), "destroy",    /* force closing of submenu dialog */
1611                     G_CALLBACK(on_export_destroy), appdata);    gtk_dialog_response(GTK_DIALOG(menu), GTK_RESPONSE_NONE);
1612      gtk_widget_hide(menu);
1613    
1614      /* let gtk clean up */
1615      while(gtk_events_pending())
1616        gtk_main_iteration();
1617    }
1618    
1619    GtkVBox *contents = GTK_VBOX(gtk_vbox_new (12, FALSE));  static GtkWidget *app_submenu_create(appdata_t *appdata,
1620                                         const submenu_t *submenu) {
1621    
1622    but = hildon_button_new_with_text(    /* create a oridinary dialog box */
1623              HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH,    GtkWidget *dialog = gtk_dialog_new();
1624              HILDON_BUTTON_ARRANGEMENT_VERTICAL,    gtk_window_set_title(GTK_WINDOW(dialog), _(submenu->title));
1625              _("Export to Maemo Mapper"),    gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
1626              _("Save a Maemo Mapper POI file"));    gtk_window_set_transient_for(GTK_WINDOW(dialog),
1627    g_signal_connect(but, "clicked",                                 GTK_WINDOW(appdata->window));
1628                     G_CALLBACK(cb_menu_export_mmpoi), appdata);    gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
   gtk_box_pack_start(GTK_BOX(contents), but, FALSE, FALSE, 0);  
1629    
1630      GtkWidget *table = gtk_table_new(submenu->len/COLUMNS, COLUMNS, TRUE);
1631      int x = 0, y = 0;
1632    
1633    but = hildon_button_new_with_text(    const menu_entry_t *menu_entries = submenu->menu;
1634              HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH,    while(menu_entries->label) {
1635              HILDON_BUTTON_ARRANGEMENT_VERTICAL,      GtkWidget *button = NULL;
             _("Export Field Notes"),  
             _("Save a Garmin Field Notes file"));  
   g_signal_connect(but, "clicked",  
                    G_CALLBACK(cb_menu_export_log), appdata);  
   gtk_box_pack_start(GTK_BOX(contents), but, FALSE, FALSE, 0);  
   
1636    
1637    but = hildon_button_new_with_text(      button = hildon_button_new_with_text(
1638              HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH,              HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH,
1639              HILDON_BUTTON_ARRANGEMENT_VERTICAL,              HILDON_BUTTON_ARRANGEMENT_VERTICAL,
1640              _("Export Garmin GPX"),              _(menu_entries->label), _(menu_entries->desc));
             _("Save a GPX file containing modified waypoints"));  
   g_signal_connect(but, "clicked",  
                    G_CALLBACK(cb_menu_export_garmin), appdata);  
   gtk_box_pack_start(GTK_BOX(contents), but, FALSE, FALSE, 0);  
1641    
1642    gtk_container_add (GTK_CONTAINER (view_window), GTK_WIDGET (contents));      /* try to center both texts */
1643    gtk_widget_show_all (GTK_WIDGET (view_window));      hildon_button_set_title_alignment(HILDON_BUTTON(button), 0.5, 0.5);
1644  }      hildon_button_set_value_alignment(HILDON_BUTTON(button), 0.5, 0.5);
1645    
1646  static void on_tools_destroy(GtkWidget *widget, appdata_t *appdata) {      g_signal_connect(button, "clicked",
1647    appdata->cur_view = g_object_get_data(G_OBJECT(widget), "cur_view");                       G_CALLBACK(on_submenu_entry_clicked), dialog);
1648  }  
1649        g_signal_connect(button, "clicked",
1650                         menu_entries->activate_cb, appdata);
1651    
1652        gtk_table_attach_defaults(GTK_TABLE(table),  button, x, x+1, y, y+1);
1653    
1654        x++;
1655        if(x == COLUMNS) { x = 0; y++; }
1656    
1657  void on_tools_clicked(GtkButton *button, appdata_t *appdata) {      menu_entries++;
1658    HildonStackableWindow *view_window;    }
   GtkWidget *but;  
1659    
1660    view_window = HILDON_STACKABLE_WINDOW (hildon_stackable_window_new ());    gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox), table);
   gtk_window_set_title (GTK_WINDOW (view_window), "GPXView - Tools");  
1661    
1662     /* store last "cur_view" in window */    return dialog;
1663    g_object_set_data(G_OBJECT(view_window), "cur_view", appdata->cur_view);  }
   appdata->cur_view = NULL;  
1664    
1665    g_signal_connect(G_OBJECT(view_window), "destroy",  /* popup the dialog shaped submenu */
1666                     G_CALLBACK(on_tools_destroy), appdata);  static void submenu_popup(GtkWidget *menu) {
1667      gtk_widget_show_all(menu);
1668      gtk_dialog_run(GTK_DIALOG(menu));
1669      gtk_widget_hide(menu);
1670    }
1671    
1672    GtkVBox *contents = GTK_VBOX(gtk_vbox_new (12, FALSE));  static void submenu_cleanup(GtkWidget *menu) {
1673      gtk_widget_destroy(menu);
1674    }
1675    
1676    but = hildon_button_new_with_text(  static const menu_entry_t submenu_export_entries[] = {
1677              HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH,    { "Export to Maemo Mapper" , "Save a Maemo Mapper POI file",
1678              HILDON_BUTTON_ARRANGEMENT_VERTICAL,      G_CALLBACK(cb_menu_export_mmpoi)  },
1679              _("Geomath"),    { "Export Field Notes",      "Save a Garmin Field Notes file",
1680              _("Geocoordinate calculation"));      G_CALLBACK(cb_menu_export_log)    },
1681    g_signal_connect(but, "clicked",    { "Export Garmin GPX",       "Save modified waypoints in GPX file",
1682                     G_CALLBACK(cb_menu_geomath), appdata);      G_CALLBACK(cb_menu_export_garmin) },
1683    gtk_box_pack_start(GTK_BOX(contents), but, FALSE, FALSE, 0);    { NULL, NULL, NULL }
1684    };
1685    
1686    static const submenu_t submenu_export = {
1687      "Export", submenu_export_entries,
1688      sizeof(submenu_export_entries)/sizeof(menu_entry_t)-1
1689    };
1690    
1691    but = hildon_button_new_with_text(  /* the export submenu */
1692              HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH,  void on_export_clicked(GtkButton *button, appdata_t *appdata) {
1693              HILDON_BUTTON_ARRANGEMENT_VERTICAL,    if(!appdata->export_menu)
1694              _("Geotext"),      appdata->export_menu = app_submenu_create(appdata, &submenu_export);
             _("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);  
   
1695    
1696    but = hildon_button_new_with_text(    submenu_popup(appdata->export_menu);
1697              HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH,  }
1698              HILDON_BUTTON_ARRANGEMENT_VERTICAL,  
1699              _("Precise Position"),  static const menu_entry_t submenu_tools_entries[] = {
1700              _("Calculate a very precise GPS position"));    { "Geomath",          "Geocoordinate calculation",
1701    g_signal_connect(but, "clicked",      G_CALLBACK(cb_menu_geomath) },
1702                     G_CALLBACK(cb_menu_precpos), appdata);    { "Geotext",          "Text analysis",
1703    gtk_box_pack_start(GTK_BOX(contents), but, FALSE, FALSE, 0);      G_CALLBACK(cb_menu_geotext) },
1704      { "Precise Position", "Calculate a precise GPS position",
1705        G_CALLBACK(cb_menu_precpos) },
1706      { NULL, NULL, NULL }
1707    };
1708    
1709    static const submenu_t submenu_tools = {
1710      "Tools", submenu_tools_entries,
1711      sizeof(submenu_tools_entries)/sizeof(menu_entry_t)-1
1712    };
1713    
1714    gtk_container_add (GTK_CONTAINER (view_window), GTK_WIDGET (contents));  /* the tools submenu */
1715    gtk_widget_show_all (GTK_WIDGET (view_window));  void on_tools_clicked(GtkButton *button, appdata_t *appdata) {
1716      if(!appdata->tools_menu)
1717        appdata->tools_menu = app_submenu_create(appdata, &submenu_tools);
1718    
1719      submenu_popup(appdata->tools_menu);
1720  }  }
1721    
1722  HildonAppMenu *menu_create(appdata_t *appdata, int mode) {  HildonAppMenu *menu_create(appdata_t *appdata, int mode) {
# Line 1656  HildonAppMenu *menu_create(appdata_t *ap Line 1744  HildonAppMenu *menu_create(appdata_t *ap
1744      g_signal_connect_after(button, "clicked",      g_signal_connect_after(button, "clicked",
1745                             G_CALLBACK(cb_menu_adddir), appdata);                             G_CALLBACK(cb_menu_adddir), appdata);
1746      hildon_app_menu_append(menu, GTK_BUTTON(button));      hildon_app_menu_append(menu, GTK_BUTTON(button));
   }  
1747    
   if(mode == MENU_GPXLIST) {  
1748      button = gtk_button_new_with_label(_("Export"));      button = gtk_button_new_with_label(_("Export"));
1749      g_signal_connect_after(button, "clicked",      g_signal_connect_after(button, "clicked",
1750                             G_CALLBACK(on_export_clicked), appdata);                             G_CALLBACK(on_export_clicked), appdata);
# Line 1675  HildonAppMenu *menu_create(appdata_t *ap Line 1761  HildonAppMenu *menu_create(appdata_t *ap
1761                           G_CALLBACK(on_tools_clicked), appdata);                           G_CALLBACK(on_tools_clicked), appdata);
1762    hildon_app_menu_append(menu, GTK_BUTTON(button));    hildon_app_menu_append(menu, GTK_BUTTON(button));
1763    
1764    #ifdef ENABLE_OSM_GPS_MAP
1765      if((mode == MENU_GPXLIST) || (mode == MENU_CACHELIST)) {
1766        button = gtk_button_new_with_label(_("Map"));
1767        g_signal_connect_after(button, "clicked",
1768                               G_CALLBACK(cb_menu_map), appdata);
1769        hildon_app_menu_append(menu, GTK_BUTTON(button));
1770      }
1771    #endif
1772    
1773  #ifdef HILDON_HELP  #ifdef HILDON_HELP
1774    button = gtk_button_new_with_label(_("Help"));    button = gtk_button_new_with_label(_("Help"));
1775    g_signal_connect_after(button, "clicked",    g_signal_connect_after(button, "clicked",
# Line 1787  void menu_create(appdata_t *appdata) { Line 1882  void menu_create(appdata_t *appdata) {
1882    
1883    gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new());    gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new());
1884    
1885    #ifdef ENABLE_OSM_GPS_MAP
1886      item = gtk_menu_item_new_with_label( _("Map") );
1887      gtk_menu_append(GTK_MENU_SHELL(menu), item);
1888      g_signal_connect(item, "activate",
1889                       GTK_SIGNAL_FUNC(cb_menu_map), appdata);
1890    #endif
1891    
1892    item = gtk_menu_item_new_with_label(_("Tools"));    item = gtk_menu_item_new_with_label(_("Tools"));
1893    gtk_menu_append(GTK_MENU_SHELL(menu), item);    gtk_menu_append(GTK_MENU_SHELL(menu), item);
1894    submenu = gtk_menu_new();    submenu = gtk_menu_new();
# Line 1851  void cleanup(appdata_t *appdata) { Line 1953  void cleanup(appdata_t *appdata) {
1953    if(appdata->image_path) free(appdata->image_path);    if(appdata->image_path) free(appdata->image_path);
1954    if(appdata->search_str) free(appdata->search_str);    if(appdata->search_str) free(appdata->search_str);
1955    
1956    #ifdef USE_STACKABLE_WINDOW
1957      if(appdata->export_menu) submenu_cleanup(appdata->export_menu);
1958      if(appdata->tools_menu)  submenu_cleanup(appdata->tools_menu);
1959    #endif
1960    
1961    gnome_vfs_shutdown();    gnome_vfs_shutdown();
1962    icons_free();    icons_free();
1963    gps_release(appdata);    gps_release(appdata);
# Line 1879  void cleanup(appdata_t *appdata) { Line 1986  void cleanup(appdata_t *appdata) {
1986    puts("everything is gone");    puts("everything is gone");
1987  }  }
1988    
1989  void on_window_destroy (GtkWidget *widget, gpointer data) {  static void on_window_destroy (GtkWidget *widget, gpointer data) {
1990    appdata_t *appdata = (appdata_t*)data;    appdata_t *appdata = (appdata_t*)data;
1991    
1992    gconf_save_state(appdata);    gconf_save_state(appdata);
# Line 2222  int main(int argc, char *argv[]) { Line 2329  int main(int argc, char *argv[]) {
2329    
2330    appdata.vbox = gtk_vbox_new(FALSE, 2);    appdata.vbox = gtk_vbox_new(FALSE, 2);
2331    gtk_container_add(GTK_CONTAINER(appdata.window), appdata.vbox);    gtk_container_add(GTK_CONTAINER(appdata.window), appdata.vbox);
   
2332  #ifndef USE_STACKABLE_WINDOW  #ifndef USE_STACKABLE_WINDOW
2333    menu_create(&appdata);    menu_create(&appdata);
2334  #else  #else

Legend:
Removed from v.15  
changed lines
  Added in v.107