Diff of /trunk/src/main.c

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

revision 21 by harbaum, Sun Jul 5 17:38:06 2009 UTC revision 113 by harbaum, Wed Sep 16 13:45:10 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 957  static GtkWidget *gpxlist_create_view_an Line 980  static GtkWidget *gpxlist_create_view_an
980      GtkTreeIter         iter;      GtkTreeIter         iter;
981      gtk_list_store_append(appdata->gpxstore, &iter);      gtk_list_store_append(appdata->gpxstore, &iter);
982      gpxlist_set(appdata->gpxstore, &iter, gpx);      gpxlist_set(appdata->gpxstore, &iter, gpx);
983    
984      if(gpx == sel_gpx) {      if(gpx == sel_gpx) {
985        sel_iter = iter;        sel_iter = iter;
986        sel_iter_valid = TRUE;        sel_iter_valid = TRUE;
# Line 1017  static void gpxlist_add(appdata_t *appda Line 1040  static void gpxlist_add(appdata_t *appda
1040    
1041  /******************** begin of menu *********************/  /******************** begin of menu *********************/
1042    
1043    typedef struct {
1044      appdata_t *appdata;
1045      GtkWidget *dialog;
1046    } about_context_t;
1047    
1048    #ifdef ENABLE_BROWSER_INTERFACE
1049    void on_paypal_button_clicked(GtkButton *button, about_context_t *context) {
1050      gtk_dialog_response(GTK_DIALOG(context->dialog), GTK_RESPONSE_ACCEPT);
1051      browser_url(context->appdata,
1052                  "https://www.paypal.com/cgi-bin/webscr"
1053                  "?cmd=_s-xclick&hosted_button_id=7400558");
1054    }
1055    #endif
1056    
1057  static void  static void
1058  cb_menu_about(GtkWidget *window, gpointer data) {  cb_menu_about(GtkWidget *window, gpointer data) {
1059    GtkAboutDialog *about = GTK_ABOUT_DIALOG(gtk_about_dialog_new());    about_context_t context;
1060    
1061    gtk_about_dialog_set_name(about, "GPXView");    context.appdata = (appdata_t *)data;
   gtk_about_dialog_set_version(about, VERSION);  
1062    
1063  #ifdef ENABLE_LIBLOCATION  #ifdef ENABLE_LIBLOCATION
1064    char *uses = "uses liblocation";    char *uses = "uses liblocation";
# Line 1032  cb_menu_about(GtkWidget *window, gpointe Line 1068  cb_menu_about(GtkWidget *window, gpointe
1068    char *uses = "uses gpsd";    char *uses = "uses gpsd";
1069  #endif  #endif
1070    
1071    char *str = g_strdup_printf("%s\n\n(%s)",    const gchar *authors[] = {
1072                        _("GPXView (c) 2008-2009 by\n"      "Till Harbaum <till@harbaum.org>",
1073                          "Till Harbaum <till@harbaum.org>\n"      "John Stowers <john.stowers@gmail.com>",
1074                          "Mailing list: gpxview-users@garage.maemo.org"),      NULL };
1075                        _(uses)  
1076                        );    context.dialog = g_object_new(GTK_TYPE_ABOUT_DIALOG,
1077                            "name", "GPXView",
1078    gtk_about_dialog_set_copyright(about, str);                          "version", VERSION,
1079    g_free(str);                          "copyright", _("Copyright 2008-2009"),
1080                            "authors", authors,
1081    gtk_about_dialog_set_website(about,                          "website", _("http://www.harbaum.org/till/maemo"),
1082         _("http://www.harbaum.org/till/maemo"));                          "comments", _(uses),
1083                            NULL);
1084    gtk_about_dialog_set_comments(about,  
1085         _("Geocaching.com GPX file viewer"));  #ifdef ENABLE_BROWSER_INTERFACE
1086      /* add a way to donate to the project */
1087    gtk_widget_show_all(GTK_WIDGET(about));    GtkWidget *alignment = gtk_alignment_new(0.5, 0, 0, 0);
1088    gtk_dialog_run(GTK_DIALOG(about));  
1089    gtk_widget_destroy(GTK_WIDGET(about));    GtkWidget *hbox = gtk_hbox_new(FALSE, 8);
1090      gtk_box_pack_start(GTK_BOX(hbox),
1091                         gtk_label_new(_("Do you like GPXView?")),
1092                         FALSE, FALSE, 0);
1093    
1094      GtkWidget *button = gtk_button_new();
1095      gtk_button_set_image(GTK_BUTTON(button),
1096                           icon_get_widget(ICON_MISC, 8));
1097      gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
1098      g_signal_connect(button, "clicked",
1099                       G_CALLBACK(on_paypal_button_clicked), &context);
1100      gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
1101    
1102      gtk_container_add(GTK_CONTAINER(alignment), hbox);
1103      gtk_box_pack_start_defaults(GTK_BOX((GTK_DIALOG(context.dialog))->vbox),
1104                                  alignment);
1105    
1106      gtk_widget_show_all(alignment);
1107    #endif
1108    
1109      gtk_dialog_run(GTK_DIALOG(context.dialog));
1110      gtk_widget_destroy(context.dialog);
1111  }  }
1112    
1113  #if defined(USE_MAEMO) && defined(HILDON_HELP)  #if defined(USE_MAEMO) && defined(HILDON_HELP)
# Line 1433  cb_menu_search(GtkWidget *window, gpoint Line 1490  cb_menu_search(GtkWidget *window, gpoint
1490      gtk_widget_destroy(dialog);      gtk_widget_destroy(dialog);
1491  }  }
1492    
1493  void on_window_destroy (GtkWidget *widget, gpointer data);  static void on_window_destroy (GtkWidget *widget, gpointer data);
1494    
1495  #ifndef USE_MAEMO  #ifndef USE_MAEMO
1496  static void  static void
# Line 1493  static void Line 1550  static void
1550  cb_menu_export_log(GtkWidget *widget, gpointer data) {  cb_menu_export_log(GtkWidget *widget, gpointer data) {
1551    appdata_t *appdata = (appdata_t*)data;    appdata_t *appdata = (appdata_t*)data;
1552    notes_log_export(appdata);    notes_log_export(appdata);
 #ifdef USE_STACKABLE_WINDOW  
   hildon_window_stack_pop_1 (hildon_window_stack_get_default());  
 #endif  
1553  }  }
1554    
1555  #ifdef USE_MAEMO  #ifdef USE_MAEMO
# Line 1503  static void Line 1557  static void
1557  cb_menu_export_mmpoi(GtkWidget *widget, gpointer data) {  cb_menu_export_mmpoi(GtkWidget *widget, gpointer data) {
1558    appdata_t *appdata = (appdata_t*)data;    appdata_t *appdata = (appdata_t*)data;
1559    mmpoi_export(appdata);    mmpoi_export(appdata);
 #ifdef USE_STACKABLE_WINDOW  
   hildon_window_stack_pop_1 (hildon_window_stack_get_default());  
 #endif  
1560  }  }
1561  #endif  #endif
1562    
# Line 1513  static void Line 1564  static void
1564  cb_menu_export_garmin(GtkWidget *widget, gpointer data) {  cb_menu_export_garmin(GtkWidget *widget, gpointer data) {
1565    appdata_t *appdata = (appdata_t*)data;    appdata_t *appdata = (appdata_t*)data;
1566    garmin_export(appdata);    garmin_export(appdata);
 #ifdef USE_STACKABLE_WINDOW  
   hildon_window_stack_pop_1 (hildon_window_stack_get_default());  
 #endif  
1567  }  }
1568    
1569    #ifdef ENABLE_OSM_GPS_MAP
1570    static void
1571    cb_menu_map(GtkWidget *window, gpointer data) {
1572      map((appdata_t *)data);
1573    }
1574    #endif
1575    
1576  static void  static void
1577  cb_menu_geomath(GtkWidget *window, gpointer data) {  cb_menu_geomath(GtkWidget *window, gpointer data) {
1578    geomath_dialog((appdata_t *)data);    geomath_dialog((appdata_t *)data);
 #ifdef USE_STACKABLE_WINDOW  
   hildon_window_stack_pop_1 (hildon_window_stack_get_default());  
 #endif  
1579  }  }
1580    
1581  static void  static void
1582  cb_menu_geotext(GtkWidget *window, gpointer data) {  cb_menu_geotext(GtkWidget *window, gpointer data) {
1583    geotext_dialog((appdata_t *)data);    geotext_dialog((appdata_t *)data);
 #ifdef USE_STACKABLE_WINDOW  
   hildon_window_stack_pop_1 (hildon_window_stack_get_default());  
 #endif  
1584  }  }
1585    
1586  static void  static void
1587  cb_menu_precpos(GtkWidget *window, gpointer data) {  cb_menu_precpos(GtkWidget *window, gpointer data) {
1588    precise_position((appdata_t *)data);    precise_position((appdata_t *)data);
 #ifdef USE_STACKABLE_WINDOW  
   hildon_window_stack_pop_1 (hildon_window_stack_get_default());  
 #endif  
1589  }  }
1590    
1591  #ifdef USE_STACKABLE_WINDOW  #ifdef USE_STACKABLE_WINDOW
1592  static GtkWidget *export_menu_create(appdata_t *appdata) {  typedef struct {
1593    GtkWidget *button;    char *label, *desc;
1594    HildonAppMenu *menu = HILDON_APP_MENU(hildon_app_menu_new());    GtkSignalFunc activate_cb;
1595    } menu_entry_t;
   button = hildon_button_new_with_text(  
             HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH,  
             HILDON_BUTTON_ARRANGEMENT_VERTICAL,  
             _("Export to Maemo Mapper"),  
             _("Save a Maemo Mapper POI file"));  
   g_signal_connect(button, "clicked",  
                    G_CALLBACK(cb_menu_export_mmpoi), appdata);  
   hildon_app_menu_append(menu, GTK_BUTTON(button));  
1596    
1597    button = hildon_button_new_with_text(  typedef struct {
1598              HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH,    const char *title;
1599              HILDON_BUTTON_ARRANGEMENT_VERTICAL,    const menu_entry_t *menu;
1600              _("Export Field Notes"),    int len;
1601              _("Save a Garmin Field Notes file"));  } submenu_t;
   g_signal_connect(button, "clicked",  
                    G_CALLBACK(cb_menu_export_log), appdata);  
   hildon_app_menu_append(menu, GTK_BUTTON(button));  
1602    
1603    button = hildon_button_new_with_text(  #define COLUMNS  1
             HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH,  
             HILDON_BUTTON_ARRANGEMENT_VERTICAL,  
             _("Export Garmin GPX"),  
             _("Save modified waypoints in GPX file"));  
   g_signal_connect(button, "clicked",  
                    G_CALLBACK(cb_menu_export_garmin), appdata);  
   hildon_app_menu_append(menu, GTK_BUTTON(button));  
1604    
1605    gtk_widget_show_all(GTK_WIDGET(menu));  void on_submenu_entry_clicked(GtkButton *button, GtkWidget *menu) {
1606    
1607    return GTK_WIDGET(menu);    /* force closing of submenu dialog */
1608      gtk_dialog_response(GTK_DIALOG(menu), GTK_RESPONSE_NONE);
1609      gtk_widget_hide(menu);
1610    
1611      /* let gtk clean up */
1612      while(gtk_events_pending())
1613        gtk_main_iteration();
1614  }  }
1615    
1616  /* the export submenu */  static GtkWidget *app_submenu_create(appdata_t *appdata,
1617  void on_export_clicked(GtkButton *button, appdata_t *appdata) {                                       const submenu_t *submenu) {
   if(!appdata->export_menu)  
     appdata->export_menu = export_menu_create(appdata);  
1618    
1619    /* draw a popup menu */    /* create a oridinary dialog box */
1620    hildon_app_menu_popup(HILDON_APP_MENU(appdata->export_menu),    GtkWidget *dialog = gtk_dialog_new();
1621                          GTK_WINDOW(hildon_window_stack_peek(    gtk_window_set_title(GTK_WINDOW(dialog), _(submenu->title));
1622                      hildon_window_stack_get_default())));    gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
1623  }    gtk_window_set_transient_for(GTK_WINDOW(dialog),
1624                                   GTK_WINDOW(appdata->window));
1625      gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
1626    
1627  static GtkWidget *tools_menu_create(appdata_t *appdata) {    GtkWidget *table = gtk_table_new(submenu->len/COLUMNS, COLUMNS, TRUE);
1628    GtkWidget *button;    int x = 0, y = 0;
   HildonAppMenu *menu = HILDON_APP_MENU(hildon_app_menu_new());  
1629    
1630    /* the following doesn't have an effect */    const menu_entry_t *menu_entries = submenu->menu;
1631    //  gtk_window_set_title(GTK_WINDOW(menu), "Tools");    while(menu_entries->label) {
1632        GtkWidget *button = NULL;
1633    
1634    button = hildon_button_new_with_text(      button = hildon_button_new_with_text(
1635              HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH,              HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH,
1636              HILDON_BUTTON_ARRANGEMENT_VERTICAL,              HILDON_BUTTON_ARRANGEMENT_VERTICAL,
1637              _("Geomath"),              _(menu_entries->label), _(menu_entries->desc));
             _("Geocoordinate calculation"));  
   g_signal_connect(button, "clicked",  
                    G_CALLBACK(cb_menu_geomath), appdata);  
   hildon_app_menu_append(menu, GTK_BUTTON(button));  
1638    
1639        /* try to center both texts */
1640        hildon_button_set_title_alignment(HILDON_BUTTON(button), 0.5, 0.5);
1641        hildon_button_set_value_alignment(HILDON_BUTTON(button), 0.5, 0.5);
1642    
1643    button = hildon_button_new_with_text(      g_signal_connect(button, "clicked",
1644              HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH,                       G_CALLBACK(on_submenu_entry_clicked), dialog);
1645              HILDON_BUTTON_ARRANGEMENT_VERTICAL,  
1646              _("Geotext"),      g_signal_connect(button, "clicked",
1647              _("Text analysis"));                       menu_entries->activate_cb, appdata);
1648    g_signal_connect(button, "clicked",  
1649                     G_CALLBACK(cb_menu_geotext), appdata);      gtk_table_attach_defaults(GTK_TABLE(table),  button, x, x+1, y, y+1);
1650    hildon_app_menu_append(menu, GTK_BUTTON(button));  
1651        x++;
1652        if(x == COLUMNS) { x = 0; y++; }
1653    
1654    button = hildon_button_new_with_text(      menu_entries++;
1655              HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH,    }
             HILDON_BUTTON_ARRANGEMENT_VERTICAL,  
             _("Precise Position"),  
             _("Calculate a precise GPS position"));  
   g_signal_connect(button, "clicked",  
                    G_CALLBACK(cb_menu_precpos), appdata);  
   hildon_app_menu_append(menu, GTK_BUTTON(button));  
1656    
1657    gtk_widget_show_all(GTK_WIDGET(menu));    gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox), table);
1658    
1659    return GTK_WIDGET(menu);    return dialog;
1660  }  }
1661    
1662    /* popup the dialog shaped submenu */
1663    static void submenu_popup(GtkWidget *menu) {
1664      gtk_widget_show_all(menu);
1665      gtk_dialog_run(GTK_DIALOG(menu));
1666      gtk_widget_hide(menu);
1667    }
1668    
1669    static void submenu_cleanup(GtkWidget *menu) {
1670      gtk_widget_destroy(menu);
1671    }
1672    
1673    static const menu_entry_t submenu_export_entries[] = {
1674      { "Export to Maemo Mapper" , "Save a Maemo Mapper POI file",
1675        G_CALLBACK(cb_menu_export_mmpoi)  },
1676      { "Export Field Notes",      "Save a Garmin Field Notes file",
1677        G_CALLBACK(cb_menu_export_log)    },
1678      { "Export Garmin GPX",       "Save modified waypoints in GPX file",
1679        G_CALLBACK(cb_menu_export_garmin) },
1680      { NULL, NULL, NULL }
1681    };
1682    
1683    static const submenu_t submenu_export = {
1684      "Export", submenu_export_entries,
1685      sizeof(submenu_export_entries)/sizeof(menu_entry_t)-1
1686    };
1687    
1688    /* the export submenu */
1689    void on_export_clicked(GtkButton *button, appdata_t *appdata) {
1690      if(!appdata->export_menu)
1691        appdata->export_menu = app_submenu_create(appdata, &submenu_export);
1692    
1693      submenu_popup(appdata->export_menu);
1694    }
1695    
1696    static const menu_entry_t submenu_tools_entries[] = {
1697      { "Geomath",          "Geocoordinate calculation",
1698        G_CALLBACK(cb_menu_geomath) },
1699      { "Geotext",          "Text analysis",
1700        G_CALLBACK(cb_menu_geotext) },
1701      { "Precise Position", "Calculate a precise GPS position",
1702        G_CALLBACK(cb_menu_precpos) },
1703      { NULL, NULL, NULL }
1704    };
1705    
1706    static const submenu_t submenu_tools = {
1707      "Tools", submenu_tools_entries,
1708      sizeof(submenu_tools_entries)/sizeof(menu_entry_t)-1
1709    };
1710    
1711  /* the tools submenu */  /* the tools submenu */
1712  void on_tools_clicked(GtkButton *button, appdata_t *appdata) {  void on_tools_clicked(GtkButton *button, appdata_t *appdata) {
1713    if(!appdata->tools_menu)    if(!appdata->tools_menu)
1714      appdata->tools_menu = tools_menu_create(appdata);      appdata->tools_menu = app_submenu_create(appdata, &submenu_tools);
1715    
1716    /* draw a popup menu */    submenu_popup(appdata->tools_menu);
   hildon_app_menu_popup(HILDON_APP_MENU(appdata->tools_menu),  
                         GTK_WINDOW(hildon_window_stack_peek(  
                     hildon_window_stack_get_default())));  
1717  }  }
1718    
   
1719  HildonAppMenu *menu_create(appdata_t *appdata, int mode) {  HildonAppMenu *menu_create(appdata_t *appdata, int mode) {
1720    GtkWidget *button;    GtkWidget *button;
1721    HildonAppMenu *menu = HILDON_APP_MENU(hildon_app_menu_new());    HildonAppMenu *menu = HILDON_APP_MENU(hildon_app_menu_new());
# Line 1668  HildonAppMenu *menu_create(appdata_t *ap Line 1741  HildonAppMenu *menu_create(appdata_t *ap
1741      g_signal_connect_after(button, "clicked",      g_signal_connect_after(button, "clicked",
1742                             G_CALLBACK(cb_menu_adddir), appdata);                             G_CALLBACK(cb_menu_adddir), appdata);
1743      hildon_app_menu_append(menu, GTK_BUTTON(button));      hildon_app_menu_append(menu, GTK_BUTTON(button));
   }  
1744    
   if(mode == MENU_GPXLIST) {  
1745      button = gtk_button_new_with_label(_("Export"));      button = gtk_button_new_with_label(_("Export"));
1746      g_signal_connect_after(button, "clicked",      g_signal_connect_after(button, "clicked",
1747                             G_CALLBACK(on_export_clicked), appdata);                             G_CALLBACK(on_export_clicked), appdata);
# Line 1687  HildonAppMenu *menu_create(appdata_t *ap Line 1758  HildonAppMenu *menu_create(appdata_t *ap
1758                           G_CALLBACK(on_tools_clicked), appdata);                           G_CALLBACK(on_tools_clicked), appdata);
1759    hildon_app_menu_append(menu, GTK_BUTTON(button));    hildon_app_menu_append(menu, GTK_BUTTON(button));
1760    
1761    #ifdef ENABLE_OSM_GPS_MAP
1762      if((mode == MENU_GPXLIST) || (mode == MENU_CACHELIST)) {
1763        button = gtk_button_new_with_label(_("Map"));
1764        g_signal_connect_after(button, "clicked",
1765                               G_CALLBACK(cb_menu_map), appdata);
1766        hildon_app_menu_append(menu, GTK_BUTTON(button));
1767      }
1768    #endif
1769    
1770  #ifdef HILDON_HELP  #ifdef HILDON_HELP
1771    button = gtk_button_new_with_label(_("Help"));    button = gtk_button_new_with_label(_("Help"));
1772    g_signal_connect_after(button, "clicked",    g_signal_connect_after(button, "clicked",
# Line 1799  void menu_create(appdata_t *appdata) { Line 1879  void menu_create(appdata_t *appdata) {
1879    
1880    gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new());    gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new());
1881    
1882    #ifdef ENABLE_OSM_GPS_MAP
1883      item = gtk_menu_item_new_with_label( _("Map") );
1884      gtk_menu_append(GTK_MENU_SHELL(menu), item);
1885      g_signal_connect(item, "activate",
1886                       GTK_SIGNAL_FUNC(cb_menu_map), appdata);
1887    #endif
1888    
1889    item = gtk_menu_item_new_with_label(_("Tools"));    item = gtk_menu_item_new_with_label(_("Tools"));
1890    gtk_menu_append(GTK_MENU_SHELL(menu), item);    gtk_menu_append(GTK_MENU_SHELL(menu), item);
1891    submenu = gtk_menu_new();    submenu = gtk_menu_new();
# Line 1863  void cleanup(appdata_t *appdata) { Line 1950  void cleanup(appdata_t *appdata) {
1950    if(appdata->image_path) free(appdata->image_path);    if(appdata->image_path) free(appdata->image_path);
1951    if(appdata->search_str) free(appdata->search_str);    if(appdata->search_str) free(appdata->search_str);
1952    
1953    #ifdef USE_STACKABLE_WINDOW
1954      if(appdata->export_menu) submenu_cleanup(appdata->export_menu);
1955      if(appdata->tools_menu)  submenu_cleanup(appdata->tools_menu);
1956    #endif
1957    
1958    gnome_vfs_shutdown();    gnome_vfs_shutdown();
1959    icons_free();    icons_free();
1960    gps_release(appdata);    gps_release(appdata);
# Line 1891  void cleanup(appdata_t *appdata) { Line 1983  void cleanup(appdata_t *appdata) {
1983    puts("everything is gone");    puts("everything is gone");
1984  }  }
1985    
1986  void on_window_destroy (GtkWidget *widget, gpointer data) {  static void on_window_destroy (GtkWidget *widget, gpointer data) {
1987    appdata_t *appdata = (appdata_t*)data;    appdata_t *appdata = (appdata_t*)data;
1988    
1989    gconf_save_state(appdata);    gconf_save_state(appdata);
# Line 2234  int main(int argc, char *argv[]) { Line 2326  int main(int argc, char *argv[]) {
2326    
2327    appdata.vbox = gtk_vbox_new(FALSE, 2);    appdata.vbox = gtk_vbox_new(FALSE, 2);
2328    gtk_container_add(GTK_CONTAINER(appdata.window), appdata.vbox);    gtk_container_add(GTK_CONTAINER(appdata.window), appdata.vbox);
   
2329  #ifndef USE_STACKABLE_WINDOW  #ifndef USE_STACKABLE_WINDOW
2330    menu_create(&appdata);    menu_create(&appdata);
2331  #else  #else

Legend:
Removed from v.21  
changed lines
  Added in v.113